kern.opts.mk revision 297174
1265785Simp# $FreeBSD: head/sys/conf/kern.opts.mk 297174 2016-03-21 23:32:13Z ian $
2265785Simp
3265785Simp# Options set in the build system that affect the kernel somehow.
4265785Simp
5265785Simp#
6265785Simp# Define MK_* variables (which are either "yes" or "no") for users
7265785Simp# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
8265785Simp# make(1) environment.
9265785Simp# These should be tested with `== "no"' or `!= "no"' in makefiles.
10265785Simp# The NO_* variables should only be set by makefiles for variables
11265785Simp# that haven't been converted over.
12265785Simp#
13265785Simp
14269812Simp# Note: bsd.own.mk must be included before the rest of kern.opts.mk to make
15269812Simp# building on 10.x and earlier work. This should be removed when that's no
16269812Simp# longer supported since it confounds the defaults (since it uses the host's
17269812Simp# notion of defaults rather than what's default in current when building
18269812Simp# within sys/modules).
19269812Simp.include <bsd.own.mk>
20269812Simp
21265785Simp# These options are used by the kernel build process (kern.mk and kmod.mk)
22265785Simp# They have to be listed here so we can build modules outside of the
23265785Simp# src tree.
24265785Simp
25265785Simp__DEFAULT_YES_OPTIONS = \
26277728Sngie    AUTOFS \
27277727Sngie    BHYVE \
28269812Simp    BLUETOOTH \
29277678Sngie    CCD \
30269812Simp    CDDL \
31269812Simp    CRYPT \
32277681Sngie    CUSE \
33296772Sbdrewery    FAST_DEPEND \
34265791Simp    FORMAT_EXTENSIONS \
35269540Simp    INET \
36269540Simp    INET6 \
37269812Simp    IPFILTER \
38277675Sngie    ISCSI \
39269812Simp    KERNEL_SYMBOLS \
40269812Simp    NETGRAPH \
41269812Simp    PF \
42269812Simp    SOURCELESS_HOST \
43269812Simp    SOURCELESS_UCODE \
44269812Simp    USB_GADGET_EXAMPLES \
45269812Simp    ZFS
46265785Simp
47269812Simp__DEFAULT_NO_OPTIONS = \
48269812Simp    EISA \
49269812Simp    NAND \
50269812Simp    OFED
51265785Simp
52295987Sbdrewery# Enable FAST_DEPEND by default for the meta build.
53295987Sbdrewery.if !empty(.MAKE.MODE:Unormal:Mmeta)
54295987Sbdrewery__DEFAULT_YES_OPTIONS+=	FAST_DEPEND
55295987Sbdrewery__DEFAULT_NO_OPTIONS:=	${__DEFAULT_NO_OPTIONS:NFAST_DEPEND}
56295987Sbdrewery.endif
57295987Sbdrewery
58279899Simp# Some options are totally broken on some architectures. We disable
59279899Simp# them. If you need to enable them on an experimental basis, you
60279899Simp# must change this code.
61280766Simp# Note: These only apply to the list of modules we build by default
62280766Simp# and sometimes what is in the opt_*.h files by default.
63280766Simp# Kernel config files are unaffected, though some targets can be
64280766Simp# affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP.
65279899Simp
66279899Simp# Things that don't work based on the CPU
67279899Simp.if ${MACHINE_CPUARCH} == "arm"
68291103Sandrew. if ${MACHINE_ARCH:Marmv6*} == ""
69297174SianBROKEN_OPTIONS+= CDDL ZFS
70291103Sandrew. endif
71279899Simp.endif
72279899Simp
73279899Simp.if ${MACHINE_CPUARCH} == "mips"
74279899SimpBROKEN_OPTIONS+= CDDL ZFS
75279899Simp.endif
76279899Simp
77279899Simp.if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} == "powerpc"
78279899SimpBROKEN_OPTIONS+= ZFS
79279899Simp.endif
80279899Simp
81279899Simp# Things that don't work because the kernel doesn't have the support
82279899Simp# for them.
83279899Simp.if ${MACHINE} != "i386"
84279899SimpBROKEN_OPTIONS+= EISA
85279899Simp.endif
86279899Simp
87279899Simp.if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
88279899SimpBROKEN_OPTIONS+= OFED
89279899Simp.endif
90279899Simp
91269812Simp# expanded inline from bsd.mkopt.mk to avoid share/mk dependency
92269812Simp
93269812Simp# Those that default to yes
94266349Simp.for var in ${__DEFAULT_YES_OPTIONS}
95266349Simp.if !defined(MK_${var})
96266349Simp.if defined(WITHOUT_${var})			# WITHOUT always wins
97266349SimpMK_${var}:=	no
98265898Simp.else
99266349SimpMK_${var}:=	yes
100265898Simp.endif
101278457Simp.else
102278457Simp.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
103278457Simp.error "Illegal value for MK_${var}: ${MK_${var}}"
104266349Simp.endif
105278457Simp.endif # !defined(MK_${var})
106266349Simp.endfor
107266349Simp.undef __DEFAULT_YES_OPTIONS
108269540Simp
109269812Simp# Those that default to no
110269812Simp.for var in ${__DEFAULT_NO_OPTIONS}
111269812Simp.if !defined(MK_${var})
112269812Simp.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins
113269812SimpMK_${var}:=	yes
114269812Simp.else
115269812SimpMK_${var}:=	no
116269812Simp.endif
117278457Simp.else
118278457Simp.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
119278457Simp.error "Illegal value for MK_${var}: ${MK_${var}}"
120269812Simp.endif
121278457Simp.endif # !defined(MK_${var})
122269812Simp.endfor
123269812Simp.undef __DEFAULT_NO_OPTIONS
124269812Simp
125269540Simp#
126279898Simp# MK_* options which are always no, usually because they are
127279898Simp# unsupported/badly broken on this architecture.
128279898Simp#
129279898Simp.for var in ${BROKEN_OPTIONS}
130279898SimpMK_${var}:=	no
131279898Simp.endfor
132279898Simp.undef BROKEN_OPTIONS
133279898Simp#end of bsd.mkopt.mk expanded inline.
134279898Simp
135279898Simp#
136269540Simp# MK_*_SUPPORT options which default to "yes" unless their corresponding
137269540Simp# MK_* variable is set to "no".
138269540Simp#
139269540Simp.for var in \
140269540Simp    INET \
141269540Simp    INET6
142269540Simp.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
143269540SimpMK_${var}_SUPPORT:= no
144269540Simp.else
145274529Simp.if defined(KERNBUILDDIR)	# See if there's an opt_foo.h
146296770Sbdrewery.if !defined(OPT_${var})
147274529SimpOPT_${var}!= cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo
148296770Sbdrewery.export OPT_${var}
149296770Sbdrewery.endif
150274529Simp.if ${OPT_${var}} == ""		# nothing -> no
151274529SimpMK_${var}_SUPPORT:= no
152274529Simp.else
153269540SimpMK_${var}_SUPPORT:= yes
154269540Simp.endif
155274529Simp.else				# otherwise, yes
156274529SimpMK_${var}_SUPPORT:= yes
157274529Simp.endif
158274529Simp.endif
159269540Simp.endfor
160