Files
ww/Makefile
Hojun-Cho d78956e5df make: isolate wwstage rules in per-target build dirs to fix -j rename race (#29)
The five $(BIN)/*_ww rules all built via `cd $(BIN) && ./ww build ...
; mv $(BIN)/main $@`. The ww driver writes the linker output to
<cwd>/<basename(src)> and has no -o flag, so every wwstage rule
landed on out/bin/main before its mv. Under `make -j8` the writes
and renames interleaved, leaving w6c_ww with a wwdump_ww (or other)
payload — silent under -j because the mv usually succeeded against
whatever `main` happened to exist at that instant. Symptom downstream:
test runs failing with `wwdump: cannot open -o`, recovered only by
falling back to -j1.

Build each rule in its own $(BIN)/<target>.d/ so the shared `main`
name is per-target. Switch -I and source args to $(CURDIR)/...
absolute paths and invoke ww by absolute path so the driver's
self_dir-relative libwwrt.a lookup still resolves to out/lib.

Side files (.combined.ww/.s/.o) land next to source via the parser's
source-path stem derivation, not cwd — unaffected. nocc target has
similar shape but its 4 builds are sequential recipe lines inside
one target so make -j can't parallelize them; not at risk today.

115/115 ok under both -j8 and -j1 from clean. ww2 == ww3 == ww4
byte-id holds.
2026-05-18 20:43:52 +09:00

37 KiB