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