xref: /freebsd/share/mk/src.opts.mk (revision c45018041d5537d2a91c2d63e3982127041d523b)
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    BINUTILS \
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    CPP \
82    CROSS_COMPILER \
83    CRYPT \
84    CUSE \
85    CXX \
86    CXGBETOOL \
87    DIALOG \
88    DICT \
89    DMAGENT \
90    DYNAMICROOT \
91    EE \
92    EFI \
93    ELFTOOLCHAIN_BOOTSTRAP \
94    EXAMPLES \
95    FDT \
96    FILE \
97    FINGER \
98    FLOPPY \
99    FMTREE \
100    FORTH \
101    FP_LIBC \
102    FREEBSD_UPDATE \
103    FTP \
104    GAMES \
105    GDB \
106    GDB_LIBEXEC \
107    GNU_DIFF \
108    GNU_GREP \
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    LIBPTHREAD \
128    LIBTHR \
129    LLVM_COV \
130    LLVM_TARGET_ALL \
131    LOADER_GELI \
132    LOADER_LUA \
133    LOADER_OFW \
134    LOADER_UBOOT \
135    LOCALES \
136    LOCATE \
137    LPR \
138    LS_COLORS \
139    LZMA_SUPPORT \
140    MAIL \
141    MAILWRAPPER \
142    MAKE \
143    MLX5TOOL \
144    NDIS \
145    NETCAT \
146    NETGRAPH \
147    NLS_CATALOGS \
148    NS_CACHING \
149    NTP \
150    NVME \
151    OFED \
152    OPENSSL \
153    PAM \
154    PF \
155    PKGBOOTSTRAP \
156    PMC \
157    PORTSNAP \
158    PPP \
159    QUOTAS \
160    RADIUS_SUPPORT \
161    RBOOTD \
162    RESCUE \
163    ROUTED \
164    SENDMAIL \
165    SERVICESDB \
166    SETUID_LOGIN \
167    SHARED_TOOLCHAIN \
168    SHAREDOCS \
169    SOURCELESS \
170    SOURCELESS_HOST \
171    SOURCELESS_UCODE \
172    STATS \
173    SVNLITE \
174    SYSCONS \
175    SYSTEM_COMPILER \
176    SYSTEM_LINKER \
177    TALK \
178    TCP_WRAPPERS \
179    TCSH \
180    TELNET \
181    TEXTPROC \
182    TFTP \
183    UNBOUND \
184    USB \
185    UTMPX \
186    VI \
187    VT \
188    WIRELESS \
189    WPA_SUPPLICANT_EAPOL \
190    ZFS \
191    LOADER_ZFS \
192    ZONEINFO
193
194__DEFAULT_NO_OPTIONS = \
195    AMD \
196    BEARSSL \
197    BSD_GREP \
198    CLANG_EXTRAS \
199    DTRACE_TESTS \
200    EXPERIMENTAL \
201    GNU_GREP_COMPAT \
202    GPL_DTC \
203    HESIOD \
204    LIBSOFT \
205    LOADER_FIREWIRE \
206    LOADER_FORCE_LE \
207    LOADER_VERBOSE \
208    LOADER_VERIEXEC_PASS_MANIFEST \
209    OFED_EXTRA \
210    OPENLDAP \
211    REPRODUCIBLE_BUILD \
212    RPCBIND_WARMSTART_SUPPORT \
213    SORT_THREADS \
214    SVN \
215    ZONEINFO_LEAPSECONDS_SUPPORT \
216    ZONEINFO_OLD_TIMEZONES_SUPPORT \
217
218# LEFT/RIGHT. Left options which default to "yes" unless their corresponding
219# RIGHT option is disabled.
220__DEFAULT_DEPENDENT_OPTIONS= \
221	CLANG_FULL/CLANG \
222	LOADER_VERIEXEC/BEARSSL \
223	LOADER_EFI_SECUREBOOT/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.if defined(TARGET)
258__TT=${TARGET}
259.else
260__TT=${MACHINE}
261.endif
262
263# All supported backends for LLVM_TARGET_XXX
264__LLVM_TARGETS= \
265		aarch64 \
266		arm \
267		mips \
268		powerpc \
269		riscv \
270		x86
271__LLVM_TARGET_FILT=	C/(amd64|i386)/x86/:S/arm64/aarch64/:S/powerpc64/powerpc/
272.for __llt in ${__LLVM_TARGETS}
273# Default enable the given TARGET's LLVM_TARGET support
274.if ${__TT:${__LLVM_TARGET_FILT}} == ${__llt}
275__DEFAULT_YES_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
276# aarch64 needs arm for -m32 support.
277.elif ${__TT} == "arm64" && ${__llt} == "arm"
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# until we can unwind clang + sparc
285MK_LLVM_TARGET_SPARC:=no
286
287__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF
288
289.include <bsd.compiler.mk>
290# If the compiler is not C++11 capable, disable Clang.  External toolchain will
291# be required.
292
293.if ${COMPILER_FEATURES:Mc++11} && (${__TT} != "mips")
294# Clang is enabled, and will be installed as the default /usr/bin/cc.
295__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD
296.elif ${COMPILER_FEATURES:Mc++11}
297# If an external compiler that supports C++11 is used as ${CC} and Clang
298# supports the target, then Clang is enabled but we still require an external
299# toolchain.
300# default /usr/bin/cc.
301__DEFAULT_YES_OPTIONS+=CLANG LLD
302__DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC
303.else
304# Everything else disables Clang, and uses GCC instead.
305__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD
306.endif
307# In-tree binutils/gcc are older versions without modern architecture support.
308.if ${__T} == "aarch64" || ${__T:Mriscv*} != ""
309BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GDB
310.endif
311.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
312__DEFAULT_YES_OPTIONS+=BINUTILS_BOOTSTRAP
313.else
314__DEFAULT_NO_OPTIONS+=BINUTILS_BOOTSTRAP
315.endif
316.if ${__T:Mriscv*} != ""
317BROKEN_OPTIONS+=OFED
318.endif
319.if ${__TT} != "mips" && ${__T} != "powerpc" && ${__T} != "powerpcspe"
320__DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
321.else
322__DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
323.endif
324.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386"
325__DEFAULT_YES_OPTIONS+=LLDB
326.else
327__DEFAULT_NO_OPTIONS+=LLDB
328.endif
329# LIB32 is supported on amd64, mips64, and powerpc64
330.if (${__T} == "amd64" || ${__T:Mmips64*} || ${__T} == "powerpc64")
331__DEFAULT_YES_OPTIONS+=LIB32
332.else
333BROKEN_OPTIONS+=LIB32
334.endif
335# Only doing soft float API stuff on armv6 and armv7
336.if ${__T} != "armv6" && ${__T} != "armv7"
337BROKEN_OPTIONS+=LIBSOFT
338.endif
339.if ${__T:Mmips*}
340# GOOGLETEST cannot currently be compiled on mips due to external circumstances.
341# Notably, the freebsd-gcc port isn't linking in libgcc so we end up trying ot
342# link to a hidden symbol. LLVM would successfully link this in, but some of
343# the mips variants are broken under LLVM until LLVM 10. GOOGLETEST should be
344# marked no longer broken with the switch to LLVM.
345BROKEN_OPTIONS+=GOOGLETEST SSP
346.endif
347# EFI doesn't exist on mips, powerpc, or riscv.
348.if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Mriscv*}
349BROKEN_OPTIONS+=EFI
350.endif
351# OFW is only for powerpc, exclude others
352.if ${__T:Mpowerpc*} == ""
353BROKEN_OPTIONS+=LOADER_OFW
354.endif
355# UBOOT is only for arm, mips and powerpc, exclude others
356.if ${__T:Marm*} == "" && ${__T:Mmips*} == "" && ${__T:Mpowerpc*} == ""
357BROKEN_OPTIONS+=LOADER_UBOOT
358.endif
359# GELI and Lua in loader currently cause boot failures on powerpc.
360# Further debugging is required -- probably they are just broken on big
361# endian systems generically (they jump to null pointers or try to read
362# crazy high addresses, which is typical of endianness problems).
363.if ${__T:Mpowerpc*}
364BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
365.endif
366
367.if ${__T:Mmips64*}
368# profiling won't work on MIPS64 because there is only assembly for o32
369BROKEN_OPTIONS+=PROFILE
370.endif
371.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
372    ${__T} != "powerpc64"
373BROKEN_OPTIONS+=CXGBETOOL
374BROKEN_OPTIONS+=MLX5TOOL
375.endif
376
377# HyperV is currently x86-only
378.if ${__T} != "amd64" && ${__T} != "i386"
379BROKEN_OPTIONS+=HYPERV
380.endif
381
382# NVME is only aarch64, x86 and powerpc64
383.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
384    ${__T} != "powerpc64"
385BROKEN_OPTIONS+=NVME
386.endif
387
388.if ${COMPILER_FEATURES:Mc++11} && \
389    (${__T} == "amd64" || ${__T} == "i386" || ${__T} == "powerpc64")
390__DEFAULT_YES_OPTIONS+=OPENMP
391.else
392__DEFAULT_NO_OPTIONS+=OPENMP
393.endif
394
395.include <bsd.mkopt.mk>
396
397#
398# MK_* options that default to "yes" if the compiler is a C++11 compiler.
399#
400.for var in \
401    LIBCPLUSPLUS
402.if !defined(MK_${var})
403.if ${COMPILER_FEATURES:Mc++11}
404.if defined(WITHOUT_${var})
405MK_${var}:=	no
406.else
407MK_${var}:=	yes
408.endif
409.else
410.if defined(WITH_${var})
411MK_${var}:=	yes
412.else
413MK_${var}:=	no
414.endif
415.endif
416.endif
417.endfor
418
419#
420# Force some options off if their dependencies are off.
421# Order is somewhat important.
422#
423.if !${COMPILER_FEATURES:Mc++11}
424MK_GOOGLETEST:=	no
425.endif
426
427.if ${MK_CAPSICUM} == "no"
428MK_CASPER:=	no
429.endif
430
431.if ${MK_LIBPTHREAD} == "no"
432MK_LIBTHR:=	no
433.endif
434
435.if ${MK_SOURCELESS} == "no"
436MK_SOURCELESS_HOST:=	no
437MK_SOURCELESS_UCODE:= no
438.endif
439
440.if ${MK_CDDL} == "no"
441MK_ZFS:=	no
442MK_LOADER_ZFS:=	no
443MK_CTF:=	no
444.endif
445
446.if ${MK_CRYPT} == "no"
447MK_OPENSSL:=	no
448MK_OPENSSH:=	no
449MK_KERBEROS:=	no
450MK_KERBEROS_SUPPORT:=	no
451.endif
452
453.if ${MK_CXX} == "no"
454MK_CLANG:=	no
455MK_GOOGLETEST:=	no
456MK_TESTS:=	no
457.endif
458
459.if ${MK_DIALOG} == "no"
460MK_BSDINSTALL:=	no
461.endif
462
463.if ${MK_FILE} == "no"
464MK_SVNLITE:=	no
465.endif
466
467.if ${MK_MAIL} == "no"
468MK_MAILWRAPPER:= no
469MK_SENDMAIL:=	no
470MK_DMAGENT:=	no
471.endif
472
473.if ${MK_NETGRAPH} == "no"
474MK_ATM:=	no
475MK_BLUETOOTH:=	no
476.endif
477
478.if ${MK_NLS} == "no"
479MK_NLS_CATALOGS:= no
480.endif
481
482.if ${MK_OPENSSL} == "no"
483MK_DMAGENT:=	no
484MK_OPENSSH:=	no
485MK_KERBEROS:=	no
486MK_KERBEROS_SUPPORT:=	no
487MK_LDNS:=	no
488.endif
489
490.if ${MK_LDNS} == "no"
491MK_LDNS_UTILS:=	no
492MK_UNBOUND:= no
493.endif
494
495.if ${MK_PF} == "no"
496MK_AUTHPF:=	no
497.endif
498
499.if ${MK_OFED} == "no"
500MK_OFED_EXTRA:=	no
501.endif
502
503.if ${MK_PORTSNAP} == "no"
504# freebsd-update depends on phttpget from portsnap
505MK_FREEBSD_UPDATE:=	no
506.endif
507
508.if ${MK_TESTS} == "no"
509MK_DTRACE_TESTS:= no
510.endif
511
512.if ${MK_TESTS_SUPPORT} == "no"
513MK_GOOGLETEST:=	no
514.endif
515
516.if ${MK_ZONEINFO} == "no"
517MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
518MK_ZONEINFO_OLD_TIMEZONES_SUPPORT:= no
519.endif
520
521.if ${MK_CROSS_COMPILER} == "no"
522MK_BINUTILS_BOOTSTRAP:= no
523MK_CLANG_BOOTSTRAP:= no
524MK_ELFTOOLCHAIN_BOOTSTRAP:= no
525MK_LLD_BOOTSTRAP:= no
526.endif
527
528.if ${MK_TOOLCHAIN} == "no"
529MK_BINUTILS:=	no
530MK_CLANG:=	no
531MK_GDB:=	no
532MK_INCLUDES:=	no
533MK_LLD:=	no
534MK_LLDB:=	no
535.endif
536
537.if ${MK_CLANG} == "no"
538MK_CLANG_EXTRAS:= no
539MK_CLANG_FULL:= no
540MK_LLVM_COV:= no
541.endif
542
543.if ${MK_LOADER_VERIEXEC} == "no"
544MK_LOADER_VERIEXEC_PASS_MANIFEST := no
545.endif
546
547#
548# MK_* options whose default value depends on another option.
549#
550.for vv in \
551    GSSAPI/KERBEROS \
552    MAN_UTILS/MAN
553.if defined(WITH_${vv:H})
554MK_${vv:H}:=	yes
555.elif defined(WITHOUT_${vv:H})
556MK_${vv:H}:=	no
557.else
558MK_${vv:H}:=	${MK_${vv:T}}
559.endif
560.endfor
561
562#
563# Set defaults for the MK_*_SUPPORT variables.
564#
565
566.if !${COMPILER_FEATURES:Mc++11}
567MK_LLDB:=	no
568.endif
569
570.endif #  !target(__<src.opts.mk>__)
571