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