xref: /freebsd/share/mk/src.opts.mk (revision a259b98fa211ed87bfee58c575de4e2de94ee0fa)
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    BLOCKLIST \
70    BLUETOOTH \
71    BOOT \
72    BOOTPARAMD \
73    BOOTPD \
74    BSDINSTALL \
75    BSNMP \
76    CALENDAR \
77    CAROOT \
78    CCD \
79    CDDL \
80    CLANG \
81    CLANG_BOOTSTRAP \
82    CPP \
83    CROSS_COMPILER \
84    CRYPT \
85    CUSE \
86    CXGBETOOL \
87    DEPEND_CLEANUP \
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    FREEBSD_UPDATE \
101    FTP \
102    GAMES \
103    GOOGLETEST \
104    GPIO \
105    HAST \
106    HTML \
107    HYPERV \
108    ICONV \
109    INET \
110    INET6 \
111    INETD \
112    IPFILTER \
113    IPFW \
114    ISCSI \
115    JAIL \
116    JEMALLOC_LG_VADDR_WIDE \
117    KDUMP \
118    KVM \
119    LDNS \
120    LDNS_UTILS \
121    LEGACY_CONSOLE \
122    LLD \
123    LLD_BOOTSTRAP \
124    LLVM_ASSERTIONS \
125    LLVM_BINUTILS \
126    LLVM_BINUTILS_BOOTSTRAP \
127    LOADER_BIOS \
128    LOADER_BIOS_TEXTONLY \
129    LOADER_GELI \
130    LOADER_IA32 \
131    LOADER_KBOOT \
132    LOADER_LUA \
133    LOADER_OFW \
134    LOADER_PXEBOOT \
135    LOADER_UBOOT \
136    LOADER_USERBOOT \
137    LOADER_ZFS \
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    PKGCONF \
162    PKGSERVE \
163    PMC \
164    PPP \
165    PTHREADS_ASSERTIONS \
166    QUOTAS \
167    RADIUS_SUPPORT \
168    RBOOTD \
169    RESCUE \
170    ROUTED \
171    SENDMAIL \
172    SERVICESDB \
173    SETUID_LOGIN \
174    SHAREDOCS \
175    SOUND \
176    SOURCELESS \
177    SOURCELESS_HOST \
178    SOURCELESS_UCODE \
179    STATS \
180    SYSCONS \
181    SYSTEM_COMPILER \
182    SYSTEM_LINKER \
183    TALK \
184    TCP_WRAPPERS \
185    TCSH \
186    TELNET \
187    TEXTPROC \
188    TFTP \
189    UNBOUND \
190    USB \
191    UTMPX \
192    VI \
193    VT \
194    WIRELESS \
195    WPA_SUPPLICANT_EAPOL \
196    ZFS \
197    ZFS_TESTS \
198    ZONEINFO
199
200__DEFAULT_NO_OPTIONS = \
201    BEARSSL \
202    BHYVE_SNAPSHOT \
203    CLANG_EXTRAS \
204    CLANG_FORMAT \
205    CLEAN \
206    DETECT_TZ_CHANGES \
207    DISK_IMAGE_TOOLS_BOOTSTRAP \
208    DTRACE_ASAN \
209    DTRACE_TESTS \
210    HESIOD \
211    IPFILTER_IPFS \
212    LLVM_FULL_DEBUGINFO \
213    LLVM_LINK_STATIC_LIBRARIES \
214    LOADER_USB \
215    LOADER_VERBOSE \
216    LOADER_VERIEXEC_PASS_MANIFEST \
217    MALLOC_PRODUCTION \
218    OFED_EXTRA \
219    OPENLDAP \
220    RPCBIND_WARMSTART_SUPPORT \
221    SORT_THREADS \
222    ZONEINFO_LEAPSECONDS_SUPPORT \
223
224__REQUIRED_OPTIONS = \
225    CASPER
226
227# LEFT/RIGHT. Left options which default to "yes" unless their corresponding
228# RIGHT option is disabled.
229__DEFAULT_DEPENDENT_OPTIONS= \
230	CLANG_FULL/CLANG \
231	LLVM_TARGET_ALL/CLANG \
232	LOADER_VERIEXEC/BEARSSL \
233	LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \
234	LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
235	VERIEXEC/BEARSSL \
236
237__SINGLE_OPTIONS = \
238	LIBC_MALLOC
239
240__LIBC_MALLOC_OPTIONS=	jemalloc
241__LIBC_MALLOC_DEFAULT=	jemalloc
242
243# MK_*_SUPPORT options which default to "yes" unless their corresponding
244# MK_* variable is set to "no".
245#
246.for var in \
247    BLACKLIST \
248    BLOCKLIST \
249    INET \
250    INET6 \
251    KERBEROS \
252    KVM \
253    NETGRAPH \
254    PAM \
255    TESTS \
256    WIRELESS
257__DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
258.endfor
259
260#
261# Default behaviour of some options depends on the architecture.  Unfortunately
262# this means that we have to test TARGET_ARCH (the buildworld case) as well
263# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
264# used at all in bsd.*.mk, but we have to make an exception here if we want
265# to allow defaults for some things like clang to vary by target architecture.
266# Additional, per-target behavior should be rarely added only after much
267# gnashing of teeth and grinding of gears.
268#
269.if defined(TARGET_ARCH)
270__T=${TARGET_ARCH}
271.else
272__T=${MACHINE_ARCH}
273.endif
274
275# All supported backends for LLVM_TARGET_XXX
276__LLVM_TARGETS= \
277		aarch64 \
278		arm \
279		powerpc \
280		riscv \
281		x86
282__LLVM_TARGET_FILT=	C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/
283.for __llt in ${__LLVM_TARGETS}
284# Default enable the given TARGET's LLVM_TARGET support
285.if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
286__DEFAULT_YES_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
287# aarch64 needs arm for -m32 support.
288.elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
289__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
290# Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
291.else
292__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
293.endif
294.endfor
295
296__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
297
298.include <bsd.compiler.mk>
299
300.if ${__T} == "i386" || ${__T} == "amd64"
301__DEFAULT_NO_OPTIONS+=FDT
302.else
303__DEFAULT_YES_OPTIONS+=FDT
304.endif
305
306.if ${__T:Mriscv64*} == ""
307__DEFAULT_YES_OPTIONS+=LLDB
308.else
309__DEFAULT_NO_OPTIONS+=LLDB
310.endif
311# LIB32 is not supported on all 64-bit architectures.
312.if (${__T:Maarch64*} != "" && ((defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} != "gcc") || (!defined(X_COMPILER_TYPE) && ${COMPILER_TYPE} != "gcc"))) || ${__T} == "amd64" || ${__T} == "powerpc64"
313__DEFAULT_YES_OPTIONS+=LIB32
314.else
315BROKEN_OPTIONS+=LIB32
316.endif
317# EFI doesn't exist on powerpc (well, officially) and doesn't work on i386
318.if ${__T:Mpowerpc*} || ${__T} == "i386"
319BROKEN_OPTIONS+=EFI
320.endif
321# Bad coupling for libsecure stuff with bearssl and efi, so broken on EFI
322.if ${__T:Mpowerpc*}
323BROKEN_OPTIONS+=BEARSSL		# bearssl brings in secure efi stuff xxx
324.endif
325# OFW is only for powerpc, exclude others
326.if ${__T:Mpowerpc*} == ""
327BROKEN_OPTIONS+=LOADER_OFW
328.endif
329# KBOOT is only for powerpc64 (powerpc64le broken) amd64 and aarch64
330.if ${__T} != "powerpc64" && ${__T} != "amd64" && ${__T} != "aarch64"
331BROKEN_OPTIONS+=LOADER_KBOOT
332.endif
333# UBOOT is only for arm, and big-endian powerpc
334.if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
335BROKEN_OPTIONS+=LOADER_UBOOT
336.endif
337# The 32-bit UEFI loader is only for amd64
338.if ${__T} != "amd64"
339BROKEN_OPTIONS+=LOADER_IA32
340.endif
341# GELI and Lua in loader currently cause boot failures on powerpc.
342# Further debugging is required -- probably they are just broken on big
343# endian systems generically (they jump to null pointers or try to read
344# crazy high addresses, which is typical of endianness problems).
345.if ${__T:Mpowerpc*}
346BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
347.endif
348
349# Kernel TLS is enabled by default on amd64, aarch64, powerpc64*, and riscv64*
350.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != ""
351__DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
352.else
353__DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
354.endif
355
356.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
357    ${__T:Mpowerpc64*} == ""
358BROKEN_OPTIONS+=CXGBETOOL
359BROKEN_OPTIONS+=MLX5TOOL
360.endif
361
362.if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64"
363BROKEN_OPTIONS+=HYPERV
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.if ${__T} != "amd64"
385BROKEN_OPTIONS+=BHYVE_SNAPSHOT
386.endif
387
388.-include <site.src.opts.mk>
389
390.include <bsd.mkopt.mk>
391
392#
393# Force some options off if their dependencies are off.
394# Order is somewhat important.
395#
396.if ${MK_SOURCELESS} == "no"
397MK_SOURCELESS_HOST:=	no
398MK_SOURCELESS_UCODE:= no
399.endif
400
401.if ${MK_BLACKLIST} == "no"
402MK_BLOCKLIST:=	no
403.endif
404
405.if ${MK_BLACKLIST_SUPPORT} == "no"
406MK_BLOCKLIST_SUPPORT:=	no
407.endif
408
409.if ${MK_BLOCKLIST} == "no"
410MK_BLACKLIST:=	no
411.endif
412
413.if ${MK_BLOCKLIST_SUPPORT} == "no"
414MK_BLACKLIST_SUPPORT:=	no
415.endif
416
417.if ${MK_CDDL} == "no"
418MK_CTF:=	no
419MK_DTRACE:=	no
420MK_LOADER_ZFS:=	no
421MK_ZFS:=	no
422.endif
423
424.if ${MK_CRYPT} == "no"
425MK_OPENSSL:=	no
426MK_OPENSSH:=	no
427MK_KERBEROS:=	no
428MK_KERBEROS_SUPPORT:=	no
429MK_MITKRB5:=	no
430.endif
431
432# MK_DTRACE also gates ctf tools, so we cannot build userland with CTF
433# if it is off.
434.if ${MK_DTRACE} == "no"
435MK_CTF:=	no
436.endif
437
438.if ${MK_MAIL} == "no"
439MK_MAILWRAPPER:= no
440MK_SENDMAIL:=	no
441MK_DMAGENT:=	no
442.endif
443
444.if ${MK_NETGRAPH} == "no"
445MK_BLUETOOTH:=	no
446.endif
447
448.if ${MK_NLS} == "no"
449MK_NLS_CATALOGS:= no
450.endif
451
452.if ${MK_OPENSSL} == "no"
453MK_DMAGENT:=	no
454MK_OPENSSH:=	no
455MK_OPENSSL_KTLS:=	no
456MK_KERBEROS:=	no
457MK_KERBEROS_SUPPORT:=	no
458MK_MITKRB5:=	no
459MK_LDNS:=	no
460MK_PKGBOOTSTRAP:=	no
461MK_LOADER_ZFS:=	no
462MK_ZFS:=	no
463.endif
464
465.if ${MK_LDNS} == "no"
466MK_LDNS_UTILS:=	no
467MK_UNBOUND:= no
468.endif
469
470.if ${MK_PF} == "no"
471MK_AUTHPF:=	no
472.endif
473
474.if ${MK_OFED} == "no"
475MK_OFED_EXTRA:=	no
476.endif
477
478.if ${MK_TESTS} == "no"
479MK_DTRACE_TESTS:= no
480MK_ZFS_TESTS:= no
481.endif
482
483.if ${MK_ZFS} == "no"
484MK_ZFS_TESTS:=	no
485.endif
486
487.if ${MK_TESTS_SUPPORT} == "no"
488MK_GOOGLETEST:=	no
489.endif
490
491.if ${MK_ZONEINFO} == "no"
492MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
493.endif
494
495.if ${MK_CROSS_COMPILER} == "no"
496MK_CLANG_BOOTSTRAP:= no
497MK_ELFTOOLCHAIN_BOOTSTRAP:= no
498MK_LLD_BOOTSTRAP:= no
499MK_LLVM_BINUTILS_BOOTSTRAP:= no
500.endif
501
502.if ${MK_TOOLCHAIN} == "no"
503MK_CLANG:=	no
504MK_LLD:=	no
505MK_LLDB:=	no
506MK_LLVM_BINUTILS:=	no
507.endif
508
509.if ${MK_CLANG} == "no"
510MK_CLANG_EXTRAS:= no
511MK_CLANG_FORMAT:= no
512MK_CLANG_FULL:= no
513.endif
514
515.if ${MK_ASAN} == "yes"
516# In order to get sensible backtraces from ASAN we have to install
517# llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
518MK_LLVM_BINUTILS:=	yes
519.endif
520
521.if ${MK_LOADER_VERIEXEC} == "no"
522MK_LOADER_VERIEXEC_PASS_MANIFEST := no
523.endif
524
525.if ${MK_CLEAN} == "yes"
526MK_DEPEND_CLEANUP:=	no
527.endif
528
529#
530# MK_* options whose default value depends on another option.
531#
532.for vv in \
533    KERBEROS_SUPPORT/KERBEROS \
534    MAN_UTILS/MAN
535.if defined(WITH_${vv:H})
536MK_${vv:H}:=	yes
537.elif defined(WITHOUT_${vv:H})
538MK_${vv:H}:=	no
539.else
540MK_${vv:H}:=	${MK_${vv:T}}
541.endif
542.endfor
543
544.endif #  !target(__<src.opts.mk>__)
545