[antlr-interest] make rules for *.g -> outputs

Martin Probst mail at martin-probst.com
Fri Dec 3 10:35:21 PST 2004


Hi,
I had to write Makefiles too. I wrote a rule that the generated files
depend on the grammar:
MyParser.cpp MyParser.hpp MyLexer.cpp [...]: mygrammar.g
	(antlr action ...)
MyParser.o: MyParser.cpp MyParser.hpp MyParserTokenTypes.hpp
(...)
This lead to the annoying result that if the grammar was changed make
expected every file to change - but the didn't (e.g. only a small change
in Parser - MyLexer.cpp won't be touched). So make kept calling the
antlr target again and again for every file, even if they wouldn't be
altered.
So I came up with two solutions: either touch all the grammars products
after the antlr run or use a ".mygrammar_was_parsed" file (touching it
after antlr run), make it depend on the grammar and the object files
depend on that magic file.
Both ways lead to unnecessary compiles of source files :-(
Either I misunderstood something with Makefiles (I'm not really a Guru
with them) or there is no other solution ... at least a change always
resulted in a rebuild and dependencies were kind of correct.

mfg
Martin



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list