Subject: Re: make and .OPTIONAL
To: David Laight <david@l8s.co.uk>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-toolchain
Date: 11/08/2003 10:44:49
>> On Fri, Nov 07, 2003 at 07:19:35PM +0000, David Laight wrote:
>> | I thought I'd try to stop the build failing when a .depend file
>> | references an old .h file by changing mkdep so that it adds:
>> |
>> | .OPTIONAL: header.h .....
>> |
>> | This stops the build failing, but the program that depended on the
>> | deleted .h file is always rebuilt.
>>
>> I'm not convinced that this is necessary. I'll defer to the make(1)
>> gurus (sjg@, etc :) if they disagree.
The .OPTIONAL - or at least the concept is what I was talking about the
other day.
>I've had another thought overnight (really ought to get some sleep!):
>- Always run ${CC} with -MD so that EVERY compilation regenerates xxx.d
>- In the ".depend: *.d" rule do the 'twiddling' that mkdep currently
> does and also add .OPTIONAL for all the headers.
>- Arrange for the .depend file to be regenerated every time a program is
> built (it is a cheap action)
>I think that would mean that the 'make depend' pass would be unnecessary.
>Has this been tried before?
Yes, this is almost exactly what my autodep.mk does. It works well.
With the addition of .OPTIONAL it would be perfect.
--sjg
> David
>--
>David Laight: david@l8s.co.uk