Makefile revision 1.207
11.15Schristos# $NetBSD: Makefile,v 1.207 2021/02/06 16:14:55 dbj Exp $ 21.9Scgd 31.1Scgd.include <bsd.own.mk> 41.5Sjtc.include <bsd.endian.mk> 51.5Sjtc 61.1Scgd# Make sure that the ordered build/install processing applies when using 71.1Scgd# plain make. 81.1Scgd.MAIN: build_install 91.1Scgd 101.1Scgd# TOOLDIR must be valid, unless MKTOOLS=no 111.1Scgd.if ${MKTOOLS:Uyes} != "no" 121.1Scgd.if "${TOOLDIR}" == "" 131.1Scgd.error "TOOLDIR is undefined or empty" 141.1Scgd.elif "${TOOLDIR:tW:M/*}" == "" 151.1Scgd.error "TOOLDIR is not an absolute path: ${TOOLDIR}" 161.1Scgd#.elif !exists(TOOLDIR) # XXX .exists fails for directories 171.1Scgd#.error "TOOLDIR does not exist: ${TOOLDIR}" 181.1Scgd.endif 191.1Scgd.endif # MKTOOLS != no 201.1Scgd 211.1Scgd# TOOLS_BUILDRUMP == yes builds only the subset of the tools required 221.1Scgd# for building rump kernels and the hypervisor. It is typically used 231.1Scgd# when building rump kernels targeted for non-NetBSD systems (via 241.1Scgd# buildrump.sh), and should not be set for a regular "make build". 251.1ScgdTOOLS_BUILDRUMP?=no 261.1Scgd 271.1Scgd.if ${TOOLCHAIN_MISSING} == "no" 281.1Scgd. if (defined(HAVE_GCC) && ${HAVE_GCC} > 0) || \ 291.1Scgd (defined(HAVE_GDB) && ${HAVE_GDB} > 0 && ${MKCROSSGDB:Uno} != "no") 301.1ScgdTOOLCHAIN_BITS+= gmake .WAIT 311.1ScgdTOOLCHAIN_BITS+= gmp .WAIT 321.1ScgdTOOLCHAIN_BITS+= mpfr .WAIT 331.1ScgdTOOLCHAIN_BITS+= mpc .WAIT 341.1Scgd. endif 351.1Scgd 361.1ScgdTOOLCHAIN_BITS+= binutils .WAIT 371.1Scgd 381.10Schristos. if defined(HAVE_GCC) && ${HAVE_GCC} > 0 391.1ScgdTOOLCHAIN_BITS+= gcc 401.1Scgd. endif 411.1Scgd 421.15Schristos. if defined(HAVE_GDB) && ${HAVE_GDB} > 0 && ${MKCROSSGDB:Uno} != "no" 431.15SchristosTOOLCHAIN_BITS+= gdb 441.15Schristos. endif 451.1Scgd 461.1ScgdTOOLCHAIN_BITS+= .WAIT 471.1Scgd.endif 481.5Sjtc 491.15Schristos.if defined(HAVE_PCC) 501.5Sjtc. if ${TOOLCHAIN_MISSING} == "no" 511.12SmycroftTOOLCHAIN_BITS+= pcc 521.15Schristos. endif 531.1Scgd.endif 541.1Scgd 551.8Schristos.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN) 561.8SchristosTOOLCHAIN_BITS+= dbsym mdsetimage 571.8Schristos.endif 581.1Scgd 591.1ScgdDTRACE_BITS= 601.8Schristos.if ${MKDTRACE} != "no" || ${MKCTF} != "no" 611.8SchristosDTRACE_BITS+= .WAIT libelf 621.8SchristosDTRACE_BITS+= .WAIT libdwarf 631.8SchristosDTRACE_BITS+= .WAIT libctf 641.8Schristos.endif 651.8Schristos.if ${MKCTF} != "no" 661.8SchristosDTRACE_BITS+= .WAIT ctfconvert ctfmerge 671.8Schristos.endif 681.8Schristos 691.8SchristosLINT_BITS= 701.1Scgd.if ${MKLINT} != "no" 711.1ScgdLINT_BITS= lint lint2 721.1Scgd.endif 731.1Scgd 741.1Scgd# All of host-mkdep, compat, and binstall are needed before anything 751.1Scgd# else. Within this group, they must be built in a specific order, and 761.1Scgd# all of them must be built before any of them is installed. They may 771.1Scgd# be installed in any order. This can't be expressed using the .WAIT 781.1Scgd# notation inside the SUBDIR list. 791.5Sjtc# 801.1Scgd# XXX .ORDER does not work when multiple targets are passed on the 811.1Scgd# make command line without "-j", so use dependencies in addition to .ORDER. 821.14Scgd# 831.14Scgd.ORDER: dependall-host-mkdep dependall-compat dependall-binstall 841.14Scgd.if make(dependall-host-mkdep) && make(dependall-compat) 851.14Scgddependall-compat: dependall-host-mkdep 86.endif 87.if make(dependall-compat) && make(dependall-binstall) 88dependall-binstall: dependall-compat 89.endif 90 91# Dependencies in SUBDIR below ordered to maximize parallel ability. 92# See above for special treatment for host-mkdep, compat, and binstall. 93# 94SUBDIR= host-mkdep compat binstall \ 95 .WAIT mktemp .WAIT sed .WAIT genassym 96.if ${TOOLS_BUILDRUMP} == "no" 97SUBDIR+= cap_mkdb crunchgen ctags gencat hexdump \ 98 ${LINT_BITS} \ 99 makewhatis mtree nbperf .WAIT uudecode 100.endif 101 102SUBDIR+= cat rpcgen join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex 103.if ${TOOLS_BUILDRUMP} == "no" 104SUBDIR+= xz-include .WAIT grep xz-lib pax .WAIT libprop 105 106SUBDIR += .WAIT texinfo \ 107 .WAIT tic \ 108 .WAIT ${TOOLCHAIN_BITS} \ 109 ${DTRACE_BITS} \ 110 asn1_compile cksum compile_et db \ 111 file lint1 slc \ 112 makefs sortinfo \ 113 .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \ 114 .WAIT disklabel gpt \ 115 .WAIT paxctl \ 116 .WAIT fdisk \ 117 .WAIT installboot \ 118 pwd_mkdb strfile sunlabel vgrind zic 119.endif 120SUBDIR+= stat .WAIT config 121.if ${TOOLS_BUILDRUMP} == "no" 122SUBDIR+= xz-bin 123.endif 124 125.if ${MKLLVM} != "no" || ${MKLLVMRT} != "no" 126SUBDIR+= \ 127 llvm .WAIT \ 128 llvm-lib/libLLVMDemangle llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 129 llvm-tblgen 130.endif 131.if ${MKLLVM} != "no" 132SUBDIR+= \ 133 llvm-clang-tblgen 134.endif 135.if ${MKLLVM} != "no" && !defined(EXTERNAL_TOOLCHAIN) 136SUBDIR+= \ 137 .WAIT llvm-include .WAIT \ 138 llvm-lib .WAIT \ 139 llvm-clang 140.endif 141 142.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 143. if ${MKGROFF} != "no" 144SUBDIR+= groff 145. endif 146SUBDIR+= mandoc 147.endif 148 149.if ${TOOLS_BUILDRUMP} == "no" 150 151.if ${MKMAINTAINERTOOLS:Uno} != "no" 152SUBDIR+= autoconf .WAIT gettext 153.endif 154 155.if ${USE_PIGZGZIP} != "no" 156SUBDIR+= pigz 157.endif 158 159.if ${MACHINE} == "hppa" 160SUBDIR+= hppa-mkboot 161.endif 162 163.if ${MACHINE} == "ibmnws" 164SUBDIR+= ibmnws-ncdcs 165.endif 166 167.if ${MACHINE} == "macppc" 168SUBDIR+= macppc-fixcoff 169.endif 170 171.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 172SUBDIR+= powerpc-mkbootimage 173.endif 174 175.if ${MACHINE_CPU} == "arm" 176SUBDIR+= arm-elf2aout 177.endif 178 179.if ${MACHINE_CPU} == "m68k" 180SUBDIR+= m68k-elf2aout 181.endif 182 183.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \ 184 ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") 185SUBDIR+= mips-elf2ecoff 186.endif 187 188.if (${MACHINE} == "sgimips") 189SUBDIR+= sgivol 190.endif 191 192.if ${MACHINE} == "acorn32" 193SUBDIR+= sparkcrc 194.endif 195 196.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 197SUBDIR+= fgen 198.endif 199 200.if ${MACHINE} == "amiga" 201SUBDIR+= amiga-elf2bb 202SUBDIR+= amiga-txlt 203.endif 204 205.if ${MACHINE} == "hp300" 206SUBDIR+= hp300-mkboot 207.endif 208 209.if ${MACHINE} == "evbarm" \ 210 && ${MACHINE_CPU} == "arm" \ 211 && ${TARGET_ENDIANNESS} == "1234" 212SUBDIR+= elftosb 213.endif 214 215.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 216 ${MACHINE} == "evbppc" || ${MACHINE} == "evbsh3" || \ 217 ${MACHINE} == "sandpoint" 218SUBDIR+= mkubootimage 219SUBDIR+= libfdt .WAIT 220SUBDIR+= dtc 221.endif 222 223.if ${MKX11} != "no" 224SUBDIR+= makestrs 225SUBDIR+= makekeys 226.endif 227 228SUBDIR+= cvslatest 229 230.endif # TOOLS_BUILDRUMP != no 231 232check_MKTOOLS: .PHONY .NOTMAIN 233.if ${MKTOOLS:Uyes} == "no" 234 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 235 @echo '*** updating your host toolchain. This should be used only as a' 236 @echo '*** temporary workaround for toolchain problems, as it will result' 237 @echo '*** in version skew and build errors over time!' 238.endif 239 240.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 241SUBDIR= # empty 242realall realdepend install: check_MKTOOLS 243.endif # } 244 245.include <bsd.subdir.mk> 246.include <bsd.buildinstall.mk> 247.include <bsd.obj.mk> 248 249.if !defined(PREVIOUSTOOLDIR) 250. if exists(PREVIOUSTOOLDIR) 251PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 252. else 253PREVIOUSTOOLDIR= 254. endif 255.endif 256 257CLEANFILES+= PREVIOUSTOOLDIR 258 259realall realdepend: .MAKE 260.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 261 @echo "*** WARNING: TOOLDIR has moved?" 262 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 263 @echo "*** != TOOLDIR '${TOOLDIR}'" 264 @echo "*** Cleaning mis-matched tools" 265 rm -f PREVIOUSTOOLDIR 266 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 267.endif 268 echo ${TOOLDIR} >PREVIOUSTOOLDIR 269 270cleandir: 271 rm -f ${CLEANFILES} 272