xref: /freebsd/share/mk/src.opts.mk (revision ba3c1f5972d7b90feb6e6da47905ff2757e0fe57)
1# $FreeBSD$
2#
3# Option file for FreeBSD /usr/src builds, at least the userland and boot loader
4# portions of the tree. These options generally chose what parts of the tree to
5# include or omit and are FreeBSD source tree specific.
6#
7# Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf
8# and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no}
9# with sensible (usually) defaults.
10#
11# Makefiles must include bsd.opts.mk after defining specific MK_FOO options that
12# are applicable for that Makefile (typically there are none, but sometimes there
13# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
14# to omit from that make.
15#
16# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO
17# variable.
18#
19# Makefiles may also assume that this file is included by src.opts.mk should it
20# need variables defined there prior to the end of the Makefile where
21# bsd.{subdir,lib.bin}.mk is traditionally included.
22#
23# The old-style YES_FOO and NO_FOO are being phased out. No new instances of them
24# should be added. Old instances should be removed since they were just to
25# bridge the gap between FreeBSD 4 and FreeBSD 5.
26#
27# Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an
28# exception is made for _WITHOUT_SRCONF which turns off this mechanism
29# completely inside bsd.*.mk files).
30#
31
32.if !target(__<src.opts.mk>__)
33__<src.opts.mk>__:
34
35.include <bsd.own.mk>
36
37#
38# Define MK_* variables (which are either "yes" or "no") for users
39# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
40# make(1) environment.
41# These should be tested with `== "no"' or `!= "no"' in makefiles.
42# The NO_* variables should only be set by makefiles for variables
43# that haven't been converted over.
44#
45
46# These options are used by the src builds. Those listed in
47# __DEFAULT_YES_OPTIONS default to 'yes' and will build unless turned
48# off.  __DEFAULT_NO_OPTIONS will default to 'no' and won't build
49# unless turned on. Any options listed in 'BROKEN_OPTIONS' will be
50# hard-wired to 'no'.  "Broken" here means not working or
51# not-appropriate and/or not supported. It doesn't imply something is
52# wrong with the code. There's not a single good word for this, so
53# BROKEN was selected as the least imperfect one considered at the
54# time. Options are added to BROKEN_OPTIONS list on a per-arch basis.
55# At this time, there's no provision for mutually incompatible options.
56# Options listed in 'REQUIRED_OPTIONS' will be hard-wired to 'yes'; this
57# is intended as a transitional measure while options are in the process
58# of being removed.
59
60__DEFAULT_YES_OPTIONS = \
61    ACCT \
62    ACPI \
63    APM \
64    AT \
65    AUDIT \
66    AUTHPF \
67    AUTOFS \
68    BHYVE \
69    BLACKLIST \
70    BLUETOOTH \
71    BOOT \
72    BOOTPARAMD \
73    BOOTPD \
74    BSD_CPIO \
75    BSDINSTALL \
76    BSNMP \
77    BZIP2 \
78    CALENDAR \
79    CAROOT \
80    CCD \
81    CDDL \
82    CLANG \
83    CLANG_BOOTSTRAP \
84    CLEAN \
85    CPP \
86    CROSS_COMPILER \
87    CRYPT \
88    CUSE \
89    CXGBETOOL \
90    DIALOG \
91    DICT \
92    DMAGENT \
93    DTRACE \
94    DYNAMICROOT \
95    EE \
96    EFI \
97    ELFTOOLCHAIN_BOOTSTRAP \
98    EXAMPLES \
99    FILE \
100    FINGER \
101    FLOPPY \
102    FORTH \
103    FP_LIBC \
104    FREEBSD_UPDATE \
105    FTP \
106    GAMES \
107    GH_BC \
108    GNU_DIFF \
109    GOOGLETEST \
110    GPIO \
111    HAST \
112    HTML \
113    HYPERV \
114    ICONV \
115    INET \
116    INET6 \
117    INETD \
118    IPFILTER \
119    IPFW \
120    ISCSI \
121    JAIL \
122    KDUMP \
123    KVM \
124    LDNS \
125    LDNS_UTILS \
126    LEGACY_CONSOLE \
127    LLD \
128    LLD_BOOTSTRAP \
129    LLD_IS_LD \
130    LLVM_ASSERTIONS \
131    LLVM_COV \
132    LLVM_CXXFILT \
133    LOADER_GELI \
134    LOADER_KBOOT \
135    LOADER_LUA \
136    LOADER_OFW \
137    LOADER_UBOOT \
138    LOCALES \
139    LOCATE \
140    LPR \
141    LS_COLORS \
142    MACHDEP_OPTIMIZATIONS \
143    MAIL \
144    MAILWRAPPER \
145    MAKE \
146    MLX5TOOL \
147    NETCAT \
148    NETGRAPH \
149    NETLINK \
150    NETLINK_SUPPORT \
151    NLS_CATALOGS \
152    NS_CACHING \
153    NTP \
154    NVME \
155    OFED \
156    OPENSSL \
157    PAM \
158    PF \
159    PKGBOOTSTRAP \
160    PMC \
161    PPP \
162    PTHREADS_ASSERTIONS \
163    QUOTAS \
164    RADIUS_SUPPORT \
165    RBOOTD \
166    RESCUE \
167    ROUTED \
168    SENDMAIL \
169    SERVICESDB \
170    SETUID_LOGIN \
171    SHAREDOCS \
172    SOURCELESS \
173    SOURCELESS_HOST \
174    SOURCELESS_UCODE \
175    STATS \
176    SYSCONS \
177    SYSTEM_COMPILER \
178    SYSTEM_LINKER \
179    TALK \
180    TCP_WRAPPERS \
181    TCSH \
182    TELNET \
183    TEXTPROC \
184    TFTP \
185    UNBOUND \
186    USB \
187    UTMPX \
188    VI \
189    VT \
190    WIRELESS \
191    WPA_SUPPLICANT_EAPOL \
192    ZFS \
193    LOADER_ZFS \
194    ZONEINFO
195
196__DEFAULT_NO_OPTIONS = \
197    BEARSSL \
198    BHYVE_SNAPSHOT \
199    CLANG_EXTRAS \
200    CLANG_FORMAT \
201    DETECT_TZ_CHANGES \
202    DISK_IMAGE_TOOLS_BOOTSTRAP \
203    DTRACE_ASAN \
204    DTRACE_TESTS \
205    EXPERIMENTAL \
206    HESIOD \
207    LOADER_VERBOSE \
208    LOADER_VERIEXEC_PASS_MANIFEST \
209    LLVM_BINUTILS \
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# MK_*_SUPPORT options which default to "yes" unless their corresponding
233# MK_* variable is set to "no".
234#
235.for var in \
236    BLACKLIST \
237    BZIP2 \
238    INET \
239    INET6 \
240    KERBEROS \
241    KVM \
242    NETGRAPH \
243    PAM \
244    TESTS \
245    WIRELESS
246__DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
247.endfor
248
249#
250# Default behaviour of some options depends on the architecture.  Unfortunately
251# this means that we have to test TARGET_ARCH (the buildworld case) as well
252# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
253# used at all in bsd.*.mk, but we have to make an exception here if we want
254# to allow defaults for some things like clang to vary by target architecture.
255# Additional, per-target behavior should be rarely added only after much
256# gnashing of teeth and grinding of gears.
257#
258.if defined(TARGET_ARCH)
259__T=${TARGET_ARCH}
260.else
261__T=${MACHINE_ARCH}
262.endif
263
264# All supported backends for LLVM_TARGET_XXX
265__LLVM_TARGETS= \
266		aarch64 \
267		arm \
268		powerpc \
269		riscv \
270		x86
271__LLVM_TARGET_FILT=	C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/
272.for __llt in ${__LLVM_TARGETS}
273# Default enable the given TARGET's LLVM_TARGET support
274.if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
275__DEFAULT_YES_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
276# aarch64 needs arm for -m32 support.
277.elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
278__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
279# Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
280.else
281__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
282.endif
283.endfor
284
285__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
286
287.include <bsd.compiler.mk>
288
289.if ${__T} == "i386" || ${__T} == "amd64"
290__DEFAULT_NO_OPTIONS += FDT
291.else
292__DEFAULT_YES_OPTIONS += FDT
293.endif
294
295.if ${__T:Marm*} == "" && ${__T:Mriscv64*} == ""
296__DEFAULT_YES_OPTIONS+=LLDB
297.else
298__DEFAULT_NO_OPTIONS+=LLDB
299.endif
300# LIB32 is not supported on all 64-bit architectures.
301.if (${__T} == "amd64" || ${__T:Maarch64*} != "" || ${__T} == "powerpc64")
302__DEFAULT_YES_OPTIONS+=LIB32
303.else
304BROKEN_OPTIONS+=LIB32
305.endif
306# EFI doesn't exist on powerpc (well, officially) and doesn't work on i386
307.if ${__T:Mpowerpc*} || ${__T} == "i386"
308BROKEN_OPTIONS+=EFI
309.endif
310# OFW is only for powerpc, exclude others
311.if ${__T:Mpowerpc*} == ""
312BROKEN_OPTIONS+=LOADER_OFW
313.endif
314# KBOOT is only for powerpc64 (powerpc64le broken) amd64 and aarch64
315.if ${__T} != "powerpc64" && ${__T} != "amd64" && ${__T} != "aarch64"
316BROKEN_OPTIONS+=LOADER_KBOOT
317.endif
318# UBOOT is only for arm, and big-endian powerpc
319.if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
320BROKEN_OPTIONS+=LOADER_UBOOT
321.endif
322# GELI and Lua in loader currently cause boot failures on powerpc.
323# Further debugging is required -- probably they are just broken on big
324# endian systems generically (they jump to null pointers or try to read
325# crazy high addresses, which is typical of endianness problems).
326.if ${__T:Mpowerpc*}
327BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
328.endif
329
330# Kernel TLS is enabled by default on amd64, aarch64 and powerpc64*
331.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != ""
332__DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
333.else
334__DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
335.endif
336
337.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
338    ${__T:Mpowerpc64*} == ""
339BROKEN_OPTIONS+=CXGBETOOL
340BROKEN_OPTIONS+=MLX5TOOL
341.endif
342
343.if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64"
344BROKEN_OPTIONS+=HYPERV
345.endif
346
347# NVME is only aarch64, x86 and powerpc64*
348.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
349    ${__T:Mpowerpc64*} == ""
350BROKEN_OPTIONS+=NVME
351.endif
352
353.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
354    ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != ""
355__DEFAULT_YES_OPTIONS+=OPENMP
356.else
357__DEFAULT_NO_OPTIONS+=OPENMP
358.endif
359
360# Broken on 32-bit arm, kernel module compile errors
361.if ${__T:Marm*} != ""
362BROKEN_OPTIONS+= OFED
363.endif
364
365# MK_host_egacy is set by local.sys.mk so is valid here
366.if ${MACHINE} == "host" && ${MK_host_egacy} == "yes"
367# we cannot expect tests to work
368BROKEN_OPTIONS+= TESTS
369.endif
370
371.-include <site.src.opts.mk>
372
373.include <bsd.mkopt.mk>
374
375#
376# Force some options off if their dependencies are off.
377# Order is somewhat important.
378#
379.if ${MK_CAPSICUM} == "no"
380MK_CASPER:=	no
381.endif
382
383.if ${MK_SOURCELESS} == "no"
384MK_SOURCELESS_HOST:=	no
385MK_SOURCELESS_UCODE:= no
386.endif
387
388.if ${MK_CDDL} == "no"
389MK_CTF:=	no
390MK_DTRACE:=	no
391MK_LOADER_ZFS:=	no
392MK_ZFS:=	no
393.endif
394
395.if ${MK_CRYPT} == "no"
396MK_OPENSSL:=	no
397MK_OPENSSH:=	no
398MK_KERBEROS:=	no
399MK_KERBEROS_SUPPORT:=	no
400.endif
401
402.if ${MK_DIALOG} == "no"
403MK_BSDINSTALL:=	no
404.endif
405
406.if ${MK_DTRACE} == "no"
407MK_CTF:=	no
408.endif
409
410.if ${MK_MAIL} == "no"
411MK_MAILWRAPPER:= no
412MK_SENDMAIL:=	no
413MK_DMAGENT:=	no
414.endif
415
416.if ${MK_NETGRAPH} == "no"
417MK_BLUETOOTH:=	no
418.endif
419
420.if ${MK_NLS} == "no"
421MK_NLS_CATALOGS:= no
422.endif
423
424.if ${MK_OPENSSL} == "no"
425MK_DMAGENT:=	no
426MK_OPENSSH:=	no
427MK_OPENSSL_KTLS:=	no
428MK_KERBEROS:=	no
429MK_KERBEROS_SUPPORT:=	no
430MK_LDNS:=	no
431MK_PKGBOOTSTRAP:=	no
432MK_LOADER_ZFS:=	no
433MK_ZFS:=	no
434.endif
435
436.if ${MK_LDNS} == "no"
437MK_LDNS_UTILS:=	no
438MK_UNBOUND:= no
439.endif
440
441.if ${MK_PF} == "no"
442MK_AUTHPF:=	no
443.endif
444
445.if ${MK_OFED} == "no"
446MK_OFED_EXTRA:=	no
447.endif
448
449.if ${MK_TESTS} == "no"
450MK_DTRACE_TESTS:= no
451.endif
452
453.if ${MK_TESTS_SUPPORT} == "no"
454MK_GOOGLETEST:=	no
455.endif
456
457.if ${MK_ZONEINFO} == "no"
458MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
459.endif
460
461.if ${MK_CROSS_COMPILER} == "no"
462MK_CLANG_BOOTSTRAP:= no
463MK_ELFTOOLCHAIN_BOOTSTRAP:= no
464MK_LLD_BOOTSTRAP:= no
465.endif
466
467.if ${MK_TOOLCHAIN} == "no"
468MK_CLANG:=	no
469MK_LLD:=	no
470MK_LLDB:=	no
471MK_LLVM_BINUTILS:=	no
472.endif
473
474.if ${MK_CLANG} == "no"
475MK_CLANG_EXTRAS:= no
476MK_CLANG_FORMAT:= no
477MK_CLANG_FULL:= no
478MK_LLVM_COV:= no
479.endif
480
481.if ${MK_ASAN} == "yes"
482# In order to get sensible backtraces from ASAN we have to install
483# llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
484MK_LLVM_BINUTILS:=	yes
485.endif
486
487.if ${MK_LLVM_BINUTILS} == "yes"
488# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be
489# enabled if MK_LLVM_BINUTILS is set.
490MK_LLVM_CXXFILT:=	yes
491.endif
492
493.if ${MK_LOADER_VERIEXEC} == "no"
494MK_LOADER_VERIEXEC_PASS_MANIFEST := no
495.endif
496
497#
498# MK_* options whose default value depends on another option.
499#
500.for vv in \
501    GSSAPI/KERBEROS \
502    MAN_UTILS/MAN
503.if defined(WITH_${vv:H})
504MK_${vv:H}:=	yes
505.elif defined(WITHOUT_${vv:H})
506MK_${vv:H}:=	no
507.else
508MK_${vv:H}:=	${MK_${vv:T}}
509.endif
510.endfor
511
512#
513# Set defaults for the MK_*_SUPPORT variables.
514#
515
516.endif #  !target(__<src.opts.mk>__)
517