2018-05-12 21:09:19 +02:00
|
|
|
WAT2WASM=wat2wasm
|
|
|
|
WAT2WASM_FLAGS=
|
|
|
|
ifeq ($(DEBUG),1)
|
|
|
|
WAT2WASM_FLAGS=--debug-names
|
|
|
|
endif
|
2018-05-29 13:06:24 +02:00
|
|
|
WEBPACK=npx webpack
|
|
|
|
WEBPACK_DEV_SERVER=npx webpack-dev-server
|
2018-05-12 21:09:19 +02:00
|
|
|
|
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)
|
2018-05-29 13:06:24 +02:00
|
|
|
$(WEBPACK) --mode=production
|
2018-05-12 21:09:19 +02:00
|
|
|
|
|
|
|
dev-server: $(WASM_FILES)
|
2018-05-29 13:06:24 +02:00
|
|
|
$(WEBPACK_DEV_SERVER) --open --openPage waforth --content-base public
|
2018-05-29 08:48:08 +02:00
|
|
|
|
2018-05-12 21:09:19 +02:00
|
|
|
wasm: $(WASM_FILES) src/tools/quadruple.wasm.hex
|
|
|
|
|
2018-05-29 13:06:24 +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
|
|
|
|
|
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
|