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