help-make
[Top][All Lists]
Advanced

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

Re: Generating dynamic dependencies


From: Philip Guenther
Subject: Re: Generating dynamic dependencies
Date: Thu, 15 May 2008 16:08:04 -0600

On Thu, May 15, 2008 at 12:56 PM, Aspra Flavius Adrian
<address@hidden> wrote:
> I can't generate dependencies automatically like on line 20 in the
> makefile below  because the variable $@ does not yet exist at that
> point. How could I overcome this problem?
...
> 20 $(TESTS): $(shell $(CC) -MM -DHAVE_MAIN address@hidden | sed 's/.*: //g')
> 21      echo "DEPS: " $(shell $(CC) -MM -DHAVE_MAIN address@hidden | sed 
> 's/.*: //g')
> 22      $(CC) $(CFLAGS) -DHAVE_MAIN -o $(DIR_TESTS)$(@F) address@hidden

How about by not trying to generate dependencies during Makefile
parsing?  Let's say you did get what you want working.  Then
*every*time* you run make, it would run *all* the source files through
the dependency generation process.  That would take place even if the
information was completely unnecessary, such as when doing "make
clean".

Instead, I *strongly* suggest that you use the autodependency setup
described by our benevolent maintainer at
      http://make.paulandlesley.org/autodep.html

The setup described there generates dependencies as a side-effect of
compilation, only regenerates them when they're out of date, and never
generates them when they're unneeded.


Philip Guenther




reply via email to

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