Annotation of src/share/mk/bsd.subdir.mk, Revision 1.16
1.16 ! matthieu 1: # $OpenBSD: bsd.subdir.mk,v 1.15 2007/11/03 15:14:32 espie Exp $
1.7 deraadt 2: # $NetBSD: bsd.subdir.mk,v 1.11 1996/04/04 02:05:06 jtc Exp $
1.1 deraadt 3: # @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
4:
5: .if !target(.MAIN)
6: .MAIN: all
7: .endif
8:
1.10 niklas 9: # Make sure this is defined
10: SKIPDIR?=
11:
1.1 deraadt 12: _SUBDIRUSE: .USE
13: .if defined(SUBDIR)
14: @for entry in ${SUBDIR}; do \
15: (set -e; if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
16: _newdir_="$${entry}.${MACHINE}"; \
17: else \
18: _newdir_="$${entry}"; \
19: fi; \
20: if test X"${_THISDIR_}" = X""; then \
21: _nextdir_="$${_newdir_}"; \
22: else \
23: _nextdir_="$${_THISDIR_}/$${_newdir_}"; \
24: fi; \
1.3 deraadt 25: _makefile_spec_=""; \
1.6 etheisen 26: if [ -e ${.CURDIR}/$${_newdir_}/Makefile.bsd-wrapper ]; then \
1.3 deraadt 27: _makefile_spec_="-f Makefile.bsd-wrapper"; \
28: fi; \
1.10 niklas 29: subskipdir=''; \
30: for skipdir in ${SKIPDIR}; do \
31: subentry=$${skipdir#$${entry}}; \
32: if [ X$${subentry} != X$${skipdir} ]; then \
33: if [ X$${subentry} = X ]; then \
34: echo "($${_nextdir_} skipped)"; \
35: break; \
36: fi; \
37: subskipdir="$${subskipdir} $${subentry#/}"; \
38: fi; \
39: done; \
40: if [ X$${skipdir} = X -o X$${subentry} != X ]; then \
41: echo "===> $${_nextdir_}"; \
42: cd ${.CURDIR}/$${_newdir_}; \
1.16 ! matthieu 43: exec ${MAKE} SKIPDIR="$${subskipdir}" \
1.10 niklas 44: $${_makefile_spec_} _THISDIR_="$${_nextdir_}" \
1.14 espie 45: ${MAKE_FLAGS} \
1.15 espie 46: ${.TARGET:S/realinstall/install/:S/subdirdepend/depend/}; \
1.10 niklas 47: fi); \
1.1 deraadt 48: done
49:
50: ${SUBDIR}::
51: @set -e; if test -d ${.CURDIR}/${.TARGET}.${MACHINE}; then \
52: _newdir_=${.TARGET}.${MACHINE}; \
53: else \
54: _newdir_=${.TARGET}; \
55: fi; \
1.3 deraadt 56: _makefile_spec_=""; \
1.6 etheisen 57: if [ -f ${.CURDIR}/$${_newdir_}/Makefile.bsd-wrapper ]; then \
1.3 deraadt 58: _makefile_spec_="-f Makefile.bsd-wrapper"; \
59: fi; \
1.1 deraadt 60: echo "===> $${_newdir_}"; \
61: cd ${.CURDIR}/$${_newdir_}; \
1.16 ! matthieu 62: exec ${MAKE} ${MAKE_FLAGS} $${_makefile_spec_} _THISDIR_="$${_newdir_}" all
1.1 deraadt 63: .endif
64:
65: .if !target(install)
1.13 espie 66: . if !target(beforeinstall)
1.1 deraadt 67: beforeinstall:
1.13 espie 68: . endif
69: . if !target(afterinstall)
1.1 deraadt 70: afterinstall:
1.13 espie 71: . endif
1.1 deraadt 72: install: maninstall
73: maninstall: afterinstall
74: afterinstall: realinstall
75: realinstall: beforeinstall _SUBDIRUSE
76: .endif
77:
78:
1.13 espie 79: .for t in all clean cleandir includes depend lint obj tags regress
80: . if !target($t)
81: $t: _SUBDIRUSE
82: . endif
83: .endfor
1.1 deraadt 84:
1.12 marc 85: .if !defined(BSD_OWN_MK)
1.13 espie 86: . include <bsd.own.mk>
1.12 marc 87: .endif