[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transfering parallelism to sub-makes explicitly

From: Paul Smith
Subject: Re: Transfering parallelism to sub-makes explicitly
Date: Thu, 31 Jan 2008 14:32:00 -0500

On Thu, 2008-01-31 at 19:20 +0000, David Wuertele wrote:
> I want total control over all build command environments, including for
> sub-makes, so I followed Paul Smith's advice (see
> with this
> line at the head of my makefile:
>   unexport $(.VARIABLES)
> This works great for me, except for one situation:  I can't figure out how to
> explicitly pass down my "-j N" values to submakes.

I don't see how this has anything to do with unexport, or obtaining
"total control over all build command environments"?

> There doesn't seem to be a single make variable which contains the
> value of "N".  I would like to do something like this:

>   target:
>           $(MAKE) -j $(SOMEVARIABLE) target
> How do I set SOMEVARIABLE so that my sub-make gets the same "-j N" that the
> top-level got?

Why do you want to do this?  This is not how make's jobserver is
designed to work.  If you do this then you will get an exponential
increase in the number of jobs running: the top level will invoke N
submakes, and each of those submakes will invoke N jobs so you really
have N*N jobs running.  If the submakes invoke make as well, you get
another N jobs running there.  Basically you'll have N jobs in every
directory, all running in parallel.

You should just NOT add any -j option to the command line.  Just use

In this mode GNU make starts a "jobserver", where all the make instances
communicate and allow only exactly N jobs to be running at any one time,
across all the subdirectories.  You just want:

                $(MAKE) $@

or whatever.

 Paul D. Smith <address@hidden>       
 "Please remain calm--I may be mad, but I am a professional."--Mad Scientist

reply via email to

[Prev in Thread] Current Thread [Next in Thread]