Subject: Re: make: making .WAIT recursive
To: None <tech-toolchain@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-toolchain
Date: 02/16/2006 17:17:28
>>> if the two things don't depend on each other, then why can't they
>>> happen concurrently?
>> Maybe they both try to build the same intermediate target.
>> This (sort of) happens in sys/i386/stand/bootxx where the different
>> options want to use the same libraries...
> Combine this with dependcies possibly spread across makefile's and it
> comes down to either a .WAIT type syntax that's fully recursive or no
> -j type behavior with any sanity.

Thinking about this, I think I've realized the problem.  Well, part of
it, anyway.

.WAIT specifies too much.  It can be used for three purposes, and it's
not the right thing for two of them.

(1) It can be used to say "don't build B until A is built".  This is
    better expressed as a normal dependency (though we need a variant
    that is "recursive", that applies to not just B but everything
    under B).

(2) It can be used to say "don't do A and B at the same time".
    However, it also specifies which of the two to do first, which
    shouldn't be specified unless it actually matters.

(3) It can be used when you really do want to say "do A, wait for it to
    complete, then do B" when A and B aren't targets to be built but
    "command verbs" (the sort of target .PHONY was invented for).  An
    example might be a target which does dependall, install, and
    cleandir; something like
	rebuild: dependall .WAIT install .WAIT cleandir
    really is the right way to do this.  (Dependencies are not; for
    example, to implement this with dependneices, cleandir would have
    to depend on install, which is totally wrong.)

I have come to the tentative conclusion that, ideally, three things
should happen:

(a) .WAIT should die in most of its uses, staying around only in the
    few-if-any cases where (3), above, is what's meant.

(b) A syntax should appear for saying not "don't do the build commands
    for B until A is ready" (which is a normal make dependency) but
    rather "don't start even walking the tree under B until A is ready"
    (which is the recursive dependency I mentioned above).

(c) A syntax should appear for saying "don't do these at the same time,
    but it doesn't matter which order you do them in if they both need
    to be done".  In full generality, there should be recursive and
    nonrecursive variants of this, but given the problem at hand, I
    think the recursive variant is the one we actually need, the one
    that says "don't be walking-to-build the trees under these two
    things at the same time".  ".MUTEX: a b c" maybe?

Thoughts?

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B