Dynamic recipe name

It is possible to add "variables" in code and then use them in platform.txt? To dynamically change recipe output filename, like this:

from platform.txt file:

Save hex

recipe.output.tmp_file={build.project_name}.bin
recipe.output.save_file={my_variable_from_code}.bin

instead original version

Save hex

recipe.output.tmp_file={build.project_name}.bin
recipe.output.save_file={build.project_name}.bin

yes.

take a look at sprintf() to format your "filename"

No. It's not possible to do that. The closest thing you could get to that is a custom Tools menu that allows you to select from a list of names defined in boards.txt.

Why do you want to do this?

Beacause I have few project variations based on the same code. Code has preprocessor statements based on actual choosed board. So I want to compile version for board1 and get recipe named: my_project_board1.bin next change board setting to board2, and get file named: my_project_board2.bin

pert:
No. It's not possible to do that. The closest thing you could get to that is a custom Tools menu that allows you to select from a list of names defined in boards.txt.

Why do you want to do this?

I believe you could use the custom Tools menu to set the preprocessor macros via -D compiler flags and set the .hex filename at the same time. Probably not the solution you were hoping for but I think it's as close as you'll get within the Arduino IDE.