src.opts.mk revision 318576
1# $FreeBSD: stable/11/share/mk/src.opts.mk 318576 2017-05-20 16:12:44Z kib $
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    DICT \
80    DMAGENT \
81    DYNAMICROOT \
82    ED_CRYPTO \
83    EE \
84    ELFCOPY_AS_OBJCOPY \
85    EFI \
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    RCS \
152    RESCUE \
153    ROUTED \
154    SENDMAIL \
155    SETUID_LOGIN \
156    SHAREDOCS \
157    SOURCELESS \
158    SOURCELESS_HOST \
159    SOURCELESS_UCODE \
160    SVNLITE \
161    SYSCONS \
162    SYSTEM_COMPILER \
163    TALK \
164    TCP_WRAPPERS \
165    TCSH \
166    TELNET \
167    TESTS \
168    TEXTPROC \
169    TFTP \
170    TIMED \
171    UNBOUND \
172    USB \
173    UTMPX \
174    VI \
175    VT \
176    WIRELESS \
177    WPA_SUPPLICANT_EAPOL \
178    ZFS \
179    ZONEINFO
180
181__DEFAULT_NO_OPTIONS = \
182    BSD_GREP \
183    CLANG_EXTRAS \
184    DTRACE_TESTS \
185    EISA \
186    HESIOD \
187    LIBSOFT \
188    NAND \
189    OFED \
190    OPENLDAP \
191    REPRODUCIBLE_BUILD \
192    SHARED_TOOLCHAIN \
193    SORT_THREADS \
194    SVN \
195
196
197#
198# Default behaviour of some options depends on the architecture.  Unfortunately
199# this means that we have to test TARGET_ARCH (the buildworld case) as well
200# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
201# used at all in bsd.*.mk, but we have to make an exception here if we want
202# to allow defaults for some things like clang to vary by target architecture.
203# Additional, per-target behavior should be rarely added only after much
204# gnashing of teeth and grinding of gears.
205#
206.if defined(TARGET_ARCH)
207__T=${TARGET_ARCH}
208.else
209__T=${MACHINE_ARCH}
210.endif
211.if defined(TARGET)
212__TT=${TARGET}
213.else
214__TT=${MACHINE}
215.endif
216
217.include <bsd.compiler.mk>
218# If the compiler is not C++11 capable, disable Clang and use GCC instead.
219# This means that architectures that have GCC 4.2 as default can not
220# build Clang without using an external compiler.
221
222.if ${COMPILER_FEATURES:Mc++11} && (${__T} == "aarch64" || \
223    ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386")
224# Clang is enabled, and will be installed as the default /usr/bin/cc.
225__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC LLD
226__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
227.elif ${COMPILER_FEATURES:Mc++11} && ${__T} != "riscv64" && ${__T} != "sparc64"
228# If an external compiler that supports C++11 is used as ${CC} and Clang
229# supports the target, then Clang is enabled but GCC is installed as the
230# default /usr/bin/cc.
231__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
232__DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC LLD
233.else
234# Everything else disables Clang, and uses GCC instead.
235__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
236__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC LLD
237.endif
238# In-tree binutils/gcc are older versions without modern architecture support.
239.if ${__T} == "aarch64" || ${__T} == "riscv64"
240BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB
241__DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND
242.else
243__DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND
244.endif
245.if ${__T} == "riscv64"
246BROKEN_OPTIONS+=PROFILE # "sorry, unimplemented: profiler support for RISC-V"
247BROKEN_OPTIONS+=TESTS   # "undefined reference to `_Unwind_Resume'"
248BROKEN_OPTIONS+=CXX     # "libcxxrt.so: undefined reference to `_Unwind_Resume_or_Rethrow'"
249.endif
250.if ${__T} == "aarch64"
251__DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
252.else
253__DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
254.endif
255.if ${__T} == "aarch64" || ${__T} == "amd64"
256__DEFAULT_YES_OPTIONS+=LLDB
257.else
258__DEFAULT_NO_OPTIONS+=LLDB
259.endif
260# LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5
261.if ${__T} == "arm" || ${__T} == "armeb"
262BROKEN_OPTIONS+=LLDB
263.endif
264# Only doing soft float API stuff on armv6
265.if ${__T} != "armv6"
266BROKEN_OPTIONS+=LIBSOFT
267.endif
268.if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || ${__T:Mriscv*}
269BROKEN_OPTIONS+=EFI
270.endif
271
272.include <bsd.mkopt.mk>
273
274#
275# MK_* options that default to "yes" if the compiler is a C++11 compiler.
276#
277.for var in \
278    LIBCPLUSPLUS
279.if !defined(MK_${var})
280.if ${COMPILER_FEATURES:Mc++11}
281.if defined(WITHOUT_${var})
282MK_${var}:=	no
283.else
284MK_${var}:=	yes
285.endif
286.else
287.if defined(WITH_${var})
288MK_${var}:=	yes
289.else
290MK_${var}:=	no
291.endif
292.endif
293.endif
294.endfor
295
296#
297# Force some options off if their dependencies are off.
298# Order is somewhat important.
299#
300.if ${MK_CAPSICUM} == "no"
301MK_CASPER:=	no
302.endif
303
304.if ${MK_LIBPTHREAD} == "no"
305MK_LIBTHR:=	no
306.endif
307
308.if ${MK_LDNS} == "no"
309MK_LDNS_UTILS:=	no
310MK_UNBOUND:= no
311.endif
312
313.if ${MK_SOURCELESS} == "no"
314MK_SOURCELESS_HOST:=	no
315MK_SOURCELESS_UCODE:= no
316.endif
317
318.if ${MK_CDDL} == "no"
319MK_ZFS:=	no
320MK_CTF:=	no
321.endif
322
323.if ${MK_CRYPT} == "no"
324MK_OPENSSL:=	no
325MK_OPENSSH:=	no
326MK_KERBEROS:=	no
327.endif
328
329.if ${MK_CXX} == "no"
330MK_CLANG:=	no
331MK_GROFF:=	no
332MK_GNUCXX:=	no
333.endif
334
335.if ${MK_MAIL} == "no"
336MK_MAILWRAPPER:= no
337MK_SENDMAIL:=	no
338MK_DMAGENT:=	no
339.endif
340
341.if ${MK_NETGRAPH} == "no"
342MK_ATM:=	no
343MK_BLUETOOTH:=	no
344.endif
345
346.if ${MK_OPENSSL} == "no"
347MK_OPENSSH:=	no
348MK_KERBEROS:=	no
349.endif
350
351.if ${MK_PF} == "no"
352MK_AUTHPF:=	no
353.endif
354
355.if ${MK_TESTS} == "no"
356MK_DTRACE_TESTS:= no
357.endif
358
359.if ${MK_TEXTPROC} == "no"
360MK_GROFF:=	no
361.endif
362
363.if ${MK_CROSS_COMPILER} == "no"
364MK_BINUTILS_BOOTSTRAP:= no
365MK_CLANG_BOOTSTRAP:= no
366MK_ELFTOOLCHAIN_BOOTSTRAP:= no
367MK_GCC_BOOTSTRAP:= no
368.endif
369
370.if ${MK_META_MODE} == "yes"
371MK_SYSTEM_COMPILER:= no
372.endif
373
374.if ${MK_TOOLCHAIN} == "no"
375MK_BINUTILS:=	no
376MK_CLANG:=	no
377MK_GCC:=	no
378MK_GDB:=	no
379MK_INCLUDES:=	no
380MK_LLD:=	no
381MK_LLDB:=	no
382.endif
383
384.if ${MK_CLANG} == "no"
385MK_CLANG_EXTRAS:= no
386MK_CLANG_FULL:= no
387.endif
388
389#
390# MK_* options whose default value depends on another option.
391#
392.for vv in \
393    GSSAPI/KERBEROS \
394    MAN_UTILS/MAN
395.if defined(WITH_${vv:H})
396MK_${vv:H}:=	yes
397.elif defined(WITHOUT_${vv:H})
398MK_${vv:H}:=	no
399.else
400MK_${vv:H}:=	${MK_${vv:T}}
401.endif
402.endfor
403
404#
405# Set defaults for the MK_*_SUPPORT variables.
406#
407
408#
409# MK_*_SUPPORT options which default to "yes" unless their corresponding
410# MK_* variable is set to "no".
411#
412.for var in \
413    BLACKLIST \
414    BZIP2 \
415    GNU \
416    INET \
417    INET6 \
418    KERBEROS \
419    KVM \
420    NETGRAPH \
421    PAM \
422    TESTS \
423    WIRELESS
424.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
425MK_${var}_SUPPORT:= no
426.else
427MK_${var}_SUPPORT:= yes
428.endif
429.endfor
430
431.if !${COMPILER_FEATURES:Mc++11}
432MK_LLDB:=	no
433.endif
434
435# gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case.
436# while in theory we could build it with that, we don't want to do
437# that since it creates too much confusion for too little gain.
438# XXX: This is incomplete and needs X_COMPILER_TYPE/VERSION checks too
439#      to prevent Makefile.inc1 from bootstrapping unneeded dependencies
440#      and to support 'make delete-old' when supplying an external toolchain.
441.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800
442MK_GNUCXX:=no
443MK_GCC:=no
444.endif
445
446.endif #  !target(__<src.opts.mk>__)
447