bsd.subdir.mk revision 1.19 1 # $NetBSD: bsd.subdir.mk,v 1.19 1997/05/07 15:53:35 mycroft 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}"; \
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 .for targ in ${TARGETS}
36 .PHONY: ${targ}-${dir}
37 ${targ}-${dir}: .MAKE __SUBDIRINTERNALUSE
38 .endfor
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(all)
46 all: _SUBDIRUSE
47 .endif
48
49 .if !target(clean)
50 clean: _SUBDIRUSE
51 .endif
52
53 .if !target(cleandir)
54 cleandir: _SUBDIRUSE
55 .endif
56
57 .if !target(depend)
58 depend: _SUBDIRUSE
59 .endif
60
61 .if !target(includes)
62 includes: _SUBDIRUSE
63 .endif
64
65 .if !target(lint)
66 lint: _SUBDIRUSE
67 .endif
68
69 .if !target(obj)
70 obj: _SUBDIRUSE
71 .endif
72
73 .if !target(tags)
74 tags: _SUBDIRUSE
75 .endif
76
77 .include <bsd.own.mk>
78