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