help-make
[Top][All Lists]
Advanced

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

Re: (no subject)


From: Paul D. Smith
Subject: Re: (no subject)
Date: Fri, 29 Mar 2002 10:07:19 -0500

%% Maciej Walezak <address@hidden> writes:

  mw> all: foo.h foo.o sth.h sth.o junk.h ...

  mw> foo.h foo.o: bar.h junk.h sth.h bar.o junk.o sth.o
  mw>   command-to-build-packet foo

This rule is not what you want.  Multiple targets is identical to
writing the same rule multiple times, it does _NOT_ mean that running
that command once will create all the targets.  In other words, the
above command is identical to this:

  foo.h: bar.h junk.h sth.h bar.o junk.o sth.o
        command-to-build-packet foo
  foo.o: bar.h junk.h sth.h bar.o junk.o sth.o
        command-to-build-packet foo

That's not what you want: you want to tell make that it only needs to
run the rule once to build both targets.  You do that with a
multi-target pattern rule, like this:

  %.h %.o: %
        command-to-build-packet $*

(I don't know what the dependency should be: your rules don't seem to
show what the command builds the packet _from_), then this:

  foo.h foo.o: bar.h junk.h sth.h bar.o junk.o sth.o

(with no command script).

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "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]