Skip to content
Latchkey

make Command: Run Builds in CI

make builds targets from rules in a Makefile, rebuilding only what changed.

make is the classic build automation tool, driving C/C++ builds and serving as a generic task runner across CI pipelines. It reads a Makefile, computes which targets are out of date, and runs their recipes.

Common flags

  • -j N - run up to N recipes in parallel (-j alone = unlimited)
  • -C DIR - change to DIR before reading the Makefile
  • -f FILE - use a non-default Makefile
  • -B / --always-make - rebuild all targets unconditionally
  • -k - keep going after a failed target (collect more errors)
  • VAR=value - override a Makefile variable on the command line
  • -n / --dry-run - print the recipes without running them

Example in CI

Run a parallel release build with a variable override in CI:

shell
make -j$(nproc) BUILD_TYPE=release

Common errors in CI

  • Makefile:NN: *** missing separator. Stop. - recipe indented with spaces, not a tab
  • make: *** No rule to make target 'X'. Stop. - target/prereq does not exist
  • make: *** [target] Error 1 - a recipe command exited non-zero
  • make: Nothing to be done for 'all' - targets already up to date (or wrong target)

Key takeaways

  • Use -j$(nproc) to parallelize builds across all runner cores.
  • The infamous "missing separator" error means a space instead of a tab.
  • Override variables inline (VAR=value) without editing the Makefile.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →