NetBSD/share/mk/bsd.subdir.mk

61 lines
1.4 KiB
Makefile
Raw Normal View History

# $NetBSD: bsd.subdir.mk,v 1.39 2000/12/30 14:32:04 sommerfeld Exp $
1997-03-29 11:02:45 +03:00
# @(#)bsd.subdir.mk 8.1 (Berkeley) 6/8/93
1993-03-21 12:45:37 +03:00
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.MAIN: all
.endif
1993-03-21 12:45:37 +03:00
.for dir in ${SUBDIR}
.if exists(${dir}.${MACHINE})
__REALSUBDIR+=${dir}.${MACHINE}
.else
__REALSUBDIR+=${dir}
.endif
.endfor
2000-04-16 12:37:27 +04:00
.if defined(DESTDIR) && exists(${DESTDIR}/usr/share/mk/sys.mk)
_M=-m ${DESTDIR}/usr/share/mk
.else
_M=
.endif
__recurse: .USE
@targ=${.TARGET:C/-.*$//};dir=${.TARGET:C/^[^-]*-//}; \
case "$$dir" in /*) \
echo "$$targ ===> $$dir"; \
cd "$$dir"; \
${MAKE} ${_M} "_THISDIR_=$$dir/" $$targ; \
;; \
*) \
echo "$$targ ===> ${_THISDIR_}$$dir"; \
cd "${.CURDIR}/$$dir"; \
${MAKE} ${_M} "_THISDIR_=${_THISDIR_}$$dir/" $$targ; \
;; \
esac
# for obscure reasons, we can't do a simple .if ${dir} == ".WAIT"
# but have to assign to __TARGDIR first.
1997-05-07 00:54:31 +04:00
.for targ in ${TARGETS}
.for dir in ${__REALSUBDIR}
__TARGDIR := ${dir}
.if ${__TARGDIR} == ".WAIT"
SUBDIR_${targ} += .WAIT
.else
1997-05-07 00:54:31 +04:00
.PHONY: ${targ}-${dir}
${targ}-${dir}: .MAKE __recurse
SUBDIR_${targ} += ${targ}-${dir}
.endif
1997-05-07 00:54:31 +04:00
.endfor
.if defined(__REALSUBDIR)
${targ}: ${SUBDIR_${targ}}
.endif
.endfor
1993-03-21 12:45:37 +03:00
# Make sure all of the standard targets are defined, even if they do nothing.
${TARGETS}: