Skip to content
Latchkey

make Command Reference

Build targets from a Makefile by resolving their dependencies.

make reads a Makefile and builds targets whose prerequisites are newer than their outputs. It is the default task runner in countless CI pipelines.

What it does

make evaluates the dependency graph in a Makefile and runs each recipe whose target is out of date relative to its prerequisites. Run bare it builds the first (default) target; given a target name it builds just that one.

Common flags and usage

  • (none): build the first target in the Makefile
  • TARGET: build a specific target by name
  • -f FILE: use a Makefile other than ./Makefile
  • VAR=value: override a Makefile variable on the command line
  • -k: keep going after an error to surface all failures

Example

shell
- name: Build
  run: make build

- name: Test
  run: make test VERBOSE=1

In CI

Pin the toolchain (compiler, make version) so out-of-date detection behaves identically across runners. Override variables on the command line (VAR=value) to parameterize a build without editing the Makefile.

Key takeaways

  • Bare make builds the first target; pass a name to build a specific target.
  • make only rebuilds targets older than their prerequisites.
  • Override Makefile variables with VAR=value on the command line.

Related guides

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