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