build: remove bundled-readline wiring from the Makefiles (Patch 2)

With the bundled fallback gone (Patch 1) the readline/ special-casing is dead
machinery.  Remove it:

  * Makefile.in: $(submake) drops the `= readline` `-f`/mkdir branch and is now
    plain `$(MAKE) -C <dir> <goal>`; the clean loop drops its matching branch;
    `readline` is removed from BUNDLED_MODULES.
  * scripts/defs.mak.in: remove the `ifeq (@MAKE_READLINE@,1) -I${MAGICSRC}/
    readline` block (system readline headers are on the standard search path) and
    the MAKE_READLINE variable; tidy the srcdir-fallback comment (only the
    top-level Makefile uses it now).
  * scripts/configure.in: drop AC_SUBST(MAKE_READLINE); regenerate configure.

The system readline link flags (rl_libs = -lreadline via READLINE_LIBS) are
unchanged.  readline/ itself is deleted in the next patch.

Verified: no unsubstituted @MAKE_READLINE@; Tcl -j12 builds+installs 375 files
with readline/ not built; --without-tcl --disable-readline -j12 builds (x2).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Darryl L. Miles 2026-07-23 16:45:12 +00:00 committed by R. Timothy Edwards
parent 5d6c9899d4
commit 5e8b81cbcc
4 changed files with 14 additions and 32 deletions

View File

@ -26,14 +26,11 @@ INSTALL_CAD_DIRS = windows doc ${TECHS}
# the build tree), empty otherwise (the pre-built PostScript is installed as-is). # the build tree), empty otherwise (the pre-built PostScript is installed as-is).
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. Every module
# Every module is a configure-generated Makefile, so config.status # is a configure-generated Makefile, so config.status already created
# already created the build subdir with its Makefile: recurse natively. The one # the build subdir with its Makefile; recurse into it natively.
# exception is readline/, which is intentionally never converted; it has no
# generated Makefile, so it takes the -f path against the source Makefile (and its
# build subdir is created on demand).
define submake define submake
if test "x$(1)" = xreadline; then mkdir -p $(1) && $(MAKE) -C $(1) -f $(MAGICSRC)/$(1)/Makefile $(2); else $(MAKE) -C $(1) $(2); fi $(MAKE) -C $(1) $(2)
endef endef
all: $(ALL_TARGET) techs $(DOCS_TARGET) all: $(ALL_TARGET) techs $(DOCS_TARGET)
@ -57,8 +54,8 @@ config:
# Declarative subdir recursion. # Declarative subdir recursion.
# #
# Each (phase, dir) pair is a PHONY target "<phase>@<dir>" whose recipe recurses # Each (phase, dir) pair is a PHONY target "<phase>@<dir>" whose recipe recurses
# into <dir> with that phase's goal via $(submake) (so readline/ still takes the # into <dir> with that phase's goal via $(submake). A phase aggregate (modules,
# -f path). A phase aggregate (depend, modules, libs, ...) is then just a list # libs, ...) is then just a list
# of its per-dir targets as prerequisites -- no shell `for` loops, no FORCE # of its per-dir targets as prerequisites -- no shell `for` loops, no FORCE
# pattern-rule hack. Ordering between phases is expressed as prerequisites on the # pattern-rule hack. Ordering between phases is expressed as prerequisites on the
# per-dir targets (e.g. every module@ waits for the generated header ${DATABASE_H}), # per-dir targets (e.g. every module@ waits for the generated header ${DATABASE_H}),
@ -135,7 +132,7 @@ libs: $(LIB_TARGETS)
SUBDIRS = bplane cmwind commands database dbwind debug drc extflat extract graphics \ SUBDIRS = bplane cmwind commands database dbwind debug drc extflat extract graphics \
magic netmenu plow resis select sim textio tiles utils windows wiring magic netmenu plow resis select sim textio tiles utils windows wiring
BUNDLED_MODULES = readline lisp BUNDLED_MODULES = lisp
# Unique, deduplicated subdir list (used by the clean fan-out below). # Unique, deduplicated subdir list (used by the clean fan-out below).
SUBDIRS_FILTERED := $(shell echo ${MODULES} ${PROGRAMS} ${SUBDIRS} | tr ' ' '\n' | sort | uniq) SUBDIRS_FILTERED := $(shell echo ${MODULES} ${PROGRAMS} ${SUBDIRS} | tr ' ' '\n' | sort | uniq)
@ -207,14 +204,11 @@ $(INSTALLTCL_TARGETS): install-tcl@%: install-tcl-dirs
install-tcl-real: $(INSTALLTCL_TARGETS) install-tcl-real: $(INSTALLTCL_TARGETS)
# clean@<dir>: clean one subdir if it exists. Must not create dirs (skip absent # clean@<dir>: clean one subdir if it exists. Must not create dirs (skip absent
# ones) and must not fail the build (|| true). readline/ uses the -f path # ones) and must not fail the build (|| true).
# (mirrors $(submake); it is the one unconverted module).
CLEAN_TARGETS := $(addprefix clean@,$(sort ${SUBDIRS_FILTERED} ${TECHS} ${BUNDLED_MODULES})) CLEAN_TARGETS := $(addprefix clean@,$(sort ${SUBDIRS_FILTERED} ${TECHS} ${BUNDLED_MODULES}))
.PHONY: $(CLEAN_TARGETS) .PHONY: $(CLEAN_TARGETS)
$(CLEAN_TARGETS): clean@%: $(CLEAN_TARGETS): clean@%:
@test -d $* || exit 0; \ @test -d $* || exit 0; ${MAKE} -C $* clean || true
if test "x$*" = xreadline; then ${MAKE} -C $* -f ${MAGICSRC}/$*/Makefile clean; \
else ${MAKE} -C $* clean; fi || true
.PHONY: clean .PHONY: clean
clean: $(CLEAN_TARGETS) clean: $(CLEAN_TARGETS)

