[Top][All Lists]

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

Re: How to restrict parallelism in make? [PATCH]

From: Alexey Neyman
Subject: Re: How to restrict parallelism in make? [PATCH]
Date: Tue, 10 May 2005 15:50:29 +0400
User-agent: KMail/1.6.2


On Wednesday 04 May 2005 11:16, Boris Kolpackov wrote:
> This is all problems of recursive build systems. You hide full 
> dependency information and as a result problems pop up from time to 
> time. In recursive builds there are no such things as "worked
> around" or "serialize targets artificially"; it is one big work
> around with alot of targets serialized artificially. I think
> solutions proposed above are quite adequate. Normally 
> I would create a separate makefile for targets (other than
> sub-directories) in current directory.

I have also read the "recursive make considered harmful" article. 
However, recursive builds are very common: even the GNU make itself 
uses recursive build system. Therefore, I think adding this feature 
would be helpful for such projects.

Yes, recursion hides the dependency information from make and it is 
the right place for the human to intervene: it is programmer who 
knows that "directories FOO and BAR must be built first in order for 
directories BAZ and BUM to be built; however both FOO+BAR and BAZ+BUM 
directories may be safely built in parallel; and local targets need 
to be made last".

> What happens if I have this makefile:
> foo: bar .WAIT baz
> fox: bar baz
> When I say 'make fox' is serialization still there?

[ the rest of similar examples skipped ]

I understand your concern for asymmetry of this solution. I guess that 
the notion of "the baz target shall always wait for all dependencies 
coming before it to be complete" is rather uncommon. However, if you 
feel it is needed, it will be easy to add support for it. E.g. it 
could look like:

foo fox: bar baz
.WAIT: baz

> IMO, the proper mechanism for something like this (which, I think, 
> is not necessary, as stated above) would be to further relax
> order-only prerequisites model by removing the requirement of
> actually building such prerequisites (aka, "truly" order-only ;-)).
> Something along these lines:
> foo: bar baz
> bar: * baz

Using asterisk as a delimiter is not a good idea: it will be expanded. 
I guess the following syntax would be better:

<target>: <normal deps> | <no-mtime deps> | <order-only deps>

However, this will still suffer from the drawback I mentioned in the 
original message: such "truly order-only" dependency will have to be 
added to each and every rule. Worse yet, to implicit rules as well - 
which will render this enhancement nearly unusable.

Moreover, as I had mentioned, this syntax is available in BSD make - 
why shall we introduce gratuituous differences?


And a dishonorable Queen is NO QUEEN AT ALL!
                        -- Yehat, SC2

reply via email to

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