]> git.hungrycats.org Git - bees/commitdiff
test: rebuild the test programs when localconf changes
authorZygo Blaxell <bees@furryterror.org>
Mon, 24 Aug 2026 19:20:34 +0000 (15:20 -0400)
committerZygo Blaxell <bees@furryterror.org>
Sat, 5 Sep 2026 04:04:14 +0000 (00:04 -0400)
../localconf overrides CC, CXX and CCFLAGS but was not a prerequisite of
anything test/Makefile builds with them, so editing it recompiled
nothing and left the tree able to link objects from two compilers.
Under -flto that surfaces at link time as "plugin needed to handle lto
object", which names neither localconf nor the compilers.

test/Makefile gains BUILD_CONF and uses it wherever ../makeflags
appeared in a prerequisite list, including the link rules, and the .dep
rules that previously depended on neither file.  localconf is optional
and has no rule to create it, so $(wildcard) names it only when it
exists.

The same change to lib/Makefile and src/Makefile is already on next.
Only test/Makefile is left here: next carries a much smaller set of test
programs, so its version of this file converted only the rules that
exist there, and the rules this branch adds still needed converting.

Verified that an unchanged tree still does no recompiles, that touching
localconf now rebuilds, and that `make test' and `make build-check' both
pass afterwards.

Assisted-by: Claude-Code:claude-opus-5
test/Makefile

index b8559a0b9590480edbe36bd76118285e4dbe5f01..d079be84ffb6bfafc90318e73f8eda5b5309d122 100644 (file)
@@ -135,25 +135,25 @@ config-parse: config-parse.o ../src/bees-config.cc ../src/bees-config-v1.o ../sr
 # rule above for the listed targets.
 test-bees-plan.o: CXXFLAGS_EXTRA = $(SECTION_FLAGS)
 
-$(BEES_PROGRAMS:%=%.o): %.o: %.cc ../makeflags Makefile
+$(BEES_PROGRAMS:%=%.o): %.o: %.cc $(BUILD_CONF) Makefile
        $(CXX) $(BEES_CXXFLAGS) -I../src $(CXXFLAGS_EXTRA) -o $@ -c $<
 
-$(BEES_PROGRAMS:%=%.dep): %.dep: %.cc tests.h Makefile
+$(BEES_PROGRAMS:%=%.dep): %.dep: %.cc tests.h Makefile $(BUILD_CONF)
        $(CXX) $(BEES_CXXFLAGS) -I../src -M -MF $@ -MT $*.o $<
 
 # test-bees-borrower links a hand-picked subset (no unity build).
-test-bees-borrower: test-bees-borrower.o ../src/bees-borrower.o ../src/bees-planner-state.o ../src/bees-trace.o ../src/bees-log.o ../makeflags Makefile ../lib/libcrucible.a
+test-bees-borrower: test-bees-borrower.o ../src/bees-borrower.o ../src/bees-planner-state.o ../src/bees-trace.o ../src/bees-log.o $(BUILD_CONF) Makefile ../lib/libcrucible.a
        $(CXX) $(BEES_CXXFLAGS) $(BEES_LDFLAGS) -o $@ test-bees-borrower.o ../src/bees-borrower.o ../src/bees-planner-state.o ../src/bees-trace.o ../src/bees-log.o $(LIBS)
 
 # test-bees-filter includes ../src/bees-filter.cc directly (unity build), so it
 # needs nothing extra from the daemon at link time.
-test-bees-filter: test-bees-filter.o ../makeflags Makefile ../lib/libcrucible.a
+test-bees-filter: test-bees-filter.o $(BUILD_CONF) Makefile ../lib/libcrucible.a
        $(CXX) $(BEES_CXXFLAGS) $(BEES_LDFLAGS) -o $@ test-bees-filter.o $(LIBS)
 
 # test-bees-heatmap exercises the BeesHeatmap collector; the collector core is
 # header-only and std-only, but print() lives in bees-heatmap.o (it uses
 # crucible Table for layout), so the test links that one object from the daemon.
-test-bees-heatmap: test-bees-heatmap.o ../src/bees-heatmap.o ../makeflags Makefile ../lib/libcrucible.a
+test-bees-heatmap: test-bees-heatmap.o ../src/bees-heatmap.o $(BUILD_CONF) Makefile ../lib/libcrucible.a
        $(CXX) $(BEES_CXXFLAGS) $(BEES_LDFLAGS) -o $@ test-bees-heatmap.o ../src/bees-heatmap.o $(LIBS)
 
 # test-bees-plan exercises CostReport (the do-nothing cost model) only.  It
@@ -162,7 +162,7 @@ test-bees-heatmap: test-bees-heatmap.o ../src/bees-heatmap.o ../makeflags Makefi
 # operator<<(CostReport) code; those are the only things in bees-plan.cc that
 # reference bees-side pretty() and BeesExtent (bytenr/phys_size), so dropping
 # them keeps the test from dragging in the rest of the daemon.
-test-bees-plan-lib.o: ../src/bees-plan.cc ../makeflags Makefile
+test-bees-plan-lib.o: ../src/bees-plan.cc $(BUILD_CONF) Makefile
        $(CXX) $(BEES_CXXFLAGS) -I../src $(SECTION_FLAGS) -o $@ -c $<
 
 # test-bees-plan-lib.o is a test-local rebuild of ../src/bees-plan.cc, so the
