|
|
If make is invoked with the -P option, it tries to build more than one target at a time, in parallel. (This is done by using the standard UNIX system process mechanism which enables multiple processes to run simultaneously.)
prog : x.o y.o z.o cc x.o y.o z.o -lm -o prog x.o : x.c defs.h cc -c x.c y.o : y.c defs.h cc -c y.c z.o : z.c cc -c z.cFor the makefile shown above, it would create processes to build x.o, y.o and z.o in parallel. After these processes were complete, it would build prog.
The number of targets make will try to build in parallel is determined by the value of the environment variable PARALLEL. If -P is invoked, but PARALLEL is not set, then make will try to build no more than two targets in parallel.
You can use the .MUTEX directive to serialize
the updating of some specified targets.
This is useful when two or more targets modify a common output file,
such as when inserting modules into an archive
or when creating an intermediate file with the same name,
as is done by lex and yacc.
If the makefile above contained a .MUTEX directive of the form
.MUTEX: x.o y.oit would prevent make from building x.o and y.o in parallel.