Makefile revision 1.176
11.176Schristos# $NetBSD: Makefile,v 1.176 2014/07/15 13:19:44 christos Exp $ 21.1Stv 31.3Stv.include <bsd.own.mk> 41.167Smatt.include <bsd.endian.mk> 51.3Stv 61.159Sjoerg# Make sure that the ordered build/install processing applies when using 71.159Sjoerg# plain make. 81.159Sjoerg.MAIN: build_install 91.159Sjoerg 101.164Sapb# TOOLDIR must be valid, unless MKTOOLS=no 111.164Sapb.if ${MKTOOLS:Uyes} != "no" 121.164Sapb.if "${TOOLDIR}" == "" 131.164Sapb.error "TOOLDIR is undefined or empty" 141.164Sapb.elif "${TOOLDIR:tW:M/*}" == "" 151.164Sapb.error "TOOLDIR is not an absolute path: ${TOOLDIR}" 161.164Sapb#.elif !exists(TOOLDIR) # XXX .exists fails for directories 171.164Sapb#.error "TOOLDIR does not exist: ${TOOLDIR}" 181.164Sapb.endif 191.164Sapb.endif # MKTOOLS != no 201.164Sapb 211.166Spooka# TOOLS_BUILDRUMP == yes builds only the subset of the tools required 221.166Spooka# for building rump kernels and the hypervisor. It is typically used 231.166Spooka# when building rump kernels targeted for non-NetBSD systems (via 241.166Spooka# buildrump.sh), and should not be set for a regular "make build". 251.166SpookaTOOLS_BUILDRUMP?=no 261.166Spooka 271.160Spooka.if ${TOOLCHAIN_MISSING} == "no" 281.174Smrg. if defined(HAVE_GCC) 291.94SjmcTOOLCHAIN_BITS= gmake .WAIT 301.146SmrgTOOLCHAIN_BITS+= gmp .WAIT 311.146SmrgTOOLCHAIN_BITS+= mpfr .WAIT 321.146SmrgTOOLCHAIN_BITS+= mpc .WAIT 331.174Smrg. endif 341.156Sjoerg.endif 351.156Sjoerg 361.156Sjoerg.if ${TOOLCHAIN_MISSING} == "no" 371.94SjmcTOOLCHAIN_BITS+= binutils .WAIT 381.156Sjoerg.endif 391.156Sjoerg 401.156Sjoerg.if defined(HAVE_GCC) 411.174Smrg. if ${TOOLCHAIN_MISSING} == "no" 421.77SmrgTOOLCHAIN_BITS+= gcc 431.169Smatt. if ${MKCROSSGDB:Uno} != "no" || make(obj) 441.74SclTOOLCHAIN_BITS+= gdb 451.70Smrg. endif 461.156SjoergTOOLCHAIN_BITS+= .WAIT 471.174Smrg. endif 481.118Sgmcgarry.endif 491.118Sgmcgarry 501.118Sgmcgarry.if defined(HAVE_PCC) 511.174Smrg. if ${TOOLCHAIN_MISSING} == "no" 521.118SgmcgarryTOOLCHAIN_BITS+= pcc 531.174Smrg. endif 541.118Sgmcgarry.endif 551.31Stv 561.157Spooka.if ${TOOLCHAIN_MISSING} == "no" 571.157Spooka# XXX Eventually, we want to be able to build dbsym and mdsetimage 581.157Spooka# XXX if EXTERNAL_TOOLCHAIN is set. 591.156SjoergTOOLCHAIN_BITS+= dbsym mdsetimage 601.157Spooka.endif 611.156Sjoerg 621.137SdarranDTRACE_BITS= 631.173Sriastrad.if ${MKDTRACE} != "no" || ${MKCTF} != "no" 641.137SdarranDTRACE_BITS+= .WAIT libelf 651.137SdarranDTRACE_BITS+= .WAIT libdwarf 661.162SapbDTRACE_BITS+= .WAIT libctf 671.172Sozaki.endif 681.172Sozaki.if ${MKCTF} != "no" 691.137SdarranDTRACE_BITS+= .WAIT ctfconvert ctfmerge 701.137Sdarran.endif 711.137Sdarran 721.99SmrgLINT_BITS= 731.99Smrg.if ${MKLINT} != "no" 741.99SmrgLINT_BITS= lint lint2 751.99Smrg.endif 761.99Smrg 771.165Sapb# All of host-mkdep, compat, and binstall are needed before anything 781.165Sapb# else. Within this group, they must be built in a specific order, and 791.165Sapb# all of them must be built before any of them is installed. They may 801.165Sapb# be installed in any order. This can't be expressed using the .WAIT 811.165Sapb# notation inside the SUBDIR list. 821.165Sapb# 831.165Sapb# XXX .ORDER does not work when multiple targets are passed on the 841.165Sapb# make command line without "-j", so use dependencies in addition to .ORDER. 851.165Sapb# 861.165Sapb.ORDER: dependall-host-mkdep dependall-compat dependall-binstall 871.165Sapb.if make(dependall-host-mkdep) && make(dependall-compat) 881.165Sapbdependall-compat: dependall-host-mkdep 891.165Sapb.endif 901.165Sapb.if make(dependall-compat) && make(dependall-binstall) 911.165Sapbdependall-binstall: dependall-compat 921.165Sapb.endif 931.165Sapb 941.16Stv# Dependencies in SUBDIR below ordered to maximize parallel ability. 951.165Sapb# See above for special treatment for host-mkdep, compat, and binstall. 961.165Sapb# 971.165SapbSUBDIR= host-mkdep compat binstall \ 981.166Spooka .WAIT mktemp .WAIT sed .WAIT 991.166Spooka.if ${TOOLS_BUILDRUMP} == "no" 1001.166SpookaSUBDIR+= cap_mkdb crunchgen ctags genassym gencat hexdump \ 1011.99Smrg ${LINT_BITS} \ 1021.175Spooka makewhatis mtree nbperf .WAIT uudecode 1031.166Spooka.endif 1041.166Spooka 1051.175SpookaSUBDIR+= cat rpcgen join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex 1061.166Spooka 1071.166Spooka.if ${TOOLS_BUILDRUMP} == "no" 1081.166SpookaSUBDIR += .WAIT texinfo \ 1091.153Schristos .WAIT tic \ 1101.132Smrg .WAIT pax \ 1111.132Smrg .WAIT ${TOOLCHAIN_BITS} \ 1121.137Sdarran ${DTRACE_BITS} \ 1131.175Spooka asn1_compile cksum compile_et db \ 1141.145Selric file lint1 slc \ 1151.144Sriz makefs .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \ 1161.132Smrg .WAIT disklabel \ 1171.132Smrg .WAIT paxctl \ 1181.132Smrg .WAIT fdisk \ 1191.132Smrg .WAIT installboot \ 1201.176Schristos pwd_mkdb strfile sunlabel vgrind zic 1211.166Spooka.endif 1221.175SpookaSUBDIR+= stat .WAIT config 1231.39Stv 1241.142Sjoerg.if ${MKLLVM} != "no" 1251.142SjoergSUBDIR+= \ 1261.142Sjoerg llvm .WAIT \ 1271.149Sjoerg llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 1281.159Sjoerg llvm-tblgen llvm-clang-tblgen .WAIT \ 1291.142Sjoerg llvm-include .WAIT \ 1301.142Sjoerg llvm-lib .WAIT \ 1311.142Sjoerg llvm-clang 1321.174Smrg. if ${MKLLD} != "no" 1331.170SjoergSUBDIR+= llvm-lld 1341.174Smrg. endif 1351.174Smrg. if ${MKMCLINKER} != "no" 1361.168SjoergSUBDIR+= llvm-mcld 1371.174Smrg. endif 1381.142Sjoerg.endif 1391.142Sjoerg 1401.121Sdyoung.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 1411.174Smrg. if ${MKGROFF} != "no" 1421.39StvSUBDIR+= groff 1431.174Smrg. endif 1441.128SjoergSUBDIR+= mandoc 1451.39Stv.endif 1461.22Stv 1471.166Spooka.if ${TOOLS_BUILDRUMP} == "no" 1481.166Spooka 1491.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no" 1501.103SlukemSUBDIR+= autoconf .WAIT gettext 1511.72Smatt.endif 1521.72Smatt 1531.140Smrg.if ${USE_PIGZGZIP} != "no" 1541.140SmrgSUBDIR+= pigz 1551.140Smrg.endif 1561.140Smrg 1571.171Sskrll.if ${MACHINE} == "hppa" 1581.171SskrllSUBDIR+= hppa-mkboot 1591.83Sskrll.endif 1601.83Sskrll 1611.86Sjmc.if ${MACHINE} == "ibmnws" 1621.72SmattSUBDIR+= ibmnws-ncdcs 1631.79Smatt.endif 1641.79Smatt 1651.86Sjmc.if ${MACHINE} == "macppc" 1661.79SmattSUBDIR+= macppc-fixcoff 1671.48Skleink.endif 1681.48Skleink 1691.116Sgarbled.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 1701.115SgarbledSUBDIR+= powerpc-mkbootimage 1711.22Stv.endif 1721.37Sgmcgarry 1731.148Stsutsui.if ${MACHINE_ARCH} == "m68k" 1741.148StsutsuiSUBDIR+= m68k-elf2aout 1751.148Stsutsui.endif 1761.148Stsutsui 1771.147Smrg.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ 1781.147Smrg ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") 1791.37SgmcgarrySUBDIR+= mips-elf2ecoff 1801.76Ssekiya.endif 1811.76Ssekiya 1821.76Ssekiya.if (${MACHINE} == "sgimips") 1831.76SsekiyaSUBDIR+= sgivol 1841.51Sbjh21.endif 1851.51Sbjh21 1861.82Sabs.if ${MACHINE} == "acorn32" 1871.82SabsSUBDIR+= sparkcrc 1881.82Sabs.endif 1891.82Sabs 1901.125Sabs.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 1911.51Sbjh21SUBDIR+= fgen 1921.37Sgmcgarry.endif 1931.37Sgmcgarry 1941.85Sjmc.if ${MACHINE} == "amiga" 1951.85SjmcSUBDIR+= amiga-elf2bb 1961.85SjmcSUBDIR+= amiga-txlt 1971.85Sjmc.endif 1981.85Sjmc 1991.86Sjmc.if ${MACHINE} == "hp300" 2001.86SjmcSUBDIR+= hp300-mkboot 2011.86Sjmc.endif 2021.86Sjmc 2031.167Smatt.if ${MACHINE} == "evbarm" \ 2041.167Smatt && ${MACHINE_CPU} == "arm" \ 2051.167Smatt && ${TARGET_ENDIANNESS} == "1234" 2061.158SjkunzSUBDIR+= elftosb 2071.158Sjkunz.endif 2081.158Sjkunz 2091.143Sphx.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 2101.143Sphx ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint" 2111.139SjmcneillSUBDIR+= mkubootimage 2121.139Sjmcneill.endif 2131.139Sjmcneill 2141.166Spooka.endif # TOOLCHAIN_BUILDRUMP 2151.166Spooka 2161.66Slukemcheck_MKTOOLS: .PHONY .NOTMAIN 2171.19Sjmc.if ${MKTOOLS:Uyes} == "no" 2181.17Stv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 2191.17Stv @echo '*** updating your host toolchain. This should be used only as a' 2201.17Stv @echo '*** temporary workaround for toolchain problems, as it will result' 2211.23Swiz @echo '*** in version skew and build errors over time!' 2221.18Sjmc.endif 2231.17Stv 2241.66Slukem.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 2251.163SapbSUBDIR= # empty 2261.67Slukemrealall realdepend install: check_MKTOOLS 2271.66Slukem.endif # } 2281.1Stv 2291.1Stv.include <bsd.subdir.mk> 2301.159Sjoerg.include <bsd.buildinstall.mk> 2311.11Stv.include <bsd.obj.mk> 2321.16Stv 2331.102Stron.if !defined(PREVIOUSTOOLDIR) 2341.102Stron. if exists(PREVIOUSTOOLDIR) 2351.66SlukemPREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 2361.102Stron. else 2371.162SapbPREVIOUSTOOLDIR= 2381.102Stron. endif 2391.66Slukem.endif 2401.66Slukem 2411.66SlukemCLEANFILES+= PREVIOUSTOOLDIR 2421.66Slukem 2431.101Stronrealall realdepend: .MAKE 2441.107Sapb.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 2451.66Slukem @echo "*** WARNING: TOOLDIR has moved?" 2461.66Slukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 2471.66Slukem @echo "*** != TOOLDIR '${TOOLDIR}'" 2481.66Slukem @echo "*** Cleaning mis-matched tools" 2491.66Slukem rm -f PREVIOUSTOOLDIR 2501.106Sfreza (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 2511.66Slukem.endif 2521.102Stron echo ${TOOLDIR} >PREVIOUSTOOLDIR 2531.66Slukem 2541.69Stroncleandir: 2551.69Stron rm -f ${CLEANFILES} 256