Determining output file type for objcopy from platform.txt

I am developing a make-based arduino build process that uses platform.txt and
boards.txt to determine how to compile/, ink, etc

This works fine for the basic arduino/avr architecture.

I am now trying to use the same tool for esp32.

What I cannot figure out is how to determine the binary format
generated by objcopy and required for upload.

With the standard arduino architecture the objcopy definition is
provided by:
recipe.objcopy.hex.pattern

which generates a .hex file

For the esp32 it is:
recipe.objcopy.bin.pattern

which generates a .bin file

My question is:

How can I determine the objcopy pattern if I don't know the file
format? How do I know which recipe entry to use?

Or, perhaps simpler, how can I tell that the file format is .bin, rather than
.hex?

I can see all sorts of hacky ways to do this, but there must be a "proper" way and it is eluding me. Can anyone please shed any light?

Thanks.

all recipes should be executed

I'm assuming that you mean that the format and naming of the files is not relevant and that I should just execute every recipe in the platform.txt file.

Can you explain how the ordering of recipes is determined? There appears to be no dependency information defined.

I guess the ordering should not matter

The ordering is critical: If you do the objcopy before the link, your binary will not be up to date.

Also, compilation must happen before linking. Objcopy must happen before upload, etc.

There are lots of dependencies, but none are defined.

I'm guessing they must be hard-coded into the ide and cli, which would be disappointing.

I was talking about execution ordering of recipe.objcopy. recipes