1# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91 2# $Id: bsd.subdir.mk,v 1.17 1997/04/13 06:44:24 jkh Exp $ 3# 4# The include file <bsd.subdir.mk> contains the default targets 5# for building subdirectories. It has the same seven targets 6# as <bsd.prog.mk>: 7# all, clean, cleandir, depend, install, lint, and tags. 8# 9# For all of the directories listed in the variable SUBDIRS, the 10# specified directory will be visited and the target made. There is 11# also a default target which allows the command "make subdir" where 12# subdir is any directory listed in the variable SUBDIRS. 13# 14# 15# +++ variables +++ 16# 17# DISTRIBUTION Name of distribution. [bin] 18# 19# SUBDIR A list of subdirectories that should be built as well. 20# Each of the targets will execute the same target in the 21# subdirectories. 22# 23# +++ targets +++ 24# 25# distribute: 26# This is a variant of install, which will 27# put the stuff into the right "distribution". 28# 29# afterdistribute, afterinstall, all, beforeinstall, checkdpadd, 30# clean, cleandepend, cleandir, depend, install, lint, maninstall, 31# obj, objlink, realinstall, tags 32# 33 34 35.MAIN: all 36 37_SUBDIRUSE: .USE 38 @for entry in ${SUBDIR}; do \ 39 (if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ 40 ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE}"; \ 41 edir=$${entry}.${MACHINE}; \ 42 cd ${.CURDIR}/$${edir}; \ 43 else \ 44 ${ECHODIR} "===> ${DIRPRFX}$$entry"; \ 45 edir=$${entry}; \ 46 cd ${.CURDIR}/$${edir}; \ 47 fi; \ 48 ${MAKE} ${.TARGET:realinstall=install} DIRPRFX=${DIRPRFX}$$edir/); \ 49 done 50 51${SUBDIR}:: 52 @if test -d ${.TARGET}.${MACHINE}; then \ 53 cd ${.CURDIR}/${.TARGET}.${MACHINE}; \ 54 else \ 55 cd ${.CURDIR}/${.TARGET}; \ 56 fi; \ 57 ${MAKE} all 58 59 60.for __target in all checkdpadd clean cleandir depend lint \ 61 maninstall obj objlink 62.if !target(__target) 63${__target}: _SUBDIRUSE 64.endif 65.endfor 66 67.if !target(tags) 68.if defined(TAGS) 69tags: 70 @cd ${.CURDIR} && gtags ${GTAGSFLAGS} 71.if defined(HTML) 72 @cd ${.CURDIR} && htags ${HTAGSFLAGS} 73.endif 74.else 75tags: _SUBDIRUSE 76.endif 77.endif 78 79.if !defined(cleandepend) 80cleandepend: _SUBDIRUSE 81.if defined(TAGS) 82 @rm -f ${.CURDIR}/GTAGS ${.CURDIR}/GRTAGS 83.if defined(HTML) 84 @rm -rf ${.CURDIR}/HTML 85.endif 86.endif 87.endif 88 89.if !target(install) 90.if !target(beforeinstall) 91beforeinstall: 92.endif 93.if !target(afterinstall) 94afterinstall: 95.endif 96install: afterinstall 97afterinstall: realinstall 98realinstall: beforeinstall _SUBDIRUSE 99.endif 100 101DISTRIBUTION?= bin 102.if !target(afterdistribute) 103afterdistribute: 104.endif 105.if !target(distribute) 106distribute: _SUBDIRUSE 107.for dist in ${DISTRIBUTION} 108 cd ${.CURDIR} ; ${MAKE} afterdistribute DESTDIR=${DISTDIR}/${dist} 109.endfor 110.endif 111