bsd.subdir.mk revision 1.56 1 # $NetBSD: bsd.subdir.mk,v 1.56 2022/07/10 21:32:09 rillig Exp $
2 # @(#)bsd.subdir.mk 8.1 (Berkeley) 6/8/93
3
4 .include <bsd.init.mk>
5
6 .if !defined(NOSUBDIR) # {
7
8 .for dir in ${SUBDIR}
9 .if ${dir} != ".WAIT" && exists(${.CURDIR}/${dir}.${MACHINE})
10 __REALSUBDIR+=${dir}.${MACHINE}
11 .else
12 __REALSUBDIR+=${dir}
13 .endif
14 .endfor
15
16 .if ${MKGROFF} == "yes"
17 __REALSUBDIR+=${SUBDIR.roff}
18 .endif
19
20 __recurse: .USE
21 @${MAKEDIRTARGET} ${.TARGET:C/^[^-]*-//} ${.TARGET:C/-.*$//}
22
23 .if make(cleandir)
24 __RECURSETARG= ${TARGETS:Nclean}
25 clean:
26 .else
27 __RECURSETARG= ${TARGETS}
28 .endif
29
30 .for targ in ${__RECURSETARG}
31 .for dir in ${__REALSUBDIR}
32 .if ${dir} == ".WAIT"
33 SUBDIR_${targ}+= .WAIT
34 .elif !commands(${targ}-${dir})
35 ${targ}-${dir}: .PHONY .MAKE __recurse
36 SUBDIR_${targ}+= ${targ}-${dir}
37 .endif
38 .endfor
39 subdir-${targ}: .PHONY ${SUBDIR_${targ}}
40 ${targ}: subdir-${targ}
41 .endfor
42
43 .endif # ! NOSUBDIR # }
44
45 ${TARGETS}: # ensure existence
46