help-make
[Top][All Lists]
Advanced

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

Re: "hidden" targets


From: Paul D. Smith
Subject: Re: "hidden" targets
Date: Tue, 22 Mar 2005 18:39:20 -0500

%% "Jonathan Baccash" <address@hidden> writes:

  jb> What is the best way to handle a command that creates more than
  jb> one target?  After reading "The trouble with hidden targets" at
  jb> http://www.electric-cloud.com/resources/ I get the feeling the
  jb> advice is "don't use them".

If you write a pattern rule with multiple patterns on the left side, it
does exactly what you want.  WARNING!  If you do this make will assume
that the rule ALWAYS creates BOTH files.  There is no way in make to
specify that it might create either one OR the other OR both.

    %.obj %.sbr: %.cc
            ...

If you can't write a pattern rule you're out of luck: there's no similar
syntax for explicit rules.  In this case you have to use something like
this to get 100% correct behavior:

    foo.o foo.sbr: foo.XX

    foo.XX: foo.c
            ...
            @touch foo.XX

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