How can I use a single platform.txt for two of my custom boards.

I have a custom board which has an Atmega 328 and esp module on it. I don't require any platform.txt for Atmega because the arduino ide uses the default path for it and for esp there is a specific platform.txt file.
Now I wanted to merge these two into a single file and to do that I have to have a single platform.txt file which defines the path for both the esp and Atmega. How can I do that???? can I use marcos such as #ifdef and tell the platform.txt to run that particular code when esp is selected and do nothing when Atmega is selected?

Don't ask the same question in multiple places - I think I have seen three, already.


Also posted at:

If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information. When you post links please always use the chain links icon on the toolbar to make them clickable.

@haarism19, do not cross-post. Other post removed.

@haarism19, stop cross-posting. Threads merged.

Okay my bad, I just wanted to solve this issue asap. Thank you for merging it. I will not repeat this mistake