xref: /freebsd/share/mk/src.opts.mk (revision ec965063070e5753c166cf592c9336444b74720a)
1# $FreeBSD$
2#
3# Option file for FreeBSD /usr/src builds, at least the userland and boot loader
4# portions of the tree. These options generally chose what parts of the tree to
5# include or omit and are FreeBSD source tree specific.
6#
7# Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf
8# and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no}
9# with sensible (usually) defaults.
10#
11# Makefiles must include bsd.opts.mk after defining specific MK_FOO options that
12# are applicable for that Makefile (typically there are none, but sometimes there
13# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
14# to omit from that make.
15#
16# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO
17# variable.
18#
19# Makefiles may also assume that this file is included by src.opts.mk should it
20# need variables defined there prior to the end of the Makefile where
21# bsd.{subdir,lib.bin}.mk is traditionally included.
22#
23# The old-style YES_FOO and NO_FOO are being phased out. No new instances of them
24# should be added. Old instances should be removed since they were just to
25# bridge the gap between FreeBSD 4 and FreeBSD 5.
26#
27# Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an
28# exception is made for _WITHOUT_SRCONF which turns off this mechanism
29# completely inside bsd.*.mk files).
30#
31
32.if !target(__<src.opts.mk>__)
33__<src.opts.mk>__:
34
35.include <bsd.own.mk>
36
37#
38# Define MK_* variables (which are either "yes" or "no") for users
39# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
40# make(1) environment.
41# These should be tested with `== "no"' or `!= "no"' in makefiles.
42# The NO_* variables should only be set by makefiles for variables
43# that haven't been converted over.
44#
45
46# These options are used by the src builds. Those listed in
47# __DEFAULT_YES_OPTIONS default to 'yes' and will build unless turned
48# off.  __DEFAULT_NO_OPTIONS will default to 'no' and won't build
49# unless turned on. Any options listed in 'BROKEN_OPTIONS' will be
50# hard-wired to 'no'.  "Broken" here means not working or
51# not-appropriate and/or not supported. It doesn't imply something is
52# wrong with the code. There's not a single good word for this, so
53# BROKEN was selected as the least imperfect one considered at the
54# time. Options are added to BROKEN_OPTIONS list on a per-arch basis.
55# At this time, there's no provision for mutually incompatible options.
56
57__DEFAULT_YES_OPTIONS = \
58    ACCT \
59    ACPI \
60    APM \
61    AT \
62    ATM \
63    AUDIT \
64    AUTHPF \
65    AUTOFS \
66    BHYVE \
67    BLACKLIST \
68    BLUETOOTH \
69    BOOT \
70    BOOTPARAMD \
71    BOOTPD \
72    BSD_CPIO \
73    BSDINSTALL \
74    BSNMP \
75    BZIP2 \
76    CALENDAR \
77    CAPSICUM \
78    CAROOT \
79    CASPER \
80    CCD \
81    CDDL \
82    CLANG \
83    CLANG_BOOTSTRAP \
84    CLEAN \
85    CPP \
86    CROSS_COMPILER \
87    CRYPT \
88    CUSE \
89    CXX \
90    CXGBETOOL \
91    DIALOG \
92    DICT \
93    DMAGENT \
94    DTRACE \
95    DYNAMICROOT \
96    EE \
97    EFI \
98    ELFTOOLCHAIN_BOOTSTRAP \
99    EXAMPLES \
100    FDT \
101    FILE \
102    FINGER \
103    FLOPPY \
104    FORTH \
105    FP_LIBC \
106    FREEBSD_UPDATE \
107    FTP \
108    GAMES \
109    GH_BC \
110    GNU_DIFF \
111    GOOGLETEST \
112    GPIO \
113    HAST \
114    HTML \
115    HYPERV \
116    ICONV \
117    INET \
118    INET6 \
119    INETD \
120    IPFILTER \
121    IPFW \
122    ISCSI \
123    JAIL \
124    KDUMP \
125    KVM \
126    LDNS \
127    LDNS_UTILS \
128    LEGACY_CONSOLE \
129    LLD \
130    LLD_BOOTSTRAP \
131    LLD_IS_LD \
132    LLVM_ASSERTIONS \
133    LLVM_COV \
134    LLVM_CXXFILT \
135    LOADER_GELI \
136    LOADER_KBOOT \
137    LOADER_LUA \
138    LOADER_OFW \
139    LOADER_UBOOT \
140    LOCALES \
141    LOCATE \
142    LPR \
143    LS_COLORS \
144    MACHDEP_OPTIMIZATIONS \
145    MAIL \
146    MAILWRAPPER \
147    MAKE \
148    MLX5TOOL \
149    NDIS \
150    NETCAT \
151    NETGRAPH \
152    NLS_CATALOGS \
153    NS_CACHING \
154    NTP \
155    NVME \
156    OFED \
157    OPENSSL \
158    PAM \
159    PF \
160    PKGBOOTSTRAP \
161    PMC \
162    PORTSNAP \
163    PPP \
164    QUOTAS \
165    RADIUS_SUPPORT \
166    RBOOTD \
167    RESCUE \
168    ROUTED \
169    SENDMAIL \
170    SERVICESDB \
171    SETUID_LOGIN \
172    SHARED_TOOLCHAIN \
173    SHAREDOCS \
174    SOURCELESS \
175    SOURCELESS_HOST \
176    SOURCELESS_UCODE \
177    STATS \
178    SYSCONS \
179    SYSTEM_COMPILER \
180    SYSTEM_LINKER \
181    TALK \
182    TCP_WRAPPERS \
183    TCSH \
184    TELNET \
185    TEXTPROC \
186    TFTP \
187    UNBOUND \
188    USB \
189    UTMPX \
190    VI \
191    VT \
192    WIRELESS \
193    WPA_SUPPLICANT_EAPOL \
194    ZFS \
195    LOADER_ZFS \
196    ZONEINFO
197
198__DEFAULT_NO_OPTIONS = \
199    BEARSSL \
200    BHYVE_SNAPSHOT \
201    CLANG_EXTRAS \
202    CLANG_FORMAT \
203    DETECT_TZ_CHANGES \
204    DTRACE_TESTS \
205    EXPERIMENTAL \
206    HESIOD \
207    LOADER_VERBOSE \
208    LOADER_VERIEXEC_PASS_MANIFEST \
209    LLVM_BINUTILS \
210    MALLOC_PRODUCTION \
211    OFED_EXTRA \
212    OPENLDAP \
213    REPRODUCIBLE_BUILD \
214    RPCBIND_WARMSTART_SUPPORT \
215    SORT_THREADS \
216    ZONEINFO_LEAPSECONDS_SUPPORT \
217
218# LEFT/RIGHT. Left options which default to "yes" unless their corresponding
219# RIGHT option is disabled.
220__DEFAULT_DEPENDENT_OPTIONS= \
221	CLANG_FULL/CLANG \
222	LLVM_TARGET_ALL/CLANG \
223	LOADER_VERIEXEC/BEARSSL \
224	LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \
225	LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
226	VERIEXEC/BEARSSL \
227
228# MK_*_SUPPORT options which default to "yes" unless their corresponding
229# MK_* variable is set to "no".
230#
231.for var in \
232    BLACKLIST \
233    BZIP2 \
234    INET \
235    INET6 \
236    KERBEROS \
237    KVM \
238    NETGRAPH \
239    PAM \
240    TESTS \
241    WIRELESS
242__DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
243.endfor
244
245.-include <site.src.opts.mk>
246
247#
248# Default behaviour of some options depends on the architecture.  Unfortunately
249# this means that we have to test TARGET_ARCH (the buildworld case) as well
250# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
251# used at all in bsd.*.mk, but we have to make an exception here if we want
252# to allow defaults for some things like clang to vary by target architecture.
253# Additional, per-target behavior should be rarely added only after much
254# gnashing of teeth and grinding of gears.
255#
256.if defined(TARGET_ARCH)
257__T=${TARGET_ARCH}
258.else
259__T=${MACHINE_ARCH}
260.endif
261
262# All supported backends for LLVM_TARGET_XXX
263__LLVM_TARGETS= \
264		aarch64 \
265		arm \
266		powerpc \
267		riscv \
268		x86
269__LLVM_TARGET_FILT=	C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/:C/mips.*/mips/
270.for __llt in ${__LLVM_TARGETS}
271# Default enable the given TARGET's LLVM_TARGET support
272.if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
273__DEFAULT_YES_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
274# aarch64 needs arm for -m32 support.
275.elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
276__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
277# Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
278.else
279__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
280.endif
281.endfor
282
283__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
284
285.include <bsd.compiler.mk>
286
287.if ${__T:Marm*} == "" && ${__T:Mriscv64*} == ""
288__DEFAULT_YES_OPTIONS+=LLDB
289.else
290__DEFAULT_NO_OPTIONS+=LLDB
291.endif
292# LIB32 is supported on amd64 and powerpc64
293.if (${__T} == "amd64" || ${__T} == "powerpc64")
294__DEFAULT_YES_OPTIONS+=LIB32
295.else
296BROKEN_OPTIONS+=LIB32
297.endif
298# EFI doesn't exist on powerpc (well, officially)
299.if ${__T:Mpowerpc*}
300BROKEN_OPTIONS+=EFI
301.endif
302# OFW is only for powerpc, exclude others
303.if ${__T:Mpowerpc*} == ""
304BROKEN_OPTIONS+=LOADER_OFW
305.endif
306# KBOOT is only for powerpc64 (powerpc64le broken) and kinda for amd64
307.if ${__T} != "powerpc64" && ${__T} != "amd64"
308BROKEN_OPTIONS+=LOADER_KBOOT
309.endif
310# UBOOT is only for arm, and big-endian powerpc
311.if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
312BROKEN_OPTIONS+=LOADER_UBOOT
313.endif
314# GELI and Lua in loader currently cause boot failures on powerpc.
315# Further debugging is required -- probably they are just broken on big
316# endian systems generically (they jump to null pointers or try to read
317# crazy high addresses, which is typical of endianness problems).
318.if ${__T:Mpowerpc*}
319BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
320.endif
321
322# Kernel TLS is enabled by default on amd64 and aarch64
323.if ${__T} == "aarch64" || ${__T} == "amd64"
324__DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
325.else
326__DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
327.endif
328
329.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
330    ${__T:Mpowerpc64*} == ""
331BROKEN_OPTIONS+=CXGBETOOL
332BROKEN_OPTIONS+=MLX5TOOL
333.endif
334
335.if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64"
336BROKEN_OPTIONS+=HYPERV
337.endif
338
339# NVME is only aarch64, x86 and powerpc64*
340.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
341    ${__T:Mpowerpc64*} == ""
342BROKEN_OPTIONS+=NVME
343.endif
344
345.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
346    ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != ""
347__DEFAULT_YES_OPTIONS+=OPENMP
348.else
349__DEFAULT_NO_OPTIONS+=OPENMP
350.endif
351
352# libc++ requires C++20
353.if !${COMPILER_FEATURES:Mc++20}
354BROKEN_OPTIONS+=CXX
355.endif
356
357.include <bsd.mkopt.mk>
358
359#
360# Force some options off if their dependencies are off.
361# Order is somewhat important.
362#
363.if ${MK_CAPSICUM} == "no"
364MK_CASPER:=	no
365.endif
366
367.if ${MK_SOURCELESS} == "no"
368MK_SOURCELESS_HOST:=	no
369MK_SOURCELESS_UCODE:= no
370.endif
371
372.if ${MK_CDDL} == "no"
373MK_CTF:=	no
374MK_DTRACE:=	no
375MK_LOADER_ZFS:=	no
376MK_ZFS:=	no
377.endif
378
379.if ${MK_CRYPT} == "no"
380MK_OPENSSL:=	no
381MK_OPENSSH:=	no
382MK_KERBEROS:=	no
383MK_KERBEROS_SUPPORT:=	no
384.endif
385
386.if ${MK_CXX} == "no"
387MK_CLANG:=	no
388MK_LLD:=	no
389MK_LLDB:=	no
390MK_LLVM_BINUTILS:= no
391MK_GOOGLETEST:=	no
392MK_OFED:=	no
393MK_OPENMP:=	no
394MK_PMC:=	no
395MK_TESTS:=	no
396.endif
397
398.if ${MK_DIALOG} == "no"
399MK_BSDINSTALL:=	no
400.endif
401
402.if ${MK_DTRACE} == "no"
403MK_CTF:=	no
404.endif
405
406.if ${MK_MAIL} == "no"
407MK_MAILWRAPPER:= no
408MK_SENDMAIL:=	no
409MK_DMAGENT:=	no
410.endif
411
412.if ${MK_NETGRAPH} == "no"
413MK_ATM:=	no
414MK_BLUETOOTH:=	no
415.endif
416
417.if ${MK_NLS} == "no"
418MK_NLS_CATALOGS:= no
419.endif
420
421.if ${MK_OPENSSL} == "no"
422MK_DMAGENT:=	no
423MK_OPENSSH:=	no
424MK_OPENSSL_KTLS:=	no
425MK_KERBEROS:=	no
426MK_KERBEROS_SUPPORT:=	no
427MK_LDNS:=	no
428MK_PKGBOOTSTRAP:=	no
429MK_ZFS:=	no
430.endif
431
432.if ${MK_LDNS} == "no"
433MK_LDNS_UTILS:=	no
434MK_UNBOUND:= no
435.endif
436
437.if ${MK_PF} == "no"
438MK_AUTHPF:=	no
439.endif
440
441.if ${MK_OFED} == "no"
442MK_OFED_EXTRA:=	no
443.endif
444
445.if ${MK_TESTS} == "no"
446MK_DTRACE_TESTS:= no
447.endif
448
449.if ${MK_TESTS_SUPPORT} == "no"
450MK_GOOGLETEST:=	no
451.endif
452
453.if ${MK_ZONEINFO} == "no"
454MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
455.endif
456
457.if ${MK_CROSS_COMPILER} == "no"
458MK_CLANG_BOOTSTRAP:= no
459MK_ELFTOOLCHAIN_BOOTSTRAP:= no
460MK_LLD_BOOTSTRAP:= no
461.endif
462
463.if ${MK_TOOLCHAIN} == "no"
464MK_CLANG:=	no
465MK_INCLUDES:=	no
466MK_LLD:=	no
467MK_LLDB:=	no
468MK_LLVM_BINUTILS:=	no
469.endif
470
471.if ${MK_CLANG} == "no"
472MK_CLANG_EXTRAS:= no
473MK_CLANG_FORMAT:= no
474MK_CLANG_FULL:= no
475MK_LLVM_COV:= no
476.endif
477
478.if ${MK_ASAN} == "yes"
479# In order to get sensible backtraces from ASAN we have to install
480# llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
481MK_LLVM_BINUTILS:=	yes
482.endif
483
484.if ${MK_LLVM_BINUTILS} == "yes"
485# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be
486# enabled if MK_LLVM_BINUTILS is set.
487MK_LLVM_CXXFILT:=	yes
488.endif
489
490.if ${MK_LOADER_VERIEXEC} == "no"
491MK_LOADER_VERIEXEC_PASS_MANIFEST := no
492.endif
493
494#
495# MK_* options whose default value depends on another option.
496#
497.for vv in \
498    GSSAPI/KERBEROS \
499    MAN_UTILS/MAN
500.if defined(WITH_${vv:H})
501MK_${vv:H}:=	yes
502.elif defined(WITHOUT_${vv:H})
503MK_${vv:H}:=	no
504.else
505MK_${vv:H}:=	${MK_${vv:T}}
506.endif
507.endfor
508
509#
510# Set defaults for the MK_*_SUPPORT variables.
511#
512
513.endif #  !target(__<src.opts.mk>__)
514