help-make
[Top][All Lists]
Advanced

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

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


From: Boris Kolpackov
Subject: Re: How to restrict parallelism in make? [PATCH]
Date: Wed, 4 May 2005 07:16:32 +0000 (UTC)
User-agent: nn/6.6.5+RFC1522

Alexey Neyman <address@hidden> writes:

> But if I add the install-subdir as an order-only prerequisite to all
> targets, as described above, this will cause "make install" executed
> in the subdirectories even in case of "make all" in the top-level
> directory. Well, this could be worked around by having
> 'install-subdir' target depend on 'all', but this way the
> subdirectories will be traversed twice: once for "make all" and once
> again for "make install". Alternatively, one could serialize the
> targets artificially (at a cost of extra instance of make running):

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.

Therefore, I personally would refrain from adding patches to GNU make for
the sole purpose of working around some problems in recursive builds
especially since other solutions are available.

Having said that I realize that recursive build systems are quite common
and the above argument might not buy. Therefore, here are some comments
on .WAIT.


> There, the special '.WAIT' target when listed as a dependency, acts as
> a "serializer": all dependencies _before_ it in the list are finished
> before any of those _after_ .WAIT are even started to be updated.
> With this, the above requirements could be supported easily:
>
> <<<<
> all: all-subdir .WAIT all-local
> install: install-subdir .WAIT install-local
> >>>>

What happens if I have this makefile:

foo: bar .WAIT baz
fox: bar baz

When I say 'make fox' is serialization still there? If the answer is 'no',
then how about this makefile:

all: foo fox
foo: bar .WAIT baz
fox: bar baz

Is it still going to work as user expects (whatever than might mean, I
personally don't know what one should expect here).

I think the answer is 'yes' (or should be 'yes'). If so then it strikes
as terribly asymmetric hack. What happens in this case:

all: foo fox
foo: bar .WAIT baz biz
fox: bar baz .WAIT biz

Or here:

all: foo fox
foo: bar .WAIT baz
bar: 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

hth,
-boris





reply via email to

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