bug-make
[Top][All Lists]
Advanced

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

[bug #30340] dependency handling


From: Krzysztof Malinowski
Subject: [bug #30340] dependency handling
Date: Mon, 09 Aug 2010 12:11:58 +0000
User-agent: Mozilla/5.0 (Windows; Windows NT 5.1; rv:2.0b2) Gecko/20100720 Firefox/4.0b2 ( .NET CLR 3.5.30729; .NET4.0E)

Follow-up Comment #3, bug #30340 (project make):

"When the .o file hasn't been created yet, knowing its .c source file is
enough, and information on header file dependencies, while harmless, is of no
practical use. "

Well, that's not always true. Some projects use generated headers and use
makefile dependency tracking in order to build them before they are needed.
Therefore sometimes it's essential to generate dependencies of foo.c just to
know that we need to generate bar.h before compiling foo.o.

In case when you don't use generated headers you can as well bypass a rule
for generating them and create dependencies as a compilation side-effect only.
So your rule

%.o %.d: %.c 
   $(COMPILE.c) -MD -o $*.o $< 

would be enough to be just

%.o: %.c
   $(COMPILE.c) -MD -o $@ $< 

You then include dependencies with

-include $(sources:.c=.d)

and only those dependencies which were already generated are evaluated.

Advantage of such approach is that dependencies are not generated if they are
not needed (i.e. when calling make clean) but if they are present, they are
used.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30340>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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