bug-make
[Top][All Lists]
Advanced

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

Re: RE: make -j and multiple targets


From: Paul D. Smith
Subject: Re: RE: make -j and multiple targets
Date: Thu, 6 Sep 2001 10:17:37 -0400

%% Patryk Zadarnowski <address@hidden> writes:

  >> lexer.c: lexer.l
  >> flex -t lexer.l > lexer.c
  >> 
  >> lexer.h: lexer.c
  >> genHeader.pl lexer.l

  pz> In particular, I regularly compile Haskell programs using GHC. For
  pz> each input file, GHC generates two outputs: the object file and the
  pz> "interface" file, sort of like an automatically-generated header.
  pz> Therefore, the _correct_ way of writing the dependency would be:

  pz>   xxx.o xxx.hi: xxx.hs
  pz>           ghc -o xxx.o xxx.hs

Use multiple-target pattern rules; this:

  %.o %.hi : %.hs
        ghc -o $*.o $<

will do exactly what you want.

This only works in GNU make, of course; see the GNU make manual.

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