From eaf42fab015441ac286a6eb4e8e1853866091221 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Thu, 23 Jul 2026 14:49:37 +0000 Subject: [PATCH] build: remove the depend phase/barrier from the top Makefile With per-file dependencies now generated during compilation (previous commit), the serial `depend` phase and its barrier are obsolete. Drop SUBDIRS_DEPEND and the `/Depend: ${DATABASE_H}` rule, and replace the `module@/lib@/tech@ %: depend` prerequisite with `: ${DATABASE_H}` -- the only real ordering constraint is the generated header, not a whole dependency-scanning pass. Modules therefore start compiling in parallel immediately instead of waiting for every subdir's deps to be scanned first. `make depend` is kept as a top-level no-op (the WASM build script still calls `emmake make depend`). Verified out-of-tree serial and -j12 and in-tree -j12: rc=0, 375 files, serial and -j installs byte-identical, zero Depend files, source tree clean. Co-Authored-By: Claude Opus 4.8 (1M context) --- Makefile.in | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/Makefile.in b/Makefile.in index 34c9a389..90663178 100644 --- a/Makefile.in +++ b/Makefile.in @@ -96,15 +96,16 @@ ${DATABASE_H}: ${MAGICSRC}/database/database.h.in prepare: ${DATABASE_H} # module@ builds /lib.o; lib@ builds /lib.a. -# Every module@/lib@ waits for the whole `depend` phase first (it used to be a -# prereq of the `modules`/`libs` aggregates; moving it onto each per-dir target -# keeps depend before compilation even under -j). +# The only thing they must wait for is the generated header (${DATABASE_H}). +# Header *dependencies* are now discovered automatically per source (.deps, see +# rules.mak), so there is no separate `depend` phase to gate on -- modules start +# compiling in parallel immediately. MODULE_TARGETS := $(addprefix module@,${MODULES}) LIB_TARGETS := $(addprefix lib@,${MODULES}) .PHONY: $(MODULE_TARGETS) $(LIB_TARGETS) -$(MODULE_TARGETS): module@%: depend +$(MODULE_TARGETS): module@%: ${DATABASE_H} @$(call submake,$*,module) -$(LIB_TARGETS): lib@%: depend +$(LIB_TARGETS): lib@%: ${DATABASE_H} @$(call submake,$*,lib) # Cross-module archive edge (-j correctness): libdatabase.a physically archives @@ -129,23 +130,20 @@ SUBDIRS = bplane cmwind commands database dbwind debug drc extflat extract graph BUNDLED_MODULES = readline lisp -# Unique list of all subdir that might have Depend file, we have to deduplicate otherwise -# MAKE will warning loudly. This list is somewhat empty when defs.mak does not exist +# Unique, deduplicated subdir list (used by the clean fan-out below). SUBDIRS_FILTERED := $(shell echo ${MODULES} ${PROGRAMS} ${SUBDIRS} | tr ' ' '\n' | sort | uniq) -SUBDIRS_DEPEND = $(addsuffix /Depend, ${SUBDIRS_FILTERED}) - -${SUBDIRS_DEPEND}: ${DATABASE_H} - @echo --- making dependencies - @$(call submake,$(patsubst %/,%,$(dir $@)),depend) - +# Dependencies are generated automatically as a side effect of compiling (see +# rules.mak .deps); there is no depend phase to run. "make depend" is kept as a +# no-op so callers that still invoke it (e.g. the WASM build script) do not error. .PHONY: depend -depend: defs.mak ${SUBDIRS_DEPEND} +depend: + @echo "--- dependencies are generated automatically during compilation" # tech@: build a technology dir (goal "all"). TECH_TARGETS := $(addprefix tech@,${TECHS}) .PHONY: $(TECH_TARGETS) -$(TECH_TARGETS): tech@%: depend +$(TECH_TARGETS): tech@%: ${DATABASE_H} @$(call submake,$*,all) .PHONY: techs