Makefile revision 1.218
11.232Schristos# $NetBSD: Makefile,v 1.218 2024/03/30 22:38:02 riastradh Exp $ 21.30Sthorpej 31.176Smaxv.include <bsd.own.mk> 41.136Sad.include <bsd.endian.mk> 51.30Sthorpej 61.30Sthorpej# Make sure that the ordered build/install processing applies when using 71.30Sthorpej# plain make. 81.30Sthorpej.MAIN: build_install 91.90Smatt 101.30Sthorpej# TOOLDIR must be valid, unless MKTOOLS=no 111.30Sthorpej.if ${MKTOOLS:Uyes} != "no" 121.30Sthorpej. if "${TOOLDIR}" == "" 131.30Sthorpej. error TOOLDIR is undefined or empty 141.30Sthorpej. elif ${TOOLDIR:tW:M/*} == "" 151.30Sthorpej. error TOOLDIR '${TOOLDIR}' is not an absolute path 161.30Sthorpej. endif 171.30Sthorpej.endif # MKTOOLS != no 181.30Sthorpej 191.30Sthorpej# TOOLS_BUILDRUMP == yes builds only the subset of the tools required 201.30Sthorpej# for building rump kernels and the hypervisor. It is typically used 211.30Sthorpej# when building rump kernels targeted for non-NetBSD systems (via 221.30Sthorpej# buildrump.sh), and should not be set for a regular "make build". 231.30SthorpejTOOLS_BUILDRUMP?=no 241.30Sthorpej 251.30Sthorpej.if ${TOOLCHAIN_MISSING} == "no" 261.30Sthorpej. if (defined(HAVE_GCC) && ${HAVE_GCC} > 0) || \ 271.30Sthorpej (defined(HAVE_GDB) && ${HAVE_GDB} > 0 && ${MKCROSSGDB:Uno} != "no") 281.30SthorpejTOOLCHAIN_BITS+= gmake .WAIT 291.30SthorpejTOOLCHAIN_BITS+= gmp .WAIT 301.30SthorpejTOOLCHAIN_BITS+= mpfr .WAIT 311.30SthorpejTOOLCHAIN_BITS+= mpc .WAIT 321.9Scgd. if (defined(HAVE_GCC) && ${HAVE_GCC} >= 12) 331.1ScgdTOOLCHAIN_BITS+= isl .WAIT 341.7Smycroft. endif 351.7Smycroft. endif 361.87Sagc 371.87SagcTOOLCHAIN_BITS+= binutils .WAIT 381.87Sagc 391.87Sagc. if defined(HAVE_GCC) && ${HAVE_GCC} > 0 401.87SagcTOOLCHAIN_BITS+= gcc 411.87Sagc. endif 421.87Sagc 431.87Sagc. if defined(HAVE_GDB) && ${HAVE_GDB} > 0 && ${MKCROSSGDB:Uno} != "no" 441.87SagcTOOLCHAIN_BITS+= gdb 451.87Sagc. endif 461.87Sagc 471.87SagcTOOLCHAIN_BITS+= .WAIT 481.87Sagc.endif 491.87Sagc 501.87Sagc.if defined(HAVE_PCC) 511.87Sagc. if ${TOOLCHAIN_MISSING} == "no" 521.87SagcTOOLCHAIN_BITS+= pcc 531.87Sagc. endif 541.87Sagc.endif 551.87Sagc 561.87Sagc.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN) 571.87SagcTOOLCHAIN_BITS+= dbsym mdsetimage 581.87Sagc.endif 591.87Sagc 601.87SagcDTRACE_BITS= 611.87Sagc.if ${MKDTRACE} != "no" || ${MKCTF} != "no" 621.87SagcDTRACE_BITS+= .WAIT elftoolchain/common 631.87SagcDTRACE_BITS+= .WAIT elftoolchain/libelf 641.22SmikelDTRACE_BITS+= .WAIT elftoolchain/libdwarf 651.22SmikelDTRACE_BITS+= .WAIT libctf 661.22Smikel.endif 671.74Smatt.if ${MKCTF} != "no" 681.74SmattDTRACE_BITS+= .WAIT ctfconvert ctfmerge 691.74Smatt.endif 701.74Smatt 711.1ScgdLINT_BITS= 721.5Smycroft.if ${MKLINT} != "no" 731.1ScgdLINT_BITS= lint lint2 741.33Sthorpej.endif 751.70Sitojun 761.139Syamt# All of host-mkdep, compat, and binstall are needed before anything 771.139Syamt# else. Within this group, they must be built in a specific order, and 781.161Sknakahar# all of them must be built before any of them is installed. They may 791.164Sozaki# be installed in any order. This can't be expressed using the .WAIT 801.139Syamt# notation inside the SUBDIR list. 811.1Scgd# 821.82Sscw# XXX .ORDER does not work when multiple targets are passed on the 831.91Satatat# make command line without "-j", so use dependencies in addition to .ORDER. 841.82Sscw# 851.82Sscw.ORDER: dependall-host-mkdep dependall-compat dependall-binstall \ 861.82Sscw dependall-date 871.82Sscw.if make(dependall-host-mkdep) && make(dependall-compat) 881.82Sscwdependall-compat: dependall-host-mkdep 891.80Sthorpej.endif 901.80Sthorpej.if make(dependall-compat) && make(dependall-binstall) 911.164Sozakidependall-binstall: dependall-compat 921.164Sozaki.endif 931.1Scgd.if make(dependall-date) 941.26Scjsdependall-date: dependall-host-mkdep dependall-compat 951.1Scgd.endif 961.27Smikel 971.1Scgd# Dependencies in SUBDIR below ordered to maximize parallel ability. 981.1Scgd# See above for special treatment for host-mkdep, compat, and binstall. 991.1Scgd# 1001.1ScgdSUBDIR= host-mkdep compat binstall date \ 1011.69Sitojun .WAIT mktemp .WAIT sed .WAIT genassym 1021.69Sitojun.if ${TOOLS_BUILDRUMP} == "no" 1031.69SitojunSUBDIR+= cap_mkdb crunchgen ctags gencat hexdump \ 1041.118Sperry ${LINT_BITS} \ 1051.118Sperry makewhatis mtree nbperf .WAIT uudecode 1061.69Sitojun.endif 1071.69Sitojun 1081.74SmattSUBDIR+= cat rpcgen join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex 1091.74Smatt.if ${TOOLS_BUILDRUMP} == "no" 1101.74SmattSUBDIR+= xz-include .WAIT grep xz-lib pax .WAIT libprop 1111.74Smatt 1121.74SmattSUBDIR += .WAIT texinfo \ 1131.139Syamt .WAIT tic \ 1141.74Smatt .WAIT ${TOOLCHAIN_BITS} \ 1151.74Smatt ${DTRACE_BITS} \ 1161.137Smatt asn1_compile cksum compile_et db \ 1171.130Schristos file lint1 slc \ 1181.139Syamt makefs sortinfo \ 1191.139Syamt .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \ 1201.139Syamt .WAIT disklabel gpt \ 1211.194Smaxv .WAIT paxctl \ 1221.194Smaxv .WAIT fdisk \ 1231.139Syamt .WAIT installboot \ 1241.139Syamt pwd_mkdb strfile sunlabel vgrind zic 1251.139Syamt.endif 1261.139SyamtSUBDIR+= stat .WAIT config 1271.139Syamt.if ${TOOLS_BUILDRUMP} == "no" 1281.139SyamtSUBDIR+= xz-bin 1291.139Syamt.endif 1301.139Syamt 1311.139Syamt.if ${MKLLVM} != "no" || ${MKLLVMRT} != "no" 1321.139SyamtSUBDIR+= \ 1331.176Smaxv llvm .WAIT \ 1341.139Syamt llvm-lib/libLLVMDemangle llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 1351.139Syamt llvm-tblgen 1361.139Syamt.endif 1371.139Syamt.if ${MKLLVM} != "no" 1381.139SyamtSUBDIR+= \ 1391.139Syamt llvm-clang-tblgen 1401.139Syamt.endif 1411.139Syamt.if ${MKLLVM} != "no" && !defined(EXTERNAL_TOOLCHAIN) 1421.139SyamtSUBDIR+= \ 1431.1Scgd .WAIT llvm-include .WAIT \ 1441.1Scgd llvm-lib .WAIT \ 1451.1Scgd llvm-clang 1461.1Scgd.endif 1471.218Smaxv 1481.1Scgd.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 1491.176Smaxv. if ${MKGROFF} != "no" 1501.1ScgdSUBDIR+= groff 1511.1Scgd. endif 1521.1ScgdSUBDIR+= mandoc 1531.218Smaxv.endif 1541.74Smatt 1551.13Scgd.if ${TOOLS_BUILDRUMP} == "no" 1561.79Sthorpej 1571.80Sthorpej.if ${MKMAINTAINERTOOLS:Uno} != "no" 1581.13ScgdSUBDIR+= autoconf .WAIT gettext 1591.1Scgd.endif 1601.1Scgd 1611.58Sthorpej.if ${USE_PIGZGZIP} != "no" 1621.58SthorpejSUBDIR+= pigz 1631.58Sthorpej.endif 1641.183Smaxv 1651.58Sthorpej.if ${MACHINE} == "hppa" 1661.183SmaxvSUBDIR+= hppa-mkboot 1671.184Smaxv.endif 1681.184Smaxv 1691.207Smaxv.if ${MACHINE} == "ibmnws" 1701.183SmaxvSUBDIR+= ibmnws-ncdcs 1711.183Smaxv.endif 1721.184Smaxv 1731.184Smaxv.if ${MACHINE} == "macppc" 1741.184SmaxvSUBDIR+= macppc-fixcoff 1751.183Smaxv.endif 1761.183Smaxv 1771.58Sthorpej.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 1781.58SthorpejSUBDIR+= powerpc-mkbootimage 1791.58Sthorpej.endif 1801.161Sknakahar 1811.171Sknakahar.if ${MACHINE_CPU} == "arm" 1821.161SknakaharSUBDIR+= arm-elf2aout 1831.58Sthorpej.endif 1841.176Smaxv 1851.164Sozaki.if ${MACHINE_CPU} == "m68k" 1861.164SozakiSUBDIR+= m68k-elf2aout 1871.166Sozaki.endif 1881.164Sozaki 1891.164Sozaki.if !empty(MACHINE_ARCH:Mmips*) 1901.154SpookaSUBDIR+= mips-elf2ecoff 1911.154Spooka.endif 1921.154Spooka 1931.154Spooka.if (${MACHINE} == "sgimips") 1941.154SpookaSUBDIR+= sgivol 1951.171Sknakahar.endif 1961.219Sknakahar 1971.219Sknakahar.if ${MACHINE} == "acorn32" 1981.161SknakaharSUBDIR+= sparkcrc 1991.161Sknakahar.endif 2001.161Sknakahar 2011.161Sknakahar.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 2021.161SknakaharSUBDIR+= fgen 2031.171Sknakahar.endif 2041.161Sknakahar 2051.161Sknakahar.if ${MACHINE} == "amiga" 2061.1ScgdSUBDIR+= amiga-elf2bb 2071.1ScgdSUBDIR+= amiga-txlt 2081.184Smaxv.endif 2091.218Smaxv 2101.218Smaxv.if ${MACHINE} == "hp300" 2111.218SmaxvSUBDIR+= hp300-mkboot 2121.218Smaxv.endif 2131.218Smaxv 2141.218Smaxv.if ${MACHINE} == "evbarm" \ 2151.218Smaxv && ${MACHINE_CPU} == "arm" \ 2161.218Smaxv && ${TARGET_ENDIANNESS} == "1234" 2171.218SmaxvSUBDIR+= elftosb 2181.218Smaxv.endif 2191.85Sjonathan 2201.102Sheas.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 2211.227Sjdolecek ${MACHINE} == "evbppc" || ${MACHINE} == "evbsh3" || \ 2221.218Smaxv ${MACHINE} == "sandpoint" 2231.102SheasSUBDIR+= mkubootimage 2241.102Sheas.endif 2251.102Sheas 2261.58Sthorpej.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 2271.120Syamt ${MACHINE} == "evbppc" || ${MACHINE} == "evbsh3" || \ 2281.120Syamt ${MACHINE} == "sandpoint" || \ 2291.227Sjdolecek ${MACHINE_CPU} == "riscv" 2301.120SyamtSUBDIR+= libfdt .WAIT 2311.80SthorpejSUBDIR+= dtc 2321.207Smaxv.endif 2331.103Sthorpej 2341.207Smaxv.if ${MACHINE} == "mvme68k" 2351.207SmaxvSUBDIR+= mvme68k-wrtvid 2361.207Smaxv.endif 2371.207Smaxv 2381.103Sthorpej.if ${MKX11} != "no" 2391.218SmaxvSUBDIR+= makestrs 2401.218SmaxvSUBDIR+= makekeys 2411.218Smaxv.endif 2421.218Smaxv 2431.218SmaxvSUBDIR+= cvslatest 2441.114Syamt 2451.114Syamt.endif # TOOLS_BUILDRUMP == no 2461.80Sthorpej 2471.80Sthorpejcheck_MKTOOLS: .PHONY .NOTMAIN 2481.80Sthorpej.if ${MKTOOLS:Uyes} == "no" 2491.80Sthorpej @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 2501.218Smaxv @echo '*** updating your host toolchain. This should be used only as a' 2511.80Sthorpej @echo '*** temporary workaround for toolchain problems, as it will result' 2521.80Sthorpej @echo '*** in version skew and build errors over time!' 2531.187Smaxv.endif 2541.187Smaxv 2551.187Smaxv.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 2561.140SyamtSUBDIR= # empty 2571.140Syamtrealall realdepend install: check_MKTOOLS 2581.140Syamt.endif # } 2591.135Schristos 2601.140Syamt.include <bsd.subdir.mk> 2611.140Syamt.include <bsd.buildinstall.mk> 2621.135Schristos.include <bsd.obj.mk> 2631.187Smaxv 2641.80Sthorpej.if !defined(PREVIOUSTOOLDIR) 2651.187Smaxv. if exists(PREVIOUSTOOLDIR) 2661.187SmaxvPREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 2671.80Sthorpej. else 2681.187SmaxvPREVIOUSTOOLDIR= 2691.80Sthorpej. endif 2701.80Sthorpej.endif 2711.80Sthorpej 2721.218SmaxvCLEANFILES+= PREVIOUSTOOLDIR 2731.218Smaxv 2741.1Scgdrealall realdepend: .MAKE 2751.1Scgd.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 2761.140Syamt @echo "*** WARNING: TOOLDIR has moved?" 2771.140Syamt @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 2781.140Syamt @echo "*** != TOOLDIR '${TOOLDIR}'" 2791.140Syamt @echo "*** Cleaning mis-matched tools" 2801.140Syamt rm -f PREVIOUSTOOLDIR 2811.218Smaxv (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 2821.80Sthorpej.endif 2831.82Sscw echo ${TOOLDIR} >PREVIOUSTOOLDIR 2841.82Sscw 2851.82Sscwcleandir: 2861.82Sscw rm -f ${CLEANFILES} 2871.218Smaxv