bsd.subdir.mk revision 1.12 1 # $NetBSD: bsd.subdir.mk,v 1.12 1997/03/21 00:53:02 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 ${SUBDIR:S/^/${.TARGET}-/}
9
10 __SUBDIRINTERNALUSE: .USE
11 @(_maketarget_="${.TARGET:S/realinstall/install/}"; \
12 entry="$${_maketarget_#*-}";\
13 target="$${_maketarget_%%-*}";\
14 set -e; if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
15 _newdir_="$${entry}.${MACHINE}"; \
16 else \
17 _newdir_="$${entry}"; \
18 fi; \
19 if test X"${_THISDIR_}" = X""; then \
20 _nextdir_="$${_newdir_}"; \
21 else \
22 _nextdir_="$${_THISDIR_}/$${_newdir_}"; \
23 fi; \
24 echo "===> $${_nextdir_}"; \
25 cd ${.CURDIR}/$${_newdir_}; \
26 ${MAKE} _THISDIR_="$${_nextdir_}" $${target});
27
28 .for dir in ${SUBDIR}
29 all-${dir}: __SUBDIRINTERNALUSE
30 install-${dir}: __SUBDIRINTERNALUSE
31 realinstall-${dir}: __SUBDIRINTERNALUSE
32 clean-${dir}: __SUBDIRINTERNALUSE
33 cleandir-${dir}: __SUBDIRINTERNALUSE
34 includes-${dir}: __SUBDIRINTERNALUSE
35 depend-${dir}: __SUBDIRINTERNALUSE
36 lint-${dir}: __SUBDIRINTERNALUSE
37 obj-${dir}: __SUBDIRINTERNALUSE
38 tags-${dir}: __SUBDIRINTERNALUSE
39
40 # Backward-compatibility with the old rules. If this went away,
41 # 'xlint' could become 'lint', 'xinstall' could become 'install', etc.
42 ${dir}: all-${dir}
43 .endfor
44
45 .if !target(install)
46 .if !target(beforeinstall)
47 beforeinstall:
48 .endif
49 .if !target(afterinstall)
50 afterinstall:
51 .endif
52 install: maninstall
53 maninstall: afterinstall
54 afterinstall: realinstall
55 realinstall: beforeinstall _SUBDIRUSE
56 .endif
57
58 .if !target(all)
59 all: _SUBDIRUSE
60 .endif
61
62 .if !target(clean)
63 clean: _SUBDIRUSE
64 .endif
65
66 .if !target(cleandir)
67 cleandir: _SUBDIRUSE
68 .endif
69
70 .if !target(includes)
71 includes: _SUBDIRUSE
72 .endif
73
74 .if !target(depend)
75 depend: _SUBDIRUSE
76 .endif
77
78 .if !target(lint)
79 lint: _SUBDIRUSE
80 .endif
81
82 .if !target(obj)
83 obj: _SUBDIRUSE
84 .endif
85
86 .if !target(tags)
87 tags: _SUBDIRUSE
88 .endif
89
90 .include <bsd.own.mk>
91