A build system turns source files into something that runs: it decides what to compile, in which order, with which flags, and what it can skip because nothing changed. A good one is fast, correct and repeatable, so the same inputs give the same output on your machine, a colleague's and a server.
Key concepts
- Dependency graph: targets depend on inputs and on each other; the tool walks the graph in order.
- Incremental builds: rebuild only what changed, which needs every input to be declared.
- Reproducibility: pinned tools and dependencies, and no hidden state from the environment.
- Dependency management: fetching libraries at fixed versions, with checks of what was fetched.
- Caching and parallelism: independent steps run at once, and results are reused.
Vocabulary
- Target: something to build, such as a library or a binary.
- Artifact: the file a build produces.
- Make: the classic tool built around rules and timestamps.
- Lock file: a record of the exact versions a build used.
What to study, in order
- Write a Makefile by hand for a small C project, with header dependencies.
- Read the compiler and linker commands your build runs and explain each flag.
- Use your language's standard build tool, and inspect how it resolves dependencies.
- Make a build reproducible: pin everything, build twice and compare the results byte for byte.
- Try a build tool with a strict dependency graph and see what breaks when an input is undeclared.