2 # Option file for FreeBSD /usr/src builds, at least the userland and boot loader
3 # portions of the tree. These options generally chose what parts of the tree to
4 # include or omit and are FreeBSD source tree specific.
6 # Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf
7 # and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no}
8 # with sensible (usually) defaults.
10 # Makefiles must include bsd.opts.mk after defining specific MK_FOO options that
11 # are applicable for that Makefile (typically there are none, but sometimes there
12 # are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
13 # to omit from that make.
15 # Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO
18 # Makefiles may also assume that this file is included by src.opts.mk should it
19 # need variables defined there prior to the end of the Makefile where
20 # bsd.{subdir,lib.bin}.mk is traditionally included.
22 # The old-style YES_FOO and NO_FOO are being phased out. No new instances of them
23 # should be added. Old instances should be removed since they were just to
24 # bridge the gap between FreeBSD 4 and FreeBSD 5.
26 # Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an
27 # exception is made for _WITHOUT_SRCONF which turns off this mechanism
28 # completely inside bsd.*.mk files).
31 .if !target(__<src.opts.mk>__)
37 # Define MK_* variables (which are either "yes" or "no") for users
38 # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
39 # make(1) environment.
40 # These should be tested with `== "no"' or `!= "no"' in makefiles.
41 # The NO_* variables should only be set by makefiles for variables
42 # that haven't been converted over.
45 # These options are used by the src builds. Those listed in
46 # __DEFAULT_YES_OPTIONS default to 'yes' and will build unless turned
47 # off. __DEFAULT_NO_OPTIONS will default to 'no' and won't build
48 # unless turned on. Any options listed in 'BROKEN_OPTIONS' will be
49 # hard-wired to 'no'. "Broken" here means not working or
50 # not-appropriate and/or not supported. It doesn't imply something is
51 # wrong with the code. There's not a single good word for this, so
52 # BROKEN was selected as the least imperfect one considered at the
53 # time. Options are added to BROKEN_OPTIONS list on a per-arch basis.
54 # At this time, there's no provision for mutually incompatible options.
55 # Options listed in 'REQUIRED_OPTIONS' will be hard-wired to 'yes'; this
56 # is intended as a transitional measure while options are in the process
59 __DEFAULT_YES_OPTIONS = \
96 ELFTOOLCHAIN_BOOTSTRAP \
141 MACHDEP_OPTIMIZATIONS \
161 PTHREADS_ASSERTIONS \
190 WPA_SUPPLICANT_EAPOL \
195 __DEFAULT_NO_OPTIONS = \
201 DISK_IMAGE_TOOLS_BOOTSTRAP \
207 LOADER_VERIEXEC_PASS_MANIFEST \
213 RPCBIND_WARMSTART_SUPPORT \
215 ZONEINFO_LEAPSECONDS_SUPPORT \
217 __REQUIRED_OPTIONS = \
221 # LEFT/RIGHT. Left options which default to "yes" unless their corresponding
222 # RIGHT option is disabled.
223 __DEFAULT_DEPENDENT_OPTIONS= \
225 LLVM_TARGET_ALL/CLANG \
226 LOADER_VERIEXEC/BEARSSL \
227 LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \
228 LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
234 __LIBC_MALLOC_OPTIONS= jemalloc
235 __LIBC_MALLOC_DEFAULT= jemalloc
237 # MK_*_SUPPORT options which default to "yes" unless their corresponding
238 # MK_* variable is set to "no".
251 __DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
255 # Default behaviour of some options depends on the architecture. Unfortunately
256 # this means that we have to test TARGET_ARCH (the buildworld case) as well
257 # as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not
258 # used at all in bsd.*.mk, but we have to make an exception here if we want
259 # to allow defaults for some things like clang to vary by target architecture.
260 # Additional, per-target behavior should be rarely added only after much
261 # gnashing of teeth and grinding of gears.
263 .if defined(TARGET_ARCH)
269 # All supported backends for LLVM_TARGET_XXX
276 __LLVM_TARGET_FILT= C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/
277 .for __llt in ${__LLVM_TARGETS}
278 # Default enable the given TARGET's LLVM_TARGET support
279 .if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
280 __DEFAULT_YES_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
281 # aarch64 needs arm for -m32 support.
282 .elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
283 __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
284 # Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
286 __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
290 __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
292 .include <bsd.compiler.mk>
294 .if ${__T} == "i386" || ${__T} == "amd64"
295 __DEFAULT_NO_OPTIONS += FDT
297 __DEFAULT_YES_OPTIONS += FDT
300 .if ${__T:Marm*} == "" && ${__T:Mriscv64*} == ""
301 __DEFAULT_YES_OPTIONS+=LLDB
303 __DEFAULT_NO_OPTIONS+=LLDB
305 # LIB32 is not supported on all 64-bit architectures.
306 .if (${__T} == "amd64" || ${__T:Maarch64*} != "" || ${__T} == "powerpc64")
307 __DEFAULT_YES_OPTIONS+=LIB32
309 BROKEN_OPTIONS+=LIB32
311 # EFI doesn't exist on powerpc (well, officially) and doesn't work on i386
312 .if ${__T:Mpowerpc*} || ${__T} == "i386"
315 # OFW is only for powerpc, exclude others
316 .if ${__T:Mpowerpc*} == ""
317 BROKEN_OPTIONS+=LOADER_OFW
319 # KBOOT is only for powerpc64 (powerpc64le broken) amd64 and aarch64
320 .if ${__T} != "powerpc64" && ${__T} != "amd64" && ${__T} != "aarch64"
321 BROKEN_OPTIONS+=LOADER_KBOOT
323 # UBOOT is only for arm, and big-endian powerpc
324 .if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
325 BROKEN_OPTIONS+=LOADER_UBOOT
327 # GELI and Lua in loader currently cause boot failures on powerpc.
328 # Further debugging is required -- probably they are just broken on big
329 # endian systems generically (they jump to null pointers or try to read
330 # crazy high addresses, which is typical of endianness problems).
332 BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
335 # Kernel TLS is enabled by default on amd64, aarch64 and powerpc64*
336 .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != ""
337 __DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
339 __DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
342 .if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
343 ${__T:Mpowerpc64*} == ""
344 BROKEN_OPTIONS+=CXGBETOOL
345 BROKEN_OPTIONS+=MLX5TOOL
348 .if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64"
349 BROKEN_OPTIONS+=HYPERV
352 # NVME is only aarch64, x86 and powerpc64*
353 .if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
354 ${__T:Mpowerpc64*} == ""
358 .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
359 ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != ""
360 __DEFAULT_YES_OPTIONS+=OPENMP
362 __DEFAULT_NO_OPTIONS+=OPENMP
365 # Broken on 32-bit arm, kernel module compile errors
366 .if ${__T:Marm*} != ""
367 BROKEN_OPTIONS+= OFED
370 # MK_host_egacy is set by local.sys.mk so is valid here
371 .if ${MACHINE:Nhost*} == "" && ${MK_host_egacy} == "yes"
372 # we cannot expect tests to work
373 BROKEN_OPTIONS+= TESTS
376 .-include <site.src.opts.mk>
378 .include <bsd.mkopt.mk>
381 # Force some options off if their dependencies are off.
382 # Order is somewhat important.
384 .if ${MK_CAPSICUM} == "no"
388 .if ${MK_SOURCELESS} == "no"
389 MK_SOURCELESS_HOST:= no
390 MK_SOURCELESS_UCODE:= no
393 .if ${MK_CDDL} == "no"
400 .if ${MK_CRYPT} == "no"
404 MK_KERBEROS_SUPPORT:= no
407 .if ${MK_DIALOG} == "no"
411 .if ${MK_DTRACE} == "no"
415 .if ${MK_MAIL} == "no"
421 .if ${MK_NETGRAPH} == "no"
425 .if ${MK_NLS} == "no"
429 .if ${MK_OPENSSL} == "no"
434 MK_KERBEROS_SUPPORT:= no
441 .if ${MK_LDNS} == "no"
450 .if ${MK_OFED} == "no"
454 .if ${MK_TESTS} == "no"
458 .if ${MK_TESTS_SUPPORT} == "no"
462 .if ${MK_ZONEINFO} == "no"
463 MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
466 .if ${MK_CROSS_COMPILER} == "no"
467 MK_CLANG_BOOTSTRAP:= no
468 MK_ELFTOOLCHAIN_BOOTSTRAP:= no
469 MK_LLD_BOOTSTRAP:= no
472 .if ${MK_TOOLCHAIN} == "no"
476 MK_LLVM_BINUTILS:= no
479 .if ${MK_CLANG} == "no"
486 .if ${MK_ASAN} == "yes"
487 # In order to get sensible backtraces from ASAN we have to install
488 # llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
489 MK_LLVM_BINUTILS:= yes
492 .if ${MK_LLVM_BINUTILS} == "yes"
493 # MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be
494 # enabled if MK_LLVM_BINUTILS is set.
495 MK_LLVM_CXXFILT:= yes
498 .if ${MK_LOADER_VERIEXEC} == "no"
499 MK_LOADER_VERIEXEC_PASS_MANIFEST := no
503 # MK_* options whose default value depends on another option.
508 .if defined(WITH_${vv:H})
510 .elif defined(WITHOUT_${vv:H})
513 MK_${vv:H}:= ${MK_${vv:T}}
518 # Set defaults for the MK_*_SUPPORT variables.
521 .endif # !target(__<src.opts.mk>__)