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