1 1.56 rillig # $NetBSD: bsd.subdir.mk,v 1.56 2022/07/10 21:32:09 rillig 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.55 rillig .if ${dir} != ".WAIT" && exists(${.CURDIR}/${dir}.${MACHINE}) 10 1.51 christos __REALSUBDIR+=${dir}.${MACHINE} 11 1.51 christos .else 12 1.51 christos __REALSUBDIR+=${dir} 13 1.51 christos .endif 14 1.54 christos .endfor 15 1.54 christos 16 1.54 christos .if ${MKGROFF} == "yes" 17 1.54 christos __REALSUBDIR+=${SUBDIR.roff} 18 1.53 kamil .endif 19 1.1 cgd 20 1.35 mycroft __recurse: .USE 21 1.48 lukem @${MAKEDIRTARGET} ${.TARGET:C/^[^-]*-//} ${.TARGET:C/-.*$//} 22 1.35 mycroft 23 1.42 tv .if make(cleandir) 24 1.42 tv __RECURSETARG= ${TARGETS:Nclean} 25 1.45 tv clean: 26 1.42 tv .else 27 1.42 tv __RECURSETARG= ${TARGETS} 28 1.42 tv .endif 29 1.42 tv 30 1.42 tv .for targ in ${__RECURSETARG} 31 1.25 mycroft .for dir in ${__REALSUBDIR} 32 1.56 rillig .if ${dir} == ".WAIT" 33 1.56 rillig SUBDIR_${targ}+= .WAIT 34 1.43 tv .elif !commands(${targ}-${dir}) 35 1.47 lukem ${targ}-${dir}: .PHONY .MAKE __recurse 36 1.56 rillig SUBDIR_${targ}+= ${targ}-${dir} 37 1.39 sommerfe .endif 38 1.17 mycroft .endfor 39 1.47 lukem subdir-${targ}: .PHONY ${SUBDIR_${targ}} 40 1.40 sommerfe ${targ}: subdir-${targ} 41 1.12 cgd .endfor 42 1.21 christos 43 1.49 apb .endif # ! NOSUBDIR # } 44 1.49 apb 45 1.46 tv ${TARGETS}: # ensure existence 46