Commit 58f10004
58f100045ab4Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
Speed up incremental test builds
Avoid treating same-content source touches as stamp changes. The stamp recipe now rechecks content through a FORCE target and only updates the stamp when the file contents actually differ, so bootstrap and test targets do not get invalidated by unchanged checkouts or mtimes.
Add a fast-test target for development loops that forces the test suite with cheaper C optimization and LTO disabled.
Co-Authored-By: Claude Opus 4.8 [email protected]
Details
- Commit
- 58f100045ab4
- Parent
- e497084a1b80
MakefilemodifiedView file
@@ -5,6 +5,7 @@
55
# make parse Build C parser only66
# make bootstrap Bootstrap the compiler backend77
# make test Run feature tests (requires bootstrap first)8+
# make fast-test Force feature tests with cheaper C optimization89
# make bench Run benchmarks (requires bootstrap first)910
# make clean Remove built binaries1011
@@ -136,7 +137,7 @@
136137
COMPILER_HELPERS_STAMP := build/stamps/compiler_helpers.rb.stamp137138
PARSE_STAMP := build/stamps/spinel_parse.c.stamp138139
139-
.PHONY: all parse bootstrap codegen rbs_extract test retest clean-test-results regen-expected bench optcarrot clean install uninstall deps140+
.PHONY: all parse bootstrap codegen rbs_extract test retest fast-test clean-test-results regen-expected bench optcarrot clean install uninstall deps FORCE140141
141142
# `make all` includes spinel_rbs_extract when vendor/rbs has been142143
# fetched (via `make deps`). Without vendor/rbs the extractor is@@ -217,15 +218,22 @@
217218
$(CC) -c -O2 -Wno-all -I$(RBS_INC) -I$(RBS_DIR)/src $< -o $@218219
219220
# ---- Content stamps ----220-
# Content stamps: rules depend on `build/stamps/foo.stamp` instead of221-
# `foo` directly, so `touch foo` (or `git checkout` of an identical222-
# version) doesn't invalidate downstream targets. cmp-or-replace223-
# advances the stamp's mtime only on real content change.221+
# Content stamps: downstream rules depend on `build/stamps/foo.stamp`222+
# instead of `foo` directly, so `touch foo` (or `git checkout` of an223+
# identical version) doesn't invalidate bootstrap/test targets.224+
#225+
# The stamp rule intentionally does not list `%` as a normal prerequisite:226+
# if it did, a same-content but newer source would make GNU make consider227+
# the stamp out-of-date on every run when cmp leaves the stamp untouched.228+
# FORCE lets us cheaply re-check content each invocation, while downstream229+
# targets only rebuild when cp actually advances the stamp's mtime.224230
build/stamps:225231
@mkdir -p $@226232
227-
build/stamps/%.stamp: % | build/stamps228-
@cmp -s $< $@ 2>/dev/null || cp $< $@233+
FORCE:234+
235+
build/stamps/%.stamp: FORCE | build/stamps236+
@cmp -s $* $@ 2>/dev/null || cp $* $@229237
230238
# Without .PRECIOUS make would delete these as pattern-rule231239
# intermediates, recreating them with fresh mtimes next run.@@ -433,6 +441,9 @@
433441
retest: clean-test-results434442
@$(MAKE) --no-print-directory test435443
444+
fast-test: clean-test-results445+
@$(MAKE) --no-print-directory test OPT=-O0 LTO=0446+
436447
# The .ok target is the test's stamp; mtime tracking gives per-test437448
# caching for free. Order-only spinel_parse$(EXE) / spinel_analyze$(EXE)438449
# / spinel_codegen$(EXE) stop a bootstrap relink from invalidating every test.