| 1 | # A Makefile for handling subdirectories. |
| 2 | # Machine dependent subdirectories take precedence. |
| 3 | # |
| 4 | # @(#)bsd.subdir.mk 5.1 (Berkeley) %G% |
| 5 | # |
| 6 | |
| 7 | # user defines: |
| 8 | # SUBDIR -- the list of subdirectories to be processed |
| 9 | |
| 10 | # the default target. |
| 11 | .MAIN: all |
| 12 | |
| 13 | # The standard targets change to the subdirectory and make the |
| 14 | # target. |
| 15 | STDALL STDDEPEND STDCLEAN STDCLEANDIR STDLINT STDINSTALL STDTAGS: .USE |
| 16 | @for entry in ${SUBDIR}; do \ |
| 17 | (echo "===> $$entry"; \ |
| 18 | if test -d $${entry}.${MACHINE}; then \ |
| 19 | cd $${entry}.${MACHINE}; \ |
| 20 | else \ |
| 21 | cd $${entry}; \ |
| 22 | fi; \ |
| 23 | ${MAKE} ${.TARGET}) \ |
| 24 | done |
| 25 | |
| 26 | # If the user has not specified the target, use the standard version. |
| 27 | all: STDALL |
| 28 | depend: STDDEPEND |
| 29 | clean: STDCLEAN |
| 30 | cleandir: STDCLEANDIR |
| 31 | lint: STDLINT |
| 32 | install: STDINSTALL |
| 33 | tags: STDTAGS |
| 34 | |
| 35 | # If trying to make one of the subdirectories, change to it and make |
| 36 | # the default target. |
| 37 | ${SUBDIR}: |
| 38 | @if test -d ${.TARGET}.${MACHINE}; then \ |
| 39 | cd ${.TARGET}.${MACHINE}; \ |
| 40 | else \ |
| 41 | cd ${.TARGET}; \ |
| 42 | fi; \ |
| 43 | ${MAKE} |