@@ -172,7 +172,7 @@ test-bees-plan-lib.o: ../src/bees-plan.cc ../makeflags Makefile
 # BeesRewritePolicy layout) would leave this object stale and link it against a
 # freshly built test-bees-plan.o: an ABI mismatch that silently corrupts the
 # cost model.  Generate and include its header dependencies explicitly.
-test-bees-plan-lib.dep: ../src/bees-plan.cc ../makeflags Makefile
+test-bees-plan-lib.dep: ../src/bees-plan.cc $(BUILD_CONF) Makefile
        $(CXX) $(BEES_CXXFLAGS) -I../src -M -MF $@ -MT test-bees-plan-lib.o $<
 -include test-bees-plan-lib.dep
 
@@ -184,35 +184,35 @@ test-bees-plan-lib.dep: ../src/bees-plan.cc ../makeflags Makefile
 # it and pulls in unresolved bees-side deps (BeesNote, bees_log_emit, pretty,
 # BeesFileRange::fid) — breaking the gcc build.  The sectioned rebuild keeps only
 # BeesStats on both toolchains.  Mirrors test-bees-plan-lib.o's header-dep rule.
-test-bees-util-lib.o: ../src/bees-util.cc ../makeflags Makefile
+test-bees-util-lib.o: ../src/bees-util.cc $(BUILD_CONF) Makefile
        $(CXX) $(BEES_CXXFLAGS) -I../src $(SECTION_FLAGS) -o $@ -c $<
-test-bees-util-lib.dep: ../src/bees-util.cc ../makeflags Makefile
+test-bees-util-lib.dep: ../src/bees-util.cc $(BUILD_CONF) Makefile
        $(CXX) $(BEES_CXXFLAGS) -I../src -M -MF $@ -MT test-bees-util-lib.o $<
 -include test-bees-util-lib.dep
 
-test-bees-plan: test-bees-plan.o test-bees-plan-lib.o test-bees-util-lib.o ../makeflags Makefile ../lib/libcrucible.a
+test-bees-plan: test-bees-plan.o test-bees-plan-lib.o test-bees-util-lib.o $(BUILD_CONF) Makefile ../lib/libcrucible.a
        $(CXX) $(BEES_CXXFLAGS) $(SECTION_FLAGS) $(BEES_LDFLAGS) -Wl,--gc-sections -o $@ test-bees-plan.o test-bees-plan-lib.o test-bees-util-lib.o $(LIBS)
 
 # bench-bees-plan is a manual scaling/timing harness for the shortest-path
 # coverage search (not a pass/fail test, so deliberately NOT in PROGRAMS and
 # not run by `make test`).  Build on demand: `make bench-bees-plan`, then e.g.
 # `./bench-bees-plan 500 4096 64`.  Reuses test-bees-plan-lib.o.
-bench-bees-plan.o: bench-bees-plan.cc ../makeflags Makefile
+bench-bees-plan.o: bench-bees-plan.cc $(BUILD_CONF) Makefile
        $(CXX) $(BEES_CXXFLAGS) -I../src $(SECTION_FLAGS) -o $@ -c $<
 
 # bench-bees-plan is not in PROGRAMS, so its header dependencies are not tracked
 # by the generic %.dep rule; track them explicitly like test-bees-plan-lib.o
 # above, so a header change (e.g. bees.h's BeesRewritePolicy layout) rebuilds it.
-bench-bees-plan.dep: bench-bees-plan.cc ../makeflags Makefile
+bench-bees-plan.dep: bench-bees-plan.cc $(BUILD_CONF) Makefile
        $(CXX) $(BEES_CXXFLAGS) -I../src -M -MF $@ -MT bench-bees-plan.o $<
 -include bench-bees-plan.dep
 
 # Links test-bees-util-lib.o for the same BEESCOUNT symbols test-bees-plan needs
 # (bench-bees-plan.o pulls the same instrumented test-bees-plan-lib.o).
-bench-bees-plan: bench-bees-plan.o test-bees-plan-lib.o test-bees-util-lib.o ../makeflags Makefile ../lib/libcrucible.a
+bench-bees-plan: bench-bees-plan.o test-bees-plan-lib.o test-bees-util-lib.o $(BUILD_CONF) Makefile ../lib/libcrucible.a
        $(CXX) $(BEES_CXXFLAGS) $(SECTION_FLAGS) $(BEES_LDFLAGS) -Wl,--gc-sections -o $@ bench-bees-plan.o test-bees-plan-lib.o test-bees-util-lib.o $(LIBS)
 
-$(REPL_TESTS): %: %.o $(REPL_OBJS) ../makeflags Makefile ../lib/libcrucible.a
+$(REPL_TESTS): %: %.o $(REPL_OBJS) $(BUILD_CONF) Makefile ../lib/libcrucible.a
        $(CXX) $(BEES_CXXFLAGS) $(BEES_LDFLAGS) -o $@ $< $(REPL_OBJS) $(LIBS)
 
 clean: