magic/Makefile.in

197 lines
6.6 KiB
Makefile

#
# rcsid $Header: /usr/cvsroot/magic-8.0/Makefile,v 1.1.1.1 2008/02/03 20:43:49 tim Exp $
#
MAGICDIR = .
# 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. Every
# recursion below drives a build subdirectory (created on demand) using the
# module Makefile from the source tree: -C <builddir> -f ${MAGICSRC}/<dir>/Makefile.
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`
VERSION := $(shell cat ${MAGICSRC}/VERSION)
MAKEFLAGS =
INSTALL_CAD_DIRS = windows doc ${TECHS}
-include defs.mak
# "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@
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:
${MAGICSRC}/configure
tcllibrary: database/database.h modules
@echo --- making Tcl shared libraries
for dir in ${PROGRAMS}; do \
mkdir -p $$dir && ${MAKE} -C $$dir -f ${MAGICSRC}/$$dir/Makefile tcl-main || exit 1; done
mains: database/database.h modules libs
@echo --- making main programs
for dir in ${PROGRAMS}; do \
mkdir -p $$dir && ${MAKE} -C $$dir -f ${MAGICSRC}/$$dir/Makefile main || exit 1; done
# makedbh is the one generated helper script; it lives in the *build* tree.
database/database.h: ${MAGICSRC}/database/database.h.in
@echo --- making header file database/database.h
@mkdir -p database
${MAGICDIR}/scripts/makedbh ${MAGICSRC}/database/database.h.in database/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
@d=$(dir $@); mkdir -p $$d && ${MAKE} -C $$d -f ${MAGICSRC}/$${d}Makefile module
.PHONY: modules
modules: database/database.h depend ${MODULES_SUBDIR}
${LIBS_SUBDIR}: FORCE
@d=$(dir $@); mkdir -p $$d && ${MAKE} -C $$d -f ${MAGICSRC}/$${d}Makefile lib
# Force the tiles/utils modules to exist first for libdatabase.a
.PHONY: libs
libs: database/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/database.h
@echo --- making dependencies
@d=$(dir $@); mkdir -p $$d && ${MAKE} -C $$d -f ${MAGICSRC}/$${d}Makefile depend
.PHONY: depend
depend: defs.mak ${SUBDIRS_DEPEND}
.PHONY: techs
techs: depend
@echo --- making techs
for dir in ${TECHS}; do \
mkdir -p $$dir && ${MAKE} -C $$dir -f ${MAGICSRC}/$$dir/Makefile all || exit 1; done
# 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
@mkdir -p doc/latexfiles
@${MAKE} -k -C doc/latexfiles -f ${MAGICSRC}/doc/latexfiles/Makefile all || \
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 \
mkdir -p $$dir && ${MAKE} -C $$dir -f ${MAGICSRC}/$$dir/Makefile install; done
for dir in ${PROGRAMS}; do \
mkdir -p $$dir && ${MAKE} -C $$dir -f ${MAGICSRC}/$$dir/Makefile install; done
install-tcl-dirs:
${SCRIPTS}/mkdirs $(DESTDIR)${INSTALL_BINDIR} \
$(DESTDIR)${INSTALL_MANDIR} $(DESTDIR)${INSTALL_SYSDIR} \
$(DESTDIR)${INSTALL_TCLDIR} $(DESTDIR)${INSTALL_TCLDIR}/bitmaps
install-dirs:
${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 \
mkdir -p $$dir && ${MAKE} -C $$dir -f ${MAGICSRC}/$$dir/Makefile install-tcl; done
clean:
for dir in ${SUBDIRS_FILTERED} ${TECHS} ${BUNDLED_MODULES}; do \
test -d $$dir && ${MAKE} -C $$dir -f ${MAGICSRC}/$$dir/Makefile clean || true; done
${RM} *.tmp */*.tmp *.sav */*.sav *.log TAGS tags
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.
${RM} defs.mak old.defs.mak
${RM} scripts/makedbh scripts/default.conf
${RM} config.log config.status
${RM} database/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}% \
${MAGICSRC}/scripts/magic.spec.in > scripts/magic.spec
${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 \
${RM} $$dir/$$dir; done
tags:
${RM} tags
cd ${MAGICSRC} && find . ${MODULES} ${PROGRAMS} -name "*.[ch]" -maxdepth 1 | xargs ctags -o $(CURDIR)/tags
TAGS:
${RM} TAGS
cd ${MAGICSRC} && find . ${MODULES} ${PROGRAMS} -name "*.[ch]" -maxdepth 1 | xargs etags -o $(CURDIR)/TAGS
setup-git:
git config --local include.path ../.gitconfig
git stash save
${RM} .git/index
git checkout HEAD -- "$$(git rev-parse --show-toplevel)"
git stash pop