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