1# $FreeBSD$ 2 3# Options set in the build system which affect the building of kernel 4# modules. These select which parts to compile in or out (eg INET) or which 5# parts to omit (eg CDDL or SOURCELESS_HOST). Some of these will cause 6# config.mk to define symbols in various opt_*.h files. 7 8# 9# Define MK_* variables (which are either "yes" or "no") for users 10# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the 11# make(1) environment. 12# These should be tested with `== "no"' or `!= "no"' in makefiles. 13# The NO_* variables should only be set by makefiles for variables 14# that haven't been converted over. 15# 16 17# Note: bsd.own.mk must be included before the rest of kern.opts.mk to make 18# building on 10.x and earlier work. This should be removed when that's no 19# longer supported since it confounds the defaults (since it uses the host's 20# notion of defaults rather than what's default in current when building 21# within sys/modules). 22.include <bsd.own.mk> 23 24# These options are used by the kernel build process (kern.mk and kmod.mk) 25# They have to be listed here so we can build modules outside of the 26# src tree. 27 28KLDXREF_CMD?= kldxref 29 30__DEFAULT_YES_OPTIONS = \ 31 AUTOFS \ 32 BHYVE \ 33 BLUETOOTH \ 34 CCD \ 35 CDDL \ 36 CRYPT \ 37 CUSE \ 38 DTRACE \ 39 EFI \ 40 FORMAT_EXTENSIONS \ 41 INET \ 42 INET6 \ 43 IPFILTER \ 44 IPSEC_SUPPORT \ 45 ISCSI \ 46 KERNEL_SYMBOLS \ 47 NETGRAPH \ 48 OFED \ 49 PF \ 50 SCTP_SUPPORT \ 51 SOURCELESS_HOST \ 52 SOURCELESS_UCODE \ 53 SPLIT_KERNEL_DEBUG \ 54 TESTS \ 55 USB_GADGET_EXAMPLES \ 56 ZFS 57 58__DEFAULT_NO_OPTIONS = \ 59 BHYVE_SNAPSHOT \ 60 EXTRA_TCP_STACKS \ 61 INIT_ALL_PATTERN \ 62 INIT_ALL_ZERO \ 63 KERNEL_RETPOLINE \ 64 RATELIMIT \ 65 REPRODUCIBLE_BUILD 66 67# Some options are totally broken on some architectures. We disable 68# them. If you need to enable them on an experimental basis, you 69# must change this code. 70# Note: These only apply to the list of modules we build by default 71# and sometimes what is in the opt_*.h files by default. 72# Kernel config files are unaffected, though some targets can be 73# affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP. 74 75# Things that don't work based on the CPU 76.if ${MACHINE} == "amd64" 77# PR251083 conflict between INIT_ALL_ZERO and ifunc memset 78BROKEN_OPTIONS+= INIT_ALL_ZERO 79.endif 80 81# ZFS is broken on 32-bit powerpc 82.if ${MACHINE_ARCH} == "powerpc" 83BROKEN_OPTIONS+= ZFS 84.endif 85 86.if ${MACHINE_CPUARCH} == "arm" 87BROKEN_OPTIONS+= OFED 88.endif 89 90# Things that don't work based on toolchain support. 91.if ${MACHINE} != "i386" && ${MACHINE} != "amd64" 92BROKEN_OPTIONS+= KERNEL_RETPOLINE 93.endif 94 95# EFI doesn't exist on powerpc, or riscv 96.if ${MACHINE:Mpowerpc} || ${MACHINE:Mriscv} 97BROKEN_OPTIONS+=EFI 98.endif 99 100.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 101__DEFAULT_NO_OPTIONS += FDT 102.else 103__DEFAULT_YES_OPTIONS += FDT 104.endif 105 106# expanded inline from bsd.mkopt.mk to avoid share/mk dependency 107 108# Those that default to yes 109.for var in ${__DEFAULT_YES_OPTIONS} 110.if !defined(MK_${var}) 111.if defined(WITHOUT_${var}) # WITHOUT always wins 112MK_${var}:= no 113.else 114MK_${var}:= yes 115.endif 116.else 117.if ${MK_${var}} != "yes" && ${MK_${var}} != "no" 118.error "Illegal value for MK_${var}: ${MK_${var}}" 119.endif 120.endif # !defined(MK_${var}) 121.endfor 122.undef __DEFAULT_YES_OPTIONS 123 124# Those that default to no 125.for var in ${__DEFAULT_NO_OPTIONS} 126.if !defined(MK_${var}) 127.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins 128MK_${var}:= yes 129.else 130MK_${var}:= no 131.endif 132.else 133.if ${MK_${var}} != "yes" && ${MK_${var}} != "no" 134.error "Illegal value for MK_${var}: ${MK_${var}}" 135.endif 136.endif # !defined(MK_${var}) 137.endfor 138.undef __DEFAULT_NO_OPTIONS 139 140# 141# MK_* options which are always no, usually because they are 142# unsupported/badly broken on this architecture. 143# 144.for var in ${BROKEN_OPTIONS} 145MK_${var}:= no 146.endfor 147.undef BROKEN_OPTIONS 148#end of bsd.mkopt.mk expanded inline. 149 150# 151# MK_*_SUPPORT options which default to "yes" unless their corresponding 152# MK_* variable is set to "no". 153# 154.for var in \ 155 INET \ 156 INET6 157.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no" 158MK_${var}_SUPPORT:= no 159.else 160.if defined(KERNBUILDDIR) # See if there's an opt_foo.h 161.if !defined(OPT_${var}) 162OPT_${var}!= cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo 163.export OPT_${var} 164.endif 165.if ${OPT_${var}} == "" # nothing -> no 166MK_${var}_SUPPORT:= no 167.else 168MK_${var}_SUPPORT:= yes 169.endif 170.else # otherwise, yes 171MK_${var}_SUPPORT:= yes 172.endif 173.endif 174.endfor 175 176.if ${MK_SPLIT_KERNEL_DEBUG} == "no" 177MK_KERNEL_SYMBOLS:= no 178.endif 179 180.if ${MK_CDDL} == "no" 181MK_DTRACE:= no 182.endif 183 184# Some modules only compile successfully if option FDT is set, due to #ifdef FDT 185# wrapped around declarations. Module makefiles can optionally compile such 186# things using .if !empty(OPT_FDT) 187.if !defined(OPT_FDT) && defined(KERNBUILDDIR) 188OPT_FDT!= sed -n '/FDT/p' ${KERNBUILDDIR}/opt_platform.h 189.export OPT_FDT 190.if empty(OPT_FDT) 191MK_FDT:=no 192.else 193MK_FDT:=yes 194.endif 195.endif 196