xref: /freebsd/share/mk/src.opts.mk (revision a5ff72cb0e51a7675d4e2b5810a2b6dad5b91960)
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 src the builds
45
46__DEFAULT_YES_OPTIONS = \
47    ACCT \
48    ACPI \
49    AMD \
50    APM \
51    AT \
52    ATM \
53    AUDIT \
54    AUTHPF \
55    AUTOFS \
56    BHYVE \
57    BINUTILS \
58    BINUTILS_BOOTSTRAP \
59    BLUETOOTH \
60    BOOT \
61    BOOTPARAMD \
62    BOOTPD \
63    BSD_CPIO \
64    BSDINSTALL \
65    BSNMP \
66    BZIP2 \
67    CALENDAR \
68    CAPSICUM \
69    CASPER \
70    CCD \
71    CDDL \
72    CPP \
73    CROSS_COMPILER \
74    CRYPT \
75    CTM \
76    CUSE \
77    CXX \
78    DICT \
79    DMAGENT \
80    DYNAMICROOT \
81    ED_CRYPTO \
82    EE \
83    ELFCOPY_AS_OBJCOPY \
84    ELFTOOLCHAIN_BOOTSTRAP \
85    EXAMPLES \
86    FDT \
87    FILE \
88    FINGER \
89    FLOPPY \
90    FMTREE \
91    FORTH \
92    FP_LIBC \
93    FREEBSD_UPDATE \
94    FTP \
95    GAMES \
96    GCOV \
97    GDB \
98    GNU \
99    GNU_GREP_COMPAT \
100    GPIO \
101    GPL_DTC \
102    GROFF \
103    HAST \
104    HTML \
105    HYPERV \
106    ICONV \
107    INET \
108    INET6 \
109    INETD \
110    IPFILTER \
111    IPFW \
112    ISCSI \
113    JAIL \
114    KDUMP \
115    KVM \
116    LDNS \
117    LDNS_UTILS \
118    LEGACY_CONSOLE \
119    LIB32 \
120    LIBPTHREAD \
121    LIBTHR \
122    LOCALES \
123    LOCATE \
124    LPR \
125    LS_COLORS \
126    LZMA_SUPPORT \
127    MAIL \
128    MAILWRAPPER \
129    MAKE \
130    MANDOCDB \
131    NDIS \
132    NETCAT \
133    NETGRAPH \
134    NLS_CATALOGS \
135    NS_CACHING \
136    NTP \
137    OPENSSL \
138    PAM \
139    PC_SYSINSTALL \
140    PF \
141    PKGBOOTSTRAP \
142    PMC \
143    PORTSNAP \
144    PPP \
145    QUOTAS \
146    RADIUS_SUPPORT \
147    RCMDS \
148    RBOOTD \
149    RCS \
150    RESCUE \
151    ROUTED \
152    SENDMAIL \
153    SETUID_LOGIN \
154    SHAREDOCS \
155    SOURCELESS \
156    SOURCELESS_HOST \
157    SOURCELESS_UCODE \
158    SVNLITE \
159    SYSCONS \
160    TALK \
161    TCP_WRAPPERS \
162    TCSH \
163    TELNET \
164    TESTS \
165    TEXTPROC \
166    TFTP \
167    TIMED \
168    UNBOUND \
169    USB \
170    UTMPX \
171    VI \
172    VT \
173    WIRELESS \
174    WPA_SUPPLICANT_EAPOL \
175    ZFS \
176    ZONEINFO
177
178__DEFAULT_NO_OPTIONS = \
179    BSD_GREP \
180    CLANG_EXTRAS \
181    DTRACE_TESTS \
182    EISA \
183    HESIOD \
184    LIBSOFT \
185    NAND \
186    OFED \
187    OPENLDAP \
188    SHARED_TOOLCHAIN \
189    SORT_THREADS \
190    SVN
191
192#
193# Default behaviour of some options depends on the architecture.  Unfortunately
194# this means that we have to test TARGET_ARCH (the buildworld case) as well
195# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
196# used at all in bsd.*.mk, but we have to make an exception here if we want
197# to allow defaults for some things like clang to vary by target architecture.
198# Additional, per-target behavior should be rarely added only after much
199# gnashing of teeth and grinding of gears.
200#
201.if defined(TARGET_ARCH)
202__T=${TARGET_ARCH}
203.else
204__T=${MACHINE_ARCH}
205.endif
206.if defined(TARGET)
207__TT=${TARGET}
208.else
209__TT=${MACHINE}
210.endif
211
212.include <bsd.compiler.mk>
213# If the compiler is not C++11 capable, disable Clang and use GCC instead.
214# This means that architectures that have GCC 4.2 as default can not
215# build Clang without using an external compiler.
216
217.if ${COMPILER_FEATURES:Mc++11} && (${__T} == "aarch64" || \
218    ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386")
219# Clang is enabled, and will be installed as the default /usr/bin/cc.
220__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
221__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
222.elif ${COMPILER_FEATURES:Mc++11} && ${__T:Mpowerpc*}
223# On powerpc, if an external compiler that supports C++11 is used as ${CC},
224# then Clang is enabled, but GCC is installed as the default /usr/bin/cc.
225__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
226__DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC
227.else
228# Everything else disables Clang, and uses GCC instead.
229__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
230__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
231.endif
232# In-tree binutils/gcc are older versions without modern architecture support.
233.if ${__T} == "aarch64" || ${__T} == "riscv64"
234BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB
235__DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND
236.else
237__DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND
238.endif
239.if ${__T} == "riscv64"
240BROKEN_OPTIONS+=PROFILE # "sorry, unimplemented: profiler support for RISC-V"
241BROKEN_OPTIONS+=TESTS   # "undefined reference to `_Unwind_Resume'"
242BROKEN_OPTIONS+=CXX     # "libcxxrt.so: undefined reference to `_Unwind_Resume_or_Rethrow'"
243.endif
244.if ${__T} == "aarch64" || ${__T} == "amd64"
245__DEFAULT_YES_OPTIONS+=LLDB
246.else
247__DEFAULT_NO_OPTIONS+=LLDB
248.endif
249# LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5
250.if ${__T} == "arm" || ${__T} == "armeb"
251BROKEN_OPTIONS+=LLDB
252.endif
253# Only doing soft float API stuff on armv6
254.if ${__T} != "armv6"
255BROKEN_OPTIONS+=LIBSOFT
256.endif
257
258.include <bsd.mkopt.mk>
259
260#
261# MK_* options that default to "yes" if the compiler is a C++11 compiler.
262#
263.for var in \
264    LIBCPLUSPLUS
265.if !defined(MK_${var})
266.if ${COMPILER_FEATURES:Mc++11}
267.if defined(WITHOUT_${var})
268MK_${var}:=	no
269.else
270MK_${var}:=	yes
271.endif
272.else
273.if defined(WITH_${var})
274MK_${var}:=	yes
275.else
276MK_${var}:=	no
277.endif
278.endif
279.endif
280.endfor
281
282#
283# Force some options off if their dependencies are off.
284# Order is somewhat important.
285#
286.if ${MK_LIBPTHREAD} == "no"
287MK_LIBTHR:=	no
288.endif
289
290.if ${MK_LDNS} == "no"
291MK_LDNS_UTILS:=	no
292MK_UNBOUND:= no
293.endif
294
295.if ${MK_SOURCELESS} == "no"
296MK_SOURCELESS_HOST:=	no
297MK_SOURCELESS_UCODE:= no
298.endif
299
300.if ${MK_CDDL} == "no"
301MK_ZFS:=	no
302MK_CTF:=	no
303.endif
304
305.if ${MK_CRYPT} == "no"
306MK_OPENSSL:=	no
307MK_OPENSSH:=	no
308MK_KERBEROS:=	no
309.endif
310
311.if ${MK_CXX} == "no"
312MK_CLANG:=	no
313MK_GROFF:=	no
314MK_GNUCXX:=	no
315.endif
316
317.if ${MK_MAIL} == "no"
318MK_MAILWRAPPER:= no
319MK_SENDMAIL:=	no
320MK_DMAGENT:=	no
321.endif
322
323.if ${MK_NETGRAPH} == "no"
324MK_ATM:=	no
325MK_BLUETOOTH:=	no
326.endif
327
328.if ${MK_OPENSSL} == "no"
329MK_OPENSSH:=	no
330MK_KERBEROS:=	no
331.endif
332
333.if ${MK_PF} == "no"
334MK_AUTHPF:=	no
335.endif
336
337.if ${MK_TESTS} == "no"
338MK_DTRACE_TESTS:= no
339.endif
340
341.if ${MK_TEXTPROC} == "no"
342MK_GROFF:=	no
343.endif
344
345.if ${MK_CROSS_COMPILER} == "no"
346MK_BINUTILS_BOOTSTRAP:= no
347MK_CLANG_BOOTSTRAP:= no
348MK_ELFTOOLCHAIN_BOOTSTRAP:= no
349MK_GCC_BOOTSTRAP:= no
350.endif
351
352.if ${MK_TOOLCHAIN} == "no"
353MK_BINUTILS:=	no
354MK_CLANG:=	no
355MK_GCC:=	no
356MK_GDB:=	no
357MK_INCLUDES:=	no
358MK_LLDB:=	no
359.endif
360
361.if ${MK_CLANG} == "no"
362MK_CLANG_EXTRAS:= no
363MK_CLANG_FULL:= no
364.endif
365
366#
367# Set defaults for the MK_*_SUPPORT variables.
368#
369
370#
371# MK_*_SUPPORT options which default to "yes" unless their corresponding
372# MK_* variable is set to "no".
373#
374.for var in \
375    BZIP2 \
376    GNU \
377    INET \
378    INET6 \
379    KERBEROS \
380    KVM \
381    NETGRAPH \
382    PAM \
383    TESTS \
384    WIRELESS
385.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
386MK_${var}_SUPPORT:= no
387.else
388MK_${var}_SUPPORT:= yes
389.endif
390.endfor
391
392#
393# MK_* options whose default value depends on another option.
394#
395.for vv in \
396    GSSAPI/KERBEROS \
397    MAN_UTILS/MAN
398.if defined(WITH_${vv:H})
399MK_${vv:H}:=	yes
400.elif defined(WITHOUT_${vv:H})
401MK_${vv:H}:=	no
402.else
403MK_${vv:H}:=	${MK_${vv:T}}
404.endif
405.endfor
406
407.if !${COMPILER_FEATURES:Mc++11}
408MK_LLDB:=	no
409.endif
410
411# gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case.
412# while in theory we could build it with that, we don't want to do
413# that since it creates too much confusion for too little gain.
414.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800
415MK_GNUCXX:=no
416MK_GCC:=no
417.endif
418
419.endif #  !target(__<src.opts.mk>__)
420