Makefile revision 1.62
11.62Sthorpej#	$NetBSD: Makefile,v 1.62 2003/03/07 01:14:30 thorpej Exp $
21.1Stv
31.3Stv.include <bsd.own.mk>
41.3Stv
51.60Sthorpej.if ${TOOLCHAIN_MISSING} != "yes"
61.45SthorpejTOOLCHAIN_BITS= toolchain .WAIT dbsym mdsetimage
71.58Sthorpej# XXX Eventually, we want to be able to build dbsym and mdsetimage
81.58Sthorpej# XXX if EXTERNAL_TOOLCHAIN is set.
91.31Stv.endif
101.31Stv
111.16Stv# Dependencies in SUBDIR below ordered to maximize parallel ability.
121.50Slukem.if !defined(NOSUBDIR)					# {
131.50Slukem
141.29StvSUBDIR=	host-mkdep .WAIT compat .WAIT \
151.57Schris	binstall .WAIT mktemp .WAIT \
161.62Sthorpej		cap_mkdb crunchgen ctags gencat hexdump lint lint2 lorder \
171.32Stv		m4 makewhatis mkdep mtree rpcgen tsort uudecode \
181.32Stv	texinfo .WAIT \
191.16Stv	yacc .WAIT \
201.16Stv	lex .WAIT \
211.32Stv	${TOOLCHAIN_BITS} \
221.53Smason		asn1_compile cat cksum compile_et config installboot lint1 \
231.61Slukem		makefs menuc mklocale msgc pax pwd_mkdb sunlabel zic
241.39Stv
251.39Stv.if ${MKMAN} != "no"
261.39StvSUBDIR+=	groff
271.39Stv.endif
281.22Stv
291.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no"
301.38StvSUBDIR+=	autoconf gettext
311.48Skleink.endif
321.48Skleink
331.48Skleink.if ${MACHINE} == prep
341.48SkleinkSUBDIR+=	prep-mkbootimage
351.22Stv.endif
361.37Sgmcgarry
371.37Sgmcgarry.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
381.37SgmcgarrySUBDIR+=	mips-elf2ecoff
391.51Sbjh21.endif
401.51Sbjh21
411.51Sbjh21.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64")
421.51Sbjh21SUBDIR+=	fgen
431.37Sgmcgarry.endif
441.37Sgmcgarry
451.50Slukem.endif	# ! NOSUBDIR					# }
461.17Stv
471.18Sjmc.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"
481.17Stvrealall install: _warn
491.19Sjmc.if ${MKTOOLS:Uyes} == "no"
501.17Stv_warn:
511.17Stv	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
521.17Stv	@echo '*** updating your host toolchain.  This should be used only as a'
531.17Stv	@echo '*** temporary workaround for toolchain problems, as it will result'
541.23Swiz	@echo '*** in version skew and build errors over time!'
551.18Sjmc.else
561.18Sjmc_warn:
571.18Sjmc.endif
581.17Stv
591.17Stv.for dir in ${SUBDIR:N.WAIT}
601.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}:
611.17Stv	@true
621.17Stv.endfor
631.14Stv.endif
641.1Stv
651.1Stv.include <bsd.subdir.mk>
661.11Stv.include <bsd.obj.mk>
671.16Stv
681.40Stv# For each .WAIT point, make sure the immediately preceding target is
691.40Stv# installed before building anything after that point.
701.36Spk#
711.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
721.36Spk# to achieve this. These targets look like:
731.36Spk#	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
741.36Spk#	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
751.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
761.36Spk# places corresponding to the .WAITs in our $SUBDIR variable.
771.36Spk#
781.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets
791.36Spk# an order relationship between those in each individual subdirectory
801.36Spk# must be established.
811.36Spk#
821.40Stv_deps:=
831.40Stv_prev:=
841.40Stv
851.16Stv.for d in ${SUBDIR}
861.16Stv_this:=		${d}
871.40Stv
881.16Stv.if ${_this} == ".WAIT"
891.36Spk
901.36Spk# setup dependency to apply to all/depend targets in the next group
911.40Stv_deps:=		${_deps} ${_prev:S/^/install-/}
921.40Stv
931.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"),
941.40Stv# make sure prerequisite tools build before installing
951.40Stv.if !make(all) && !make(dependall)
961.40Stvinstall-${_prev}: dependall-${_prev}
971.40Stv.endif
981.36Spk
991.16Stv.else
1001.36Spk
1011.36Spk# order depend/all/install targets for ${d} subdir.  Note the additional
1021.36Spk# .WAIT to achieve "closure" of the predecessor/successor relationships.
1031.36Spk.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
1041.40Stv
1051.40Stv# make all/depend-${d} dependent on list of install targets
1061.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps}
1071.36Spk
1081.16Stv.endif
1091.40Stv
1101.40Stv# stash current name in case the next entry is .WAIT
1111.40Stv_prev:=		${d}
1121.16Stv.endfor
1131.12Stv
1141.12Stvcleantools:
1151.12Stv	rm -r -f tools.${HOST_OSTYPE}
116