Makefile revision 1.49
1#	$NetBSD: Makefile,v 1.49 2002/05/07 12:12:53 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} == prep
32SUBDIR+=	prep-mkbootimage
33.endif
34
35.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
36SUBDIR+=	mips-elf2ecoff
37.endif
38
39.endif
40
41.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"
42realall install: _warn
43.if ${MKTOOLS:Uyes} == "no"
44_warn:
45	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
46	@echo '*** updating your host toolchain.  This should be used only as a'
47	@echo '*** temporary workaround for toolchain problems, as it will result'
48	@echo '*** in version skew and build errors over time!'
49.else
50_warn:
51.endif
52
53.for dir in ${SUBDIR:N.WAIT}
54all-${dir} depend-${dir} dependall-${dir} install-${dir}:
55	@true
56.endfor
57.endif
58
59.include <bsd.subdir.mk>
60.include <bsd.obj.mk>
61
62# For each .WAIT point, make sure the immediately preceding target is
63# installed before building anything after that point.
64#
65# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
66# to achieve this. These targets look like:
67#	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
68#	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
69# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
70# places corresponding to the .WAITs in our $SUBDIR variable.
71#
72# Also, since we're now mixing `install' with `all' and `depend' targets
73# an order relationship between those in each individual subdirectory
74# must be established.
75#
76_deps:=
77_prev:=
78
79.for d in ${SUBDIR}
80_this:=		${d}
81
82.if ${_this} == ".WAIT"
83
84# setup dependency to apply to all/depend targets in the next group
85_deps:=		${_deps} ${_prev:S/^/install-/}
86
87# if we're building *only* individual targets (i.e. "dependall-yacc"),
88# make sure prerequisite tools build before installing
89.if !make(all) && !make(dependall)
90install-${_prev}: dependall-${_prev}
91.endif
92
93.else
94
95# order depend/all/install targets for ${d} subdir.  Note the additional
96# .WAIT to achieve "closure" of the predecessor/successor relationships.
97.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
98
99# make all/depend-${d} dependent on list of install targets
100depend-${d} all-${d} dependall-${d}: ${_deps}
101
102.endif
103
104# stash current name in case the next entry is .WAIT
105_prev:=		${d}
106.endfor
107
108cleantools:
109	rm -r -f tools.${HOST_OSTYPE}
110