bsd.subdir.mk revision 21673
1#	from: @(#)bsd.subdir.mk	5.9 (Berkeley) 2/1/91
2#	$FreeBSD: head/share/mk/bsd.subdir.mk 21673 1997-01-14 07:20:47Z jkh $
3
4.MAIN: all
5
6_SUBDIRUSE: .USE
7	@for entry in ${SUBDIR}; do \
8		(if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
9			${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE}"; \
10			edir=$${entry}.${MACHINE}; \
11			cd ${.CURDIR}/$${edir}; \
12		else \
13			${ECHODIR} "===> ${DIRPRFX}$$entry"; \
14			edir=$${entry}; \
15			cd ${.CURDIR}/$${edir}; \
16		fi; \
17		${MAKE} ${.TARGET:realinstall=install} DIRPRFX=${DIRPRFX}$$edir/); \
18	done
19
20${SUBDIR}::
21	@if test -d ${.TARGET}.${MACHINE}; then \
22		cd ${.CURDIR}/${.TARGET}.${MACHINE}; \
23	else \
24		cd ${.CURDIR}/${.TARGET}; \
25	fi; \
26	${MAKE} all
27
28
29.for __target in all checkdpadd clean cleandepend cleandir depend lint \
30		 maninstall obj objlink tags
31.if !target(__target)
32${__target}: _SUBDIRUSE
33.endif
34.endfor
35
36.if !target(install)
37.if !target(beforeinstall)
38beforeinstall:
39.endif
40.if !target(afterinstall)
41afterinstall:
42.endif
43install: afterinstall
44afterinstall: realinstall
45realinstall: beforeinstall _SUBDIRUSE
46.endif
47
48DISTRIBUTION?=	bin
49.if !target(afterdistribute)
50afterdistribute:
51.endif
52.if !target(distribute)
53distribute: _SUBDIRUSE 
54	cd ${.CURDIR} ; ${MAKE} afterdistribute DESTDIR=${DISTDIR}/${DISTRIBUTION}
55.endif
56