Makefile revision 1.206
11.206Suwe# $NetBSD: Makefile,v 1.206 2020/07/28 21:38:15 uwe 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.204SbadSUBDIR+= cat rpcgen join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex 1041.204Sbad.if ${TOOLS_BUILDRUMP} == "no" 1051.204SbadSUBDIR+= xz-include .WAIT grep xz-lib pax .WAIT libprop 1061.166Spooka 1071.166SpookaSUBDIR += .WAIT texinfo \ 1081.153Schristos .WAIT tic \ 1091.132Smrg .WAIT ${TOOLCHAIN_BITS} \ 1101.137Sdarran ${DTRACE_BITS} \ 1111.175Spooka asn1_compile cksum compile_et db \ 1121.145Selric file lint1 slc \ 1131.184Schristos makefs sortinfo \ 1141.184Schristos .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \ 1151.178Schristos .WAIT disklabel gpt \ 1161.132Smrg .WAIT paxctl \ 1171.132Smrg .WAIT fdisk \ 1181.132Smrg .WAIT installboot \ 1191.176Schristos pwd_mkdb strfile sunlabel vgrind zic 1201.166Spooka.endif 1211.204SbadSUBDIR+= stat .WAIT config 1221.204Sbad.if ${TOOLS_BUILDRUMP} == "no" 1231.204SbadSUBDIR+= xz-bin 1241.204Sbad.endif 1251.39Stv 1261.201Sjoerg.if ${MKLLVM} != "no" || ${MKLLVMRT} != "no" 1271.142SjoergSUBDIR+= \ 1281.142Sjoerg llvm .WAIT \ 1291.187Sjoerg llvm-lib/libLLVMDemangle llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 1301.201Sjoerg llvm-tblgen 1311.201Sjoerg.endif 1321.201Sjoerg.if ${MKLLVM} != "no" 1331.201SjoergSUBDIR+= \ 1341.201Sjoerg llvm-clang-tblgen 1351.194Sjoerg.endif 1361.194Sjoerg.if ${MKLLVM} != "no" && !defined(EXTERNAL_TOOLCHAIN) 1371.194SjoergSUBDIR+= \ 1381.194Sjoerg .WAIT llvm-include .WAIT \ 1391.200Sjoerg llvm-lib .WAIT \ 1401.200Sjoerg llvm-clang 1411.142Sjoerg.endif 1421.142Sjoerg 1431.121Sdyoung.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 1441.174Smrg. if ${MKGROFF} != "no" 1451.39StvSUBDIR+= groff 1461.174Smrg. endif 1471.128SjoergSUBDIR+= mandoc 1481.39Stv.endif 1491.22Stv 1501.166Spooka.if ${TOOLS_BUILDRUMP} == "no" 1511.166Spooka 1521.22Stv.if ${MKMAINTAINERTOOLS:Uno} != "no" 1531.103SlukemSUBDIR+= autoconf .WAIT gettext 1541.72Smatt.endif 1551.72Smatt 1561.140Smrg.if ${USE_PIGZGZIP} != "no" 1571.140SmrgSUBDIR+= pigz 1581.140Smrg.endif 1591.140Smrg 1601.171Sskrll.if ${MACHINE} == "hppa" 1611.171SskrllSUBDIR+= hppa-mkboot 1621.83Sskrll.endif 1631.83Sskrll 1641.86Sjmc.if ${MACHINE} == "ibmnws" 1651.72SmattSUBDIR+= ibmnws-ncdcs 1661.79Smatt.endif 1671.79Smatt 1681.86Sjmc.if ${MACHINE} == "macppc" 1691.79SmattSUBDIR+= macppc-fixcoff 1701.48Skleink.endif 1711.48Skleink 1721.116Sgarbled.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 1731.115SgarbledSUBDIR+= powerpc-mkbootimage 1741.22Stv.endif 1751.37Sgmcgarry 1761.198Schristos.if ${MACHINE_CPU} == "arm" 1771.197SchristosSUBDIR+= arm-elf2aout 1781.197Schristos.endif 1791.197Schristos 1801.198Schristos.if ${MACHINE_CPU} == "m68k" 1811.148StsutsuiSUBDIR+= m68k-elf2aout 1821.148Stsutsui.endif 1831.148Stsutsui 1841.147Smrg.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ 1851.147Smrg ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") 1861.37SgmcgarrySUBDIR+= mips-elf2ecoff 1871.76Ssekiya.endif 1881.76Ssekiya 1891.76Ssekiya.if (${MACHINE} == "sgimips") 1901.76SsekiyaSUBDIR+= sgivol 1911.51Sbjh21.endif 1921.51Sbjh21 1931.82Sabs.if ${MACHINE} == "acorn32" 1941.82SabsSUBDIR+= sparkcrc 1951.82Sabs.endif 1961.82Sabs 1971.125Sabs.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 1981.51Sbjh21SUBDIR+= fgen 1991.37Sgmcgarry.endif 2001.37Sgmcgarry 2011.85Sjmc.if ${MACHINE} == "amiga" 2021.85SjmcSUBDIR+= amiga-elf2bb 2031.85SjmcSUBDIR+= amiga-txlt 2041.85Sjmc.endif 2051.85Sjmc 2061.86Sjmc.if ${MACHINE} == "hp300" 2071.86SjmcSUBDIR+= hp300-mkboot 2081.86Sjmc.endif 2091.86Sjmc 2101.167Smatt.if ${MACHINE} == "evbarm" \ 2111.167Smatt && ${MACHINE_CPU} == "arm" \ 2121.167Smatt && ${TARGET_ENDIANNESS} == "1234" 2131.158SjkunzSUBDIR+= elftosb 2141.158Sjkunz.endif 2151.158Sjkunz 2161.143Sphx.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 2171.206Suwe ${MACHINE} == "evbppc" || ${MACHINE} == "evbsh3" || \ 2181.206Suwe ${MACHINE} == "sandpoint" 2191.139SjmcneillSUBDIR+= mkubootimage 2201.191SskrllSUBDIR+= libfdt .WAIT 2211.191SskrllSUBDIR+= dtc 2221.139Sjmcneill.endif 2231.139Sjmcneill 2241.182Smrg.if ${MKX11} != "no" 2251.181SmattSUBDIR+= makestrs 2261.181SmattSUBDIR+= makekeys 2271.180Sjoerg.endif 2281.180Sjoerg 2291.186SchristosSUBDIR+= cvslatest 2301.186Schristos 2311.193Suwe.endif # TOOLS_BUILDRUMP != no 2321.166Spooka 2331.66Slukemcheck_MKTOOLS: .PHONY .NOTMAIN 2341.19Sjmc.if ${MKTOOLS:Uyes} == "no" 2351.17Stv @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 2361.17Stv @echo '*** updating your host toolchain. This should be used only as a' 2371.17Stv @echo '*** temporary workaround for toolchain problems, as it will result' 2381.23Swiz @echo '*** in version skew and build errors over time!' 2391.18Sjmc.endif 2401.17Stv 2411.66Slukem.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 2421.163SapbSUBDIR= # empty 2431.67Slukemrealall realdepend install: check_MKTOOLS 2441.66Slukem.endif # } 2451.1Stv 2461.1Stv.include <bsd.subdir.mk> 2471.159Sjoerg.include <bsd.buildinstall.mk> 2481.11Stv.include <bsd.obj.mk> 2491.16Stv 2501.102Stron.if !defined(PREVIOUSTOOLDIR) 2511.102Stron. if exists(PREVIOUSTOOLDIR) 2521.66SlukemPREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 2531.102Stron. else 2541.162SapbPREVIOUSTOOLDIR= 2551.102Stron. endif 2561.66Slukem.endif 2571.66Slukem 2581.66SlukemCLEANFILES+= PREVIOUSTOOLDIR 2591.66Slukem 2601.101Stronrealall realdepend: .MAKE 2611.107Sapb.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 2621.66Slukem @echo "*** WARNING: TOOLDIR has moved?" 2631.66Slukem @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 2641.66Slukem @echo "*** != TOOLDIR '${TOOLDIR}'" 2651.66Slukem @echo "*** Cleaning mis-matched tools" 2661.66Slukem rm -f PREVIOUSTOOLDIR 2671.106Sfreza (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 2681.66Slukem.endif 2691.102Stron echo ${TOOLDIR} >PREVIOUSTOOLDIR 2701.66Slukem 2711.69Stroncleandir: 2721.69Stron rm -f ${CLEANFILES} 273