Makefile revision 1.128
11.128Sjoerg# $NetBSD: Makefile,v 1.128 2009/10/23 22:14:37 joerg Exp $ 21.1Stv 31.3Stv.include <bsd.own.mk> 41.3Stv 51.118Sgmcgarry.if defined(HAVE_GCC) 61.96Smrg.if ${HAVE_GCC} == "4" 71.94SjmcTOOLCHAIN_BITS= gmake .WAIT 81.94Sjmc.endif 91.81Slukem.if ${TOOLCHAIN_MISSING} == "no" 101.94SjmcTOOLCHAIN_BITS+= binutils .WAIT 111.77SmrgTOOLCHAIN_BITS+= gcc 121.97Smrg. if ${MKCROSSGDB:Uno} != "no" 131.74SclTOOLCHAIN_BITS+= gdb 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.118Sgmcgarry.endif 201.118Sgmcgarry 211.118Sgmcgarry.if defined(HAVE_PCC) 221.118SgmcgarryTOOLCHAIN_BITS= gmake .WAIT 231.118Sgmcgarry.if ${TOOLCHAIN_MISSING} == "no" 241.118SgmcgarryTOOLCHAIN_BITS+= binutils .WAIT 251.118SgmcgarryTOOLCHAIN_BITS+= pcc 261.118Sgmcgarry.endif 271.118SgmcgarryTOOLCHAIN_BITS+= .WAIT dbsym mdsetimage 281.118Sgmcgarry.endif 291.31Stv 301.99SmrgLINT_BITS= 311.99Smrg.if ${MKLINT} != "no" 321.99SmrgLINT_BITS= lint lint2 331.99Smrg.endif 341.99Smrg 351.16Stv# Dependencies in SUBDIR below ordered to maximize parallel ability. 361.29StvSUBDIR= host-mkdep .WAIT compat .WAIT \ 371.124Sapb binstall .WAIT mktemp .WAIT sed .WAIT \ 381.113Sapb cap_mkdb crunchgen ctags genassym gencat hexdump join \ 391.99Smrg ${LINT_BITS} \ 401.120Sapb lorder m4 makewhatis mkdep mtree rpcgen tsort uudecode \ 411.32Stv texinfo .WAIT \ 421.16Stv yacc .WAIT \ 431.122Sapb awk .WAIT \ 441.16Stv lex .WAIT \ 451.32Stv ${TOOLCHAIN_BITS} \ 461.114Sjmmv asn1_compile atf-compile cat cksum compile_et config db \ 471.127Ssketch file lint1 \ 481.90Sdyoung makefs menuc mkcsmapper mkesdb mklocale mknod msgc \ 491.90Sdyoung pax .WAIT \ 501.92Sjmc disklabel .WAIT \ 511.110Sriz paxctl .WAIT \ 521.92Sjmc fdisk .WAIT \ 531.92Sjmc installboot .WAIT \ 541.119Sapb pwd_mkdb stat strfile sunlabel zic 551.39Stv 561.121Sdyoung.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 571.39StvSUBDIR+= groff 581.128Sjoerg. if ${MKMANDOC} == "yes" 591.128SjoergSUBDIR+= mandoc 601.128Sjoerg. endif 611.39Stv.endif 621.22Stv 631.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no" 641.103SlukemSUBDIR+= autoconf .WAIT gettext 651.72Smatt.endif 661.72Smatt 671.86Sjmc.if ${MACHINE} == "hp700" 681.83SskrllSUBDIR+= hp700-mkboot 691.83Sskrll.endif 701.83Sskrll 711.86Sjmc.if ${MACHINE} == "ibmnws" 721.72SmattSUBDIR+= ibmnws-ncdcs 731.79Smatt.endif 741.79Smatt 751.86Sjmc.if ${MACHINE} == "macppc" 761.79SmattSUBDIR+= macppc-fixcoff 771.48Skleink.endif 781.48Skleink 791.116Sgarbled.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 801.115SgarbledSUBDIR+= powerpc-mkbootimage 811.22Stv.endif 821.37Sgmcgarry 831.37Sgmcgarry.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb") 841.37SgmcgarrySUBDIR+= mips-elf2ecoff 851.76Ssekiya.endif 861.76Ssekiya 871.76Ssekiya.if (${MACHINE} == "sgimips") 881.76SsekiyaSUBDIR+= sgivol 891.51Sbjh21.endif 901.51Sbjh21 911.82Sabs.if ${MACHINE} == "acorn32" 921.82SabsSUBDIR+= sparkcrc 931.82Sabs.endif 941.82Sabs 951.125Sabs.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 961.51Sbjh21SUBDIR+= fgen 971.37Sgmcgarry.endif 981.37Sgmcgarry 991.85Sjmc.if ${MACHINE} == "amiga" 1001.85SjmcSUBDIR+= amiga-elf2bb 1011.85SjmcSUBDIR+= amiga-txlt 1021.85Sjmc.endif 1031.85Sjmc 1041.86Sjmc.if ${MACHINE} == "hp300" 1051.86SjmcSUBDIR+= hp300-mkboot 1061.86Sjmc.endif 1071.86Sjmc 1081.66Slukemcheck_MKTOOLS: .PHONY .NOTMAIN 1091.19Sjmc.if ${MKTOOLS:Uyes} == "no" 1101.17Stv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 1111.17Stv @echo '*** updating your host toolchain. This should be used only as a' 1121.17Stv @echo '*** temporary workaround for toolchain problems, as it will result' 1131.23Swiz @echo '*** in version skew and build errors over time!' 1141.18Sjmc.endif 1151.17Stv 1161.66Slukem.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 1171.67Slukemrealall realdepend install: check_MKTOOLS 1181.66Slukem 1191.17Stv.for dir in ${SUBDIR:N.WAIT} 1201.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}: 1211.17Stv @true 1221.17Stv.endfor 1231.66Slukem.endif # } 1241.1Stv 1251.1Stv.include <bsd.subdir.mk> 1261.11Stv.include <bsd.obj.mk> 1271.16Stv 1281.102Stron.if !defined(PREVIOUSTOOLDIR) 1291.102Stron. if exists(PREVIOUSTOOLDIR) 1301.66SlukemPREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 1311.102Stron. else 1321.66SlukemPREVIOUSTOOLDIR= 1331.102Stron. endif 1341.66Slukem.endif 1351.66Slukem 1361.66SlukemCLEANFILES+= PREVIOUSTOOLDIR 1371.66Slukem 1381.101Stronrealall realdepend: .MAKE 1391.107Sapb.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 1401.66Slukem @echo "*** WARNING: TOOLDIR has moved?" 1411.66Slukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 1421.66Slukem @echo "*** != TOOLDIR '${TOOLDIR}'" 1431.66Slukem @echo "*** Cleaning mis-matched tools" 1441.66Slukem rm -f PREVIOUSTOOLDIR 1451.106Sfreza (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 1461.66Slukem.endif 1471.102Stron echo ${TOOLDIR} >PREVIOUSTOOLDIR 1481.66Slukem 1491.40Stv# For each .WAIT point, make sure the immediately preceding target is 1501.40Stv# installed before building anything after that point. 1511.109Sdsl# (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the 1521.109Sdsl# install of 'b', but not the install of 'a'.) 1531.36Spk# 1541.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 1551.36Spk# to achieve this. These targets look like: 1561.36Spk# subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 1571.36Spk# subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 1581.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at 1591.36Spk# places corresponding to the .WAITs in our $SUBDIR variable. 1601.36Spk# 1611.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets 1621.36Spk# an order relationship between those in each individual subdirectory 1631.36Spk# must be established. 1641.36Spk# 1651.40Stv_deps:= 1661.40Stv_prev:= 1671.40Stv 1681.123Sapb.for d in ${SUBDIR} # { 1691.16Stv_this:= ${d} 1701.40Stv 1711.123Sapb.if ${_this} == ".WAIT" # { 1721.36Spk 1731.36Spk# setup dependency to apply to all/depend targets in the next group 1741.40Stv_deps:= ${_deps} ${_prev:S/^/install-/} 1751.40Stv 1761.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"), 1771.40Stv# make sure prerequisite tools build before installing 1781.109Sdsl# XXX: dsl: this is likely to generate a dependency loop since there is 1791.109Sdsl# a .ORDER releation between the nodes as well. 1801.109Sdsl.if !make(all) && !make(dependall) && !make(install) 1811.40Stvinstall-${_prev}: dependall-${_prev} 1821.40Stv.endif 1831.36Spk 1841.123Sapb.else # ${_this} != ".WAIT" # } { 1851.36Spk 1861.109Sdsl# order depend/all/install targets for ${d} subdir. 1871.109Sdsl.ORDER: depend-${d} all-${d} dependall-${d} install-${d} 1881.40Stv 1891.106Sfreza# prevent cleandir in real{all,depend} from interfering with subdir makes 1901.106Sfreza.ORDER: realdepend dependall-${d} 1911.106Sfreza.ORDER: realdepend depend-${d} 1921.106Sfreza.ORDER: realall all-${d} 1931.106Sfreza 1941.40Stv# make all/depend-${d} dependent on list of install targets 1951.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps} 1961.36Spk 1971.123Sapb.endif # ${_this} != ".WAIT" # } 1981.40Stv 1991.40Stv# stash current name in case the next entry is .WAIT 2001.40Stv_prev:= ${d} 2011.123Sapb.endfor # } 2021.69Stron 2031.69Stroncleandir: 2041.69Stron rm -f ${CLEANFILES} 205