Skip to content
Latchkey

make: Usage, Options & Common CI Errors

make runs the recipe for a target, rebuilding only what its dependencies require.

make orchestrates builds and task running across countless projects. The two errors that define it in CI: the infamous tab-vs-spaces "missing separator", and "No rule to make target".

What it does

make reads a Makefile of target: prerequisites rules with TAB-indented recipes, and builds the requested target by running recipes for any prerequisite that is out of date. It is also widely used as a generic task runner.

Common usage

Terminal
make                           # build the first/default target
make test
make -j4                       # build with 4 parallel jobs
make -C subdir build           # run in another directory
make -f Custom.mk deploy
make --always-make             # force rebuild (ignore timestamps)

Options

FlagWhat it does
-j [N]Run N recipes in parallel
-C <dir>Change to dir before reading the Makefile
-f <file>Use a non-default makefile
-B / --always-makeRebuild all targets unconditionally
-n / --dry-runPrint recipes without running them
-kKeep going after a failed target

Common errors in CI

Makefile:N: * missing separator. Stop. - a recipe line is indented with spaces instead of a real TAB; editors and copy-paste silently convert them. "make: * No rule to make target "X". Stop." means the target or a prerequisite file does not exist (typo, or it was not generated). "make: *** [target] Error 2" just means a recipe command exited non-zero - scroll up for the real error. With -j, interleaved output makes failures harder to read; rerun with -j1 to isolate.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →