help-make
[Top][All Lists]
Advanced

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

autodependencies


From: Dan Kujovich
Subject: autodependencies
Date: Wed, 9 Mar 2011 16:12:02 -0800 (PST)

I am trying to get my dependencies working for obvious reasons.  But when I try 
what has been offered, it lacks the primary goal of recompiling objects when 
any of the dependencies (header files) change.

I like the gcc -MD command as it provides the proper dependencies, but I am 
having trouble having my make file actually be able to use it.  Here is an 
example of what I am grabbing from paulandlesley.org/autodep.html


a.o : a.cpp
          @gcc -MD -c a.cpp; \
            cp $*.d $*.P; \
            sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
                -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
            rm -f $*.d
          gcc -c a.cpp -o a.o


here the command works the first time fine.  Then I change the
header a.h and run make again and it says nothing needs to be done.

Dan







reply via email to

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