Go Down

Topic: The Arduino Build Process should use a Makefile (Read 410 times) previous topic - next topic

merox

Hello there,

I have several use-cases where I need more control over the build process and the Arduino standard build just doesn't cut it. Then I think: just extend the Makefile and re-run the build. But there is no Makefile. So my suggestion is this:

The Arduino Build Process should use a Makefile

When I first used the Arduino IDE I thought it created and ran a Makefile in the background. I was surprised when I found out that this is not the case. Having a Makefile has a lot of advantages: it makes the build process more transparent. It makes the build process more modular. It makes it easier to edit/customize the build process.

Here's how the suggestion looks like in detail:
  • The Arduino IDE creates a scratch directory and copies the core modules and libraries into that directory
  • The Arduino IDE performs additional preparation steps such as adding #include statements and creating the actual main.c file based on the scratch
  • The Arduino IDE generates a Makefile which builds all of the source files (core, libraries, sketch) and the HEX file. The Makefile should have two targets: "compile" and "program". Those targets are linked to the buttons "verify" and "upload" in the IDE.
  • Finally, the Arduino IDE runs the Makefile

And the best thing is: the user will not notice that you have replaced the underlying build mechanism.

Delta_G

|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

pert

Here's a feature request for this in the issue tracker:
https://github.com/arduino/Arduino/issues/7528
I'm sure I've seen it in previous feature requests with discussion but this is the only one I found after a short search.

merox

Here's a feature request for this in the issue tracker:
https://github.com/arduino/Arduino/issues/7528
I'm sure I've seen it in previous feature requests with discussion but this is the only one I found after a short search.

Using CMake as a Makefile generator is even better. No need to re-invent the wheel and create yet another Makefile generator. Plus, CMake can create MS Visual Studio projects as well. I hope that gets implemented. Until then I will probably be using Makefiles.

Go Up