From 4a5d3565ae6fab8ba7da1ce38dccf528132d65da Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Sun, 18 Oct 2026 07:51:41 -0500 Subject: [PATCH 1/2] Rebuild m16_native.o and nvrm.o when PHYSICS_DIR changes (#488) Co-Authored-By: Claude Sonnet 5.5 --- Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6b53cd124..67f12296b 100644 --- a/Makefile +++ b/Makefile @@ -116,10 +116,20 @@ $(OUT_DIR): $(OUT_DIR)/%.o: src/%.c | $(OUT_DIR) $(CC) $(CFLAGS) -c $< -o $@ -$(OUT_DIR)/m16_native.o: $(PHYSICS_DIR)/m16/m16_native.c | $(OUT_DIR) +# The physics-built objects must be rebuilt when PHYSICS_DIR points somewhere else (#488), not only +# when a file there is newer. The stamp records the resolved PHYSICS_DIR and its git HEAD, and is +# rewritten only when that text changes, so an unchanged PHYSICS_DIR rebuilds nothing. +PHYSICS_STAMP = $(OUT_DIR)/physics.stamp +.PHONY: FORCE +FORCE: +$(PHYSICS_STAMP): FORCE | $(OUT_DIR) + @new="$$(cd '$(PHYSICS_DIR)' 2>/dev/null && pwd -P || echo '$(PHYSICS_DIR)') $$(git -C '$(PHYSICS_DIR)' rev-parse HEAD 2>/dev/null || echo nogit)"; \ + if [ "$$(cat $@ 2>/dev/null)" != "$$new" ]; then printf '%s\n' "$$new" > $@; fi + +$(OUT_DIR)/m16_native.o: $(PHYSICS_DIR)/m16/m16_native.c $(PHYSICS_STAMP) | $(OUT_DIR) $(CC) $(CFLAGS) -c $< -o $@ -$(OUT_DIR)/nvrm.o: $(PHYSICS_DIR)/nvrm/nvrm.c | $(OUT_DIR) +$(OUT_DIR)/nvrm.o: $(PHYSICS_DIR)/nvrm/nvrm.c $(PHYSICS_STAMP) | $(OUT_DIR) $(CC) $(CFLAGS) -c $< -o $@ $(OUT_DIR)/crumbline/%.o: src/crumbline/%.c | $(OUT_DIR) From 61480112e878a5c6a181cfc0b61c53af39a0519d Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Fri, 30 Oct 2026 09:49:54 -0500 Subject: [PATCH 2/2] build: gate physics objects on the lock check and a PHYSICS_DIR stamp (#488) Builds on #546 (the stamp). The objects that read the physics tree (m16_native.o, nvrm.o, and the eight objects whose sources include m16_native.h or nvrm.h from it) now depend on build/physics.stamp, whose phony prerequisite is check-physics-lock. A different PHYSICS_DIR or physics commit rewrites the stamp and rebuilds them; an unchanged one rebuilds nothing; a refused lock check stops before any of them compiles, with or without -j and for both omegatool and libomega_gpu.a. The other objects take nothing from PHYSICS_DIR (byte-identical across physics trees) and stay ungated, so crumbline-learner, omega and test-program-id still build without a pinned physics checkout. --- .crumb | 16 ++++++++-------- Makefile | 24 ++++++++++++++++-------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.crumb b/.crumb index f3e51fe46..3a0370aed 100644 --- a/.crumb +++ b/.crumb @@ -72,38 +72,38 @@ }, { "digest": "f765ad87fdddd9b47f690b07298c951a0f7e7675dc5de4ffe44e33a0c14b1986", - "last_commit": "a8a6a3d3c", + "last_commit": "62d1d0d66", "name": "spec", "purpose": "Directory spec. Purpose not yet described by a human." }, { "digest": "aaf5acb82fd4c720cd60c85fd6087f636c72a98e2f3740c9295dcfa525dc64d7", - "last_commit": "bf54b19fa", + "last_commit": "089e5b053", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { "digest": "5395ff8ff9afceebe8e453788f80a3064b831513cc4cb92fd55869115e06b874", - "last_commit": "a8a6a3d3c", + "last_commit": "62d1d0d66", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, { "digest": "308db0e6cf45c0a48f01f5f5f228450f191389de68006915b9ecf9c65b9a2e29", - "last_commit": "a8a6a3d3c", + "last_commit": "62d1d0d66", "name": "tools", "purpose": "Directory tools. Purpose not yet described by a human." } ], "children_root": "sha256:07bf1706dcffbad66c0353871ff67a6749055da03cee8d8ebdf9a4c91e36bddc", - "compiled_at": "2026-10-30T12:31:50Z", + "compiled_at": "2026-10-30T14:49:50Z", "compiler": "crumb-compile/1", - "digest": "sha256:904fca8c0e0cf3e3a5e5adb73393e01c7018b920bb542d289904240f70e400d6", + "digest": "sha256:094521d494467f6afd190b1c13df772e0c21a5e33d7796bd9748127697abb279", "evidence_files": 12622, "evidence_root": "sha256:b1a08e2ce56e6feada0d8a31f06fbd7adee57adc1c1ad8dec220293ee5d439f9", "files": 17849, - "generated_at_commit": "52a82f392fa513ebbc2d9d719a0f14c385289b06", - "source_tree": "sha256:75458da6553a0ee5ea2af95f46afb658e8a3f6e53cca6e3b4b9874035f78c2ed" + "generated_at_commit": "4a5d3565ae6fab8ba7da1ce38dccf528132d65da", + "source_tree": "sha256:ea58987f0a894a067450c360b50a9d126b3dd20d9de4f734565fb53b4f1e07dd" }, "owner_lane": "", "provenance": { diff --git a/Makefile b/Makefile index 67f12296b..2f4155d99 100644 --- a/Makefile +++ b/Makefile @@ -116,20 +116,28 @@ $(OUT_DIR): $(OUT_DIR)/%.o: src/%.c | $(OUT_DIR) $(CC) $(CFLAGS) -c $< -o $@ -# The physics-built objects must be rebuilt when PHYSICS_DIR points somewhere else (#488), not only -# when a file there is newer. The stamp records the resolved PHYSICS_DIR and its git HEAD, and is -# rewritten only when that text changes, so an unchanged PHYSICS_DIR rebuilds nothing. +# Objects that read the physics tree: the two compiled from it, and the sources that include +# m16_native.h or nvrm.h from it (directly or through src/*.h; `gcc -MM` lists a $(PHYSICS_DIR) +# path for exactly these). They must be rebuilt when PHYSICS_DIR points at another tree, not only +# when a file there is newer, and none may compile before check-physics-lock passes (#488). +# The stamp records the resolved PHYSICS_DIR and its git HEAD and is rewritten only when that +# text changes, so an unchanged PHYSICS_DIR rebuilds nothing. Its phony prerequisite runs the +# lock check first: when the check refuses, the stamp is not made and no physics object compiles. +# The other objects take nothing from PHYSICS_DIR and are shared with physics-free builds +# (crumbline-learner, omega, test-program-id), so they stay ungated. PHYSICS_STAMP = $(OUT_DIR)/physics.stamp -.PHONY: FORCE -FORCE: -$(PHYSICS_STAMP): FORCE | $(OUT_DIR) +PHYSICS_OBJS = $(addprefix $(OUT_DIR)/,m16_native.o nvrm.o omegatool.o omega_accelerator_world.o \ + omega_blackwell_submit.o omega_blackwell_engine.o omega_blackwell_gates.o \ + omega_gpu_platform_linux.o omega_world_gates.o omega_evidence.o) +$(PHYSICS_STAMP): check-physics-lock | $(OUT_DIR) @new="$$(cd '$(PHYSICS_DIR)' 2>/dev/null && pwd -P || echo '$(PHYSICS_DIR)') $$(git -C '$(PHYSICS_DIR)' rev-parse HEAD 2>/dev/null || echo nogit)"; \ if [ "$$(cat $@ 2>/dev/null)" != "$$new" ]; then printf '%s\n' "$$new" > $@; fi +$(PHYSICS_OBJS): $(PHYSICS_STAMP) -$(OUT_DIR)/m16_native.o: $(PHYSICS_DIR)/m16/m16_native.c $(PHYSICS_STAMP) | $(OUT_DIR) +$(OUT_DIR)/m16_native.o: $(PHYSICS_DIR)/m16/m16_native.c | $(OUT_DIR) $(CC) $(CFLAGS) -c $< -o $@ -$(OUT_DIR)/nvrm.o: $(PHYSICS_DIR)/nvrm/nvrm.c $(PHYSICS_STAMP) | $(OUT_DIR) +$(OUT_DIR)/nvrm.o: $(PHYSICS_DIR)/nvrm/nvrm.c | $(OUT_DIR) $(CC) $(CFLAGS) -c $< -o $@ $(OUT_DIR)/crumbline/%.o: src/crumbline/%.c | $(OUT_DIR)