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