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