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) <noreply@anthropic.com>
This commit is contained in:
Darryl L. Miles 2026-07-22 15:53:36 +00:00 committed by R. Timothy Edwards
parent 1bdc3fa12a
commit b21b20364b
10 changed files with 19 additions and 11 deletions

View File

@ -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

View File

@ -20,5 +20,5 @@ jobs:
- name: Build
run: |
./configure
make database/database.h
make prepare
make -j$(nproc)

View File

@ -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

View File

@ -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)

View File

@ -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
```

View File

@ -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

View File

@ -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 \

View File

@ -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 \

View File

@ -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 \

View File

@ -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 \