Makefile revision 1.46
1#	$NetBSD: Makefile,v 1.46 2002/04/03 06:03:35 lukem Exp $
2
3.include <bsd.own.mk>
4
5# XXX We can't currently build the toolchain for x86-64.
6.if ${MACHINE_ARCH} != "x86_64"
7TOOLCHAIN_BITS= toolchain .WAIT dbsym mdsetimage
8.endif
9
10# Dependencies in SUBDIR below ordered to maximize parallel ability.
11.if !defined(NOSUBDIR)
12SUBDIR=	host-mkdep .WAIT compat .WAIT \
13	binstall .WAIT \
14		cap_mkdb crunchgen ctags gencat lint lint2 lorder \
15		m4 makewhatis mkdep mtree rpcgen tsort uudecode \
16	texinfo .WAIT \
17	yacc .WAIT \
18	lex .WAIT \
19	${TOOLCHAIN_BITS} \
20		asn1_compile cksum compile_et config installboot lint1 \
21		makefs menuc mklocale msgc pax pwd_mkdb zic
22
23.if ${MKMAN} != "no"
24SUBDIR+=	groff
25.endif
26
27.if ${MKMAINTAINERTOOLS:Uno} != "no"
28SUBDIR+=	autoconf gettext
29.endif
30
31.if ${MACHINE} == sparc || ${MACHINE} == sparc64
32SUBDIR+=	sparc-installboot
33.endif
34
35.if ${MACHINE_ARCH} == vax
36SUBDIR+=	vax-installboot
37.endif
38
39.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
40SUBDIR+=	mips-elf2ecoff
41.endif
42
43.endif
44
45.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"
46realall install: _warn
47.if ${MKTOOLS:Uyes} == "no"
48_warn:
49	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
50	@echo '*** updating your host toolchain.  This should be used only as a'
51	@echo '*** temporary workaround for toolchain problems, as it will result'
52	@echo '*** in version skew and build errors over time!'
53.else
54_warn:
55.endif
56
57.for dir in ${SUBDIR:N.WAIT}
58all-${dir} depend-${dir} dependall-${dir} install-${dir}:
59	@true
60.endfor
61.endif
62
63.include <bsd.subdir.mk>
64.include <bsd.obj.mk>
65
66# For each .WAIT point, make sure the immediately preceding target is
67# installed before building anything after that point.
68#
69# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
70# to achieve this. These targets look like:
71#	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
72#	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
73# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
74# places corresponding to the .WAITs in our $SUBDIR variable.
75#
76# Also, since we're now mixing `install' with `all' and `depend' targets
77# an order relationship between those in each individual subdirectory
78# must be established.
79#
80_deps:=
81_prev:=
82
83.for d in ${SUBDIR}
84_this:=		${d}
85
86.if ${_this} == ".WAIT"
87
88# setup dependency to apply to all/depend targets in the next group
89_deps:=		${_deps} ${_prev:S/^/install-/}
90
91# if we're building *only* individual targets (i.e. "dependall-yacc"),
92# make sure prerequisite tools build before installing
93.if !make(all) && !make(dependall)
94install-${_prev}: dependall-${_prev}
95.endif
96
97.else
98
99# order depend/all/install targets for ${d} subdir.  Note the additional
100# .WAIT to achieve "closure" of the predecessor/successor relationships.
101.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
102
103# make all/depend-${d} dependent on list of install targets
104depend-${d} all-${d} dependall-${d}: ${_deps}
105
106.endif
107
108# stash current name in case the next entry is .WAIT
109_prev:=		${d}
110.endfor
111
112cleantools:
113	rm -r -f tools.${HOST_OSTYPE}
114