Home | History | Annotate | Line # | Download | only in mk
bsd.own.mk revision 1.927
      1 #	$NetBSD: bsd.own.mk,v 1.926 2016/05/21 18:34:52 christos 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/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3/:S/coldfire/m68k/:S/m68000/m68k/:C/arm.*/arm/:C/earm.*/arm/:S/earm/arm/:S/powerpc64/powerpc/:S/aarch64eb/aarch64/:S/or1knd/or1k/:C/riscv../riscv/}
     18 
     19 #
     20 # Subdirectory used below ${RELEASEDIR} when building a release
     21 #
     22 RELEASEMACHINEDIR?=	${MACHINE}
     23 
     24 #
     25 # Subdirectory or path component used for the following paths:
     26 #   distrib/${RELEASEMACHINE}
     27 #   distrib/notes/${RELEASEMACHINE}
     28 #   etc/etc.${RELEASEMACHINE}
     29 # Used when building a release.
     30 #
     31 RELEASEMACHINE?=	${MACHINE}
     32 
     33 #
     34 # NEED_OWN_INSTALL_TARGET is set to "no" by pkgsrc/mk/bsd.pkg.mk to
     35 # ensure that things defined by <bsd.own.mk> (default targets,
     36 # INSTALL_FILE, etc.) are not conflicting with bsd.pkg.mk.
     37 #
     38 NEED_OWN_INSTALL_TARGET?=	yes
     39 
     40 #
     41 # This lists the platforms which do not have working in-tree toolchains.  For
     42 # the in-tree gcc toolchain, this list is empty.
     43 #
     44 # If some future port is not supported by the in-tree toolchain, this should
     45 # be set to "yes" for that port only.
     46 #
     47 # .if ${MACHINE} == "playstation2"
     48 # TOOLCHAIN_MISSING?=	yes
     49 # .endif
     50 
     51 TOOLCHAIN_MISSING?=	no
     52 
     53 .if ${MACHINE_CPU} == "aarch64" && !defined(EXTERNAL_TOOLCHAIN) && ${MKLLVM:Uyes} != "no"
     54 MKLLVM?=	yes
     55 HAVE_LLVM?=	yes
     56 MKGCC?=		no
     57 .endif
     58 
     59 #
     60 # GCC Using platforms.
     61 #
     62 .if ${MKGCC:Uyes} != "no"
     63 
     64 #
     65 # What GCC is used?
     66 #
     67 .if ${MACHINE_CPU} == "aarch64"
     68 HAVE_GCC?=	0
     69 .elif \
     70     ${MACHINE} == "amd64" || \
     71     ${MACHINE} == "hppa" || \
     72     ${MACHINE} == "i386" || \
     73     ${MACHINE} == "evbarm" || \
     74     ${MACHINE} == "playstation2" || \
     75     ${MACHINE_ARCH} == "powerpc" || \
     76     ${MACHINE_ARCH} == "vax"
     77 HAVE_GCC?=	53
     78 .else
     79 # Otherwise, default to GCC4.8
     80 HAVE_GCC?=	48
     81 .endif
     82 
     83 #
     84 # Platforms that can't run a modern GCC natively
     85 .if ${MACHINE_ARCH} == "m68000"
     86 MKGCCCMDS?=	no
     87 .endif
     88 
     89 #
     90 # We import the old gcc as "gcc.old" when upgrading.  EXTERNAL_GCC_SUBDIR is
     91 # set to the relevant subdirectory in src/external/gpl3 for his HAVE_GCC.
     92 #
     93 .if ${HAVE_GCC} == 53
     94 EXTERNAL_GCC_SUBDIR=	gcc
     95 .elif ${HAVE_GCC} == 48
     96 EXTERNAL_GCC_SUBDIR=	gcc.old
     97 .else
     98 EXTERNAL_GCC_SUBDIR=	/does/not/exist
     99 .endif
    100 .else
    101 MKGCCCMDS?=	no
    102 .endif
    103 
    104 .if !empty(MACHINE_ARCH:Mearm*)
    105 _LIBC_COMPILER_RT.${MACHINE_ARCH}=	yes
    106 .endif
    107 
    108 _LIBC_COMPILER_RT.aarch64=	yes
    109 _LIBC_COMPILER_RT.i386=		yes
    110 _LIBC_COMPILER_RT.powerpc=	yes
    111 _LIBC_COMPILER_RT.powerpc64=	yes
    112 _LIBC_COMPILER_RT.sparc=	yes
    113 _LIBC_COMPILER_RT.sparc64=	yes
    114 _LIBC_COMPILER_RT.x86_64=	yes
    115 
    116 .if ${HAVE_LLVM:Uno} == "yes" && ${_LIBC_COMPILER_RT.${MACHINE_ARCH}:Uno} == "yes"
    117 HAVE_LIBGCC?=	no
    118 .else
    119 HAVE_LIBGCC?=	yes
    120 .endif
    121 
    122 
    123 # ia64 is not support
    124 .if ${HAVE_LLVM:Uno} == "yes" || !empty(MACHINE_ARCH:Mearm*)
    125 HAVE_LIBGCC_EH?=	no
    126 .else
    127 HAVE_LIBGCC_EH?=	yes
    128 .endif
    129 
    130 .if ${MACHINE} == "alpha" || \
    131     ${MACHINE} == "hppa" || \
    132     ${MACHINE} == "ia64" || \
    133     ${MACHINE_CPU} == "mips"
    134 HAVE_SSP?=	no
    135 .else
    136 HAVE_SSP?=	yes
    137 .if !defined(NOFORT) && ${USE_FORT:Uno} != "no"
    138 USE_SSP?=	yes
    139 .endif
    140 .endif
    141 
    142 #
    143 # What GDB is used?
    144 #
    145 .if ${MACHINE} == "amd64" || \
    146     ${MACHINE} == "evbarm" || \
    147     ${MACHINE} == "i386" || \
    148     ${MACHINE} == "playstation2" || \
    149     ${MACHINE} == "sparc" || \
    150     ${MACHINE} == "vax" || \
    151     ${MACHINE_CPU} == "sh3" || \
    152     ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
    153 HAVE_GDB?=	710
    154 .else
    155 HAVE_GDB?=	79
    156 .endif
    157 
    158 .if ${HAVE_GDB} == 79
    159 EXTERNAL_GDB_SUBDIR=		gdb.old
    160 .else
    161 EXTERNAL_GDB_SUBDIR=		gdb
    162 .endif
    163 
    164 #
    165 # What binutils is used?
    166 #
    167 .if ${MACHINE} == "amd64" || \
    168     ${MACHINE} == "evbarm" || \
    169     ${MACHINE} == "hppa" || \
    170     ${MACHINE} == "i386" || \
    171     ${MACHINE} == "playstation2" || \
    172     ${MACHINE} == "sparc" || \
    173     ${MACHINE} == "vax" || \
    174     ${MACHINE_CPU} == "sh3" || \
    175     ${MACHINE_ARCH} == "powerpc"
    176 HAVE_BINUTILS?=	226
    177 .else
    178 HAVE_BINUTILS?=	223
    179 .endif
    180 
    181 .if ${HAVE_BINUTILS} == 223
    182 EXTERNAL_BINUTILS_SUBDIR=	binutils.old
    183 .elif ${HAVE_BINUTILS} == 226
    184 EXTERNAL_BINUTILS_SUBDIR=	binutils
    185 .else
    186 EXTERNAL_BINUTILS_SUBDIR=	/does/not/exist
    187 .endif
    188 
    189 .if empty(.MAKEFLAGS:tW:M*-V .OBJDIR*)
    190 .if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR)
    191 PRINTOBJDIR=	${MAKE} -r -V .OBJDIR -f /dev/null xxx
    192 .else
    193 PRINTOBJDIR=	${MAKE} -V .OBJDIR
    194 .endif
    195 .else
    196 PRINTOBJDIR=	echo /error/bsd.own.mk/PRINTOBJDIR # avoid infinite recursion
    197 .endif
    198 
    199 #
    200 # Determine if running in the NetBSD source tree by checking for the
    201 # existence of build.sh and tools/ in the current or a parent directory,
    202 # and setting _SRC_TOP_ to the result.
    203 #
    204 .if !defined(_SRC_TOP_)			# {
    205 _SRC_TOP_!= cd "${.CURDIR}"; while :; do \
    206 		here=`pwd`; \
    207 		[ -f build.sh  ] && [ -d tools ] && { echo $$here; break; }; \
    208 		case $$here in /) echo ""; break;; esac; \
    209 		cd ..; done
    210 
    211 .MAKEOVERRIDES+=	_SRC_TOP_
    212 
    213 .endif					# }
    214 
    215 #
    216 # If _SRC_TOP_ != "", we're within the NetBSD source tree.
    217 # * Set defaults for NETBSDSRCDIR and _SRC_TOP_OBJ_.
    218 # * Define _NETBSD_VERSION_DEPENDS.  Targets that depend on the
    219 #   NetBSD version, or on variables defined at build time, can
    220 #   declare a dependency on ${_NETBSD_VERSION_DEPENDS}.
    221 #
    222 .if (${_SRC_TOP_} != "")		# {
    223 
    224 NETBSDSRCDIR?=	${_SRC_TOP_}
    225 
    226 .if !defined(_SRC_TOP_OBJ_)
    227 _SRC_TOP_OBJ_!=		cd "${_SRC_TOP_}" && ${PRINTOBJDIR}
    228 .MAKEOVERRIDES+=	_SRC_TOP_OBJ_
    229 .endif
    230 
    231 _NETBSD_VERSION_DEPENDS=	${_SRC_TOP_OBJ_}/params
    232 _NETBSD_VERSION_DEPENDS+=	${NETBSDSRCDIR}/sys/sys/param.h
    233 _NETBSD_VERSION_DEPENDS+=	${NETBSDSRCDIR}/sys/conf/newvers.sh
    234 _NETBSD_VERSION_DEPENDS+=	${NETBSDSRCDIR}/sys/conf/osrelease.sh
    235 ${_SRC_TOP_OBJ_}/params: .NOTMAIN .OPTIONAL # created by top level "make build"
    236 
    237 .endif	# _SRC_TOP_ != ""		# }
    238 
    239 
    240 .if (${_SRC_TOP_} != "") && \
    241     (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN))
    242 USETOOLS?=	yes
    243 .endif
    244 USETOOLS?=	no
    245 
    246 
    247 .if ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "mips64" || \
    248     ${MACHINE_ARCH} == "sh3"
    249 .BEGIN:
    250 	@echo "Must set MACHINE_ARCH to one of ${MACHINE_ARCH}eb or ${MACHINE_ARCH}el"
    251 	@false
    252 .elif defined(REQUIRETOOLS) && \
    253       (${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)) && \
    254       ${USETOOLS} == "no"
    255 .BEGIN:
    256 	@echo "USETOOLS=no, but this component requires a version-specific host toolchain"
    257 	@false
    258 .endif
    259 
    260 #
    261 # Host platform information; may be overridden
    262 #
    263 .include <bsd.host.mk>
    264 
    265 .if ${USETOOLS} == "yes"						# {
    266 
    267 #
    268 # Provide a default for TOOLDIR.
    269 #
    270 .if !defined(TOOLDIR)
    271 TOOLDIR:=	${_SRC_TOP_OBJ_}/tooldir.${HOST_OSTYPE}
    272 .MAKEOVERRIDES+= TOOLDIR
    273 .endif
    274 
    275 #
    276 # This is the prefix used for the NetBSD-sourced tools.
    277 #
    278 _TOOL_PREFIX?=	nb
    279 
    280 #
    281 # If an external toolchain base is specified, use it.
    282 #
    283 .if defined(EXTERNAL_TOOLCHAIN)						# {
    284 AR=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ar
    285 AS=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-as
    286 LD=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ld
    287 NM=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-nm
    288 OBJCOPY=	${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objcopy
    289 OBJDUMP=	${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-objdump
    290 RANLIB=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-ranlib
    291 READELF=	${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-readelf
    292 SIZE=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-size
    293 STRINGS=	${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strings
    294 STRIP=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strip
    295 
    296 TOOL_CC.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc
    297 TOOL_CPP.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-cpp
    298 TOOL_CXX.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-c++
    299 TOOL_FC.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-g77
    300 TOOL_OBJC.gcc=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc
    301 
    302 TOOL_CC.clang=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang
    303 TOOL_CPP.clang=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp
    304 TOOL_CXX.clang=		${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang++
    305 TOOL_OBJC.clang=	${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-clang
    306 .else									# } {
    307 # Define default locations for common tools.
    308 .if ${USETOOLS_BINUTILS:Uyes} == "yes"					#  {
    309 AR=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ar
    310 AS=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-as
    311 LD=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ld
    312 NM=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-nm
    313 OBJCOPY=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objcopy
    314 OBJDUMP=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-objdump
    315 RANLIB=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ranlib
    316 READELF=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-readelf
    317 SIZE=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-size
    318 STRINGS=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strings
    319 STRIP=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strip
    320 
    321 # GCC supports C, C++, Fortran and Objective C
    322 TOOL_CC.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc
    323 TOOL_CPP.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-cpp
    324 TOOL_CXX.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-c++
    325 TOOL_FC.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-g77
    326 TOOL_OBJC.gcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc
    327 .endif									#  }
    328 
    329 # Clang supports C, C++ and Objective C
    330 TOOL_CC.clang=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang
    331 TOOL_CPP.clang=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp
    332 TOOL_CXX.clang=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang++
    333 TOOL_OBJC.clang=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang
    334 
    335 # PCC supports C and Fortran
    336 TOOL_CC.pcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-pcc
    337 TOOL_CPP.pcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-pcpp
    338 TOOL_CXX.pcc=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-p++
    339 
    340 #
    341 # Make sure DESTDIR is set, so that builds with these tools always
    342 # get appropriate -nostdinc, -nostdlib, etc. handling.  The default is
    343 # <empty string>, meaning start from /, the root directory.
    344 #
    345 DESTDIR?=
    346 
    347 .if !defined(HOSTPROG) && !defined(HOSTLIB)
    348 .  if ${DESTDIR} != ""
    349 CPPFLAGS+=	--sysroot=${DESTDIR}
    350 LDFLAGS+=	--sysroot=${DESTDIR}
    351 .  else
    352 CPPFLAGS+=	--sysroot=/
    353 LDFLAGS+=	--sysroot=/
    354 .  endif
    355 .endif
    356 .endif	# EXTERNAL_TOOLCHAIN						# }
    357 
    358 DBSYM=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-dbsym
    359 ELF2AOUT=	${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout
    360 ELF2ECOFF=	${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff
    361 INSTALL=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install
    362 LEX=		${TOOLDIR}/bin/${_TOOL_PREFIX}lex
    363 LINT=		CC=${CC:Q} ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-lint
    364 LORDER=		NM=${NM:Q} MKTEMP=${TOOL_MKTEMP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}lorder
    365 MKDEP=		CC=${CC:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}mkdep
    366 MKDEPCXX=	CC=${CXX:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}mkdep
    367 PAXCTL=		${TOOLDIR}/bin/${_TOOL_PREFIX}paxctl
    368 TSORT=		${TOOLDIR}/bin/${_TOOL_PREFIX}tsort -q
    369 YACC=		${TOOLDIR}/bin/${_TOOL_PREFIX}yacc
    370 
    371 TOOL_AMIGAAOUT2BB=	${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-aout2bb
    372 TOOL_AMIGAELF2BB=	${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-elf2bb
    373 TOOL_AMIGATXLT=		${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-txlt
    374 TOOL_ASN1_COMPILE=	${TOOLDIR}/bin/${_TOOL_PREFIX}asn1_compile
    375 TOOL_AWK=		${TOOLDIR}/bin/${_TOOL_PREFIX}awk
    376 TOOL_CAP_MKDB=		${TOOLDIR}/bin/${_TOOL_PREFIX}cap_mkdb
    377 TOOL_CAT=		${TOOLDIR}/bin/${_TOOL_PREFIX}cat
    378 TOOL_CKSUM=		${TOOLDIR}/bin/${_TOOL_PREFIX}cksum
    379 TOOL_CLANG_TBLGEN=		${TOOLDIR}/bin/${_TOOL_PREFIX}clang-tblgen
    380 TOOL_COMPILE_ET=	${TOOLDIR}/bin/${_TOOL_PREFIX}compile_et
    381 TOOL_CONFIG=		${TOOLDIR}/bin/${_TOOL_PREFIX}config
    382 TOOL_CRUNCHGEN=		MAKE=${.MAKE:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}crunchgen
    383 TOOL_CTAGS=		${TOOLDIR}/bin/${_TOOL_PREFIX}ctags
    384 TOOL_CTFCONVERT=	${TOOLDIR}/bin/${_TOOL_PREFIX}ctfconvert
    385 TOOL_CTFMERGE=		${TOOLDIR}/bin/${_TOOL_PREFIX}ctfmerge
    386 TOOL_CVSLATEST=		${TOOLDIR}/bin/${_TOOL_PREFIX}cvslatest
    387 TOOL_DB=		${TOOLDIR}/bin/${_TOOL_PREFIX}db
    388 TOOL_DISKLABEL=		${TOOLDIR}/bin/nbdisklabel
    389 TOOL_EQN=		${TOOLDIR}/bin/${_TOOL_PREFIX}eqn
    390 TOOL_FDISK=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk
    391 TOOL_FGEN=		${TOOLDIR}/bin/${_TOOL_PREFIX}fgen
    392 TOOL_GENASSYM=		${TOOLDIR}/bin/${_TOOL_PREFIX}genassym
    393 TOOL_GENCAT=		${TOOLDIR}/bin/${_TOOL_PREFIX}gencat
    394 TOOL_GMAKE=		${TOOLDIR}/bin/${_TOOL_PREFIX}gmake
    395 # grep exists in src/tools, but is not hooked up into the build.
    396 #TOOL_GREP=		${TOOLDIR}/bin/${_TOOL_PREFIX}grep
    397 TOOL_GREP=		grep
    398 TOOL_GROFF=		PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}groff
    399 TOOL_HEXDUMP=		${TOOLDIR}/bin/${_TOOL_PREFIX}hexdump
    400 TOOL_HP300MKBOOT=	${TOOLDIR}/bin/${_TOOL_PREFIX}hp300-mkboot
    401 TOOL_HPPAMKBOOT=	${TOOLDIR}/bin/${_TOOL_PREFIX}hppa-mkboot
    402 TOOL_INDXBIB=		${TOOLDIR}/bin/${_TOOL_PREFIX}indxbib
    403 TOOL_INSTALLBOOT=	${TOOLDIR}/bin/${_TOOL_PREFIX}installboot
    404 TOOL_INSTALL_INFO=	${TOOLDIR}/bin/${_TOOL_PREFIX}install-info
    405 TOOL_JOIN=		${TOOLDIR}/bin/${_TOOL_PREFIX}join
    406 TOOL_LLVM_TBLGEN=		${TOOLDIR}/bin/${_TOOL_PREFIX}llvm-tblgen
    407 TOOL_M4=		${TOOLDIR}/bin/${_TOOL_PREFIX}m4
    408 TOOL_MACPPCFIXCOFF=	${TOOLDIR}/bin/${_TOOL_PREFIX}macppc-fixcoff
    409 TOOL_MAKEFS=		${TOOLDIR}/bin/${_TOOL_PREFIX}makefs
    410 TOOL_MAKEINFO=		${TOOLDIR}/bin/${_TOOL_PREFIX}makeinfo
    411 TOOL_MAKEKEYS=		${TOOLDIR}/bin/${_TOOL_PREFIX}makekeys
    412 TOOL_MAKESTRS=		${TOOLDIR}/bin/${_TOOL_PREFIX}makestrs
    413 TOOL_MAKEWHATIS=	${TOOLDIR}/bin/${_TOOL_PREFIX}makewhatis
    414 TOOL_MANDOC_ASCII=	${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Tascii
    415 TOOL_MANDOC_HTML=	${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Thtml
    416 TOOL_MANDOC_LINT=	${TOOLDIR}/bin/${_TOOL_PREFIX}mandoc -Tlint
    417 TOOL_MDSETIMAGE=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-mdsetimage
    418 TOOL_MENUC=		MENUDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}menuc
    419 TOOL_M68KELF2AOUT=	${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout
    420 TOOL_MIPSELF2ECOFF=	${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff
    421 TOOL_MKCSMAPPER=	${TOOLDIR}/bin/${_TOOL_PREFIX}mkcsmapper
    422 TOOL_MKESDB=		${TOOLDIR}/bin/${_TOOL_PREFIX}mkesdb
    423 TOOL_MKLOCALE=		${TOOLDIR}/bin/${_TOOL_PREFIX}mklocale
    424 TOOL_MKMAGIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}file
    425 TOOL_MKNOD=		${TOOLDIR}/bin/${_TOOL_PREFIX}mknod
    426 TOOL_MKTEMP=		${TOOLDIR}/bin/${_TOOL_PREFIX}mktemp
    427 TOOL_MKUBOOTIMAGE=	${TOOLDIR}/bin/${_TOOL_PREFIX}mkubootimage
    428 TOOL_ELFTOSB=		${TOOLDIR}/bin/${_TOOL_PREFIX}elftosb
    429 TOOL_MSGC=		MSGDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}msgc
    430 TOOL_MTREE=		${TOOLDIR}/bin/${_TOOL_PREFIX}mtree
    431 TOOL_NBPERF=		${TOOLDIR}/bin/${_TOOL_PREFIX}perf
    432 TOOL_NCDCS=		${TOOLDIR}/bin/${_TOOL_PREFIX}ibmnws-ncdcs
    433 TOOL_PAX=		${TOOLDIR}/bin/${_TOOL_PREFIX}pax
    434 TOOL_PIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}pic
    435 TOOL_PIGZ=		${TOOLDIR}/bin/${_TOOL_PREFIX}pigz
    436 TOOL_PKG_CREATE=	${TOOLDIR}/bin/${_TOOL_PREFIX}pkg_create
    437 TOOL_POWERPCMKBOOTIMAGE=${TOOLDIR}/bin/${_TOOL_PREFIX}powerpc-mkbootimage
    438 TOOL_PWD_MKDB=		${TOOLDIR}/bin/${_TOOL_PREFIX}pwd_mkdb
    439 TOOL_REFER=		${TOOLDIR}/bin/${_TOOL_PREFIX}refer
    440 TOOL_ROFF_ASCII=	PATH=${TOOLDIR}/lib/groff:$${PATH} ${TOOLDIR}/bin/${_TOOL_PREFIX}nroff
    441 TOOL_ROFF_DOCASCII=	${TOOL_GROFF} -Tascii
    442 TOOL_ROFF_DOCHTML=	${TOOL_GROFF} -Thtml
    443 TOOL_ROFF_DVI=		${TOOL_GROFF} -Tdvi
    444 TOOL_ROFF_HTML=		${TOOL_GROFF} -Tlatin1 -mdoc2html
    445 TOOL_ROFF_PS=		${TOOL_GROFF} -Tps
    446 TOOL_ROFF_RAW=		${TOOL_GROFF} -Z
    447 TOOL_RPCGEN=		RPCGEN_CPP=${CPP:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}rpcgen
    448 TOOL_SED=		${TOOLDIR}/bin/${_TOOL_PREFIX}sed
    449 TOOL_SLC=		${TOOLDIR}/bin/${_TOOL_PREFIX}slc
    450 TOOL_SOELIM=		${TOOLDIR}/bin/${_TOOL_PREFIX}soelim
    451 TOOL_SORTINFO=		${TOOLDIR}/bin/${_TOOL_PREFIX}sortinfo
    452 TOOL_SPARKCRC=		${TOOLDIR}/bin/${_TOOL_PREFIX}sparkcrc
    453 TOOL_STAT=		${TOOLDIR}/bin/${_TOOL_PREFIX}stat
    454 TOOL_STRFILE=		${TOOLDIR}/bin/${_TOOL_PREFIX}strfile
    455 TOOL_SUNLABEL=		${TOOLDIR}/bin/${_TOOL_PREFIX}sunlabel
    456 TOOL_TBL=		${TOOLDIR}/bin/${_TOOL_PREFIX}tbl
    457 TOOL_TIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}tic
    458 TOOL_UUDECODE=		${TOOLDIR}/bin/${_TOOL_PREFIX}uudecode
    459 TOOL_VGRIND=		${TOOLDIR}/bin/${_TOOL_PREFIX}vgrind -f
    460 TOOL_VFONTEDPR=		${TOOLDIR}/libexec/${_TOOL_PREFIX}vfontedpr
    461 TOOL_ZIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}zic
    462 
    463 .else	# USETOOLS != yes						# } {
    464 
    465 # Clang supports C, C++ and Objective C
    466 TOOL_CC.clang=		clang
    467 TOOL_CPP.clang=		clang-cpp
    468 TOOL_CXX.clang=		clang++
    469 TOOL_OBJC.clang=	clang
    470 
    471 # GCC supports C, C++, Fortran and Objective C
    472 TOOL_CC.gcc=	gcc
    473 TOOL_CPP.gcc=	cpp
    474 TOOL_CXX.gcc=	c++
    475 TOOL_FC.gcc=	g77
    476 TOOL_OBJC.gcc=	gcc
    477 
    478 # PCC supports C and Fortran
    479 TOOL_CC.pcc=		pcc
    480 TOOL_CPP.pcc=		pcpp
    481 TOOL_CXX.pcc=		p++
    482 
    483 TOOL_AMIGAAOUT2BB=	amiga-aout2bb
    484 TOOL_AMIGAELF2BB=	amiga-elf2bb
    485 TOOL_AMIGATXLT=		amiga-txlt
    486 TOOL_ASN1_COMPILE=	asn1_compile
    487 TOOL_AWK=		awk
    488 TOOL_CAP_MKDB=		cap_mkdb
    489 TOOL_CAT=		cat
    490 TOOL_CKSUM=		cksum
    491 TOOL_CLANG_TBLGEN=	clang-tblgen
    492 TOOL_COMPILE_ET=	compile_et
    493 TOOL_CONFIG=		config
    494 TOOL_CRUNCHGEN=		crunchgen
    495 TOOL_CTAGS=		ctags
    496 TOOL_CTFCONVERT=	ctfconvert
    497 TOOL_CTFMERGE=		ctfmerge
    498 TOOL_CVSLATEST=		cvslatest
    499 TOOL_DB=		db
    500 TOOL_DISKLABEL=		disklabel
    501 TOOL_EQN=		eqn
    502 TOOL_FDISK=		fdisk
    503 TOOL_FGEN=		fgen
    504 TOOL_GENASSYM=		genassym
    505 TOOL_GENCAT=		gencat
    506 TOOL_GMAKE=		gmake
    507 TOOL_GREP=		grep
    508 TOOL_GROFF=		groff
    509 TOOL_HEXDUMP=		hexdump
    510 TOOL_HP300MKBOOT=	hp300-mkboot
    511 TOOL_HPPAMKBOOT=	hppa-mkboot
    512 TOOL_INDXBIB=		indxbib
    513 TOOL_INSTALLBOOT=	installboot
    514 TOOL_INSTALL_INFO=	install-info
    515 TOOL_JOIN=		join
    516 TOOL_LLVM_TBLGEN=	llvm-tblgen
    517 TOOL_M4=		m4
    518 TOOL_MACPPCFIXCOFF=	macppc-fixcoff
    519 TOOL_MAKEFS=		makefs
    520 TOOL_MAKEINFO=		makeinfo
    521 TOOL_MAKEKEYS=		makekeys
    522 TOOL_MAKESTRS=		makestrs
    523 TOOL_MAKEWHATIS=	/usr/libexec/makewhatis
    524 TOOL_MANDOC_ASCII=	mandoc -Tascii
    525 TOOL_MANDOC_HTML=	mandoc -Thtml
    526 TOOL_MANDOC_LINT=	mandoc -Tlint
    527 TOOL_MDSETIMAGE=	mdsetimage
    528 TOOL_MENUC=		menuc
    529 TOOL_M68KELF2AOUT=	m68k-elf2aout
    530 TOOL_MIPSELF2ECOFF=	mips-elf2ecoff
    531 TOOL_MKCSMAPPER=	mkcsmapper
    532 TOOL_MKESDB=		mkesdb
    533 TOOL_MKLOCALE=		mklocale
    534 TOOL_MKMAGIC=		file
    535 TOOL_MKNOD=		mknod
    536 TOOL_MKTEMP=		mktemp
    537 TOOL_MKUBOOTIMAGE=	mkubootimage
    538 TOOL_ELFTOSB=		elftosb
    539 TOOL_MSGC=		msgc
    540 TOOL_MTREE=		mtree
    541 TOOL_NBPERF=		nbperf
    542 TOOL_NCDCS=		ncdcs
    543 TOOL_PAX=		pax
    544 TOOL_PIC=		pic
    545 TOOL_PIGZ=		pigz
    546 TOOL_PKG_CREATE=	pkg_create
    547 TOOL_POWERPCMKBOOTIMAGE=	powerpc-mkbootimage
    548 TOOL_PWD_MKDB=		pwd_mkdb
    549 TOOL_REFER=		refer
    550 TOOL_ROFF_ASCII=	nroff
    551 TOOL_ROFF_DOCASCII=	${TOOL_GROFF} -Tascii
    552 TOOL_ROFF_DOCHTML=	${TOOL_GROFF} -Thtml
    553 TOOL_ROFF_DVI=		${TOOL_GROFF} -Tdvi
    554 TOOL_ROFF_HTML=		${TOOL_GROFF} -Tlatin1 -mdoc2html
    555 TOOL_ROFF_PS=		${TOOL_GROFF} -Tps
    556 TOOL_ROFF_RAW=		${TOOL_GROFF} -Z
    557 TOOL_RPCGEN=		rpcgen
    558 TOOL_SED=		sed
    559 TOOL_SOELIM=		soelim
    560 TOOL_SORTINFO=		sortinfo
    561 TOOL_SPARKCRC=		sparkcrc
    562 TOOL_STAT=		stat
    563 TOOL_STRFILE=		strfile
    564 TOOL_SUNLABEL=		sunlabel
    565 TOOL_TBL=		tbl
    566 TOOL_TIC=		tic
    567 TOOL_UUDECODE=		uudecode
    568 TOOL_VGRIND=		vgrind -f
    569 TOOL_VFONTEDPR=		/usr/libexec/vfontedpr
    570 TOOL_ZIC=		zic
    571 
    572 .endif	# USETOOLS != yes						# }
    573 
    574 # Standalone code should not be compiled with PIE or CTF
    575 # Should create a better test
    576 .if defined(BINDIR) && ${BINDIR} == "/usr/mdec"
    577 NOPIE=			# defined
    578 NOCTF=			# defined
    579 .endif
    580 
    581 # Fallback to ensure that all variables are defined to something
    582 TOOL_CC.false=		false
    583 TOOL_CPP.false=		false
    584 TOOL_CXX.false=		false
    585 TOOL_FC.false=		false
    586 TOOL_OBJC.false=	false
    587 
    588 AVAILABLE_COMPILER?=	${HAVE_PCC:Dpcc} ${HAVE_LLVM:Dclang} ${HAVE_GCC:Dgcc} ${EXTERNAL_TOOLCHAIN:Dgcc} false
    589 
    590 .for _t in CC CPP CXX FC OBJC
    591 ACTIVE_${_t}=	${AVAILABLE_COMPILER:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@:[1]}
    592 SUPPORTED_${_t}=${AVAILABLE_COMPILER:Nfalse:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@}
    593 .endfor
    594 # make bugs prevent moving this into the .for loop
    595 CC=		${TOOL_CC.${ACTIVE_CC}}
    596 CPP=		${TOOL_CPP.${ACTIVE_CPP}}
    597 CXX=		${TOOL_CXX.${ACTIVE_CXX}}
    598 FC=		${TOOL_FC.${ACTIVE_FC}}
    599 OBJC=		${TOOL_OBJC.${ACTIVE_OBJC}}
    600 
    601 # For each ${MACHINE_CPU}, list the ports that use it.
    602 MACHINES.aarch64=	evbarm64
    603 MACHINES.alpha=		alpha
    604 MACHINES.arm=		acorn26 acorn32 cats epoc32 evbarm hpcarm \
    605 			iyonix netwinder shark zaurus
    606 MACHINES.coldfire=	evbcf
    607 MACHINES.i386=		i386
    608 MACHINES.ia64=		ia64
    609 MACHINES.hppa=		hppa
    610 MACHINES.m68000=	sun2
    611 MACHINES.m68k=		amiga atari cesfic hp300 luna68k mac68k \
    612 			news68k next68k sun3 x68k
    613 MACHINES.mips=		arc cobalt algor cobalt emips evbmips ews4800mips \
    614 			hpcmips mipsco newsmips pmax sbmips sgimips
    615 MACHINES.or1k=		or1k
    616 MACHINES.powerpc=	amigappc bebox evbppc ibmnws macppc mvmeppc \
    617 			ofppc prep rs6000 sandpoint
    618 MACHINES.riscv=		riscv
    619 MACHINES.sh3=		dreamcast evbsh3 hpcsh landisk mmeye
    620 MACHINES.sparc=		sparc sparc64
    621 MACHINES.sparc64=	sparc64
    622 MACHINES.vax=		vax
    623 MACHINES.x86_64=	amd64
    624 
    625 # for crunchide & ldd, define the OBJECT_FMTS used by a MACHINE_ARCH
    626 #
    627 OBJECT_FMTS=
    628 .if	${MACHINE_ARCH} != "alpha" 
    629 OBJECT_FMTS+=	elf32
    630 .endif
    631 .if	${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH:M*64*} != ""
    632 OBJECT_FMTS+=	elf64
    633 .endif
    634 
    635 # OBJCOPY flags to create a.out binaries for old firmware
    636 # shared among src/distrib and ${MACHINE}/conf/Makefile.${MACHINE}.inc
    637 .if ${MACHINE_CPU} == "arm"
    638 OBJCOPY_ELF2AOUT_FLAGS?=	\
    639 	-O a.out-arm-netbsd	\
    640 	-R .ident		\
    641 	-R .ARM.attributes	\
    642 	-R .ARM.exidx		\
    643 	-R .ARM.extab		\
    644 	-R .SUNW_ctf		\
    645 	-R .arm.atpcs		\
    646 	-R .comment		\
    647 	-R .debug_abbrev	\
    648 	-R .debug_aranges	\
    649 	-R .debug_info		\
    650 	-R .debug_line		\
    651 	-R .debug_frame		\
    652 	-R .debug_loc		\
    653 	-R .debug_pubnames	\
    654 	-R .debug_pubtypes	\
    655 	-R .debug_ranges	\
    656 	-R .debug_str		\
    657 	-R .eh_frame		\
    658 	-R .note.netbsd.ident
    659 .endif
    660 
    661 #
    662 # Targets to check if DESTDIR or RELEASEDIR is provided
    663 #
    664 .if !target(check_DESTDIR)
    665 check_DESTDIR: .PHONY .NOTMAIN
    666 .if !defined(DESTDIR)
    667 	@echo "setenv DESTDIR before doing that!"
    668 	@false
    669 .else
    670 	@true
    671 .endif
    672 .endif
    673 
    674 .if !target(check_RELEASEDIR)
    675 check_RELEASEDIR: .PHONY .NOTMAIN
    676 .if !defined(RELEASEDIR)
    677 	@echo "setenv RELEASEDIR before doing that!"
    678 	@false
    679 .else
    680 	@true
    681 .endif
    682 .endif
    683 
    684 #
    685 # Build a dynamically linked /bin and /sbin, with the necessary shared
    686 # libraries moved from /usr/lib to /lib and the shared linker moved
    687 # from /usr/libexec to /lib
    688 #
    689 # Note that if the BINDIR is not /bin or /sbin, then we always use the
    690 # non-DYNAMICROOT behavior (i.e. it is only enabled for programs in /bin
    691 # and /sbin).  See <bsd.shlib.mk>.
    692 #
    693 MKDYNAMICROOT?=	yes
    694 
    695 #
    696 # Where the system object and source trees are kept; can be configurable
    697 # by the user in case they want them in ~/foosrc and ~/fooobj (for example).
    698 #
    699 BSDSRCDIR?=	/usr/src
    700 BSDOBJDIR?=	/usr/obj
    701 NETBSDSRCDIR?=	${BSDSRCDIR}
    702 
    703 BINGRP?=	wheel
    704 BINOWN?=	root
    705 BINMODE?=	555
    706 NONBINMODE?=	444
    707 
    708 # These are here mainly because we don't want suid root in case
    709 # a Makefile defines BINMODE.
    710 RUMPBINGRP?=	wheel
    711 RUMPBINOWN?=	root
    712 RUMPBINMODE?=	555
    713 RUMPNONBINMODE?=444
    714 
    715 MANDIR?=	/usr/share/man
    716 MANGRP?=	wheel
    717 MANOWN?=	root
    718 MANMODE?=	${NONBINMODE}
    719 MANINSTALL?=	${_MANINSTALL}
    720 
    721 INFODIR?=	/usr/share/info
    722 INFOGRP?=	wheel
    723 INFOOWN?=	root
    724 INFOMODE?=	${NONBINMODE}
    725 
    726 LIBDIR?=	/usr/lib
    727 
    728 LINTLIBDIR?=	/usr/libdata/lint
    729 LIBGRP?=	${BINGRP}
    730 LIBOWN?=	${BINOWN}
    731 LIBMODE?=	${NONBINMODE}
    732 
    733 DOCDIR?=	/usr/share/doc
    734 DOCGRP?=	wheel
    735 DOCOWN?=	root
    736 DOCMODE?=	${NONBINMODE}
    737 
    738 NLSDIR?=	/usr/share/nls
    739 NLSGRP?=	wheel
    740 NLSOWN?=	root
    741 NLSMODE?=	${NONBINMODE}
    742 
    743 KMODULEGRP?=	wheel
    744 KMODULEOWN?=	root
    745 KMODULEMODE?=	${NONBINMODE}
    746 
    747 LOCALEDIR?=	/usr/share/locale
    748 LOCALEGRP?=	wheel
    749 LOCALEOWN?=	root
    750 LOCALEMODE?=	${NONBINMODE}
    751 
    752 FIRMWAREDIR?=	/libdata/firmware
    753 FIRMWAREGRP?=	wheel
    754 FIRMWAREOWN?=	root
    755 FIRMWAREMODE?=	${NONBINMODE}
    756 
    757 DEBUGDIR?=	/usr/libdata/debug
    758 DEBUGGRP?=	wheel
    759 DEBUGOWN?=	root
    760 DEBUGMODE?=	${NONBINMODE}
    761 
    762 #
    763 # Data-driven table using make variables to control how
    764 # toolchain-dependent targets and shared libraries are built
    765 # for different platforms and object formats.
    766 #
    767 # OBJECT_FMT:		currently either "ELF" or "a.out".
    768 #
    769 # All platforms are ELF.
    770 #
    771 OBJECT_FMT=	ELF
    772 
    773 #
    774 # If this platform's toolchain is missing, we obviously cannot build it.
    775 #
    776 .if ${TOOLCHAIN_MISSING} != "no"
    777 MKBINUTILS:= no
    778 MKGDB:= no
    779 MKGCC:= no
    780 .endif
    781 
    782 #
    783 # If we are using an external toolchain, we can still build the target's
    784 # binutils, but we cannot build GCC's support libraries, since those are
    785 # tightly-coupled to the version of GCC being used.
    786 #
    787 .if defined(EXTERNAL_TOOLCHAIN)
    788 MKGCC:= no
    789 .endif
    790 
    791 # No GDB support for aarch64
    792 MKGDB.aarch64=	no
    793 MKGDB.or1k=	no
    794 MKGDB.riscv32=	no
    795 MKGDB.riscv64=	no
    796 
    797 # No kernel modules for or1k (yet)
    798 MKKMOD.or1k=	no
    799 MKKMOD.riscv32=	no
    800 MKKMOD.riscv64=	no
    801 
    802 # No profiling for or1k (yet)
    803 MKPROFILE.or1k=	no
    804 MKPROFILE.riscv32=no
    805 MKPROFILE.riscv64=no
    806 
    807 #
    808 # The m68000 port is incomplete.
    809 #
    810 .if ${MACHINE_ARCH} == "m68000"
    811 NOPIC=		# defined
    812 MKISCSI=	no
    813 # XXX GCC 4 outputs mcount() calling sequences that try to load values
    814 # from over 64KB away and this fails to assemble.
    815 .if defined(HAVE_GCC)
    816 NOPROFILE=	# defined
    817 .endif
    818 .endif
    819 
    820 #
    821 # The ia64 port is incomplete.
    822 #
    823 MKLINT.ia64=	no
    824 MKGDB.ia64=	no
    825 
    826 #
    827 # On the MIPS, all libs are compiled with ABIcalls (and are thus PIC),
    828 # not just shared libraries, so don't build the _pic version.
    829 #
    830 .if ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
    831     ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb"
    832 MKPICLIB:=	no
    833 .endif
    834 
    835 # PowerPC64 and AArch64 ABI's are PIC
    836 MKPICLIB.powerpc64=	no
    837 #MKPICLIB.aarch64=	no
    838 
    839 #
    840 # On VAX using ELF, all objects are PIC, not just shared libraries,
    841 # so don't build the _pic version.
    842 #
    843 MKPICLIB.vax=	no
    844 
    845 #
    846 # Location of the file that contains the major and minor numbers of the
    847 # version of a shared library.  If this file exists a shared library
    848 # will be built by <bsd.lib.mk>.
    849 #
    850 SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version
    851 
    852 #
    853 # GNU sources and packages sometimes see architecture names differently.
    854 #
    855 GNU_ARCH.aarch64eb=aarch64_be
    856 GNU_ARCH.coldfire=m5407
    857 GNU_ARCH.earm=arm
    858 GNU_ARCH.earmhf=arm
    859 GNU_ARCH.earmeb=armeb
    860 GNU_ARCH.earmhfeb=armeb
    861 GNU_ARCH.earmv4=armv4
    862 GNU_ARCH.earmv4eb=armv4eb
    863 GNU_ARCH.earmv5=arm
    864 GNU_ARCH.earmv5eb=armeb
    865 GNU_ARCH.earmv6=armv6
    866 GNU_ARCH.earmv6hf=armv6
    867 GNU_ARCH.earmv6eb=armv6eb
    868 GNU_ARCH.earmv6hfeb=armv6eb
    869 GNU_ARCH.earmv7=armv7
    870 GNU_ARCH.earmv7hf=armv7
    871 GNU_ARCH.earmv7eb=armv7eb
    872 GNU_ARCH.earmv7hfeb=armv7eb
    873 GNU_ARCH.i386=i486
    874 GCC_CONFIG_ARCH.i386=i486
    875 GCC_CONFIG_TUNE.i386=nocona
    876 GCC_CONFIG_TUNE.x86_64=nocona
    877 GNU_ARCH.m68000=m68010
    878 GNU_ARCH.sh3eb=sh
    879 GNU_ARCH.sh3el=shle
    880 GNU_ARCH.mips64eb=mips64
    881 MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}:U${MACHINE_ARCH}}
    882 
    883 #
    884 # In order to identify NetBSD to GNU packages, we sometimes need
    885 # an "elf" tag for historically a.out platforms.
    886 #
    887 .if (!empty(MACHINE_ARCH:Mearm*))
    888 MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf-${MACHINE_ARCH:C/eb//:C/v[4-7]//:S/earm/eabi/}
    889 .elif (${MACHINE_GNU_ARCH} == "arm" || \
    890      ${MACHINE_GNU_ARCH} == "armeb" || \
    891      ${MACHINE_ARCH} == "i386" || \
    892      ${MACHINE_CPU} == "m68k" || \
    893      ${MACHINE_GNU_ARCH} == "sh" || \
    894      ${MACHINE_GNU_ARCH} == "shle" || \
    895      ${MACHINE_ARCH} == "sparc" || \
    896      ${MACHINE_ARCH} == "vax")
    897 MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf
    898 .else
    899 MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsd
    900 .endif
    901 
    902 .if !empty(MACHINE_ARCH:M*arm*)
    903 # Flags to pass to CC for using the old APCS ABI on ARM for compat or stand.
    904 ARM_APCS_FLAGS=	-mabi=apcs-gnu -mfloat-abi=soft
    905 ARM_APCS_FLAGS+=${${ACTIVE_CC} == "gcc":? -marm :}
    906 ARM_APCS_FLAGS+=${${ACTIVE_CC} == "clang":? -target ${MACHINE_GNU_ARCH}--netbsdelf -B ${TOOLDIR}/${MACHINE_GNU_PLATFORM}/bin :}
    907 .endif
    908 
    909 GENASSYM_CPPFLAGS+=	${${ACTIVE_CC} == "clang":? -no-integrated-as :}
    910 
    911 TARGETS+=	all clean cleandir depend dependall includes \
    912 		install lint obj regress tags html analyze describe \
    913 		rumpdescribe
    914 PHONY_NOTMAIN =	all clean cleandir depend dependall distclean includes \
    915 		install lint obj regress beforedepend afterdepend \
    916 		beforeinstall afterinstall realinstall realdepend realall \
    917 		html subdir-all subdir-install subdir-depend analyze describe \
    918 		rumpdescribe
    919 .PHONY:		${PHONY_NOTMAIN}
    920 .NOTMAIN:	${PHONY_NOTMAIN}
    921 
    922 .if ${NEED_OWN_INSTALL_TARGET} != "no"
    923 .if !target(install)
    924 install:	beforeinstall .WAIT subdir-install realinstall .WAIT afterinstall
    925 beforeinstall:
    926 subdir-install:
    927 realinstall:
    928 afterinstall:
    929 .endif
    930 all:		realall subdir-all
    931 subdir-all:
    932 realall:
    933 depend:		realdepend subdir-depend
    934 subdir-depend:
    935 realdepend:
    936 distclean:	cleandir
    937 cleandir:	clean
    938 
    939 dependall:	.NOTMAIN realdepend .MAKE
    940 	@cd "${.CURDIR}"; ${MAKE} realall
    941 .endif
    942 
    943 #
    944 # Define MKxxx variables (which are either yes or no) for users
    945 # to set in /etc/mk.conf and override in the make environment.
    946 # These should be tested with `== "no"' or `!= "no"'.
    947 # The NOxxx variables should only be set by Makefiles.
    948 #
    949 # Please keep etc/Makefile and share/man/man5/mk.conf.5 in sync
    950 # with changes to the MK* variables here.
    951 #
    952 
    953 #
    954 # Supported NO* options (if defined, MK* will be forced to "no",
    955 # regardless of user's mk.conf setting).
    956 #
    957 # Source makefiles should set NO*, and not MK*, and must do so before
    958 # including bsd.own.mk.
    959 #
    960 .for var in \
    961 	NOCRYPTO NODOC NOHTML NOINFO NOLINKLIB NOLINT NOMAN NONLS NOOBJ NOPIC \
    962 	NOPICINSTALL NOPROFILE NOSHARE NOSTATICLIB
    963 .if defined(${var})
    964 MK${var:S/^NO//}:=	no
    965 .endif
    966 .endfor
    967 
    968 #
    969 # Older-style variables that enabled behaviour when set.
    970 #
    971 .for var in MANZ UNPRIVED UPDATE
    972 .if defined(${var})
    973 MK${var}:=	yes
    974 .endif
    975 .endfor
    976 
    977 #
    978 # MK* options which have variable defaults.
    979 #
    980 .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64" \
    981     || ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" \
    982     || ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_CPU} == "aarch64" \
    983     || ${MACHINE_ARCH} == "riscv64" \
    984     || (!empty(MACHINE_ARCH:Mearm*) && ${HAVE_GCC:U} == 48)
    985 MKCOMPAT?=	yes
    986 .else
    987 # Don't let this build where it really isn't supported.
    988 MKCOMPAT:=	no
    989 MKCOMPATTESTS:=	no
    990 MKCOMPATX11:=	no
    991 .endif
    992 
    993 .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" \
    994     || ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" \
    995     || (${MACHINE} == "evbppc" && ${MACHINE_ARCH} == "powerpc")
    996 MKCOMPATMODULES?=	yes
    997 .else
    998 MKCOMPATMODULES:=	no
    999 .endif
   1000 
   1001 #
   1002 # Default mips64 to softfloat now.
   1003 # arm is always softfloat unless it isn't
   1004 # emips is always softfloat.
   1005 # coldfire is always softfloat
   1006 # or1k is always softfloat
   1007 #
   1008 .if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el" || \
   1009     (${MACHINE_CPU} == "arm" && ${MACHINE_ARCH:M*hf*} == "") || \
   1010     ${MACHINE_ARCH} == "coldfire" || ${MACHINE_CPU} == "or1k" || \
   1011     ${MACHINE} == "emips"
   1012 MKSOFTFLOAT?=	yes
   1013 .endif
   1014 
   1015 .if ${MACHINE} == "emips"
   1016 SOFTFLOAT_BITS=	32
   1017 .endif
   1018 
   1019 .if ${MACHINE_ARCH} == "i386" || \
   1020     ${MACHINE_ARCH} == "x86_64" || \
   1021     ${MACHINE_ARCH} == "sparc" 
   1022 MKSLJIT?=	yes
   1023 .else
   1024 MKSLJIT?=	no
   1025 .endif
   1026 
   1027 #
   1028 # MK* backward compatibility.
   1029 #
   1030 .if defined(MKBFD)
   1031 MKBINUTILS?=	${MKBFD}
   1032 .endif
   1033 
   1034 #
   1035 # We want to build zfs only for amd64 by default for now.
   1036 #
   1037 .if ${MACHINE} == "amd64"
   1038 MKZFS?=		yes
   1039 .endif
   1040 
   1041 #
   1042 # DTrace works on amd64, i386 and earm*
   1043 #
   1044 
   1045 .if ${MACHINE_ARCH} == "i386" || \
   1046     ${MACHINE_ARCH} == "x86_64" || \
   1047     !empty(MACHINE_ARCH:Mearm*)
   1048 MKDTRACE?=	yes
   1049 MKCTF?=		yes
   1050 .endif
   1051 #
   1052 # PIE is enabled on amd64 by default
   1053 #
   1054 .if ${MACHINE_ARCH} == "i386" || \
   1055     ${MACHINE_ARCH} == "x86_64" || \
   1056     ${MACHINE} == "evbarm" || \
   1057     ${MACHINE} == "sparc64"
   1058 MKPIE?=		yes
   1059 .else
   1060 MKPIE?=		no
   1061 .endif
   1062 
   1063 #
   1064 # MK* options which default to "yes".
   1065 #
   1066 _MKVARS.yes= \
   1067 	MKATF \
   1068 	MKBINUTILS \
   1069 	MKCRYPTO MKCOMPLEX MKCVS MKCXX \
   1070 	MKDOC \
   1071 	MKGCC MKGDB MKGROFF \
   1072 	MKHESIOD MKHTML \
   1073 	MKIEEEFP MKINET6 MKINFO MKIPFILTER MKISCSI \
   1074 	MKKERBEROS \
   1075 	MKKMOD \
   1076 	MKLDAP MKLIBSTDCXX MKLINKLIB MKLVM \
   1077 	MKMAN MKMANDOC \
   1078 	MKMDNS \
   1079 	MKMAKEMANDB \
   1080 	MKNLS \
   1081 	MKNPF \
   1082 	MKOBJ \
   1083 	MKPAM MKPERFUSE \
   1084 	MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
   1085 	MKRUMP \
   1086 	MKSHARE MKSKEY MKSTATICLIB \
   1087 	MKX11FONTS \
   1088 	MKYP
   1089 .for var in ${_MKVARS.yes}
   1090 ${var}?=	${${var}.${MACHINE_ARCH}:Uyes}
   1091 .endfor
   1092 
   1093 #
   1094 # MKGCCCMDS is only valid if we are building GCC so make it dependent on that.
   1095 #
   1096 _MKVARS.yes += MKGCCCMDS
   1097 MKGCCCMDS?=	${MKGCC}
   1098 
   1099 #
   1100 # Exceptions to the above:
   1101 #
   1102 .if ${MACHINE} == "acorn26"	# page size is prohibitive
   1103 MKKMOD=		no
   1104 .endif
   1105 
   1106 #
   1107 # MK* options which default to "no".  Note that MKZFS has a different
   1108 # default for some platforms, see above.
   1109 #
   1110 _MKVARS.no= \
   1111 	MKBSDGREP MKBSDTAR \
   1112 	MKCATPAGES MKCOMPATTESTS MKCOMPATX11 MKCRYPTO_RC5 MKCTF MKDEBUG \
   1113 	MKDEBUGLIB MKDTRACE MKEXTSRC MKGROFFHTMLDOC \
   1114 	MKKYUA MKLLD MKLLDB MKLINT \
   1115 	MKMANZ MKMCLINKER MKOBJDIRS \
   1116 	MKLIBCXX MKLLVM MKPCC \
   1117 	MKPIGZGZIP \
   1118 	MKREPRO \
   1119 	MKSOFTFLOAT MKSTRIPIDENT MKTPM \
   1120 	MKUNPRIVED MKUPDATE MKX11 MKX11MOTIF MKZFS
   1121 .for var in ${_MKVARS.no}
   1122 ${var}?=	${${var}.${MACHINE_ARCH}:Uno}
   1123 .endfor
   1124 
   1125 #
   1126 # Which platforms build the xorg-server drivers (as opposed
   1127 # to just Xnest and Xvfb.)
   1128 #
   1129 .if ${MACHINE} == "alpha"	|| \
   1130     ${MACHINE} == "amd64"	|| \
   1131     ${MACHINE} == "amiga"	|| \
   1132     ${MACHINE} == "bebox"	|| \
   1133     ${MACHINE} == "cats"	|| \
   1134     ${MACHINE} == "dreamcast"	|| \
   1135     ${MACHINE} == "ews4800mips"	|| \
   1136     ${MACHINE} == "evbarm"	|| \
   1137     ${MACHINE} == "evbmips"	|| \
   1138     ${MACHINE} == "hp300"	|| \
   1139     ${MACHINE} == "hpcarm"	|| \
   1140     ${MACHINE} == "hpcmips"	|| \
   1141     ${MACHINE} == "hpcsh"	|| \
   1142     ${MACHINE} == "i386"	|| \
   1143     ${MACHINE} == "ibmnws"	|| \
   1144     ${MACHINE} == "luna68k"	|| \
   1145     ${MACHINE} == "mac68k"	|| \
   1146     ${MACHINE} == "macppc"	|| \
   1147     ${MACHINE} == "netwinder"	|| \
   1148     ${MACHINE} == "newsmips"	|| \
   1149     ${MACHINE} == "prep"	|| \
   1150     ${MACHINE} == "ofppc"	|| \
   1151     ${MACHINE} == "sgimips"	|| \
   1152     ${MACHINE} == "shark"	|| \
   1153     ${MACHINE} == "sparc"	|| \
   1154     ${MACHINE} == "sparc64"	|| \
   1155     ${MACHINE} == "vax"		|| \
   1156     ${MACHINE} == "zaurus"
   1157 MKXORG_SERVER?=yes
   1158 .else
   1159 MKXORG_SERVER?=no
   1160 .endif
   1161 
   1162 #
   1163 # Force some options off if their dependencies are off.
   1164 #
   1165 
   1166 .if ${MKCXX} == "no"
   1167 MKATF:=		no
   1168 MKGROFF:=	no
   1169 MKKYUA:=	no
   1170 .endif
   1171 
   1172 .if ${MKCRYPTO} == "no"
   1173 MKKERBEROS:=	no
   1174 MKLDAP:=	no
   1175 .endif
   1176 
   1177 .if ${MKMAN} == "no"
   1178 MKCATPAGES:=	no
   1179 MKHTML:=	no
   1180 .endif
   1181 
   1182 _MANINSTALL=	maninstall
   1183 .if ${MKCATPAGES} != "no"
   1184 _MANINSTALL+=	catinstall
   1185 .endif
   1186 .if ${MKHTML} != "no"
   1187 _MANINSTALL+=	htmlinstall
   1188 .endif
   1189 
   1190 .if ${MKLINKLIB} == "no"
   1191 MKLINT:=	no
   1192 MKPICINSTALL:=	no
   1193 MKPROFILE:=	no
   1194 .endif
   1195 
   1196 .if ${MKPIC} == "no"
   1197 MKPICLIB:=	no
   1198 .endif
   1199 
   1200 .if ${MKOBJ} == "no"
   1201 MKOBJDIRS:=	no
   1202 .endif
   1203 
   1204 .if ${MKSHARE} == "no"
   1205 MKCATPAGES:=	no
   1206 MKDOC:=		no
   1207 MKINFO:=	no
   1208 MKHTML:=	no
   1209 MKMAN:=		no
   1210 MKNLS:=		no
   1211 .endif
   1212 
   1213 .if !empty(MACHINE_ARCH:Mearm*)
   1214 _NEEDS_LIBCXX.${MACHINE_ARCH}=	yes
   1215 .endif
   1216 _NEEDS_LIBCXX.aarch64=		yes
   1217 _NEEDS_LIBCXX.i386=		yes
   1218 _NEEDS_LIBCXX.powerpc=		yes
   1219 _NEEDS_LIBCXX.powerpc64=	yes
   1220 _NEEDS_LIBCXX.sparc=		yes
   1221 _NEEDS_LIBCXX.sparc64=		yes
   1222 _NEEDS_LIBCXX.x86_64=		yes
   1223 
   1224 .if ${MKLLVM} == "yes" && ${_NEEDS_LIBCXX.${MACHINE_ARCH}:Uno} == "yes"
   1225 MKLIBCXX:=	yes
   1226 .endif
   1227 
   1228 #
   1229 # install(1) parameters.
   1230 #
   1231 COPY?=		-c
   1232 .if ${MKUPDATE} == "no"
   1233 PRESERVE?=	
   1234 .else
   1235 PRESERVE?=	-p
   1236 .endif
   1237 RENAME?=	-r
   1238 HRDLINK?=	-l h
   1239 SYMLINK?=	-l s
   1240 
   1241 METALOG?=	${DESTDIR}/METALOG
   1242 METALOG.add?=	${TOOL_CAT} -l >> ${METALOG}
   1243 .if (${_SRC_TOP_} != "")	# only set INSTPRIV if inside ${NETBSDSRCDIR}
   1244 .if ${MKUNPRIVED} != "no"
   1245 INSTPRIV.unpriv=-U -M ${METALOG} -D ${DESTDIR} -h sha256
   1246 .else
   1247 INSTPRIV.unpriv=
   1248 .endif
   1249 INSTPRIV?=	${INSTPRIV.unpriv} -N ${NETBSDSRCDIR}/etc
   1250 .endif
   1251 STRIPFLAG?=	
   1252 
   1253 .if ${NEED_OWN_INSTALL_TARGET} != "no"
   1254 INSTALL_DIR?=		${INSTALL} ${INSTPRIV} -d
   1255 INSTALL_FILE?=		${INSTALL} ${INSTPRIV} ${COPY} ${PRESERVE} ${RENAME}
   1256 INSTALL_LINK?=		${INSTALL} ${INSTPRIV} ${HRDLINK} ${RENAME}
   1257 INSTALL_SYMLINK?=	${INSTALL} ${INSTPRIV} ${SYMLINK} ${RENAME}
   1258 .endif
   1259 
   1260 #
   1261 # Set defaults for the USE_xxx variables.
   1262 #
   1263 
   1264 #
   1265 # USE_* options which default to "no" and will be forced to "no" if their
   1266 # corresponding MK* variable is set to "no".
   1267 #
   1268 .for var in USE_SKEY
   1269 .if (${${var:S/USE_/MK/}} == "no")
   1270 ${var}:= no
   1271 .else
   1272 ${var}?= no
   1273 .endif
   1274 .endfor
   1275 
   1276 #
   1277 # USE_* options which default to "yes" unless their corresponding MK*
   1278 # variable is set to "no".
   1279 #
   1280 .for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP
   1281 .if (${${var:S/USE_/MK/}} == "no")
   1282 ${var}:= no
   1283 .else
   1284 ${var}?= yes
   1285 .endif
   1286 .endfor
   1287 
   1288 #
   1289 # USE_* options which default to "yes".
   1290 #
   1291 .for var in USE_JEMALLOC
   1292 ${var}?= yes
   1293 .endfor
   1294 
   1295 #
   1296 # USE_* options which default to "no".
   1297 #
   1298 # For now, disable pigz as compressor by default
   1299 .for var in USE_PIGZGZIP USE_LIBTRE
   1300 ${var}?= no
   1301 .endfor
   1302 
   1303 #
   1304 # TOOL_GZIP and friends.  These might refer to TOOL_PIGZ or to the host gzip.
   1305 #
   1306 .if ${USE_PIGZGZIP} != "no"
   1307 TOOL_GZIP=		${TOOL_PIGZ}
   1308 GZIP_N_FLAG?=		-nT
   1309 .else
   1310 TOOL_GZIP=		gzip
   1311 GZIP_N_FLAG?=		-n
   1312 .endif
   1313 TOOL_GZIP_N=		${TOOL_GZIP} ${GZIP_N_FLAG}
   1314 
   1315 #
   1316 # Where X11 sources are and where it is installed to.
   1317 #
   1318 .if !defined(X11SRCDIR)
   1319 .if exists(${NETBSDSRCDIR}/../xsrc)
   1320 X11SRCDIR!=		cd "${NETBSDSRCDIR}/../xsrc" && pwd
   1321 .else
   1322 X11SRCDIR=		/usr/xsrc
   1323 .endif
   1324 .endif # !defined(X11SRCDIR)
   1325 
   1326 X11SRCDIR.local?=	${X11SRCDIR}/local
   1327 X11ROOTDIR?=		/usr/X11R7
   1328 X11BINDIR?=		${X11ROOTDIR}/bin
   1329 X11ETCDIR?=		/etc/X11
   1330 X11FONTDIR?=		${X11ROOTDIR}/lib/X11/fonts
   1331 X11INCDIR?=		${X11ROOTDIR}/include
   1332 X11LIBDIR?=		${X11ROOTDIR}/lib/X11
   1333 X11MANDIR?=		${X11ROOTDIR}/man
   1334 X11SHAREDIR?=		${X11ROOTDIR}/share
   1335 X11USRLIBDIR?=		${X11ROOTDIR}/lib${MLIBDIR:D/${MLIBDIR}}
   1336 
   1337 #
   1338 # New modular-xorg based builds
   1339 #
   1340 X11SRCDIRMIT?=		${X11SRCDIR}/external/mit
   1341 .for _lib in \
   1342 	FS ICE SM X11 XScrnSaver XTrap Xau Xcomposite Xcursor Xdamage \
   1343 	Xdmcp Xevie Xext Xfixes Xfont Xft Xi Xinerama Xmu Xpresent Xpm \
   1344 	Xrandr Xrender Xres Xt Xtst Xv XvMC Xxf86dga Xxf86misc Xxf86vm drm \
   1345 	fontenc xkbfile xkbui Xaw Xfontcache pciaccess xcb \
   1346 	pthread-stubs
   1347 X11SRCDIR.${_lib}?=		${X11SRCDIRMIT}/lib${_lib}/dist
   1348 .endfor
   1349 
   1350 .for _proto in \
   1351 	xcmisc xext xf86bigfont bigreqs input kb x fonts fixes scrnsaver \
   1352 	xinerama dri2 dri3 render resource record video xf86dga xf86misc \
   1353 	xf86vidmode composite damage trap gl randr fontcache xf86dri \
   1354 	present xcb-
   1355 X11SRCDIR.${_proto}proto?=		${X11SRCDIRMIT}/${_proto}proto/dist
   1356 .endfor
   1357 
   1358 .for _dir in \
   1359 	xtrans fontconfig freetype evieext mkfontscale bdftopcf \
   1360 	xkbcomp xorg-cf-files imake xorg-server xbiff xkeyboard-config \
   1361 	xbitmaps appres xeyes xev xedit sessreg pixman \
   1362 	beforelight bitmap editres makedepend fonttosfnt fslsfonts fstobdf \
   1363 	glu glw mesa-demos MesaGLUT MesaLib MesaLib7 \
   1364 	ico iceauth listres lndir \
   1365 	luit xproxymanagementprotocol mkfontdir oclock proxymngr rgb \
   1366 	rstart setxkbmap showfont smproxy twm viewres \
   1367 	x11perf xauth xcalc xclipboard \
   1368 	xclock xcmsdb xconsole xditview xdpyinfo xdriinfo xdm \
   1369 	xfd xf86dga xfindproxy xfontsel xfwp xgamma xgc xhost xinit \
   1370 	xkill xload xlogo xlsatoms xlsclients xlsfonts xmag xmessage \
   1371 	xmh xmodmap xmore xman xprop xrandr xrdb xrefresh xset \
   1372 	xsetmode xsetpointer xsetroot xsm xstdcmap xvidtune xvinfo \
   1373 	xwininfo xwud xkbprint xkbevd \
   1374 	xterm xwd xfs xfsinfo xtrap xkbutils xkbcomp \
   1375 	xkeyboard-config xinput xcb-util xorg-docs \
   1376 	font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-100dpi \
   1377 	font-adobe-utopia-75dpi font-adobe-utopia-type1 \
   1378 	font-alias \
   1379 	font-bh-100dpi font-bh-75dpi font-bh-lucidatypewriter-100dpi \
   1380 	font-bh-lucidatypewriter-75dpi font-bh-ttf font-bh-type1 \
   1381 	font-bitstream-100dpi font-bitstream-75dpi font-bitstream-type1 \
   1382 	font-cursor-misc font-daewoo-misc font-dec-misc font-ibm-type1 \
   1383 	font-isas-misc font-jis-misc font-misc-misc font-mutt-misc \
   1384 	font-sony-misc font-util ttf-bitstream-vera encodings
   1385 X11SRCDIR.${_dir}?=		${X11SRCDIRMIT}/${_dir}/dist
   1386 .endfor
   1387 
   1388 .for _i in \
   1389 	elographics keyboard mouse synaptics vmmouse void ws
   1390 X11SRCDIR.xf86-input-${_i}?=	${X11SRCDIRMIT}/xf86-input-${_i}/dist
   1391 .endfor
   1392 
   1393 .for _v in \
   1394 	ag10e apm ark ast ati ati-kms chips cirrus crime \
   1395 	geode glint i128 i740 igs imstt intel intel-old \
   1396 	modesetting mach64 mga \
   1397 	neomagic newport nouveau nsc nv nvxbox openchrome pnozz \
   1398 	r128 radeonhd rendition \
   1399 	s3 s3virge savage siliconmotion sis suncg14 \
   1400 	suncg6 sunffb sunleo suntcx \
   1401 	tdfx tga trident tseng vesa vga vmware wsfb xgi
   1402 X11SRCDIR.xf86-video-${_v}?=	${X11SRCDIRMIT}/xf86-video-${_v}/dist
   1403 .endfor
   1404 
   1405 # Only install the radeon firmware on DRM-happy systems.
   1406 .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386"
   1407 MKRADEONFIRMWARE?=		yes
   1408 .endif
   1409 MKRADEONFIRMWARE?=		no
   1410 
   1411 X11DRI?=			yes
   1412 X11LOADABLE?=			yes
   1413 
   1414 
   1415 #
   1416 # Where extsrc sources are and where it is installed to.
   1417 #
   1418 .if !defined(EXTSRCSRCDIR)
   1419 .if exists(${NETBSDSRCDIR}/../extsrc)
   1420 EXTSRCSRCDIR!=		cd "${NETBSDSRCDIR}/../extsrc" && pwd
   1421 .else
   1422 EXTSRCSRCDIR=		/usr/extsrc
   1423 .endif
   1424 .endif # !defined(EXTSRCSRCDIR)
   1425 
   1426 EXTSRCROOTDIR?=		/usr/ext
   1427 EXTSRCBINDIR?=		${EXTSRCROOTDIR}/bin
   1428 EXTSRCETCDIR?=		/etc/ext
   1429 EXTSRCINCDIR?=		${EXTSRCROOTDIR}/include
   1430 EXTSRCLIBDIR?=		${EXTSRCROOTDIR}/lib/ext
   1431 EXTSRCMANDIR?=		${EXTSRCROOTDIR}/man
   1432 EXTSRCUSRLIBDIR?=	${EXTSRCROOTDIR}/lib
   1433 
   1434 #
   1435 # MAKEDIRTARGET dir target [extra make(1) params]
   1436 #	run "cd $${dir} && ${MAKEDIRTARGETENV} ${MAKE} [params] $${target}", with a pretty message
   1437 #
   1438 MAKEDIRTARGETENV?=
   1439 MAKEDIRTARGET=\
   1440 	@_makedirtarget() { \
   1441 		dir="$$1"; shift; \
   1442 		target="$$1"; shift; \
   1443 		case "$${dir}" in \
   1444 		/*)	this="$${dir}/"; \
   1445 			real="$${dir}" ;; \
   1446 		.)	this="${_THISDIR_}"; \
   1447 			real="${.CURDIR}" ;; \
   1448 		*)	this="${_THISDIR_}$${dir}/"; \
   1449 			real="${.CURDIR}/$${dir}" ;; \
   1450 		esac; \
   1451 		show=$${this:-.}; \
   1452 		echo "$${target} ===> $${show%/}$${1:+	(with: $$@)}"; \
   1453 		cd "$${real}" \
   1454 		&& ${MAKEDIRTARGETENV} ${MAKE} _THISDIR_="$${this}" "$$@" $${target}; \
   1455 	}; \
   1456 	_makedirtarget
   1457 
   1458 #
   1459 # MAKEVERBOSE support.  Levels are:
   1460 #	0	Minimal output ("quiet")
   1461 #	1	Describe what is occurring
   1462 #	2	Describe what is occurring and echo the actual command
   1463 #	3	Ignore the effect of the "@" prefix in make commands
   1464 #	4	Trace shell commands using the shell's -x flag
   1465 #		
   1466 MAKEVERBOSE?=		2
   1467 
   1468 .if ${MAKEVERBOSE} == 0
   1469 _MKMSG?=	@\#
   1470 _MKSHMSG?=	: echo
   1471 _MKSHECHO?=	: echo
   1472 .SILENT:
   1473 .elif ${MAKEVERBOSE} == 1
   1474 _MKMSG?=	@echo '   '
   1475 _MKSHMSG?=	echo '   '
   1476 _MKSHECHO?=	: echo
   1477 .SILENT:
   1478 .else	# MAKEVERBOSE >= 2
   1479 _MKMSG?=	@echo '\#  '
   1480 _MKSHMSG?=	echo '\#  '
   1481 _MKSHECHO?=	echo
   1482 .SILENT: __makeverbose_dummy_target__
   1483 .endif	# MAKEVERBOSE >= 2
   1484 .if ${MAKEVERBOSE} >= 3
   1485 .MAKEFLAGS:	-dl
   1486 .endif	# ${MAKEVERBOSE} >= 3
   1487 .if ${MAKEVERBOSE} >= 4
   1488 .MAKEFLAGS:	-dx
   1489 .endif	# ${MAKEVERBOSE} >= 4
   1490 
   1491 _MKMSG_BUILD?=		${_MKMSG} "  build "
   1492 _MKMSG_CREATE?=		${_MKMSG} " create "
   1493 _MKMSG_COMPILE?=	${_MKMSG} "compile "
   1494 _MKMSG_FORMAT?=		${_MKMSG} " format "
   1495 _MKMSG_INSTALL?=	${_MKMSG} "install "
   1496 _MKMSG_LINK?=		${_MKMSG} "   link "
   1497 _MKMSG_LEX?=		${_MKMSG} "    lex "
   1498 _MKMSG_REMOVE?=		${_MKMSG} " remove "
   1499 _MKMSG_YACC?=		${_MKMSG} "   yacc "
   1500 
   1501 _MKSHMSG_CREATE?=	${_MKSHMSG} " create "
   1502 _MKSHMSG_INSTALL?=	${_MKSHMSG} "install "
   1503 
   1504 _MKTARGET_BUILD?=	${_MKMSG_BUILD} ${.CURDIR:T}/${.TARGET}
   1505 _MKTARGET_CREATE?=	${_MKMSG_CREATE} ${.CURDIR:T}/${.TARGET}
   1506 _MKTARGET_COMPILE?=	${_MKMSG_COMPILE} ${.CURDIR:T}/${.TARGET}
   1507 _MKTARGET_FORMAT?=	${_MKMSG_FORMAT} ${.CURDIR:T}/${.TARGET}
   1508 _MKTARGET_INSTALL?=	${_MKMSG_INSTALL} ${.TARGET}
   1509 _MKTARGET_LINK?=	${_MKMSG_LINK} ${.CURDIR:T}/${.TARGET}
   1510 _MKTARGET_LEX?=		${_MKMSG_LEX} ${.CURDIR:T}/${.TARGET}
   1511 _MKTARGET_REMOVE?=	${_MKMSG_REMOVE} ${.TARGET}
   1512 _MKTARGET_YACC?=	${_MKMSG_YACC} ${.CURDIR:T}/${.TARGET}
   1513 
   1514 .if ${MKMANDOC} == "yes"
   1515 TARGETS+=	lintmanpages
   1516 .endif
   1517 
   1518 TESTSBASE=	/usr/tests${MLIBDIR:D/${MLIBDIR}}
   1519 
   1520 # Override with tools versions if needed
   1521 .if ${MKCTF:Uno} != "no" && !defined(NOCTF)
   1522 CTFCONVERT=	${TOOL_CTFCONVERT}
   1523 CTFMERGE=	${TOOL_CTFMERGE}
   1524 .endif
   1525 
   1526 .endif	# !defined(_BSD_OWN_MK_)
   1527