Makefile revision 1.65
11.65Stshiozak#	$NetBSD: Makefile,v 1.65 2003/06/26 06:30:19 tshiozak 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.64Slukem		asn1_compile cat cksum compile_et config db file installboot \
231.65Stshiozak		lint1 makefs menuc mklocale mkcsmapper mkesdb msgc pax \
241.65Stshiozak		pwd_mkdb sunlabel zic
251.39Stv
261.39Stv.if ${MKMAN} != "no"
271.39StvSUBDIR+=	groff
281.39Stv.endif
291.22Stv
301.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no"
311.38StvSUBDIR+=	autoconf gettext
321.48Skleink.endif
331.48Skleink
341.48Skleink.if ${MACHINE} == prep
351.48SkleinkSUBDIR+=	prep-mkbootimage
361.22Stv.endif
371.37Sgmcgarry
381.37Sgmcgarry.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
391.37SgmcgarrySUBDIR+=	mips-elf2ecoff
401.51Sbjh21.endif
411.51Sbjh21
421.51Sbjh21.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64")
431.51Sbjh21SUBDIR+=	fgen
441.37Sgmcgarry.endif
451.37Sgmcgarry
461.50Slukem.endif	# ! NOSUBDIR					# }
471.17Stv
481.18Sjmc.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"
491.17Stvrealall install: _warn
501.19Sjmc.if ${MKTOOLS:Uyes} == "no"
511.17Stv_warn:
521.17Stv	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
531.17Stv	@echo '*** updating your host toolchain.  This should be used only as a'
541.17Stv	@echo '*** temporary workaround for toolchain problems, as it will result'
551.23Swiz	@echo '*** in version skew and build errors over time!'
561.18Sjmc.else
571.18Sjmc_warn:
581.18Sjmc.endif
591.17Stv
601.17Stv.for dir in ${SUBDIR:N.WAIT}
611.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}:
621.17Stv	@true
631.17Stv.endfor
641.14Stv.endif
651.1Stv
661.1Stv.include <bsd.subdir.mk>
671.11Stv.include <bsd.obj.mk>
681.16Stv
691.40Stv# For each .WAIT point, make sure the immediately preceding target is
701.40Stv# installed before building anything after that point.
711.36Spk#
721.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
731.36Spk# to achieve this. These targets look like:
741.36Spk#	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
751.36Spk#	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
761.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
771.36Spk# places corresponding to the .WAITs in our $SUBDIR variable.
781.36Spk#
791.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets
801.36Spk# an order relationship between those in each individual subdirectory
811.36Spk# must be established.
821.36Spk#
831.40Stv_deps:=
841.40Stv_prev:=
851.40Stv
861.16Stv.for d in ${SUBDIR}
871.16Stv_this:=		${d}
881.40Stv
891.16Stv.if ${_this} == ".WAIT"
901.36Spk
911.36Spk# setup dependency to apply to all/depend targets in the next group
921.40Stv_deps:=		${_deps} ${_prev:S/^/install-/}
931.40Stv
941.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"),
951.40Stv# make sure prerequisite tools build before installing
961.40Stv.if !make(all) && !make(dependall)
971.40Stvinstall-${_prev}: dependall-${_prev}
981.40Stv.endif
991.36Spk
1001.16Stv.else
1011.36Spk
1021.36Spk# order depend/all/install targets for ${d} subdir.  Note the additional
1031.36Spk# .WAIT to achieve "closure" of the predecessor/successor relationships.
1041.36Spk.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
1051.40Stv
1061.40Stv# make all/depend-${d} dependent on list of install targets
1071.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps}
1081.36Spk
1091.16Stv.endif
1101.40Stv
1111.40Stv# stash current name in case the next entry is .WAIT
1121.40Stv_prev:=		${d}
1131.16Stv.endfor
1141.12Stv
1151.12Stvcleantools:
1161.12Stv	rm -r -f tools.${HOST_OSTYPE}
117