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