1 1.55 rillig # $NetBSD: bsd.subdir.mk,v 1.55 2022/07/10 21:16:57 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.39 sommerfe # for obscure reasons, we can't do a simple .if ${dir} == ".WAIT" 31 1.39 sommerfe # but have to assign to __TARGDIR first. 32 1.42 tv .for targ in ${__RECURSETARG} 33 1.25 mycroft .for dir in ${__REALSUBDIR} 34 1.39 sommerfe __TARGDIR := ${dir} 35 1.39 sommerfe .if ${__TARGDIR} == ".WAIT" 36 1.39 sommerfe SUBDIR_${targ} += .WAIT 37 1.43 tv .elif !commands(${targ}-${dir}) 38 1.47 lukem ${targ}-${dir}: .PHONY .MAKE __recurse 39 1.41 sommerfe SUBDIR_${targ} += ${targ}-${dir} 40 1.39 sommerfe .endif 41 1.17 mycroft .endfor 42 1.47 lukem subdir-${targ}: .PHONY ${SUBDIR_${targ}} 43 1.40 sommerfe ${targ}: subdir-${targ} 44 1.12 cgd .endfor 45 1.21 christos 46 1.49 apb .endif # ! NOSUBDIR # } 47 1.49 apb 48 1.46 tv ${TARGETS}: # ensure existence 49