bsd.subdir.mk revision 53152
11844Swollman# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91 250476Speter# $FreeBSD: head/share/mk/bsd.subdir.mk 53152 1999-11-14 13:54:44Z marcel $ 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# 1523549Swosch# DISTRIBUTION Name of distribution. [bin] 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# 2134934Seivind# SUBDIR_CHANGE A directory-tree that contains overrides for 2234934Seivind# corresponding build subdirs. 2334934Seivind# Each override is a file containing one subdirname per line: 2434934Seivind# 'subdirlist' is a pure override 2534934Seivind# 'subdirdrop' drops directories from the build 2634934Seivind# 'subdiradd' adds directories to the build 2734934Seivind# 2823549Swosch# +++ targets +++ 2923549Swosch# 3023549Swosch# distribute: 3123549Swosch# This is a variant of install, which will 3223549Swosch# put the stuff into the right "distribution". 3323549Swosch# 3423549Swosch# afterdistribute, afterinstall, all, beforeinstall, checkdpadd, 3523549Swosch# clean, cleandepend, cleandir, depend, install, lint, maninstall, 3644922Sbde# obj, objlink, realinstall, regress, tags 3723549Swosch# 381638Srgrimes 3938183Speter.if !target(__initialized__) 4038183Speter__initialized__: 4138183Speter.if exists(${.CURDIR}/../Makefile.inc) 4238183Speter.include "${.CURDIR}/../Makefile.inc" 4338183Speter.endif 4438183Speter.endif 4523549Swosch 461638Srgrimes.MAIN: all 471638Srgrimes 4834934Seivind.if defined(SUBDIR_CHANGE) && !empty(SUBDIR_CHANGE) && \ 4934934Seivind exists(${SUBDIR_CHANGE}/${DIRPRFX}/subdirlist) 5034934SeivindSUBDIR!=cat ${SUBDIR_CHANGE}/${DIRPRFX}/subdirlist 5134934Seivind.endif 5234934Seivind 5334934Seivind.if defined(SUBDIR_CHANGE) && !empty(SUBDIR_CHANGE) && \ 5434934Seivind exists(${SUBDIR_CHANGE}/${DIRPRFX}/subdirlist) 5534934Seivind_SUBDIR_EXTRA!=cat ${SUBDIR_CHANGE}/${DIRPRFX}/subdiradd 5634934Seivind.endif 5734934Seivind 581638Srgrimes_SUBDIRUSE: .USE 5934934Seivind @for entry in ${SUBDIR} ${_SUBDIR_EXTRA}; do \ 6034934Seivind (if ! (test -f ${SUBDIR_CHANGE}/${DIRPRFX}/subdirdrop && \ 6134934Seivind grep -w $${entry} \ 6234934Seivind ${SUBDIR_CHANGE}/${DIRPRFX}/subdirdrop \ 6334934Seivind > /dev/null); then \ 6453152Smarcel if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \ 6534934Seivind ${ECHODIR} \ 6653152Smarcel "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH}"; \ 6753152Smarcel edir=$${entry}.${MACHINE_ARCH}; \ 6834934Seivind cd ${.CURDIR}/$${edir}; \ 6934934Seivind else \ 7034934Seivind ${ECHODIR} "===> ${DIRPRFX}$$entry"; \ 7134934Seivind edir=$${entry}; \ 7234934Seivind cd ${.CURDIR}/$${edir}; \ 7334934Seivind fi; \ 7434934Seivind ${MAKE} ${.TARGET:realinstall=install} \ 7534934Seivind SUBDIR_CHANGE=${SUBDIR_CHANGE} \ 7634934Seivind DIRPRFX=${DIRPRFX}$$edir/; \ 7734934Seivind fi; \ 7834934Seivind ); \ 791638Srgrimes done 801638Srgrimes 811638Srgrimes${SUBDIR}:: 8253152Smarcel @if test -d ${.TARGET}.${MACHINE_ARCH}; then \ 8353152Smarcel cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \ 841638Srgrimes else \ 851638Srgrimes cd ${.CURDIR}/${.TARGET}; \ 861638Srgrimes fi; \ 871638Srgrimes ${MAKE} all 881638Srgrimes 891638Srgrimes 9034892Seivind.for __target in all checkdpadd clean cleandepend cleandir depend lint \ 9144922Sbde maninstall obj objlink regress tags 9231177Swosch.if !target(${__target}) 9315061Swosch${__target}: _SUBDIRUSE 941638Srgrimes.endif 9515061Swosch.endfor 961638Srgrimes 971638Srgrimes.if !target(install) 981638Srgrimes.if !target(beforeinstall) 991638Srgrimesbeforeinstall: 1001638Srgrimes.endif 1011638Srgrimes.if !target(afterinstall) 1021638Srgrimesafterinstall: 1031638Srgrimes.endif 1041638Srgrimesinstall: afterinstall 1051638Srgrimesafterinstall: realinstall 1061638Srgrimesrealinstall: beforeinstall _SUBDIRUSE 1071638Srgrimes.endif 1081638Srgrimes 10915061SwoschDISTRIBUTION?= bin 11015061Swosch.if !target(afterdistribute) 11115061Swoschafterdistribute: 1121638Srgrimes.endif 11315061Swosch.if !target(distribute) 11423549Swoschdistribute: _SUBDIRUSE 11526760Sjkh.for dist in ${DISTRIBUTION} 11626760Sjkh cd ${.CURDIR} ; ${MAKE} afterdistribute DESTDIR=${DISTDIR}/${dist} 11726760Sjkh.endfor 1181638Srgrimes.endif 119