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