src.opts.mk revision 316423
1279264Sdelphij# $FreeBSD: stable/11/share/mk/src.opts.mk 316423 2017-04-02 17:24:58Z dim $ 2110010Smarkm# 3110010Smarkm# Option file for FreeBSD /usr/src builds. 4160819Ssimon# 5110010Smarkm# Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf 6110010Smarkm# and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no} 7110010Smarkm# with sensible (usually) defaults. 8110010Smarkm# 9110010Smarkm# Makefiles must include bsd.opts.mk after defining specific MK_FOO options that 10110010Smarkm# are applicable for that Makefile (typically there are none, but sometimes there 11110010Smarkm# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish 12110010Smarkm# to omit from that make. 13110010Smarkm# 14110010Smarkm# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO 15110010Smarkm# variable. 16110010Smarkm# 17110010Smarkm# Makefiles may also assume that this file is included by src.opts.mk should it 18110010Smarkm# need variables defined there prior to the end of the Makefile where 19110010Smarkm# bsd.{subdir,lib.bin}.mk is traditionally included. 20215698Ssimon# 21215698Ssimon# The old-style YES_FOO and NO_FOO are being phased out. No new instances of them 22215698Ssimon# should be added. Old instances should be removed since they were just to 23215698Ssimon# bridge the gap between FreeBSD 4 and FreeBSD 5. 24215698Ssimon# 25110010Smarkm# Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an 26110010Smarkm# exception is made for _WITHOUT_SRCONF which turns off this mechanism 27110010Smarkm# completely inside bsd.*.mk files). 28110010Smarkm# 29110010Smarkm 30110010Smarkm.if !target(__<src.opts.mk>__) 31110010Smarkm__<src.opts.mk>__: 32110010Smarkm 33110010Smarkm.include <bsd.own.mk> 34110010Smarkm 35110010Smarkm# 36110010Smarkm# Define MK_* variables (which are either "yes" or "no") for users 37110010Smarkm# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the 38110010Smarkm# make(1) environment. 39110010Smarkm# These should be tested with `== "no"' or `!= "no"' in makefiles. 40110010Smarkm# The NO_* variables should only be set by makefiles for variables 41279264Sdelphij# that haven't been converted over. 42279264Sdelphij# 43110010Smarkm 44110010Smarkm# These options are used by src the builds 45215698Ssimon 46215698Ssimon__DEFAULT_YES_OPTIONS = \ 47215698Ssimon ACCT \ 48215698Ssimon ACPI \ 49160819Ssimon AMD \ 50215698Ssimon APM \ 51160819Ssimon AT \ 52160819Ssimon ATM \ 53279264Sdelphij AUDIT \ 54279264Sdelphij AUTHPF \ 55279264Sdelphij AUTOFS \ 56110010Smarkm BHYVE \ 57279264Sdelphij BINUTILS \ 58279264Sdelphij BINUTILS_BOOTSTRAP \ 59279264Sdelphij BLACKLIST \ 60279264Sdelphij BLUETOOTH \ 61279264Sdelphij BOOT \ 62279264Sdelphij BOOTPARAMD \ 63215698Ssimon BOOTPD \ 64279264Sdelphij BSD_CPIO \ 65279264Sdelphij BSDINSTALL \ 66279264Sdelphij BSNMP \ 67279264Sdelphij BZIP2 \ 68279264Sdelphij CALENDAR \ 69215698Ssimon CAPSICUM \ 70279264Sdelphij CASPER \ 71110010Smarkm CCD \ 72110010Smarkm CDDL \ 73110010Smarkm CPP \ 74110010Smarkm CROSS_COMPILER \ 75110010Smarkm CRYPT \ 76110010Smarkm CTM \ 77110010Smarkm CUSE \ 78110010Smarkm CXX \ 79110010Smarkm DICT \ 80110010Smarkm DMAGENT \ 81110010Smarkm DYNAMICROOT \ 82110010Smarkm ED_CRYPTO \ 83110010Smarkm EE \ 84110010Smarkm ELFCOPY_AS_OBJCOPY \ 85110010Smarkm ELFTOOLCHAIN_BOOTSTRAP \ 86110010Smarkm EXAMPLES \ 87110010Smarkm FDT \ 88110010Smarkm FILE \ 89110010Smarkm FINGER \ 90110010Smarkm FLOPPY \ 91110010Smarkm FMTREE \ 92110010Smarkm FORTH \ 93110010Smarkm FP_LIBC \ 94110010Smarkm FREEBSD_UPDATE \ 95110010Smarkm FTP \ 96110010Smarkm GAMES \ 97110010Smarkm GCOV \ 98110010Smarkm GDB \ 99110010Smarkm GNU \ 100110010Smarkm GNU_GREP_COMPAT \ 101110010Smarkm GPIO \ 102110010Smarkm GPL_DTC \ 103110010Smarkm GROFF \ 104110010Smarkm HAST \ 105110010Smarkm HTML \ 106110010Smarkm HYPERV \ 107110010Smarkm ICONV \ 108110010Smarkm INET \ 109110010Smarkm INET6 \ 110110010Smarkm INETD \ 111110010Smarkm IPFILTER \ 112110010Smarkm IPFW \ 113110010Smarkm ISCSI \ 114110010Smarkm JAIL \ 115110010Smarkm KDUMP \ 116110010Smarkm KVM \ 117110010Smarkm LDNS \ 118110010Smarkm LDNS_UTILS \ 119110010Smarkm LEGACY_CONSOLE \ 120110010Smarkm LIB32 \ 121110010Smarkm LIBPTHREAD \ 122110010Smarkm LIBTHR \ 123110010Smarkm LOCALES \ 124110010Smarkm LOCATE \ 125110010Smarkm LPR \ 126110010Smarkm LS_COLORS \ 127110010Smarkm LZMA_SUPPORT \ 128110010Smarkm MAIL \ 129110010Smarkm MAILWRAPPER \ 130110010Smarkm MAKE \ 131110010Smarkm MANDOCDB \ 132110010Smarkm NDIS \ 133160819Ssimon NETCAT \ 134110010Smarkm NETGRAPH \ 135110010Smarkm NLS_CATALOGS \ 136279264Sdelphij NS_CACHING \ 137215698Ssimon NTP \ 138215698Ssimon OPENSSL \ 139215698Ssimon PAM \ 140215698Ssimon PC_SYSINSTALL \ 141110010Smarkm PF \ 142160819Ssimon PKGBOOTSTRAP \ 143110010Smarkm PMC \ 144110010Smarkm PORTSNAP \ 145110010Smarkm PPP \ 146110010Smarkm QUOTAS \ 147215698Ssimon RADIUS_SUPPORT \ 148160819Ssimon RCMDS \ 149110010Smarkm RBOOTD \ 150110010Smarkm RCS \ 151110010Smarkm RESCUE \ 152110010Smarkm ROUTED \ 153160819Ssimon SENDMAIL \ 154110010Smarkm SETUID_LOGIN \ 155110010Smarkm SHAREDOCS \ 156110010Smarkm SOURCELESS \ 157110010Smarkm SOURCELESS_HOST \ 158110010Smarkm SOURCELESS_UCODE \ 159160819Ssimon SVNLITE \ 160 SYSCONS \ 161 SYSTEM_COMPILER \ 162 TALK \ 163 TCP_WRAPPERS \ 164 TCSH \ 165 TELNET \ 166 TESTS \ 167 TEXTPROC \ 168 TFTP \ 169 TIMED \ 170 UNBOUND \ 171 USB \ 172 UTMPX \ 173 VI \ 174 VT \ 175 WIRELESS \ 176 WPA_SUPPLICANT_EAPOL \ 177 ZFS \ 178 ZONEINFO 179 180__DEFAULT_NO_OPTIONS = \ 181 BSD_GREP \ 182 CLANG_EXTRAS \ 183 DTRACE_TESTS \ 184 EISA \ 185 HESIOD \ 186 LIBSOFT \ 187 NAND \ 188 OFED \ 189 OPENLDAP \ 190 REPRODUCIBLE_BUILD \ 191 SHARED_TOOLCHAIN \ 192 SORT_THREADS \ 193 SVN \ 194 195 196# 197# Default behaviour of some options depends on the architecture. Unfortunately 198# this means that we have to test TARGET_ARCH (the buildworld case) as well 199# as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not 200# used at all in bsd.*.mk, but we have to make an exception here if we want 201# to allow defaults for some things like clang to vary by target architecture. 202# Additional, per-target behavior should be rarely added only after much 203# gnashing of teeth and grinding of gears. 204# 205.if defined(TARGET_ARCH) 206__T=${TARGET_ARCH} 207.else 208__T=${MACHINE_ARCH} 209.endif 210.if defined(TARGET) 211__TT=${TARGET} 212.else 213__TT=${MACHINE} 214.endif 215 216.include <bsd.compiler.mk> 217# If the compiler is not C++11 capable, disable Clang and use GCC instead. 218# This means that architectures that have GCC 4.2 as default can not 219# build Clang without using an external compiler. 220 221.if ${COMPILER_FEATURES:Mc++11} && (${__T} == "aarch64" || \ 222 ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386") 223# Clang is enabled, and will be installed as the default /usr/bin/cc. 224__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC LLD 225__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX 226.elif ${COMPILER_FEATURES:Mc++11} && ${__T} != "riscv64" && ${__T} != "sparc64" 227# If an external compiler that supports C++11 is used as ${CC} and Clang 228# supports the target, then Clang is enabled but GCC is installed as the 229# default /usr/bin/cc. 230__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX 231__DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC LLD 232.else 233# Everything else disables Clang, and uses GCC instead. 234__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX 235__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC LLD 236.endif 237# In-tree binutils/gcc are older versions without modern architecture support. 238.if ${__T} == "aarch64" || ${__T} == "riscv64" 239BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB 240__DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND 241.else 242__DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND 243.endif 244.if ${__T} == "riscv64" 245BROKEN_OPTIONS+=PROFILE # "sorry, unimplemented: profiler support for RISC-V" 246BROKEN_OPTIONS+=TESTS # "undefined reference to `_Unwind_Resume'" 247BROKEN_OPTIONS+=CXX # "libcxxrt.so: undefined reference to `_Unwind_Resume_or_Rethrow'" 248.endif 249.if ${__T} == "aarch64" 250__DEFAULT_YES_OPTIONS+=LLD_IS_LD 251.else 252__DEFAULT_NO_OPTIONS+=LLD_IS_LD 253.endif 254.if ${__T} == "aarch64" || ${__T} == "amd64" 255__DEFAULT_YES_OPTIONS+=LLDB 256.else 257__DEFAULT_NO_OPTIONS+=LLDB 258.endif 259# LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5 260.if ${__T} == "arm" || ${__T} == "armeb" 261BROKEN_OPTIONS+=LLDB 262.endif 263# Only doing soft float API stuff on armv6 264.if ${__T} != "armv6" 265BROKEN_OPTIONS+=LIBSOFT 266.endif 267 268.include <bsd.mkopt.mk> 269 270# 271# MK_* options that default to "yes" if the compiler is a C++11 compiler. 272# 273.for var in \ 274 LIBCPLUSPLUS 275.if !defined(MK_${var}) 276.if ${COMPILER_FEATURES:Mc++11} 277.if defined(WITHOUT_${var}) 278MK_${var}:= no 279.else 280MK_${var}:= yes 281.endif 282.else 283.if defined(WITH_${var}) 284MK_${var}:= yes 285.else 286MK_${var}:= no 287.endif 288.endif 289.endif 290.endfor 291 292# 293# Force some options off if their dependencies are off. 294# Order is somewhat important. 295# 296.if ${MK_CAPSICUM} == "no" 297MK_CASPER:= no 298.endif 299 300.if ${MK_LIBPTHREAD} == "no" 301MK_LIBTHR:= no 302.endif 303 304.if ${MK_LDNS} == "no" 305MK_LDNS_UTILS:= no 306MK_UNBOUND:= no 307.endif 308 309.if ${MK_LLD} == "no" 310MK_LLD_IS_LD:= no 311.endif 312 313# LLD requires LLVM libraries, and we do not yet compare in-tree and host LLD 314# versions to avoid building it if they are identical. 315.if ${MK_LLD_IS_LD} != "no" 316MK_SYSTEM_COMPILER:= no 317.endif 318 319.if ${MK_SOURCELESS} == "no" 320MK_SOURCELESS_HOST:= no 321MK_SOURCELESS_UCODE:= no 322.endif 323 324.if ${MK_CDDL} == "no" 325MK_ZFS:= no 326MK_CTF:= no 327.endif 328 329.if ${MK_CRYPT} == "no" 330MK_OPENSSL:= no 331MK_OPENSSH:= no 332MK_KERBEROS:= no 333.endif 334 335.if ${MK_CXX} == "no" 336MK_CLANG:= no 337MK_GROFF:= no 338MK_GNUCXX:= no 339.endif 340 341.if ${MK_MAIL} == "no" 342MK_MAILWRAPPER:= no 343MK_SENDMAIL:= no 344MK_DMAGENT:= no 345.endif 346 347.if ${MK_NETGRAPH} == "no" 348MK_ATM:= no 349MK_BLUETOOTH:= no 350.endif 351 352.if ${MK_OPENSSL} == "no" 353MK_OPENSSH:= no 354MK_KERBEROS:= no 355.endif 356 357.if ${MK_PF} == "no" 358MK_AUTHPF:= no 359.endif 360 361.if ${MK_TESTS} == "no" 362MK_DTRACE_TESTS:= no 363.endif 364 365.if ${MK_TEXTPROC} == "no" 366MK_GROFF:= no 367.endif 368 369.if ${MK_CROSS_COMPILER} == "no" 370MK_BINUTILS_BOOTSTRAP:= no 371MK_CLANG_BOOTSTRAP:= no 372MK_ELFTOOLCHAIN_BOOTSTRAP:= no 373MK_GCC_BOOTSTRAP:= no 374.endif 375 376.if ${MK_META_MODE} == "yes" 377MK_SYSTEM_COMPILER:= no 378.endif 379 380.if ${MK_TOOLCHAIN} == "no" 381MK_BINUTILS:= no 382MK_CLANG:= no 383MK_GCC:= no 384MK_GDB:= no 385MK_INCLUDES:= no 386MK_LLDB:= no 387.endif 388 389.if ${MK_CLANG} == "no" 390MK_CLANG_EXTRAS:= no 391MK_CLANG_FULL:= no 392.endif 393 394# 395# MK_* options whose default value depends on another option. 396# 397.for vv in \ 398 GSSAPI/KERBEROS \ 399 MAN_UTILS/MAN 400.if defined(WITH_${vv:H}) 401MK_${vv:H}:= yes 402.elif defined(WITHOUT_${vv:H}) 403MK_${vv:H}:= no 404.else 405MK_${vv:H}:= ${MK_${vv:T}} 406.endif 407.endfor 408 409# 410# Set defaults for the MK_*_SUPPORT variables. 411# 412 413# 414# MK_*_SUPPORT options which default to "yes" unless their corresponding 415# MK_* variable is set to "no". 416# 417.for var in \ 418 BLACKLIST \ 419 BZIP2 \ 420 GNU \ 421 INET \ 422 INET6 \ 423 KERBEROS \ 424 KVM \ 425 NETGRAPH \ 426 PAM \ 427 TESTS \ 428 WIRELESS 429.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no" 430MK_${var}_SUPPORT:= no 431.else 432MK_${var}_SUPPORT:= yes 433.endif 434.endfor 435 436.if !${COMPILER_FEATURES:Mc++11} 437MK_LLDB:= no 438.endif 439 440# gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case. 441# while in theory we could build it with that, we don't want to do 442# that since it creates too much confusion for too little gain. 443# XXX: This is incomplete and needs X_COMPILER_TYPE/VERSION checks too 444# to prevent Makefile.inc1 from bootstrapping unneeded dependencies 445# and to support 'make delete-old' when supplying an external toolchain. 446.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800 447MK_GNUCXX:=no 448MK_GCC:=no 449.endif 450 451.endif # !target(__<src.opts.mk>__) 452