help-make
[Top][All Lists]
Advanced

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

Re: one makes many


From: Paul D. Smith
Subject: Re: one makes many
Date: Tue, 21 Mar 2006 07:17:48 -0500

%% "Chris Chiasson" <address@hidden> writes:

  cc> How can I express a relationship in make that says "any one of 'these
  cc> files' can be made with 'command', but 'command' makes all of 'these
  cc> files' at once, so if you execute this rule, you don't need to run it
  cc> again"?

If your targets are related by some part of their filename (and,
ideally, also related to the file they're built from that way) then you
can use a pattern rule.  Pattern rules with multiple targets have the
quality you're looking for:

    %.c %.h : %.in

etc.

  cc> What I am doing right now is equivalent to:
  cc> falsetarget : dep
  cc>         command to generate all targets
  cc>         touch falsetarget

Something like this is the only way to do it if the targets have no
relationship that can be expressed as a pattern.  Generally the best way
is something like:

    target1 target2: falsetarget ;

    falsetarget: dep
            command to generate all targets
            @touch $@

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