kern.opts.mk revision 312730
1# $FreeBSD: stable/11/sys/conf/kern.opts.mk 312730 2017-01-25 01:04:51Z emaste $
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    FORMAT_EXTENSIONS \
34    INET \
35    INET6 \
36    IPFILTER \
37    ISCSI \
38    KERNEL_SYMBOLS \
39    NETGRAPH \
40    PF \
41    SOURCELESS_HOST \
42    SOURCELESS_UCODE \
43    USB_GADGET_EXAMPLES \
44    ZFS
45
46__DEFAULT_NO_OPTIONS = \
47    EISA \
48    EXTRA_TCP_STACKS \
49    NAND \
50    OFED \
51    REPRODUCIBLE_BUILD
52
53# Some options are totally broken on some architectures. We disable
54# them. If you need to enable them on an experimental basis, you
55# must change this code.
56# Note: These only apply to the list of modules we build by default
57# and sometimes what is in the opt_*.h files by default.
58# Kernel config files are unaffected, though some targets can be
59# affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP.
60
61# Things that don't work based on the CPU
62.if ${MACHINE_CPUARCH} == "arm"
63. if ${MACHINE_ARCH:Marmv6*} == ""
64BROKEN_OPTIONS+= CDDL ZFS
65. endif
66.endif
67
68.if ${MACHINE_CPUARCH} == "mips"
69BROKEN_OPTIONS+= CDDL ZFS
70.endif
71
72.if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} == "powerpc"
73BROKEN_OPTIONS+= ZFS
74.endif
75
76# Things that don't work because the kernel doesn't have the support
77# for them.
78.if ${MACHINE} != "i386"
79BROKEN_OPTIONS+= EISA
80.endif
81
82.if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
83BROKEN_OPTIONS+= OFED
84.endif
85
86# expanded inline from bsd.mkopt.mk to avoid share/mk dependency
87
88# Those that default to yes
89.for var in ${__DEFAULT_YES_OPTIONS}
90.if !defined(MK_${var})
91.if defined(WITHOUT_${var})			# WITHOUT always wins
92MK_${var}:=	no
93.else
94MK_${var}:=	yes
95.endif
96.else
97.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
98.error "Illegal value for MK_${var}: ${MK_${var}}"
99.endif
100.endif # !defined(MK_${var})
101.endfor
102.undef __DEFAULT_YES_OPTIONS
103
104# Those that default to no
105.for var in ${__DEFAULT_NO_OPTIONS}
106.if !defined(MK_${var})
107.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins
108MK_${var}:=	yes
109.else
110MK_${var}:=	no
111.endif
112.else
113.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
114.error "Illegal value for MK_${var}: ${MK_${var}}"
115.endif
116.endif # !defined(MK_${var})
117.endfor
118.undef __DEFAULT_NO_OPTIONS
119
120#
121# MK_* options which are always no, usually because they are
122# unsupported/badly broken on this architecture.
123#
124.for var in ${BROKEN_OPTIONS}
125MK_${var}:=	no
126.endfor
127.undef BROKEN_OPTIONS
128#end of bsd.mkopt.mk expanded inline.
129
130#
131# MK_*_SUPPORT options which default to "yes" unless their corresponding
132# MK_* variable is set to "no".
133#
134.for var in \
135    INET \
136    INET6
137.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
138MK_${var}_SUPPORT:= no
139.else
140.if defined(KERNBUILDDIR)	# See if there's an opt_foo.h
141.if !defined(OPT_${var})
142OPT_${var}!= cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo
143.export OPT_${var}
144.endif
145.if ${OPT_${var}} == ""		# nothing -> no
146MK_${var}_SUPPORT:= no
147.else
148MK_${var}_SUPPORT:= yes
149.endif
150.else				# otherwise, yes
151MK_${var}_SUPPORT:= yes
152.endif
153.endif
154.endfor
155
156# Some modules only compile successfully if option FDT is set, due to #ifdef FDT
157# wrapped around declarations.  Module makefiles can optionally compile such
158# things using .if !empty(OPT_FDT)
159.if !defined(OPT_FDT) && defined(KERNBUILDDIR)
160OPT_FDT!= sed -n '/FDT/p' ${KERNBUILDDIR}/opt_platform.h
161.export OPT_FDT
162.endif
163