Subject: Re: CVS commit: src/usr.bin/crunch/crunchgen
To: Luke Mewburn <lukem@NetBSD.org>
From: James Chacon <jmc@NetBSD.org>
List: source-changes
Date: 01/31/2005 01:31:19
On Mon, Jan 31, 2005 at 06:27:01PM +1100, Luke Mewburn wrote:
> On Mon, Jan 31, 2005 at 01:16:12AM -0600, James Chacon wrote:
>   | On Sun, Jan 30, 2005 at 11:04:33PM +0000, Luke Mewburn wrote:
>   | > 
>   | > Module Name:	src
>   | > Committed By:	lukem
>   | > Date:		Sun Jan 30 23:04:33 UTC 2005
>   | > 
>   | > Modified Files:
>   | > 	src/usr.bin/crunch/crunchgen: crunchgen.c
>   | > 
>   | > Log Message:
>   | > Explicitly cd to the .OBJDIR in the  ${PROG}.strip  target.
>   | > This fixes the "make -j N dependall" build issues people were
>   | > seeing in src/rescue, that appears to have been introduced
>   | > in rev 1.62.
>   | 
>   | Why is this needed? Even for -j isn't make always going to do a chdir(2)
>   | into $.OBJDIR before exec'ing the target commands?
> 
> I added some debug code in that target's { ... } shell block
> and noticed that the pwd(1) was ${.CURDIR} not ${.OBJDIR}.
> I didn't investigate why that was the case; I just fixed it
> in the simplest solution at the time.

Ahh ok. I'll dig further into make then as I think it should have 
"done the right thing" there with directories. All -j really should have
caused was out of order dependency execution (which is happening) and
the entire target command slurping into 1 shell script (which also seems
to be the case). It's something w. dependall's explicit cd ${.CURDIR} that
seems to throw something off here.

> Note that if that shell block in ${PROG}.strip was using ${.TARGET}
> (and filenames derived from that) instead of ${PROG}, I expect that
> it would have worked, because make(1) does get that right.

Yep

> 
> I suspect that the entire ${PROG}.strip (et al) stuff could be
> done in a better way using make's internal handling of timestamps...

Yeah..I agree w. that it mostly comes off as ugly to me when reading it
also. Anything using test w. -nt *in a Makefile* is pretty damn silly.

James