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