bsd.subdir.mk revision 95356
11844Swollman# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91 250476Speter# $FreeBSD: head/share/mk/bsd.subdir.mk 95356 2002-04-24 11:26:19Z 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# 2774842Sru# afterdistribute, afterinstall, all, all-man, beforeinstall, checkdpadd, 2895306Sru# clean, cleandepend, cleandir, depend, install, lint, 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 6074842Sru.for __target in all all-man checkdpadd clean cleandepend cleandir depend lint \ 6195356Sru obj objlink realinstall regress tags 6295306Sru${__target}: _SUBDIR 6315061Swosch.endfor 641638Srgrimes 651638Srgrimes.if !target(install) 661638Srgrimes.if !target(beforeinstall) 671638Srgrimesbeforeinstall: 681638Srgrimes.endif 691638Srgrimes.if !target(afterinstall) 701638Srgrimesafterinstall: 711638Srgrimes.endif 721638Srgrimesinstall: afterinstall 731638Srgrimesafterinstall: realinstall 7495306Srurealinstall: beforeinstall 751638Srgrimes.endif 761638Srgrimes 7795327SobrienDISTRIBUTION?= base 7815061Swosch.if !target(afterdistribute) 7915061Swoschafterdistribute: 801638Srgrimes.endif 8115061Swosch.if !target(distribute) 8295306Srudistribute: _SUBDIR 8326760Sjkh.for dist in ${DISTRIBUTION} 8426760Sjkh cd ${.CURDIR} ; ${MAKE} afterdistribute DESTDIR=${DISTDIR}/${dist} 8526760Sjkh.endfor 861638Srgrimes.endif 87