help-make
[Top][All Lists]
Advanced

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

Re: Including dependency files automagically + some basic pilot error


From: Paul D. Smith
Subject: Re: Including dependency files automagically + some basic pilot error
Date: Mon, 25 Jul 2005 15:38:18 -0400

%% Angus Leeming <address@hidden> writes:

  al> 1. I'd like to build the MOCS files before going on to compile the .cpp
  al> ones. However,

  al> .cpp.o: $(MOCS)

This won't work.  You can't put prerequisites on a suffix rule
definition; it doesn't mean anything.  If you want to do this you'll
have to use pattern rules instead:

    %.o : %.cpp $(MOCS)

See the GNU make manual for info on pattern rules.  Note that pattern
rules are not portable to all versions of make.

If you don't want to do that you can write the dependency differently;
leave the suffix rule alone (no $(MOCS)) and put the dependency
separately:

    $(OBJS) : $(MOCS)

will cause every target in $(OBJS) to have every file in $(MOCS) as a
prerequisite.

  al> 2. I have, in the past seen some magic to include all the .deps
  al>    files in a simple rule, rather than

  al> include  ./$(DEPSDIR)/foo.Plo
  al> include  ./$(DEPSDIR)/bar.Plo
  al> include  ./$(DEPSDIR)/baz.Plo

  al> but I can't for the life of me either remember what it is or find
  al> it through google.

There is a description of a "traditional" way to do this in the GNU make
manual.  There is a description of a more advanced way to do it, based
on the methods used in automake, on my website (see below).

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




reply via email to

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