b25a566d47
Ensure all standard targets honor SUBDIR. Now `make obj' descends into SUBDIRs even if NOOBJ is set (some descendants may still need an object directory, but we do not have such precedents). Now `make install' in non-bsd.subdir.mk makefiles runs `afterinstall' target _after_ `install' in SUBDIRs, like we do in bsd.subdir.mk. Nothing depended on the wrong order anyway. Fixed `distribute' targets (except for the bsd.subdir.mk version) so that they do not depend on _SUBDIR; `distribute' calls `install' which already depends on _SUBDIR. De-standardize `maninstall', otherwise manpages would be installed twice. (To be revised later.)
88 lines
2.2 KiB
Makefile
88 lines
2.2 KiB
Makefile
# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
|
|
# $FreeBSD$
|
|
#
|
|
# The include file <bsd.subdir.mk> contains the default targets
|
|
# for building subdirectories.
|
|
#
|
|
# For all of the directories listed in the variable SUBDIRS, the
|
|
# specified directory will be visited and the target made. There is
|
|
# also a default target which allows the command "make subdir" where
|
|
# subdir is any directory listed in the variable SUBDIRS.
|
|
#
|
|
#
|
|
# +++ variables +++
|
|
#
|
|
# DISTRIBUTION Name of distribution. [bin]
|
|
#
|
|
# SUBDIR A list of subdirectories that should be built as well.
|
|
# Each of the targets will execute the same target in the
|
|
# subdirectories.
|
|
#
|
|
# +++ targets +++
|
|
#
|
|
# distribute:
|
|
# This is a variant of install, which will
|
|
# put the stuff into the right "distribution".
|
|
#
|
|
# afterdistribute, afterinstall, all, all-man, beforeinstall, checkdpadd,
|
|
# clean, cleandepend, cleandir, depend, install, lint,
|
|
# obj, objlink, realinstall, regress, tags
|
|
#
|
|
|
|
.include <bsd.init.mk>
|
|
|
|
_SUBDIR: .USE
|
|
.if defined(SUBDIR) && !empty(SUBDIR)
|
|
@for entry in ${SUBDIR}; do \
|
|
if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
|
|
${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH}"; \
|
|
edir=$${entry}.${MACHINE_ARCH}; \
|
|
cd ${.CURDIR}/$${edir}; \
|
|
else \
|
|
${ECHODIR} "===> ${DIRPRFX}$$entry"; \
|
|
edir=$${entry}; \
|
|
cd ${.CURDIR}/$${edir}; \
|
|
fi; \
|
|
${MAKE} ${.TARGET:realinstall=install} \
|
|
DIRPRFX=${DIRPRFX}$$edir/; \
|
|
done
|
|
.endif
|
|
|
|
${SUBDIR}::
|
|
@if test -d ${.TARGET}.${MACHINE_ARCH}; then \
|
|
cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \
|
|
else \
|
|
cd ${.CURDIR}/${.TARGET}; \
|
|
fi; \
|
|
${MAKE} all
|
|
|
|
|
|
.for __target in all all-man checkdpadd clean cleandepend cleandir depend lint \
|
|
obj objlink realinstall regress tags \
|
|
install.debug reinstall.debug
|
|
${__target}: _SUBDIR
|
|
.endfor
|
|
|
|
.if !target(install)
|
|
.if !target(beforeinstall)
|
|
beforeinstall:
|
|
.endif
|
|
.if !target(afterinstall)
|
|
afterinstall:
|
|
.endif
|
|
install: afterinstall
|
|
afterinstall: realinstall
|
|
realinstall: beforeinstall
|
|
.endif
|
|
|
|
DISTRIBUTION?= bin
|
|
.if !target(afterdistribute)
|
|
afterdistribute:
|
|
.endif
|
|
.if !target(distribute)
|
|
distribute: _SUBDIR
|
|
.for dist in ${DISTRIBUTION}
|
|
cd ${.CURDIR} ; ${MAKE} afterdistribute DESTDIR=${DISTDIR}/${dist}
|
|
.endfor
|
|
.endif
|