Makefile revision 1.201
11.201Sjoerg# $NetBSD: Makefile,v 1.201 2019/04/03 15:22:05 joerg 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.177Smatt. if defined(HAVE_GCC) && ${HAVE_GCC} > 0 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.177Smatt.if defined(HAVE_GCC) && ${HAVE_GCC} > 0 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.192Schristos.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN) 571.156SjoergTOOLCHAIN_BITS+= dbsym mdsetimage 581.157Spooka.endif 591.156Sjoerg 601.137SdarranDTRACE_BITS= 611.173Sriastrad.if ${MKDTRACE} != "no" || ${MKCTF} != "no" 621.137SdarranDTRACE_BITS+= .WAIT libelf 631.137SdarranDTRACE_BITS+= .WAIT libdwarf 641.162SapbDTRACE_BITS+= .WAIT libctf 651.172Sozaki.endif 661.172Sozaki.if ${MKCTF} != "no" 671.137SdarranDTRACE_BITS+= .WAIT ctfconvert ctfmerge 681.137Sdarran.endif 691.137Sdarran 701.99SmrgLINT_BITS= 711.99Smrg.if ${MKLINT} != "no" 721.99SmrgLINT_BITS= lint lint2 731.99Smrg.endif 741.99Smrg 751.165Sapb# All of host-mkdep, compat, and binstall are needed before anything 761.165Sapb# else. Within this group, they must be built in a specific order, and 771.165Sapb# all of them must be built before any of them is installed. They may 781.165Sapb# be installed in any order. This can't be expressed using the .WAIT 791.165Sapb# notation inside the SUBDIR list. 801.165Sapb# 811.165Sapb# XXX .ORDER does not work when multiple targets are passed on the 821.165Sapb# make command line without "-j", so use dependencies in addition to .ORDER. 831.165Sapb# 841.165Sapb.ORDER: dependall-host-mkdep dependall-compat dependall-binstall 851.165Sapb.if make(dependall-host-mkdep) && make(dependall-compat) 861.165Sapbdependall-compat: dependall-host-mkdep 871.165Sapb.endif 881.165Sapb.if make(dependall-compat) && make(dependall-binstall) 891.165Sapbdependall-binstall: dependall-compat 901.165Sapb.endif 911.165Sapb 921.16Stv# Dependencies in SUBDIR below ordered to maximize parallel ability. 931.165Sapb# See above for special treatment for host-mkdep, compat, and binstall. 941.165Sapb# 951.165SapbSUBDIR= host-mkdep compat binstall \ 961.179Spooka .WAIT mktemp .WAIT sed .WAIT genassym 971.166Spooka.if ${TOOLS_BUILDRUMP} == "no" 981.179SpookaSUBDIR+= cap_mkdb crunchgen ctags gencat hexdump \ 991.99Smrg ${LINT_BITS} \ 1001.175Spooka makewhatis mtree nbperf .WAIT uudecode 1011.166Spooka.endif 1021.166Spooka 1031.196SjoergSUBDIR+= cat rpcgen join lorder m4 mkdep tsort xz-include .WAIT yacc .WAIT awk .WAIT lex 1041.196SjoergSUBDIR+= grep xz-lib 1051.166Spooka 1061.166Spooka.if ${TOOLS_BUILDRUMP} == "no" 1071.166SpookaSUBDIR += .WAIT texinfo \ 1081.153Schristos .WAIT tic \ 1091.132Smrg .WAIT pax \ 1101.132Smrg .WAIT ${TOOLCHAIN_BITS} \ 1111.137Sdarran ${DTRACE_BITS} \ 1121.175Spooka asn1_compile cksum compile_et db \ 1131.145Selric file lint1 slc \ 1141.184Schristos makefs sortinfo \ 1151.184Schristos .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \ 1161.178Schristos .WAIT disklabel gpt \ 1171.132Smrg .WAIT paxctl \ 1181.132Smrg .WAIT fdisk \ 1191.132Smrg .WAIT installboot \ 1201.176Schristos pwd_mkdb strfile sunlabel vgrind zic 1211.166Spooka.endif 1221.196SjoergSUBDIR+= stat .WAIT config xz-bin 1231.39Stv 1241.201Sjoerg.if ${MKLLVM} != "no" || ${MKLLVMRT} != "no" 1251.142SjoergSUBDIR+= \ 1261.142Sjoerg llvm .WAIT \ 1271.187Sjoerg llvm-lib/libLLVMDemangle llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 1281.201Sjoerg llvm-tblgen 1291.201Sjoerg.endif 1301.201Sjoerg.if ${MKLLVM} != "no" 1311.201SjoergSUBDIR+= \ 1321.201Sjoerg llvm-clang-tblgen 1331.194Sjoerg.endif 1341.194Sjoerg.if ${MKLLVM} != "no" && !defined(EXTERNAL_TOOLCHAIN) 1351.194SjoergSUBDIR+= \ 1361.194Sjoerg .WAIT llvm-include .WAIT \ 1371.200Sjoerg llvm-lib .WAIT \ 1381.200Sjoerg llvm-clang 1391.174Smrg. if ${MKLLD} != "no" 1401.170SjoergSUBDIR+= llvm-lld 1411.174Smrg. endif 1421.174Smrg. if ${MKMCLINKER} != "no" 1431.168SjoergSUBDIR+= llvm-mcld 1441.174Smrg. endif 1451.142Sjoerg.endif 1461.142Sjoerg 1471.121Sdyoung.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 1481.174Smrg. if ${MKGROFF} != "no" 1491.39StvSUBDIR+= groff 1501.174Smrg. endif 1511.128SjoergSUBDIR+= mandoc 1521.39Stv.endif 1531.22Stv 1541.166Spooka.if ${TOOLS_BUILDRUMP} == "no" 1551.166Spooka 1561.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no" 1571.103SlukemSUBDIR+= autoconf .WAIT gettext 1581.72Smatt.endif 1591.72Smatt 1601.140Smrg.if ${USE_PIGZGZIP} != "no" 1611.140SmrgSUBDIR+= pigz 1621.140Smrg.endif 1631.140Smrg 1641.171Sskrll.if ${MACHINE} == "hppa" 1651.171SskrllSUBDIR+= hppa-mkboot 1661.83Sskrll.endif 1671.83Sskrll 1681.86Sjmc.if ${MACHINE} == "ibmnws" 1691.72SmattSUBDIR+= ibmnws-ncdcs 1701.79Smatt.endif 1711.79Smatt 1721.86Sjmc.if ${MACHINE} == "macppc" 1731.79SmattSUBDIR+= macppc-fixcoff 1741.48Skleink.endif 1751.48Skleink 1761.116Sgarbled.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 1771.115SgarbledSUBDIR+= powerpc-mkbootimage 1781.22Stv.endif 1791.37Sgmcgarry 1801.198Schristos.if ${MACHINE_CPU} == "arm" 1811.197SchristosSUBDIR+= arm-elf2aout 1821.197Schristos.endif 1831.197Schristos 1841.198Schristos.if ${MACHINE_CPU} == "m68k" 1851.148StsutsuiSUBDIR+= m68k-elf2aout 1861.148Stsutsui.endif 1871.148Stsutsui 1881.147Smrg.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ 1891.147Smrg ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") 1901.37SgmcgarrySUBDIR+= mips-elf2ecoff 1911.76Ssekiya.endif 1921.76Ssekiya 1931.76Ssekiya.if (${MACHINE} == "sgimips") 1941.76SsekiyaSUBDIR+= sgivol 1951.51Sbjh21.endif 1961.51Sbjh21 1971.82Sabs.if ${MACHINE} == "acorn32" 1981.82SabsSUBDIR+= sparkcrc 1991.82Sabs.endif 2001.82Sabs 2011.125Sabs.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 2021.51Sbjh21SUBDIR+= fgen 2031.37Sgmcgarry.endif 2041.37Sgmcgarry 2051.85Sjmc.if ${MACHINE} == "amiga" 2061.85SjmcSUBDIR+= amiga-elf2bb 2071.85SjmcSUBDIR+= amiga-txlt 2081.85Sjmc.endif 2091.85Sjmc 2101.86Sjmc.if ${MACHINE} == "hp300" 2111.86SjmcSUBDIR+= hp300-mkboot 2121.86Sjmc.endif 2131.86Sjmc 2141.167Smatt.if ${MACHINE} == "evbarm" \ 2151.167Smatt && ${MACHINE_CPU} == "arm" \ 2161.167Smatt && ${TARGET_ENDIANNESS} == "1234" 2171.158SjkunzSUBDIR+= elftosb 2181.158Sjkunz.endif 2191.158Sjkunz 2201.143Sphx.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 2211.143Sphx ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint" 2221.139SjmcneillSUBDIR+= mkubootimage 2231.191SskrllSUBDIR+= libfdt .WAIT 2241.191SskrllSUBDIR+= dtc 2251.139Sjmcneill.endif 2261.139Sjmcneill 2271.182Smrg.if ${MKX11} != "no" 2281.181SmattSUBDIR+= makestrs 2291.181SmattSUBDIR+= makekeys 2301.180Sjoerg.endif 2311.180Sjoerg 2321.186SchristosSUBDIR+= cvslatest 2331.186Schristos 2341.193Suwe.endif # TOOLS_BUILDRUMP != no 2351.166Spooka 2361.66Slukemcheck_MKTOOLS: .PHONY .NOTMAIN 2371.19Sjmc.if ${MKTOOLS:Uyes} == "no" 2381.17Stv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 2391.17Stv @echo '*** updating your host toolchain. This should be used only as a' 2401.17Stv @echo '*** temporary workaround for toolchain problems, as it will result' 2411.23Swiz @echo '*** in version skew and build errors over time!' 2421.18Sjmc.endif 2431.17Stv 2441.66Slukem.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 2451.163SapbSUBDIR= # empty 2461.67Slukemrealall realdepend install: check_MKTOOLS 2471.66Slukem.endif # } 2481.1Stv 2491.1Stv.include <bsd.subdir.mk> 2501.159Sjoerg.include <bsd.buildinstall.mk> 2511.11Stv.include <bsd.obj.mk> 2521.16Stv 2531.102Stron.if !defined(PREVIOUSTOOLDIR) 2541.102Stron. if exists(PREVIOUSTOOLDIR) 2551.66SlukemPREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 2561.102Stron. else 2571.162SapbPREVIOUSTOOLDIR= 2581.102Stron. endif 2591.66Slukem.endif 2601.66Slukem 2611.66SlukemCLEANFILES+= PREVIOUSTOOLDIR 2621.66Slukem 2631.101Stronrealall realdepend: .MAKE 2641.107Sapb.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 2651.66Slukem @echo "*** WARNING: TOOLDIR has moved?" 2661.66Slukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 2671.66Slukem @echo "*** != TOOLDIR '${TOOLDIR}'" 2681.66Slukem @echo "*** Cleaning mis-matched tools" 2691.66Slukem rm -f PREVIOUSTOOLDIR 2701.106Sfreza (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 2711.66Slukem.endif 2721.102Stron echo ${TOOLDIR} >PREVIOUSTOOLDIR 2731.66Slukem 2741.69Stroncleandir: 2751.69Stron rm -f ${CLEANFILES} 276