Makefile revision 1.51
11.51Sbjh21#	$NetBSD: Makefile,v 1.51 2002/05/28 21:56:05 bjh21 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.50Slukem.if !defined(NOSUBDIR)					# {
121.50Slukem
131.29StvSUBDIR=	host-mkdep .WAIT compat .WAIT \
141.16Stv	binstall .WAIT \
151.32Stv		cap_mkdb crunchgen ctags gencat lint lint2 lorder \
161.32Stv		m4 makewhatis mkdep mtree rpcgen tsort uudecode \
171.32Stv	texinfo .WAIT \
181.16Stv	yacc .WAIT \
191.16Stv	lex .WAIT \
201.32Stv	${TOOLCHAIN_BITS} \
211.46Slukem		asn1_compile cksum compile_et config installboot lint1 \
221.44Sbjh21		makefs menuc mklocale msgc pax pwd_mkdb zic
231.39Stv
241.39Stv.if ${MKMAN} != "no"
251.39StvSUBDIR+=	groff
261.39Stv.endif
271.22Stv
281.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no"
291.38StvSUBDIR+=	autoconf gettext
301.48Skleink.endif
311.48Skleink
321.48Skleink.if ${MACHINE} == prep
331.48SkleinkSUBDIR+=	prep-mkbootimage
341.22Stv.endif
351.37Sgmcgarry
361.37Sgmcgarry.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
371.37SgmcgarrySUBDIR+=	mips-elf2ecoff
381.51Sbjh21.endif
391.51Sbjh21
401.51Sbjh21.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64")
411.51Sbjh21SUBDIR+=	fgen
421.37Sgmcgarry.endif
431.37Sgmcgarry
441.50Slukem.endif	# ! NOSUBDIR					# }
451.17Stv
461.18Sjmc.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"
471.17Stvrealall install: _warn
481.19Sjmc.if ${MKTOOLS:Uyes} == "no"
491.17Stv_warn:
501.17Stv	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
511.17Stv	@echo '*** updating your host toolchain.  This should be used only as a'
521.17Stv	@echo '*** temporary workaround for toolchain problems, as it will result'
531.23Swiz	@echo '*** in version skew and build errors over time!'
541.18Sjmc.else
551.18Sjmc_warn:
561.18Sjmc.endif
571.17Stv
581.17Stv.for dir in ${SUBDIR:N.WAIT}
591.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}:
601.17Stv	@true
611.17Stv.endfor
621.14Stv.endif
631.1Stv
641.1Stv.include <bsd.subdir.mk>
651.11Stv.include <bsd.obj.mk>
661.16Stv
671.40Stv# For each .WAIT point, make sure the immediately preceding target is
681.40Stv# installed before building anything after that point.
691.36Spk#
701.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
711.36Spk# to achieve this. These targets look like:
721.36Spk#	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
731.36Spk#	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
741.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
751.36Spk# places corresponding to the .WAITs in our $SUBDIR variable.
761.36Spk#
771.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets
781.36Spk# an order relationship between those in each individual subdirectory
791.36Spk# must be established.
801.36Spk#
811.40Stv_deps:=
821.40Stv_prev:=
831.40Stv
841.16Stv.for d in ${SUBDIR}
851.16Stv_this:=		${d}
861.40Stv
871.16Stv.if ${_this} == ".WAIT"
881.36Spk
891.36Spk# setup dependency to apply to all/depend targets in the next group
901.40Stv_deps:=		${_deps} ${_prev:S/^/install-/}
911.40Stv
921.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"),
931.40Stv# make sure prerequisite tools build before installing
941.40Stv.if !make(all) && !make(dependall)
951.40Stvinstall-${_prev}: dependall-${_prev}
961.40Stv.endif
971.36Spk
981.16Stv.else
991.36Spk
1001.36Spk# order depend/all/install targets for ${d} subdir.  Note the additional
1011.36Spk# .WAIT to achieve "closure" of the predecessor/successor relationships.
1021.36Spk.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
1031.40Stv
1041.40Stv# make all/depend-${d} dependent on list of install targets
1051.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps}
1061.36Spk
1071.16Stv.endif
1081.40Stv
1091.40Stv# stash current name in case the next entry is .WAIT
1101.40Stv_prev:=		${d}
1111.16Stv.endfor
1121.12Stv
1131.12Stvcleantools:
1141.12Stv	rm -r -f tools.${HOST_OSTYPE}
115