From d34d0a31f26ed43d75b03649946ce2c8a656bfe9 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Fri, 19 Dec 2025 11:16:01 -0600 Subject: [PATCH] Fix: Folder deps need to be order-only deps I did the thing againnnnn. The Makefile thinks the sound assets are constantly out-of-date because the folder that contains them technically changes any time a file is added or removed from the folder. 1. "out/assets" is created, it is up-to-date 2. "out/assets/example.ogg" is created, it is up-to-date 3. Parent folder "out/assets" has it's mtime updated because it's contents have changed. It is newer than it was at step 1, and newer than the .ogg file in step 2. 4. run `make` again 5. "out/assets" is up-to-date, nothing changes 6. "out/assets/example.ogg" is OLDER than one of it's dependencies ("out/assets/"), and is rebuilt. 7. "out/assets" got new contents, so it's mtime was updated again. The cycle isn't infinite, but it will always try to rebuild the sound files. The fix is to consider the containing folder to only be an ordering dependency rather than a substantive dependency. The former only needs the dependency to be made first, where the latter considers the dependency to be part of the target file. The containing folder is not part of the sound files, so "rebuilding" the sound files when the folder changes is complete nonsense. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 630c945..c20e9df 100644 --- a/Makefile +++ b/Makefile @@ -40,10 +40,10 @@ target/$(CARGO_TARGET)/$(CARGO_PROFILE)/asteroids.wasm: $(SRCS) Cargo.lock Cargo out: mkdir $@ -out/assets: out +out/assets: | out mkdir $@ -out/assets/%.ogg: out/assets assets/%.ogg +out/assets/%.ogg: assets/%.ogg | out/assets cp -ar assets/$*.ogg $@ # Both the JS and WASM files are generated by the wasm-bindgen call, so both