The Make build system
In this section, we will explore the Make build system, from its basic concepts to practical usage in firmware development.
The basics of Make
The primary component of the make
build system is the Makefile, which contains a set of directives used by the tool to generate a target. At its core, a Makefile consists of rules. Each rule begins with a target, followed by prerequisites, and then a recipe:
- Target: This is typically the name of the file that the rule generates – in other words, the output file that needs to be generated, such as
main.o
orapp.exe
. The target can also be the name of the action to carry out. - Prerequisites: These are the source files needed to create the target (e.g.,
main.c
andadc.c
). - Recipes: The recipe is a series of commands that
make
executes in order to build the target.
The following diagram illustrates a simple make rule:
Figure 5.1: A Make rule, with main.o as the...