DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
make

Parallel make

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.c
For 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(CP) and yacc(CP).

To prevent make from building x.o and y.o in parallel, the makefile above would contain a .MUTEX directive of the form:

   .MUTEX: x.o y.o

Next topic: Recursive makefiles
Previous topic: Basic features

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003