2004-04-13 16:25:03 +04:00
|
|
|
# $NetBSD: bsd.subdir.mk,v 1.48 2004/04/13 12:25:03 lukem 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
|
2004-04-13 16:25:03 +04:00
|
|
|
@${MAKEDIRTARGET} ${.TARGET:C/^[^-]*-//} ${.TARGET:C/-.*$//}
|
2000-06-06 09:33:58 +04:00
|
|
|
|
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})
|
2004-01-29 04:48:45 +03:00
|
|
|
${targ}-${dir}: .PHONY .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)
|
2004-01-29 04:48:45 +03:00
|
|
|
subdir-${targ}: .PHONY ${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
|