bsd.subdir.mk revision 99215
14273SN/A# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91 24273SN/A# $FreeBSD: head/share/mk/bsd.subdir.mk 99215 2002-07-01 14:49:16Z ru $ 34273SN/A# 44273SN/A# The include file <bsd.subdir.mk> contains the default targets 54273SN/A# for building subdirectories. 64273SN/A# 74273SN/A# For all of the directories listed in the variable SUBDIRS, the 84273SN/A# specified directory will be visited and the target made. There is 91674SN/A# also a default target which allows the command "make subdir" where 104273SN/A# subdir is any directory listed in the variable SUBDIRS. 114273SN/A# 124273SN/A# 134273SN/A# +++ variables +++ 141674SN/A# 154273SN/A# DISTRIBUTION Name of distribution. [base] 164273SN/A# 174273SN/A# SUBDIR A list of subdirectories that should be built as well. 181674SN/A# Each of the targets will execute the same target in the 194273SN/A# subdirectories. 204273SN/A# 214273SN/A# +++ targets +++ 224273SN/A# 234273SN/A# distribute: 244273SN/A# This is a variant of install, which will 251674SN/A# put the stuff into the right "distribution". 261674SN/A# 271674SN/A# afterinstall, all, all-man, beforeinstall, checkdpadd, 281674SN/A# clean, cleandepend, cleandir, depend, install, lint, maninstall, 291674SN/A# obj, objlink, realinstall, regress, tags 301674SN/A# 311674SN/A 321674SN/A.include <bsd.init.mk> 331674SN/A 341674SN/A_SUBDIR: .USE 351674SN/A.if defined(SUBDIR) && !empty(SUBDIR) 361674SN/A @for entry in ${SUBDIR}; do \ 371674SN/A if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \ 381674SN/A ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH}"; \ 391674SN/A edir=$${entry}.${MACHINE_ARCH}; \ 401674SN/A cd ${.CURDIR}/$${edir}; \ 411674SN/A else \ 421674SN/A ${ECHODIR} "===> ${DIRPRFX}$$entry"; \ 431674SN/A edir=$${entry}; \ 441674SN/A cd ${.CURDIR}/$${edir}; \ 451674SN/A fi; \ 461674SN/A ${MAKE} ${.TARGET:realinstall=install} \ 471674SN/A DIRPRFX=${DIRPRFX}$$edir/; \ 481674SN/A done 491674SN/A.endif 501674SN/A 511674SN/A${SUBDIR}:: 521674SN/A @if test -d ${.TARGET}.${MACHINE_ARCH}; then \ 531674SN/A cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \ 541674SN/A else \ 551674SN/A cd ${.CURDIR}/${.TARGET}; \ 561674SN/A fi; \ 571674SN/A ${MAKE} all 581674SN/A 591674SN/A 601674SN/A.for __target in all all-man checkdpadd clean cleandepend cleandir \ 611674SN/A depend distribute lint maninstall \ 621674SN/A obj objlink realinstall regress tags 631674SN/A${__target}: _SUBDIR 641674SN/A.endfor 651674SN/A 661674SN/A.for __target in files includes 671674SN/A.for __stage in build install 681674SN/A${__stage}${__target}: 691674SN/A.if make(${__stage}${__target}) 701674SN/A${__stage}${__target}: _SUBDIR 711674SN/A.endif 721674SN/A.endfor 731674SN/A${__target}: 741674SN/A cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target} 751674SN/A.endfor 761674SN/A 771674SN/A.if !target(install) 781674SN/A.if !target(beforeinstall) 791674SN/Abeforeinstall: 801674SN/A.endif 811674SN/A.if !target(afterinstall) 821674SN/Aafterinstall: 831674SN/A.endif 841674SN/Ainstall: beforeinstall realinstall afterinstall 851674SN/A.ORDER: beforeinstall realinstall afterinstall 861674SN/A.endif 871674SN/A