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