# Emscripten target (see https://github.com/apiaryio/emscripten-docker)

all: js/appmake.js  js/copt.js  js/dzx7.js  js/sccz80.js js/ticks.js  js/ucpp.js js/z80asm.js  js/z80nm.js  js/z88dk-dis.js  js/z88dk-lstmanip.js js/zcc.js  js/zcpp.js js/zobjcopy.js  js/zpragma.js  js/zx7.js wasm/appmake.js  wasm/copt.js  wasm/dzx7.js  wasm/sccz80.js wasm/ticks.js  wasm/ucpp.js wasm/z80asm.js  wasm/z80nm.js  wasm/z88dk-dis.js  wasm/z88dk-lstmanip.js wasm/zcc.js  wasm/zcpp.js wasm/zobjcopy.js  wasm/zpragma.js  wasm/zx7.js


js/%.js: bin/%.bc
	emcc -O2 --memory-init-file 0 \
		-s WASM=0 \
		-s MODULARIZE=1 \
		-s EXPORT_NAME=\"'$*'\" \
		-s 'EXTRA_EXPORTED_RUNTIME_METHODS=["FS"]' \
		-s FORCE_FILESYSTEM=1 \
		$< -o $@ $(ARGS_$*)

wasm/%.js: bin/%.bc
	emcc -O2 --memory-init-file 0 \
		-s WASM=1 \
		-s MODULARIZE=1 \
		-s EXPORT_NAME=\"'$*'\" \
		-s 'EXTRA_EXPORTED_RUNTIME_METHODS=["FS"]' \
		-s FORCE_FILESYSTEM=1 \
		$< -o $@ $(ARGS_$*)

bin/%.bc: bin/%
	cp bin/$* bin/$*.bc

