On Thu, Apr 09, 2009 at 06:38:56PM +1000, Gilles Gigan wrote:
Hi,
i have a question about automatically generating prerequisites as
explained in section 4.14 of the make manual:
If I understand this section correctly, the .d files must be shipped
with the source code and must not be removed by a "clean" target.
Otherwise, the next "make" will complain about not being able to
include them, even though they will be generated afterwards.
Is this correct ?
Now, I would like to get around having to ship these files with the
source code. Is there a way to have make generate these .d files IFF
they are missing, and then include them ?
First off make cannot possibly generate the dependency files,
you need some tool for that.
The typical way to deeal with generating .d files is to
generate them in the same command as used to generate .o files.
Then you can do a simple:
ifneq ($(wildcard *.d),)
include $(wildcard *.d)
endif
So you do not try to include .d files that does not yet exist.