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