MAKEPARALLEL(1)
β¨ MAKEPARALLEL β¨
okay bestie, so this is makeparallel β a command line tool for communication with the GNU make jobserver. yes, that jobserver. the one that's been gatekeeping your parallelism this whole time. we're talking to it now. we're being friends with it. π
πΈ SYNOPSIS πΈ
so like, to run a multi-thread or multi-process binary inside GNU make using makeparallel, you add:
+makeparallel subprocess arguments
to a rule. for example, to wrap ninja in make, use something like:
+makeparallel ninja -f build.ninja
and to determine the size of the jobserver pool, add:
+makeparallel echo > make.jobs
to a rule that is guaranteed to run alone (i.e. all other rules are either dependencies of the makeparallel rule, or they depend on the makeparallel rule). the output file will contain the -j<num> flag passed to the parent make process, or -j1 if no flag was found. π
now here's the tea: since GNU make will run makeparallel during the execution phase, after all variables have been set and evaluated, it is not possible to get the output of makeparallel into a make variable. so instead, use a shell substitution to read the output file directly in a recipe. for example:
echo Make was started with $$(cat make.jobs)
periodt. π
π¦ DESCRIPTION π¦
makeparallel communicates with the GNU make jobserver (http://make.mad-scientist.net/papers/jobserver-implementation/) in order to claim all available jobs, and then it passes the number of jobs claimed to a subprocess with -j<jobs>.
the number of available jobs is determined by reading tokens from the jobserver until a read would block. so if the makeparallel rule is the only one running, the number of jobs will be the total size of the jobserver pool, i.e. the value passed to make with -j. slay. but any jobs running in parallel with the makeparallel rule will reduce the measured value, and thus reduce the parallelism available to the subprocess. it's giving sharing the aux cord. π
π AUTHORS π
The Android Open Source Project.
and that's the whole vibe check, bestie β makeparallel(1), brought to you by the iconic humans of the Android Open Source Project, forever and always. go claim your tokens. π«Άβ¨
π¦ where this page comes from
- debian bookworm: makeparallel 1:10.0.0+r36-1 Β· Apache-2.0
- debian trixie: makeparallel 1:10.0.0+r36-1.1 Β· Apache-2.0
- ubuntu jammy: makeparallel 1:10.0.0+r36-1 Β· Apache-2.0
- ubuntu noble: makeparallel 1:10.0.0+r36-1ubuntu2 Β· Apache-2.0
- ubuntu questing: makeparallel 1:10.0.0+r36-1.1
- ubuntu resolute: makeparallel 1:10.0.0+r36-1.1build1 Β· Apache-2.0
- ubuntu stonking: makeparallel 1:10.0.0+r36-1.1build1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms