Compare commits
2 Commits
v0.3.0
...
918992702f
| Author | SHA1 | Date | |
|---|---|---|---|
| 918992702f | |||
| c8c64e4d22 |
31
Makefile
31
Makefile
@@ -3,22 +3,32 @@
|
|||||||
## Do not use it if that isn't your goal!
|
## Do not use it if that isn't your goal!
|
||||||
##
|
##
|
||||||
|
|
||||||
SRC_DIR = ./src
|
|
||||||
SRCS := $(wildcard $(SRC_DIR)/**)
|
|
||||||
|
|
||||||
# Patch these to select a different build profile or target
|
# Patch these to select a different build profile or target
|
||||||
# The target shouldn't change any time soon. WASM64, I guess. Other targets
|
# The target shouldn't change any time soon. WASM64, I guess. Other targets
|
||||||
# aren't aimed at the web, so you shouldn't be using this makefile.
|
# aren't aimed at the web, so you shouldn't be using this makefile.
|
||||||
CARGO_TARGET := wasm32-unknown-unknown
|
CARGO_TARGET := wasm32-unknown-unknown
|
||||||
CARGO_PROFILE := tiny
|
CARGO_PROFILE := tiny
|
||||||
|
|
||||||
.PHONY: clean full-clean web tarball
|
SRC_DIR = ./src
|
||||||
|
SRCS := $(wildcard $(SRC_DIR)/**)
|
||||||
|
|
||||||
web: out/asteroids.js out/asteroids_bg.wasm out/index.html
|
.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
|
||||||
|
|
||||||
|
# "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
|
||||||
|
|
||||||
tarball: asteroids_web_root.tar
|
tarball: asteroids_web_root.tar
|
||||||
|
|
||||||
asteroids_web_root.tar: out/asteroids.js out/asteroids_bg.wasm out/index.html
|
tarball_standalone: asteroids_web_root_standalone.tar
|
||||||
|
|
||||||
|
asteroids_web_root.tar: out/asteroids.js out/asteroids_bg.wasm out/asteroids.html
|
||||||
|
tar -caf $@ $^
|
||||||
|
|
||||||
|
asteroids_web_root_standalone.tar: out/asteroids.js out/asteroids_bg.wasm out/index.html
|
||||||
tar -caf $@ $^
|
tar -caf $@ $^
|
||||||
|
|
||||||
target/$(CARGO_TARGET)/$(CARGO_PROFILE)/asteroids.wasm: $(SRCS) Cargo.lock Cargo.toml
|
target/$(CARGO_TARGET)/$(CARGO_PROFILE)/asteroids.wasm: $(SRCS) Cargo.lock Cargo.toml
|
||||||
@@ -32,13 +42,20 @@ out:
|
|||||||
out/asteroids.js out/asteroids_bg.wasm &: target/$(CARGO_TARGET)/$(CARGO_PROFILE)/asteroids.wasm | out
|
out/asteroids.js out/asteroids_bg.wasm &: 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
|
wasm-bindgen --no-typescript --target web --out-dir ./out/ --out-name asteroids target/$(CARGO_TARGET)/$(CARGO_PROFILE)/asteroids.wasm
|
||||||
|
|
||||||
|
# Copies the index page to the output dir.
|
||||||
out/index.html: www/index.html
|
out/index.html: www/index.html
|
||||||
cp -a $< $@
|
cp -a $< $@
|
||||||
|
rm -f out/boids.html
|
||||||
|
|
||||||
|
# Like `out/index.html`, but renames the page for use in a larger site.
|
||||||
|
out/asteroids.html: www/index.html
|
||||||
|
cp -a $< $@
|
||||||
|
rm -f out/index.html
|
||||||
|
|
||||||
# Clean the web build, but not the Cargo cache. Cargo handles it's own caching
|
# Clean the web build, but not the Cargo cache. Cargo handles it's own caching
|
||||||
# and I don't want to obliterate it all the time.
|
# and I don't want to obliterate it all the time.
|
||||||
clean:
|
clean:
|
||||||
rm -rf out/ asteroids_web_root.tar
|
rm -rf out/ asteroids_web_root.tar asteroids_web_root_standalone.tar
|
||||||
|
|
||||||
# Delete everything, including the Cargo build cache. In case someone needs
|
# Delete everything, including the Cargo build cache. In case someone needs
|
||||||
# this, I guess.
|
# this, I guess.
|
||||||
|
|||||||
Reference in New Issue
Block a user