phasm/Makefile
Johan B.W. de Vries b28df7fa74 Fix: Could not both export and use function
Added HTML pages for fib example
2022-06-24 18:52:43 +02:00

39 lines
831 B
Makefile

WABT_DIR := /home/johan/Sources/github.com/WebAssembly/wabt
WAT2WASM := $(WABT_DIR)/bin/wat2wasm
WASM2C := $(WABT_DIR)/bin/wasm2c
%.wat: %.py py2wasm/*.py venv/.done
venv/bin/python -m py2wasm $< $@
%.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))
venv/bin/python3 -m http.server --directory examples
test: venv/.done
WAT2WASM=$(WAT2WASM) venv/bin/pytest tests $(TEST_FLAGS)
lint: venv/.done
venv/bin/pylint py2wasm
typecheck: venv/.done
venv/bin/mypy --strict py2wasm
venv/.done: requirements.txt
python3.8 -m venv venv
venv/bin/python3 -m pip install wheel pip --upgrade
venv/bin/python3 -m pip install -r $^
touch $@
.SECONDARY: # Keep intermediate files
.PHONY: examples