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).
DOCS_TARGET = @DOCS_TARGET@
# $(call submake,<dir>,<goal>) -- recurse into a build subdirectory.
# Every module is a configure-generated Makefile, so config.status
# already created the build subdir with its Makefile: recurse natively. The one
# 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).
# $(call submake,<dir>,<goal>) -- recurse into a build subdirectory. Every module
# is a configure-generated Makefile, so config.status already created
# the build subdir with its Makefile; recurse into it natively.
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
all: $(ALL_TARGET) techs $(DOCS_TARGET)
@ -57,8 +54,8 @@ config:
# Declarative subdir recursion.
#
# 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
# -f path). A phase aggregate (depend, modules, libs, ...) is then just a list
# into <dir> with that phase's goal via $(submake). A phase aggregate (modules,
# libs, ...) is then just a list
# 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
# 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 \
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).
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)
# 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
# (mirrors $(submake); it is the one unconverted module).
# ones) and must not fail the build (|| true).
CLEAN_TARGETS := $(addprefix clean@,$(sort ${SUBDIRS_FILTERED} ${TECHS} ${BUNDLED_MODULES}))
.PHONY: $(CLEAN_TARGETS)
$(CLEAN_TARGETS): clean@%:
@test -d $* || exit 0; \
if test "x$*" = xreadline; then ${MAKE} -C $* -f ${MAGICSRC}/$*/Makefile clean; \
else ${MAKE} -C $* clean; fi || true
@test -d $* || exit 0; ${MAKE} -C $* clean || true
.PHONY: clean
clean: $(CLEAN_TARGETS)

3
scripts/configure vendored
View File

@ -622,7 +622,6 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
MAKE_READLINE
MAKE_CAIRO
MAKE_GLU
MAKE_GL
@ -9502,8 +9501,6 @@ MAKE_GLU=$usingGLU
MAKE_CAIRO=$usingCairo
MAKE_READLINE=0
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_GLU, [$usingGLU])
AC_SUBST(MAKE_CAIRO, [$usingCairo])
AC_SUBST(MAKE_READLINE, [0])
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

View File

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