Vocabulary
Build system: Automates program configuration, compilation, testing, and flashing. Handles dependencies and build order automatically.
Make: One of the most widespread build systems available. Very powerful and very fast, but can be very confusing to learn and use.
Makefile: Special file that defines a set of rules. This is processed by Make to determine what needs to be done to reach a specified goal, such as dependency generation or source compilation.
Non-recursive make: A build system that runs with a single instance of make instead of recursively creating new make instances per directory. Results in improved dependency detection, less boilerplate, and less overhead.
Overview
Our build system is built on non-recursive make. The basic structure of our build system looks like this:
Folder/File | Purpose |
---|---|
build | Contains build output |
libraries | Each folder within the libraries folder represents a library that can be used as a dependency. Each library must have a rules.mk in their root directory that defines their search paths and dependencies. |
platforms | Each folder within the platforms folder represents a platform that projects can be compiled against. Each platform must have a platform.mk in their root directory that defines their toolchain and default flags. |
projects | Each folder within the projects folder represents a project. Each project must have a rules.mk in their root directory that defines their search paths and dependencies, the same way libraries do. |
make | Contains shared makefiles. These should be included in the root makefile with $(TARGET) and $(TARGET_TYPE) defined. The generic build makefile generates the rules for libraries and projects to create static libraries and applications respectively. The build test makefile generates the rules for generating test runners for all unit tests in the specified library or project. |
Makefile | The main makefile. Its main purpose is to include the correct makefiles and validate input. |