2019-03-11 16:34:15 +01:00
|
|
|
WASM2WAT=wasm2wat
|
2018-05-12 21:09:19 +02:00
|
|
|
WAT2WASM=wat2wasm
|
2019-11-09 20:04:11 +01:00
|
|
|
WAT2WASM_FLAGS=
|
2018-05-12 21:09:19 +02:00
|
|
|
ifeq ($(DEBUG),1)
|
2019-11-09 19:28:59 +01:00
|
|
|
WAT2WASM_FLAGS:=$(WAT2WASM_FLAGS) --debug-names
|
2018-05-12 21:09:19 +02:00
|
|
|
endif
|
|
|
|
|
2019-11-09 20:04:11 +01:00
|
|
|
WASM_FILES=src/waforth.wasm src/waforth.bulkmem.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
|
|
|
|
2019-11-11 11:29:20 +01:00
|
|
|
process: src/waforth.vanilla.wat
|
|
|
|
cp $< src/waforth.wat
|
|
|
|
|
|
|
|
src/waforth.wasm: src/waforth.wat
|
2019-11-09 20:04:11 +01:00
|
|
|
$(WAT2WASM) $(WAT2WASM_FLAGS) -o $@ $<
|
|
|
|
|
|
|
|
src/waforth.vanilla.wat: src/waforth.wat
|
2019-11-11 11:29:20 +01:00
|
|
|
./src/tools/process.js $< > $@
|
2018-05-12 21:09:19 +02:00
|
|
|
|
2019-11-09 20:04:11 +01:00
|
|
|
src/waforth.bulkmem.wasm: src/waforth.bulkmem.wat
|
|
|
|
$(WAT2WASM) $(WAT2WASM_FLAGS) --enable-bulk-memory -o $@ $<
|
|
|
|
|
|
|
|
src/waforth.bulkmem.wat: src/waforth.wat
|
2019-11-11 11:29:20 +01:00
|
|
|
./src/tools/process.js --enable-bulk-memory $< > $@
|
2019-03-11 16:34:15 +01:00
|
|
|
|
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
|
|
|
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
|