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