Makefile revision 1.211
1# $NetBSD: Makefile,v 1.211 2021/05/27 08:41:35 cjep Exp $ 2 3.include <bsd.own.mk> 4.include <bsd.endian.mk> 5 6# Make sure that the ordered build/install processing applies when using 7# plain make. 8.MAIN: build_install 9 10# TOOLDIR must be valid, unless MKTOOLS=no 11.if ${MKTOOLS:Uyes} != "no" 12.if "${TOOLDIR}" == "" 13.error "TOOLDIR is undefined or empty" 14.elif "${TOOLDIR:tW:M/*}" == "" 15.error "TOOLDIR is not an absolute path: ${TOOLDIR}" 16#.elif !exists(TOOLDIR) # XXX .exists fails for directories 17#.error "TOOLDIR does not exist: ${TOOLDIR}" 18.endif 19.endif # MKTOOLS != no 20 21# TOOLS_BUILDRUMP == yes builds only the subset of the tools required 22# for building rump kernels and the hypervisor. It is typically used 23# when building rump kernels targeted for non-NetBSD systems (via 24# buildrump.sh), and should not be set for a regular "make build". 25TOOLS_BUILDRUMP?=no 26 27.if ${TOOLCHAIN_MISSING} == "no" 28. if (defined(HAVE_GCC) && ${HAVE_GCC} > 0) || \ 29 (defined(HAVE_GDB) && ${HAVE_GDB} > 0 && ${MKCROSSGDB:Uno} != "no") 30TOOLCHAIN_BITS+= gmake .WAIT 31TOOLCHAIN_BITS+= gmp .WAIT 32TOOLCHAIN_BITS+= mpfr .WAIT 33TOOLCHAIN_BITS+= mpc .WAIT 34. endif 35 36TOOLCHAIN_BITS+= binutils .WAIT 37 38. if defined(HAVE_GCC) && ${HAVE_GCC} > 0 39TOOLCHAIN_BITS+= gcc 40. endif 41 42. if defined(HAVE_GDB) && ${HAVE_GDB} > 0 && ${MKCROSSGDB:Uno} != "no" 43TOOLCHAIN_BITS+= gdb 44. endif 45 46TOOLCHAIN_BITS+= .WAIT 47.endif 48 49.if defined(HAVE_PCC) 50. if ${TOOLCHAIN_MISSING} == "no" 51TOOLCHAIN_BITS+= pcc 52. endif 53.endif 54 55.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN) 56TOOLCHAIN_BITS+= dbsym mdsetimage 57.endif 58 59DTRACE_BITS= 60.if ${MKDTRACE} != "no" || ${MKCTF} != "no" 61DTRACE_BITS+= .WAIT libelf 62DTRACE_BITS+= .WAIT libdwarf 63DTRACE_BITS+= .WAIT libctf 64.endif 65.if ${MKCTF} != "no" 66DTRACE_BITS+= .WAIT ctfconvert ctfmerge 67.endif 68 69LINT_BITS= 70.if ${MKLINT} != "no" 71LINT_BITS= lint lint2 72.endif 73 74# All of host-mkdep, compat, and binstall are needed before anything 75# else. Within this group, they must be built in a specific order, and 76# all of them must be built before any of them is installed. They may 77# be installed in any order. This can't be expressed using the .WAIT 78# notation inside the SUBDIR list. 79# 80# XXX .ORDER does not work when multiple targets are passed on the 81# make command line without "-j", so use dependencies in addition to .ORDER. 82# 83.ORDER: dependall-host-mkdep dependall-compat dependall-binstall \ 84 dependall-date 85.if make(dependall-host-mkdep) && make(dependall-compat) 86dependall-compat: dependall-host-mkdep 87.endif 88.if make(dependall-compat) && make(dependall-binstall) 89dependall-binstall: dependall-compat 90.endif 91.if make(dependall-date) 92dependall-date: dependall-host-mkdep dependall-compat 93.endif 94 95# Dependencies in SUBDIR below ordered to maximize parallel ability. 96# See above for special treatment for host-mkdep, compat, and binstall. 97# 98SUBDIR= host-mkdep compat binstall date \ 99 .WAIT mktemp .WAIT sed .WAIT genassym 100.if ${TOOLS_BUILDRUMP} == "no" 101SUBDIR+= cap_mkdb crunchgen ctags gencat hexdump \ 102 ${LINT_BITS} \ 103 makewhatis mtree nbperf .WAIT uudecode 104.endif 105 106SUBDIR+= cat rpcgen join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex 107.if ${TOOLS_BUILDRUMP} == "no" 108SUBDIR+= xz-include .WAIT grep xz-lib pax .WAIT libprop 109 110SUBDIR += .WAIT texinfo \ 111 .WAIT tic \ 112 .WAIT ${TOOLCHAIN_BITS} \ 113 ${DTRACE_BITS} \ 114 asn1_compile cksum compile_et db \ 115 file lint1 slc \ 116 makefs sortinfo \ 117 .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \ 118 .WAIT disklabel gpt \ 119 .WAIT paxctl \ 120 .WAIT fdisk \ 121 .WAIT installboot \ 122 pwd_mkdb strfile sunlabel vgrind zic 123.endif 124SUBDIR+= stat .WAIT config 125.if ${TOOLS_BUILDRUMP} == "no" 126SUBDIR+= xz-bin 127.endif 128 129.if ${MKLLVM} != "no" || ${MKLLVMRT} != "no" 130SUBDIR+= \ 131 llvm .WAIT \ 132 llvm-lib/libLLVMDemangle llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ 133 llvm-tblgen 134.endif 135.if ${MKLLVM} != "no" 136SUBDIR+= \ 137 llvm-clang-tblgen 138.endif 139.if ${MKLLVM} != "no" && !defined(EXTERNAL_TOOLCHAIN) 140SUBDIR+= \ 141 .WAIT llvm-include .WAIT \ 142 llvm-lib .WAIT \ 143 llvm-clang 144.endif 145 146.if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no" 147. if ${MKGROFF} != "no" 148SUBDIR+= groff 149. endif 150SUBDIR+= mandoc 151.endif 152 153.if ${TOOLS_BUILDRUMP} == "no" 154 155.if ${MKMAINTAINERTOOLS:Uno} != "no" 156SUBDIR+= autoconf .WAIT gettext 157.endif 158 159.if ${USE_PIGZGZIP} != "no" 160SUBDIR+= pigz 161.endif 162 163.if ${MACHINE} == "hppa" 164SUBDIR+= hppa-mkboot 165.endif 166 167.if ${MACHINE} == "ibmnws" 168SUBDIR+= ibmnws-ncdcs 169.endif 170 171.if ${MACHINE} == "macppc" 172SUBDIR+= macppc-fixcoff 173.endif 174 175.if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox") 176SUBDIR+= powerpc-mkbootimage 177.endif 178 179.if ${MACHINE_CPU} == "arm" 180SUBDIR+= arm-elf2aout 181.endif 182 183.if ${MACHINE_CPU} == "m68k" 184SUBDIR+= m68k-elf2aout 185.endif 186 187.if !empty(MACHINE_ARCH:Mmips*) 188SUBDIR+= mips-elf2ecoff 189.endif 190 191.if (${MACHINE} == "sgimips") 192SUBDIR+= sgivol 193.endif 194 195.if ${MACHINE} == "acorn32" 196SUBDIR+= sparkcrc 197.endif 198 199.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 200SUBDIR+= fgen 201.endif 202 203.if ${MACHINE} == "amiga" 204SUBDIR+= amiga-elf2bb 205SUBDIR+= amiga-txlt 206.endif 207 208.if ${MACHINE} == "hp300" 209SUBDIR+= hp300-mkboot 210.endif 211 212.if ${MACHINE} == "evbarm" \ 213 && ${MACHINE_CPU} == "arm" \ 214 && ${TARGET_ENDIANNESS} == "1234" 215SUBDIR+= elftosb 216.endif 217 218.if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \ 219 ${MACHINE} == "evbppc" || ${MACHINE} == "evbsh3" || \ 220 ${MACHINE} == "sandpoint" 221SUBDIR+= mkubootimage 222SUBDIR+= libfdt .WAIT 223SUBDIR+= dtc 224.endif 225 226.if ${MACHINE} == "mvme68k" 227SUBDIR+= mvme68k-wrtvid 228.endif 229 230.if ${MKX11} != "no" 231SUBDIR+= makestrs 232SUBDIR+= makekeys 233.endif 234 235SUBDIR+= cvslatest 236 237.endif # TOOLS_BUILDRUMP != no 238 239check_MKTOOLS: .PHONY .NOTMAIN 240.if ${MKTOOLS:Uyes} == "no" 241 @echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and' 242 @echo '*** updating your host toolchain. This should be used only as a' 243 @echo '*** temporary workaround for toolchain problems, as it will result' 244 @echo '*** in version skew and build errors over time!' 245.endif 246 247.if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes" # { 248SUBDIR= # empty 249realall realdepend install: check_MKTOOLS 250.endif # } 251 252.include <bsd.subdir.mk> 253.include <bsd.buildinstall.mk> 254.include <bsd.obj.mk> 255 256.if !defined(PREVIOUSTOOLDIR) 257. if exists(PREVIOUSTOOLDIR) 258PREVIOUSTOOLDIR!= cat PREVIOUSTOOLDIR 259. else 260PREVIOUSTOOLDIR= 261. endif 262.endif 263 264CLEANFILES+= PREVIOUSTOOLDIR 265 266realall realdepend: .MAKE 267.if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}" 268 @echo "*** WARNING: TOOLDIR has moved?" 269 @echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'" 270 @echo "*** != TOOLDIR '${TOOLDIR}'" 271 @echo "*** Cleaning mis-matched tools" 272 rm -f PREVIOUSTOOLDIR 273 (cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir) 274.endif 275 echo ${TOOLDIR} >PREVIOUSTOOLDIR 276 277cleandir: 278 rm -f ${CLEANFILES} 279