diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index 8ca237f6b40a..4a95b5dce031 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -1,5 +1,5 @@ # from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91 -# $Id: bsd.subdir.mk,v 1.21 1998/03/23 14:58:29 eivind Exp $ +# $Id: bsd.subdir.mk,v 1.22 1998/03/26 16:02:44 eivind Exp $ # # The include file contains the default targets # for building subdirectories. It has the same seven targets @@ -20,6 +20,13 @@ # Each of the targets will execute the same target in the # subdirectories. # +# SUBDIR_CHANGE A directory-tree that contains overrides for +# corresponding build subdirs. +# Each override is a file containing one subdirname per line: +# 'subdirlist' is a pure override +# 'subdirdrop' drops directories from the build +# 'subdiradd' adds directories to the build +# # +++ targets +++ # # distribute: @@ -34,18 +41,37 @@ .MAIN: all +.if defined(SUBDIR_CHANGE) && !empty(SUBDIR_CHANGE) && \ + exists(${SUBDIR_CHANGE}/${DIRPRFX}/subdirlist) +SUBDIR!=cat ${SUBDIR_CHANGE}/${DIRPRFX}/subdirlist +.endif + +.if defined(SUBDIR_CHANGE) && !empty(SUBDIR_CHANGE) && \ + exists(${SUBDIR_CHANGE}/${DIRPRFX}/subdirlist) +_SUBDIR_EXTRA!=cat ${SUBDIR_CHANGE}/${DIRPRFX}/subdiradd +.endif + _SUBDIRUSE: .USE - @for entry in ${SUBDIR}; do \ - (if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ - ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE}"; \ - edir=$${entry}.${MACHINE}; \ - cd ${.CURDIR}/$${edir}; \ - else \ - ${ECHODIR} "===> ${DIRPRFX}$$entry"; \ - edir=$${entry}; \ - cd ${.CURDIR}/$${edir}; \ - fi; \ - ${MAKE} ${.TARGET:realinstall=install} DIRPRFX=${DIRPRFX}$$edir/); \ + @for entry in ${SUBDIR} ${_SUBDIR_EXTRA}; do \ + (if ! (test -f ${SUBDIR_CHANGE}/${DIRPRFX}/subdirdrop && \ + grep -w $${entry} \ + ${SUBDIR_CHANGE}/${DIRPRFX}/subdirdrop \ + > /dev/null); then \ + if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ + ${ECHODIR} \ + "===> ${DIRPRFX}$${entry}.${MACHINE}"; \ + edir=$${entry}.${MACHINE}; \ + cd ${.CURDIR}/$${edir}; \ + else \ + ${ECHODIR} "===> ${DIRPRFX}$$entry"; \ + edir=$${entry}; \ + cd ${.CURDIR}/$${edir}; \ + fi; \ + ${MAKE} ${.TARGET:realinstall=install} \ + SUBDIR_CHANGE=${SUBDIR_CHANGE} \ + DIRPRFX=${DIRPRFX}$$edir/; \ + fi; \ + ); \ done ${SUBDIR}::