2001-11-02 08:21:47 +03:00
|
|
|
# $NetBSD: bsd.subdir.mk,v 1.46 2001/11/02 05:21:51 tv 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
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
.include <bsd.init.mk>
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-03-21 03:53:02 +03:00
|
|
|
.for dir in ${SUBDIR}
|
1997-10-10 13:12:28 +04:00
|
|
|
.if exists(${dir}.${MACHINE})
|
|
|
|
__REALSUBDIR+=${dir}.${MACHINE}
|
|
|
|
.else
|
|
|
|
__REALSUBDIR+=${dir}
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
2000-06-06 09:33:58 +04:00
|
|
|
__recurse: .USE
|
2000-06-06 09:39:26 +04:00
|
|
|
@targ=${.TARGET:C/-.*$//};dir=${.TARGET:C/^[^-]*-//}; \
|
2000-06-06 09:33:58 +04:00
|
|
|
case "$$dir" in /*) \
|
|
|
|
echo "$$targ ===> $$dir"; \
|
|
|
|
cd "$$dir"; \
|
2001-09-22 09:01:26 +04:00
|
|
|
${MAKE} "_THISDIR_=$$dir/" $$targ; \
|
2000-06-06 09:33:58 +04:00
|
|
|
;; \
|
|
|
|
*) \
|
|
|
|
echo "$$targ ===> ${_THISDIR_}$$dir"; \
|
|
|
|
cd "${.CURDIR}/$$dir"; \
|
2001-09-22 09:01:26 +04:00
|
|
|
${MAKE} "_THISDIR_=${_THISDIR_}$$dir/" $$targ; \
|
2000-06-06 09:33:58 +04:00
|
|
|
;; \
|
|
|
|
esac
|
|
|
|
|
2001-08-14 13:02:26 +04:00
|
|
|
.if make(cleandir)
|
|
|
|
__RECURSETARG= ${TARGETS:Nclean}
|
2001-10-04 20:29:54 +04:00
|
|
|
clean:
|
2001-08-14 13:02:26 +04:00
|
|
|
.else
|
|
|
|
__RECURSETARG= ${TARGETS}
|
|
|
|
.endif
|
|
|
|
|
2000-12-30 17:32:04 +03:00
|
|
|
# for obscure reasons, we can't do a simple .if ${dir} == ".WAIT"
|
|
|
|
# but have to assign to __TARGDIR first.
|
2001-08-14 13:02:26 +04:00
|
|
|
.for targ in ${__RECURSETARG}
|
2000-06-06 09:33:58 +04:00
|
|
|
.for dir in ${__REALSUBDIR}
|
2000-12-30 17:32:04 +03:00
|
|
|
__TARGDIR := ${dir}
|
|
|
|
.if ${__TARGDIR} == ".WAIT"
|
|
|
|
SUBDIR_${targ} += .WAIT
|
2001-09-22 00:50:23 +04:00
|
|
|
.elif !commands(${targ}-${dir})
|
1997-05-07 00:54:31 +04:00
|
|
|
.PHONY: ${targ}-${dir}
|
2000-06-06 09:33:58 +04:00
|
|
|
${targ}-${dir}: .MAKE __recurse
|
2001-01-09 05:08:32 +03:00
|
|
|
SUBDIR_${targ} += ${targ}-${dir}
|
2000-12-30 17:32:04 +03:00
|
|
|
.endif
|
1997-05-07 00:54:31 +04:00
|
|
|
.endfor
|
2000-06-06 12:54:06 +04:00
|
|
|
.if defined(__REALSUBDIR)
|
2001-01-09 05:08:32 +03:00
|
|
|
.PHONY: subdir-${targ}
|
|
|
|
subdir-${targ}: ${SUBDIR_${targ}}
|
2001-01-01 18:27:31 +03:00
|
|
|
${targ}: subdir-${targ}
|
2000-06-06 12:54:06 +04:00
|
|
|
.endif
|
1997-03-21 03:53:02 +03:00
|
|
|
.endfor
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
${TARGETS}: # ensure existence
|