magic/Makefile.in

219 lines
7.4 KiB
Makefile
Raw Normal View History

#
# rcsid $Header: /usr/cvsroot/magic-8.0/Makefile,v 1.1.1.1 2008/02/03 20:43:49 tim Exp $
#
MAGICDIR = .
build: top Makefile.in + build-dir orchestration (out-of-tree) Make a plain `make` in a build directory build every module into the build tree. The top Makefile becomes a configure-generated Makefile.in, and each recursion drives a build subdirectory (created on demand) using the module Makefile from the source tree. Makefile -> Makefile.in (config.status generates Makefile in the build top via AC_CONFIG_FILES([Makefile:Makefile.in])): * Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from ${MAGICSRC}. * Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@) <goal>` becomes: mkdir -p <builddir> && ${MAKE} -C <builddir> \ -f ${MAGICSRC}/<dir>/Makefile <goal> so the build subdir need not pre-exist and the source Makefile is used. Applied to modules/libs/depend pattern rules and the tcllibrary/mains/techs/install/clean loops. * database/database.h: generate from ${MAGICSRC}/.../database.h.in into the build tree (mkdir -p database), via the generated build-tree ${MAGICDIR}/scripts/makedbh. * install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree); clean skips absent build subdirs; distclean/dist/tags updated for the split source/build layout. scripts/defs.mak.in: * SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the static helpers (mkdirs, printmans, ...); the one generated helper, makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree). * Guard VPATH so it is set only inside module subdirectories, never at the build top -- a top-level VPATH into the source tree could let a stale source database/database.h shadow the build-tree copy. scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated scripts/configure. Verified out-of-tree: `../configure && make modules && make libs` builds all 33 module libraries (lib*.o and lib*.a) plus the generated database/database.h into the build tree, with no errors and the source tree left clean. A full `make` (link the magic program, build techs) still needs the later outlier fixes (magic/, scmos/, ...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
# Absolute path to the source tree (config.status substitutes @abs_top_srcdir@).
# For an in-tree build this is the same directory as the build top. Recursion
# into subdirectories goes through $(submake) (defined below).
build: top Makefile.in + build-dir orchestration (out-of-tree) Make a plain `make` in a build directory build every module into the build tree. The top Makefile becomes a configure-generated Makefile.in, and each recursion drives a build subdirectory (created on demand) using the module Makefile from the source tree. Makefile -> Makefile.in (config.status generates Makefile in the build top via AC_CONFIG_FILES([Makefile:Makefile.in])): * Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from ${MAGICSRC}. * Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@) <goal>` becomes: mkdir -p <builddir> && ${MAKE} -C <builddir> \ -f ${MAGICSRC}/<dir>/Makefile <goal> so the build subdir need not pre-exist and the source Makefile is used. Applied to modules/libs/depend pattern rules and the tcllibrary/mains/techs/install/clean loops. * database/database.h: generate from ${MAGICSRC}/.../database.h.in into the build tree (mkdir -p database), via the generated build-tree ${MAGICDIR}/scripts/makedbh. * install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree); clean skips absent build subdirs; distclean/dist/tags updated for the split source/build layout. scripts/defs.mak.in: * SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the static helpers (mkdirs, printmans, ...); the one generated helper, makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree). * Guard VPATH so it is set only inside module subdirectories, never at the build top -- a top-level VPATH into the source tree could let a stale source database/database.h shadow the build-tree copy. scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated scripts/configure. Verified out-of-tree: `../configure && make modules && make libs` builds all 33 module libraries (lib*.o and lib*.a) plus the generated database/database.h into the build tree, with no errors and the source tree left clean. A full `make` (link the magic program, build techs) still needs the later outlier fixes (magic/, scmos/, ...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
MAGICSRC = @abs_top_srcdir@
PROGRAMS = magic
TECHS = scmos
LIBRARIES = database utils extflat
MODULES = bplane cmwind commands database dbwind debug drc extflat \
extract graphics netmenu plow resis select sim textio tiles \
utils windows wiring
# This was `cat VERSION`
build: top Makefile.in + build-dir orchestration (out-of-tree) Make a plain `make` in a build directory build every module into the build tree. The top Makefile becomes a configure-generated Makefile.in, and each recursion drives a build subdirectory (created on demand) using the module Makefile from the source tree. Makefile -> Makefile.in (config.status generates Makefile in the build top via AC_CONFIG_FILES([Makefile:Makefile.in])): * Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from ${MAGICSRC}. * Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@) <goal>` becomes: mkdir -p <builddir> && ${MAKE} -C <builddir> \ -f ${MAGICSRC}/<dir>/Makefile <goal> so the build subdir need not pre-exist and the source Makefile is used. Applied to modules/libs/depend pattern rules and the tcllibrary/mains/techs/install/clean loops. * database/database.h: generate from ${MAGICSRC}/.../database.h.in into the build tree (mkdir -p database), via the generated build-tree ${MAGICDIR}/scripts/makedbh. * install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree); clean skips absent build subdirs; distclean/dist/tags updated for the split source/build layout. scripts/defs.mak.in: * SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the static helpers (mkdirs, printmans, ...); the one generated helper, makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree). * Guard VPATH so it is set only inside module subdirectories, never at the build top -- a top-level VPATH into the source tree could let a stale source database/database.h shadow the build-tree copy. scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated scripts/configure. Verified out-of-tree: `../configure && make modules && make libs` builds all 33 module libraries (lib*.o and lib*.a) plus the generated database/database.h into the build tree, with no errors and the source tree left clean. A full `make` (link the magic program, build techs) still needs the later outlier fixes (magic/, scmos/, ...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
VERSION := $(shell cat ${MAGICSRC}/VERSION)
MAKEFLAGS =
INSTALL_CAD_DIRS = windows doc ${TECHS}
-include defs.mak
build: auto-detect latex/dvips and regenerate docs in default make When latex and dvips are available, the default no-arg "make" now regenerates the PostScript documentation from its .tex sources into the build tree; otherwise the pre-built PostScript shipped in the source tree is used as-is at install time. Documentation is always available either way -- installing latex simply refreshes it from source. configure (scripts/configure.in, regenerated scripts/configure): * AC_PATH_PROG for latex + dvips; DOCS_TARGET = "docs" only when both are found; AC_SUBST(LATEX/DVIPS/DOCS_TARGET). * Configuration summary prints "LaTeX docs: yes/no". scripts/defs.mak.in: export LATEX/DVIPS. Makefile.in: * all: ... $(DOCS_TARGET) -- pulls in "docs" only when latex was found. * docs: best-effort -- `make -k` + a warning on failure so a document that will not typeset (or a missing texlive package) never fails the build; install falls back to the pre-built PostScript for those. doc/latexfiles/Makefile: * use ${LATEX}/${DVIPS} from defs.mak. * the .tex include figures as ../psfigures/*.ps; point the build-tree ../psfigures at ${MAGICSRC}/doc/psfigures (no-op in-tree) so latex and dvips find them while outputs stay in the build tree. CI: main.yml and main-aarch64.yml install texlive-latex-base/-recommended + texlive-fonts-recommended so the Linux builds exercise doc regeneration (best-effort, never fatal). README.Tcl: document latex/dvips as an optional prerequisite for docs. .gitignore: ignore in-tree doc build artifacts (doc/latexfiles/psfiles/, *.dvi/*.aux/*.log); the pre-built doc/psfiles/ stays tracked. Verified out-of-tree with TeX Live 2024: configure reports "LaTeX docs: yes"; `make` regenerates 27/28 documents into the build tree (maint1.tex has a genuine LaTeX error and falls back), stays exit 0; `make install` installs the 27 regenerated PostScript from the build tree and maint1 from the source pre-built copy; the source tree is not modified. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 17:02:51 +02:00
# "docs" when configure found latex+dvips (regenerate PostScript from .tex into
# 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).
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
endef
build: auto-detect latex/dvips and regenerate docs in default make When latex and dvips are available, the default no-arg "make" now regenerates the PostScript documentation from its .tex sources into the build tree; otherwise the pre-built PostScript shipped in the source tree is used as-is at install time. Documentation is always available either way -- installing latex simply refreshes it from source. configure (scripts/configure.in, regenerated scripts/configure): * AC_PATH_PROG for latex + dvips; DOCS_TARGET = "docs" only when both are found; AC_SUBST(LATEX/DVIPS/DOCS_TARGET). * Configuration summary prints "LaTeX docs: yes/no". scripts/defs.mak.in: export LATEX/DVIPS. Makefile.in: * all: ... $(DOCS_TARGET) -- pulls in "docs" only when latex was found. * docs: best-effort -- `make -k` + a warning on failure so a document that will not typeset (or a missing texlive package) never fails the build; install falls back to the pre-built PostScript for those. doc/latexfiles/Makefile: * use ${LATEX}/${DVIPS} from defs.mak. * the .tex include figures as ../psfigures/*.ps; point the build-tree ../psfigures at ${MAGICSRC}/doc/psfigures (no-op in-tree) so latex and dvips find them while outputs stay in the build tree. CI: main.yml and main-aarch64.yml install texlive-latex-base/-recommended + texlive-fonts-recommended so the Linux builds exercise doc regeneration (best-effort, never fatal). README.Tcl: document latex/dvips as an optional prerequisite for docs. .gitignore: ignore in-tree doc build artifacts (doc/latexfiles/psfiles/, *.dvi/*.aux/*.log); the pre-built doc/psfiles/ stays tracked. Verified out-of-tree with TeX Live 2024: configure reports "LaTeX docs: yes"; `make` regenerates 27/28 documents into the build tree (maint1.tex has a genuine LaTeX error and falls back), stays exit 0; `make install` installs the 27 regenerated PostScript from the build tree and maint1 from the source pre-built copy; the source tree is not modified. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 17:02:51 +02:00
all: $(ALL_TARGET) techs $(DOCS_TARGET)
standard: mains
tcl: tcllibrary
force:
@${MAKE} clean
@${MAKE} all
defs.mak:
@echo No \"defs.mak\" file found. Run "configure" to make one.
@exit 1
config:
build: top Makefile.in + build-dir orchestration (out-of-tree) Make a plain `make` in a build directory build every module into the build tree. The top Makefile becomes a configure-generated Makefile.in, and each recursion drives a build subdirectory (created on demand) using the module Makefile from the source tree. Makefile -> Makefile.in (config.status generates Makefile in the build top via AC_CONFIG_FILES([Makefile:Makefile.in])): * Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from ${MAGICSRC}. * Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@) <goal>` becomes: mkdir -p <builddir> && ${MAKE} -C <builddir> \ -f ${MAGICSRC}/<dir>/Makefile <goal> so the build subdir need not pre-exist and the source Makefile is used. Applied to modules/libs/depend pattern rules and the tcllibrary/mains/techs/install/clean loops. * database/database.h: generate from ${MAGICSRC}/.../database.h.in into the build tree (mkdir -p database), via the generated build-tree ${MAGICDIR}/scripts/makedbh. * install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree); clean skips absent build subdirs; distclean/dist/tags updated for the split source/build layout. scripts/defs.mak.in: * SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the static helpers (mkdirs, printmans, ...); the one generated helper, makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree). * Guard VPATH so it is set only inside module subdirectories, never at the build top -- a top-level VPATH into the source tree could let a stale source database/database.h shadow the build-tree copy. scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated scripts/configure. Verified out-of-tree: `../configure && make modules && make libs` builds all 33 module libraries (lib*.o and lib*.a) plus the generated database/database.h into the build tree, with no errors and the source tree left clean. A full `make` (link the magic program, build techs) still needs the later outlier fixes (magic/, scmos/, ...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
${MAGICSRC}/configure
tcllibrary: ${DATABASE_H} modules
@echo --- making Tcl shared libraries
for dir in ${PROGRAMS}; do \
$(call submake,$$dir,tcl-main) || exit 1; done
mains: ${DATABASE_H} modules libs
@echo --- making main programs
for dir in ${PROGRAMS}; do \
$(call submake,$$dir,main) || exit 1; done
build: top Makefile.in + build-dir orchestration (out-of-tree) Make a plain `make` in a build directory build every module into the build tree. The top Makefile becomes a configure-generated Makefile.in, and each recursion drives a build subdirectory (created on demand) using the module Makefile from the source tree. Makefile -> Makefile.in (config.status generates Makefile in the build top via AC_CONFIG_FILES([Makefile:Makefile.in])): * Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from ${MAGICSRC}. * Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@) <goal>` becomes: mkdir -p <builddir> && ${MAKE} -C <builddir> \ -f ${MAGICSRC}/<dir>/Makefile <goal> so the build subdir need not pre-exist and the source Makefile is used. Applied to modules/libs/depend pattern rules and the tcllibrary/mains/techs/install/clean loops. * database/database.h: generate from ${MAGICSRC}/.../database.h.in into the build tree (mkdir -p database), via the generated build-tree ${MAGICDIR}/scripts/makedbh. * install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree); clean skips absent build subdirs; distclean/dist/tags updated for the split source/build layout. scripts/defs.mak.in: * SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the static helpers (mkdirs, printmans, ...); the one generated helper, makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree). * Guard VPATH so it is set only inside module subdirectories, never at the build top -- a top-level VPATH into the source tree could let a stale source database/database.h shadow the build-tree copy. scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated scripts/configure. Verified out-of-tree: `../configure && make modules && make libs` builds all 33 module libraries (lib*.o and lib*.a) plus the generated database/database.h into the build tree, with no errors and the source tree left clean. A full `make` (link the magic program, build techs) still needs the later outlier fixes (magic/, scmos/, ...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
# makedbh is the one generated helper script; it lives in the *build* tree.
# ${DATABASE_H} is $(builddir)/database/database.h in-tree, or
# $(builddir)/include/database/database.h when relocated (see defs.mak GENINC).
${DATABASE_H}: ${MAGICSRC}/database/database.h.in
@echo --- making header file ${DATABASE_H}
@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
LIBS_SUBDIR := $(shell for i in ${MODULES}; do echo "$${i}/lib$${i}.a"; done)
.PHONY: FORCE
${MODULES_SUBDIR}: FORCE
@$(call submake,$(patsubst %/,%,$(dir $@)),module)
.PHONY: modules
modules: ${DATABASE_H} depend ${MODULES_SUBDIR}
${LIBS_SUBDIR}: FORCE
@$(call submake,$(patsubst %/,%,$(dir $@)),lib)
2025-07-24 16:02:14 +02:00
# Force the tiles/utils modules to exist first for libdatabase.a
.PHONY: libs
libs: ${DATABASE_H} depend tiles/libtiles.o utils/libutils.o ${LIBS_SUBDIR}
#
# extcheck - utility tool
# net2ir - utility tool
# oa - disabled (needs 'clean' target renaming)
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
# Unique list of all subdir that might have Depend file, we have to deduplicate otherwise
# MAKE will warning loudly. This list is somewhat empty when defs.mak does not exist
SUBDIRS_FILTERED := $(shell echo ${MODULES} ${PROGRAMS} ${SUBDIRS} | tr ' ' '\n' | sort | uniq)
SUBDIRS_DEPEND = $(addsuffix /Depend, ${SUBDIRS_FILTERED})
${SUBDIRS_DEPEND}: ${DATABASE_H}
@echo --- making dependencies
@$(call submake,$(patsubst %/,%,$(dir $@)),depend)
.PHONY: depend
depend: defs.mak ${SUBDIRS_DEPEND}
.PHONY: techs
techs: depend
@echo --- making techs
for dir in ${TECHS}; do \
$(call submake,$$dir,all) || exit 1; done
build: auto-detect latex/dvips and regenerate docs in default make When latex and dvips are available, the default no-arg "make" now regenerates the PostScript documentation from its .tex sources into the build tree; otherwise the pre-built PostScript shipped in the source tree is used as-is at install time. Documentation is always available either way -- installing latex simply refreshes it from source. configure (scripts/configure.in, regenerated scripts/configure): * AC_PATH_PROG for latex + dvips; DOCS_TARGET = "docs" only when both are found; AC_SUBST(LATEX/DVIPS/DOCS_TARGET). * Configuration summary prints "LaTeX docs: yes/no". scripts/defs.mak.in: export LATEX/DVIPS. Makefile.in: * all: ... $(DOCS_TARGET) -- pulls in "docs" only when latex was found. * docs: best-effort -- `make -k` + a warning on failure so a document that will not typeset (or a missing texlive package) never fails the build; install falls back to the pre-built PostScript for those. doc/latexfiles/Makefile: * use ${LATEX}/${DVIPS} from defs.mak. * the .tex include figures as ../psfigures/*.ps; point the build-tree ../psfigures at ${MAGICSRC}/doc/psfigures (no-op in-tree) so latex and dvips find them while outputs stay in the build tree. CI: main.yml and main-aarch64.yml install texlive-latex-base/-recommended + texlive-fonts-recommended so the Linux builds exercise doc regeneration (best-effort, never fatal). README.Tcl: document latex/dvips as an optional prerequisite for docs. .gitignore: ignore in-tree doc build artifacts (doc/latexfiles/psfiles/, *.dvi/*.aux/*.log); the pre-built doc/psfiles/ stays tracked. Verified out-of-tree with TeX Live 2024: configure reports "LaTeX docs: yes"; `make` regenerates 27/28 documents into the build tree (maint1.tex has a genuine LaTeX error and falls back), stays exit 0; `make install` installs the 27 regenerated PostScript from the build tree and maint1 from the source pre-built copy; the source tree is not modified. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 17:02:51 +02:00
# Regenerate the PostScript documentation from its .tex sources (only reached
# from "all" when configure found latex+dvips; see DOCS_TARGET).
.PHONY: docs
docs:
@echo --- making documentation
@${MAKE} -k -C doc/latexfiles all || \
build: auto-detect latex/dvips and regenerate docs in default make When latex and dvips are available, the default no-arg "make" now regenerates the PostScript documentation from its .tex sources into the build tree; otherwise the pre-built PostScript shipped in the source tree is used as-is at install time. Documentation is always available either way -- installing latex simply refreshes it from source. configure (scripts/configure.in, regenerated scripts/configure): * AC_PATH_PROG for latex + dvips; DOCS_TARGET = "docs" only when both are found; AC_SUBST(LATEX/DVIPS/DOCS_TARGET). * Configuration summary prints "LaTeX docs: yes/no". scripts/defs.mak.in: export LATEX/DVIPS. Makefile.in: * all: ... $(DOCS_TARGET) -- pulls in "docs" only when latex was found. * docs: best-effort -- `make -k` + a warning on failure so a document that will not typeset (or a missing texlive package) never fails the build; install falls back to the pre-built PostScript for those. doc/latexfiles/Makefile: * use ${LATEX}/${DVIPS} from defs.mak. * the .tex include figures as ../psfigures/*.ps; point the build-tree ../psfigures at ${MAGICSRC}/doc/psfigures (no-op in-tree) so latex and dvips find them while outputs stay in the build tree. CI: main.yml and main-aarch64.yml install texlive-latex-base/-recommended + texlive-fonts-recommended so the Linux builds exercise doc regeneration (best-effort, never fatal). README.Tcl: document latex/dvips as an optional prerequisite for docs. .gitignore: ignore in-tree doc build artifacts (doc/latexfiles/psfiles/, *.dvi/*.aux/*.log); the pre-built doc/psfiles/ stays tracked. Verified out-of-tree with TeX Live 2024: configure reports "LaTeX docs: yes"; `make` regenerates 27/28 documents into the build tree (maint1.tex has a genuine LaTeX error and falls back), stays exit 0; `make install` installs the 27 regenerated PostScript from the build tree and maint1 from the source pre-built copy; the source tree is not modified. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 17:02:51 +02:00
echo "--- WARNING: some documents did not regenerate; the pre-built PostScript will be used for those at 'make install'"
install: $(INSTALL_TARGET)
install-magic:
@echo --- installing executable to $(DESTDIR)${INSTALL_BINDIR}
@echo --- installing runtime files to $(DESTDIR)${INSTALL_LIBDIR}
@${MAKE} install-real
install-real: install-dirs
for dir in ${INSTALL_CAD_DIRS}; do \
$(call submake,$$dir,install); done
for dir in ${PROGRAMS}; do \
$(call submake,$$dir,install); done
install-tcl-dirs:
build: top Makefile.in + build-dir orchestration (out-of-tree) Make a plain `make` in a build directory build every module into the build tree. The top Makefile becomes a configure-generated Makefile.in, and each recursion drives a build subdirectory (created on demand) using the module Makefile from the source tree. Makefile -> Makefile.in (config.status generates Makefile in the build top via AC_CONFIG_FILES([Makefile:Makefile.in])): * Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from ${MAGICSRC}. * Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@) <goal>` becomes: mkdir -p <builddir> && ${MAKE} -C <builddir> \ -f ${MAGICSRC}/<dir>/Makefile <goal> so the build subdir need not pre-exist and the source Makefile is used. Applied to modules/libs/depend pattern rules and the tcllibrary/mains/techs/install/clean loops. * database/database.h: generate from ${MAGICSRC}/.../database.h.in into the build tree (mkdir -p database), via the generated build-tree ${MAGICDIR}/scripts/makedbh. * install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree); clean skips absent build subdirs; distclean/dist/tags updated for the split source/build layout. scripts/defs.mak.in: * SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the static helpers (mkdirs, printmans, ...); the one generated helper, makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree). * Guard VPATH so it is set only inside module subdirectories, never at the build top -- a top-level VPATH into the source tree could let a stale source database/database.h shadow the build-tree copy. scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated scripts/configure. Verified out-of-tree: `../configure && make modules && make libs` builds all 33 module libraries (lib*.o and lib*.a) plus the generated database/database.h into the build tree, with no errors and the source tree left clean. A full `make` (link the magic program, build techs) still needs the later outlier fixes (magic/, scmos/, ...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
${SCRIPTS}/mkdirs $(DESTDIR)${INSTALL_BINDIR} \
$(DESTDIR)${INSTALL_MANDIR} $(DESTDIR)${INSTALL_SYSDIR} \
$(DESTDIR)${INSTALL_TCLDIR} $(DESTDIR)${INSTALL_TCLDIR}/bitmaps
install-dirs:
build: top Makefile.in + build-dir orchestration (out-of-tree) Make a plain `make` in a build directory build every module into the build tree. The top Makefile becomes a configure-generated Makefile.in, and each recursion drives a build subdirectory (created on demand) using the module Makefile from the source tree. Makefile -> Makefile.in (config.status generates Makefile in the build top via AC_CONFIG_FILES([Makefile:Makefile.in])): * Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from ${MAGICSRC}. * Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@) <goal>` becomes: mkdir -p <builddir> && ${MAKE} -C <builddir> \ -f ${MAGICSRC}/<dir>/Makefile <goal> so the build subdir need not pre-exist and the source Makefile is used. Applied to modules/libs/depend pattern rules and the tcllibrary/mains/techs/install/clean loops. * database/database.h: generate from ${MAGICSRC}/.../database.h.in into the build tree (mkdir -p database), via the generated build-tree ${MAGICDIR}/scripts/makedbh. * install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree); clean skips absent build subdirs; distclean/dist/tags updated for the split source/build layout. scripts/defs.mak.in: * SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the static helpers (mkdirs, printmans, ...); the one generated helper, makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree). * Guard VPATH so it is set only inside module subdirectories, never at the build top -- a top-level VPATH into the source tree could let a stale source database/database.h shadow the build-tree copy. scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated scripts/configure. Verified out-of-tree: `../configure && make modules && make libs` builds all 33 module libraries (lib*.o and lib*.a) plus the generated database/database.h into the build tree, with no errors and the source tree left clean. A full `make` (link the magic program, build techs) still needs the later outlier fixes (magic/, scmos/, ...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
${SCRIPTS}/mkdirs $(DESTDIR)${INSTALL_BINDIR} \
$(DESTDIR)${INSTALL_MANDIR} $(DESTDIR)${INSTALL_SYSDIR} \
$(DESTDIR)${INSTALL_SCMDIR}
install-tcl:
@echo --- installing executable to $(DESTDIR)${INSTALL_BINDIR}
@echo --- installing runtime files to $(DESTDIR)${INSTALL_LIBDIR}
@${MAKE} install-tcl-real
install-tcl-real: install-tcl-dirs
for dir in ${INSTALL_CAD_DIRS} ${PROGRAMS}; do \
$(call submake,$$dir,install-tcl); done
clean:
@# clean must not create dirs: skip absent ones. Recurse natively;
@# readline/ is the one unconverted module, so it uses -f (mirrors $(submake)).
for dir in ${SUBDIRS_FILTERED} ${TECHS} ${BUNDLED_MODULES}; do \
test -d $$dir || continue; \
if test "x$$dir" = xreadline; then ${MAKE} -C $$dir -f ${MAGICSRC}/$$dir/Makefile clean; \
else ${MAKE} -C $$dir clean; fi || true; done
${RM} *.tmp */*.tmp *.sav */*.sav *.log TAGS tags
distclean:
touch defs.mak
@${MAKE} clean
# 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.
build: top Makefile.in + build-dir orchestration (out-of-tree) Make a plain `make` in a build directory build every module into the build tree. The top Makefile becomes a configure-generated Makefile.in, and each recursion drives a build subdirectory (created on demand) using the module Makefile from the source tree. Makefile -> Makefile.in (config.status generates Makefile in the build top via AC_CONFIG_FILES([Makefile:Makefile.in])): * Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from ${MAGICSRC}. * Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@) <goal>` becomes: mkdir -p <builddir> && ${MAKE} -C <builddir> \ -f ${MAGICSRC}/<dir>/Makefile <goal> so the build subdir need not pre-exist and the source Makefile is used. Applied to modules/libs/depend pattern rules and the tcllibrary/mains/techs/install/clean loops. * database/database.h: generate from ${MAGICSRC}/.../database.h.in into the build tree (mkdir -p database), via the generated build-tree ${MAGICDIR}/scripts/makedbh. * install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree); clean skips absent build subdirs; distclean/dist/tags updated for the split source/build layout. scripts/defs.mak.in: * SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the static helpers (mkdirs, printmans, ...); the one generated helper, makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree). * Guard VPATH so it is set only inside module subdirectories, never at the build top -- a top-level VPATH into the source tree could let a stale source database/database.h shadow the build-tree copy. scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated scripts/configure. Verified out-of-tree: `../configure && make modules && make libs` builds all 33 module libraries (lib*.o and lib*.a) plus the generated database/database.h into the build tree, with no errors and the source tree left clean. A full `make` (link the magic program, build techs) still needs the later outlier fixes (magic/, scmos/, ...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
${RM} defs.mak old.defs.mak
${RM} scripts/makedbh scripts/default.conf
${RM} config.log config.status
${RM} ${DATABASE_H}
${RM} scripts/magic.spec magic-${VERSION} magic-${VERSION}.tgz
${RM} *.log
dist:
${RM} scripts/magic.spec magic-${VERSION} magic-${VERSION}.tgz
${SED} -e /@VERSION@/s%@VERSION@%${VERSION}% \
build: top Makefile.in + build-dir orchestration (out-of-tree) Make a plain `make` in a build directory build every module into the build tree. The top Makefile becomes a configure-generated Makefile.in, and each recursion drives a build subdirectory (created on demand) using the module Makefile from the source tree. Makefile -> Makefile.in (config.status generates Makefile in the build top via AC_CONFIG_FILES([Makefile:Makefile.in])): * Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from ${MAGICSRC}. * Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@) <goal>` becomes: mkdir -p <builddir> && ${MAKE} -C <builddir> \ -f ${MAGICSRC}/<dir>/Makefile <goal> so the build subdir need not pre-exist and the source Makefile is used. Applied to modules/libs/depend pattern rules and the tcllibrary/mains/techs/install/clean loops. * database/database.h: generate from ${MAGICSRC}/.../database.h.in into the build tree (mkdir -p database), via the generated build-tree ${MAGICDIR}/scripts/makedbh. * install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree); clean skips absent build subdirs; distclean/dist/tags updated for the split source/build layout. scripts/defs.mak.in: * SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the static helpers (mkdirs, printmans, ...); the one generated helper, makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree). * Guard VPATH so it is set only inside module subdirectories, never at the build top -- a top-level VPATH into the source tree could let a stale source database/database.h shadow the build-tree copy. scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated scripts/configure. Verified out-of-tree: `../configure && make modules && make libs` builds all 33 module libraries (lib*.o and lib*.a) plus the generated database/database.h into the build tree, with no errors and the source tree left clean. A full `make` (link the magic program, build techs) still needs the later outlier fixes (magic/, scmos/, ...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
${MAGICSRC}/scripts/magic.spec.in > scripts/magic.spec
2025-01-08 09:58:55 +01:00
${LN} -nsf . magic-${VERSION}
tar zchvf magic-${VERSION}.tgz --exclude CVS \
--exclude magic-${VERSION}/magic-${VERSION} \
--exclude magic-${VERSION}/magic-${VERSION}.tgz \
magic-${VERSION}
clean-mains:
for dir in ${PROGRAMS}; do \
build: top Makefile.in + build-dir orchestration (out-of-tree) Make a plain `make` in a build directory build every module into the build tree. The top Makefile becomes a configure-generated Makefile.in, and each recursion drives a build subdirectory (created on demand) using the module Makefile from the source tree. Makefile -> Makefile.in (config.status generates Makefile in the build top via AC_CONFIG_FILES([Makefile:Makefile.in])): * Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from ${MAGICSRC}. * Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@) <goal>` becomes: mkdir -p <builddir> && ${MAKE} -C <builddir> \ -f ${MAGICSRC}/<dir>/Makefile <goal> so the build subdir need not pre-exist and the source Makefile is used. Applied to modules/libs/depend pattern rules and the tcllibrary/mains/techs/install/clean loops. * database/database.h: generate from ${MAGICSRC}/.../database.h.in into the build tree (mkdir -p database), via the generated build-tree ${MAGICDIR}/scripts/makedbh. * install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree); clean skips absent build subdirs; distclean/dist/tags updated for the split source/build layout. scripts/defs.mak.in: * SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the static helpers (mkdirs, printmans, ...); the one generated helper, makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree). * Guard VPATH so it is set only inside module subdirectories, never at the build top -- a top-level VPATH into the source tree could let a stale source database/database.h shadow the build-tree copy. scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated scripts/configure. Verified out-of-tree: `../configure && make modules && make libs` builds all 33 module libraries (lib*.o and lib*.a) plus the generated database/database.h into the build tree, with no errors and the source tree left clean. A full `make` (link the magic program, build techs) still needs the later outlier fixes (magic/, scmos/, ...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
${RM} $$dir/$$dir; done
tags:
${RM} tags
build: top Makefile.in + build-dir orchestration (out-of-tree) Make a plain `make` in a build directory build every module into the build tree. The top Makefile becomes a configure-generated Makefile.in, and each recursion drives a build subdirectory (created on demand) using the module Makefile from the source tree. Makefile -> Makefile.in (config.status generates Makefile in the build top via AC_CONFIG_FILES([Makefile:Makefile.in])): * Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from ${MAGICSRC}. * Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@) <goal>` becomes: mkdir -p <builddir> && ${MAKE} -C <builddir> \ -f ${MAGICSRC}/<dir>/Makefile <goal> so the build subdir need not pre-exist and the source Makefile is used. Applied to modules/libs/depend pattern rules and the tcllibrary/mains/techs/install/clean loops. * database/database.h: generate from ${MAGICSRC}/.../database.h.in into the build tree (mkdir -p database), via the generated build-tree ${MAGICDIR}/scripts/makedbh. * install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree); clean skips absent build subdirs; distclean/dist/tags updated for the split source/build layout. scripts/defs.mak.in: * SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the static helpers (mkdirs, printmans, ...); the one generated helper, makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree). * Guard VPATH so it is set only inside module subdirectories, never at the build top -- a top-level VPATH into the source tree could let a stale source database/database.h shadow the build-tree copy. scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated scripts/configure. Verified out-of-tree: `../configure && make modules && make libs` builds all 33 module libraries (lib*.o and lib*.a) plus the generated database/database.h into the build tree, with no errors and the source tree left clean. A full `make` (link the magic program, build techs) still needs the later outlier fixes (magic/, scmos/, ...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
cd ${MAGICSRC} && find . ${MODULES} ${PROGRAMS} -name "*.[ch]" -maxdepth 1 | xargs ctags -o $(CURDIR)/tags
TAGS:
${RM} TAGS
build: top Makefile.in + build-dir orchestration (out-of-tree) Make a plain `make` in a build directory build every module into the build tree. The top Makefile becomes a configure-generated Makefile.in, and each recursion drives a build subdirectory (created on demand) using the module Makefile from the source tree. Makefile -> Makefile.in (config.status generates Makefile in the build top via AC_CONFIG_FILES([Makefile:Makefile.in])): * Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from ${MAGICSRC}. * Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@) <goal>` becomes: mkdir -p <builddir> && ${MAKE} -C <builddir> \ -f ${MAGICSRC}/<dir>/Makefile <goal> so the build subdir need not pre-exist and the source Makefile is used. Applied to modules/libs/depend pattern rules and the tcllibrary/mains/techs/install/clean loops. * database/database.h: generate from ${MAGICSRC}/.../database.h.in into the build tree (mkdir -p database), via the generated build-tree ${MAGICDIR}/scripts/makedbh. * install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree); clean skips absent build subdirs; distclean/dist/tags updated for the split source/build layout. scripts/defs.mak.in: * SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the static helpers (mkdirs, printmans, ...); the one generated helper, makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree). * Guard VPATH so it is set only inside module subdirectories, never at the build top -- a top-level VPATH into the source tree could let a stale source database/database.h shadow the build-tree copy. scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated scripts/configure. Verified out-of-tree: `../configure && make modules && make libs` builds all 33 module libraries (lib*.o and lib*.a) plus the generated database/database.h into the build tree, with no errors and the source tree left clean. A full `make` (link the magic program, build techs) still needs the later outlier fixes (magic/, scmos/, ...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
cd ${MAGICSRC} && find . ${MODULES} ${PROGRAMS} -name "*.[ch]" -maxdepth 1 | xargs etags -o $(CURDIR)/TAGS
2020-05-23 23:01:30 +02:00
setup-git:
git config --local include.path ../.gitconfig
git stash save
2025-01-08 10:01:47 +01:00
${RM} .git/index
2020-05-23 23:01:30 +02:00
git checkout HEAD -- "$$(git rev-parse --show-toplevel)"
git stash pop