27 lines
638 B
Makefile
27 lines
638 B
Makefile
all: grammars
|
|
|
|
.PHONY: grammars
|
|
grammars: grammars/__init__.py
|
|
grammars/__init__.py: *.g4 antlr4.jar
|
|
java -cp "${PWD}/antlr4.jar" org.antlr.v4.Tool -Dlanguage=Python3 $< -no-listener -visitor -o grammars
|
|
touch grammars/__init__.py
|
|
|
|
antlr4.jar:
|
|
rm -f *.jar
|
|
wget https://www.antlr.org/download/antlr-4.10.1-complete.jar
|
|
mv *.jar antlr4.jar
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf grammars
|
|
|
|
tests/%.correct: tests/%.in hmknf.py
|
|
cat $< > $@
|
|
echo "-------------------" >> $@
|
|
python3 hmknf.py < $< >> $@
|
|
|
|
TESTS=$(shell ls tests/*.in | xargs -I{} /usr/bin/basename {} .in | xargs -I{} printf "tests/%s.correct\n" {})
|
|
|
|
.PHONY: test
|
|
test: ${TESTS}
|