Skip to content
Latchkey

make -j (Parallel Builds) Command Reference

Run independent recipes in parallel to cut wall-clock build time.

make -j runs multiple recipes concurrently. It is the simplest way to use all of a runner core count, with two CI caveats: memory pressure and interleaved logs.

What it does

make -jN runs up to N recipes at once, respecting the dependency graph so only independent targets run in parallel. With no number, -j runs unlimited jobs, which can overwhelm a runner.

Common flags and usage

  • -jN: run up to N jobs in parallel
  • -j (no number): unlimited parallelism (use with care)
  • -l LOAD: also cap by system load average
  • -O / --output-sync: keep each target output un-interleaved

Example

shell
- name: Parallel build
  run: make -j"$(nproc)" --output-sync=target build

In CI

Size -j to the runner: make -j"$(nproc)" uses every core. Heavy C/C++ links can exhaust memory at full core count, so cap -j below nproc on memory-limited runners. Add --output-sync=target so parallel logs stay readable.

Key takeaways

  • -jN runs independent recipes in parallel; bare -j is unbounded.
  • make -j"$(nproc)" matches parallelism to runner cores.
  • Cap -j on memory-limited runners and use --output-sync for readable logs.

Related guides

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