From b21b20364bd3705fe1e343561e3c8cce38651e9a Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Wed, 22 Jul 2026 15:53:36 +0000 Subject: [PATCH] build: add "make prepare" and use it in docs/CI instead of database.h path The generated header's path now depends on in-tree vs relocated builds (database/database.h vs include/database/database.h), so instructions that named it directly ("make database/database.h") are brittle. Add a stable, path-independent top-level target: .PHONY: prepare prepare: ${DATABASE_H} Being .PHONY the name is always valid, but its prerequisite is the real file target ${DATABASE_H}, so the header is still regenerated only when out of date -- same result, no exposed path. Convert every "make database/database.h" in the docs, appimage Dockerfiles, and CI workflows to "make prepare". Verified: relocated `make prepare` generates include/database/database.h; re-running is a no-op; touching database.h.in triggers regeneration. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/canary-matrix.yml | 2 +- .github/workflows/main-aarch64.yml | 2 +- .github/workflows/main-macos.yml | 4 ++-- .github/workflows/main.yml | 4 ++-- INSTALL_MacOS.md | 2 +- Makefile.in | 8 ++++++++ appimage/10/Dockerfile | 2 +- appimage/7/Dockerfile | 2 +- appimage/8/Dockerfile | 2 +- appimage/9/Dockerfile | 2 +- 10 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/canary-matrix.yml b/.github/workflows/canary-matrix.yml index 7b2963c6..65e89bad 100644 --- a/.github/workflows/canary-matrix.yml +++ b/.github/workflows/canary-matrix.yml @@ -285,7 +285,7 @@ jobs: #sed -e 's# -Werror=# -Wno-unused-local-typedefs -Werror=#' -i defs.mak #sed -e 's# -Werror=# -Wno-unused-label -Werror=#' -i defs.mak #sed -e 's# -Werror=# -Wno-unused-but-set-variable -Werror=#' -i defs.mak - make database/database.h + make prepare make -j$(nproc) 2>&1 | tee MAKE.LOG - name: Summary diff --git a/.github/workflows/main-aarch64.yml b/.github/workflows/main-aarch64.yml index 2eeb84e1..2c2d1263 100644 --- a/.github/workflows/main-aarch64.yml +++ b/.github/workflows/main-aarch64.yml @@ -20,5 +20,5 @@ jobs: - name: Build run: | ./configure - make database/database.h + make prepare make -j$(nproc) diff --git a/.github/workflows/main-macos.yml b/.github/workflows/main-macos.yml index ece62540..dedfcc55 100644 --- a/.github/workflows/main-macos.yml +++ b/.github/workflows/main-macos.yml @@ -129,7 +129,7 @@ jobs: cat defs.mak echo "===== defs.mak =====" - make database/database.h + make prepare make -j$(sysctl -n hw.ncpu) 2>&1 | tee MAKE.LOG - name: Install @@ -361,7 +361,7 @@ jobs: cat defs.mak echo "===== defs.mak =====" - make database/database.h + make prepare make -j$(sysctl -n hw.ncpu) 2>&1 | tee MAKE.LOG - name: Install diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c2c1baf2..37be6b8f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: - name: Build run: | ./configure - make database/database.h + make prepare make -j$(nproc) - name: Build Tcl auto-load modules # These per-module Tcl shared libraries are real products but are not @@ -51,5 +51,5 @@ jobs: - name: Build (non-Tcl / standard) run: | ./configure --without-tcl --without-opengl - make database/database.h + make prepare make -j$(nproc) diff --git a/INSTALL_MacOS.md b/INSTALL_MacOS.md index 0f0ded8d..13c6e24d 100644 --- a/INSTALL_MacOS.md +++ b/INSTALL_MacOS.md @@ -7,7 +7,7 @@ brew install cairo tcl-tk@8 python3 gnu-sed brew install --cask xquartz ./scripts/configure_mac # If you have both TCL8 and TCL9 installed you may need to verify which was selected. -make database/database.h +make prepare make -j$(sysctl -n hw.ncpu) make install # may need sudo depending on your setup ``` diff --git a/Makefile.in b/Makefile.in index 7b8c06bf..dc3300a7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -62,6 +62,14 @@ ${DATABASE_H}: ${MAGICSRC}/database/database.h.in @mkdir -p $(dir ${DATABASE_H}) ${MAGICDIR}/scripts/makedbh ${MAGICSRC}/database/database.h.in ${DATABASE_H} +# "prepare" is the stable, path-independent way to (re)generate the build-time +# headers (currently database.h) before compiling -- use it instead of naming +# the header directly (its path depends on in-tree vs relocated; see GENINC). +# It is .PHONY so the name is always valid, but its prerequisite ${DATABASE_H} +# is a real file target, so the header is regenerated only when out of date. +.PHONY: prepare +prepare: ${DATABASE_H} + # tiles xyz => tiles/libtiles.o xyz/libxyz.o MODULES_SUBDIR := $(shell for i in ${MODULES}; do echo "$${i}/lib$${i}.o"; done) # tiles xyz => tiles/libtiles.a xyz/libxyz.a diff --git a/appimage/10/Dockerfile b/appimage/10/Dockerfile index 8c076fd4..b348dcf8 100644 --- a/appimage/10/Dockerfile +++ b/appimage/10/Dockerfile @@ -85,7 +85,7 @@ RUN ./configure \ --with-tcl=/prefix/lib \ --with-tk=/prefix/lib \ && make clean \ - && make database/database.h \ + && make prepare \ && make -j$(nproc) \ && make install \ && install -d /prefix/share/licenses/magic \ diff --git a/appimage/7/Dockerfile b/appimage/7/Dockerfile index f4111387..7b550b69 100644 --- a/appimage/7/Dockerfile +++ b/appimage/7/Dockerfile @@ -96,7 +96,7 @@ RUN ./configure \ --with-tk=/prefix/lib \ --without-opengl \ && make clean \ - && make database/database.h \ + && make prepare \ && make -j$(nproc) \ && make install \ && install -d /prefix/share/licenses/magic \ diff --git a/appimage/8/Dockerfile b/appimage/8/Dockerfile index d1760b68..65030d70 100644 --- a/appimage/8/Dockerfile +++ b/appimage/8/Dockerfile @@ -84,7 +84,7 @@ RUN ./configure \ --with-tcl=/prefix/lib \ --with-tk=/prefix/lib \ && make clean \ - && make database/database.h \ + && make prepare \ && make -j$(nproc) \ && make install \ && install -d /prefix/share/licenses/magic \ diff --git a/appimage/9/Dockerfile b/appimage/9/Dockerfile index 11cbe3f8..05bdf13b 100644 --- a/appimage/9/Dockerfile +++ b/appimage/9/Dockerfile @@ -85,7 +85,7 @@ RUN ./configure \ --with-tcl=/prefix/lib \ --with-tk=/prefix/lib \ && make clean \ - && make database/database.h \ + && make prepare \ && make -j$(nproc) \ && make install \ && install -d /prefix/share/licenses/magic \