Makefile revision 1.98
11.98Sgdamore# $NetBSD: Makefile,v 1.98 2006/06/18 05:16:41 gdamore Exp $ 21.1Stv 31.3Stv.include <bsd.own.mk> 41.3Stv 51.96Smrg.if ${HAVE_GCC} == "4" 61.94SjmcTOOLCHAIN_BITS= gmake .WAIT 71.94Sjmc.endif 81.81Slukem.if ${TOOLCHAIN_MISSING} == "no" 91.94SjmcTOOLCHAIN_BITS+= binutils .WAIT 101.77SmrgTOOLCHAIN_BITS+= gcc 111.97Smrg. if ${MKCROSSGDB:Uno} != "no" 121.74SclTOOLCHAIN_BITS+= gdb 131.70Smrg. endif 141.70SmrgTOOLCHAIN_BITS+= .WAIT dbsym mdsetimage 151.58Sthorpej# XXX Eventually, we want to be able to build dbsym and mdsetimage 161.58Sthorpej# XXX if EXTERNAL_TOOLCHAIN is set. 171.31Stv.endif 181.31Stv 191.16Stv# Dependencies in SUBDIR below ordered to maximize parallel ability. 201.50Slukem.if !defined(NOSUBDIR) # { 211.50Slukem 221.29StvSUBDIR= host-mkdep .WAIT compat .WAIT \ 231.57Schris binstall .WAIT mktemp .WAIT \ 241.89Sthorpej cap_mkdb crunchgen ctags genassym gencat hexdump lint lint2 \ 251.98Sgdamore lorder m4 makewhatis mkdep mtree rpcgen sed tsort uudecode \ 261.32Stv texinfo .WAIT \ 271.16Stv yacc .WAIT \ 281.16Stv lex .WAIT \ 291.32Stv ${TOOLCHAIN_BITS} \ 301.90Sdyoung asn1_compile cat cksum compile_et config db \ 311.91Sdyoung file lint1 \ 321.90Sdyoung makefs menuc mkcsmapper mkesdb mklocale mknod msgc \ 331.90Sdyoung pax .WAIT \ 341.92Sjmc disklabel .WAIT \ 351.92Sjmc fdisk .WAIT \ 361.92Sjmc installboot .WAIT \ 371.68Slukem pwd_mkdb stat sunlabel zic 381.39Stv 391.39Stv.if ${MKMAN} != "no" 401.39StvSUBDIR+= groff 411.39Stv.endif 421.22Stv 431.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no" 441.38StvSUBDIR+= autoconf gettext 451.72Smatt.endif 461.72Smatt 471.86Sjmc.if ${MACHINE} == "hp700" 481.83SskrllSUBDIR+= hp700-mkboot 491.83Sskrll.endif 501.83Sskrll 511.86Sjmc.if ${MACHINE} == "ibmnws" 521.72SmattSUBDIR+= ibmnws-ncdcs 531.79Smatt.endif 541.79Smatt 551.86Sjmc.if ${MACHINE} == "macppc" 561.79SmattSUBDIR+= macppc-fixcoff 571.48Skleink.endif 581.48Skleink 591.86Sjmc.if ${MACHINE} == "prep" 601.48SkleinkSUBDIR+= prep-mkbootimage 611.22Stv.endif 621.37Sgmcgarry 631.37Sgmcgarry.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb") 641.37SgmcgarrySUBDIR+= mips-elf2ecoff 651.76Ssekiya.endif 661.76Ssekiya 671.76Ssekiya.if (${MACHINE} == "sgimips") 681.76SsekiyaSUBDIR+= sgivol 691.51Sbjh21.endif 701.51Sbjh21 711.82Sabs.if ${MACHINE} == "acorn32" 721.82SabsSUBDIR+= sparkcrc 731.82Sabs.endif 741.82Sabs 751.51Sbjh21.if (${MACHINE} == "sparc" || ${MACHINE} == "sparc64") 761.51Sbjh21SUBDIR+= fgen 771.37Sgmcgarry.endif 781.37Sgmcgarry 791.84Sjmc.if ${MACHINE} == "bebox" 801.84SjmcSUBDIR+= bebox-elf2pef 811.84SjmcSUBDIR+= bebox-mkbootimage 821.84Sjmc.endif 831.84Sjmc 841.85Sjmc.if ${MACHINE} == "amiga" 851.85SjmcSUBDIR+= amiga-elf2bb 861.85SjmcSUBDIR+= amiga-txlt 871.85Sjmc.endif 881.85Sjmc 891.86Sjmc.if ${MACHINE} == "hp300" 901.86SjmcSUBDIR+= hp300-mkboot 911.86Sjmc.endif 921.86Sjmc 931.50Slukem.endif # ! NOSUBDIR # } 941.17Stv 951.66Slukemcheck_MKTOOLS: .PHONY .NOTMAIN 961.19Sjmc.if ${MKTOOLS:Uyes} == "no" 971.17Stv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 981.17Stv @echo '*** updating your host toolchain. This should be used only as a' 991.17Stv @echo '*** temporary workaround for toolchain problems, as it will result' 1001.23Swiz @echo '*** in version skew and build errors over time!' 1011.18Sjmc.endif 1021.17Stv 1031.66Slukem.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 1041.67Slukemrealall realdepend install: check_MKTOOLS 1051.66Slukem 1061.17Stv.for dir in ${SUBDIR:N.WAIT} 1071.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}: 1081.17Stv @true 1091.17Stv.endfor 1101.66Slukem.endif # } 1111.1Stv 1121.1Stv.include <bsd.subdir.mk> 1131.11Stv.include <bsd.obj.mk> 1141.16Stv 1151.66Slukem.if exists(PREVIOUSTOOLDIR) 1161.66SlukemPREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 1171.66Slukem.else 1181.66SlukemPREVIOUSTOOLDIR= 1191.66Slukem.endif 1201.66Slukem 1211.66SlukemCLEANFILES+= PREVIOUSTOOLDIR 1221.66Slukem 1231.93Sdslrealall realdepend: .MAKE 1241.87Smycroft.if "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 1251.66Slukem @echo "*** WARNING: TOOLDIR has moved?" 1261.66Slukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 1271.66Slukem @echo "*** != TOOLDIR '${TOOLDIR}'" 1281.66Slukem @echo "*** Cleaning mis-matched tools" 1291.66Slukem rm -f PREVIOUSTOOLDIR 1301.78Slukem (cd ${.CURDIR} && ${MAKE} cleandir) 1311.66Slukem.endif 1321.66Slukem echo ${TOOLDIR} > PREVIOUSTOOLDIR 1331.66Slukem 1341.40Stv# For each .WAIT point, make sure the immediately preceding target is 1351.40Stv# installed before building anything after that point. 1361.36Spk# 1371.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 1381.36Spk# to achieve this. These targets look like: 1391.36Spk# subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 1401.36Spk# subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 1411.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at 1421.36Spk# places corresponding to the .WAITs in our $SUBDIR variable. 1431.36Spk# 1441.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets 1451.36Spk# an order relationship between those in each individual subdirectory 1461.36Spk# must be established. 1471.36Spk# 1481.40Stv_deps:= 1491.40Stv_prev:= 1501.40Stv 1511.16Stv.for d in ${SUBDIR} 1521.16Stv_this:= ${d} 1531.40Stv 1541.16Stv.if ${_this} == ".WAIT" 1551.36Spk 1561.36Spk# setup dependency to apply to all/depend targets in the next group 1571.40Stv_deps:= ${_deps} ${_prev:S/^/install-/} 1581.40Stv 1591.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"), 1601.40Stv# make sure prerequisite tools build before installing 1611.40Stv.if !make(all) && !make(dependall) 1621.40Stvinstall-${_prev}: dependall-${_prev} 1631.40Stv.endif 1641.36Spk 1651.16Stv.else 1661.36Spk 1671.36Spk# order depend/all/install targets for ${d} subdir. Note the additional 1681.36Spk# .WAIT to achieve "closure" of the predecessor/successor relationships. 1691.36Spk.ORDER: depend-${d} all-${d} dependall-${d} .WAIT install-${d} 1701.40Stv 1711.40Stv# make all/depend-${d} dependent on list of install targets 1721.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps} 1731.36Spk 1741.16Stv.endif 1751.40Stv 1761.40Stv# stash current name in case the next entry is .WAIT 1771.40Stv_prev:= ${d} 1781.16Stv.endfor 1791.69Stron 1801.69Stroncleandir: 1811.69Stron rm -f ${CLEANFILES} 182