Build Process / Makefile / IDE Settings

Hello,

Does anyone know (or have a good link) how the compile process works with regards to taking the settings in the software environment (Target controller, COM port, etc) and then compiling/linking?

Is there a new Makefile that is generated for each project, every time a build occurs? I have to assume that the Arduino IDE takes these settings and constructs a new Makefile but I would like to confirm.

Does anyone know if/how/where this is where things like AVR_ATmega1280 are defined?

Is main.cpp modified during the build process to #include "iom328.h" etc?

Thanks!

dimitri:
Does anyone know (or have a good link) how the compile process works with regards to taking the settings in the software environment (Target controller, COM port, etc) and then compiling/linking?

It is documented here:

Those pages are hosted with the Arduino CLI documentation because the Arduino CLI codebase is now where all that is implemented. The other official Arduino development tools (Arduino IDE, Arduino Web Editor, Arduino Pro IDE) use Arduino CLI under the hood for the build process.

dimitri:
Is there a new Makefile that is generated for each project, every time a build occurs? I have to assume that the Arduino IDE takes these settings and constructs a new Makefile but I would like to confirm.

Make is not used at all by the Arduino development software for compiling sketches. So the answer is no.

dimitri:
Does anyone know if/how/where this is where things like AVR_ATmega1280 are defined?

It doesn't help for this particular macro, but it might still be helpful information so I'll share it: A trick I use to find the location where macros are defined is to add a definition of the macro to my sketch defining it to some value I know is different from the original. Then turn on compilier warnings in File > Preferences > Compiler warnings and compile the sketch. After the compilation finishes, examine the contents of the black console pane at the bottom of the Arduino IDE window. You'll find a warning that shows the location of the original define.

dimitri:
Is main.cpp modified during the build process to #include "iom328.h" etc?

No. main.cpp is never modified.

boards.txt
uno.build.mcu=atmega328p
goes to platform.txt to avr-gcc command line argument
-mmcu={build.mcu}

Does anyone know if/how/where this is where things like AVR_ATmega1280 are defined?

Is main.cpp modified during the build process to #include "iom328.h" etc?

That particular symbol is set by the compiler as a result of the -mmcu switch on the compile command line.
Source code eventually includes “avr/io.h”, and it pulls in iom328.h as a result of the proper __AVR symbol.
These are both NOT arduino things; they’re standard usage for avr-gcc