NetBSD/share/mk/bsd.subdir.mk
cjs 5fd7ce7066 These updates to the build allow building against include files
and libs in the object tree, if you use a separate object tree,
while maintaining backward compatability with other build methods.
See the notes in src/share/mk/bsd.README for full details. Note
that the `make includes' target now only installs the include files
in the build directory (if you use one--otherwise they go in DESTDIR
just like before); `make install' will install include files in
DESTDIR.
1997-05-26 03:55:19 +00:00

50 lines
1.2 KiB
Makefile

# $NetBSD: bsd.subdir.mk,v 1.22 1997/05/26 03:59:03 cjs Exp $
# @(#)bsd.subdir.mk 8.1 (Berkeley) 6/8/93
.include <bsd.own.mk>
.if !target(.MAIN)
.MAIN: all
.endif
_SUBDIRUSE: .USE ${SUBDIR:S/^/${.TARGET}-/}
__SUBDIRINTERNALUSE: .USE
@(_maketarget_="${.TARGET}"; \
entry="$${_maketarget_#*-}";\
target="$${_maketarget_%%-*}";\
set -e; if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
_newdir_="$${entry}.${MACHINE}"; \
else \
_newdir_="$${entry}"; \
fi; \
if test X"${_THISDIR_}" = X""; then \
_nextdir_="$${_newdir_}"; \
else \
_nextdir_="$${_THISDIR_}/$${_newdir_}"; \
fi; \
if test -d ${.CURDIR}/$${_newdir_}; then \
echo "===> $${_nextdir_}"; \
cd ${.CURDIR}/$${_newdir_}; \
${MAKE} _THISDIR_="$${_nextdir_}" $${target}; \
else \
echo "===> $${_nextdir_} [skipped: missing]"; \
fi)
.for dir in ${SUBDIR}
.for targ in ${TARGETS}
.PHONY: ${targ}-${dir}
${targ}-${dir}: .MAKE __SUBDIRINTERNALUSE
.endfor
# Backward-compatibility with the old rules. If this went away,
# 'xlint' could become 'lint', 'xinstall' could become 'install', etc.
${dir}: all-${dir}
.endfor
.for targ in ${TARGETS}
${targ}: _SUBDIRUSE
.endfor
.include <bsd.own.mk>