[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: autodependencies
From: |
Philip Guenther |
Subject: |
Re: autodependencies |
Date: |
Wed, 9 Mar 2011 17:54:07 -0800 |
On 3/9/11, Dan Kujovich <address@hidden> wrote:
> 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.
So, that rule correctly generates an a.P file with the dependency
information for a.o. Are you actually using the 'include' directive
in your Makefile to pull that information in? Something like
-include *.P
perhaps?
Philip Guenther