1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
.\" Automatically generated by Pandoc 2.2.1
.\"
.TH "MAKEPARALLEL" "1" "" "" ""
.hy
.SH NAME
.PP
makeparallel \- command line tool for communication with the GNU make
jobserver
.SH SYNOPSIS
.PP
To run a multi\-thread or multi\-process binary inside GNU make using
makeparallel, add:
.IP
.nf
\f[C]
\ \ \ \ +makeparallel\ subprocess\ arguments
\f[]
.fi
.PP
to a rule.
For example, to wrap ninja in make, use something like:
.IP
.nf
\f[C]
\ \ \ \ +makeparallel\ ninja\ \-f\ build.ninja
\f[]
.fi
.PP
To determine the size of the jobserver pool, add:
.IP
.nf
\f[C]
\ \ \ \ +makeparallel\ echo\ >\ make.jobs
\f[]
.fi
.PP
to a rule that is guarantee to run alone (i.e.\ all other rules are
either dependencies of the makeparallel rule, or the depend on the
makeparallel rule.
The output file will contain the \f[C]\-j<num>\f[] flag passed to the
parent make process, or \f[C]\-j1\f[] if no flag was found.
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.
Instead, use a shell substitution to read the output file directly in a
recipe.
For example:
.IP
.nf
\f[C]
\ \ \ \ echo\ Make\ was\ started\ with\ $$(cat\ make.jobs)
\f[]
.fi
.SH DESCRIPTION
.PP
\f[C]makeparallel\f[] communicates with the GNU make
jobserver (http://make.mad-scientist.net/papers/jobserver-implementation/)
in order claim all available jobs, and then passes the number of jobs
claimed to a subprocess with \f[C]\-j<jobs>\f[].
.PP
The number of available jobs is determined by reading tokens from the
jobserver until a read would block.
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 \f[C]\-j\f[].
Any jobs running in parallel with with the makeparellel rule will reduce
the measured value, and thus reduce the parallelism available to the
subprocess.
.SH AUTHORS
The Android Open Source Project.
|