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