On Wed, Dec 12, 2012 at 09:32:23AM -0600, Kent R. Spillner wrote:
> Hey, dude-
> 
> On Dec 12, 2012, at 7:51, David Coppa <dco...@gmail.com> wrote:
> > Thanks.
> > I'll wait for useful pointers...
> 
> I don't think CMake does anything specifically to handle parallel recursive 
> builds.  It works with GNU make because when invoked with -jX the top level 
> gmake sets some environment variables (it adds -j to MAKEFLAGS, but i think 
> it uses some others for job control, too) so sub-makes pick that up in 
> parallel builds and CMake doesn't need to explicitly write -j$((X - 1)) in 
> targets invoking sub-makes.
> 
> How does our make handle parallel job control between recursive invocations?

Our make passes -j through MAKEFLAGS.

The way it handles recursive invocation is documented. Read the end of
make(1):

     In parallel mode, -j n only limits the number of direct children of make.
     During recursive invocations, each level may multiply the total number of
     processes by n.  However, make includes some heuristics to try to prevent
     catastrophic behavior: if a command is marked as expensive, or preceded
     by `+', or seems to invoke a program that looks sufficiently like `make',
     make will assume recursive invocation, and not start any new process
     until said command has finished running.  Thus the number of processes
     run directly or indirectly by make will increase linearly with each level
     of recursion instead of exponentially.

Reply via email to