Skip to content

Commit 12dfb4d

Browse files
committed
fix generating the antlr parser to only generate once, and postprocess in parallel
1 parent 4059d68 commit 12dfb4d

File tree

1 file changed

+8
-7
lines changed
  • graalpython/com.oracle.graal.python.parser.antlr

1 file changed

+8
-7
lines changed

graalpython/com.oracle.graal.python.parser.antlr/Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,22 @@ TARGETS=${PARSER_PATH}/Python3BaseVisitor.java \
4848
${PARSER_PATH}/Python3Lexer.java
4949

5050
SOURCE=${PARSER_PATH}/Python3.g4
51+
STAMP=${SOURCE}.stamp
5152

5253
.PHONY: default clean
5354
default: ${TARGETS}
5455

55-
# postprocessing to make source compile without warnings
56-
define postprocess_file
57-
python ${POSTPROCESSOR} $(1)
58-
endef
59-
60-
${PARSER_PATH}/%.java: ${SOURCE} ${POSTPROCESSOR}
56+
${STAMP}: ${SOURCE} ${POSTPROCESSOR}
57+
$(QUIETLY) touch $@
6158
$(QUIETLY) ${JAVA_HOME}/bin/java -cp ${ANTLR_JAR} org.antlr.v4.Tool -visitor -package ${PARSER_PKG} -o ${PARSER_PATH} ${SOURCE}
62-
$(QUIETLY) $(call postprocess_file,$@)
59+
60+
# postprocessing to make source compile without warnings
61+
${PARSER_PATH}/%.java: ${STAMP}
62+
$(QUIETLY) python ${POSTPROCESSOR} $@
6363

6464
clean:
6565
ifeq ($(wildcard ${SOURCE}),)
6666
$(error ${SOURCE} is not in the location I expected it to be, not cleaning antlr parser)
6767
endif
6868
$(QUIETLY) rm -f ${TARGETS}
69+
$(QUIETLY) rm -f ${STAMP}

0 commit comments

Comments
 (0)