hi,
A precise way would be to use a dual comparator IC, each comparator circuit driving a transistor/relay.
When the main battery is less than 13.5V its comp/relay is ON, charging the main battery.
As it reaches 13.5V, comp/relay #2 secondary battery charge circuit is Enabled.
If the secondary battery is less than 13.5V, the secondary battery starts to charge.
Should the main battery fall below 13.5V then it will disable the secondary comparator.
You will need to add hysteresis to the comparators to prevent the relays from chattering at the 13.5V switch over point.
OK.?