3 # Option file for FreeBSD /usr/src builds, at least the userland and boot loader
4 # portions of the tree. These options generally chose what parts of the tree to
5 # include or omit and are FreeBSD source tree specific.
7 # Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf
8 # and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no}
9 # with sensible (usually) defaults.
11 # Makefiles must include bsd.opts.mk after defining specific MK_FOO options that
12 # are applicable for that Makefile (typically there are none, but sometimes there
13 # are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
14 # to omit from that make.
16 # Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO
19 # Makefiles may also assume that this file is included by src.opts.mk should it
20 # need variables defined there prior to the end of the Makefile where
21 # bsd.{subdir,lib.bin}.mk is traditionally included.
23 # The old-style YES_FOO and NO_FOO are being phased out. No new instances of them
24 # should be added. Old instances should be removed since they were just to
25 # bridge the gap between FreeBSD 4 and FreeBSD 5.
27 # Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an
28 # exception is made for _WITHOUT_SRCONF which turns off this mechanism
29 # completely inside bsd.*.mk files).
32 .if !target(__<src.opts.mk>__)
38 # Define MK_* variables (which are either "yes" or "no") for users
39 # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
40 # make(1) environment.
41 # These should be tested with `== "no"' or `!= "no"' in makefiles.
42 # The NO_* variables should only be set by makefiles for variables
43 # that haven't been converted over.
46 # These options are used by the src builds. Those listed in
47 # __DEFAULT_YES_OPTIONS default to 'yes' and will build unless turned
48 # off. __DEFAULT_NO_OPTIONS will default to 'no' and won't build
49 # unless turned on. Any options listed in 'BROKEN_OPTIONS' will be
50 # hard-wired to 'no'. "Broken" here means not working or
51 # not-appropriate and/or not supported. It doesn't imply something is
52 # wrong with the code. There's not a single good word for this, so
53 # BROKEN was selected as the least imperfect one considered at the
54 # time. Options are added to BROKEN_OPTIONS list on a per-arch basis.
55 # At this time, there's no provision for mutually incompatible options.
56 # Options listed in 'REQUIRED_OPTIONS' will be hard-wired to 'yes'; this
57 # is intended as a transitional measure while options are in the process
60 __DEFAULT_YES_OPTIONS = \
97 ELFTOOLCHAIN_BOOTSTRAP \
142 MACHDEP_OPTIMIZATIONS \
162 PTHREADS_ASSERTIONS \
191 WPA_SUPPLICANT_EAPOL \
196 __DEFAULT_NO_OPTIONS = \
202 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 \
231 # MK_*_SUPPORT options which default to "yes" unless their corresponding
232 # MK_* variable is set to "no".
245 __DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
249 # Default behaviour of some options depends on the architecture. Unfortunately
250 # this means that we have to test TARGET_ARCH (the buildworld case) as well
251 # as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not
252 # used at all in bsd.*.mk, but we have to make an exception here if we want
253 # to allow defaults for some things like clang to vary by target architecture.
254 # Additional, per-target behavior should be rarely added only after much
255 # gnashing of teeth and grinding of gears.
257 .if defined(TARGET_ARCH)
263 # All supported backends for LLVM_TARGET_XXX
270 __LLVM_TARGET_FILT= C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/
271 .for __llt in ${__LLVM_TARGETS}
272 # Default enable the given TARGET's LLVM_TARGET support
273 .if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
274 __DEFAULT_YES_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
275 # aarch64 needs arm for -m32 support.
276 .elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
277 __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
278 # Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
280 __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
284 __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
286 .include <bsd.compiler.mk>
288 .if ${__T} == "i386" || ${__T} == "amd64"
289 __DEFAULT_NO_OPTIONS += FDT
291 __DEFAULT_YES_OPTIONS += FDT
294 .if ${__T:Marm*} == "" && ${__T:Mriscv64*} == ""
295 __DEFAULT_YES_OPTIONS+=LLDB
297 __DEFAULT_NO_OPTIONS+=LLDB
299 # LIB32 is not supported on all 64-bit architectures.
300 .if (${__T} == "amd64" || ${__T:Maarch64*} != "" || ${__T} == "powerpc64")
301 __DEFAULT_YES_OPTIONS+=LIB32
303 BROKEN_OPTIONS+=LIB32
305 # EFI doesn't exist on powerpc (well, officially) and doesn't work on i386
306 .if ${__T:Mpowerpc*} || ${__T} == "i386"
309 # OFW is only for powerpc, exclude others
310 .if ${__T:Mpowerpc*} == ""
311 BROKEN_OPTIONS+=LOADER_OFW
313 # KBOOT is only for powerpc64 (powerpc64le broken) amd64 and aarch64
314 .if ${__T} != "powerpc64" && ${__T} != "amd64" && ${__T} != "aarch64"
315 BROKEN_OPTIONS+=LOADER_KBOOT
317 # UBOOT is only for arm, and big-endian powerpc
318 .if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
319 BROKEN_OPTIONS+=LOADER_UBOOT
321 # GELI and Lua in loader currently cause boot failures on powerpc.
322 # Further debugging is required -- probably they are just broken on big
323 # endian systems generically (they jump to null pointers or try to read
324 # crazy high addresses, which is typical of endianness problems).
326 BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
329 # Kernel TLS is enabled by default on amd64, aarch64 and powerpc64*
330 .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != ""
331 __DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
333 __DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
336 .if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
337 ${__T:Mpowerpc64*} == ""
338 BROKEN_OPTIONS+=CXGBETOOL
339 BROKEN_OPTIONS+=MLX5TOOL
342 .if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64"
343 BROKEN_OPTIONS+=HYPERV
346 # NVME is only aarch64, x86 and powerpc64*
347 .if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
348 ${__T:Mpowerpc64*} == ""
352 .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
353 ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != ""
354 __DEFAULT_YES_OPTIONS+=OPENMP
356 __DEFAULT_NO_OPTIONS+=OPENMP
359 # Broken on 32-bit arm, kernel module compile errors
360 .if ${__T:Marm*} != ""
361 BROKEN_OPTIONS+= OFED
364 # MK_host_egacy is set by local.sys.mk so is valid here
365 .if ${MACHINE} == "host" && ${MK_host_egacy} == "yes"
366 # we cannot expect tests to work
367 BROKEN_OPTIONS+= TESTS
370 .-include <site.src.opts.mk>
372 .include <bsd.mkopt.mk>
375 # Force some options off if their dependencies are off.
376 # Order is somewhat important.
378 .if ${MK_CAPSICUM} == "no"
382 .if ${MK_SOURCELESS} == "no"
383 MK_SOURCELESS_HOST:= no
384 MK_SOURCELESS_UCODE:= no
387 .if ${MK_CDDL} == "no"
394 .if ${MK_CRYPT} == "no"
398 MK_KERBEROS_SUPPORT:= no
401 .if ${MK_DIALOG} == "no"
405 .if ${MK_DTRACE} == "no"
409 .if ${MK_MAIL} == "no"
415 .if ${MK_NETGRAPH} == "no"
419 .if ${MK_NLS} == "no"
423 .if ${MK_OPENSSL} == "no"
428 MK_KERBEROS_SUPPORT:= no
435 .if ${MK_LDNS} == "no"
444 .if ${MK_OFED} == "no"
448 .if ${MK_TESTS} == "no"
452 .if ${MK_TESTS_SUPPORT} == "no"
456 .if ${MK_ZONEINFO} == "no"
457 MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
460 .if ${MK_CROSS_COMPILER} == "no"
461 MK_CLANG_BOOTSTRAP:= no
462 MK_ELFTOOLCHAIN_BOOTSTRAP:= no
463 MK_LLD_BOOTSTRAP:= no
466 .if ${MK_TOOLCHAIN} == "no"
470 MK_LLVM_BINUTILS:= no
473 .if ${MK_CLANG} == "no"
480 .if ${MK_ASAN} == "yes"
481 # In order to get sensible backtraces from ASAN we have to install
482 # llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
483 MK_LLVM_BINUTILS:= yes
486 .if ${MK_LLVM_BINUTILS} == "yes"
487 # MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be
488 # enabled if MK_LLVM_BINUTILS is set.
489 MK_LLVM_CXXFILT:= yes
492 .if ${MK_LOADER_VERIEXEC} == "no"
493 MK_LOADER_VERIEXEC_PASS_MANIFEST := no
497 # MK_* options whose default value depends on another option.
502 .if defined(WITH_${vv:H})
504 .elif defined(WITHOUT_${vv:H})
507 MK_${vv:H}:= ${MK_${vv:T}}
512 # Set defaults for the MK_*_SUPPORT variables.
515 .endif # !target(__<src.opts.mk>__)