Makefile revision 1.46
11.46Slukem#	$NetBSD: Makefile,v 1.46 2002/04/03 06:03:35 lukem Exp $
21.1Stv
31.3Stv.include <bsd.own.mk>
41.3Stv
51.24Sthorpej# XXX We can't currently build the toolchain for x86-64.
61.24Sthorpej.if ${MACHINE_ARCH} != "x86_64"
71.45SthorpejTOOLCHAIN_BITS= toolchain .WAIT dbsym mdsetimage
81.31Stv.endif
91.31Stv
101.16Stv# Dependencies in SUBDIR below ordered to maximize parallel ability.
111.14Stv.if !defined(NOSUBDIR)
121.29StvSUBDIR=	host-mkdep .WAIT compat .WAIT \
131.16Stv	binstall .WAIT \
141.32Stv		cap_mkdb crunchgen ctags gencat lint lint2 lorder \
151.32Stv		m4 makewhatis mkdep mtree rpcgen tsort uudecode \
161.32Stv	texinfo .WAIT \
171.16Stv	yacc .WAIT \
181.16Stv	lex .WAIT \
191.32Stv	${TOOLCHAIN_BITS} \
201.46Slukem		asn1_compile cksum compile_et config installboot lint1 \
211.44Sbjh21		makefs menuc mklocale msgc pax pwd_mkdb zic
221.39Stv
231.39Stv.if ${MKMAN} != "no"
241.39StvSUBDIR+=	groff
251.39Stv.endif
261.22Stv
271.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no"
281.38StvSUBDIR+=	autoconf gettext
291.25Smrg.endif
301.25Smrg
311.25Smrg.if ${MACHINE} == sparc || ${MACHINE} == sparc64
321.25SmrgSUBDIR+=	sparc-installboot
331.41Smatt.endif
341.41Smatt
351.41Smatt.if ${MACHINE_ARCH} == vax
361.41SmattSUBDIR+=	vax-installboot
371.22Stv.endif
381.37Sgmcgarry
391.37Sgmcgarry.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
401.37SgmcgarrySUBDIR+=	mips-elf2ecoff
411.37Sgmcgarry.endif
421.37Sgmcgarry
431.17Stv.endif
441.17Stv
451.18Sjmc.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"
461.17Stvrealall install: _warn
471.19Sjmc.if ${MKTOOLS:Uyes} == "no"
481.17Stv_warn:
491.17Stv	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
501.17Stv	@echo '*** updating your host toolchain.  This should be used only as a'
511.17Stv	@echo '*** temporary workaround for toolchain problems, as it will result'
521.23Swiz	@echo '*** in version skew and build errors over time!'
531.18Sjmc.else
541.18Sjmc_warn:
551.18Sjmc.endif
561.17Stv
571.17Stv.for dir in ${SUBDIR:N.WAIT}
581.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}:
591.17Stv	@true
601.17Stv.endfor
611.14Stv.endif
621.1Stv
631.1Stv.include <bsd.subdir.mk>
641.11Stv.include <bsd.obj.mk>
651.16Stv
661.40Stv# For each .WAIT point, make sure the immediately preceding target is
671.40Stv# installed before building anything after that point.
681.36Spk#
691.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
701.36Spk# to achieve this. These targets look like:
711.36Spk#	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
721.36Spk#	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
731.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
741.36Spk# places corresponding to the .WAITs in our $SUBDIR variable.
751.36Spk#
761.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets
771.36Spk# an order relationship between those in each individual subdirectory
781.36Spk# must be established.
791.36Spk#
801.40Stv_deps:=
811.40Stv_prev:=
821.40Stv
831.16Stv.for d in ${SUBDIR}
841.16Stv_this:=		${d}
851.40Stv
861.16Stv.if ${_this} == ".WAIT"
871.36Spk
881.36Spk# setup dependency to apply to all/depend targets in the next group
891.40Stv_deps:=		${_deps} ${_prev:S/^/install-/}
901.40Stv
911.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"),
921.40Stv# make sure prerequisite tools build before installing
931.40Stv.if !make(all) && !make(dependall)
941.40Stvinstall-${_prev}: dependall-${_prev}
951.40Stv.endif
961.36Spk
971.16Stv.else
981.36Spk
991.36Spk# order depend/all/install targets for ${d} subdir.  Note the additional
1001.36Spk# .WAIT to achieve "closure" of the predecessor/successor relationships.
1011.36Spk.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
1021.40Stv
1031.40Stv# make all/depend-${d} dependent on list of install targets
1041.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps}
1051.36Spk
1061.16Stv.endif
1071.40Stv
1081.40Stv# stash current name in case the next entry is .WAIT
1091.40Stv_prev:=		${d}
1101.16Stv.endfor
1111.12Stv
1121.12Stvcleantools:
1131.12Stv	rm -r -f tools.${HOST_OSTYPE}
114