Makefile revision 1.87
11.87Smycroft#	$NetBSD: Makefile,v 1.87 2005/01/09 03:48:30 mycroft Exp $
21.1Stv
31.3Stv.include <bsd.own.mk>
41.3Stv
51.81Slukem.if ${TOOLCHAIN_MISSING} == "no"
61.77SmrgTOOLCHAIN_BITS= binutils .WAIT
71.70Smrg.  if ${USE_TOOLS_TOOLCHAIN} != "yes"
81.77SmrgTOOLCHAIN_BITS+= gcc
91.74Scl.    if ${MKCROSSGDB:Uno} != "no"
101.74SclTOOLCHAIN_BITS+= gdb
111.74Scl.    endif
121.70Smrg.  else
131.77SmrgTOOLCHAIN_BITS+= toolchain
141.70Smrg.  endif
151.70SmrgTOOLCHAIN_BITS+= .WAIT dbsym mdsetimage
161.58Sthorpej# XXX Eventually, we want to be able to build dbsym and mdsetimage
171.58Sthorpej# XXX if EXTERNAL_TOOLCHAIN is set.
181.31Stv.endif
191.31Stv
201.16Stv# Dependencies in SUBDIR below ordered to maximize parallel ability.
211.50Slukem.if !defined(NOSUBDIR)					# {
221.50Slukem
231.29StvSUBDIR=	host-mkdep .WAIT compat .WAIT \
241.57Schris	binstall .WAIT mktemp .WAIT \
251.62Sthorpej		cap_mkdb crunchgen ctags gencat hexdump lint lint2 lorder \
261.32Stv		m4 makewhatis mkdep mtree rpcgen tsort uudecode \
271.32Stv	texinfo .WAIT \
281.16Stv	yacc .WAIT \
291.16Stv	lex .WAIT \
301.32Stv	${TOOLCHAIN_BITS} \
311.64Slukem		asn1_compile cat cksum compile_et config db file installboot \
321.75Slukem		lint1 makefs menuc mkcsmapper mkesdb mklocale mknod msgc pax \
331.68Slukem		pwd_mkdb stat sunlabel zic
341.39Stv
351.39Stv.if ${MKMAN} != "no"
361.39StvSUBDIR+=	groff
371.39Stv.endif
381.22Stv
391.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no"
401.38StvSUBDIR+=	autoconf gettext
411.72Smatt.endif
421.72Smatt
431.86Sjmc.if ${MACHINE} == "hp700"
441.83SskrllSUBDIR+=	hp700-mkboot
451.83Sskrll.endif
461.83Sskrll
471.86Sjmc.if ${MACHINE} == "ibmnws"
481.72SmattSUBDIR+=	ibmnws-ncdcs
491.79Smatt.endif
501.79Smatt
511.86Sjmc.if ${MACHINE} == "macppc"
521.79SmattSUBDIR+=	macppc-fixcoff
531.48Skleink.endif
541.48Skleink
551.86Sjmc.if ${MACHINE} == "prep"
561.48SkleinkSUBDIR+=	prep-mkbootimage
571.22Stv.endif
581.37Sgmcgarry
591.37Sgmcgarry.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
601.37SgmcgarrySUBDIR+=	mips-elf2ecoff
611.76Ssekiya.endif
621.76Ssekiya
631.76Ssekiya.if (${MACHINE} == "sgimips")
641.76SsekiyaSUBDIR+=	sgivol
651.51Sbjh21.endif
661.51Sbjh21
671.82Sabs.if ${MACHINE} == "acorn32"
681.82SabsSUBDIR+=	sparkcrc
691.82Sabs.endif
701.82Sabs
711.51Sbjh21.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64")
721.51Sbjh21SUBDIR+=	fgen
731.37Sgmcgarry.endif
741.37Sgmcgarry
751.84Sjmc.if ${MACHINE} == "bebox"
761.84SjmcSUBDIR+=	bebox-elf2pef
771.84SjmcSUBDIR+=	bebox-mkbootimage
781.84Sjmc.endif
791.84Sjmc
801.85Sjmc.if ${MACHINE} == "amiga"
811.85SjmcSUBDIR+=	amiga-elf2bb
821.85SjmcSUBDIR+=	amiga-aout2bb
831.85SjmcSUBDIR+=	amiga-txlt
841.85Sjmc.endif
851.85Sjmc
861.86Sjmc.if ${MACHINE} == "hp300"
871.86SjmcSUBDIR+=	hp300-mkboot
881.86Sjmc.endif
891.86Sjmc
901.50Slukem.endif	# ! NOSUBDIR					# }
911.17Stv
921.66Slukemcheck_MKTOOLS: .PHONY .NOTMAIN
931.19Sjmc.if ${MKTOOLS:Uyes} == "no"
941.17Stv	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
951.17Stv	@echo '*** updating your host toolchain.  This should be used only as a'
961.17Stv	@echo '*** temporary workaround for toolchain problems, as it will result'
971.23Swiz	@echo '*** in version skew and build errors over time!'
981.18Sjmc.endif
991.17Stv
1001.66Slukem.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"	# {
1011.67Slukemrealall realdepend install: check_MKTOOLS
1021.66Slukem
1031.17Stv.for dir in ${SUBDIR:N.WAIT}
1041.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}:
1051.17Stv	@true
1061.17Stv.endfor
1071.66Slukem.endif							# }
1081.1Stv
1091.1Stv.include <bsd.subdir.mk>
1101.11Stv.include <bsd.obj.mk>
1111.16Stv
1121.66Slukem.if exists(PREVIOUSTOOLDIR)
1131.66SlukemPREVIOUSTOOLDIR!=	cat PREVIOUSTOOLDIR
1141.66Slukem.else
1151.66SlukemPREVIOUSTOOLDIR=	
1161.66Slukem.endif
1171.66Slukem
1181.66SlukemCLEANFILES+=	PREVIOUSTOOLDIR
1191.66Slukem
1201.67Slukemrealall realdepend:
1211.87Smycroft.if "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
1221.66Slukem	@echo "*** WARNING: TOOLDIR has moved?"
1231.66Slukem	@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
1241.66Slukem	@echo "***     !=  TOOLDIR '${TOOLDIR}'"
1251.66Slukem	@echo "*** Cleaning mis-matched tools"
1261.66Slukem	rm -f PREVIOUSTOOLDIR
1271.78Slukem	(cd ${.CURDIR} && ${MAKE} cleandir)
1281.66Slukem.endif
1291.66Slukem	echo ${TOOLDIR} > PREVIOUSTOOLDIR
1301.66Slukem
1311.40Stv# For each .WAIT point, make sure the immediately preceding target is
1321.40Stv# installed before building anything after that point.
1331.36Spk#
1341.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
1351.36Spk# to achieve this. These targets look like:
1361.36Spk#	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
1371.36Spk#	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
1381.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
1391.36Spk# places corresponding to the .WAITs in our $SUBDIR variable.
1401.36Spk#
1411.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets
1421.36Spk# an order relationship between those in each individual subdirectory
1431.36Spk# must be established.
1441.36Spk#
1451.40Stv_deps:=
1461.40Stv_prev:=
1471.40Stv
1481.16Stv.for d in ${SUBDIR}
1491.16Stv_this:=		${d}
1501.40Stv
1511.16Stv.if ${_this} == ".WAIT"
1521.36Spk
1531.36Spk# setup dependency to apply to all/depend targets in the next group
1541.40Stv_deps:=		${_deps} ${_prev:S/^/install-/}
1551.40Stv
1561.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"),
1571.40Stv# make sure prerequisite tools build before installing
1581.40Stv.if !make(all) && !make(dependall)
1591.40Stvinstall-${_prev}: dependall-${_prev}
1601.40Stv.endif
1611.36Spk
1621.16Stv.else
1631.36Spk
1641.36Spk# order depend/all/install targets for ${d} subdir.  Note the additional
1651.36Spk# .WAIT to achieve "closure" of the predecessor/successor relationships.
1661.36Spk.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
1671.40Stv
1681.40Stv# make all/depend-${d} dependent on list of install targets
1691.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps}
1701.36Spk
1711.16Stv.endif
1721.40Stv
1731.40Stv# stash current name in case the next entry is .WAIT
1741.40Stv_prev:=		${d}
1751.16Stv.endfor
1761.69Stron
1771.69Stroncleandir:
1781.69Stron	rm -f ${CLEANFILES}
179