1 1.44 tv # $NetBSD: bsd.subdir.mk,v 1.44 2001/09/22 05:01:26 tv Exp $ 2 1.14 mikel # @(#)bsd.subdir.mk 8.1 (Berkeley) 6/8/93 3 1.1 cgd 4 1.27 mycroft .if !target(__initialized__) 5 1.27 mycroft __initialized__: 6 1.27 mycroft .if exists(${.CURDIR}/../Makefile.inc) 7 1.27 mycroft .include "${.CURDIR}/../Makefile.inc" 8 1.27 mycroft .endif 9 1.13 christos .include <bsd.own.mk> 10 1.27 mycroft .MAIN: all 11 1.3 mycroft .endif 12 1.1 cgd 13 1.25 mycroft .for dir in ${SUBDIR} 14 1.25 mycroft .if exists(${dir}.${MACHINE}) 15 1.25 mycroft __REALSUBDIR+=${dir}.${MACHINE} 16 1.25 mycroft .else 17 1.25 mycroft __REALSUBDIR+=${dir} 18 1.25 mycroft .endif 19 1.25 mycroft .endfor 20 1.1 cgd 21 1.35 mycroft __recurse: .USE 22 1.36 mycroft @targ=${.TARGET:C/-.*$//};dir=${.TARGET:C/^[^-]*-//}; \ 23 1.35 mycroft case "$$dir" in /*) \ 24 1.35 mycroft echo "$$targ ===> $$dir"; \ 25 1.35 mycroft cd "$$dir"; \ 26 1.44 tv ${MAKE} "_THISDIR_=$$dir/" $$targ; \ 27 1.35 mycroft ;; \ 28 1.35 mycroft *) \ 29 1.35 mycroft echo "$$targ ===> ${_THISDIR_}$$dir"; \ 30 1.35 mycroft cd "${.CURDIR}/$$dir"; \ 31 1.44 tv ${MAKE} "_THISDIR_=${_THISDIR_}$$dir/" $$targ; \ 32 1.35 mycroft ;; \ 33 1.35 mycroft esac 34 1.35 mycroft 35 1.42 tv .if make(cleandir) 36 1.42 tv __RECURSETARG= ${TARGETS:Nclean} 37 1.42 tv .else 38 1.42 tv __RECURSETARG= ${TARGETS} 39 1.42 tv .endif 40 1.42 tv 41 1.39 sommerfe # for obscure reasons, we can't do a simple .if ${dir} == ".WAIT" 42 1.39 sommerfe # but have to assign to __TARGDIR first. 43 1.42 tv .for targ in ${__RECURSETARG} 44 1.25 mycroft .for dir in ${__REALSUBDIR} 45 1.39 sommerfe __TARGDIR := ${dir} 46 1.39 sommerfe .if ${__TARGDIR} == ".WAIT" 47 1.39 sommerfe SUBDIR_${targ} += .WAIT 48 1.43 tv .elif !commands(${targ}-${dir}) 49 1.17 mycroft .PHONY: ${targ}-${dir} 50 1.35 mycroft ${targ}-${dir}: .MAKE __recurse 51 1.41 sommerfe SUBDIR_${targ} += ${targ}-${dir} 52 1.39 sommerfe .endif 53 1.17 mycroft .endfor 54 1.38 mycroft .if defined(__REALSUBDIR) 55 1.41 sommerfe .PHONY: subdir-${targ} 56 1.41 sommerfe subdir-${targ}: ${SUBDIR_${targ}} 57 1.40 sommerfe ${targ}: subdir-${targ} 58 1.38 mycroft .endif 59 1.12 cgd .endfor 60 1.21 christos 61 1.26 mycroft # Make sure all of the standard targets are defined, even if they do nothing. 62 1.26 mycroft ${TARGETS}: 63