make: Parallel
1
1 5.4 Parallel Execution
1 ======================
1
1 GNU 'make' knows how to execute several recipes at once. Normally,
1 'make' will execute only one recipe at a time, waiting for it to finish
1 before executing the next. However, the '-j' or '--jobs' option tells
1 'make' to execute many recipes simultaneously. You can inhibit
1 parallelism in a particular makefile with the '.NOTPARALLEL'
1 pseudo-target (⇒Special Built-in Target Names Special Targets.).
1
1 On MS-DOS, the '-j' option has no effect, since that system doesn't
1 support multi-processing.
1
1 If the '-j' option is followed by an integer, this is the number of
1 recipes to execute at once; this is called the number of "job slots".
1 If there is nothing looking like an integer after the '-j' option, there
1 is no limit on the number of job slots. The default number of job slots
1 is one, which means serial execution (one thing at a time).
1
1 Handling recursive 'make' invocations raises issues for parallel
11 execution. For more information on this, see ⇒Communicating
Options to a Sub-'make' Options/Recursion.
1
1 If a recipe fails (is killed by a signal or exits with a nonzero
11 status), and errors are not ignored for that recipe (⇒Errors in
Recipes Errors.), the remaining recipe lines to remake the same target
1 will not be run. If a recipe fails and the '-k' or '--keep-going'
1 option was not given (⇒Summary of Options Options Summary.),
1 'make' aborts execution. If make terminates for any reason (including a
1 signal) with child processes running, it waits for them to finish before
1 actually exiting.
1
1 When the system is heavily loaded, you will probably want to run
1 fewer jobs than when it is lightly loaded. You can use the '-l' option
1 to tell 'make' to limit the number of jobs to run at once, based on the
1 load average. The '-l' or '--max-load' option is followed by a
1 floating-point number. For example,
1
1 -l 2.5
1
1 will not let 'make' start more than one job if the load average is above
1 2.5. The '-l' option with no following number removes the load limit,
1 if one was given with a previous '-l' option.
1
1 More precisely, when 'make' goes to start up a job, and it already
1 has at least one job running, it checks the current load average; if it
1 is not lower than the limit given with '-l', 'make' waits until the load
1 average goes below that limit, or until all the other jobs finish.
1
1 By default, there is no load limit.
1
Menu