Makefile revision 1.50
11.50Slukem#	$NetBSD: Makefile,v 1.50 2002/05/18 05:59:23 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.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.37Sgmcgarry.endif
391.37Sgmcgarry
401.50Slukem.endif	# ! NOSUBDIR					# }
411.17Stv
421.18Sjmc.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"
431.17Stvrealall install: _warn
441.19Sjmc.if ${MKTOOLS:Uyes} == "no"
451.17Stv_warn:
461.17Stv	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
471.17Stv	@echo '*** updating your host toolchain.  This should be used only as a'
481.17Stv	@echo '*** temporary workaround for toolchain problems, as it will result'
491.23Swiz	@echo '*** in version skew and build errors over time!'
501.18Sjmc.else
511.18Sjmc_warn:
521.18Sjmc.endif
531.17Stv
541.17Stv.for dir in ${SUBDIR:N.WAIT}
551.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}:
561.17Stv	@true
571.17Stv.endfor
581.14Stv.endif
591.1Stv
601.1Stv.include <bsd.subdir.mk>
611.11Stv.include <bsd.obj.mk>
621.16Stv
631.40Stv# For each .WAIT point, make sure the immediately preceding target is
641.40Stv# installed before building anything after that point.
651.36Spk#
661.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
671.36Spk# to achieve this. These targets look like:
681.36Spk#	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
691.36Spk#	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
701.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
711.36Spk# places corresponding to the .WAITs in our $SUBDIR variable.
721.36Spk#
731.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets
741.36Spk# an order relationship between those in each individual subdirectory
751.36Spk# must be established.
761.36Spk#
771.40Stv_deps:=
781.40Stv_prev:=
791.40Stv
801.16Stv.for d in ${SUBDIR}
811.16Stv_this:=		${d}
821.40Stv
831.16Stv.if ${_this} == ".WAIT"
841.36Spk
851.36Spk# setup dependency to apply to all/depend targets in the next group
861.40Stv_deps:=		${_deps} ${_prev:S/^/install-/}
871.40Stv
881.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"),
891.40Stv# make sure prerequisite tools build before installing
901.40Stv.if !make(all) && !make(dependall)
911.40Stvinstall-${_prev}: dependall-${_prev}
921.40Stv.endif
931.36Spk
941.16Stv.else
951.36Spk
961.36Spk# order depend/all/install targets for ${d} subdir.  Note the additional
971.36Spk# .WAIT to achieve "closure" of the predecessor/successor relationships.
981.36Spk.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
991.40Stv
1001.40Stv# make all/depend-${d} dependent on list of install targets
1011.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps}
1021.36Spk
1031.16Stv.endif
1041.40Stv
1051.40Stv# stash current name in case the next entry is .WAIT
1061.40Stv_prev:=		${d}
1071.16Stv.endfor
1081.12Stv
1091.12Stvcleantools:
1101.12Stv	rm -r -f tools.${HOST_OSTYPE}
111