help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about dependencies


From: Galen Seitz
Subject: Re: Question about dependencies
Date: Thu, 09 Apr 2009 08:15:35 -0700
User-agent: Thunderbird 2.0.0.19 (X11/20090107)

Sam Ravnborg wrote:
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.

Another way to do this is to use -include. This will silently ignore any files that don't exist.

-include $(wildcard *.d)

You can find lots of good information on dependency generation here:
http://make.mad-scientist.us/autodep.html

--
Galen Seitz
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]