[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> PythonLexer.java PythonParser.java PythonParserTokenTypes.java \
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:
%Lexer.java %Parser.java %ParserTokenTypes.java %ParserTokenTypes.txt : \
%.g
...
See the GNU make manual for details.
--
-------------------------------------------------------------------------------
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