Makefile revision 1.65
11.1Sdholland#	$NetBSD: Makefile,v 1.65 2003/06/26 06:30:19 tshiozak Exp $
21.1Sdholland
31.1Sdholland.include <bsd.own.mk>
41.1Sdholland
51.1Sdholland.if ${TOOLCHAIN_MISSING} != "yes"
61.1SdhollandTOOLCHAIN_BITS= toolchain .WAIT dbsym mdsetimage
71.1Sdholland# XXX Eventually, we want to be able to build dbsym and mdsetimage
81.1Sdholland# XXX if EXTERNAL_TOOLCHAIN is set.
91.1Sdholland.endif
101.1Sdholland
111.1Sdholland# Dependencies in SUBDIR below ordered to maximize parallel ability.
121.1Sdholland.if !defined(NOSUBDIR)					# {
131.1Sdholland
141.1SdhollandSUBDIR=	host-mkdep .WAIT compat .WAIT \
151.1Sdholland	binstall .WAIT mktemp .WAIT \
161.1Sdholland		cap_mkdb crunchgen ctags gencat hexdump lint lint2 lorder \
171.1Sdholland		m4 makewhatis mkdep mtree rpcgen tsort uudecode \
181.1Sdholland	texinfo .WAIT \
191.1Sdholland	yacc .WAIT \
201.1Sdholland	lex .WAIT \
211.1Sdholland	${TOOLCHAIN_BITS} \
221.1Sdholland		asn1_compile cat cksum compile_et config db file installboot \
231.1Sdholland		lint1 makefs menuc mklocale mkcsmapper mkesdb msgc pax \
241.1Sdholland		pwd_mkdb sunlabel zic
251.1Sdholland
261.1Sdholland.if ${MKMAN} != "no"
271.1SdhollandSUBDIR+=	groff
281.1Sdholland.endif
291.1Sdholland
301.1Sdholland.if ${MKMAINTAINERTOOLS:Uno} != "no"
311.1SdhollandSUBDIR+=	autoconf gettext
321.1Sdholland.endif
331.1Sdholland
341.1Sdholland.if ${MACHINE} == prep
351.1SdhollandSUBDIR+=	prep-mkbootimage
361.1Sdholland.endif
371.1Sdholland
381.1Sdholland.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
391.1SdhollandSUBDIR+=	mips-elf2ecoff
401.1Sdholland.endif
411.1Sdholland
421.1Sdholland.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64")
431.1SdhollandSUBDIR+=	fgen
441.1Sdholland.endif
451.1Sdholland
461.1Sdholland.endif	# ! NOSUBDIR					# }
471.1Sdholland
481.1Sdholland.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"
491.1Sdhollandrealall install: _warn
501.1Sdholland.if ${MKTOOLS:Uyes} == "no"
511.1Sdholland_warn:
521.1Sdholland	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
531.1Sdholland	@echo '*** updating your host toolchain.  This should be used only as a'
541.1Sdholland	@echo '*** temporary workaround for toolchain problems, as it will result'
551.1Sdholland	@echo '*** in version skew and build errors over time!'
561.1Sdholland.else
571.1Sdholland_warn:
581.1Sdholland.endif
59
60.for dir in ${SUBDIR:N.WAIT}
61all-${dir} depend-${dir} dependall-${dir} install-${dir}:
62	@true
63.endfor
64.endif
65
66.include <bsd.subdir.mk>
67.include <bsd.obj.mk>
68
69# For each .WAIT point, make sure the immediately preceding target is
70# installed before building anything after that point.
71#
72# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
73# to achieve this. These targets look like:
74#	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
75#	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
76# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
77# places corresponding to the .WAITs in our $SUBDIR variable.
78#
79# Also, since we're now mixing `install' with `all' and `depend' targets
80# an order relationship between those in each individual subdirectory
81# must be established.
82#
83_deps:=
84_prev:=
85
86.for d in ${SUBDIR}
87_this:=		${d}
88
89.if ${_this} == ".WAIT"
90
91# setup dependency to apply to all/depend targets in the next group
92_deps:=		${_deps} ${_prev:S/^/install-/}
93
94# if we're building *only* individual targets (i.e. "dependall-yacc"),
95# make sure prerequisite tools build before installing
96.if !make(all) && !make(dependall)
97install-${_prev}: dependall-${_prev}
98.endif
99
100.else
101
102# order depend/all/install targets for ${d} subdir.  Note the additional
103# .WAIT to achieve "closure" of the predecessor/successor relationships.
104.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
105
106# make all/depend-${d} dependent on list of install targets
107depend-${d} all-${d} dependall-${d}: ${_deps}
108
109.endif
110
111# stash current name in case the next entry is .WAIT
112_prev:=		${d}
113.endfor
114
115cleantools:
116	rm -r -f tools.${HOST_OSTYPE}
117