Makefile revision 1.172
11.172Sozaki# $NetBSD: Makefile,v 1.172 2014/03/25 09:52:56 ozaki-r 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.160Spooka.if defined(HAVE_GCC) 291.94SjmcTOOLCHAIN_BITS= gmake .WAIT 301.156Sjoerg.endif 311.156Sjoerg 321.156Sjoerg.if defined(HAVE_GCC) 331.146Smrg.if ${HAVE_GCC} >= 45 341.146SmrgTOOLCHAIN_BITS+= gmp .WAIT 351.146SmrgTOOLCHAIN_BITS+= mpfr .WAIT 361.146SmrgTOOLCHAIN_BITS+= mpc .WAIT 371.94Sjmc.endif 381.156Sjoerg.endif 391.156Sjoerg.endif 401.156Sjoerg 411.156Sjoerg.if ${TOOLCHAIN_MISSING} == "no" 421.94SjmcTOOLCHAIN_BITS+= binutils .WAIT 431.156Sjoerg.endif 441.156Sjoerg 451.156Sjoerg.if defined(HAVE_GCC) 461.156Sjoerg.if ${TOOLCHAIN_MISSING} == "no" 471.77SmrgTOOLCHAIN_BITS+= gcc 481.169Smatt. if ${MKCROSSGDB:Uno} != "no" || make(obj) 491.74SclTOOLCHAIN_BITS+= gdb 501.70Smrg. endif 511.156SjoergTOOLCHAIN_BITS+= .WAIT 521.31Stv.endif 531.118Sgmcgarry.endif 541.118Sgmcgarry 551.118Sgmcgarry.if defined(HAVE_PCC) 561.118Sgmcgarry.if ${TOOLCHAIN_MISSING} == "no" 571.118SgmcgarryTOOLCHAIN_BITS+= pcc 581.118Sgmcgarry.endif 591.118Sgmcgarry.endif 601.31Stv 611.157Spooka.if ${TOOLCHAIN_MISSING} == "no" 621.157Spooka# XXX Eventually, we want to be able to build dbsym and mdsetimage 631.157Spooka# XXX if EXTERNAL_TOOLCHAIN is set. 641.156SjoergTOOLCHAIN_BITS+= dbsym mdsetimage 651.157Spooka.endif 661.156Sjoerg 671.137SdarranDTRACE_BITS= 681.137Sdarran.if ${MKDTRACE} != "no" 691.137SdarranDTRACE_BITS+= .WAIT libelf 701.137SdarranDTRACE_BITS+= .WAIT libdwarf 711.162SapbDTRACE_BITS+= .WAIT libctf 721.172Sozaki.endif 731.172Sozaki.if ${MKCTF} != "no" 741.137SdarranDTRACE_BITS+= .WAIT ctfconvert ctfmerge 751.137Sdarran.endif 761.137Sdarran 771.99SmrgLINT_BITS= 781.99Smrg.if ${MKLINT} != "no" 791.99SmrgLINT_BITS= lint lint2 801.99Smrg.endif 811.99Smrg 821.165Sapb# All of host-mkdep, compat, and binstall are needed before anything 831.165Sapb# else. Within this group, they must be built in a specific order, and 841.165Sapb# all of them must be built before any of them is installed. They may 851.165Sapb# be installed in any order. This can't be expressed using the .WAIT 861.165Sapb# notation inside the SUBDIR list. 871.165Sapb# 881.165Sapb# XXX .ORDER does not work when multiple targets are passed on the 891.165Sapb# make command line without "-j", so use dependencies in addition to .ORDER. 901.165Sapb# 911.165Sapb.ORDER: dependall-host-mkdep dependall-compat dependall-binstall 921.165Sapb.if make(dependall-host-mkdep) && make(dependall-compat) 931.165Sapbdependall-compat: dependall-host-mkdep 941.165Sapb.endif 951.165Sapb.if make(dependall-compat) && make(dependall-binstall) 961.165Sapbdependall-binstall: dependall-compat 971.165Sapb.endif 981.165Sapb 991.16Stv# Dependencies in SUBDIR below ordered to maximize parallel ability. 1001.165Sapb# See above for special treatment for host-mkdep, compat, and binstall. 1011.165Sapb# 1021.165SapbSUBDIR= host-mkdep compat binstall \ 1031.166Spooka .WAIT mktemp .WAIT sed .WAIT 1041.166Spooka.if ${TOOLS_BUILDRUMP} == "no" 1051.166SpookaSUBDIR+= cap_mkdb crunchgen ctags genassym gencat hexdump \ 1061.99Smrg ${LINT_BITS} \ 1071.166Spooka makewhatis mtree nbperf .WAIT rpcgen uudecode 1081.166Spooka.endif 1091.166Spooka 1101.166SpookaSUBDIR+= join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex 1111.166Spooka 1121.166Spooka.if ${TOOLS_BUILDRUMP} == "no" 1131.166SpookaSUBDIR += .WAIT texinfo \ 1141.153Schristos .WAIT tic \ 1151.132Smrg .WAIT pax \ 1161.132Smrg .WAIT ${TOOLCHAIN_BITS} \ 1171.137Sdarran ${DTRACE_BITS} \ 1181.166Spooka asn1_compile cat cksum compile_et db \ 1191.145Selric file lint1 slc \ 1201.144Sriz makefs .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \ 1211.132Smrg .WAIT disklabel \ 1221.132Smrg .WAIT paxctl \ 1231.132Smrg .WAIT fdisk \ 1241.132Smrg .WAIT installboot \ 1251.154Snjoly pwd_mkdb stat strfile sunlabel zic 1261.166Spooka.endif 1271.166SpookaSUBDIR+= .WAIT config 1281.39Stv 1291.142Sjoerg.if ${MKLLVM} != "no" 1301.142SjoergSUBDIR+= \ 1311.142Sjoerg llvm .WAIT \ 1321.149Sjoerg llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 1331.159Sjoerg llvm-tblgen llvm-clang-tblgen .WAIT \ 1341.142Sjoerg llvm-include .WAIT \ 1351.142Sjoerg llvm-lib .WAIT \ 1361.142Sjoerg llvm-clang 1371.170Sjoerg.if ${MKLLD} != "no" 1381.170SjoergSUBDIR+= llvm-lld 1391.170Sjoerg.endif 1401.168Sjoerg.if ${MKMCLINKER} != "no" 1411.168SjoergSUBDIR+= llvm-mcld 1421.168Sjoerg.endif 1431.142Sjoerg.endif 1441.142Sjoerg 1451.121Sdyoung.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 1461.136Sjoerg. if ${MKGROFF} != "no" 1471.39StvSUBDIR+= groff 1481.136Sjoerg. endif 1491.128SjoergSUBDIR+= mandoc 1501.39Stv.endif 1511.22Stv 1521.166Spooka.if ${TOOLS_BUILDRUMP} == "no" 1531.166Spooka 1541.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no" 1551.103SlukemSUBDIR+= autoconf .WAIT gettext 1561.72Smatt.endif 1571.72Smatt 1581.140Smrg.if ${USE_PIGZGZIP} != "no" 1591.140SmrgSUBDIR+= pigz 1601.140Smrg.endif 1611.140Smrg 1621.171Sskrll.if ${MACHINE} == "hppa" 1631.171SskrllSUBDIR+= hppa-mkboot 1641.83Sskrll.endif 1651.83Sskrll 1661.86Sjmc.if ${MACHINE} == "ibmnws" 1671.72SmattSUBDIR+= ibmnws-ncdcs 1681.79Smatt.endif 1691.79Smatt 1701.86Sjmc.if ${MACHINE} == "macppc" 1711.79SmattSUBDIR+= macppc-fixcoff 1721.48Skleink.endif 1731.48Skleink 1741.116Sgarbled.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 1751.115SgarbledSUBDIR+= powerpc-mkbootimage 1761.22Stv.endif 1771.37Sgmcgarry 1781.148Stsutsui.if ${MACHINE_ARCH} == "m68k" 1791.148StsutsuiSUBDIR+= m68k-elf2aout 1801.148Stsutsui.endif 1811.148Stsutsui 1821.147Smrg.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ 1831.147Smrg ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") 1841.37SgmcgarrySUBDIR+= mips-elf2ecoff 1851.76Ssekiya.endif 1861.76Ssekiya 1871.76Ssekiya.if (${MACHINE} == "sgimips") 1881.76SsekiyaSUBDIR+= sgivol 1891.51Sbjh21.endif 1901.51Sbjh21 1911.82Sabs.if ${MACHINE} == "acorn32" 1921.82SabsSUBDIR+= sparkcrc 1931.82Sabs.endif 1941.82Sabs 1951.125Sabs.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 1961.51Sbjh21SUBDIR+= fgen 1971.37Sgmcgarry.endif 1981.37Sgmcgarry 1991.85Sjmc.if ${MACHINE} == "amiga" 2001.85SjmcSUBDIR+= amiga-elf2bb 2011.85SjmcSUBDIR+= amiga-txlt 2021.85Sjmc.endif 2031.85Sjmc 2041.86Sjmc.if ${MACHINE} == "hp300" 2051.86SjmcSUBDIR+= hp300-mkboot 2061.86Sjmc.endif 2071.86Sjmc 2081.167Smatt.if ${MACHINE} == "evbarm" \ 2091.167Smatt && ${MACHINE_CPU} == "arm" \ 2101.167Smatt && ${TARGET_ENDIANNESS} == "1234" 2111.158SjkunzSUBDIR+= elftosb 2121.158Sjkunz.endif 2131.158Sjkunz 2141.143Sphx.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 2151.143Sphx ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint" 2161.139SjmcneillSUBDIR+= mkubootimage 2171.139Sjmcneill.endif 2181.139Sjmcneill 2191.166Spooka.endif # TOOLCHAIN_BUILDRUMP 2201.166Spooka 2211.66Slukemcheck_MKTOOLS: .PHONY .NOTMAIN 2221.19Sjmc.if ${MKTOOLS:Uyes} == "no" 2231.17Stv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 2241.17Stv @echo '*** updating your host toolchain. This should be used only as a' 2251.17Stv @echo '*** temporary workaround for toolchain problems, as it will result' 2261.23Swiz @echo '*** in version skew and build errors over time!' 2271.18Sjmc.endif 2281.17Stv 2291.66Slukem.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 2301.163SapbSUBDIR= # empty 2311.67Slukemrealall realdepend install: check_MKTOOLS 2321.66Slukem.endif # } 2331.1Stv 2341.1Stv.include <bsd.subdir.mk> 2351.159Sjoerg.include <bsd.buildinstall.mk> 2361.11Stv.include <bsd.obj.mk> 2371.16Stv 2381.102Stron.if !defined(PREVIOUSTOOLDIR) 2391.102Stron. if exists(PREVIOUSTOOLDIR) 2401.66SlukemPREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 2411.102Stron. else 2421.162SapbPREVIOUSTOOLDIR= 2431.102Stron. endif 2441.66Slukem.endif 2451.66Slukem 2461.66SlukemCLEANFILES+= PREVIOUSTOOLDIR 2471.66Slukem 2481.101Stronrealall realdepend: .MAKE 2491.107Sapb.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 2501.66Slukem @echo "*** WARNING: TOOLDIR has moved?" 2511.66Slukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 2521.66Slukem @echo "*** != TOOLDIR '${TOOLDIR}'" 2531.66Slukem @echo "*** Cleaning mis-matched tools" 2541.66Slukem rm -f PREVIOUSTOOLDIR 2551.106Sfreza (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 2561.66Slukem.endif 2571.102Stron echo ${TOOLDIR} >PREVIOUSTOOLDIR 2581.66Slukem 2591.69Stroncleandir: 2601.69Stron rm -f ${CLEANFILES} 261