11844Swollman# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91 250476Speter# $FreeBSD$ 323549Swosch# 423549Swosch# The include file <bsd.subdir.mk> contains the default targets 5139761Skrion# 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# 27200178Sed# afterinstall, all, all-man, beforeinstall, checkdpadd, clean, 28200178Sed# cleandepend, cleandir, cleanilinks depend, install, lint, 29200178Sed# maninstall, manlint, obj, objlink, realinstall, regress, tags 3023549Swosch# 311638Srgrimes 32242711Ssjg.if !target(__<bsd.subdir.mk>__) 33242711Ssjg__<bsd.subdir.mk>__: 34242711Ssjg 3594940Sru.include <bsd.init.mk> 3623549Swosch 3799875SruDISTRIBUTION?= base 3899875Sru.if !target(distribute) 39251749Ssjgdistribute: .MAKE 4099875Sru.for dist in ${DISTRIBUTION} 41133369Sharti ${_+_}cd ${.CURDIR}; \ 4299875Sru ${MAKE} install -DNO_SUBDIR DESTDIR=${DISTDIR}/${dist} SHARED=copies 4399875Sru.endfor 4499875Sru.endif 4599875Sru 46251749Ssjg_SUBDIR: .USE .MAKE 4799875Sru.if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR) 48241298Smarcel @${_+_}set -e; for entry in ${SUBDIR}; do \ 4995306Sru if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \ 50134903Simp ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:realinstall=install})"; \ 5190311Sru edir=$${entry}.${MACHINE_ARCH}; \ 5290311Sru cd ${.CURDIR}/$${edir}; \ 5390311Sru else \ 54134903Simp ${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:realinstall=install})"; \ 5590311Sru edir=$${entry}; \ 5690311Sru cd ${.CURDIR}/$${edir}; \ 5790311Sru fi; \ 5890311Sru ${MAKE} ${.TARGET:realinstall=install} \ 5995306Sru DIRPRFX=${DIRPRFX}$$edir/; \ 601638Srgrimes done 6195306Sru.endif 621638Srgrimes 63251749Ssjg${SUBDIR}: .PHONY .MAKE 64133369Sharti ${_+_}@if test -d ${.TARGET}.${MACHINE_ARCH}; then \ 6553152Smarcel cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \ 661638Srgrimes else \ 671638Srgrimes cd ${.CURDIR}/${.TARGET}; \ 681638Srgrimes fi; \ 69146817Sru ${MAKE} all 701638Srgrimes 7195509Sru.for __target in all all-man checkdpadd clean cleandepend cleandir \ 72200178Sed cleanilinks depend distribute lint maninstall manlint obj objlink \ 73200178Sed realinstall regress tags ${SUBDIR_TARGETS} 7495306Sru${__target}: _SUBDIR 7515061Swosch.endfor 761638Srgrimes 7797769Sru.for __target in files includes 7896668Sru.for __stage in build install 7996668Sru${__stage}${__target}: 8096668Sru.if make(${__stage}${__target}) 8196668Sru${__stage}${__target}: _SUBDIR 8296668Sru.endif 8396668Sru.endfor 84251749Ssjg${__target}: .MAKE 85241298Smarcel ${_+_}set -e; cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target} 8696668Sru.endfor 8796668Sru 881638Srgrimes.if !target(install) 891638Srgrimes.if !target(beforeinstall) 901638Srgrimesbeforeinstall: 911638Srgrimes.endif 921638Srgrimes.if !target(afterinstall) 931638Srgrimesafterinstall: 941638Srgrimes.endif 9599215Sruinstall: beforeinstall realinstall afterinstall 9699215Sru.ORDER: beforeinstall realinstall afterinstall 971638Srgrimes.endif 98242711Ssjg 99242711Ssjg.endif 100