3
scripts/configure vendored
View File

@ -622,7 +622,6 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS ac_subst_vars='LTLIBOBJS
LIBOBJS LIBOBJS
MAKE_READLINE
MAKE_CAIRO MAKE_CAIRO
MAKE_GLU MAKE_GLU
MAKE_GL MAKE_GL
@ -9502,8 +9501,6 @@ MAKE_GLU=$usingGLU
MAKE_CAIRO=$usingCairo MAKE_CAIRO=$usingCairo
MAKE_READLINE=0
ac_config_files="$ac_config_files Makefile:Makefile.in" ac_config_files="$ac_config_files Makefile:Makefile.in"

View File

@ -2058,7 +2058,6 @@ AC_SUBST(MAKE_X11, [$usingX11])
AC_SUBST(MAKE_GL, [$usingOGL]) AC_SUBST(MAKE_GL, [$usingOGL])
AC_SUBST(MAKE_GLU, [$usingGLU]) AC_SUBST(MAKE_GLU, [$usingGLU])
AC_SUBST(MAKE_CAIRO, [$usingCairo]) AC_SUBST(MAKE_CAIRO, [$usingCairo])
AC_SUBST(MAKE_READLINE, [0])
dnl Name the .in templates explicitly (relative to srcdir) so config.status can dnl Name the .in templates explicitly (relative to srcdir) so config.status can
dnl find them when run from a separate build directory. Outputs land in the dnl find them when run from a separate build directory. Outputs land in the

View File

@ -19,12 +19,11 @@ MAGICSRC = @abs_top_srcdir@
BUILD_TOP := $(abspath $(MAGICDIR)) BUILD_TOP := $(abspath $(MAGICDIR))
# Minimal srcdir fallback. Every module converted to Makefile.in sets # Minimal srcdir fallback. Every module converted to Makefile.in sets
# `srcdir` (and VPATH) from @srcdir@ *before* including this file. The only # `srcdir` (and VPATH) from @srcdir@ *before* including this file. The only
# Makefiles that do NOT are readline/ (intentionally never converted) and the # Makefile that does NOT is the top-level Makefile, which does not compile magic
# top-level Makefile; neither compiles magic sources through the pattern rules, so # sources through the pattern rules and so needs no VPATH. We only default
# neither needs VPATH. We only default `srcdir` -- derived from where make is # `srcdir` -- derived from where make is running (CURDIR, a build dir) relative to
# running (CURDIR, a build dir) relative to BUILD_TOP -- so that CPPFLAGS, which # BUILD_TOP -- so that CPPFLAGS, which lists -I${srcdir}, stays well-formed. The
# lists -I${srcdir}, stays well-formed. The patsubst is an anchored prefix strip: # patsubst is an anchored prefix strip: "" at the build top.
# "" at the build top, "/readline" in the readline subdir.
ifeq ($(origin srcdir),undefined) ifeq ($(origin srcdir),undefined)
srcdir := $(MAGICSRC)$(patsubst $(BUILD_TOP)%,%,$(CURDIR)) srcdir := $(MAGICSRC)$(patsubst $(BUILD_TOP)%,%,$(CURDIR))
endif endif
@ -186,12 +185,6 @@ CXX = @CXX@
# -I${srcdir}: this module's source dir, for same-directory headers # -I${srcdir}: this module's source dir, for same-directory headers
CPPFLAGS = -I${GENINC} -I${MAGICSRC} -I${srcdir} @CPPFLAGS@ CPPFLAGS = -I${GENINC} -I${MAGICSRC} -I${srcdir} @CPPFLAGS@
CXXFLAGS = @CXXFLAGS@ CXXFLAGS = @CXXFLAGS@
# Bundled GNU readline: its headers use <readline/*.h> includes, so the readline
# source's parent directory must be on the include path. Only for the bundled
# build (@MAKE_READLINE@ = 1); a no-op with a system or disabled readline.
ifeq (@MAKE_READLINE@,1)
CPPFLAGS += -I${MAGICSRC}/readline
endif
DFLAGS_MAGICVERSION = -DMAGIC_VERSION=\"${MAGIC_VERSION}\" -DMAGIC_REVISION=\"${MAGIC_REVISION}\" -DMAGIC_COMMIT=\"${MAGIC_COMMIT}\" ${MAGIC_BUILDDATE_DEFS} DFLAGS_MAGICVERSION = -DMAGIC_VERSION=\"${MAGIC_VERSION}\" -DMAGIC_REVISION=\"${MAGIC_REVISION}\" -DMAGIC_COMMIT=\"${MAGIC_COMMIT}\" ${MAGIC_BUILDDATE_DEFS}
ifeq (${MAGIC_BUILDDATE_DEFS},) ifeq (${MAGIC_BUILDDATE_DEFS},)
DFLAGS_MAGICVERSION += "-DMAGIC_BUILDDATE=\"${MAGIC_BUILDDATE}\"" DFLAGS_MAGICVERSION += "-DMAGIC_BUILDDATE=\"${MAGIC_BUILDDATE}\""
@ -244,4 +237,3 @@ MAKE_X11 = @MAKE_X11@
MAKE_GL = @MAKE_GL@ MAKE_GL = @MAKE_GL@
MAKE_GLU = @MAKE_GLU@ MAKE_GLU = @MAKE_GLU@
MAKE_CAIRO = @MAKE_CAIRO@ MAKE_CAIRO = @MAKE_CAIRO@
MAKE_READLINE = @MAKE_READLINE@