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