diff --git a/support/xhpast/Makefile b/support/xhpast/Makefile index 3123cf1f..3686de3e 100644 --- a/support/xhpast/Makefile +++ b/support/xhpast/Makefile @@ -1,6 +1,7 @@ BISONFLAGS = --verbose --name-prefix xhpast CPPFLAGS = -fPIC -Wall FLEXFLAGS = -CFr +XHPAST_VERSION := $(shell ./bin/xhpast-generate-version.php) ifdef DEBUG BISONFLAGS += --debug @@ -64,7 +65,7 @@ endif %.o: %.cpp $(CXX) -c $(CPPFLAGS) -o $@ $< -node_names.hpp parser_nodes.php: generate_nodes.php +node_names.hpp parser_nodes.php: bin/xhpast-generate-nodes.php php -f $< parser.yacc.o: scanner.lex.hpp @@ -74,4 +75,4 @@ libxhpast.a: scanner.lex.o parser.yacc.o $(AR) -crs $@ $^ xhpast: xhpast.cpp libxhpast.a - $(CXX) $(CPPFLAGS) -o $@ $^ + $(CXX) $(CPPFLAGS) -D XHPAST_VERSION='"$(XHPAST_VERSION)"' -o $@ $^ diff --git a/support/xhpast/generate_nodes.php b/support/xhpast/bin/xhpast-generate-nodes.php similarity index 89% rename from support/xhpast/generate_nodes.php rename to support/xhpast/bin/xhpast-generate-nodes.php index 22ea26cb..baf43687 100755 --- a/support/xhpast/generate_nodes.php +++ b/support/xhpast/bin/xhpast-generate-nodes.php @@ -1,9 +1,16 @@ #!/usr/bin/env php $value) { $hpp .= "#define {$node} {$value}\n"; } -Filesystem::writeFile( - Filesystem::resolvePath('node_names.hpp', dirname(__FILE__)), - $hpp); + + +Filesystem::writeFile($hpp_outpath, $hpp); echo pht('Wrote C++ definition.')."\n"; $at = '@'; @@ -158,7 +165,7 @@ $php .= <<