Makefile Improvement Plan
- Dominant language
- C
- Stars
- 4k
- Forks
- 1.7k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 237
Description
Hi Folks, I've been working to improve the NuttX Makefiles over the last few weeks. See my contributions here: https://github.com/apache/incubator-nuttx/pulls?q=is%3Apr+is%3Aclosed+author%3AAlanRosenthal
Now that I'm more familiar with the codebase/Makefiles, I have some higher level thoughts on how to improve the Makefiles. This is a loose plan, but I'd appreciate any feedback / guidance!
Today, the configure and build stages are slightly intermingled. We should create a clear separation. This will both improve developer ergonomics, and will enable faster incremental builds.
My proposal is:
the **configure stage** is responsible for:
* Generating the .config file
* Setting up symlinks
* Extracting tar files if required
The **build stage** is responsible for:
* Generating the nuttx elf
* Generating the .a files that the nuttx elf requires
* Generating the .o files that the .a files require
* Generating the .c/.h files that the .o files require
* Running Post-build commands
The best way to isolate these stages, is to create separate Makefiles for the configure and build stage. For example, instead of the context rule existing in Unix.mk, it will exist in UnixConfigure.mk (or a better named file).
Any changes to the configuration stage, will first require a clean build, to ensure that everything is in the correct state.
Any changes to the build stage, will not require the configuration stage to be rerun.
cc @Ouss4 @xiaoxiang781216 @gustavonihei
Contributor guide
Assessment
This issue has not been assessed yet.