build: make the -f recursion path readline-specific
Every module is now a configure-generated Makefile, so the generic "use -f if there is no build Makefile" fallback in $(submake) and in the clean loop is only ever reached by readline/ (the one module that is intentionally never converted). Replace the generic `test -f $dir/Makefile` probe with an explicit `$dir = readline` check: recurse natively everywhere, take the -f path (against the source Makefile, creating the build subdir on demand) only for readline. A converted module whose build Makefile is somehow missing now fails loudly instead of silently falling back to -f. Verified out-of-tree: default (Tcl) make+install+clean rc=0 (375 files); --without-tcl make+clean rc=0 with readline/libreadline.a + magic/magic built through the readline -f path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
54a5a919bb
commit
79e6863aa8
20
Makefile.in
20
Makefile.in
|
|
@ -27,13 +27,13 @@ INSTALL_CAD_DIRS = windows doc ${TECHS}
|
||||||
DOCS_TARGET = @DOCS_TARGET@
|
DOCS_TARGET = @DOCS_TARGET@
|
||||||
|
|
||||||
# $(call submake,<dir>,<goal>) -- recurse into a build subdirectory.
|
# $(call submake,<dir>,<goal>) -- recurse into a build subdirectory.
|
||||||
# Use the generated build Makefile if config.status created one there (a module
|
# Every module is a configure-generated Makefile, so config.status
|
||||||
# converted to Makefile.in); otherwise fall back to the source Makefile
|
# already created the build subdir with its Makefile: recurse natively. The one
|
||||||
# with -f. The build subdir is created on demand. During the
|
# exception is readline/, which is intentionally never converted; it has no
|
||||||
# Makefile.in migration both kinds coexist; readline/ is intentionally never
|
# generated Makefile, so it takes the -f path against the source Makefile (and its
|
||||||
# converted, so it always takes the -f path.
|
# build subdir is created on demand).
|
||||||
define submake
|
define submake
|
||||||
mkdir -p $(1) && if test -f $(1)/Makefile; then $(MAKE) -C $(1) $(2); else $(MAKE) -C $(1) -f $(MAGICSRC)/$(1)/Makefile $(2); fi
|
if test "x$(1)" = xreadline; then mkdir -p $(1) && $(MAKE) -C $(1) -f $(MAGICSRC)/$(1)/Makefile $(2); else $(MAKE) -C $(1) $(2); fi
|
||||||
endef
|
endef
|
||||||
|
|
||||||
all: $(ALL_TARGET) techs $(DOCS_TARGET)
|
all: $(ALL_TARGET) techs $(DOCS_TARGET)
|
||||||
|
|
@ -167,12 +167,12 @@ install-tcl-real: install-tcl-dirs
|
||||||
$(call submake,$$dir,install-tcl); done
|
$(call submake,$$dir,install-tcl); done
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@# clean must not create dirs: skip absent ones, and use the generated build
|
@# clean must not create dirs: skip absent ones. Recurse natively;
|
||||||
@# Makefile if present else the source one (mirrors $(submake) without mkdir).
|
@# readline/ is the one unconverted module, so it uses -f (mirrors $(submake)).
|
||||||
for dir in ${SUBDIRS_FILTERED} ${TECHS} ${BUNDLED_MODULES}; do \
|
for dir in ${SUBDIRS_FILTERED} ${TECHS} ${BUNDLED_MODULES}; do \
|
||||||
test -d $$dir || continue; \
|
test -d $$dir || continue; \
|
||||||
if test -f $$dir/Makefile; then ${MAKE} -C $$dir clean; \
|
if test "x$$dir" = xreadline; then ${MAKE} -C $$dir -f ${MAGICSRC}/$$dir/Makefile clean; \
|
||||||
else ${MAKE} -C $$dir -f ${MAGICSRC}/$$dir/Makefile clean; fi || true; done
|
else ${MAKE} -C $$dir clean; fi || true; done
|
||||||
${RM} *.tmp */*.tmp *.sav */*.sav *.log TAGS tags
|
${RM} *.tmp */*.tmp *.sav */*.sav *.log TAGS tags
|
||||||
|
|
||||||
distclean:
|
distclean:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue