On Wednesday, 22 November, Geraldin Arthy ([EMAIL PROTECTED]) wrote:

> 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)

This is not right.

Your MAKEDEPEND rule and the sed, etc. afterwards create a file $*.P, where $*
will expand to the stem of the target/prerequisite.  For a pattern rule this
is essentially whatever text matches the pattern (%).

In your rules, for a target $(OUTPUT_DIR)/foo.o and a prerequisite foo.cxx,
the stem ($*) is "foo".

So, these commands will build a file foo.P for every source file foo.cxx that
you compile.


BUT, your include line doesn't include foo.P, it includes $(OUTPUT_DIR)/foo.P,
which does not exist.  So, that include line doesn't do anything at all and
none of the prerequisites defined in your .P file are being seen.

You should really use the -d (debug) option; these things would be clear.  I
know it generates a ton of output but you can redirect it to a file, then
search through it for a representative file.  It would tell you that it can't
open those included files.  You can also use the -p option to have make print
its internal database: you'd see then that none of the prerequisites exist.


You should change your rules to create $(OUTPUT_DIR)/$*.P, not just $*.P.
Also, I recommend changing your command to use the variable $(OUTPUT_DIR) in
your .P files, rather than the expanded value of $(OUTPUT_DIR).

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          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


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to