phasm/Makefile
Johan B.W. de Vries a0d575f61f Implements __alloc_bytes__, uses it in the buffer example
Also, updated todo, remove broken code from buffer example
2022-08-09 20:21:59 +02:00

45 lines
1.1 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
WAT2WASM=$(WAT2WASM) venv/bin/pytest tests $(TEST_FLAGS)
lint: venv/.done
venv/bin/pylint phasm
typecheck: venv/.done
venv/bin/mypy --strict phasm tests/integration/runners.py
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