xref: /freebsd/share/mk/src.opts.mk (revision 243e928310d073338c5ec089f0dce238a80b9866)
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    SYSTEM_COMPILER \
192
193
194#
195# Default behaviour of some options depends on the architecture.  Unfortunately
196# this means that we have to test TARGET_ARCH (the buildworld case) as well
197# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
198# used at all in bsd.*.mk, but we have to make an exception here if we want
199# to allow defaults for some things like clang to vary by target architecture.
200# Additional, per-target behavior should be rarely added only after much
201# gnashing of teeth and grinding of gears.
202#
203.if defined(TARGET_ARCH)
204__T=${TARGET_ARCH}
205.else
206__T=${MACHINE_ARCH}
207.endif
208.if defined(TARGET)
209__TT=${TARGET}
210.else
211__TT=${MACHINE}
212.endif
213
214.include <bsd.compiler.mk>
215# If the compiler is not C++11 capable, disable Clang and use GCC instead.
216# This means that architectures that have GCC 4.2 as default can not
217# build Clang without using an external compiler.
218
219.if ${COMPILER_FEATURES:Mc++11} && (${__T} == "aarch64" || \
220    ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386")
221# Clang is enabled, and will be installed as the default /usr/bin/cc.
222__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
223__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
224.elif ${COMPILER_FEATURES:Mc++11} && ${__T:Mpowerpc*}
225# On powerpc, if an external compiler that supports C++11 is used as ${CC},
226# then Clang is enabled, but GCC is installed as the default /usr/bin/cc.
227__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
228__DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC
229.else
230# Everything else disables Clang, and uses GCC instead.
231__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
232__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
233.endif
234# In-tree binutils/gcc are older versions without modern architecture support.
235.if ${__T} == "aarch64" || ${__T} == "riscv64"
236BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB
237__DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND
238.else
239__DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND
240.endif
241.if ${__T} == "riscv64"
242BROKEN_OPTIONS+=PROFILE # "sorry, unimplemented: profiler support for RISC-V"
243BROKEN_OPTIONS+=TESTS   # "undefined reference to `_Unwind_Resume'"
244BROKEN_OPTIONS+=CXX     # "libcxxrt.so: undefined reference to `_Unwind_Resume_or_Rethrow'"
245.endif
246.if ${__T} == "aarch64" || ${__T} == "amd64"
247__DEFAULT_YES_OPTIONS+=LLDB
248.else
249__DEFAULT_NO_OPTIONS+=LLDB
250.endif
251# LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5
252.if ${__T} == "arm" || ${__T} == "armeb"
253BROKEN_OPTIONS+=LLDB
254.endif
255# Only doing soft float API stuff on armv6
256.if ${__T} != "armv6"
257BROKEN_OPTIONS+=LIBSOFT
258.endif
259
260.include <bsd.mkopt.mk>
261
262#
263# MK_* options that default to "yes" if the compiler is a C++11 compiler.
264#
265.for var in \
266    LIBCPLUSPLUS
267.if !defined(MK_${var})
268.if ${COMPILER_FEATURES:Mc++11}
269.if defined(WITHOUT_${var})
270MK_${var}:=	no
271.else
272MK_${var}:=	yes
273.endif
274.else
275.if defined(WITH_${var})
276MK_${var}:=	yes
277.else
278MK_${var}:=	no
279.endif
280.endif
281.endif
282.endfor
283
284#
285# Force some options off if their dependencies are off.
286# Order is somewhat important.
287#
288.if ${MK_LIBPTHREAD} == "no"
289MK_LIBTHR:=	no
290.endif
291
292.if ${MK_LDNS} == "no"
293MK_LDNS_UTILS:=	no
294MK_UNBOUND:= no
295.endif
296
297.if ${MK_SOURCELESS} == "no"
298MK_SOURCELESS_HOST:=	no
299MK_SOURCELESS_UCODE:= no
300.endif
301
302.if ${MK_CDDL} == "no"
303MK_ZFS:=	no
304MK_CTF:=	no
305.endif
306
307.if ${MK_CRYPT} == "no"
308MK_OPENSSL:=	no
309MK_OPENSSH:=	no
310MK_KERBEROS:=	no
311.endif
312
313.if ${MK_CXX} == "no"
314MK_CLANG:=	no
315MK_GROFF:=	no
316MK_GNUCXX:=	no
317.endif
318
319.if ${MK_MAIL} == "no"
320MK_MAILWRAPPER:= no
321MK_SENDMAIL:=	no
322MK_DMAGENT:=	no
323.endif
324
325.if ${MK_NETGRAPH} == "no"
326MK_ATM:=	no
327MK_BLUETOOTH:=	no
328.endif
329
330.if ${MK_OPENSSL} == "no"
331MK_OPENSSH:=	no
332MK_KERBEROS:=	no
333.endif
334
335.if ${MK_PF} == "no"
336MK_AUTHPF:=	no
337.endif
338
339.if ${MK_TESTS} == "no"
340MK_DTRACE_TESTS:= no
341.endif
342
343.if ${MK_TEXTPROC} == "no"
344MK_GROFF:=	no
345.endif
346
347.if ${MK_CROSS_COMPILER} == "no"
348MK_BINUTILS_BOOTSTRAP:= no
349MK_CLANG_BOOTSTRAP:= no
350MK_ELFTOOLCHAIN_BOOTSTRAP:= no
351MK_GCC_BOOTSTRAP:= no
352.endif
353
354.if ${MK_TOOLCHAIN} == "no"
355MK_BINUTILS:=	no
356MK_CLANG:=	no
357MK_GCC:=	no
358MK_GDB:=	no
359MK_INCLUDES:=	no
360MK_LLDB:=	no
361.endif
362
363.if ${MK_CLANG} == "no"
364MK_CLANG_EXTRAS:= no
365MK_CLANG_FULL:= no
366.endif
367
368#
369# Set defaults for the MK_*_SUPPORT variables.
370#
371
372#
373# MK_*_SUPPORT options which default to "yes" unless their corresponding
374# MK_* variable is set to "no".
375#
376.for var in \
377    BZIP2 \
378    GNU \
379    INET \
380    INET6 \
381    KERBEROS \
382    KVM \
383    NETGRAPH \
384    PAM \
385    TESTS \
386    WIRELESS
387.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
388MK_${var}_SUPPORT:= no
389.else
390MK_${var}_SUPPORT:= yes
391.endif
392.endfor
393
394#
395# MK_* options whose default value depends on another option.
396#
397.for vv in \
398    GSSAPI/KERBEROS \
399    MAN_UTILS/MAN
400.if defined(WITH_${vv:H})
401MK_${vv:H}:=	yes
402.elif defined(WITHOUT_${vv:H})
403MK_${vv:H}:=	no
404.else
405MK_${vv:H}:=	${MK_${vv:T}}
406.endif
407.endfor
408
409.if !${COMPILER_FEATURES:Mc++11}
410MK_LLDB:=	no
411.endif
412
413# gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case.
414# while in theory we could build it with that, we don't want to do
415# that since it creates too much confusion for too little gain.
416.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800
417MK_GNUCXX:=no
418MK_GCC:=no
419.endif
420
421.endif #  !target(__<src.opts.mk>__)
422