xref: /freebsd/share/mk/src.opts.mk (revision b2f5dc591ef2547ee2e9b68e58a263cd34948db1)
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>__:	.NOTMAIN
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    CPP \
84    CROSS_COMPILER \
85    CRYPT \
86    CUSE \
87    CXGBETOOL \
88    DICT \
89    DMAGENT \
90    DTRACE \
91    DYNAMICROOT \
92    EE \
93    EFI \
94    ELFTOOLCHAIN_BOOTSTRAP \
95    EXAMPLES \
96    FILE \
97    FINGER \
98    FLOPPY \
99    FORTH \
100    FP_LIBC \
101    FREEBSD_UPDATE \
102    FTP \
103    GAMES \
104    GNU_DIFF \
105    GOOGLETEST \
106    GPIO \
107    HAST \
108    HTML \
109    HYPERV \
110    ICONV \
111    INET \
112    INET6 \
113    INETD \
114    IPFILTER \
115    IPFW \
116    ISCSI \
117    JAIL \
118    JEMALLOC_LG_VADDR_WIDE \
119    KDUMP \
120    KVM \
121    LDNS \
122    LDNS_UTILS \
123    LEGACY_CONSOLE \
124    LLD \
125    LLD_BOOTSTRAP \
126    LLVM_ASSERTIONS \
127    LLVM_BINUTILS \
128    LLVM_COV \
129    LLVM_CXXFILT \
130    LOADER_BIOS_TEXTONLY \
131    LOADER_GELI \
132    LOADER_KBOOT \
133    LOADER_LUA \
134    LOADER_OFW \
135    LOADER_PXEBOOT \
136    LOADER_UBOOT \
137    LOADER_IA32 \
138    LOCALES \
139    LOCATE \
140    LPR \
141    LS_COLORS \
142    MACHDEP_OPTIMIZATIONS \
143    MAIL \
144    MAILWRAPPER \
145    MAKE \
146    MITKRB5 \
147    MLX5TOOL \
148    NETCAT \
149    NETGRAPH \
150    NETLINK \
151    NETLINK_SUPPORT \
152    NLS_CATALOGS \
153    NS_CACHING \
154    NTP \
155    NUAGEINIT \
156    OFED \
157    OPENSSL \
158    PAM \
159    PF \
160    PKGBOOTSTRAP \
161    PMC \
162    PPP \
163    PTHREADS_ASSERTIONS \
164    QUOTAS \
165    RADIUS_SUPPORT \
166    RBOOTD \
167    RESCUE \
168    ROUTED \
169    SENDMAIL \
170    SERVICESDB \
171    SETUID_LOGIN \
172    SHAREDOCS \
173    SOURCELESS \
174    SOURCELESS_HOST \
175    SOURCELESS_UCODE \
176    STATS \
177    SYSCONS \
178    SYSTEM_COMPILER \
179    SYSTEM_LINKER \
180    TALK \
181    TCP_WRAPPERS \
182    TCSH \
183    TELNET \
184    TEXTPROC \
185    TFTP \
186    UNBOUND \
187    USB \
188    UTMPX \
189    VI \
190    VT \
191    WIRELESS \
192    WPA_SUPPLICANT_EAPOL \
193    ZFS \
194    ZFS_TESTS \
195    LOADER_ZFS \
196    ZONEINFO
197
198__DEFAULT_NO_OPTIONS = \
199    BEARSSL \
200    BHYVE_SNAPSHOT \
201    CLANG_EXTRAS \
202    CLANG_FORMAT \
203    CLEAN \
204    DIALOG \
205    DETECT_TZ_CHANGES \
206    DISK_IMAGE_TOOLS_BOOTSTRAP \
207    DTRACE_ASAN \
208    DTRACE_TESTS \
209    EXPERIMENTAL \
210    HESIOD \
211    LOADER_VERBOSE \
212    LOADER_VERIEXEC_PASS_MANIFEST \
213    LLVM_FULL_DEBUGINFO \
214    MALLOC_PRODUCTION \
215    OFED_EXTRA \
216    OPENLDAP \
217    RPCBIND_WARMSTART_SUPPORT \
218    SORT_THREADS \
219    ZONEINFO_LEAPSECONDS_SUPPORT \
220
221__REQUIRED_OPTIONS = \
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    WIRELESS
254__DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
255.endfor
256
257#
258# Default behaviour of some options depends on the architecture.  Unfortunately
259# this means that we have to test TARGET_ARCH (the buildworld case) as well
260# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
261# used at all in bsd.*.mk, but we have to make an exception here if we want
262# to allow defaults for some things like clang to vary by target architecture.
263# Additional, per-target behavior should be rarely added only after much
264# gnashing of teeth and grinding of gears.
265#
266.if defined(TARGET_ARCH)
267__T=${TARGET_ARCH}
268.else
269__T=${MACHINE_ARCH}
270.endif
271
272# All supported backends for LLVM_TARGET_XXX
273__LLVM_TARGETS= \
274		aarch64 \
275		arm \
276		powerpc \
277		riscv \
278		x86
279__LLVM_TARGET_FILT=	C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/
280.for __llt in ${__LLVM_TARGETS}
281# Default enable the given TARGET's LLVM_TARGET support
282.if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
283__DEFAULT_YES_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
284# aarch64 needs arm for -m32 support.
285.elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
286__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
287# Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
288.else
289__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
290.endif
291.endfor
292
293__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
294
295.include <bsd.compiler.mk>
296
297.if ${__T} == "i386" || ${__T} == "amd64"
298__DEFAULT_NO_OPTIONS+=FDT
299.else
300__DEFAULT_YES_OPTIONS+=FDT
301.endif
302
303.if ${__T:Marm*} == "" && ${__T:Mriscv64*} == ""
304__DEFAULT_YES_OPTIONS+=LLDB
305.else
306__DEFAULT_NO_OPTIONS+=LLDB
307.endif
308# LIB32 is not supported on all 64-bit architectures.
309.if (${__T:Maarch64*} != "" && ((defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} != "gcc") || (!defined(X_COMPILER_TYPE) && ${COMPILER_TYPE} != "gcc"))) || ${__T} == "amd64" || ${__T} == "powerpc64"
310__DEFAULT_YES_OPTIONS+=LIB32
311.else
312BROKEN_OPTIONS+=LIB32
313.endif
314# EFI doesn't exist on powerpc (well, officially) and doesn't work on i386
315.if ${__T:Mpowerpc*} || ${__T} == "i386"
316BROKEN_OPTIONS+=EFI
317.endif
318# Bad coupling for libsecure stuff with bearssl and efi, so broken on EFI
319.if ${__T:Mpowerpc*}
320BROKEN_OPTIONS+=BEARSSL		# bearssl brings in secure efi stuff xxx
321.endif
322# OFW is only for powerpc, exclude others
323.if ${__T:Mpowerpc*} == ""
324BROKEN_OPTIONS+=LOADER_OFW
325.endif
326# KBOOT is only for powerpc64 (powerpc64le broken) amd64 and aarch64
327.if ${__T} != "powerpc64" && ${__T} != "amd64" && ${__T} != "aarch64"
328BROKEN_OPTIONS+=LOADER_KBOOT
329.endif
330# UBOOT is only for arm, and big-endian powerpc
331.if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
332BROKEN_OPTIONS+=LOADER_UBOOT
333.endif
334# The 32-bit UEFI loader is only for amd64
335.if ${__T} != "amd64"
336BROKEN_OPTIONS+=LOADER_IA32
337.endif
338# GELI and Lua in loader currently cause boot failures on powerpc.
339# Further debugging is required -- probably they are just broken on big
340# endian systems generically (they jump to null pointers or try to read
341# crazy high addresses, which is typical of endianness problems).
342.if ${__T:Mpowerpc*}
343BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
344.endif
345
346# Kernel TLS is enabled by default on amd64, aarch64 and powerpc64*
347.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != ""
348__DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
349.else
350__DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
351.endif
352
353.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
354    ${__T:Mpowerpc64*} == ""
355BROKEN_OPTIONS+=CXGBETOOL
356BROKEN_OPTIONS+=MLX5TOOL
357.endif
358
359.if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64"
360BROKEN_OPTIONS+=HYPERV
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_SOURCELESS} == "no"
390MK_SOURCELESS_HOST:=	no
391MK_SOURCELESS_UCODE:= no
392.endif
393
394.if ${MK_CDDL} == "no"
395MK_CTF:=	no
396MK_DTRACE:=	no
397MK_LOADER_ZFS:=	no
398MK_ZFS:=	no
399.endif
400
401.if ${MK_CRYPT} == "no"
402MK_OPENSSL:=	no
403MK_OPENSSH:=	no
404MK_KERBEROS:=	no
405MK_KERBEROS_SUPPORT:=	no
406MK_MITKRB5:=	no
407.endif
408
409.if ${MK_DTRACE} == "no"
410MK_CTF:=	no
411.endif
412
413.if ${MK_MAIL} == "no"
414MK_MAILWRAPPER:= no
415MK_SENDMAIL:=	no
416MK_DMAGENT:=	no
417.endif
418
419.if ${MK_NETGRAPH} == "no"
420MK_BLUETOOTH:=	no
421.endif
422
423.if ${MK_NLS} == "no"
424MK_NLS_CATALOGS:= no
425.endif
426
427.if ${MK_OPENSSL} == "no"
428MK_DMAGENT:=	no
429MK_OPENSSH:=	no
430MK_OPENSSL_KTLS:=	no
431MK_KERBEROS:=	no
432MK_KERBEROS_SUPPORT:=	no
433MK_MITKRB5:=	no
434MK_LDNS:=	no
435MK_PKGBOOTSTRAP:=	no
436MK_LOADER_ZFS:=	no
437MK_ZFS:=	no
438.endif
439
440.if ${MK_LDNS} == "no"
441MK_LDNS_UTILS:=	no
442MK_UNBOUND:= no
443.endif
444
445.if ${MK_PF} == "no"
446MK_AUTHPF:=	no
447.endif
448
449.if ${MK_OFED} == "no"
450MK_OFED_EXTRA:=	no
451.endif
452
453.if ${MK_TESTS} == "no"
454MK_DTRACE_TESTS:= no
455MK_ZFS_TESTS:= no
456.endif
457
458.if ${MK_ZFS} == "no"
459MK_ZFS_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    KERBEROS_SUPPORT/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.endif #  !target(__<src.opts.mk>__)
522