Also, reduced spam on typing dump by only showing the 'back on todo list' count, rather than repeat them all. Also, typing on tests.integration.helpers
54 lines
1.7 KiB
Makefile
54 lines
1.7 KiB
Makefile
WABT_DIR := /home/johan/sources/github.com/WebAssembly/wabt
|
|
|
|
WAT2WASM := $(WABT_DIR)/bin/wat2wasm
|
|
WASM2C := $(WABT_DIR)/bin/wasm2c
|
|
|
|
%.wat: %.py $(shell find phasm -name '*.py') venv/.done
|
|
venv/bin/python -m phasm $< $@
|
|
|
|
%.wat.html: %.wat
|
|
venv/bin/pygmentize -l wat -O full -f html $^ -o $@
|
|
|
|
%.py.html: %.py
|
|
venv/bin/pygmentize -l py -O full -f html $^ -o $@
|
|
|
|
%.wasm: %.wat
|
|
$(WAT2WASM) $^ -o $@
|
|
|
|
%.c: %.wasm
|
|
$(WASM2C) $^ -o $@
|
|
|
|
# %.exe: %.c
|
|
# cc $^ -o $@ -I $(WABT_DIR)/wasm2c
|
|
|
|
examples: venv/.done $(subst .py,.wasm,$(wildcard examples/*.py)) $(subst .py,.wat.html,$(wildcard examples/*.py)) $(subst .py,.py.html,$(wildcard examples/*.py))
|
|
venv/bin/python3 -m http.server --directory examples
|
|
|
|
test: venv/.done $(subst .json,.py,$(subst /generator_,/test_generated_,$(wildcard tests/integration/test_lang/generator_*.json)))
|
|
venv/bin/pytest tests $(TEST_FLAGS)
|
|
|
|
lint: venv/.done
|
|
venv/bin/pylint phasm
|
|
|
|
typecheck: venv/.done
|
|
venv/bin/mypy --strict phasm tests/integration/helpers.py tests/integration/runners.py
|
|
|
|
venv/.done: requirements.txt
|
|
python3.10 -m venv venv
|
|
venv/bin/python3 -m pip install wheel pip --upgrade
|
|
venv/bin/python3 -m pip install -r $^
|
|
touch $@
|
|
|
|
tests/integration/test_lang/test_generated_%.py: venv/.done tests/integration/test_lang/generator.py tests/integration/test_lang/generator.md tests/integration/test_lang/generator_%.json
|
|
venv/bin/python3 tests/integration/test_lang/generator.py tests/integration/test_lang/generator.md tests/integration/test_lang/generator_$*.json > $@
|
|
|
|
clean-examples:
|
|
rm -f examples/*.wat examples/*.wasm examples/*.wat.html examples/*.py.html
|
|
|
|
clean-generated-tests:
|
|
rm -f tests/integration/test_lang/test_generated_*.py
|
|
|
|
.SECONDARY: # Keep intermediate files
|
|
|
|
.PHONY: examples
|