diff --git a/Makefile b/Makefile index 34542a9..e7e50e7 100644 --- a/Makefile +++ b/Makefile @@ -15,20 +15,20 @@ SRCS := $(wildcard $(SRC_DIR)/**) .PHONY: clean full-clean tarball tarball-standalone web web-standalone # "Standalone" version. It includes an index.html to serve as-is -web-standalone: out/asteroids.js out/asteroids_bg.wasm out/index.html +web-standalone: out/asteroids.js out/asteroids_bg.wasm.gz out/index.html # "Bundle-able" version. It has a page, but no index.html. Consumers are # expected to provide their own index.html and link to this page. -web: out/asteroids.js out/asteroids_bg.wasm out/asteroids.html +web: out/asteroids.js out/asteroids_bg.wasm.gz out/asteroids.html tarball: asteroids_web_root.tar tarball_standalone: asteroids_web_root_standalone.tar -asteroids_web_root.tar: out/asteroids.js out/asteroids_bg.wasm out/asteroids.html +asteroids_web_root.tar: out/asteroids.js out/asteroids_bg.wasm.gz out/asteroids.html tar -caf $@ $^ -asteroids_web_root_standalone.tar: out/asteroids.js out/asteroids_bg.wasm out/index.html +asteroids_web_root_standalone.tar: out/asteroids.js out/asteroids_bg.wasm.gz out/index.html tar -caf $@ $^ target/$(CARGO_TARGET)/$(CARGO_PROFILE)/asteroids.wasm: $(SRCS) Cargo.lock Cargo.toml @@ -39,8 +39,9 @@ out: # Both the JS and WASM files are generated by the wasm-bindgen call, so both # get to be on the target half of this recipe. -out/asteroids.js out/asteroids_bg.wasm &: target/$(CARGO_TARGET)/$(CARGO_PROFILE)/asteroids.wasm | out +out/asteroids.js out/asteroids_bg.wasm.gz &: target/$(CARGO_TARGET)/$(CARGO_PROFILE)/asteroids.wasm | out wasm-bindgen --no-typescript --target web --out-dir ./out/ --out-name asteroids target/$(CARGO_TARGET)/$(CARGO_PROFILE)/asteroids.wasm + gzip -9 -f out/asteroids_bg.wasm # Copies the index page to the output dir. out/index.html: www/index.html @@ -67,5 +68,5 @@ full-clean: clean install: web install -dm0755 $(DESTDIR) install -m0644 out/asteroids.js $(DESTDIR)/ - install -m0644 out/asteroids_bg.wasm $(DESTDIR)/ + install -m0644 out/asteroids_bg.wasm.gz $(DESTDIR)/ install -m0644 out/asteroids.html $(DESTDIR)/ diff --git a/www/index.html b/www/index.html index 79c865c..13f243b 100644 --- a/www/index.html +++ b/www/index.html @@ -98,7 +98,11 @@