Home | History | Annotate | Line # | Download | only in mk
bsd.subdir.mk revision 1.52
      1  1.52       uwe #	$NetBSD: bsd.subdir.mk,v 1.52 2010/05/26 00:48:15 uwe Exp $
      2  1.14     mikel #	@(#)bsd.subdir.mk	8.1 (Berkeley) 6/8/93
      3   1.1       cgd 
      4  1.46        tv .include <bsd.init.mk>
      5   1.1       cgd 
      6  1.49       apb .if !defined(NOSUBDIR)					# {
      7  1.49       apb 
      8  1.25   mycroft .for dir in ${SUBDIR}
      9  1.51  christos .if "${dir}" == ".WAIT"
     10  1.52       uwe # Don't play with .WAIT
     11  1.51  christos __REALSUBDIR+=${dir}
     12  1.51  christos .else
     13  1.51  christos .if "${dir:H}" != ""
     14  1.51  christos # It is a relative path; make it absolute so exists can't search the path.
     15  1.51  christos .if exists(${.CURDIR}/${dir}.${MACHINE})
     16  1.51  christos __REALSUBDIR+=${dir}.${MACHINE}
     17  1.51  christos .else
     18  1.51  christos __REALSUBDIR+=${dir}
     19  1.51  christos .endif
     20  1.51  christos .else
     21  1.51  christos # It is an absolute path; leave it alone
     22  1.25   mycroft .if exists(${dir}.${MACHINE})
     23  1.25   mycroft __REALSUBDIR+=${dir}.${MACHINE}
     24  1.25   mycroft .else
     25  1.25   mycroft __REALSUBDIR+=${dir}
     26  1.25   mycroft .endif
     27  1.51  christos .endif
     28  1.51  christos .endif
     29  1.25   mycroft .endfor
     30   1.1       cgd 
     31  1.35   mycroft __recurse: .USE
     32  1.48     lukem 	@${MAKEDIRTARGET} ${.TARGET:C/^[^-]*-//} ${.TARGET:C/-.*$//}
     33  1.35   mycroft 
     34  1.42        tv .if make(cleandir)
     35  1.42        tv __RECURSETARG=	${TARGETS:Nclean}
     36  1.45        tv clean:
     37  1.42        tv .else
     38  1.42        tv __RECURSETARG=	${TARGETS}
     39  1.42        tv .endif
     40  1.42        tv 
     41  1.39  sommerfe # for obscure reasons, we can't do a simple .if ${dir} == ".WAIT"
     42  1.39  sommerfe # but have to assign to __TARGDIR first.
     43  1.42        tv .for targ in ${__RECURSETARG}
     44  1.25   mycroft .for dir in ${__REALSUBDIR}
     45  1.39  sommerfe __TARGDIR := ${dir}
     46  1.39  sommerfe .if ${__TARGDIR} == ".WAIT"
     47  1.39  sommerfe SUBDIR_${targ} += .WAIT
     48  1.43        tv .elif !commands(${targ}-${dir})
     49  1.47     lukem ${targ}-${dir}: .PHONY .MAKE __recurse
     50  1.41  sommerfe SUBDIR_${targ} += ${targ}-${dir}
     51  1.39  sommerfe .endif
     52  1.17   mycroft .endfor
     53  1.47     lukem subdir-${targ}: .PHONY ${SUBDIR_${targ}}
     54  1.40  sommerfe ${targ}: subdir-${targ}
     55  1.12       cgd .endfor
     56  1.21  christos 
     57  1.49       apb .endif	# ! NOSUBDIR					# }
     58  1.49       apb 
     59  1.46        tv ${TARGETS}:	# ensure existence
     60