bsd.subdir.mk revision 1.10 1 # $NetBSD: bsd.subdir.mk,v 1.10 1995/07/24 04:22:29 cgd Exp $
2 # @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
3
4 .if !target(.MAIN)
5 .MAIN: all
6 .endif
7
8 _SUBDIRUSE: .USE
9 .if defined(SUBDIR)
10 @for entry in ${SUBDIR}; do \
11 (set -e; if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
12 _newdir_="$${entry}.${MACHINE}"; \
13 else \
14 _newdir_="$${entry}"; \
15 fi; \
16 if test X"${_THISDIR_}" = X""; then \
17 _nextdir_="$${_newdir_}"; \
18 else \
19 _nextdir_="$${_THISDIR_}/$${_newdir_}"; \
20 fi; \
21 echo "===> $${_nextdir_}"; \
22 cd ${.CURDIR}/$${_newdir_}; \
23 ${MAKE} _THISDIR_="$${_nextdir_}" \
24 ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \
25 done
26
27 ${SUBDIR}::
28 @set -e; if test -d ${.CURDIR}/${.TARGET}.${MACHINE}; then \
29 _newdir_=${.TARGET}.${MACHINE}; \
30 else \
31 _newdir_=${.TARGET}; \
32 fi; \
33 echo "===> $${_newdir_}"; \
34 cd ${.CURDIR}/$${_newdir_}; \
35 ${MAKE} _THISDIR_="$${_newdir_}" all
36 .endif
37
38 .if !target(install)
39 .if !target(beforeinstall)
40 beforeinstall:
41 .endif
42 .if !target(afterinstall)
43 afterinstall:
44 .endif
45 install: maninstall
46 maninstall: afterinstall
47 afterinstall: realinstall
48 realinstall: beforeinstall _SUBDIRUSE
49 .endif
50
51 .if !target(all)
52 all: _SUBDIRUSE
53 .endif
54
55 .if !target(clean)
56 clean: _SUBDIRUSE
57 .endif
58
59 .if !target(cleandir)
60 cleandir: _SUBDIRUSE
61 .endif
62
63 .if !target(depend)
64 depend: _SUBDIRUSE
65 .endif
66
67 .if !target(lint)
68 lint: _SUBDIRUSE
69 .endif
70
71 .if !target(obj)
72 obj: _SUBDIRUSE
73 .endif
74
75 .if !target(tags)
76 tags: _SUBDIRUSE
77 .endif
78
79 .include <bsd.own.mk>
80