Subject: Re: make: making .WAIT recursive
To: None <tech-toolchain@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-toolchain
Date: 02/12/2006 16:22:48
On Sun, 12 Feb 2006, Manuel Bouyer wrote:
> > 	foo: a .WAIT b	; echo foo
> > 	a:		; echo a
> > 	b: b1 b2	; echo b
> > 	b1:		; echo b1
> > 	b2:		; echo b2
> [...]
> I fear that by making .WAIT and .ORDER recursive we loose a lot of
> parallelism from makefiles. In your example, the fast that b1 and b2
> have to be done after a may not be always true, and if it's the case,
> maybe b1 and b2 should depend on a ?
> Or change it to .ORDER a b1 b2 b ?

In the general case, explicitly listing all recursive dependencies is
tedious (there may be many of them), error-prone (if somebody changes
"b: b1 b2" to "b: b1 b2 b3" then they could easily forget to update the
.ORDER line, which may be a great distance away from the line that was
changed, possibly even in a different .included file), or difficult
without a redesign of the way the makefile is written (when some of
the recursive dependencies are derived from included makefiles that
are edited by different people).  Imagine what would have to happen to
src/etc/Makefile if all the .WAITs were expanded the way you suggest,
and then somebody changed the definition of snap_md_post in one of the
src/etc/etc/*/Makefile.inc included files.

I think we clearly need a recursive form of .WAIT.  Lack of this feature
is causing much grief to people who try to build NetBSD using "-j N"
parallelism.  I am not sure about whether to spell it ".WAIT" or
something new.

My preference it to leave .ORDER non-recursive as at present, and
to make .WAIT recursive.  This will allow both behaviours to be
expressed by users who care about the difference, and will allow
.WAIT to work in the way that was expected by whoever wrote the
Makefiles used to build NetBSD.  I have patches to do this; see
ftp://ftp.netbsd.org/pub/NetBSD/misc/apb/make.20060212.diff.

--apb (Alan Barrett)