[Top][All Lists]

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

Re: multiple targets in one rule

From: Paul D. Smith
Subject: Re: multiple targets in one rule
Date: Wed, 31 Aug 2005 20:58:31 -0400

%% Christian Bird <address@hidden> writes:

  cb> \
  cb> PythonParserTokenTypes.txt : python.g
  cb>         $(ANTLR) python.g

  cb> This works, but it ends up running antlr on python.g four times
  cb> which seems bad.

Multiple targets is the same as defining multiple rules.  That is:

    foo bar baz : biz
        echo $@

is the same as:

    foo : biz
        echo $@
    bar : biz
        echo $@
    baz : biz
        echo $@

which is not what you want.  You need to use pattern rules;
unfortunately they only work if there is a commonality between the
target(s) and prerequisite(s).  Change the name of your input file to
Python.g (or change the name of the output files to "python*"), then: %ParserTokenTypes.txt : \

See the GNU make manual for details.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "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]