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 buildIn 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
make Command ReferenceReference for make in CI/CD: how make reads a Makefile, builds the default or a named target, and which envir…
make -C (Directory) Command ReferenceReference for make -C in CI/CD: change into a directory before reading its Makefile, the clean way to build a…
make Targets Command ReferenceReference for make targets in CI/CD: what a target is, how to run several in one invocation, and how to disco…