waforth/Makefile

48 lines
1.2 KiB
Makefile
Raw Permalink Normal View History

2019-03-11 16:34:15 +01:00
WASM2WAT=wasm2wat
2018-05-12 21:09:19 +02:00
WAT2WASM=wat2wasm
2018-05-30 22:48:50 +02:00
WAT2WASM_FLAGS=--enable-mutable-globals
2018-05-12 21:09:19 +02:00
ifeq ($(DEBUG),1)
WAT2WASM_FLAGS=--debug-names
endif
2018-05-29 21:14:22 +02:00
WASM_FILES=src/waforth.wasm tests/benchmarks/sieve-vanilla.wasm
2018-05-12 21:09:19 +02:00
all: $(WASM_FILES)
2019-03-10 10:37:01 +01:00
yarn -s build
2018-05-12 21:09:19 +02:00
dev-server: $(WASM_FILES)
2019-03-10 10:37:01 +01:00
yarn -s dev-server
2018-05-29 08:48:08 +02:00
2019-03-12 16:05:19 +01:00
wasm: $(WASM_FILES) src/waforth.assembled.wat src/tools/quadruple.wasm.hex
2018-05-12 21:09:19 +02:00
src/waforth.wasm: src/waforth.wat dist
2018-05-12 21:09:19 +02:00
racket -f $< > src/waforth.wat.tmp
$(WAT2WASM) $(WAT2WASM_FLAGS) -o $@ src/waforth.wat.tmp
2019-03-11 16:34:15 +01:00
src/waforth.assembled.wat: src/waforth.wasm
$(WASM2WAT) --fold-exprs --inline-imports --inline-exports -o $@ $<
2018-05-29 21:14:22 +02:00
tests/benchmarks/sieve-vanilla.wasm: tests/benchmarks/sieve-vanilla.wat
2018-05-19 14:17:16 +02:00
$(WAT2WASM) $(WAT2WASM_FLAGS) -o $@ $<
2018-05-12 21:09:19 +02:00
dist:
mkdir -p $@
src/tools/quadruple.wasm: src/tools/quadruple.wat
$(WAT2WASM) $(WAT2WASM_FLAGS) -o $@ $<
src/tools/quadruple.wasm.hex: src/tools/quadruple.wasm
hexdump -v -e '16/1 "_u%04X" "\n"' $< | sed 's/_/\\/g; s/\\u //g; s/.*/ "&"/' > $@
clean:
-rm -rf $(WASM_FILES) src/tools/quadruple.wasm src/tools/quadruple.wasm.hex src/waforth.wat.tmp dist
2019-03-09 20:13:00 +01:00
2019-03-12 18:06:42 +01:00
check: $(WASM_FILES)
2019-03-10 10:37:01 +01:00
yarn -s test
2019-03-12 21:05:34 +01:00
check-watch: $(WASM_FILES)
yarn -s test-watch
2019-03-09 20:13:00 +01:00
lint:
2019-03-10 10:37:01 +01:00
yarn -s lint