help-make
[Top][All Lists]
Advanced

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

Re: Make dependency check


From: Geraldin Arthy
Subject: Re: Make dependency check
Date: Wed, 22 Nov 2006 20:50:32 +0530

Hello Paul,
 
I tried modifying the makefile like what you have specified.
I have changed the following lines in the makefile what I sent you yesterday.
MAKEDEPEND = touch $*.d && makedepend $(CPPFLAGS) -I$(INCS) -f $*.d -p$(OUTPUT_DIR) $<
 
$(OBJS):$(OUTPUT_DIR)/%.o: %.cxx
        @$(MAKEDEPEND); \
        cp $*.d $*.P; \
        sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
        -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
        rm -f $*.d
        $(CXX) $(CFLAGS) $(@F:.o=.cxx) -o $@

-include $(SRCS:.cxx=$(OUTPUT_DIR)/%.P)
 
Now if I refer the COvBucket.P file I get info like this which is correct.But sill when I modify COvBucket.h and give a make it dooes not rebuild again.
 
# DO NOT DELETE

../build/PCS_2.0/release_NOtsp/Linux/2.6/i686/pdfoverload/COvBucket.o: COvBucket.h
../build/PCS_2.0/release_NOtsp/Linux/2.6/i686/pdfoverload/COvBucket.o: ../pdfcommon/src/PdfType.h
../build/PCS_2.0/release_NOtsp/Linux/2.6/i686/pdfoverload/COvBucket.o: ../pdfcommon/src/CPdfObject.h
../build/PCS_2.0/release_NOtsp/Linux/2.6/i686/pdfoverload/COvBucket.o: ../pdfcommon/src/CPdfTrace.h
../build/PCS_2.0/release_NOtsp/Linux/2.6/i686/pdfoverload/COvBucket.o: /usr/lib/gcc-lib/i586-suse-linux/3.3.3/include/stdarg.h

I've attached the makefile and the .P files.Please have a look and tell me what is wrong with my makefile.

 

Thanks in advance,

GA.


 


 
On 11/21/06, Paul D. Smith <address@hidden> wrote:
On Tuesday, 21 November, Geraldin Arthy (address@hidden ) wrote:

> I can use the gcc dependency option but the problem is we will be using the
> same makefile for both linux as well as Solaris.And in Solaris for our code
> we use the CC compiler and not gcc.That is the reason why I have to
> definitely use the makedepend option.

OK but... as you've discovered, makedepend is an old, out-of-date
application.  It doesn't grok C++ headers, for example, and its ideas of what
is legal and not legal are old-fashioned.

> For example when I see the COvBucket.P, I find the lines below.
> COvBucket.o: COvBucket.h ../pdfcommon/src/PdfType.h
> COvBucket.o: ../pdfcommon/src/CPdfObject.h ../pdfcommon/src/CPdfTrace.h
>
> But when I modify the ../pdfcommon/src/CPdfTrace.h header file and give a
> make again it does not rebuild the dependencies.

That's because your .P files are wrong.  Your rule to build .o's is:

$(OBJS):$(OUTPUT_DIR)/%.o: %.cxx
       ...

which means your target .o's are things like $(OUTPUT_DIR)/COvBucket.o.

But, your .P files list targets like this:

COvBucket.o:

with no $(OUTPUT_DIR).  There's absolutely no way make can know that you
intend these targets to refer to the same file; in fact make knows that they
are NOT the same file.  So, prerequisites listed for COvBucket.o will have no
relevance to make when it wants to build $(OUTPUT_DIR)/COvBucket.o.


You need to fix up your script that generates the .P files to add in the
$(OUTPUT_DIR)/ prefix to the target .o's.

Then it will work.

--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden>          Find some GNU make tips at:
http://www.gnu.org                       http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist

Attachment: depend.zip
Description: Zip archive


reply via email to

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