Makefile revision 1.135
11.135Sroy# $NetBSD: Makefile,v 1.135 2010/02/03 20:56:54 roy 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.135Sroy lorder makewhatis mkdep mtree rpcgen tic tsort \ 411.134Sroy uudecode m4 \ 421.132Smrg .WAIT texinfo \ 431.132Smrg .WAIT yacc \ 441.132Smrg .WAIT awk \ 451.132Smrg .WAIT lex \ 461.132Smrg .WAIT pax \ 471.132Smrg .WAIT ${TOOLCHAIN_BITS} \ 481.114Sjmmv asn1_compile atf-compile cat cksum compile_et config db \ 491.127Ssketch file lint1 \ 501.90Sdyoung makefs menuc mkcsmapper mkesdb mklocale mknod msgc \ 511.132Smrg .WAIT disklabel \ 521.132Smrg .WAIT paxctl \ 531.132Smrg .WAIT fdisk \ 541.132Smrg .WAIT installboot \ 551.119Sapb pwd_mkdb stat strfile sunlabel zic 561.39Stv 571.121Sdyoung.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 581.39StvSUBDIR+= groff 591.128Sjoerg. if ${MKMANDOC} == "yes" 601.128SjoergSUBDIR+= mandoc 611.128Sjoerg. endif 621.39Stv.endif 631.22Stv 641.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no" 651.103SlukemSUBDIR+= autoconf .WAIT gettext 661.72Smatt.endif 671.72Smatt 681.86Sjmc.if ${MACHINE} == "hp700" 691.83SskrllSUBDIR+= hp700-mkboot 701.83Sskrll.endif 711.83Sskrll 721.86Sjmc.if ${MACHINE} == "ibmnws" 731.72SmattSUBDIR+= ibmnws-ncdcs 741.79Smatt.endif 751.79Smatt 761.86Sjmc.if ${MACHINE} == "macppc" 771.79SmattSUBDIR+= macppc-fixcoff 781.48Skleink.endif 791.48Skleink 801.116Sgarbled.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 811.115SgarbledSUBDIR+= powerpc-mkbootimage 821.22Stv.endif 831.37Sgmcgarry 841.37Sgmcgarry.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb") 851.37SgmcgarrySUBDIR+= mips-elf2ecoff 861.76Ssekiya.endif 871.76Ssekiya 881.76Ssekiya.if (${MACHINE} == "sgimips") 891.76SsekiyaSUBDIR+= sgivol 901.51Sbjh21.endif 911.51Sbjh21 921.82Sabs.if ${MACHINE} == "acorn32" 931.82SabsSUBDIR+= sparkcrc 941.82Sabs.endif 951.82Sabs 961.125Sabs.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 971.51Sbjh21SUBDIR+= fgen 981.37Sgmcgarry.endif 991.37Sgmcgarry 1001.85Sjmc.if ${MACHINE} == "amiga" 1011.85SjmcSUBDIR+= amiga-elf2bb 1021.85SjmcSUBDIR+= amiga-txlt 1031.85Sjmc.endif 1041.85Sjmc 1051.86Sjmc.if ${MACHINE} == "hp300" 1061.86SjmcSUBDIR+= hp300-mkboot 1071.86Sjmc.endif 1081.86Sjmc 1091.66Slukemcheck_MKTOOLS: .PHONY .NOTMAIN 1101.19Sjmc.if ${MKTOOLS:Uyes} == "no" 1111.17Stv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 1121.17Stv @echo '*** updating your host toolchain. This should be used only as a' 1131.17Stv @echo '*** temporary workaround for toolchain problems, as it will result' 1141.23Swiz @echo '*** in version skew and build errors over time!' 1151.18Sjmc.endif 1161.17Stv 1171.66Slukem.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 1181.67Slukemrealall realdepend install: check_MKTOOLS 1191.66Slukem 1201.17Stv.for dir in ${SUBDIR:N.WAIT} 1211.17Stvall-${dir} depend-${dir} dependall-${dir} install-${dir}: 1221.17Stv @true 1231.17Stv.endfor 1241.66Slukem.endif # } 1251.1Stv 1261.1Stv.include <bsd.subdir.mk> 1271.11Stv.include <bsd.obj.mk> 1281.16Stv 1291.102Stron.if !defined(PREVIOUSTOOLDIR) 1301.102Stron. if exists(PREVIOUSTOOLDIR) 1311.66SlukemPREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 1321.102Stron. else 1331.66SlukemPREVIOUSTOOLDIR= 1341.102Stron. endif 1351.66Slukem.endif 1361.66Slukem 1371.66SlukemCLEANFILES+= PREVIOUSTOOLDIR 1381.66Slukem 1391.101Stronrealall realdepend: .MAKE 1401.107Sapb.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 1411.66Slukem @echo "*** WARNING: TOOLDIR has moved?" 1421.66Slukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 1431.66Slukem @echo "*** != TOOLDIR '${TOOLDIR}'" 1441.66Slukem @echo "*** Cleaning mis-matched tools" 1451.66Slukem rm -f PREVIOUSTOOLDIR 1461.106Sfreza (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 1471.66Slukem.endif 1481.102Stron echo ${TOOLDIR} >PREVIOUSTOOLDIR 1491.66Slukem 1501.40Stv# For each .WAIT point, make sure the immediately preceding target is 1511.40Stv# installed before building anything after that point. 1521.109Sdsl# (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the 1531.109Sdsl# install of 'b', but not the install of 'a'.) 1541.36Spk# 1551.36Spk# We use the "internal" targets and dependencies generated by <bsd.subdir.mk> 1561.36Spk# to achieve this. These targets look like: 1571.36Spk# subdir-all: all-dir1 [.WAIT] all-dir2 etc.. 1581.36Spk# subdir-install: install-dir1 [.WAIT] install-dir2 etc.. 1591.36Spk# and so on for each element in ${TARGETS}, with .WAIT sources inserted at 1601.36Spk# places corresponding to the .WAITs in our $SUBDIR variable. 1611.36Spk# 1621.36Spk# Also, since we're now mixing `install' with `all' and `depend' targets 1631.36Spk# an order relationship between those in each individual subdirectory 1641.36Spk# must be established. 1651.36Spk# 1661.40Stv_deps:= 1671.40Stv_prev:= 1681.40Stv 1691.123Sapb.for d in ${SUBDIR} # { 1701.16Stv_this:= ${d} 1711.40Stv 1721.123Sapb.if ${_this} == ".WAIT" # { 1731.36Spk 1741.36Spk# setup dependency to apply to all/depend targets in the next group 1751.40Stv_deps:= ${_deps} ${_prev:S/^/install-/} 1761.40Stv 1771.40Stv# if we're building *only* individual targets (i.e. "dependall-yacc"), 1781.40Stv# make sure prerequisite tools build before installing 1791.109Sdsl# XXX: dsl: this is likely to generate a dependency loop since there is 1801.109Sdsl# a .ORDER releation between the nodes as well. 1811.109Sdsl.if !make(all) && !make(dependall) && !make(install) 1821.40Stvinstall-${_prev}: dependall-${_prev} 1831.40Stv.endif 1841.36Spk 1851.123Sapb.else # ${_this} != ".WAIT" # } { 1861.36Spk 1871.109Sdsl# order depend/all/install targets for ${d} subdir. 1881.109Sdsl.ORDER: depend-${d} all-${d} dependall-${d} install-${d} 1891.40Stv 1901.106Sfreza# prevent cleandir in real{all,depend} from interfering with subdir makes 1911.106Sfreza.ORDER: realdepend dependall-${d} 1921.106Sfreza.ORDER: realdepend depend-${d} 1931.106Sfreza.ORDER: realall all-${d} 1941.106Sfreza 1951.40Stv# make all/depend-${d} dependent on list of install targets 1961.40Stvdepend-${d} all-${d} dependall-${d}: ${_deps} 1971.36Spk 1981.123Sapb.endif # ${_this} != ".WAIT" # } 1991.40Stv 2001.40Stv# stash current name in case the next entry is .WAIT 2011.40Stv_prev:= ${d} 2021.123Sapb.endfor # } 2031.69Stron 2041.69Stroncleandir: 2051.69Stron rm -f ${CLEANFILES} 206