bsd.subdir.mk revision 99215
11844Swollman# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91 250476Speter# $FreeBSD: head/share/mk/bsd.subdir.mk 99215 2002-07-01 14:49:16Z ru $ 323549Swosch# 423549Swosch# The include file <bsd.subdir.mk> contains the default targets 535784Swosch# for building subdirectories. 623549Swosch# 723549Swosch# For all of the directories listed in the variable SUBDIRS, the 823549Swosch# specified directory will be visited and the target made. There is 923549Swosch# also a default target which allows the command "make subdir" where 1023549Swosch# subdir is any directory listed in the variable SUBDIRS. 1123549Swosch# 1223549Swosch# 1323549Swosch# +++ variables +++ 1423549Swosch# 1595327Sobrien# DISTRIBUTION Name of distribution. [base] 1623549Swosch# 1723549Swosch# SUBDIR A list of subdirectories that should be built as well. 1823549Swosch# Each of the targets will execute the same target in the 1923549Swosch# subdirectories. 2023549Swosch# 2123549Swosch# +++ targets +++ 2223549Swosch# 2323549Swosch# distribute: 2423549Swosch# This is a variant of install, which will 2523549Swosch# put the stuff into the right "distribution". 2623549Swosch# 2795509Sru# afterinstall, all, all-man, beforeinstall, checkdpadd, 2896164Sru# clean, cleandepend, cleandir, depend, install, lint, maninstall, 2944922Sbde# obj, objlink, realinstall, regress, tags 3023549Swosch# 311638Srgrimes 3294940Sru.include <bsd.init.mk> 3323549Swosch 3495306Sru_SUBDIR: .USE 3595306Sru.if defined(SUBDIR) && !empty(SUBDIR) 3690311Sru @for entry in ${SUBDIR}; do \ 3795306Sru if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \ 3890311Sru ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH}"; \ 3990311Sru edir=$${entry}.${MACHINE_ARCH}; \ 4090311Sru cd ${.CURDIR}/$${edir}; \ 4190311Sru else \ 4290311Sru ${ECHODIR} "===> ${DIRPRFX}$$entry"; \ 4390311Sru edir=$${entry}; \ 4490311Sru cd ${.CURDIR}/$${edir}; \ 4590311Sru fi; \ 4690311Sru ${MAKE} ${.TARGET:realinstall=install} \ 4795306Sru DIRPRFX=${DIRPRFX}$$edir/; \ 481638Srgrimes done 4995306Sru.endif 501638Srgrimes 511638Srgrimes${SUBDIR}:: 5253152Smarcel @if test -d ${.TARGET}.${MACHINE_ARCH}; then \ 5353152Smarcel cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \ 541638Srgrimes else \ 551638Srgrimes cd ${.CURDIR}/${.TARGET}; \ 561638Srgrimes fi; \ 571638Srgrimes ${MAKE} all 581638Srgrimes 591638Srgrimes 6095509Sru.for __target in all all-man checkdpadd clean cleandepend cleandir \ 6196668Sru depend distribute lint maninstall \ 6295356Sru obj objlink realinstall regress tags 6395306Sru${__target}: _SUBDIR 6415061Swosch.endfor 651638Srgrimes 6697769Sru.for __target in files includes 6796668Sru.for __stage in build install 6896668Sru${__stage}${__target}: 6996668Sru.if make(${__stage}${__target}) 7096668Sru${__stage}${__target}: _SUBDIR 7196668Sru.endif 7296668Sru.endfor 7396668Sru${__target}: 7496668Sru cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target} 7596668Sru.endfor 7696668Sru 771638Srgrimes.if !target(install) 781638Srgrimes.if !target(beforeinstall) 791638Srgrimesbeforeinstall: 801638Srgrimes.endif 811638Srgrimes.if !target(afterinstall) 821638Srgrimesafterinstall: 831638Srgrimes.endif 8499215Sruinstall: beforeinstall realinstall afterinstall 8599215Sru.ORDER: beforeinstall realinstall afterinstall 861638Srgrimes.endif 87