3 # Options set in the build system that affect the kernel somehow.
6 # Define MK_* variables (which are either "yes" or "no") for users
7 # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
9 # These should be tested with `== "no"' or `!= "no"' in makefiles.
10 # The NO_* variables should only be set by makefiles for variables
11 # that haven't been converted over.
14 # Note: bsd.own.mk must be included before the rest of kern.opts.mk to make
15 # building on 10.x and earlier work. This should be removed when that's no
16 # longer supported since it confounds the defaults (since it uses the host's
17 # notion of defaults rather than what's default in current when building
18 # within sys/modules).
21 # These options are used by the kernel build process (kern.mk and kmod.mk)
22 # They have to be listed here so we can build modules outside of the
27 __DEFAULT_YES_OPTIONS = \
52 __DEFAULT_NO_OPTIONS = \
58 # Some options are totally broken on some architectures. We disable
59 # them. If you need to enable them on an experimental basis, you
60 # must change this code.
61 # Note: These only apply to the list of modules we build by default
62 # and sometimes what is in the opt_*.h files by default.
63 # Kernel config files are unaffected, though some targets can be
64 # affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP.
66 # Things that don't work based on the CPU
67 .if ${MACHINE_CPUARCH} == "arm"
68 . if ${MACHINE_ARCH:Marmv[67]*} == ""
69 BROKEN_OPTIONS+= CDDL ZFS
73 .if ${MACHINE_CPUARCH} == "mips"
74 BROKEN_OPTIONS+= CDDL ZFS SSP
77 .if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} == "powerpc"
81 .if ${MACHINE_CPUARCH} == "riscv"
82 BROKEN_OPTIONS+= FORMAT_EXTENSIONS
85 # Things that don't work because the kernel doesn't have the support
87 .if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
91 # Things that don't work based on toolchain support.
92 .if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
93 BROKEN_OPTIONS+= KERNEL_RETPOLINE
96 # EFI doesn't exist on mips, powerpc, sparc or riscv.
97 .if ${MACHINE:Mmips} || ${MACHINE:Mpowerpc} || ${MACHINE:Msparc64} || ${MACHINE:Mriscv}
101 # expanded inline from bsd.mkopt.mk to avoid share/mk dependency
103 # Those that default to yes
104 .for var in ${__DEFAULT_YES_OPTIONS}
105 .if !defined(MK_${var})
106 .if defined(WITHOUT_${var}) # WITHOUT always wins
112 .if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
113 .error "Illegal value for MK_${var}: ${MK_${var}}"
115 .endif # !defined(MK_${var})
117 .undef __DEFAULT_YES_OPTIONS
119 # Those that default to no
120 .for var in ${__DEFAULT_NO_OPTIONS}
121 .if !defined(MK_${var})
122 .if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins
128 .if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
129 .error "Illegal value for MK_${var}: ${MK_${var}}"
131 .endif # !defined(MK_${var})
133 .undef __DEFAULT_NO_OPTIONS
136 # MK_* options which are always no, usually because they are
137 # unsupported/badly broken on this architecture.
139 .for var in ${BROKEN_OPTIONS}
142 .undef BROKEN_OPTIONS
143 #end of bsd.mkopt.mk expanded inline.
146 # MK_*_SUPPORT options which default to "yes" unless their corresponding
147 # MK_* variable is set to "no".
152 .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
153 MK_${var}_SUPPORT:= no
155 .if defined(KERNBUILDDIR) # See if there's an opt_foo.h
156 .if !defined(OPT_${var})
157 OPT_${var}!= cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo
160 .if ${OPT_${var}} == "" # nothing -> no
161 MK_${var}_SUPPORT:= no
163 MK_${var}_SUPPORT:= yes
165 .else # otherwise, yes
166 MK_${var}_SUPPORT:= yes
171 # Some modules only compile successfully if option FDT is set, due to #ifdef FDT
172 # wrapped around declarations. Module makefiles can optionally compile such
173 # things using .if !empty(OPT_FDT)
174 .if !defined(OPT_FDT) && defined(KERNBUILDDIR)
175 OPT_FDT!= sed -n '/FDT/p' ${KERNBUILDDIR}/opt_platform.h