bug-make
[Top][All Lists]
Advanced

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

Re: Parallel Build, but Not for the Command-Line Targets.


From: Ralph Corderoy
Subject: Re: Parallel Build, but Not for the Command-Line Targets.
Date: Sun, 24 Aug 2014 12:33:41 +0100

Hi Paul,

> > It seems a design flaw that I must
> > 
> >     make -sj clean && make -sj all && make -sj check &&
> >     make -sj install
> 
> Well, that's because you're only considering this use-case,

Yes, but it's an idiomatic one, oft suggested;  "Unpack and run
`./configure && make all check install'".

> But, if you consider something like:
> 
>     make prog1 prog2 prog3 prog4
> 
> then it's clearly a design flaw if these programs are built serially.

Oh sure, I wasn't trying to suggest that it's never wanted, just that
the binary -j doesn't seem sufficient to cover common cases.

> There is no easy way to do this in GNU make today.
> 
> You can play some tricks with MAKECMDGOALS; something like this:
> 
>     all: $(filter clean,$(MAKECMDGOALS))
> 
>     clean::
> 
>     check:: $(filter all,$(MAKECMDGOALS))
> 
>     install:: $(filter check,$(MAKECMDGOALS))

That doesn't work for a few reasons.  It needs to be more noisy to avoid
--warn's `undefined';  something like the untested

    all: $(filter clean,$(if $(filter undefined,$(origin 
MAKECMDGOALS)),,$(MAKECMDGOALS)))

Double-colon targets are treated as independent for the same target, so
I have to stick that dependency on every `check::', I can't just do it
once to have it affect all of them;  more noise.

And it's based on this particular use-case.  ;-)  If a previous build
went well then `make -j install clean all check' to get me going again
will re-order to `clean all check install'.  (I often find tests on
MAKECMDGOALS fail to consider order.)

The `make -j clean .WAIT all .WAIT check .WAIT install' of other makes
is no better;  who wants to type that?  It would seem a -J that's just
like -j except for the MAKECMDGOALS targets is nicest for the user for
this common case.  Perhaps `--' is a less noisy .WAIT, though still not
great.

A pseudo-target could allow targets that cannot be built in parallel to
be specified, `.SEQUENTIAL: all clean check install', though that may be
too coarse-grained in that sometimes they can be built in parallel with
some others, just not all others.  But it would allow shipped makefiles
to work with a user's -j without them having to know to switch to -J.

I think an all-encompassing solution needs thought, but a -J seems
useful.  What do you think?

Cheers, Ralph.



reply via email to

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