Makefile revision 1.93
11.93Sdsl#	$NetBSD: Makefile,v 1.93 2006/02/03 22:07:57 dsl 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.89Sthorpej		cap_mkdb crunchgen ctags genassym gencat hexdump lint lint2 \
261.89Sthorpej		lorder m4 makewhatis mkdep mtree rpcgen tsort uudecode \
271.32Stv	texinfo .WAIT \
281.16Stv	yacc .WAIT \
291.16Stv	lex .WAIT \
301.32Stv	${TOOLCHAIN_BITS} \
311.90Sdyoung		asn1_compile cat cksum compile_et config db \
321.91Sdyoung		file lint1 \
331.90Sdyoung		makefs menuc mkcsmapper mkesdb mklocale mknod msgc \
341.90Sdyoung		pax .WAIT \
351.92Sjmc		disklabel .WAIT \
361.92Sjmc		fdisk .WAIT \
371.92Sjmc		installboot .WAIT \
381.68Slukem		pwd_mkdb stat sunlabel zic
391.39Stv
401.39Stv.if ${MKMAN} != "no"
411.39StvSUBDIR+=	groff
421.39Stv.endif
431.22Stv
441.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no"
451.38StvSUBDIR+=	autoconf gettext
461.72Smatt.endif
471.72Smatt
481.86Sjmc.if ${MACHINE} == "hp700"
491.83SskrllSUBDIR+=	hp700-mkboot
501.83Sskrll.endif
511.83Sskrll
521.86Sjmc.if ${MACHINE} == "ibmnws"
531.72SmattSUBDIR+=	ibmnws-ncdcs
541.79Smatt.endif
551.79Smatt
561.86Sjmc.if ${MACHINE} == "macppc"
571.79SmattSUBDIR+=	macppc-fixcoff
581.48Skleink.endif
591.48Skleink
601.86Sjmc.if ${MACHINE} == "prep"
611.48SkleinkSUBDIR+=	prep-mkbootimage
621.22Stv.endif
631.37Sgmcgarry
641.37Sgmcgarry.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
651.37SgmcgarrySUBDIR+=	mips-elf2ecoff
661.76Ssekiya.endif
671.76Ssekiya
681.76Ssekiya.if (${MACHINE} == "sgimips")
691.76SsekiyaSUBDIR+=	sgivol
701.51Sbjh21.endif
711.51Sbjh21
721.82Sabs.if ${MACHINE} == "acorn32"
731.82SabsSUBDIR+=	sparkcrc
741.82Sabs.endif
751.82Sabs
761.51Sbjh21.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64")
771.51Sbjh21SUBDIR+=	fgen
781.37Sgmcgarry.endif
791.37Sgmcgarry
801.84Sjmc.if ${MACHINE} == "bebox"
811.84SjmcSUBDIR+=	bebox-elf2pef
821.84SjmcSUBDIR+=	bebox-mkbootimage
831.84Sjmc.endif
841.84Sjmc
851.85Sjmc.if ${MACHINE} == "amiga"
861.85SjmcSUBDIR+=	amiga-elf2bb
871.85SjmcSUBDIR+=	amiga-txlt
881.85Sjmc.endif
891.85Sjmc
901.86Sjmc.if ${MACHINE} == "hp300"
911.86SjmcSUBDIR+=	hp300-mkboot
921.86Sjmc.endif
931.86Sjmc
941.50Slukem.endif	# ! NOSUBDIR					# }
951.17Stv
961.66Slukemcheck_MKTOOLS: .PHONY .NOTMAIN
971.19Sjmc.if ${MKTOOLS:Uyes} == "no"
981.17Stv	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
991.17Stv	@echo '*** updating your host toolchain.  This should be used only as a'
1001.17Stv	@echo '*** temporary workaround for toolchain problems, as it will result'
1011.23Swiz	@echo '*** in version skew and build errors over time!'
1021.18Sjmc.endif
1031.17Stv
1041.66Slukem.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"	# {
1051.67Slukemrealall realdepend install: check_MKTOOLS
1061.66Slukem
1071.17Stv.for dir in ${SUBDIR:N.WAIT}
1081.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}:
1091.17Stv	@true
1101.17Stv.endfor
1111.66Slukem.endif							# }
1121.1Stv
1131.1Stv.include <bsd.subdir.mk>
1141.11Stv.include <bsd.obj.mk>
1151.16Stv
1161.66Slukem.if exists(PREVIOUSTOOLDIR)
1171.66SlukemPREVIOUSTOOLDIR!=	cat PREVIOUSTOOLDIR
1181.66Slukem.else
1191.66SlukemPREVIOUSTOOLDIR=	
1201.66Slukem.endif
1211.66Slukem
1221.66SlukemCLEANFILES+=	PREVIOUSTOOLDIR
1231.66Slukem
1241.93Sdslrealall realdepend: .MAKE
1251.87Smycroft.if "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
1261.66Slukem	@echo "*** WARNING: TOOLDIR has moved?"
1271.66Slukem	@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
1281.66Slukem	@echo "***     !=  TOOLDIR '${TOOLDIR}'"
1291.66Slukem	@echo "*** Cleaning mis-matched tools"
1301.66Slukem	rm -f PREVIOUSTOOLDIR
1311.78Slukem	(cd ${.CURDIR} && ${MAKE} cleandir)
1321.66Slukem.endif
1331.66Slukem	echo ${TOOLDIR} > PREVIOUSTOOLDIR
1341.66Slukem
1351.40Stv# For each .WAIT point, make sure the immediately preceding target is
1361.40Stv# installed before building anything after that point.
1371.36Spk#
1381.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk>
1391.36Spk# to achieve this. These targets look like:
1401.36Spk#	subdir-all:	all-dir1     [.WAIT] all-dir2     etc..
1411.36Spk#	subdir-install:	install-dir1 [.WAIT] install-dir2 etc..
1421.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at
1431.36Spk# places corresponding to the .WAITs in our $SUBDIR variable.
1441.36Spk#
1451.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets
1461.36Spk# an order relationship between those in each individual subdirectory
1471.36Spk# must be established.
1481.36Spk#
1491.40Stv_deps:=
1501.40Stv_prev:=
1511.40Stv
1521.16Stv.for d in ${SUBDIR}
1531.16Stv_this:=		${d}
1541.40Stv
1551.16Stv.if ${_this} == ".WAIT"
1561.36Spk
1571.36Spk# setup dependency to apply to all/depend targets in the next group
1581.40Stv_deps:=		${_deps} ${_prev:S/^/install-/}
1591.40Stv
1601.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"),
1611.40Stv# make sure prerequisite tools build before installing
1621.40Stv.if !make(all) && !make(dependall)
1631.40Stvinstall-${_prev}: dependall-${_prev}
1641.40Stv.endif
1651.36Spk
1661.16Stv.else
1671.36Spk
1681.36Spk# order depend/all/install targets for ${d} subdir.  Note the additional
1691.36Spk# .WAIT to achieve "closure" of the predecessor/successor relationships.
1701.36Spk.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d}
1711.40Stv
1721.40Stv# make all/depend-${d} dependent on list of install targets
1731.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps}
1741.36Spk
1751.16Stv.endif
1761.40Stv
1771.40Stv# stash current name in case the next entry is .WAIT
1781.40Stv_prev:=		${d}
1791.16Stv.endfor
1801.69Stron
1811.69Stroncleandir:
1821.69Stron	rm -f ${CLEANFILES}
183