Subject: Re: auto creation od .depend files
To: David Laight <>
From: Simon J. Gerraty <>
List: tech-toolchain
Date: 01/27/2004 16:48:06
>This needs to be done if and of the .d files have been created during the
>current build (not if they are out of date at the start of the build).

Its not actually that big a deal if you do it always.
At least I've not found it to be a problem.
Have you looked at the I've mentioned a couple of times?
Its been in constant use for over 3 years (in a pretty busy engineering dept.)
and even without use of .OPTIONAL has worked very well.  
You can find it in pkgsrc/devel/mk-files

>This is done by detecting whether ${CPPFLAGS) has been expanded by setting:

This is cute - I like it.  
Note that SKIP_AUTODEP=: would work as well, and save you
the need to quote things.

>realall: ${PROG} ${SCRIPTS} .WAIT .depend

>Things are actually slightly more complicated...

But is it really necessary?  

>You need 'SKIP_AUTODEP!= [ ! -f .depend ] || echo \\#' to get .depend
>created if it is absent, but nothing is built.

>And to use
>instead of CPPFLAGS when passing things into nested makes.

This is starting to look fragile.  This is all just to avoid 
unnecessarily building .depend?  is it worth it?

>I've also had to ensure there is a dummy target (ie one with no rules)
>to pin the '.WAIT .depend' onto.  Maybe I could use .USEBEFORE instead???

Probably better than the .END target I've used - I've been tempted to fix 
it (and .BEGIN) so that

.END: this
.END: that

works.  A dummy target is ok if needed though.