On Mon, Jul 27, 2009 at 9:12 AM, John Breitenbach<[email protected]> wrote: > Is there anything I can put in my makefile to specify a default number of > jobs? > > I think I see a path where I can test MAKEFLAGS and then perhaps invoke a > submake with the desired -j something. > I hoping for something like: > > # this makefile has been tested for and is known to build reliably for up to > 6 simultaneous jobs. > .MAKE_JOBS := 6 > > And with this capability, and identifying the jobs flag from the command > line, you can implement a max or min number of jobs.
The short answer is no - AFAIK there's no such facility, though as you say it should be possible to check the command line and re-invoke with "-j $(MAKE_JOB_DEFAULT)" if no -j flag is present. Beyond that I'd say your hypothetical feature is logically flawed. A piece of code, whether it be a Makefile or a C++ class, is rarely "safe for up to N jobs". Generally it's either threadsafe or it's not and if it is, the appropriate number of parallel threads/jobs is generally a function of available resources. In other words, given that the same build might be run on a developer's workstation during the day and on a massively parallel server during the nightly build, who's to say what the "right" amount of parallelism is? I think it's by design that the decision is made at runtime via a command line flag rather than wired into the Makefile. Also, if there was to be such a feature it should encompass --load-average too, because that's another aspect of available resources. David Boyce _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
