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