xref: /freebsd/share/mk/src.opts.mk (revision 1719886f)
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    VIMAGE \
188    VT \
189    WIRELESS \
190    WPA_SUPPLICANT_EAPOL \
191    ZFS \
192    LOADER_ZFS \
193    ZONEINFO
194
195__DEFAULT_NO_OPTIONS = \
196    BEARSSL \
197    BHYVE_SNAPSHOT \
198    CLANG_EXTRAS \
199    CLANG_FORMAT \
200    DIALOG \
201    DETECT_TZ_CHANGES \
202    DISK_IMAGE_TOOLS_BOOTSTRAP \
203    DTRACE_ASAN \
204    DTRACE_TESTS \
205    EXPERIMENTAL \
206    HESIOD \
207    LOADER_BIOS_TEXTONLY \
208    LOADER_VERBOSE \
209    LOADER_VERIEXEC_PASS_MANIFEST \
210    LLVM_BINUTILS \
211    LLVM_FULL_DEBUGINFO \
212    MALLOC_PRODUCTION \
213    OFED_EXTRA \
214    OPENLDAP \
215    REPRODUCIBLE_BUILD \
216    RPCBIND_WARMSTART_SUPPORT \
217    SORT_THREADS \
218    ZONEINFO_LEAPSECONDS_SUPPORT \
219
220__REQUIRED_OPTIONS = \
221    CAPSICUM \
222    CASPER
223
224# LEFT/RIGHT. Left options which default to "yes" unless their corresponding
225# RIGHT option is disabled.
226__DEFAULT_DEPENDENT_OPTIONS= \
227	CLANG_FULL/CLANG \
228	LLVM_TARGET_ALL/CLANG \
229	LOADER_VERIEXEC/BEARSSL \
230	LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \
231	LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
232	VERIEXEC/BEARSSL \
233
234__SINGLE_OPTIONS = \
235	LIBC_MALLOC
236
237__LIBC_MALLOC_OPTIONS=	jemalloc
238__LIBC_MALLOC_DEFAULT=	jemalloc
239
240# MK_*_SUPPORT options which default to "yes" unless their corresponding
241# MK_* variable is set to "no".
242#
243.for var in \
244    BLACKLIST \
245    BZIP2 \
246    INET \
247    INET6 \
248    KERBEROS \
249    KVM \
250    NETGRAPH \
251    PAM \
252    TESTS \
253    VIMAGE \
254    WIRELESS
255__DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
256.endfor
257
258#
259# Default behaviour of some options depends on the architecture.  Unfortunately
260# this means that we have to test TARGET_ARCH (the buildworld case) as well
261# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
262# used at all in bsd.*.mk, but we have to make an exception here if we want
263# to allow defaults for some things like clang to vary by target architecture.
264# Additional, per-target behavior should be rarely added only after much
265# gnashing of teeth and grinding of gears.
266#
267.if defined(TARGET_ARCH)
268__T=${TARGET_ARCH}
269.else
270__T=${MACHINE_ARCH}
271.endif
272
273# All supported backends for LLVM_TARGET_XXX
274__LLVM_TARGETS= \
275		aarch64 \
276		arm \
277		powerpc \
278		riscv \
279		x86
280__LLVM_TARGET_FILT=	C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/
281.for __llt in ${__LLVM_TARGETS}
282# Default enable the given TARGET's LLVM_TARGET support
283.if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
284__DEFAULT_YES_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
285# aarch64 needs arm for -m32 support.
286.elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
287__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
288# Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
289.else
290__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
291.endif
292.endfor
293
294__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
295
296.include <bsd.compiler.mk>
297
298.if ${__T} == "i386" || ${__T} == "amd64"
299__DEFAULT_NO_OPTIONS += FDT
300.else
301__DEFAULT_YES_OPTIONS += FDT
302.endif
303
304.if ${__T:Marm*} == "" && ${__T:Mriscv64*} == ""
305__DEFAULT_YES_OPTIONS+=LLDB
306.else
307__DEFAULT_NO_OPTIONS+=LLDB
308.endif
309# LIB32 is not supported on all 64-bit architectures.
310.if (${__T} == "amd64" || ${__T:Maarch64*} != "" || ${__T} == "powerpc64")
311__DEFAULT_YES_OPTIONS+=LIB32
312.else
313BROKEN_OPTIONS+=LIB32
314.endif
315# EFI doesn't exist on powerpc (well, officially) and doesn't work on i386
316.if ${__T:Mpowerpc*} || ${__T} == "i386"
317BROKEN_OPTIONS+=EFI
318.endif
319# Bad coupling for libsecure stuff with bearssl and efi, so broken on EFI
320.if ${__T:Mpowerpc*}
321BROKEN_OPTIONS+=BEARSSL		# bearssl brings in secure efi stuff xxx
322.endif
323# OFW is only for powerpc, exclude others
324.if ${__T:Mpowerpc*} == ""
325BROKEN_OPTIONS+=LOADER_OFW
326.endif
327# KBOOT is only for powerpc64 (powerpc64le broken) amd64 and aarch64
328.if ${__T} != "powerpc64" && ${__T} != "amd64" && ${__T} != "aarch64"
329BROKEN_OPTIONS+=LOADER_KBOOT
330.endif
331# UBOOT is only for arm, and big-endian powerpc
332.if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
333BROKEN_OPTIONS+=LOADER_UBOOT
334.endif
335# GELI and Lua in loader currently cause boot failures on powerpc.
336# Further debugging is required -- probably they are just broken on big
337# endian systems generically (they jump to null pointers or try to read
338# crazy high addresses, which is typical of endianness problems).
339.if ${__T:Mpowerpc*}
340BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
341.endif
342
343# Kernel TLS is enabled by default on amd64, aarch64 and powerpc64*
344.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != ""
345__DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
346.else
347__DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
348.endif
349
350.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
351    ${__T:Mpowerpc64*} == ""
352BROKEN_OPTIONS+=CXGBETOOL
353BROKEN_OPTIONS+=MLX5TOOL
354.endif
355
356.if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64"
357BROKEN_OPTIONS+=HYPERV
358.endif
359
360# NVME is only aarch64, x86 and powerpc64*
361.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
362    ${__T:Mpowerpc64*} == ""
363BROKEN_OPTIONS+=NVME
364.endif
365
366.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
367    ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != ""
368__DEFAULT_YES_OPTIONS+=OPENMP
369.else
370__DEFAULT_NO_OPTIONS+=OPENMP
371.endif
372
373# Broken on 32-bit arm, kernel module compile errors
374.if ${__T:Marm*} != ""
375BROKEN_OPTIONS+= OFED
376.endif
377
378# MK_host_egacy is set by local.sys.mk so is valid here
379.if ${MACHINE:Nhost*} == "" && ${MK_host_egacy} == "yes"
380# we cannot expect tests to work
381BROKEN_OPTIONS+= TESTS
382.endif
383
384.-include <site.src.opts.mk>
385
386.include <bsd.mkopt.mk>
387
388#
389# Force some options off if their dependencies are off.
390# Order is somewhat important.
391#
392.if ${MK_CAPSICUM} == "no"
393MK_CASPER:=	no
394.endif
395
396.if ${MK_SOURCELESS} == "no"
397MK_SOURCELESS_HOST:=	no
398MK_SOURCELESS_UCODE:= no
399.endif
400
401.if ${MK_CDDL} == "no"
402MK_CTF:=	no
403MK_DTRACE:=	no
404MK_LOADER_ZFS:=	no
405MK_ZFS:=	no
406.endif
407
408.if ${MK_CRYPT} == "no"
409MK_OPENSSL:=	no
410MK_OPENSSH:=	no
411MK_KERBEROS:=	no
412MK_KERBEROS_SUPPORT:=	no
413.endif
414
415.if ${MK_DTRACE} == "no"
416MK_CTF:=	no
417.endif
418
419.if ${MK_MAIL} == "no"
420MK_MAILWRAPPER:= no
421MK_SENDMAIL:=	no
422MK_DMAGENT:=	no
423.endif
424
425.if ${MK_NETGRAPH} == "no"
426MK_BLUETOOTH:=	no
427.endif
428
429.if ${MK_NLS} == "no"
430MK_NLS_CATALOGS:= no
431.endif
432
433.if ${MK_OPENSSL} == "no"
434MK_DMAGENT:=	no
435MK_OPENSSH:=	no
436MK_OPENSSL_KTLS:=	no
437MK_KERBEROS:=	no
438MK_KERBEROS_SUPPORT:=	no
439MK_LDNS:=	no
440MK_PKGBOOTSTRAP:=	no
441MK_LOADER_ZFS:=	no
442MK_ZFS:=	no
443.endif
444
445.if ${MK_LDNS} == "no"
446MK_LDNS_UTILS:=	no
447MK_UNBOUND:= no
448.endif
449
450.if ${MK_PF} == "no"
451MK_AUTHPF:=	no
452.endif
453
454.if ${MK_OFED} == "no"
455MK_OFED_EXTRA:=	no
456.endif
457
458.if ${MK_TESTS} == "no"
459MK_DTRACE_TESTS:= no
460.endif
461
462.if ${MK_TESTS_SUPPORT} == "no"
463MK_GOOGLETEST:=	no
464.endif
465
466.if ${MK_ZONEINFO} == "no"
467MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
468.endif
469
470.if ${MK_CROSS_COMPILER} == "no"
471MK_CLANG_BOOTSTRAP:= no
472MK_ELFTOOLCHAIN_BOOTSTRAP:= no
473MK_LLD_BOOTSTRAP:= no
474.endif
475
476.if ${MK_TOOLCHAIN} == "no"
477MK_CLANG:=	no
478MK_LLD:=	no
479MK_LLDB:=	no
480MK_LLVM_BINUTILS:=	no
481.endif
482
483.if ${MK_CLANG} == "no"
484MK_CLANG_EXTRAS:= no
485MK_CLANG_FORMAT:= no
486MK_CLANG_FULL:= no
487MK_LLVM_COV:= no
488.endif
489
490.if ${MK_ASAN} == "yes"
491# In order to get sensible backtraces from ASAN we have to install
492# llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
493MK_LLVM_BINUTILS:=	yes
494.endif
495
496.if ${MK_LLVM_BINUTILS} == "yes"
497# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be
498# enabled if MK_LLVM_BINUTILS is set.
499MK_LLVM_CXXFILT:=	yes
500.endif
501
502.if ${MK_LOADER_VERIEXEC} == "no"
503MK_LOADER_VERIEXEC_PASS_MANIFEST := no
504.endif
505
506#
507# MK_* options whose default value depends on another option.
508#
509.for vv in \
510    GSSAPI/KERBEROS \
511    MAN_UTILS/MAN
512.if defined(WITH_${vv:H})
513MK_${vv:H}:=	yes
514.elif defined(WITHOUT_${vv:H})
515MK_${vv:H}:=	no
516.else
517MK_${vv:H}:=	${MK_${vv:T}}
518.endif
519.endfor
520
521#
522# Set defaults for the MK_*_SUPPORT variables.
523#
524
525.endif #  !target(__<src.opts.mk>__)
526