bsd.subdir.mk revision 139761
11638Srgrimes# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91 252331Sache# $FreeBSD: head/share/mk/bsd.subdir.mk 139761 2005-01-06 11:12:43Z krion $ 31638Srgrimes# 4265420Simp# The include file <bsd.subdir.mk> contains the default targets 5156813Sru# for building subdirectories. 656296Sru# 756296Sru# For all of the directories listed in the variable SUBDIRS, the 8256365Srpaulo# specified directory will be visited and the target made. There is 9290494Sbapt# also a default target which allows the command "make subdir" where 10145003Sphk# subdir is any directory listed in the variable SUBDIRS. 11124750Sru# 12277666Sngie# 13148675Sphk# +++ variables +++ 14219019Sgabor# 15257344Sbdrewery# DISTRIBUTION Name of distribution. [base] 16148675Sphk# 17148675Sphk# SUBDIR A list of subdirectories that should be built as well. 18124750Sru# Each of the targets will execute the same target in the 19183242Ssam# subdirectories. 20148736Sphk# 21148736Sphk# +++ targets +++ 22148736Sphk# 23124750Sru# distribute: 24124750Sru# This is a variant of install, which will 25183242Ssam# put the stuff into the right "distribution". 26148675Sphk# 27124750Sru# afterinstall, all, all-man, beforeinstall, checkdpadd, 28124750Sru# clean, cleandepend, cleandir, depend, install, lint, maninstall, 29258299Sjmmv# obj, objlink, realinstall, regress, tags 30148736Sphk# 31267124Semaste 32171050Sremko.include <bsd.init.mk> 331638Srgrimes 34183242SsamDISTRIBUTION?= base 35183242Ssam.if !target(distribute) 36183242Ssamdistribute: 37183242Ssam.for dist in ${DISTRIBUTION} 38183242Ssam ${_+_}cd ${.CURDIR}; \ 39183242Ssam ${MAKE} install -DNO_SUBDIR DESTDIR=${DISTDIR}/${dist} SHARED=copies 40277666Sngie.endfor 41277666Sngie.endif 42277666Sngie 43277666Sngie_SUBDIR: .USE 44183242Ssam.if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR) 45183697Sdes @${_+_}for entry in ${SUBDIR}; do \ 46183242Ssam if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \ 47183242Ssam ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:realinstall=install})"; \ 48183242Ssam edir=$${entry}.${MACHINE_ARCH}; \ 49183242Ssam cd ${.CURDIR}/$${edir}; \ 50183242Ssam else \ 51183242Ssam ${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:realinstall=install})"; \ 52183242Ssam edir=$${entry}; \ 53183242Ssam cd ${.CURDIR}/$${edir}; \ 54183242Ssam fi; \ 55183242Ssam ${MAKE} ${.TARGET:realinstall=install} \ 56219019Sgabor DIRPRFX=${DIRPRFX}$$edir/; \ 57219019Sgabor done 58219019Sgabor.endif 59219019Sgabor 60156813Sru${SUBDIR}:: 61290494Sbapt ${_+_}@if test -d ${.TARGET}.${MACHINE_ARCH}; then \ 62290494Sbapt cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \ 63290494Sbapt else \ 64290494Sbapt cd ${.CURDIR}/${.TARGET}; \ 65290494Sbapt fi; \ 66290494Sbapt ${_+_}${MAKE} all 67148736Sphk 68148736Sphk 69183242Ssam.for __target in all all-man checkdpadd clean cleandepend cleandir \ 70183242Ssam depend distribute lint maninstall \ 71148675Sphk obj objlink realinstall regress tags 72148675Sphk${__target}: _SUBDIR 73156813Sru.endfor 74148675Sphk 75148675Sphk.for __target in files includes 76148675Sphk.for __stage in build install 77156813Sru${__stage}${__target}: 78124750Sru.if make(${__stage}${__target}) 7966940Sgshapiro${__stage}${__target}: _SUBDIR 8066940Sgshapiro.endif 81156813Sru.endfor 82124750Sru${__target}: 83124750Sru ${_+_}cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target} 84124750Sru.endfor 85183242Ssam 86183242Ssam.if !target(install) 87183242Ssam.if !target(beforeinstall) 88183242Ssambeforeinstall: 89258299Sjmmv.endif 90258299Sjmmv.if !target(afterinstall) 91258299Sjmmvafterinstall: 92258299Sjmmv.endif 93268022Semasteinstall: beforeinstall realinstall afterinstall 94267124Semaste.ORDER: beforeinstall realinstall afterinstall 95267124Semaste.endif 96267124Semaste