bsd.subdir.mk revision 1.10
1#	$OpenBSD: bsd.subdir.mk,v 1.10 1998/03/01 09:18:06 niklas 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# Make sure this is defined
10SKIPDIR?=
11
12_SUBDIRUSE: .USE
13.if defined(SUBDIR)
14	@for entry in ${SUBDIR}; do \
15		(set -e; if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
16			_newdir_="$${entry}.${MACHINE}"; \
17		else \
18			_newdir_="$${entry}"; \
19		fi; \
20		if test X"${_THISDIR_}" = X""; then \
21			_nextdir_="$${_newdir_}"; \
22		else \
23			_nextdir_="$${_THISDIR_}/$${_newdir_}"; \
24		fi; \
25		_makefile_spec_=""; \
26		if [ -e ${.CURDIR}/$${_newdir_}/Makefile.bsd-wrapper ]; then \
27			_makefile_spec_="-f Makefile.bsd-wrapper"; \
28		fi; \
29		subskipdir=''; \
30		for skipdir in ${SKIPDIR}; do \
31			subentry=$${skipdir#$${entry}}; \
32			if [ X$${subentry} != X$${skipdir} ]; then \
33				if [ X$${subentry} = X ]; then \
34					echo "($${_nextdir_} skipped)"; \
35					break; \
36				fi; \
37				subskipdir="$${subskipdir} $${subentry#/}"; \
38			fi; \
39		done; \
40		if [ X$${skipdir} = X -o X$${subentry} != X ]; then \
41			echo "===> $${_nextdir_}"; \
42			cd ${.CURDIR}/$${_newdir_}; \
43			${MAKE} ${.MAKEFLAGS} SKIPDIR="$${subskipdir}" \
44			    $${_makefile_spec_} _THISDIR_="$${_nextdir_}" \
45			    ${.TARGET:S/realinstall/install/:S/.depend/depend/}; \
46		fi); \
47	done
48
49${SUBDIR}::
50	@set -e; if test -d ${.CURDIR}/${.TARGET}.${MACHINE}; then \
51		_newdir_=${.TARGET}.${MACHINE}; \
52	else \
53		_newdir_=${.TARGET}; \
54	fi; \
55	_makefile_spec_=""; \
56	if [ -f ${.CURDIR}/$${_newdir_}/Makefile.bsd-wrapper ]; then \
57		_makefile_spec_="-f Makefile.bsd-wrapper"; \
58	fi; \
59	echo "===> $${_newdir_}"; \
60	cd ${.CURDIR}/$${_newdir_}; \
61	${MAKE} ${.MAKEFLAGS} $${_makefile_spec_} _THISDIR_="$${_newdir_}" all
62.endif
63
64.if !target(install)
65.if !target(beforeinstall)
66beforeinstall:
67.endif
68.if !target(afterinstall)
69afterinstall:
70.endif
71install: maninstall
72maninstall: afterinstall
73afterinstall: realinstall
74realinstall: beforeinstall _SUBDIRUSE
75.endif
76
77.if !target(all)
78all: _SUBDIRUSE
79.endif
80
81.if !target(clean)
82clean: _SUBDIRUSE
83.endif
84
85.if !target(cleandir)
86cleandir: _SUBDIRUSE
87.endif
88
89.if !target(includes)
90includes: _SUBDIRUSE
91.endif
92
93.if !target(depend)
94depend: _SUBDIRUSE
95.endif
96
97.if !target(lint)
98lint: _SUBDIRUSE
99.endif
100
101.if !target(obj)
102obj: _SUBDIRUSE
103.endif
104
105.if !target(tags)
106tags: _SUBDIRUSE
107.endif
108
109.include <bsd.own.mk>
110