1 # $NetBSD: bsd.own.mk,v 1.1441 2025/10/20 14:31:40 nat Exp $ 2 3 # This needs to be before bsd.init.mk 4 .if defined(BSD_MK_COMPAT_FILE) 5 .include <${BSD_MK_COMPAT_FILE}> 6 .endif 7 8 .if !defined(_BSD_OWN_MK_) 9 _BSD_OWN_MK_=1 10 11 MAKECONF?= /etc/mk.conf 12 .-include "${MAKECONF}" 13 14 # 15 # CPU model, derived from MACHINE_ARCH 16 # 17 MACHINE_CPU= ${MACHINE_ARCH:C/mips.*e[bl]/mips/:C/sh3e[bl]/sh3/:S/coldfire/m68k/:S/m68000/m68k/:S/m68ksf/m68k/:C/e?arm.*/arm/:S/powerpc64/powerpc/:S/aarch64eb/aarch64/:S/or1knd/or1k/:C/riscv../riscv/} 18 19 .if (${MACHINE_ARCH} == "mips64el" || \ 20 ${MACHINE_ARCH} == "mips64eb" || \ 21 ${MACHINE_ARCH} == "mipsn64el" || \ 22 ${MACHINE_ARCH} == "mipsn64eb") 23 MACHINE_MIPS64= 1 24 .else 25 MACHINE_MIPS64= 0 26 .endif 27 28 .if ${MACHINE_ARCH} == "m68ksf" 29 BFD_MACHINE_ARCH=m68k 30 BINUTILS_MACHINE_ARCH=m68k 31 GCC_MACHINE_ARCH=m68k 32 GDB_MACHINE_ARCH=m68k 33 GMP_MACHINE_ARCH=m68k 34 GOMP_MACHINE_ARCH=m68k 35 LIBGCC_MACHINE_ARCH=m68k 36 LIBC_MACHINE_ARCH=m68k 37 LIBEXEC_MACHINE_ARCH=m68k 38 LIBEXECINFO_MACHINE_ARCH=m68k 39 LIBKERN_ARCH=m68k 40 LDELFSO_MACHINE_ARCH=m68k 41 .endif 42 43 # 44 # Subdirectory used below ${RELEASEDIR} when building a release 45 # 46 .if \ 47 ${MACHINE:Mevbarm} || \ 48 ${MACHINE:Mevbmips} || \ 49 ${MACHINE:Mevbsh3} || \ 50 ${MACHINE:Mriscv} 51 RELEASEMACHINEDIR?= ${MACHINE}-${MACHINE_ARCH} 52 .else 53 RELEASEMACHINEDIR?= ${MACHINE} 54 .endif 55 56 # 57 # Subdirectory or path component used for the following paths: 58 # distrib/${RELEASEMACHINE} 59 # distrib/notes/${RELEASEMACHINE} 60 # etc/etc.${RELEASEMACHINE} 61 # Used when building a release. 62 # 63 RELEASEMACHINE?= ${MACHINE} 64 65 # 66 # NEED_OWN_INSTALL_TARGET is set to "no" by pkgsrc/mk/bsd.pkg.mk to 67 # ensure that things defined by <bsd.own.mk> (default targets, 68 # INSTALL_FILE, etc.) are not conflicting with bsd.pkg.mk. 69 # 70 NEED_OWN_INSTALL_TARGET?= yes 71 72 # 73 # This lists the platforms which do not have working in-tree toolchains. For 74 # the in-tree gcc toolchain, this list is empty. 75 # 76 # If some future port is not supported by the in-tree toolchain, this should 77 # be set to "yes" for that port only. 78 # 79 # .if ${MACHINE} == "playstation2" 80 # TOOLCHAIN_MISSING?= yes 81 # .endif 82 83 TOOLCHAIN_MISSING?= no 84 85 # 86 # GCC Using platforms. 87 # 88 .if ${MKGCC:Uyes} != "no" # { 89 90 # 91 # What GCC is used? 92 # 93 .if ${MACHINE} == "amd64" || \ 94 ${MACHINE} == "hppa" || \ 95 ${MACHINE} == "i386" || \ 96 ${MACHINE} == "sparc" || \ 97 ${MACHINE} == "sparc64" || \ 98 ${MACHINE} == "vax" || \ 99 ${MACHINE_CPU} == "aarch64" || \ 100 ${MACHINE_CPU} == "arm" || \ 101 ${MACHINE_CPU} == "riscv" 102 HAVE_GCC?= 14 103 .endif 104 105 HAVE_GCC?= 12 106 107 # 108 # Platforms that can't run a modern GCC natively 109 .if ${MACHINE_ARCH} == "m68000" 110 MKGCCCMDS?= no 111 .endif 112 113 # 114 # We import the old gcc as "gcc.old" when upgrading. EXTERNAL_GCC_SUBDIR is 115 # set to the relevant subdirectory in src/external/gpl3 for his HAVE_GCC. 116 # 117 .if ${HAVE_GCC} == 12 118 EXTERNAL_GCC_SUBDIR?= gcc.old 119 .elif ${HAVE_GCC} == 14 120 EXTERNAL_GCC_SUBDIR?= gcc 121 .else 122 EXTERNAL_GCC_SUBDIR?= /does/not/exist 123 .endif 124 125 .else # MKGCC == no # } { 126 MKGCCCMDS?= no 127 .endif # MKGCC == no # } 128 129 # 130 # Build GCC with the "isl" library enabled. 131 # The alpha port does not work with it, see GCC PR's 84204 and 84353. 132 # Other ports don't have vector units GCC can target. 133 # 134 .if ${MACHINE} == "alpha" || \ 135 ${MACHINE} == "vax" || \ 136 ${MACHINE_CPU} == "m68k" || \ 137 ${MACHINE_CPU} == "sh3" 138 NOGCCISL= # defined 139 .endif 140 141 # 142 # What binutils is used? 143 # 144 HAVE_BINUTILS?= 245 145 146 .if ${HAVE_BINUTILS} == 245 147 EXTERNAL_BINUTILS_SUBDIR= binutils 148 .elif ${HAVE_BINUTILS} == 242 149 EXTERNAL_BINUTILS_SUBDIR= binutils.old 150 .else 151 EXTERNAL_BINUTILS_SUBDIR= /does/not/exist 152 .endif 153 154 # 155 # What GDB is used? 156 # 157 HAVE_GDB?= 1630 158 159 .if ${HAVE_GDB} == 1630 160 EXTERNAL_GDB_SUBDIR= gdb 161 .elif ${HAVE_GDB} == 1510 162 EXTERNAL_GDB_SUBDIR= gdb.old 163 .else 164 EXTERNAL_GDB_SUBDIR= /does/not/exist 165 .endif 166 167 .if ${MACHINE_ARCH} == "x86_64" 168 MKGDBSERVER?= yes 169 .endif 170 MKGDBSERVER?= no 171 172 # 173 # What OpenSSL is used? 174 # 175 HAVE_OPENSSL?= 35 176 177 .if ${HAVE_OPENSSL} == 35 178 EXTERNAL_OPENSSL_SUBDIR=apache2/openssl 179 .elif ${HAVE_OPENSSL} == 30 180 EXTERNAL_OPENSSL_SUBDIR=bsd/openssl 181 .elif ${HAVE_OPENSSL} == 11 182 EXTERNAL_OPENSSL_SUBDIR=bsd/openssl.old 183 .else 184 EXTERNAL_OPENSSL_SUBDIR=/does/not/exist 185 .endif 186 187 # 188 # Does the platform support ACPI? 189 # 190 .if ${MACHINE} == "i386" || \ 191 ${MACHINE} == "amd64" || \ 192 ${MACHINE} == "ia64" || \ 193 ${MACHINE_ARCH:Maarch64*} 194 HAVE_ACPI= yes 195 .else 196 HAVE_ACPI= no 197 .endif 198 199 # 200 # Does the platform support UEFI? 201 # 202 .if ${MACHINE} == "i386" || \ 203 ${MACHINE} == "amd64" || \ 204 ${MACHINE} == "ia64" || \ 205 ${MACHINE_ARCH:Mearmv7*} || \ 206 ${MACHINE_ARCH:Maarch64*} || \ 207 ${MACHINE_ARCH} == "riscv64" 208 HAVE_UEFI= yes 209 .else 210 HAVE_UEFI= no 211 .endif 212 213 # 214 # Does the platform support EFI RT services? 215 # 216 .if ${HAVE_UEFI} == "yes" && ${MACHINE_ARCH:M*eb} == "" 217 HAVE_EFI_RT= yes 218 .else 219 HAVE_EFI_RT= no 220 .endif 221 222 # 223 # Does the platform support NVMM? 224 # 225 .if ${MACHINE_ARCH} == "x86_64" 226 HAVE_NVMM= yes 227 .else 228 HAVE_NVMM= no 229 .endif 230 231 232 .if ${MACHINE_ARCH:Mearm*} 233 _LIBC_COMPILER_RT.${MACHINE_ARCH}= yes 234 .endif 235 236 _LIBC_COMPILER_RT.aarch64= yes 237 _LIBC_COMPILER_RT.aarch64eb= yes 238 _LIBC_COMPILER_RT.i386= yes 239 _LIBC_COMPILER_RT.powerpc= yes 240 _LIBC_COMPILER_RT.powerpc64= yes 241 _LIBC_COMPILER_RT.sparc= yes 242 _LIBC_COMPILER_RT.sparc64= yes 243 _LIBC_COMPILER_RT.x86_64= yes 244 245 .if ${HAVE_LLVM:Uno} == "yes" && ${_LIBC_COMPILER_RT.${MACHINE_ARCH}:Uno} == "yes" 246 HAVE_LIBGCC?= no 247 .else 248 HAVE_LIBGCC?= yes 249 .endif 250 251 252 # Should libgcc have unwinding code? 253 .if ${HAVE_LLVM:Uno} == "yes" || ${MACHINE_ARCH:Mearm*} 254 HAVE_LIBGCC_EH?= no 255 .else 256 HAVE_LIBGCC_EH?= yes 257 .endif 258 259 # Coverity does not like SSP 260 .if defined(COVERITY_TOP_CONFIG) || \ 261 ${MACHINE} == "alpha" || \ 262 ${MACHINE} == "hppa" || \ 263 ${MACHINE} == "ia64" 264 HAVE_SSP?= no 265 .else 266 HAVE_SSP?= yes 267 .if !defined(NOFORT) && ${USE_FORT:Uno} != "no" 268 USE_SSP?= yes 269 .endif 270 .endif 271 272 # 273 # What version of jemalloc we use (100 is the one 274 # built-in to libc from 2005 (pre version 3). 275 # 276 .if ${MACHINE_ARCH} == "vax" || ${MACHINE} == "sun2" 277 HAVE_JEMALLOC?= 100 278 .else 279 HAVE_JEMALLOC?= 530 280 .endif 281 282 .if ${HAVE_JEMALLOC} == 530 || ${HAVE_JEMALLOC} == 100 283 EXTERNAL_JEMALLOC_SUBDIR = jemalloc 284 .elif ${HAVE_JEMALLOC} == 510 285 EXTERNAL_JEMALLOC_SUBDIR = jemalloc.old 286 .else 287 EXTERNAL_JEMALLOC_SUBDIR = /does/not/exist 288 .endif 289 290 .if empty(.MAKEFLAGS:tW:M*-V .OBJDIR*) 291 .if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR) 292 PRINTOBJDIR= ${MAKE} -B -r -V .OBJDIR -f /dev/null xxx 293 .else 294 PRINTOBJDIR= ${MAKE} -B -V .OBJDIR 295 .endif 296 .else 297 PRINTOBJDIR= echo /error/bsd.own.mk/PRINTOBJDIR # avoid infinite recursion 298 .endif 299 300 # 301 # Make sure we set _NETBSD_REVISIONID in CPPFLAGS if requested. 302 # 303 .ifdef NETBSD_REVISIONID 304 _NETBSD_REVISIONID_STR= "${NETBSD_REVISIONID}" 305 CPPFLAGS+= -D_NETBSD_REVISIONID=${_NETBSD_REVISIONID_STR:Q} 306 .endif 307 308 # 309 # Determine if running in the NetBSD source tree by checking for the 310 # existence of build.sh and tools/ in the current or a parent directory, 311 # and setting _SRC_TOP_ to the result. 312 # 313 .if !defined(_SRC_TOP_) # { 314 _SRC_TOP_!= cd "${.CURDIR}"; while :; do \ 315 here=$$(pwd); \ 316 [ -f build.sh ] && [ -d tools ] && { echo $$here; break; }; \ 317 case $$here in /) echo ""; break;; esac; \ 318 cd ..; done 319 320 .MAKEOVERRIDES+= _SRC_TOP_ 321 322 .endif # } 323 324 # 325 # If _SRC_TOP_ != "", we're within the NetBSD source tree. 326 # * Set defaults for NETBSDSRCDIR and _SRC_TOP_OBJ_. 327 # * Define _NETBSD_VERSION_DEPENDS. Targets that depend on the 328 # NetBSD version, or on variables defined at build time, can 329 # declare a dependency on ${_NETBSD_VERSION_DEPENDS}. 330 # 331 .if (${_SRC_TOP_} != "") # { 332 333 NETBSDSRCDIR?= ${_SRC_TOP_} 334 335 .if !defined(_SRC_TOP_OBJ_) 336 _SRC_TOP_OBJ_!= cd "${_SRC_TOP_}" && ${PRINTOBJDIR} 337 .MAKEOVERRIDES+= _SRC_TOP_OBJ_ 338 .endif 339 340 _NETBSD_VERSION_DEPENDS= ${_SRC_TOP_OBJ_}/params 341 _NETBSD_VERSION_DEPENDS+= ${NETBSDSRCDIR}/sys/sys/param.h 342 _NETBSD_VERSION_DEPENDS+= ${NETBSDSRCDIR}/sys/conf/newvers.sh 343 _NETBSD_VERSION_DEPENDS+= ${NETBSDSRCDIR}/sys/conf/osrelease.sh 344 ${_SRC_TOP_OBJ_}/params: .NOTMAIN .OPTIONAL # created by top level "make build" 345 346 .endif # _SRC_TOP_ != "" # } 347 348 349 .if (${_SRC_TOP_} != "") && \ 350 (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)) 351 USETOOLS?= yes 352 .endif 353 USETOOLS?= no 354 355 356 .if ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "mips64" || \ 357 ${MACHINE_ARCH} == "sh3" 358 .BEGIN: 359 @echo "Must set MACHINE_ARCH to one of ${MACHINE_ARCH}eb or ${MACHINE_ARCH}el" 360 @false 361 .elif defined(REQUIRETOOLS) && \ 362 (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)) && \ 363 ${USETOOLS} == "no" 364 .BEGIN: 365 @echo "USETOOLS=no, but this component requires a version-specific host toolchain" 366 @false 367 .endif 368 369 # 370 # Host platform information; may be overridden 371 # 372 .include <bsd.host.mk> 373 374 .if ${USETOOLS} == "yes" # { 375 376 # 377 # Provide a default for TOOLDIR. 378 # 379 .if !defined(TOOLDIR) 380 TOOLDIR:= ${_SRC_TOP_OBJ_}/tooldir.${HOST_OSTYPE} 381 .MAKEOVERRIDES+= TOOLDIR 382 .endif 383 384 # 385 # This is the prefix used for the NetBSD-sourced tools. 386 # 387 _TOOL_PREFIX?= nb 388 389 # 390 # If an external toolchain base is specified, use it. 391 # 392 .if defined(EXTERNAL_TOOLCHAIN) # { 393 AR= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ar 394 AS= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-as 395 ELFEDIT= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-elfedit 396 LD= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ld 397 NM= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-nm 398 OBJCOPY= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objcopy 399 OBJDUMP= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objdump 400 RANLIB= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ranlib 401 READELF= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-readelf 402 SIZE= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-size 403 STRINGS= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strings 404 STRIP= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strip 405 406 TOOL_CC.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc 407 TOOL_CPP.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-cpp 408 TOOL_CXX.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-c++ 409 TOOL_FC.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gfortran 410 TOOL_OBJC.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc 411 412 TOOL_CC.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang 413 TOOL_CPP.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp 414 TOOL_CXX.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang++ 415 TOOL_OBJC.clang= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang 416 .else # } { 417 # Define default locations for common tools. 418 .if ${USETOOLS_BINUTILS:Uyes} == "yes" # { 419 AR= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ar 420 AS= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-as 421 ELFEDIT= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-elfedit 422 LD= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ld 423 NM= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-nm 424 OBJCOPY= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objcopy 425 OBJDUMP= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objdump 426 RANLIB= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ranlib 427 READELF= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-readelf 428 SIZE= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-size 429 STRINGS= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strings 430 STRIP= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strip 431 432 # GCC supports C, C++, Fortran and Objective C 433 TOOL_CC.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc 434 TOOL_CPP.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-cpp 435 TOOL_CXX.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-c++ 436 TOOL_FC.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gfortran 437 TOOL_OBJC.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc 438 .endif # } 439 440 # Clang supports C, C++ and Objective C 441 TOOL_CC.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang 442 TOOL_CPP.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp 443 TOOL_CXX.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang++ 444 TOOL_OBJC.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang 445 446 # PCC supports C and Fortran 447 TOOL_CC.pcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-pcc 448 TOOL_CPP.pcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-pcpp 449 TOOL_CXX.pcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-p++ 450 .endif # EXTERNAL_TOOLCHAIN # } 451 452 # 453 # Make sure DESTDIR is set, so that builds with these tools always 454 # get appropriate -nostdinc, -nostdlib, etc. handling. The default is 455 # <empty string>, meaning start from /, the root directory. 456 # 457 DESTDIR?= 458 459 # Don't append another copy of sysroot (coming from COMPATCPPFLAGS etc.) 460 # because it confuses Coverity. Still we need to cov-configure specially 461 # for each specific sysroot argument. 462 # Also don't add a sysroot at all if a rumpkernel build. 463 .if !defined(HOSTPROG) && !defined(HOSTLIB) && !defined(RUMPRUN) 464 . if ${DESTDIR} != "" 465 . if empty(CPPFLAGS:M*--sysroot=*) 466 CPPFLAGS+= --sysroot=${DESTDIR} 467 . endif 468 LDFLAGS+= --sysroot=${DESTDIR} 469 . else 470 . if empty(CPPFLAGS:M*--sysroot=*) 471 CPPFLAGS+= --sysroot=/ 472 . endif 473 LDFLAGS+= --sysroot=/ 474 . endif 475 .endif 476 477 DBSYM= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-dbsym 478 ARM_ELF2AOUT= ${TOOLDIR}/bin/${_TOOL_PREFIX}arm-elf2aout 479 M68K_ELF2AOUT= ${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout 480 MIPS_ELF2ECOFF= ${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff 481 INSTALL= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install 482 LEX= ${TOOLDIR}/bin/${_TOOL_PREFIX}lex 483 LINT= CC=${CC:Q} ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-lint 484 LORDER= NM=${NM:Q} MKTEMP=${TOOL_MKTEMP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}lorder 485 MKDEP= CC=${CC:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}mkdep 486 MKDEPCXX= CC=${CXX:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}mkdep 487 PAXCTL= ${TOOLDIR}/bin/${_TOOL_PREFIX}paxctl 488 TSORT= ${TOOLDIR}/bin/${_TOOL_PREFIX}tsort -q 489 YACC= ${TOOLDIR}/bin/${_TOOL_PREFIX}yacc 490 491 TOOL_AMIGAAOUT2BB= ${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-aout2bb 492 TOOL_AMIGAELF2BB= ${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-elf2bb 493 TOOL_AMIGATXLT= ${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-txlt 494 TOOL_ASN1_COMPILE= ${TOOLDIR}/bin/${_TOOL_PREFIX}asn1_compile 495 TOOL_AWK= ${TOOLDIR}/bin/${_TOOL_PREFIX}awk 496 TOOL_CAP_MKDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}cap_mkdb 497 TOOL_CAT= ${TOOLDIR}/bin/${_TOOL_PREFIX}cat 498 TOOL_CKSUM= ${TOOLDIR}/bin/${_TOOL_PREFIX}cksum 499 TOOL_CLANG_TBLGEN= ${TOOLDIR}/bin/${_TOOL_PREFIX}clang-tblgen 500 TOOL_COMPILE_ET= ${TOOLDIR}/bin/${_TOOL_PREFIX}compile_et 501 TOOL_CONFIG= ${TOOLDIR}/bin/${_TOOL_PREFIX}config 502 TOOL_CRUNCHGEN= MAKE=${.MAKE:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}crunchgen 503 TOOL_CTAGS= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctags 504 TOOL_CTFCONVERT= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctfconvert 505 TOOL_CTFMERGE= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctfmerge 506 TOOL_CVSLATEST= ${TOOLDIR}/bin/${_TOOL_PREFIX}cvslatest 507 TOOL_DATE= ${TOOLDIR}/bin/${_TOOL_PREFIX}date 508 TOOL_DB= ${TOOLDIR}/bin/${_TOOL_PREFIX}db 509 TOOL_DISKLABEL= ${TOOLDIR}/bin/${_TOOL_PREFIX}disklabel 510 TOOL_DTC= ${TOOLDIR}/bin/${_TOOL_PREFIX}dtc 511 TOOL_EQN= ${TOOLDIR}/bin/${_TOOL_PREFIX}eqn 512 TOOL_FDISK= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk 513 TOOL_FGEN= ${TOOLDIR}/bin/${_TOOL_PREFIX}fgen 514 TOOL_FILE= ${TOOLDIR}/bin/${_TOOL_PREFIX}file 515 TOOL_GENASSYM= ${TOOLDIR}/bin/${_TOOL_PREFIX}genassym 516 TOOL_GENCAT= ${TOOLDIR}/bin/${_TOOL_PREFIX}gencat 517 TOOL_GMAKE= ${TOOLDIR}/bin/${_TOOL_PREFIX}gmake 518 TOOL_GPT= ${TOOLDIR}/bin/${_TOOL_PREFIX}gpt 519 TOOL_GREP= ${TOOLDIR}/bin/${_TOOL_PREFIX}grep 520 GROFF_SHARE_PATH= ${TOOLDIR}/share/groff 521 TOOL_GROFF_ENV= \ 522 GROFF_ENCODING= \ 523 GROFF_BIN_PATH=${TOOLDIR}/lib/groff \ 524 GROFF_FONT_PATH=${GROFF_SHARE_PATH}/site-font:${GROFF_SHARE_PATH}/font \ 525 GROFF_TMAC_PATH=${GROFF_SHARE_PATH}/site-tmac:${GROFF_SHARE_PATH}/tmac 526 TOOL_GROFF= ${TOOL_GROFF_ENV} ${TOOLDIR}/bin/${_TOOL_PREFIX}groff ${GROFF_FLAGS} 527 TOOL_GROPS= ${TOOL_GROFF_ENV} ${TOOLDIR}/lib/groff/grops 528 529 TOOL_HEXDUMP= ${TOOLDIR}/bin/${_TOOL_PREFIX}hexdump 530 TOOL_HP300MKBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}hp300-mkboot 531 TOOL_HPPAMKBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}hppa-mkboot 532 TOOL_INDXBIB= ${TOOLDIR}/bin/${_TOOL_PREFIX}indxbib 533 TOOL_INSTALLBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}installboot 534 TOOL_INSTALL_INFO= ${TOOLDIR}/bin/${_TOOL_PREFIX}install-info 535 TOOL_JOIN= ${TOOLDIR}/bin/${_TOOL_PREFIX}join 536 TOOL_LLVM_TBLGEN= ${TOOLDIR}/bin/${_TOOL_PREFIX}llvm-tblgen 537 TOOL_M4= ${TOOLDIR}/bin/${_TOOL_PREFIX}m4 538 TOOL_MACPPCFIXCOFF= ${TOOLDIR}/bin/${_TOOL_PREFIX}macppc-fixcoff 539 TOOL_MACPPCINSTALLBOOT= ${TOOLDIR}/bin/${_TOOL_PREFIX}macppc_installboot 540 TOOL_MACPPCMKBOOTHFS= ${TOOLDIR}/bin/${_TOOL_PREFIX}macppc_mkboothfs 541 TOOL_MAKEFS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makefs 542 TOOL_MAKEINFO= ${TOOLDIR}/bin/${_TOOL_PREFIX}makeinfo 543 TOOL_MAKEKEYS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makekeys 544 TOOL_MAKESTRS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makestrs 545 TOOL_MAKEWHATIS= ${TOOLDIR}/bin/${_TOOL_PREFIX}makewhatis 546 TOOL_MANDOC_ASCII= ${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Tascii 547 TOOL_MANDOC_HTML= ${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Thtml 548 TOOL_MANDOC_LINT= ${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Tlint 549 TOOL_MDSETIMAGE= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-mdsetimage 550 TOOL_MENUC= MENUDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}menuc 551 TOOL_ARMELF2AOUT= ${TOOLDIR}/bin/${_TOOL_PREFIX}arm-elf2aout 552 TOOL_M68KELF2AOUT= ${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout 553 TOOL_MIPSELF2ECOFF= ${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff 554 TOOL_MKCSMAPPER= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkcsmapper 555 TOOL_MKESDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkesdb 556 TOOL_MKHYBRID= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkhybrid 557 TOOL_MKLOCALE= ${TOOLDIR}/bin/${_TOOL_PREFIX}mklocale 558 TOOL_MKMAGIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}file 559 TOOL_MKNOD= ${TOOLDIR}/bin/${_TOOL_PREFIX}mknod 560 TOOL_MKTEMP= ${TOOLDIR}/bin/${_TOOL_PREFIX}mktemp 561 TOOL_MKUBOOTIMAGE= ${TOOLDIR}/bin/${_TOOL_PREFIX}mkubootimage 562 TOOL_ELFTOSB= ${TOOLDIR}/bin/${_TOOL_PREFIX}elftosb 563 TOOL_MSGC= MSGDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}msgc 564 TOOL_MTREE= ${TOOLDIR}/bin/${_TOOL_PREFIX}mtree 565 TOOL_MVME68KWRTVID= ${TOOLDIR}/bin/${_TOOL_PREFIX}mvme68k-wrtvid 566 TOOL_NBPERF= ${TOOLDIR}/bin/${_TOOL_PREFIX}perf 567 TOOL_NCDCS= ${TOOLDIR}/bin/${_TOOL_PREFIX}ibmnws-ncdcs 568 TOOL_PAX= ${TOOLDIR}/bin/${_TOOL_PREFIX}pax 569 TOOL_PIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}pic 570 TOOL_PIGZ= ${TOOLDIR}/bin/${_TOOL_PREFIX}pigz 571 TOOL_XZ= ${TOOLDIR}/bin/${_TOOL_PREFIX}xz 572 TOOL_PKG_CREATE= ${TOOLDIR}/bin/${_TOOL_PREFIX}pkg_create 573 TOOL_POWERPCMKBOOTIMAGE=${TOOLDIR}/bin/${_TOOL_PREFIX}powerpc-mkbootimage 574 TOOL_PWD_MKDB= ${TOOLDIR}/bin/${_TOOL_PREFIX}pwd_mkdb 575 TOOL_REFER= ${TOOLDIR}/bin/${_TOOL_PREFIX}refer 576 TOOL_ROFF_ASCII= ${TOOL_GROFF_ENV} ${TOOLDIR}/bin/${_TOOL_PREFIX}nroff 577 TOOL_ROFF_DOCASCII= ${TOOL_GROFF} -Tascii 578 TOOL_ROFF_DOCHTML= ${TOOL_GROFF} -Thtml 579 TOOL_ROFF_DVI= ${TOOL_GROFF} -Tdvi ${ROFF_PAGESIZE} 580 TOOL_ROFF_HTML= ${TOOL_GROFF} -Tlatin1 -mdoc2html 581 TOOL_ROFF_PS= ${TOOL_GROFF} -Tps ${ROFF_PAGESIZE} 582 TOOL_ROFF_RAW= ${TOOL_GROFF} -Z 583 TOOL_RPCGEN= RPCGEN_CPP=${CPP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}rpcgen 584 TOOL_SED= ${TOOLDIR}/bin/${_TOOL_PREFIX}sed 585 TOOL_SLC= ${TOOLDIR}/bin/${_TOOL_PREFIX}slc 586 TOOL_SOELIM= ${TOOLDIR}/bin/${_TOOL_PREFIX}soelim 587 TOOL_SORTINFO= ${TOOLDIR}/bin/${_TOOL_PREFIX}sortinfo 588 TOOL_SPARKCRC= ${TOOLDIR}/bin/${_TOOL_PREFIX}sparkcrc 589 TOOL_STAT= ${TOOLDIR}/bin/${_TOOL_PREFIX}stat 590 TOOL_STRFILE= ${TOOLDIR}/bin/${_TOOL_PREFIX}strfile 591 TOOL_SUNLABEL= ${TOOLDIR}/bin/${_TOOL_PREFIX}sunlabel 592 TOOL_TBL= ${TOOLDIR}/bin/${_TOOL_PREFIX}tbl 593 TOOL_TIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}tic 594 TOOL_UUDECODE= ${TOOLDIR}/bin/${_TOOL_PREFIX}uudecode 595 TOOL_VAXMOPCOPY= ${TOOLDIR}/bin/${_TOOL_PREFIX}vax-mopcopy 596 TOOL_VGRIND= ${TOOLDIR}/bin/${_TOOL_PREFIX}vgrind -f 597 TOOL_VFONTEDPR= ${TOOLDIR}/libexec/${_TOOL_PREFIX}vfontedpr 598 TOOL_ZIC= ${TOOLDIR}/bin/${_TOOL_PREFIX}zic 599 600 .else # USETOOLS != yes # } { 601 602 # Clang supports C, C++ and Objective C 603 TOOL_CC.clang= clang 604 TOOL_CPP.clang= clang-cpp 605 TOOL_CXX.clang= clang++ 606 TOOL_OBJC.clang= clang 607 608 # GCC supports C, C++, Fortran and Objective C 609 TOOL_CC.gcc= gcc 610 TOOL_CPP.gcc= cpp 611 TOOL_CXX.gcc= c++ 612 TOOL_FC.gcc= gfortran 613 TOOL_OBJC.gcc= gcc 614 615 # PCC supports C and Fortran 616 TOOL_CC.pcc= pcc 617 TOOL_CPP.pcc= pcpp 618 TOOL_CXX.pcc= p++ 619 620 TOOL_AMIGAAOUT2BB= amiga-aout2bb 621 TOOL_AMIGAELF2BB= amiga-elf2bb 622 TOOL_AMIGATXLT= amiga-txlt 623 TOOL_ASN1_COMPILE= asn1_compile 624 TOOL_AWK= awk 625 TOOL_CAP_MKDB= cap_mkdb 626 TOOL_CAT= cat 627 TOOL_CKSUM= cksum 628 TOOL_CLANG_TBLGEN= clang-tblgen 629 TOOL_COMPILE_ET= compile_et 630 TOOL_CONFIG= config 631 TOOL_CRUNCHGEN= crunchgen 632 TOOL_CTAGS= ctags 633 TOOL_CTFCONVERT= ctfconvert 634 TOOL_CTFMERGE= ctfmerge 635 TOOL_CVSLATEST= cvslatest 636 TOOL_DATE= date 637 TOOL_DB= db 638 TOOL_DISKLABEL= disklabel 639 TOOL_DTC= dtc 640 TOOL_EQN= eqn 641 TOOL_FDISK= fdisk 642 TOOL_FGEN= fgen 643 TOOL_FILE= file 644 TOOL_GENASSYM= genassym 645 TOOL_GENCAT= gencat 646 TOOL_GMAKE= gmake 647 TOOL_GPT= gpt 648 TOOL_GREP= grep 649 TOOL_GROFF= groff 650 TOOL_GROPS= grops 651 TOOL_HEXDUMP= hexdump 652 TOOL_HP300MKBOOT= hp300-mkboot 653 TOOL_HPPAMKBOOT= hppa-mkboot 654 TOOL_INDXBIB= indxbib 655 TOOL_INSTALLBOOT= installboot 656 TOOL_INSTALL_INFO= install-info 657 TOOL_JOIN= join 658 TOOL_LLVM_TBLGEN= llvm-tblgen 659 TOOL_M4= m4 660 TOOL_MACPPCFIXCOFF= macppc-fixcoff 661 TOOL_MAKEFS= makefs 662 TOOL_MAKEINFO= makeinfo 663 TOOL_MAKEKEYS= makekeys 664 TOOL_MAKESTRS= makestrs 665 TOOL_MAKEWHATIS= /usr/libexec/makewhatis 666 TOOL_MANDOC_ASCII= mandoc -Tascii 667 TOOL_MANDOC_HTML= mandoc -Thtml 668 TOOL_MANDOC_LINT= mandoc -Tlint 669 TOOL_MDSETIMAGE= mdsetimage 670 TOOL_MENUC= menuc 671 TOOL_ARMELF2AOUT= arm-elf2aout 672 TOOL_M68KELF2AOUT= m68k-elf2aout 673 TOOL_MIPSELF2ECOFF= mips-elf2ecoff 674 TOOL_MKCSMAPPER= mkcsmapper 675 TOOL_MKESDB= mkesdb 676 TOOL_MKLOCALE= mklocale 677 TOOL_MKMAGIC= file 678 TOOL_MKNOD= mknod 679 TOOL_MKTEMP= mktemp 680 TOOL_MKUBOOTIMAGE= mkubootimage 681 TOOL_ELFTOSB= elftosb 682 TOOL_MSGC= msgc 683 TOOL_MTREE= mtree 684 TOOL_MVME68KWRTVID= wrtvid 685 TOOL_NBPERF= nbperf 686 TOOL_NCDCS= ncdcs 687 TOOL_PAX= pax 688 TOOL_PIC= pic 689 TOOL_PIGZ= pigz 690 TOOL_XZ= xz 691 TOOL_PKG_CREATE= pkg_create 692 TOOL_POWERPCMKBOOTIMAGE=powerpc-mkbootimage 693 TOOL_PWD_MKDB= pwd_mkdb 694 TOOL_REFER= refer 695 TOOL_ROFF_ASCII= nroff 696 TOOL_ROFF_DOCASCII= ${TOOL_GROFF} -Tascii 697 TOOL_ROFF_DOCHTML= ${TOOL_GROFF} -Thtml 698 TOOL_ROFF_DVI= ${TOOL_GROFF} -Tdvi ${ROFF_PAGESIZE} 699 TOOL_ROFF_HTML= ${TOOL_GROFF} -Tlatin1 -mdoc2html 700 TOOL_ROFF_PS= ${TOOL_GROFF} -Tps ${ROFF_PAGESIZE} 701 TOOL_ROFF_RAW= ${TOOL_GROFF} -Z 702 TOOL_RPCGEN= rpcgen 703 TOOL_SED= sed 704 TOOL_SOELIM= soelim 705 TOOL_SORTINFO= sortinfo 706 TOOL_SPARKCRC= sparkcrc 707 TOOL_STAT= stat 708 TOOL_STRFILE= strfile 709 TOOL_SUNLABEL= sunlabel 710 TOOL_TBL= tbl 711 TOOL_TIC= tic 712 TOOL_UUDECODE= uudecode 713 TOOL_VAXMOPCOPY= vax-mopcopy 714 TOOL_VGRIND= vgrind -f 715 TOOL_VFONTEDPR= /usr/libexec/vfontedpr 716 TOOL_ZIC= zic 717 718 .endif # USETOOLS != yes # } 719 720 # Standalone code should not be compiled with PIE or CTF 721 # Should create a better test 722 .if defined(BINDIR) && ${BINDIR} == "/usr/mdec" 723 NOPIE= # defined 724 NOCTF= # defined 725 .elif ${MACHINE} == "sun2" 726 NOPIE= # we don't have PIC, so no PIE 727 .endif 728 729 # Fallback to ensure that all variables are defined to something 730 TOOL_CC.false= false 731 TOOL_CPP.false= false 732 TOOL_CXX.false= false 733 TOOL_FC.false= false 734 TOOL_OBJC.false= false 735 736 AVAILABLE_COMPILER?= ${HAVE_PCC:Dpcc} ${HAVE_LLVM:Dclang} ${HAVE_GCC:Dgcc} false 737 738 .for _t in CC CPP CXX FC OBJC 739 ACTIVE_${_t}= ${AVAILABLE_COMPILER:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@:[1]} 740 SUPPORTED_${_t}=${AVAILABLE_COMPILER:Nfalse:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@} 741 .endfor 742 # make bugs prevent moving this into the .for loop 743 CC= ${TOOL_CC.${ACTIVE_CC}} 744 CPP= ${TOOL_CPP.${ACTIVE_CPP}} 745 CXX= ${TOOL_CXX.${ACTIVE_CXX}} 746 FC= ${TOOL_FC.${ACTIVE_FC}} 747 OBJC= ${TOOL_OBJC.${ACTIVE_OBJC}} 748 749 # 750 # Clang and GCC compiler-specific options, usually to disable warnings. 751 # The naming convention is "CC" + the compiler flag converted 752 # to upper case, with '-' and '=' changed to '_' a la `tr -=a-z __A-Z`. 753 # For variable naming purposes, treat -Werror=FLAG as -WFLAG, 754 # and -Wno-error=FLAG as -Wno-FLAG (usually from Clang). 755 # 756 # E.g., CC_WNO_ADDRESS_OF_PACKED_MEMBER contains 757 # both -Wno-error=address-of-packed-member for Clang, 758 # and -Wno-address-of-packed-member for GCC 9+. 759 # 760 # Use these with e.g. 761 # COPTS.foo.c+= ${CC_WNO_ADDRESS_OF_PACKED_MEMBER} 762 # 763 CC_WNO_ADDRESS_OF_PACKED_MEMBER=${${ACTIVE_CC} == "clang" :? -Wno-error=address-of-packed-member :} \ 764 ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 9:? -Wno-address-of-packed-member :} 765 766 CC_WNO_ARRAY_BOUNDS= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 12:? -Wno-array-bounds :} 767 CC_WNO_CALLOC_TRANSPOSED_ARGS= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 14:? -Wno-calloc-transposed-args :} 768 CC_WNO_CAST_FUNCTION_TYPE= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8:? -Wno-cast-function-type :} 769 CC_WNO_DANGLING_POINTER= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 14:? -Wno-dangling-pointer :} 770 CC_WNO_ENUM_INT_MISMATCH= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 14:? -Wno-enum-int-mismatch :} 771 CC_WNO_FORMAT_OVERFLOW= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-format-overflow :} 772 CC_WNO_FORMAT_TRUNCATION= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-format-truncation :} 773 CC_WNO_IMPLICIT_FALLTHROUGH= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-implicit-fallthrough :} 774 CC_WNO_MAYBE_UNINITIALIZED= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-maybe-uninitialized :} 775 CC_WNO_MISSING_TEMPLATE_KEYWORD=${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 12:? -Wno-missing-template-keyword :} 776 CC_WNO_REGISTER= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 12:? -Wno-register :} 777 CC_WNO_RETURN_LOCAL_ADDR= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-return-local-addr :} 778 CC_WNO_STRINGOP_OVERFLOW= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-stringop-overflow :} 779 CC_WNO_STRINGOP_OVERREAD= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 12:? -Wno-stringop-overread :} 780 CC_WNO_STRINGOP_TRUNCATION= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8:? -Wno-stringop-truncation :} 781 782 # relative relocs are only supported in gnu ld for ppc64 and x86 783 .if ${MACHINE_ARCH} == "x86_64" || \ 784 ${MACHINE_ARCH} == "i386" || \ 785 ${MACHINE_ARCH} == "powerpc64" 786 LD_PACK_RELATIVE_RELOCS= -Wl,-z,pack-relative-relocs 787 LD_NOPACK_RELATIVE_RELOCS= -Wl,-z,nopack-relative-relocs 788 .endif 789 790 # For each ${MACHINE_CPU}, list the ports that use it. 791 MACHINES.aarch64= evbarm 792 MACHINES.alpha= alpha 793 MACHINES.arm= acorn32 cats epoc32 evbarm hpcarm \ 794 iyonix netwinder shark zaurus 795 MACHINES.coldfire= evbcf 796 MACHINES.i386= i386 797 MACHINES.ia64= ia64 798 MACHINES.hppa= hppa 799 MACHINES.m68000= sun2 800 MACHINES.m68k= amiga atari cesfic hp300 luna68k mac68k \ 801 mvme68k news68k next68k sun3 virt68k x68k 802 MACHINES.m68ksf= mac68k 803 MACHINES.mips= algor arc cobalt emips evbmips ews4800mips \ 804 hpcmips mipsco newsmips pmax sbmips sgimips 805 MACHINES.or1k= or1k 806 MACHINES.powerpc= amigappc bebox evbppc ibmnws macppc mvmeppc \ 807 ofppc prep rs6000 sandpoint 808 MACHINES.riscv= riscv 809 MACHINES.sh3= dreamcast evbsh3 hpcsh landisk mmeye 810 MACHINES.sparc= sparc sparc64 811 MACHINES.sparc64= sparc64 812 MACHINES.vax= vax 813 MACHINES.x86_64= amd64 814 815 # OBJCOPY flags to create a.out binaries for old firmware 816 # shared among src/distrib and ${MACHINE}/conf/Makefile.${MACHINE}.inc 817 .if ${MACHINE_CPU} == "arm" 818 OBJCOPY_ELF2AOUT_FLAGS?= \ 819 -O a.out-arm-netbsd \ 820 -R .ident \ 821 -R .ARM.attributes \ 822 -R .ARM.exidx \ 823 -R .ARM.extab \ 824 -R .SUNW_ctf \ 825 -R .arm.atpcs \ 826 -R .comment \ 827 -R .debug_abbrev \ 828 -R .debug_aranges \ 829 -R .debug_info \ 830 -R .debug_line \ 831 -R .debug_frame \ 832 -R .debug_loc \ 833 -R .debug_pubnames \ 834 -R .debug_pubtypes \ 835 -R .debug_ranges \ 836 -R .debug_str \ 837 -R .debug_macinfo \ 838 -R .eh_frame \ 839 -R .note.netbsd.ident 840 .endif 841 842 # 843 # Targets to check if DESTDIR or RELEASEDIR is provided 844 # 845 .if !target(check_DESTDIR) 846 check_DESTDIR: .PHONY .NOTMAIN 847 .if !defined(DESTDIR) 848 @echo "setenv DESTDIR before doing that!" 849 @false 850 .else 851 @true 852 .endif 853 .endif 854 855 .if !target(check_RELEASEDIR) 856 check_RELEASEDIR: .PHONY .NOTMAIN 857 .if !defined(RELEASEDIR) 858 @echo "setenv RELEASEDIR before doing that!" 859 @false 860 .else 861 @true 862 .endif 863 .endif 864 865 # 866 # Where the system object and source trees are kept; can be configurable 867 # by the user in case they want them in ~/foosrc and ~/fooobj (for example). 868 # 869 BSDSRCDIR?= /usr/src 870 BSDOBJDIR?= /usr/obj 871 NETBSDSRCDIR?= ${BSDSRCDIR} 872 873 BINGRP?= wheel 874 BINOWN?= root 875 BINMODE?= 555 876 NONBINMODE?= 444 877 878 # These are here mainly because we don't want suid root in case 879 # a Makefile defines BINMODE. 880 RUMPBINGRP?= wheel 881 RUMPBINOWN?= root 882 RUMPBINMODE?= 555 883 RUMPNONBINMODE?=444 884 885 MANDIR?= /usr/share/man 886 MANGRP?= wheel 887 MANOWN?= root 888 MANMODE?= ${NONBINMODE} 889 MANINSTALL?= ${_MANINSTALL} 890 891 INFODIR?= /usr/share/info 892 INFOGRP?= wheel 893 INFOOWN?= root 894 INFOMODE?= ${NONBINMODE} 895 896 LIBDIR?= /usr/lib 897 898 LINTLIBDIR?= /usr/libdata/lint 899 LIBGRP?= ${BINGRP} 900 LIBOWN?= ${BINOWN} 901 LIBMODE?= ${NONBINMODE} 902 903 DOCDIR?= /usr/share/doc 904 DOCGRP?= wheel 905 DOCOWN?= root 906 DOCMODE?= ${NONBINMODE} 907 908 NLSDIR?= /usr/share/nls 909 NLSGRP?= wheel 910 NLSOWN?= root 911 NLSMODE?= ${NONBINMODE} 912 913 KMODULEGRP?= wheel 914 KMODULEOWN?= root 915 KMODULEMODE?= ${NONBINMODE} 916 917 LOCALEDIR?= /usr/share/locale 918 LOCALEGRP?= wheel 919 LOCALEOWN?= root 920 LOCALEMODE?= ${NONBINMODE} 921 922 FIRMWAREDIR?= /libdata/firmware 923 FIRMWAREGRP?= wheel 924 FIRMWAREOWN?= root 925 FIRMWAREMODE?= ${NONBINMODE} 926 927 DEBUGDIR?= /usr/libdata/debug 928 DEBUGGRP?= wheel 929 DEBUGOWN?= root 930 DEBUGMODE?= ${NONBINMODE} 931 932 DTBDIR?= /boot/dtb 933 DTBGRP?= wheel 934 DTBOWN?= root 935 DTBMODE?= ${NONBINMODE} 936 937 MKDIRMODE?= 0755 938 MKDIRPERM?= -m ${MKDIRMODE} 939 940 # 941 # Data-driven table using make variables to control how 942 # toolchain-dependent targets and shared libraries are built 943 # for different platforms and object formats. 944 # 945 # OBJECT_FMT: currently either "ELF" or "a.out". 946 # 947 # All platforms are ELF. 948 # 949 OBJECT_FMT= ELF 950 951 # 952 # If this platform's toolchain is missing, we obviously cannot build it. 953 # 954 .if ${TOOLCHAIN_MISSING} != "no" 955 MKBINUTILS:= no 956 MKGDB:= no 957 MKGCC:= no 958 .endif 959 960 # 961 # If we are using an external toolchain, we can still build the target's 962 # binutils, but we cannot build GCC's support libraries, since those are 963 # tightly-coupled to the version of GCC being used. 964 # 965 .if defined(EXTERNAL_TOOLCHAIN) 966 MKGCC:= no 967 .endif 968 969 MKGDB.or1k= no 970 971 # No kernel modules for or1k (yet) 972 MKKMOD.or1k= no 973 974 # No profiling for or1k or risc-v (yet) 975 MKPROFILE.or1k= no 976 MKPROFILE.riscv32=no 977 MKPROFILE.riscv64=no 978 979 # 980 # The m68000 port is incomplete. 981 # 982 .if ${MACHINE_ARCH} == "m68000" 983 NOPIC= # defined 984 MKISCSI= no 985 # XXX GCC 4 outputs mcount() calling sequences that try to load values 986 # from over 64KB away and this fails to assemble. 987 .if defined(HAVE_GCC) 988 NOPROFILE= # defined 989 .endif 990 .endif 991 992 # 993 # The ia64 port is incomplete. 994 # 995 MKGDB.ia64= no 996 997 # 998 # On VAX using ELF, all objects are PIC, not just shared libraries, 999 # so don't build the _pic version. VAX has no native TLS support either, 1000 # so differences between TLS models are not relevant. 1001 # 1002 MKPICLIB.vax= no 1003 1004 # 1005 # Location of the file that contains the major and minor numbers of the 1006 # version of a shared library. If this file exists a shared library 1007 # will be built by <bsd.lib.mk>. 1008 # 1009 SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version 1010 1011 # 1012 # GNU sources and packages sometimes see architecture names differently. 1013 # 1014 GNU_ARCH.aarch64eb=aarch64_be 1015 GNU_ARCH.coldfire=m5407 1016 GNU_ARCH.earm=arm 1017 GNU_ARCH.earmhf=arm 1018 GNU_ARCH.earmeb=armeb 1019 GNU_ARCH.earmhfeb=armeb 1020 GNU_ARCH.earmv4=armv4 1021 GNU_ARCH.earmv4eb=armv4eb 1022 GNU_ARCH.earmv5=arm 1023 GNU_ARCH.earmv5hf=arm 1024 GNU_ARCH.earmv5eb=armeb 1025 GNU_ARCH.earmv5hfeb=armeb 1026 GNU_ARCH.earmv6=armv6 1027 GNU_ARCH.earmv6hf=armv6 1028 GNU_ARCH.earmv6eb=armv6eb 1029 GNU_ARCH.earmv6hfeb=armv6eb 1030 GNU_ARCH.earmv7=armv7 1031 GNU_ARCH.earmv7hf=armv7 1032 GNU_ARCH.earmv7eb=armv7eb 1033 GNU_ARCH.earmv7hfeb=armv7eb 1034 GNU_ARCH.i386=i486 1035 GCC_CONFIG_ARCH.i386=i486 1036 GCC_CONFIG_TUNE.i386=nocona 1037 GCC_CONFIG_TUNE.x86_64=nocona 1038 GNU_ARCH.m68000=m68010 1039 GNU_ARCH.m68ksf=m68k 1040 GNU_ARCH.sh3eb=sh 1041 GNU_ARCH.sh3el=shle 1042 GNU_ARCH.mips64eb=mips64 1043 MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}:U${MACHINE_ARCH}} 1044 1045 # 1046 # In order to identify NetBSD to GNU packages, we sometimes need 1047 # an "elf" tag for historically a.out platforms. 1048 # 1049 .if (${MACHINE_ARCH:Mearm*}) 1050 MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf-${MACHINE_ARCH:C/eb//:C/v[4-7]//:S/earm/eabi/} 1051 .elif (${MACHINE_GNU_ARCH} == "arm" || \ 1052 ${MACHINE_GNU_ARCH} == "armeb" || \ 1053 ${MACHINE_ARCH} == "i386" || \ 1054 ${MACHINE_CPU} == "m68k" || \ 1055 ${MACHINE_GNU_ARCH} == "sh" || \ 1056 ${MACHINE_GNU_ARCH} == "shle" || \ 1057 ${MACHINE_ARCH} == "sparc" || \ 1058 ${MACHINE_ARCH} == "vax") 1059 MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf 1060 .else 1061 MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsd 1062 .endif 1063 1064 .if ${MACHINE_ARCH:M*arm*} 1065 # Flags to pass to CC for using the old APCS ABI on ARM for compat or stand. 1066 ARM_APCS_FLAGS= -mabi=apcs-gnu -mfloat-abi=soft -marm 1067 ARM_APCS_FLAGS+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8:? -mno-thumb-interwork :} 1068 ARM_APCS_FLAGS+=${${ACTIVE_CC} == "clang":? -target ${MACHINE_GNU_ARCH}--netbsdelf -B ${TOOLDIR}/${MACHINE_GNU_PLATFORM}/bin :} 1069 .endif 1070 1071 GENASSYM_CPPFLAGS+= ${${ACTIVE_CC} == "clang":? -no-integrated-as :} 1072 1073 TARGETS+= all clean cleandir depend dependall includes \ 1074 install lint obj regress tags html analyze describe \ 1075 rumpdescribe 1076 PHONY_NOTMAIN = all clean cleandir depend dependall distclean includes \ 1077 install lint obj regress beforedepend afterdepend \ 1078 beforeinstall afterinstall realinstall realdepend realall \ 1079 html subdir-all subdir-install subdir-depend analyze describe \ 1080 rumpdescribe 1081 .PHONY: ${PHONY_NOTMAIN} 1082 .NOTMAIN: ${PHONY_NOTMAIN} 1083 1084 .if ${NEED_OWN_INSTALL_TARGET} != "no" 1085 .if !target(install) 1086 install: beforeinstall .WAIT subdir-install realinstall .WAIT afterinstall 1087 beforeinstall: 1088 subdir-install: 1089 realinstall: 1090 afterinstall: 1091 .endif 1092 all: realall subdir-all 1093 subdir-all: 1094 realall: 1095 depend: realdepend subdir-depend 1096 subdir-depend: 1097 realdepend: 1098 distclean: cleandir 1099 cleandir: clean 1100 1101 dependall: .NOTMAIN realdepend .MAKE 1102 @cd "${.CURDIR}"; ${MAKE} realall 1103 .endif 1104 1105 # 1106 # Define MKxxx variables (which are either yes or no) for users 1107 # to set in /etc/mk.conf and override in the make environment. 1108 # These should be tested with `== "no"' or `!= "no"'. 1109 # The NOxxx variables should only be set by Makefiles. 1110 # 1111 # Please keep etc/Makefile and share/man/man5/mk.conf.5 in sync 1112 # with changes to the MK* variables here. 1113 # 1114 1115 # 1116 # Supported NO* options (if defined, MK* will be forced to "no", 1117 # regardless of user's mk.conf setting). 1118 # 1119 # Source makefiles should set NO*, and not MK*, and must do so before 1120 # including bsd.own.mk. 1121 # Please keep alphabetically sorted with one entry per line. 1122 # 1123 _NOVARS= \ 1124 NOCOMPAT \ 1125 NODEBUGLIB \ 1126 NODOC \ 1127 NOHTML \ 1128 NOINFO \ 1129 NOLIBCSANITIZER \ 1130 NOLINKLIB \ 1131 NOLINT \ 1132 NOMAN \ 1133 NONLS \ 1134 NOOBJ \ 1135 NOPIC \ 1136 NOPIE \ 1137 NOPICINSTALL \ 1138 NOPROFILE \ 1139 NORELRO \ 1140 NOSANITIZER \ 1141 NOSHARE \ 1142 NOSTATICLIB 1143 1144 .for var in ${_NOVARS} 1145 .if defined(${var}) 1146 MK${var:S/^NO//}:= no 1147 .endif 1148 .endfor 1149 1150 # 1151 # MK* options which have variable defaults. 1152 # 1153 1154 # 1155 # aarch64eb is not yet supported for MKCOMPAT. 1156 # 1157 .if ${MACHINE_ARCH} == "x86_64" || \ 1158 ${MACHINE_ARCH} == "sparc64" || \ 1159 ${MACHINE_MIPS64} || \ 1160 ${MACHINE_ARCH} == "powerpc64" || \ 1161 (${MACHINE_ARCH} == "aarch64" && ${HAVE_GCC:U0} == 0) || \ 1162 ${MACHINE_ARCH} == "riscv64" || \ 1163 ${MACHINE_ARCH:Mearm*} 1164 MKCOMPAT?= yes 1165 .else 1166 # Don't let this build where it really isn't supported. 1167 MKCOMPAT:= no 1168 .endif 1169 1170 .if ${MKCOMPAT} == "no" 1171 MKCOMPATTESTS:= no 1172 MKCOMPATX11:= no 1173 .endif 1174 1175 .if ${MACHINE_MIPS64} \ 1176 || (${MACHINE} == "evbppc" && ${MACHINE_ARCH} == "powerpc") 1177 MKCOMPATMODULES?= yes 1178 .else 1179 MKCOMPATMODULES:= no 1180 .endif 1181 1182 # 1183 # These platforms use softfloat by default. 1184 # 1185 .if ${MACHINE_MIPS64} 1186 MKSOFTFLOAT?= yes 1187 .endif 1188 1189 # 1190 # These platforms always use softfloat. 1191 # 1192 .if (${MACHINE_CPU} == "arm" && ${MACHINE_ARCH:M*hf*} == "") || \ 1193 ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "or1k" || \ 1194 ${MACHINE} == "emips" || ${MACHINE_CPU} == "sh3" || \ 1195 ${MACHINE_ARCH} == "m68ksf" 1196 MKSOFTFLOAT= yes 1197 .endif 1198 1199 .if ${MACHINE} == "emips" 1200 SOFTFLOAT_BITS= 32 1201 .endif 1202 1203 MKSOFTFLOAT?=no 1204 # 1205 # Prefer libc's softfloat.c 1206 # 1207 .if ${MKSOFTFLOAT} != "no" 1208 MKLIBCSOFTFLOAT?= yes 1209 .else 1210 MKLIBCSOFTFLOAT= no 1211 .endif 1212 1213 # 1214 # We want to build zfs only for amd64, aarch64 and sparc64 by default for now. 1215 # 1216 .if ${MACHINE} == "amd64" || \ 1217 ${MACHINE} == "sparc64" || \ 1218 ${MACHINE_ARCH:Maarch64*} 1219 MKZFS?= yes 1220 .endif 1221 1222 # 1223 # DTrace works on amd64, i386, aarch64, and earm* 1224 # 1225 .if ${MACHINE_ARCH} == "i386" || \ 1226 ${MACHINE_ARCH} == "x86_64" || \ 1227 ${MACHINE_ARCH} == "aarch64" || \ 1228 ${MACHINE_ARCH:Mearm*} 1229 MKDTRACE?= yes 1230 MKCTF?= yes 1231 .endif 1232 1233 # 1234 # PIE is enabled on many platforms by default. 1235 # 1236 # Coverity does not like PIE 1237 .if !defined(COVERITY_TOP_CONFIG) && \ 1238 (${MACHINE_ARCH} == "i386" || \ 1239 ${MACHINE_ARCH} == "x86_64" || \ 1240 ${MACHINE_ARCH:Maarch64*} || \ 1241 ${MACHINE_CPU} == "arm" || \ 1242 ${MACHINE} == "macppc" || \ 1243 ${MACHINE_CPU} == "m68k" || \ 1244 ${MACHINE_CPU} == "mips" || \ 1245 ${MACHINE_CPU} == "sh3" || \ 1246 ${MACHINE} == "sparc64") 1247 MKPIE?= yes 1248 .else 1249 MKPIE?= no 1250 .endif 1251 1252 # 1253 # RELRO is enabled on i386, amd64, and aarch64 by default 1254 # 1255 # sync with NORELRO in compat/*/*/bsd.*.mk for the relro-enabled 64-bit 1256 # platforms with relro-disabled 32-bit compat 1257 # 1258 .if ${MACHINE} == "i386" || \ 1259 ${MACHINE} == "amd64" || \ 1260 ${MACHINE_ARCH:Maarch64*} || \ 1261 ${MACHINE_MIPS64} 1262 MKRELRO?= partial 1263 .else 1264 MKRELRO?= no 1265 .endif 1266 1267 .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" 1268 MKSTATICPIE?= yes 1269 .else 1270 MKSTATICPIE?= no 1271 .endif 1272 1273 # 1274 # MK* options which default to "yes". 1275 # Please keep alphabetically sorted with one entry per line. 1276 # 1277 _MKVARS.yes= \ 1278 MKARGON2 \ 1279 MKATF \ 1280 MKBINUTILS \ 1281 MKBSDTAR \ 1282 MKCLEANSRC \ 1283 MKCLEANVERIFY \ 1284 MKCOMPLEX \ 1285 MKCVS \ 1286 MKCXX \ 1287 MKDOC \ 1288 MKDTC \ 1289 MKDYNAMICROOT \ 1290 MKGCC \ 1291 MKGDB \ 1292 MKGROFF \ 1293 MKHESIOD \ 1294 MKHTML \ 1295 MKIEEEFP \ 1296 MKINET6 \ 1297 MKINFO \ 1298 MKIPFILTER \ 1299 MKISCSI \ 1300 MKKERBEROS \ 1301 MKKMOD \ 1302 MKLDAP \ 1303 MKLIBSTDCXX \ 1304 MKLINKLIB \ 1305 MKLVM \ 1306 MKMAKEMANDB \ 1307 MKMAN \ 1308 MKMANDOC \ 1309 MKMDNS \ 1310 MKNLS \ 1311 MKNPF \ 1312 MKOBJ \ 1313 MKPAM \ 1314 MKPF \ 1315 MKPIC \ 1316 MKPICLIB \ 1317 MKPOSTFIX \ 1318 MKPROFILE \ 1319 MKRUMP \ 1320 MKSHARE \ 1321 MKSKEY \ 1322 MKSTATICLIB \ 1323 MKSTRIPSYM \ 1324 MKUNBOUND \ 1325 MKX11FONTS \ 1326 MKYP 1327 1328 .for var in ${_MKVARS.yes} 1329 ${var}?= ${${var}.${MACHINE_ARCH}:U${${var}.${MACHINE}:Uyes}} 1330 .endfor 1331 1332 # 1333 # MKGCCCMDS is only valid if we are building GCC so make it dependent on that. 1334 # 1335 _MKVARS.yes += MKGCCCMDS 1336 MKGCCCMDS?= ${MKGCC} 1337 1338 # 1339 # Sanitizers, only "address" and "undefined" are supported by gcc 1340 # 1341 MKSANITIZER?= no 1342 USE_SANITIZER?= address 1343 1344 # 1345 # Sanitizers implemented in libc, only "undefined" is supported 1346 # 1347 MKLIBCSANITIZER?= no 1348 USE_LIBCSANITIZER?= undefined 1349 1350 # 1351 # Exceptions to the above: 1352 # 1353 1354 # RUMP uses -nostdinc which coverity does not like 1355 # It also does not use many new files, so disable it 1356 .if defined(COVERITY_TOP_CONFIG) 1357 MKRUMP= no 1358 .endif 1359 1360 # 1361 # Build a dynamically linked /bin and /sbin, with the necessary shared 1362 # libraries moved from /usr/lib to /lib and the shared linker moved 1363 # from /usr/libexec to /lib 1364 # 1365 # Note that if the BINDIR is not /bin or /sbin, then we always use the 1366 # non-DYNAMICROOT behavior (i.e. it is only enabled for programs in /bin 1367 # and /sbin). See <bsd.shlib.mk>. 1368 # 1369 # For ia64, ld.elf_so not yet implemented 1370 .if ${MACHINE_ARCH} == "ia64" 1371 MKDYNAMICROOT= no 1372 .endif 1373 1374 .if defined(MKREPRO) 1375 MKARZERO ?= ${MKREPRO} 1376 GROFF_FLAGS ?= -dpaper=letter 1377 ROFF_PAGESIZE ?= -P-pletter 1378 .endif 1379 1380 # 1381 # Install the kernel as /netbsd/kernel and the modules in /netbsd/modules 1382 # 1383 KERNEL_DIR?= no 1384 1385 # Only install the general firmware on some systems 1386 MKFIRMWARE.amd64= yes 1387 MKFIRMWARE.cobalt= yes 1388 MKFIRMWARE.evbarm= yes 1389 MKFIRMWARE.evbmips= yes 1390 MKFIRMWARE.evbppc= yes 1391 MKFIRMWARE.hpcarm= yes 1392 MKFIRMWARE.hppa= yes 1393 MKFIRMWARE.i386= yes 1394 MKFIRMWARE.mac68k= yes 1395 MKFIRMWARE.macppc= yes 1396 MKFIRMWARE.riscv= yes 1397 MKFIRMWARE.sandpoint= yes 1398 MKFIRMWARE.sparc64= yes 1399 1400 # Only install the GPU firmware on DRM-happy systems. 1401 MKNOUVEAUFIRMWARE.x86_64= yes 1402 MKNOUVEAUFIRMWARE.i386= yes 1403 MKNOUVEAUFIRMWARE.aarch64= yes 1404 MKRADEONFIRMWARE.x86_64= yes 1405 MKRADEONFIRMWARE.i386= yes 1406 MKRADEONFIRMWARE.aarch64= yes 1407 MKAMDGPUFIRMWARE.x86_64= yes 1408 1409 # Only install the tegra firmware on evbarm. 1410 MKTEGRAFIRMWARE.evbarm= yes 1411 1412 # Only build devicetree (dtb) files on armv6, armv7, and aarch64. 1413 MKDTB.aarch64= yes 1414 MKDTB.aarch64eb= yes 1415 MKDTB.earmv6= yes 1416 MKDTB.earmv6hf= yes 1417 MKDTB.earmv6eb= yes 1418 MKDTB.earmv6hfeb= yes 1419 MKDTB.earmv7= yes 1420 MKDTB.earmv7hf= yes 1421 MKDTB.earmv7eb= yes 1422 MKDTB.earmv7hfeb= yes 1423 MKDTB.riscv32= yes 1424 MKDTB.riscv64= yes 1425 1426 # During transition from xorg-server 1.10 to 1.20 1427 # XXX sgimips uses XAA which is removed in 1.20, and EXA is hard 1428 # XXX to do the same with. 1429 .if ${MACHINE} == "sgimips" 1430 HAVE_XORG_SERVER_VER?=110 1431 .else 1432 HAVE_XORG_SERVER_VER?=120 1433 .endif 1434 1435 # Newer Mesa does not build with old X server 1436 .if ${HAVE_XORG_SERVER_VER} != "120" 1437 HAVE_MESA_VER?=19 1438 .endif 1439 1440 HAVE_MESA_VER?= 21 1441 .if ${HAVE_MESA_VER} == 19 1442 EXTERNAL_MESALIB_DIR?= MesaLib.old 1443 .elif ${HAVE_MESA_VER} == 21 1444 EXTERNAL_MESALIB_DIR?= MesaLib 1445 .endif 1446 1447 # Default to LLVM run-time if x86 or aarch64 and X11 and Mesa 18 or newer 1448 # XXX This knows that MKX11=no is default below, but would 1449 # require splitting the below loop in two parts. 1450 .if ${MKX11:Uno} != "no" && ${HAVE_MESA_VER} >= 19 1451 MKLLVMRT.amd64= yes 1452 MKLLVMRT.i386= yes 1453 MKLLVMRT.aarch64= yes 1454 .endif 1455 1456 # Just-in-time compiler for bpf, npf acceleration 1457 MKSLJIT.aarch64= yes 1458 MKSLJIT.i386= yes 1459 MKSLJIT.sparc= yes 1460 #MKSLJIT.sparc64= yes # not suppored in sljit (yet?) 1461 MKSLJIT.x86_64= yes 1462 #MKSLJIT.powerpc= yes # XXX 1463 #MKSLJIT.powerpc64= yes # XXX 1464 #MKSLJIT.mipsel= yes # XXX 1465 #MKSLJIT.mipseb= yes # XXX 1466 #MKSLJIT.mips64el= yes # XXX 1467 #MKSLJIT.mips64eb= yes # XXX 1468 #MKSLJIT.riscv32= yes # not until we update sljit 1469 #MKSLJIT.riscv64= yes # not until we update sljit 1470 1471 # compat with old names 1472 MKDEBUGKERNEL?=${MKKDEBUG:Uno} 1473 MKDEBUGTOOLS?=${MKTOOLSDEBUG:Uno} 1474 1475 # 1476 # MK* options which default to "no". 1477 # Note that MKZFS has a different default for some platforms, see above. 1478 # Please keep alphabetically sorted with one entry per line. 1479 # 1480 _MKVARS.no= \ 1481 MKAMDGPUFIRMWARE \ 1482 MKARZERO \ 1483 MKBSDGREP \ 1484 MKCATPAGES \ 1485 MKCOMPATTESTS \ 1486 MKCOMPATX11 \ 1487 MKCTF \ 1488 MKDEBUG \ 1489 MKDEBUGLIB \ 1490 MKDEPINCLUDES \ 1491 MKDTB \ 1492 MKDTRACE \ 1493 MKFIRMWARE \ 1494 MKGROFFHTMLDOC \ 1495 MKHOSTOBJ \ 1496 MKKYUA \ 1497 MKLIBCXX \ 1498 MKLINT \ 1499 MKLLVM \ 1500 MKLLVMRT \ 1501 MKMANZ \ 1502 MKNOUVEAUFIRMWARE \ 1503 MKNSD \ 1504 MKOBJDIRS \ 1505 MKPCC \ 1506 MKPICINSTALL \ 1507 MKPIGZGZIP \ 1508 MKRADEONFIRMWARE \ 1509 MKREPRO \ 1510 MKSLJIT \ 1511 MKSOFTFLOAT \ 1512 MKSTRIPIDENT \ 1513 MKTEGRAFIRMWARE \ 1514 MKTPM \ 1515 MKUNPRIVED \ 1516 MKUPDATE \ 1517 MKX11 \ 1518 MKX11MOTIF \ 1519 MKXORG_SERVER \ 1520 MKZFS 1521 1522 .for var in ${_MKVARS.no} 1523 ${var}?= ${${var}.${MACHINE_ARCH}:U${${var}.${MACHINE}:Uno}} 1524 .endfor 1525 1526 # 1527 # Which platforms build the xorg-server drivers (as opposed 1528 # to just Xnest and Xvfb.) 1529 # 1530 .if ${MACHINE} == "alpha" || \ 1531 ${MACHINE} == "amd64" || \ 1532 ${MACHINE} == "amiga" || \ 1533 ${MACHINE} == "bebox" || \ 1534 ${MACHINE} == "cats" || \ 1535 ${MACHINE} == "dreamcast" || \ 1536 ${MACHINE} == "ews4800mips" || \ 1537 ${MACHINE} == "evbarm" || \ 1538 ${MACHINE} == "evbmips" || \ 1539 ${MACHINE} == "evbppc" || \ 1540 ${MACHINE} == "hp300" || \ 1541 ${MACHINE} == "hpcarm" || \ 1542 ${MACHINE} == "hpcmips" || \ 1543 ${MACHINE} == "hpcsh" || \ 1544 ${MACHINE} == "hppa" || \ 1545 ${MACHINE} == "i386" || \ 1546 ${MACHINE} == "ibmnws" || \ 1547 ${MACHINE} == "iyonix" || \ 1548 ${MACHINE} == "luna68k" || \ 1549 ${MACHINE} == "mac68k" || \ 1550 ${MACHINE} == "macppc" || \ 1551 ${MACHINE} == "netwinder" || \ 1552 ${MACHINE} == "newsmips" || \ 1553 ${MACHINE} == "pmax" || \ 1554 ${MACHINE} == "prep" || \ 1555 ${MACHINE} == "ofppc" || \ 1556 ${MACHINE} == "sgimips" || \ 1557 ${MACHINE} == "shark" || \ 1558 ${MACHINE} == "sparc" || \ 1559 ${MACHINE} == "sparc64" || \ 1560 ${MACHINE} == "vax" || \ 1561 ${MACHINE} == "zaurus" 1562 MKXORG_SERVER=yes 1563 .endif 1564 1565 # 1566 # Force some options off if their dependencies are off. 1567 # 1568 1569 .if ${MKCXX} == "no" 1570 MKATF:= no 1571 MKGCCCMDS:= no 1572 MKGDB:= no 1573 MKGROFF:= no 1574 MKKYUA:= no 1575 .endif 1576 1577 .if ${MKMAN} == "no" 1578 MKCATPAGES:= no 1579 MKHTML:= no 1580 .endif 1581 1582 _MANINSTALL= maninstall 1583 .if ${MKCATPAGES} != "no" 1584 _MANINSTALL+= catinstall 1585 .endif 1586 .if ${MKHTML} != "no" 1587 _MANINSTALL+= htmlinstall 1588 .endif 1589 1590 .if ${MKLINKLIB} == "no" 1591 MKLINT:= no 1592 MKPICINSTALL:= no 1593 MKPROFILE:= no 1594 .endif 1595 1596 .if ${MKPIC} == "no" 1597 MKPICLIB:= no 1598 .endif 1599 1600 .if ${MKOBJ} == "no" 1601 MKOBJDIRS:= no 1602 .endif 1603 1604 .if ${MKSHARE} == "no" 1605 MKCATPAGES:= no 1606 MKDOC:= no 1607 MKINFO:= no 1608 MKHTML:= no 1609 MKMAN:= no 1610 MKNLS:= no 1611 .endif 1612 1613 .if ${MACHINE_ARCH:Mearm*} 1614 _NEEDS_LIBCXX.${MACHINE_ARCH}= yes 1615 .endif 1616 _NEEDS_LIBCXX.aarch64= yes 1617 _NEEDS_LIBCXX.aarch64eb= yes 1618 _NEEDS_LIBCXX.i386= yes 1619 _NEEDS_LIBCXX.powerpc= yes 1620 _NEEDS_LIBCXX.powerpc64= yes 1621 _NEEDS_LIBCXX.sparc= yes 1622 _NEEDS_LIBCXX.sparc64= yes 1623 _NEEDS_LIBCXX.x86_64= yes 1624 1625 .if ${MKLLVM} == "yes" && ${_NEEDS_LIBCXX.${MACHINE_ARCH}:Uno} == "yes" 1626 MKLIBCXX:= yes 1627 .endif 1628 1629 # 1630 # Disable MKSTRIPSYM if MKDEBUG is enabled. 1631 # 1632 .if ${MKDEBUG} != "no" 1633 MKSTRIPSYM:= no 1634 .endif 1635 1636 # 1637 # install(1) parameters. 1638 # 1639 COPY?= -c 1640 .if ${MKUPDATE} == "no" 1641 PRESERVE?= 1642 .else 1643 PRESERVE?= -p 1644 .endif 1645 RENAME?= -r 1646 HRDLINK?= -l h 1647 SYMLINK?= -l s 1648 1649 METALOG?= ${DESTDIR}/METALOG 1650 METALOG.add?= ${TOOL_CAT} -l >> ${METALOG} 1651 .if (${_SRC_TOP_} != "") # only set INSTPRIV if inside ${NETBSDSRCDIR} 1652 .if ${MKUNPRIVED} != "no" 1653 INSTPRIV.unpriv=-U -M ${METALOG} -D ${DESTDIR} -h sha256 1654 .else 1655 INSTPRIV.unpriv= 1656 .endif 1657 INSTPRIV?= ${INSTPRIV.unpriv} -N ${NETBSDSRCDIR}/etc 1658 .endif 1659 STRIPFLAG?= 1660 1661 INSTALL_DIR?= ${INSTALL} ${INSTPRIV} -d 1662 INSTALL_FILE?= ${INSTALL} ${INSTPRIV} ${COPY} ${PRESERVE} ${RENAME} 1663 INSTALL_LINK?= ${INSTALL} ${INSTPRIV} ${HRDLINK} ${RENAME} 1664 INSTALL_SYMLINK?= ${INSTALL} ${INSTPRIV} ${SYMLINK} ${RENAME} 1665 1666 # for crunchide & ldd, define the OBJECT_FMTS used by a MACHINE_ARCH 1667 # 1668 OBJECT_FMTS= 1669 .if ${MACHINE_ARCH} != "alpha" && ${MACHINE_ARCH} != "ia64" 1670 OBJECT_FMTS+= elf32 1671 .endif 1672 .if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH:M*64*} != "" 1673 . if !(${MKCOMPAT:Uyes} == "no" && ${MACHINE_ARCH:Mmips64*} != "") 1674 OBJECT_FMTS+= elf64 1675 . endif 1676 .endif 1677 1678 # 1679 # Set defaults for the USE_xxx variables. 1680 # 1681 1682 # 1683 # USE_* options which default to "no" and will be forced to "no" if their 1684 # corresponding MK* variable is set to "no". 1685 # 1686 .for var in USE_SKEY 1687 .if (${${var:S/USE_/MK/}} == "no") 1688 ${var}:= no 1689 .else 1690 ${var}?= no 1691 .endif 1692 .endfor 1693 1694 # 1695 # USE_* options which default to "yes" unless their corresponding MK* 1696 # variable is set to "no". 1697 # 1698 .for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP 1699 .if (${${var:S/USE_/MK/}} == "no") 1700 ${var}:= no 1701 .else 1702 ${var}?= yes 1703 .endif 1704 .endfor 1705 1706 # 1707 # USE_* options which default to "yes". 1708 # 1709 .for var in USE_JEMALLOC 1710 ${var}?= yes 1711 .endfor 1712 1713 # 1714 # USE_* options which default to "no". 1715 # 1716 # For now, disable pigz as compressor by default 1717 .for var in USE_PIGZGZIP 1718 ${var}?= no 1719 .endfor 1720 1721 # Default to USE_XZ_SETS on some 64bit architectures where decompressor 1722 # memory will likely not be in short supply. 1723 # Since pigz can not create .xz format files currently, disable .xz 1724 # format if USE_PIGZGZIP is enabled. 1725 .if ${USE_PIGZGZIP} == "no" && \ 1726 (${MACHINE} == "amd64" || \ 1727 ${MACHINE_ARCH:Maarch64*}) 1728 USE_XZ_SETS?= yes 1729 .else 1730 USE_XZ_SETS?= no 1731 .endif 1732 1733 # 1734 # TOOL_GZIP and friends. These might refer to TOOL_PIGZ or to the host gzip. 1735 # 1736 .if ${USE_PIGZGZIP} != "no" 1737 TOOL_GZIP= ${TOOL_PIGZ} 1738 GZIP_N_FLAG?= -nT 1739 .else 1740 .if ${USETOOLS} == "yes" 1741 TOOL_GZIP= ${TOOLDIR}/bin/${_TOOL_PREFIX}gzip 1742 .else 1743 TOOL_GZIP= gzip 1744 .endif 1745 GZIP_N_FLAG?= -n 1746 .endif 1747 TOOL_GZIP_N= ${TOOL_GZIP} ${GZIP_N_FLAG} 1748 1749 # 1750 # Where X11 sources are and where it is installed to. 1751 # 1752 .if !defined(X11SRCDIR) 1753 .if exists(${NETBSDSRCDIR}/../xsrc) 1754 X11SRCDIR!= cd "${NETBSDSRCDIR}/../xsrc" && pwd 1755 .else 1756 X11SRCDIR= /usr/xsrc 1757 .endif 1758 .endif # !defined(X11SRCDIR) 1759 1760 X11SRCDIR.local?= ${X11SRCDIR}/local 1761 X11ROOTDIR?= /usr/X11R7 1762 X11BINDIR?= ${X11ROOTDIR}/bin 1763 X11ETCDIR?= /etc/X11 1764 X11FONTDIR?= ${X11ROOTDIR}/lib/X11/fonts 1765 X11INCDIR?= ${X11ROOTDIR}/include 1766 X11LIBDIR?= ${X11ROOTDIR}/lib/X11 1767 X11MANDIR?= ${X11ROOTDIR}/man 1768 X11SHAREDIR?= ${X11ROOTDIR}/share 1769 X11USRLIBDIR?= ${X11ROOTDIR}/lib${MLIBDIR:D/${MLIBDIR}} 1770 1771 # 1772 # New modular-xorg based builds 1773 # 1774 X11SRCDIRMIT?= ${X11SRCDIR}/external/mit 1775 .for _lib in \ 1776 FS ICE SM X11 XScrnSaver XTrap Xau Xcomposite Xcursor Xdamage \ 1777 Xdmcp Xevie Xext Xfixes Xfont Xfont2 Xft Xi Xinerama Xmu Xpresent Xpm \ 1778 Xrandr Xrender Xres Xt Xtst Xv XvMC Xxf86dga Xxf86misc Xxf86vm drm \ 1779 epoxy fontenc vdpau xkbfile xkbui Xaw pciaccess xcb xshmfence \ 1780 pthread-stubs xcvt 1781 X11SRCDIR.${_lib}?= ${X11SRCDIRMIT}/lib${_lib}/dist 1782 .endfor 1783 1784 .for _proto in \ 1785 xcb- xorg 1786 X11SRCDIR.${_proto}proto?= ${X11SRCDIRMIT}/${_proto}proto/dist 1787 .endfor 1788 1789 # Build glamor extension? 1790 1791 .if ${HAVE_XORG_SERVER_VER} == "120" 1792 XORG_SERVER_SUBDIR?=xorg-server 1793 . if ${MACHINE} == "amd64" || ${MACHINE} == "i386" || ${MACHINE} == "evbarm" 1794 HAVE_XORG_GLAMOR?= yes 1795 . endif 1796 HAVE_XORG_EGL?= yes 1797 .else 1798 XORG_SERVER_SUBDIR?=xorg-server.old 1799 .endif 1800 1801 X11SRCDIR.xorg-server?= ${X11SRCDIRMIT}/${XORG_SERVER_SUBDIR}/dist 1802 HAVE_XORG_GLAMOR?= no 1803 HAVE_XORG_EGL?= no 1804 1805 .for _dir in \ 1806 xtrans fontconfig freetype evieext mkfontscale bdftopcf \ 1807 xorg-cf-files imake xbiff xkeyboard-config \ 1808 xcompmgr xbitmaps appres xeyes xev xedit sessreg pixman \ 1809 brotli \ 1810 beforelight bitmap editres makedepend fonttosfnt fslsfonts fstobdf \ 1811 glu glw mesa-demos MesaGLUT MesaLib MesaLib.old MesaLib7 \ 1812 ico iceauth listres lndir \ 1813 luit xproxymanagementprotocol mkfontdir oclock proxymngr rgb \ 1814 rstart setxkbmap showfont smproxy transset twm viewres \ 1815 util-macros \ 1816 x11perf xauth xcalc xclipboard \ 1817 xclock xcmsdb xconsole xditview xdpyinfo xdriinfo xdm \ 1818 xfd xf86dga xfindproxy xfontsel xgamma xgc xhost xinit \ 1819 xkill xload xlogo xlsatoms xlsclients xlsfonts xmag xmessage \ 1820 xmh xmodmap xmore xman xprop xrandr xrdb xrefresh xset \ 1821 xsetmode xsetpointer xsetroot xsm xstdcmap xvidtune xvinfo \ 1822 xwininfo xwud xkbprint xkbevd \ 1823 xterm xwd xfs xfsinfo xtrap xkbutils xkbcomp \ 1824 xinput xcb-util xorg-docs \ 1825 font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-100dpi \ 1826 font-adobe-utopia-75dpi font-adobe-utopia-type1 \ 1827 font-alias \ 1828 font-bh-100dpi font-bh-75dpi font-bh-lucidatypewriter-100dpi \ 1829 font-bh-lucidatypewriter-75dpi font-bh-ttf font-bh-type1 \ 1830 font-bitstream-100dpi font-bitstream-75dpi font-bitstream-type1 \ 1831 font-cursor-misc font-daewoo-misc font-dec-misc font-ibm-type1 \ 1832 font-isas-misc font-jis-misc font-misc-misc font-mutt-misc \ 1833 font-sony-misc font-util ttf-bitstream-vera encodings \ 1834 font-arabic-misc font-micro-misc font-schumacher-misc \ 1835 font-sun-misc font-cronyx-cyrillic font-misc-cyrillic \ 1836 font-screen-cyrillic font-winitzki-cyrillic font-xfree86-type1 1837 X11SRCDIR.${_dir}?= ${X11SRCDIRMIT}/${_dir}/dist 1838 .endfor 1839 1840 # X11SRCDIR.Mesa points to the currently used Mesa sources 1841 X11SRCDIR.Mesa?= ${X11SRCDIRMIT}/${EXTERNAL_MESALIB_DIR}/dist 1842 1843 .for _i in \ 1844 elographics keyboard mouse synaptics vmmouse void ws 1845 X11SRCDIR.xf86-input-${_i}?= ${X11SRCDIRMIT}/xf86-input-${_i}/dist 1846 .endfor 1847 1848 # xf86-video-modesetting move into the server build. 1849 EXTRA_DRIVERS= 1850 .if ${HAVE_XORG_SERVER_VER} == "120" 1851 X11SRCDIR.xf86-video-modesetting=${X11SRCDIR.xorg-server}/hw/xfree86/drivers/modesetting 1852 .else 1853 EXTRA_DRIVERS= modesetting 1854 .endif 1855 1856 .for _v in \ 1857 ag10e amdgpu apm ark ast ati ati-kms chips cirrus crime \ 1858 geode glint i128 i740 igs imstt intel intel-old intel-2014 \ 1859 ${EXTRA_DRIVERS} mach64 mga mgx \ 1860 neomagic newport ngle nouveau nsc nv openchrome pnozz \ 1861 r128 rendition \ 1862 s3 s3virge savage siliconmotion sis suncg14 \ 1863 suncg6 sunffb sunleo suntcx \ 1864 tdfx tga trident tseng vboxvideo vesa vga vmware wsfb xgi 1865 X11SRCDIR.xf86-video-${_v}?= ${X11SRCDIRMIT}/xf86-video-${_v}/dist 1866 .endfor 1867 1868 1869 X11DRI?= yes 1870 X11LOADABLE?= yes 1871 1872 1873 # 1874 # MAKEDIRTARGET dir target [extra make(1) params] 1875 # run "cd $${dir} && ${MAKEDIRTARGETENV} ${MAKE} [params] $${target}", with a pretty message 1876 # 1877 MAKEDIRTARGETENV?= 1878 MAKEDIRTARGET=\ 1879 @_makedirtarget() { \ 1880 dir="$$1"; shift; \ 1881 target="$$1"; shift; \ 1882 case "$${dir}" in \ 1883 /*) this="$${dir}/"; \ 1884 real="$${dir}" ;; \ 1885 .) this="${_THISDIR_}"; \ 1886 real="${.CURDIR}" ;; \ 1887 *) this="${_THISDIR_}$${dir}/"; \ 1888 real="${.CURDIR}/$${dir}" ;; \ 1889 esac; \ 1890 show=$${this:-.}; \ 1891 echo "$${target} ===> $${show%/}$${1:+ (with: $$@)}"; \ 1892 cd "$${real}" \ 1893 && ${MAKEDIRTARGETENV} ${MAKE} _THISDIR_="$${this}" "$$@" $${target}; \ 1894 }; \ 1895 _makedirtarget 1896 1897 # 1898 # MAKEVERBOSE support. Levels are: 1899 # 0 Minimal output ("quiet") 1900 # 1 Describe what is occurring 1901 # 2 Describe what is occurring and echo the actual command 1902 # 3 Ignore the effect of the "@" prefix in make commands 1903 # 4 Trace shell commands using the shell's -x flag 1904 # 1905 MAKEVERBOSE?= 2 1906 1907 .if ${MAKEVERBOSE} == 0 1908 _MKMSG?= @\# 1909 _MKSHMSG?= : echo 1910 _MKSHECHO?= : echo 1911 .SILENT: 1912 .elif ${MAKEVERBOSE} == 1 1913 _MKMSG?= @echo ' ' 1914 _MKSHMSG?= echo ' ' 1915 _MKSHECHO?= : echo 1916 .SILENT: 1917 .else # MAKEVERBOSE >= 2 1918 _MKMSG?= @echo '\# ' 1919 _MKSHMSG?= echo '\# ' 1920 _MKSHECHO?= echo 1921 .SILENT: __makeverbose_dummy_target__ 1922 .endif # MAKEVERBOSE >= 2 1923 .if ${MAKEVERBOSE} >= 3 1924 .MAKEFLAGS: -dl 1925 .endif # ${MAKEVERBOSE} >= 3 1926 .if ${MAKEVERBOSE} >= 4 1927 .MAKEFLAGS: -dx 1928 .endif # ${MAKEVERBOSE} >= 4 1929 1930 _MKMSG_BUILD?= ${_MKMSG} " build " 1931 _MKMSG_CREATE?= ${_MKMSG} " create " 1932 _MKMSG_COMPILE?= ${_MKMSG} "compile " 1933 _MKMSG_EXECUTE?= ${_MKMSG} "execute " 1934 _MKMSG_FORMAT?= ${_MKMSG} " format " 1935 _MKMSG_INSTALL?= ${_MKMSG} "install " 1936 _MKMSG_LINK?= ${_MKMSG} " link " 1937 _MKMSG_LEX?= ${_MKMSG} " lex " 1938 _MKMSG_REMOVE?= ${_MKMSG} " remove " 1939 _MKMSG_REGEN?= ${_MKMSG} " regen " 1940 _MKMSG_YACC?= ${_MKMSG} " yacc " 1941 1942 _MKSHMSG_CREATE?= ${_MKSHMSG} " create " 1943 _MKSHMSG_FORMAT?= ${_MKSHMSG} " format " 1944 _MKSHMSG_INSTALL?= ${_MKSHMSG} "install " 1945 1946 _MKTARGET_BUILD?= ${_MKMSG_BUILD} ${.CURDIR:T}/${.TARGET} 1947 _MKTARGET_CREATE?= ${_MKMSG_CREATE} ${.CURDIR:T}/${.TARGET} 1948 _MKTARGET_COMPILE?= ${_MKMSG_COMPILE} ${.CURDIR:T}/${.TARGET} 1949 _MKTARGET_FORMAT?= ${_MKMSG_FORMAT} ${.CURDIR:T}/${.TARGET} 1950 _MKTARGET_INSTALL?= ${_MKMSG_INSTALL} ${.TARGET} 1951 _MKTARGET_LINK?= ${_MKMSG_LINK} ${.CURDIR:T}/${.TARGET} 1952 _MKTARGET_LEX?= ${_MKMSG_LEX} ${.CURDIR:T}/${.TARGET} 1953 _MKTARGET_REMOVE?= ${_MKMSG_REMOVE} ${.TARGET} 1954 _MKTARGET_YACC?= ${_MKMSG_YACC} ${.CURDIR:T}/${.TARGET} 1955 1956 .if ${MKMANDOC} == "yes" 1957 TARGETS+= lintmanpages 1958 .endif 1959 1960 TESTSBASE= /usr/tests${MLIBDIR:D/${MLIBDIR}} 1961 1962 # Override with tools versions if needed 1963 .if ${MKCTF:Uno} != "no" && !defined(NOCTF) && \ 1964 (exists(${TOOL_CTFCONVERT}) || exists(/usr/bin/${TOOL_CTFCONVERT})) 1965 CTFCONVERT= ${TOOL_CTFCONVERT} 1966 CTFMERGE= ${TOOL_CTFMERGE} 1967 .endif 1968 1969 .endif # !defined(_BSD_OWN_MK_) 1970