From 0358935bf6866c62cbae947bbbf7768d33e02da4 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Tue, 28 Oct 2025 15:04:45 -0500 Subject: [PATCH] Group the WASM & JS targets so they're built once https://www.gnu.org/software/make/manual/html_node/Multiple-Targets.html The previous recipe told Make that each file could be produced by running wasm-bindgen. The more correct expression is that *both* files will be produced at the same time. Now Make knows to only invoke the command one time to get both files if either is out of date. Previously, multi-job builds (`-j2`) could build the files twice -- one invocation for each out-of-date file. --- makefile_web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile_web b/makefile_web index 370d9c67..4411489f 100644 --- a/makefile_web +++ b/makefile_web @@ -18,7 +18,7 @@ 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/boids.js out/boids_bg.wasm: target/wasm32-unknown-unknown/wasm-release/another-boids-in-rust.wasm | out +out/boids.js out/boids_bg.wasm &: target/wasm32-unknown-unknown/wasm-release/another-boids-in-rust.wasm | out wasm-bindgen --no-typescript --target web --out-dir ./out/ --out-name boids target/wasm32-unknown-unknown/wasm-release/another-boids-in-rust.wasm out/index.html: www/index.html