build: include rules.mak from source, drop the build-top copy

rules.mak has no @...@ substitutions, so there is no reason to copy it into
the build top.  Point all 38 subdir Makefile.in includes at the source copy
directly -- ${MAGICSRC}/rules.mak instead of ${MAGICDIR}/rules.mak -- and
remove AC_CONFIG_FILES([rules.mak:rules.mak]) from configure.  defs.mak (the
one make fragment with substitutions) remains the only generated file in the
build top.  readline/ and the top Makefile never included rules.mak, so they
are unaffected; AC_CONFIG_SRCDIR(rules.mak) (the srcdir sentinel) is kept.

Now editing rules.mak in the source tree takes effect without reconfiguring.

Verified rc=0, 375 files, both in-tree and out-of-tree; out-of-tree build
top has no rules.mak; distclean rc=0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Darryl L. Miles 2026-07-22 19:11:10 +00:00 committed by R. Timothy Edwards
parent 69dff2aaa8
commit 2b4fcf5968
42 changed files with 47 additions and 48 deletions

3
.gitignore vendored
View File

@ -140,3 +140,6 @@ doc/latexfiles/psfiles/
doc/latexfiles/*.dvi
doc/latexfiles/*.aux
doc/latexfiles/*.log
# Out-of-tree build directory (generated; was accidentally committed in e7fd0e90)
/build-alt/

View File

@ -178,9 +178,9 @@ clean:
distclean:
touch defs.mak
@${MAKE} clean
# NB: do NOT remove rules.mak here. In-tree (build == source) it is the
# tracked source file, not a generated one; out-of-tree the build dir is
# disposable, so leaving its generated copy is harmless.
# rules.mak is no longer copied into the build top (subdir Makefiles include
# ${MAGICSRC}/rules.mak straight from the source tree), so there is nothing to
# remove for it here; defs.mak is the only generated make fragment.
${RM} defs.mak old.defs.mak
${RM} scripts/makedbh scripts/default.conf
${RM} config.log config.status

View File

@ -11,4 +11,4 @@ MAGICDIR = @top_builddir@
SRCS = bpDump.c bpUtils.c bpBins.c bpEnum.c bpMain.c bpStat.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -11,4 +11,4 @@ MAGICDIR = @top_builddir@
SRCS = CalmaRead.c CalmaRdcl.c CalmaRdio.c CalmaRdpt.c CalmaWrite.c CalmaWriteZ.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -12,4 +12,4 @@ SRCS = CIFgen.c CIFhier.c CIFmain.c CIFrdcl.c CIFrdpt.c CIFrdpoly.c \
CIFrdtech.c CIFrdutils.c CIFsee.c CIFtech.c CIFwrite.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -11,4 +11,4 @@ MAGICDIR = @top_builddir@
SRCS = CMWmain.c CMWcmmnds.c CMWundo.c CMWrgbhsv.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -21,4 +21,4 @@ ${MAGICDIR}/readline/readline:
${MAKE} -C ${MAGICDIR}/readline readline-create-symlinks
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -34,4 +34,4 @@ LIB_OBJS += ${MAGICDIR}/tiles/libtiles.o ${MAGICDIR}/utils/libutils.o
database.h: ${MAGICSRC}/database/database.h.in
${MAKE} -C ${MAGICDIR} $(patsubst ${MAGICDIR}/%,%,${DATABASE_H})
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -12,4 +12,4 @@ SRCS = DBWcommands.c DBWdisplay.c DBWbuttons.c DBWelement.c \
DBWfdback.c DBWhlights.c DBWprocs.c DBWtools.c DBWundo.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -11,4 +11,4 @@ MAGICDIR = @top_builddir@
SRCS = debugFlags.c hist.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -12,4 +12,4 @@ SRCS = DRCarray.c DRCbasic.c DRCcif.c DRCcontin.c DRCmain.c \
DRCsubcell.c DRCtech.c DRCprint.c DRCextend.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -48,4 +48,4 @@ $(DESTDIR)${INSTALL_TCLDIR}/exttosim${SHDLIB_EXT}: exttosim${SHDLIB_EXT}
${RM} $(DESTDIR)${INSTALL_TCLDIR}/exttosim${SHDLIB_EXT}
${CP} exttosim${SHDLIB_EXT} $(DESTDIR)${INSTALL_TCLDIR}/exttosim${SHDLIB_EXT}
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -48,4 +48,4 @@ $(DESTDIR)${INSTALL_BINDIR}/spice2sim: spice2sim
${RM} $(DESTDIR)${INSTALL_BINDIR}/spice2sim
${CP} $< $(DESTDIR)${INSTALL_BINDIR}/spice2sim
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -23,4 +23,4 @@ install: $(DESTDIR)${BINDIR}/${MODULE}${EXEEXT}
install-tcl:
echo "Nothing to do here"
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -12,4 +12,4 @@ SRCS = EFargs.c EFbuild.c EFdef.c EFerr.c EFflat.c EFhier.c EFname.c \
EFread.c EFsym.c EFvisit.c EFantenna.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -14,4 +14,4 @@ SRCS = ExtArray.c ExtBasic.c ExtCell.c ExtCouple.c ExtHard.c \
ExtInter.c ExtUnique.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -12,4 +12,4 @@ SRCS = gaChannel.c gaMain.c gaMaze.c gaSimple.c gaStem.c \
gaTest.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -13,4 +13,4 @@ SRCS = gcrChannel.c gcrColl.c gcrDebug.c gcrEdge.c gcrFeas.c \
gcrUnsplit.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -82,4 +82,4 @@ fonts: ${OUTLINE_FONTS}
${RM} $(DESTDIR)${INSTALL_SYSDIR}/$$i; \
${CP} $(srcdir)/$$i $(DESTDIR)${INSTALL_SYSDIR}; done
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -12,4 +12,4 @@ SRCS = grouteChan.c grouteCrss.c grouteDens.c grouteMain.c \
grouteMult.c grouteMaze.c groutePath.c groutePen.c grouteTest.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -11,4 +11,4 @@ MAGICDIR = @top_builddir@
SRCS = irCommand.c irMain.c irRoute.c irTestCmd.c irUtils.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -32,4 +32,4 @@ $(DESTDIR)${INSTALL_TCLDIR}/magiclef${SHDLIB_EXT}: magiclef${SHDLIB_EXT}
${RM} $(DESTDIR)${INSTALL_TCLDIR}/magiclef${SHDLIB_EXT}
${CP} magiclef${SHDLIB_EXT} $(DESTDIR)${INSTALL_TCLDIR}/magiclef${SHDLIB_EXT}
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -37,4 +37,4 @@ $(DESTDIR)${INSTALL_SCMDIR}/%: scm/%
test -d "$(DESTDIR)$(INSTALL_SCMDIR)" || mkdir -p "$(DESTDIR)$(INSTALL_SCMDIR)"
${CP} scm/$* $(DESTDIR)$(INSTALL_SCMDIR)/$*
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -112,7 +112,7 @@ $(DESTDIR)${INSTALL_SYSDIR}/magicps.pro: magicps.pro
${RM} $(DESTDIR)${INSTALL_SYSDIR}/magicps.pro
${CP} $< $(DESTDIR)${INSTALL_SYSDIR}/magicps.pro
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak
ifeq (${MAKE_WASM},1)
# rules.mak defines `${MODULE}` (= `magic`) with a recipe that links a native

View File

@ -14,4 +14,4 @@ SRCS = mzBlock.c mzDebug.c mzEstimate.c mzXtndDown.c \
mzWalk.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -24,4 +24,4 @@ install: $(DESTDIR)${INSTALL_BINDIR}/${MODULE}${EXEEXT}
install-tcl:
echo "Nothing to do here"
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -12,4 +12,4 @@ SRCS = NMbutton.c NMcmdAK.c NMcmdLZ.c NMlabel.c NMmain.c \
NMnetlist.c NMshowpt.c NMshowcell.c NMundo.c NMwiring.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -48,4 +48,4 @@ module-clean:
${RM} -r .deps
#------------------------------------------------------
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -38,4 +38,4 @@ $(DESTDIR)${INSTALL_TCLDIR}/tclplot${SHDLIB_EXT}: tclplot${SHDLIB_EXT}
${RM} $(DESTDIR)${INSTALL_TCLDIR}/tclplot${SHDLIB_EXT}
${CP} tclplot${SHDLIB_EXT} $(DESTDIR)${INSTALL_TCLDIR}/tclplot${SHDLIB_EXT}
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -13,4 +13,4 @@ SRCS = PlowCmd.c PlowJogs.c PlowMain.c PlowQueue.c PlowRandom.c \
PlowTest.c PlowWidth.c PlowYank.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -13,4 +13,4 @@ SRCS = ResMain.c ResJunct.c ResMakeRes.c ResSimple.c ResPrint.c \
ResFract.c ResUtils.c ResDebug.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -38,4 +38,4 @@ $(DESTDIR)${TCLDIR}/tclroute${SHDLIB_EXT}: tclroute${SHDLIB_EXT}
${RM} $(DESTDIR)${TCLDIR}/tclroute${SHDLIB_EXT}
${CP} tclroute${SHDLIB_EXT} $(DESTDIR)${TCLDIR}/tclroute${SHDLIB_EXT}
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

3
scripts/configure vendored
View File

@ -9396,8 +9396,6 @@ ac_config_files="$ac_config_files defs.mak:scripts/defs.mak.in"
ac_config_files="$ac_config_files scripts/makedbh:scripts/makedbh.in"
ac_config_files="$ac_config_files rules.mak:rules.mak"
ac_config_files="$ac_config_files tiles/Makefile:tiles/Makefile.in"
@ -10217,7 +10215,6 @@ do
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:Makefile.in" ;;
"defs.mak") CONFIG_FILES="$CONFIG_FILES defs.mak:scripts/defs.mak.in" ;;
"scripts/makedbh") CONFIG_FILES="$CONFIG_FILES scripts/makedbh:scripts/makedbh.in" ;;
"rules.mak") CONFIG_FILES="$CONFIG_FILES rules.mak:rules.mak" ;;
"tiles/Makefile") CONFIG_FILES="$CONFIG_FILES tiles/Makefile:tiles/Makefile.in" ;;
"bplane/Makefile") CONFIG_FILES="$CONFIG_FILES bplane/Makefile:bplane/Makefile.in" ;;
"calma/Makefile") CONFIG_FILES="$CONFIG_FILES calma/Makefile:calma/Makefile.in" ;;

View File

@ -1998,10 +1998,9 @@ dnl under build/scripts/ (matching ${SCRIPTS}/makedbh = ${MAGICDIR}/scripts).
AC_CONFIG_FILES([Makefile:Makefile.in])
AC_CONFIG_FILES([defs.mak:scripts/defs.mak.in])
AC_CONFIG_FILES([scripts/makedbh:scripts/makedbh.in], [chmod +x scripts/makedbh])
dnl Copy rules.mak into the build top (it has no @...@ substitutions; this just
dnl places it next to the generated defs.mak so a single ${MAGICDIR} resolves
dnl both `include`s in every subdir Makefile out-of-tree).
AC_CONFIG_FILES([rules.mak:rules.mak])
dnl rules.mak is included straight from the source tree (${MAGICSRC}/rules.mak),
dnl so it is NOT copied into the build top. Only defs.mak (which has @...@
dnl substitutions) is generated there.
dnl Per-module Makefiles (Makefile.in migration). Each converted module lists
dnl its Makefile here; config.status creates the build subdir and the Makefile.

View File

@ -12,4 +12,4 @@ SRCS = selCreate.c selDisplay.c selEnum.c selOps.c selUndo.c \
selUnselect.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -11,4 +11,4 @@ MAGICDIR = @top_builddir@
SRCS = SimDBstuff.c SimSelect.c SimRsim.c SimExtract.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -117,4 +117,4 @@ $(DESTDIR)${INSTALL_BINDIR}/ext2sim.sh: ext2sim.sh
# An additional dependency on the VERSION file
${OBJS}: ${MAGICSRC}/VERSION
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -11,4 +11,4 @@ MAGICDIR = @top_builddir@
SRCS = txCommands.c txInput.c txMain.c txMore.c txOutput.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -11,4 +11,4 @@ MAGICDIR = @top_builddir@
SRCS = tile.c search.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -22,4 +22,4 @@ include ${MAGICDIR}/defs.mak
DFLAGS += ${GR_DFLAGS}
CFLAGS += ${GR_CFLAGS}
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak

View File

@ -16,7 +16,7 @@ GLYPHS = windows7.glyphs windows11.glyphs windows14.glyphs windows22.glyphs
FONTS = vfont.B.12 vfont.I.12 vfont.R.8
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak
install-tcl:
@echo --- installing glyphs to $(DESTDIR)${INSTALL_SYSDIR}

View File

@ -11,4 +11,4 @@ MAGICDIR = @top_builddir@
SRCS = wireOps.c wireTech.c wireUndo.c
include ${MAGICDIR}/defs.mak
include ${MAGICDIR}/rules.mak
include ${MAGICSRC}/rules.mak