1# $FreeBSD$ 2 3# Options set in the build system that affect the kernel somehow. 4 5# 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 8# make(1) environment. 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. 12# 13 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). 19.include <bsd.own.mk> 20 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 23# src tree. 24 25__DEFAULT_YES_OPTIONS = \ 26 AUTOFS \ 27 BHYVE \ 28 BLUETOOTH \ 29 CCD \ 30 CDDL \ 31 CRYPT \ 32 CUSE \ 33 EFI \ 34 FORMAT_EXTENSIONS \ 35 INET \ 36 INET6 \ 37 IPFILTER \ 38 IPSEC_SUPPORT \ 39 ISCSI \ 40 KERNEL_SYMBOLS \ 41 NETGRAPH \ 42 PF \ 43 SOURCELESS_HOST \ 44 SOURCELESS_UCODE \ 45 TESTS \ 46 USB_GADGET_EXAMPLES \ 47 ZFS 48 49__DEFAULT_NO_OPTIONS = \ 50 EXTRA_TCP_STACKS \ 51 KERNEL_RETPOLINE \ 52 NAND \ 53 OFED \ 54 RATELIMIT \ 55 REPRODUCIBLE_BUILD 56 57# Some options are totally broken on some architectures. We disable 58# them. If you need to enable them on an experimental basis, you 59# must change this code. 60# Note: These only apply to the list of modules we build by default 61# and sometimes what is in the opt_*.h files by default. 62# Kernel config files are unaffected, though some targets can be 63# affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP. 64 65# Things that don't work based on the CPU 66.if ${MACHINE_CPUARCH} == "arm" 67. if ${MACHINE_ARCH:Marmv[67]*} == "" 68BROKEN_OPTIONS+= CDDL ZFS 69. endif 70.endif 71 72.if ${MACHINE_CPUARCH} == "mips" 73BROKEN_OPTIONS+= CDDL ZFS SSP 74.endif 75 76.if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} == "powerpc" 77BROKEN_OPTIONS+= ZFS 78.endif 79 80.if ${MACHINE_CPUARCH} == "riscv" 81BROKEN_OPTIONS+= FORMAT_EXTENSIONS 82.endif 83 84# Things that don't work because the kernel doesn't have the support 85# for them. 86.if ${MACHINE} != "i386" && ${MACHINE} != "amd64" 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 mips, powerpc, sparc or riscv. 96.if ${MACHINE:Mmips} || ${MACHINE:Mpowerpc} || ${MACHINE:Msparc64} || ${MACHINE:Mriscv} 97BROKEN_OPTIONS+=EFI 98.endif 99 100# expanded inline from bsd.mkopt.mk to avoid share/mk dependency 101 102# Those that default to yes 103.for var in ${__DEFAULT_YES_OPTIONS} 104.if !defined(MK_${var}) 105.if defined(WITHOUT_${var}) # WITHOUT always wins 106MK_${var}:= no 107.else 108MK_${var}:= yes 109.endif 110.else 111.if ${MK_${var}} != "yes" && ${MK_${var}} != "no" 112.error "Illegal value for MK_${var}: ${MK_${var}}" 113.endif 114.endif # !defined(MK_${var}) 115.endfor 116.undef __DEFAULT_YES_OPTIONS 117 118# Those that default to no 119.for var in ${__DEFAULT_NO_OPTIONS} 120.if !defined(MK_${var}) 121.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins 122MK_${var}:= yes 123.else 124MK_${var}:= no 125.endif 126.else 127.if ${MK_${var}} != "yes" && ${MK_${var}} != "no" 128.error "Illegal value for MK_${var}: ${MK_${var}}" 129.endif 130.endif # !defined(MK_${var}) 131.endfor 132.undef __DEFAULT_NO_OPTIONS 133 134# 135# MK_* options which are always no, usually because they are 136# unsupported/badly broken on this architecture. 137# 138.for var in ${BROKEN_OPTIONS} 139MK_${var}:= no 140.endfor 141.undef BROKEN_OPTIONS 142#end of bsd.mkopt.mk expanded inline. 143 144# 145# MK_*_SUPPORT options which default to "yes" unless their corresponding 146# MK_* variable is set to "no". 147# 148.for var in \ 149 INET \ 150 INET6 151.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no" 152MK_${var}_SUPPORT:= no 153.else 154.if defined(KERNBUILDDIR) # See if there's an opt_foo.h 155.if !defined(OPT_${var}) 156OPT_${var}!= cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo 157.export OPT_${var} 158.endif 159.if ${OPT_${var}} == "" # nothing -> no 160MK_${var}_SUPPORT:= no 161.else 162MK_${var}_SUPPORT:= yes 163.endif 164.else # otherwise, yes 165MK_${var}_SUPPORT:= yes 166.endif 167.endif 168.endfor 169 170# Some modules only compile successfully if option FDT is set, due to #ifdef FDT 171# wrapped around declarations. Module makefiles can optionally compile such 172# things using .if !empty(OPT_FDT) 173.if !defined(OPT_FDT) && defined(KERNBUILDDIR) 174OPT_FDT!= sed -n '/FDT/p' ${KERNBUILDDIR}/opt_platform.h 175.export OPT_FDT 176.endif 177