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