1 1.46 tv # $NetBSD: bsd.subdir.mk,v 1.46 2001/11/02 05:21:51 tv 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.25 mycroft .for dir in ${SUBDIR} 7 1.25 mycroft .if exists(${dir}.${MACHINE}) 8 1.25 mycroft __REALSUBDIR+=${dir}.${MACHINE} 9 1.25 mycroft .else 10 1.25 mycroft __REALSUBDIR+=${dir} 11 1.25 mycroft .endif 12 1.25 mycroft .endfor 13 1.1 cgd 14 1.35 mycroft __recurse: .USE 15 1.36 mycroft @targ=${.TARGET:C/-.*$//};dir=${.TARGET:C/^[^-]*-//}; \ 16 1.35 mycroft case "$$dir" in /*) \ 17 1.35 mycroft echo "$$targ ===> $$dir"; \ 18 1.35 mycroft cd "$$dir"; \ 19 1.44 tv ${MAKE} "_THISDIR_=$$dir/" $$targ; \ 20 1.35 mycroft ;; \ 21 1.35 mycroft *) \ 22 1.35 mycroft echo "$$targ ===> ${_THISDIR_}$$dir"; \ 23 1.35 mycroft cd "${.CURDIR}/$$dir"; \ 24 1.44 tv ${MAKE} "_THISDIR_=${_THISDIR_}$$dir/" $$targ; \ 25 1.35 mycroft ;; \ 26 1.35 mycroft esac 27 1.35 mycroft 28 1.42 tv .if make(cleandir) 29 1.42 tv __RECURSETARG= ${TARGETS:Nclean} 30 1.45 tv clean: 31 1.42 tv .else 32 1.42 tv __RECURSETARG= ${TARGETS} 33 1.42 tv .endif 34 1.42 tv 35 1.39 sommerfe # for obscure reasons, we can't do a simple .if ${dir} == ".WAIT" 36 1.39 sommerfe # but have to assign to __TARGDIR first. 37 1.42 tv .for targ in ${__RECURSETARG} 38 1.25 mycroft .for dir in ${__REALSUBDIR} 39 1.39 sommerfe __TARGDIR := ${dir} 40 1.39 sommerfe .if ${__TARGDIR} == ".WAIT" 41 1.39 sommerfe SUBDIR_${targ} += .WAIT 42 1.43 tv .elif !commands(${targ}-${dir}) 43 1.17 mycroft .PHONY: ${targ}-${dir} 44 1.35 mycroft ${targ}-${dir}: .MAKE __recurse 45 1.41 sommerfe SUBDIR_${targ} += ${targ}-${dir} 46 1.39 sommerfe .endif 47 1.17 mycroft .endfor 48 1.38 mycroft .if defined(__REALSUBDIR) 49 1.41 sommerfe .PHONY: subdir-${targ} 50 1.41 sommerfe subdir-${targ}: ${SUBDIR_${targ}} 51 1.40 sommerfe ${targ}: subdir-${targ} 52 1.38 mycroft .endif 53 1.12 cgd .endfor 54 1.21 christos 55 1.46 tv ${TARGETS}: # ensure existence 56