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