src.opts.mk revision 357082
1# $FreeBSD: stable/11/share/mk/src.opts.mk 357082 2020-01-24 15:29:33Z kevans $ 2# 3# Option file for FreeBSD /usr/src builds. 4# 5# Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf 6# and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no} 7# with sensible (usually) defaults. 8# 9# Makefiles must include bsd.opts.mk after defining specific MK_FOO options that 10# are applicable for that Makefile (typically there are none, but sometimes there 11# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish 12# to omit from that make. 13# 14# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO 15# variable. 16# 17# Makefiles may also assume that this file is included by src.opts.mk should it 18# need variables defined there prior to the end of the Makefile where 19# bsd.{subdir,lib.bin}.mk is traditionally included. 20# 21# The old-style YES_FOO and NO_FOO are being phased out. No new instances of them 22# should be added. Old instances should be removed since they were just to 23# bridge the gap between FreeBSD 4 and FreeBSD 5. 24# 25# Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an 26# exception is made for _WITHOUT_SRCONF which turns off this mechanism 27# completely inside bsd.*.mk files). 28# 29 30.if !target(__<src.opts.mk>__) 31__<src.opts.mk>__: 32 33.include <bsd.own.mk> 34 35# 36# Define MK_* variables (which are either "yes" or "no") for users 37# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the 38# make(1) environment. 39# These should be tested with `== "no"' or `!= "no"' in makefiles. 40# The NO_* variables should only be set by makefiles for variables 41# that haven't been converted over. 42# 43 44# These options are used by src the builds 45 46__DEFAULT_YES_OPTIONS = \ 47 ACCT \ 48 ACPI \ 49 AMD \ 50 APM \ 51 AT \ 52 ATM \ 53 AUDIT \ 54 AUTHPF \ 55 AUTOFS \ 56 BHYVE \ 57 BINUTILS \ 58 BINUTILS_BOOTSTRAP \ 59 BLACKLIST \ 60 BLUETOOTH \ 61 BOOT \ 62 BOOTPARAMD \ 63 BOOTPD \ 64 BSD_CPIO \ 65 BSD_GREP_FASTMATCH \ 66 BSDINSTALL \ 67 BSNMP \ 68 BZIP2 \ 69 CALENDAR \ 70 CAPSICUM \ 71 CAROOT \ 72 CASPER \ 73 CCD \ 74 CDDL \ 75 CPP \ 76 CROSS_COMPILER \ 77 CRYPT \ 78 CTM \ 79 CUSE \ 80 CXX \ 81 DIALOG \ 82 DICT \ 83 DMAGENT \ 84 DYNAMICROOT \ 85 ED_CRYPTO \ 86 EE \ 87 ELFCOPY_AS_OBJCOPY \ 88 EFI \ 89 ELFTOOLCHAIN_BOOTSTRAP \ 90 EXAMPLES \ 91 FDT \ 92 FILE \ 93 FINGER \ 94 FLOPPY \ 95 FMTREE \ 96 FORTH \ 97 FP_LIBC \ 98 FREEBSD_UPDATE \ 99 FTP \ 100 GAMES \ 101 GCOV \ 102 GDB \ 103 GNU \ 104 GNU_DIFF \ 105 GNU_GREP \ 106 GNU_GREP_COMPAT \ 107 GPIO \ 108 GPL_DTC \ 109 GROFF \ 110 HAST \ 111 HTML \ 112 HYPERV \ 113 ICONV \ 114 INET \ 115 INET6 \ 116 INETD \ 117 IPFILTER \ 118 IPFW \ 119 ISCSI \ 120 JAIL \ 121 KDUMP \ 122 KVM \ 123 LDNS \ 124 LDNS_UTILS \ 125 LEGACY_CONSOLE \ 126 LIB32 \ 127 LIBPTHREAD \ 128 LIBTHR \ 129 LLVM_COV \ 130 LOADER_GELI \ 131 LOADER_LUA \ 132 LOADER_OFW \ 133 LOADER_UBOOT \ 134 LOCALES \ 135 LOCATE \ 136 LPR \ 137 LS_COLORS \ 138 LZMA_SUPPORT \ 139 MAIL \ 140 MAILWRAPPER \ 141 MAKE \ 142 MANDOCDB \ 143 NDIS \ 144 NETCAT \ 145 NETGRAPH \ 146 NLS_CATALOGS \ 147 NS_CACHING \ 148 NTP \ 149 OPENSSL \ 150 PAM \ 151 PC_SYSINSTALL \ 152 PF \ 153 PKGBOOTSTRAP \ 154 PMC \ 155 PORTSNAP \ 156 PPP \ 157 QUOTAS \ 158 RADIUS_SUPPORT \ 159 RCMDS \ 160 RBOOTD \ 161 RCS \ 162 RESCUE \ 163 ROUTED \ 164 SENDMAIL \ 165 SETUID_LOGIN \ 166 SHAREDOCS \ 167 SOURCELESS \ 168 SOURCELESS_HOST \ 169 SOURCELESS_UCODE \ 170 SVNLITE \ 171 SYSCONS \ 172 SYSTEM_COMPILER \ 173 TALK \ 174 TCP_WRAPPERS \ 175 TCSH \ 176 TELNET \ 177 TESTS \ 178 TEXTPROC \ 179 TFTP \ 180 TIMED \ 181 UNBOUND \ 182 USB \ 183 UTMPX \ 184 VI \ 185 VT \ 186 WIRELESS \ 187 WPA_SUPPLICANT_EAPOL \ 188 ZFS \ 189 LOADER_ZFS \ 190 ZONEINFO 191 192__DEFAULT_NO_OPTIONS = \ 193 BSD_GREP \ 194 CLANG_EXTRAS \ 195 DTRACE_TESTS \ 196 EISA \ 197 HESIOD \ 198 LIBSOFT \ 199 LINT \ 200 LOADER_FIREWIRE \ 201 LOADER_FORCE_LE \ 202 LOADER_VERBOSE \ 203 NAND \ 204 OFED_EXTRA \ 205 OPENLDAP \ 206 REPRODUCIBLE_BUILD \ 207 RPCBIND_WARMSTART_SUPPORT \ 208 SHARED_TOOLCHAIN \ 209 SORT_THREADS \ 210 SVN \ 211 ZONEINFO_LEAPSECONDS_SUPPORT \ 212 ZONEINFO_OLD_TIMEZONES_SUPPORT \ 213 214 215# 216# Default behaviour of some options depends on the architecture. Unfortunately 217# this means that we have to test TARGET_ARCH (the buildworld case) as well 218# as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not 219# used at all in bsd.*.mk, but we have to make an exception here if we want 220# to allow defaults for some things like clang to vary by target architecture. 221# Additional, per-target behavior should be rarely added only after much 222# gnashing of teeth and grinding of gears. 223# 224.if defined(TARGET_ARCH) 225__T=${TARGET_ARCH} 226.else 227__T=${MACHINE_ARCH} 228.endif 229.if defined(TARGET) 230__TT=${TARGET} 231.else 232__TT=${MACHINE} 233.endif 234 235__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF 236__DEFAULT_NO_OPTIONS+=LLVM_TARGET_RISCV 237 238.include <bsd.compiler.mk> 239# If the compiler is not C++11 capable, disable Clang and use GCC instead. 240# This means that architectures that have GCC 4.2 as default can not 241# build Clang without using an external compiler. 242 243.if ${COMPILER_FEATURES:Mc++11} && (${__T} == "aarch64" || \ 244 ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386") 245# Clang is enabled, and will be installed as the default /usr/bin/cc. 246__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC LLD 247__DEFAULT_YES_OPTIONS+=LLVM_TARGET_AARCH64 LLVM_TARGET_ARM LLVM_TARGET_MIPS 248__DEFAULT_YES_OPTIONS+=LLVM_TARGET_POWERPC LLVM_TARGET_SPARC LLVM_TARGET_X86 249__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX 250.elif ${COMPILER_FEATURES:Mc++11} && ${__T} != "riscv64" && ${__T} != "sparc64" 251# If an external compiler that supports C++11 is used as ${CC} and Clang 252# supports the target, then Clang is enabled but GCC is installed as the 253# default /usr/bin/cc. 254__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX 255__DEFAULT_YES_OPTIONS+=LLVM_TARGET_AARCH64 LLVM_TARGET_ARM LLVM_TARGET_MIPS 256__DEFAULT_YES_OPTIONS+=LLVM_TARGET_POWERPC LLVM_TARGET_SPARC LLVM_TARGET_X86 257__DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC LLD 258.else 259# Everything else disables Clang, and uses GCC instead. 260__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX 261__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC LLD 262__DEFAULT_NO_OPTIONS+=LLVM_TARGET_AARCH64 LLVM_TARGET_ARM LLVM_TARGET_MIPS 263__DEFAULT_NO_OPTIONS+=LLVM_TARGET_POWERPC LLVM_TARGET_SPARC LLVM_TARGET_X86 264.endif 265__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF 266# In-tree binutils/gcc are older versions without modern architecture support. 267.if ${__T} == "aarch64" || ${__T} == "riscv64" 268BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB 269.endif 270.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ 271 ${__T:Mriscv*} != "" || ${__TT} == "mips" 272__DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND 273.else 274__DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND 275.endif 276.if ${__T} == "riscv64" 277BROKEN_OPTIONS+=PROFILE # "sorry, unimplemented: profiler support for RISC-V" 278BROKEN_OPTIONS+=TESTS # "undefined reference to `_Unwind_Resume'" 279BROKEN_OPTIONS+=CXX # "libcxxrt.so: undefined reference to `_Unwind_Resume_or_Rethrow'" 280.endif 281.if ${__T} == "aarch64" 282__DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD 283.else 284__DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD 285.endif 286.if ${__T} == "aarch64" || ${__T} == "amd64" 287__DEFAULT_YES_OPTIONS+=LLDB 288.else 289__DEFAULT_NO_OPTIONS+=LLDB 290.endif 291# LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5 292.if ${__T} == "arm" || ${__T} == "armeb" 293BROKEN_OPTIONS+=LLDB 294.endif 295# Only doing soft float API stuff on armv6 296.if ${__T} != "armv6" 297BROKEN_OPTIONS+=LIBSOFT 298.endif 299# EFI doesn't exist on mips, pc98, powerpc, sparc or riscv. 300.if ${__T:Mmips*} || ${__TT:Mpc98*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || \ 301 ${__T:Mriscv*} 302BROKEN_OPTIONS+=EFI 303.endif 304# OFW is only for powerpc and sparc64, exclude others 305.if ${__T:Mpowerpc*} == "" && ${__T:Msparc64} == "" 306BROKEN_OPTIONS+=LOADER_OFW 307.endif 308# UBOOT is only for arm, mips and powerpc, exclude others 309.if ${__T:Marm*} == "" && ${__T:Mmips*} == "" && ${__T:Mpowerpc*} == "" 310BROKEN_OPTIONS+=LOADER_UBOOT 311.endif 312# GELI and Lua in loader currently cause boot failures on sparc64 and powerpc. 313# Further debugging is required -- probably they are just broken on big 314# endian systems generically (they jump to null pointers or try to read 315# crazy high addresses, which is typical of endianness problems). 316.if ${__T} == "sparc64" || ${__T:Mpowerpc*} 317BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA 318.endif 319# Both features are untested on pc98, so we'll mark them as disabled just to 320# be safe and make sure we keep pc98 stable. 321.if ${__TT:Mpc98*} 322BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA 323.endif 324.if ${__T:Mmips64*} 325# profiling won't work on MIPS64 because there is only assembly for o32 326BROKEN_OPTIONS+=PROFILE 327.endif 328.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ 329 ${__T} == "powerpc64" || ${__T} == "sparc64" 330__DEFAULT_YES_OPTIONS+=CXGBETOOL 331__DEFAULT_YES_OPTIONS+=MLX5TOOL 332.else 333__DEFAULT_NO_OPTIONS+=CXGBETOOL 334__DEFAULT_NO_OPTIONS+=MLX5TOOL 335.endif 336 337.if ${__T} == "amd64" 338__DEFAULT_YES_OPTIONS+=OFED 339.else 340__DEFAULT_NO_OPTIONS+=OFED 341.endif 342 343.if ${COMPILER_FEATURES:Mc++11} && (${__T} == "amd64" || ${__T} == "i386") 344__DEFAULT_YES_OPTIONS+=OPENMP 345.else 346__DEFAULT_NO_OPTIONS+=OPENMP 347.endif 348 349.include <bsd.mkopt.mk> 350 351# 352# MK_* options that default to "yes" if the compiler is a C++11 compiler. 353# 354.for var in \ 355 LIBCPLUSPLUS 356.if !defined(MK_${var}) 357.if ${COMPILER_FEATURES:Mc++11} 358.if defined(WITHOUT_${var}) 359MK_${var}:= no 360.else 361MK_${var}:= yes 362.endif 363.else 364.if defined(WITH_${var}) 365MK_${var}:= yes 366.else 367MK_${var}:= no 368.endif 369.endif 370.endif 371.endfor 372 373# 374# Force some options off if their dependencies are off. 375# Order is somewhat important. 376# 377.if !${COMPILER_FEATURES:Mc++11} 378MK_LLVM_LIBUNWIND:= no 379.endif 380 381.if ${MK_CAPSICUM} == "no" 382MK_CASPER:= no 383.endif 384 385.if ${MK_LIBPTHREAD} == "no" 386MK_LIBTHR:= no 387.endif 388 389.if ${MK_LDNS} == "no" 390MK_LDNS_UTILS:= no 391MK_UNBOUND:= no 392.endif 393 394.if ${MK_SOURCELESS} == "no" 395MK_SOURCELESS_HOST:= no 396MK_SOURCELESS_UCODE:= no 397.endif 398 399.if ${MK_CDDL} == "no" 400MK_ZFS:= no 401MK_LOADER_ZFS:= no 402MK_CTF:= no 403.endif 404 405.if ${MK_CRYPT} == "no" 406MK_OPENSSL:= no 407MK_OPENSSH:= no 408MK_KERBEROS:= no 409.endif 410 411.if ${MK_CXX} == "no" 412MK_CLANG:= no 413MK_GROFF:= no 414MK_GNUCXX:= no 415.endif 416 417.if ${MK_DIALOG} == "no" 418MK_BSDINSTALL:= no 419.endif 420 421.if ${MK_MAIL} == "no" 422MK_MAILWRAPPER:= no 423MK_SENDMAIL:= no 424MK_DMAGENT:= no 425.endif 426 427.if ${MK_NETGRAPH} == "no" 428MK_ATM:= no 429MK_BLUETOOTH:= no 430.endif 431 432.if ${MK_NLS} == "no" 433MK_NLS_CATALOGS:= no 434.endif 435 436.if ${MK_OPENSSL} == "no" 437MK_OPENSSH:= no 438MK_KERBEROS:= no 439.endif 440 441.if ${MK_OFED} == "no" 442MK_OFED_EXTRA:= no 443.endif 444 445.if ${MK_PF} == "no" 446MK_AUTHPF:= no 447.endif 448 449.if ${MK_TESTS} == "no" 450MK_DTRACE_TESTS:= no 451.endif 452 453.if ${MK_TEXTPROC} == "no" 454MK_GROFF:= no 455.endif 456 457.if ${MK_ZONEINFO} == "no" 458MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no 459MK_ZONEINFO_OLD_TIMEZONES_SUPPORT:= no 460.endif 461 462.if ${MK_CROSS_COMPILER} == "no" 463MK_BINUTILS_BOOTSTRAP:= no 464MK_CLANG_BOOTSTRAP:= no 465MK_ELFTOOLCHAIN_BOOTSTRAP:= no 466MK_GCC_BOOTSTRAP:= no 467MK_LLD_BOOTSTRAP:= no 468.endif 469 470.if ${MK_META_MODE} == "yes" 471MK_SYSTEM_COMPILER:= no 472.endif 473 474.if ${MK_TOOLCHAIN} == "no" 475MK_BINUTILS:= no 476MK_CLANG:= no 477MK_GCC:= no 478MK_GDB:= no 479MK_INCLUDES:= no 480MK_LLD:= no 481MK_LLDB:= no 482.endif 483 484.if ${MK_CLANG} == "no" 485MK_CLANG_EXTRAS:= no 486MK_CLANG_FULL:= no 487MK_LLVM_COV:= no 488.endif 489 490# 491# MK_* options whose default value depends on another option. 492# 493.for vv in \ 494 GSSAPI/KERBEROS \ 495 MAN_UTILS/MAN 496.if defined(WITH_${vv:H}) 497MK_${vv:H}:= yes 498.elif defined(WITHOUT_${vv:H}) 499MK_${vv:H}:= no 500.else 501MK_${vv:H}:= ${MK_${vv:T}} 502.endif 503.endfor 504 505# 506# Set defaults for the MK_*_SUPPORT variables. 507# 508 509# 510# MK_*_SUPPORT options which default to "yes" unless their corresponding 511# MK_* variable is set to "no". 512# 513.for var in \ 514 BLACKLIST \ 515 BZIP2 \ 516 GNU \ 517 INET \ 518 INET6 \ 519 KERBEROS \ 520 KVM \ 521 NETGRAPH \ 522 PAM \ 523 TESTS \ 524 WIRELESS 525.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no" 526MK_${var}_SUPPORT:= no 527.else 528MK_${var}_SUPPORT:= yes 529.endif 530.endfor 531 532.if !${COMPILER_FEATURES:Mc++11} 533MK_LLDB:= no 534.endif 535 536# gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case. 537# while in theory we could build it with that, we don't want to do 538# that since it creates too much confusion for too little gain. 539# XXX: This is incomplete and needs X_COMPILER_TYPE/VERSION checks too 540# to prevent Makefile.inc1 from bootstrapping unneeded dependencies 541# and to support 'make delete-old' when supplying an external toolchain. 542.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800 543MK_GNUCXX:=no 544MK_GCC:=no 545.endif 546 547.endif # !target(__<src.opts.mk>__) 548