Makefile revision 1.40
11.40Stv#	$NetBSD: Makefile,v 1.40 2002/03/07 19:12:33 tv Exp $
21.31Stv
31.32Stv# XXX Note: NO_DBSYM is a stopgap temporary variable for use
41.32Stv# with the development of non-NetBSD hosting support.  This will go away.
51.1Stv
61.3Stv.include <bsd.own.mk>
71.3Stv
81.24Sthorpej# XXX We can't currently build the toolchain for x86-64.
91.24Sthorpej.if ${MACHINE_ARCH} != "x86_64"
101.31StvTOOLCHAIN_BITS= toolchain .WAIT ${NO_DBSYM:D:Udbsym} mdsetimage
111.31Stv.endif
121.31Stv
131.16Stv# Dependencies in SUBDIR below ordered to maximize parallel ability.
141.14Stv.if !defined(NOSUBDIR)
151.29StvSUBDIR=	host-mkdep .WAIT compat .WAIT \
161.16Stv	binstall .WAIT \
171.32Stv		cap_mkdb crunchgen ctags gencat lint lint2 lorder \
181.32Stv		m4 makewhatis mkdep mtree rpcgen tsort uudecode \
191.32Stv	texinfo .WAIT \
201.16Stv	yacc .WAIT \
211.16Stv	lex .WAIT \
221.32Stv	${TOOLCHAIN_BITS} \
231.32Stv		asn1_compile compile_et config lint1 \
241.32Stv		makefs menuc mklocale msgc pax pwd_mkdb 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.25Smrg.endif
331.25Smrg
341.25Smrg.if ${MACHINE} == sparc || ${MACHINE} == sparc64
351.25SmrgSUBDIR+=	sparc-installboot
361.22Stv.endif
371.37Sgmcgarry
381.37Sgmcgarry.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
391.37SgmcgarrySUBDIR+=	mips-elf2ecoff
401.37Sgmcgarry.endif
411.37Sgmcgarry
421.17Stv.endif
431.17Stv
441.18Sjmc.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"
451.17Stvrealall install: _warn
461.19Sjmc.if ${MKTOOLS:Uyes} == "no"
471.17Stv_warn:
481.17Stv	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
491.17Stv	@echo '*** updating your host toolchain.  This should be used only as a'
501.17Stv	@echo '*** temporary workaround for toolchain problems, as it will result'
511.23Swiz	@echo '*** in version skew and build errors over time!'
521.18Sjmc.else
531.18Sjmc_warn:
541.18Sjmc.endif
551.17Stv
561.17Stv.for dir in ${SUBDIR:N.WAIT}
571.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}:
581.17Stv	@true
591.17Stv.endfor
601.14Stv.endif
611.1Stv
621.1Stv.include <bsd.subdir.mk>
631.11Stv.include <bsd.obj.mk>
641.16Stv
651.40Stv# For each .WAIT point, make sure the immediately preceding target is
661.40Stv# installed before building anything after that point.
671.36Spk#
681.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
691.36Spk# to achieve this. These targets look like:
701.36Spk#	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
711.36Spk#	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
721.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
731.36Spk# places corresponding to the .WAITs in our $SUBDIR variable.
741.36Spk#
751.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets
761.36Spk# an order relationship between those in each individual subdirectory
771.36Spk# must be established.
781.36Spk#
791.40Stv_deps:=
801.40Stv_prev:=
811.40Stv
821.16Stv.for d in ${SUBDIR}
831.16Stv_this:=		${d}
841.40Stv
851.16Stv.if ${_this} == ".WAIT"
861.36Spk
871.36Spk# setup dependency to apply to all/depend targets in the next group
881.40Stv_deps:=		${_deps} ${_prev:S/^/install-/}
891.40Stv
901.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"),
911.40Stv# make sure prerequisite tools build before installing
921.40Stv.if !make(all) && !make(dependall)
931.40Stvinstall-${_prev}: dependall-${_prev}
941.40Stv.endif
951.36Spk
961.16Stv.else
971.36Spk
981.36Spk# order depend/all/install targets for ${d} subdir.  Note the additional
991.36Spk# .WAIT to achieve "closure" of the predecessor/successor relationships.
1001.36Spk.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
1011.40Stv
1021.40Stv# make all/depend-${d} dependent on list of install targets
1031.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps}
1041.36Spk
1051.16Stv.endif
1061.40Stv
1071.40Stv# stash current name in case the next entry is .WAIT
1081.40Stv_prev:=		${d}
1091.16Stv.endfor
1101.12Stv
1111.12Stvcleantools:
1121.12Stv	rm -r -f tools.${HOST_OSTYPE}
113