New build variants: "standalone" and "bundle-able"
The `web-standalone` target does what the old `web` target did: Produce the WASM, JS, and an index.html so the output can be served up directly. The new `web` target renames the "index.html" to "boids.html" so it can be used as a submodule/subpage in a larger website build.
This commit is contained in:
14
Makefile
14
Makefile
@@ -10,9 +10,14 @@ CARGO_PROFILE := wasm-release
|
|||||||
SRC_DIR = ./src
|
SRC_DIR = ./src
|
||||||
SRCS := $(wildcard $(SRC_DIR)/**)
|
SRCS := $(wildcard $(SRC_DIR)/**)
|
||||||
|
|
||||||
.PHONY: clean full-clean web tarball
|
.PHONY: clean full-clean tarball tarball-standalone web web-standalone
|
||||||
|
|
||||||
web: out/boids.js out/boids_bg.wasm out/index.html
|
# "Standalone" version
|
||||||
|
# (i.e., it includes an index.html so it can be placed on a server as-is)
|
||||||
|
web-standalone: out/boids.js out/boids_bg.wasm out/index.html
|
||||||
|
|
||||||
|
# "Bundle-able" version. The host site must provide it's own HTML page.
|
||||||
|
web: out/boids.js out/boids_bg.wasm out/boids.html
|
||||||
|
|
||||||
tarball: boids_web_root.tar
|
tarball: boids_web_root.tar
|
||||||
|
|
||||||
@@ -30,9 +35,14 @@ out:
|
|||||||
out/boids.js out/boids_bg.wasm &: target/$(CARGO_TARGET)/$(CARGO_PROFILE)/another-boids-in-rust.wasm | out
|
out/boids.js out/boids_bg.wasm &: target/$(CARGO_TARGET)/$(CARGO_PROFILE)/another-boids-in-rust.wasm | out
|
||||||
wasm-bindgen --no-typescript --target web --out-dir ./out/ --out-name boids target/$(CARGO_TARGET)/$(CARGO_PROFILE)/another-boids-in-rust.wasm
|
wasm-bindgen --no-typescript --target web --out-dir ./out/ --out-name boids target/$(CARGO_TARGET)/$(CARGO_PROFILE)/another-boids-in-rust.wasm
|
||||||
|
|
||||||
|
# Copies the index page to the output
|
||||||
out/index.html: www/index.html
|
out/index.html: www/index.html
|
||||||
cp -a $< $@
|
cp -a $< $@
|
||||||
|
|
||||||
|
# Like `out/index.html`, but renames it for use in a larger site.
|
||||||
|
out/boids.html: www/index.html
|
||||||
|
cp -a $< $@
|
||||||
|
|
||||||
# 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:
|
||||||
|
|||||||
Reference in New Issue
Block a user