%% Duane Ellis <[EMAIL PROTECTED]> writes:

  de> [~> make -v
  de> GNU Make version 3.77, by Richard Stallman and Roland McGrath.

  de> Under SunOS 4 make, we can do this:

  de> foo.lst + foo.o: foo.s
  de>   my_assembler -l foo.lst -o foo.o foo.s

  de> Key point is: "target *PLUS* target" This tells Make that executing
  de> the one command actually results in 2 outputs.

You can do this in GNU make with pattern rules only.  That is, the
following pattern rule will mean the same thing as above:

  %.lst %.o : %.s
        my_assembler -l $*.lst $*.o $<

It's best to not use $@ here, since that will be whatever target caused
the rule to fire (e.g., if you say "make foo.lst" then $@ will be
foo.lst, but if you say "make foo.o" it will be foo.o).

This is documented in the section of the manual on pattern rules.

You're right about the missing features section; this should probably be
added there.  Although I've had people express interest in writing this
(and I know I'd like to have this feature), so who knows...?

In situations where pattern rules aren't appropriate (e.g., if all the
outputs don't have some portion of their name in common so that you can
write a pattern for them all) you have to go back to the traditional
dummy target method.

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