2010-05-26 04:48:15 +04:00
|
|
|
# $NetBSD: bsd.subdir.mk,v 1.52 2010/05/26 00:48:15 uwe 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
|
|
|
|
2008-10-25 18:58:00 +04:00
|
|
|
.if !defined(NOSUBDIR) # {
|
|
|
|
|
1997-03-21 03:53:02 +03:00
|
|
|
.for dir in ${SUBDIR}
|
2009-12-19 03:14:43 +03:00
|
|
|
.if "${dir}" == ".WAIT"
|
2010-05-26 04:48:15 +04:00
|
|
|
# Don't play with .WAIT
|
2009-12-19 03:14:43 +03:00
|
|
|
__REALSUBDIR+=${dir}
|
|
|
|
.else
|
|
|
|
.if "${dir:H}" != ""
|
|
|
|
# It is a relative path; make it absolute so exists can't search the path.
|
|
|
|
.if exists(${.CURDIR}/${dir}.${MACHINE})
|
|
|
|
__REALSUBDIR+=${dir}.${MACHINE}
|
|
|
|
.else
|
|
|
|
__REALSUBDIR+=${dir}
|
|
|
|
.endif
|
|
|
|
.else
|
|
|
|
# It is an absolute path; leave it alone
|
1997-10-10 13:12:28 +04:00
|
|
|
.if exists(${dir}.${MACHINE})
|
|
|
|
__REALSUBDIR+=${dir}.${MACHINE}
|
|
|
|
.else
|
|
|
|
__REALSUBDIR+=${dir}
|
|
|
|
.endif
|
2009-12-19 03:14:43 +03:00
|
|
|
.endif
|
|
|
|
.endif
|
1997-10-10 13:12:28 +04:00
|
|
|
.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
|
2004-01-29 04:48:45 +03:00
|
|
|
subdir-${targ}: .PHONY ${SUBDIR_${targ}}
|
2001-01-01 18:27:31 +03:00
|
|
|
${targ}: subdir-${targ}
|
1997-03-21 03:53:02 +03:00
|
|
|
.endfor
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2008-10-25 18:58:00 +04:00
|
|
|
.endif # ! NOSUBDIR # }
|
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
${TARGETS}: # ensure existence
|