1 1.50 uebayasi # $NetBSD: bsd.subdir.mk,v 1.50 2009/11/29 16:00:00 uebayasi 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.25 mycroft .if exists(${dir}.${MACHINE}) 10 1.25 mycroft __REALSUBDIR+=${dir}.${MACHINE} 11 1.25 mycroft .else 12 1.25 mycroft __REALSUBDIR+=${dir} 13 1.25 mycroft .endif 14 1.25 mycroft .endfor 15 1.1 cgd 16 1.35 mycroft __recurse: .USE 17 1.48 lukem @${MAKEDIRTARGET} ${.TARGET:C/^[^-]*-//} ${.TARGET:C/-.*$//} 18 1.35 mycroft 19 1.42 tv .if make(cleandir) 20 1.42 tv __RECURSETARG= ${TARGETS:Nclean} 21 1.45 tv clean: 22 1.42 tv .else 23 1.42 tv __RECURSETARG= ${TARGETS} 24 1.42 tv .endif 25 1.42 tv 26 1.39 sommerfe # for obscure reasons, we can't do a simple .if ${dir} == ".WAIT" 27 1.39 sommerfe # but have to assign to __TARGDIR first. 28 1.42 tv .for targ in ${__RECURSETARG} 29 1.25 mycroft .for dir in ${__REALSUBDIR} 30 1.39 sommerfe __TARGDIR := ${dir} 31 1.39 sommerfe .if ${__TARGDIR} == ".WAIT" 32 1.39 sommerfe SUBDIR_${targ} += .WAIT 33 1.43 tv .elif !commands(${targ}-${dir}) 34 1.47 lukem ${targ}-${dir}: .PHONY .MAKE __recurse 35 1.41 sommerfe SUBDIR_${targ} += ${targ}-${dir} 36 1.39 sommerfe .endif 37 1.17 mycroft .endfor 38 1.47 lukem subdir-${targ}: .PHONY ${SUBDIR_${targ}} 39 1.40 sommerfe ${targ}: subdir-${targ} 40 1.12 cgd .endfor 41 1.21 christos 42 1.49 apb .endif # ! NOSUBDIR # } 43 1.49 apb 44 1.46 tv ${TARGETS}: # ensure existence 45