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