Makefile 728 Bytes
Newer Older
Vladimír Štill's avatar
Vladimír Štill committed
1
PY = $(wildcard *.py)
2
GRMS=DFA NFA CFG RegG RegEx
Vladimír Štill's avatar
Vladimír Štill committed
3
4
5
6
7

-include local.make

MYPY ?= mypy

8
all : test
Vladimír Štill's avatar
Vladimír Štill committed
9

10
11
12
typecheck : $(PY:%=%.mypy)

unit:
Vladimír Štill's avatar
Vladimír Štill committed
13
	PYTHONPATH=$$PWD pytest --color=yes
14
15

test: typecheck unit
Vladimír Štill's avatar
Vladimír Štill committed
16
17
18
19

%.mypy : %
	$(MYPY) --check-untyped-defs --warn-redundant-casts --warn-unused-ignores --warn-return-any $<

Vladimír Štill's avatar
Vladimír Štill committed
20
grammars : $(GRMS:%=lib/parser/%Parser.py)
21

22
$(GRMS:%=lib/parser/%Parser.py) : lib/parser/%Parser.py : lib/parser/%.g4
23
24
25
26
	antlr4 -Dlanguage=Python3 -visitor $<
	@# let's be a bit more permissive for versions
	sed -i '/self.checkVersion(".*")/d' $(@:%Parser.py=%*.py)

27
28
29
30
31
FA_PARSER=DFA NFA
$(FA_PARSER:%=lib/parser/%Parser.py) : lib/parser/FA.g4

lib/parser/RegG.g4 : lib/parser/CFG.g4

Vladimír Štill's avatar
Vladimír Štill committed
32
.PHONY: %.mypy typecheck test unit all grammars