xref: /freebsd/share/mk/src.opts.mk (revision 5ae59dec60e3815b621ae87f74a377cf3449ca55)
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.srcpot.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# Allow user to configure things that only effect src tree builds.
34SRCCONF?=	/etc/src.conf
35.if exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf"
36.include "${SRCCONF}"
37.endif
38
39# Must be included after src.conf
40.include <bsd.own.mk>
41
42#
43# Define MK_* variables (which are either "yes" or "no") for users
44# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
45# make(1) environment.
46# These should be tested with `== "no"' or `!= "no"' in makefiles.
47# The NO_* variables should only be set by makefiles for variables
48# that haven't been converted over.
49#
50
51# These options are used by src the builds
52
53__DEFAULT_YES_OPTIONS = \
54    ACCT \
55    ACPI \
56    AMD \
57    APM \
58    ARM_EABI \
59    AT \
60    ATM \
61    AUDIT \
62    AUTHPF \
63    BINUTILS \
64    BINUTILS_BOOTSTRAP \
65    BLUETOOTH \
66    BOOT \
67    BSD_CPIO \
68    BSNMP \
69    BZIP2 \
70    CALENDAR \
71    CAPSICUM \
72    CASPER \
73    CDDL \
74    CPP \
75    CROSS_COMPILER \
76    CRYPT \
77    CTM \
78    CXX \
79    DICT \
80    DMAGENT \
81    DYNAMICROOT \
82    ED_CRYPTO \
83    EXAMPLES \
84    FDT \
85    FLOPPY \
86    FMTREE \
87    FORTH \
88    FP_LIBC \
89    FREEBSD_UPDATE \
90    GAMES \
91    GCOV \
92    GDB \
93    GNU \
94    GNU_GREP_COMPAT \
95    GPIB \
96    GPIO \
97    GPL_DTC \
98    GROFF \
99    HTML \
100    ICONV \
101    INET \
102    INET6 \
103    IPFILTER \
104    IPFW \
105    JAIL \
106    KDUMP \
107    KVM \
108    LDNS \
109    LDNS_UTILS \
110    LEGACY_CONSOLE \
111    LIB32 \
112    LIBPTHREAD \
113    LIBTHR \
114    LOCALES \
115    LOCATE \
116    LPR \
117    LS_COLORS \
118    LZMA_SUPPORT \
119    MAIL \
120    MAILWRAPPER \
121    MAKE \
122    NCURSESW \
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    TCSH \
153    TELNET \
154    TEXTPROC \
155    UNBOUND \
156    USB \
157    UTMPX \
158    VI \
159    WIRELESS \
160    WPA_SUPPLICANT_EAPOL \
161    ZFS \
162    ZONEINFO
163
164__DEFAULT_NO_OPTIONS = \
165    BSD_GREP \
166    CLANG_EXTRAS \
167    EISA \
168    FMAKE \
169    HESIOD \
170    LLDB \
171    NAND \
172    OFED \
173    OPENLDAP \
174    OPENSSH_NONE_CIPHER \
175    SHARED_TOOLCHAIN \
176    SORT_THREADS \
177    SVN \
178    TESTS \
179    USB_GADGET_EXAMPLES
180
181#
182# Default behaviour of some options depends on the architecture.  Unfortunately
183# this means that we have to test TARGET_ARCH (the buildworld case) as well
184# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
185# used at all in bsd.*.mk, but we have to make an exception here if we want
186# to allow defaults for some things like clang to vary by target architecture.
187# Additional, per-target behavior should be rarely added only after much
188# gnashing of teeth and grinding of gears.
189#
190.if defined(TARGET_ARCH)
191__T=${TARGET_ARCH}
192.else
193__T=${MACHINE_ARCH}
194.endif
195.if defined(TARGET)
196__TT=${TARGET}
197.else
198__TT=${MACHINE}
199.endif
200# Clang is only for x86, powerpc and little-endian arm right now, by default.
201.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
202__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
203.elif ${__T} == "arm" || ${__T} == "armv6" || ${__T} == "armv6hf"
204__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP
205# GCC is unable to build the full clang on arm, disable it by default.
206__DEFAULT_NO_OPTIONS+=CLANG_FULL
207.else
208__DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
209.endif
210# Clang the default system compiler only on little-endian arm and x86.
211.if ${__T} == "amd64" || ${__T} == "arm" || ${__T} == "armv6" || \
212    ${__T} == "armv6hf" || ${__T} == "i386"
213__DEFAULT_YES_OPTIONS+=CLANG_IS_CC
214__DEFAULT_NO_OPTIONS+=GNUCXX
215# The pc98 bootloader requires gcc to build and so we must leave gcc enabled
216# for pc98 for now.
217.if ${__TT} == "pc98"
218__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP
219.else
220__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP
221.endif
222.else
223# If clang is not cc, then build gcc by default
224__DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG CLANG_BOOTSTRAP
225__DEFAULT_YES_OPTIONS+=GCC GNUCXX GCC_BOOTSTRAP
226.endif
227
228.include <bsd.mkopt.mk>
229
230#
231# MK_* options that default to "yes" if the compiler is a C++11 compiler.
232#
233.include <bsd.compiler.mk>
234.for var in \
235    LIBCPLUSPLUS
236.if !defined(MK_${var})
237.if ${COMPILER_FEATURES:Mc++11}
238.if defined(WITHOUT_${var})
239MK_${var}:=	no
240.else
241MK_${var}:=	yes
242.endif
243.else
244.if defined(WITH_${var})
245MK_${var}:=	yes
246.else
247MK_${var}:=	no
248.endif
249.endif
250.endif
251.endfor
252
253#
254# Force some options off if their dependencies are off.
255# Order is somewhat important.
256#
257.if ${MK_LIBPTHREAD} == "no"
258MK_LIBTHR:=	no
259.endif
260
261.if ${MK_LDNS} == "no"
262MK_LDNS_UTILS:=	no
263MK_UNBOUND:= no
264.endif
265
266.if ${MK_SOURCELESS} == "no"
267MK_SOURCELESS_HOST:=	no
268MK_SOURCELESS_UCODE:= no
269.endif
270
271.if ${MK_CDDL} == "no"
272MK_ZFS:=	no
273MK_CTF:=	no
274.endif
275
276.if ${MK_CRYPT} == "no"
277MK_OPENSSL:=	no
278MK_OPENSSH:=	no
279MK_KERBEROS:=	no
280.endif
281
282.if ${MK_CXX} == "no"
283MK_CLANG:=	no
284MK_GROFF:=	no
285.endif
286
287.if ${MK_MAIL} == "no"
288MK_MAILWRAPPER:= no
289MK_SENDMAIL:=	no
290MK_DMAGENT:=	no
291.endif
292
293.if ${MK_NETGRAPH} == "no"
294MK_ATM:=	no
295MK_BLUETOOTH:=	no
296.endif
297
298.if ${MK_OPENSSL} == "no"
299MK_OPENSSH:=	no
300MK_KERBEROS:=	no
301.endif
302
303.if ${MK_PF} == "no"
304MK_AUTHPF:=	no
305.endif
306
307.if ${MK_TEXTPROC} == "no"
308MK_GROFF:=	no
309.endif
310
311.if ${MK_CROSS_COMPILER} == "no"
312MK_BINUTILS_BOOTSTRAP:= no
313MK_CLANG_BOOTSTRAP:= no
314MK_GCC_BOOTSTRAP:= no
315.endif
316
317.if ${MK_TOOLCHAIN} == "no"
318MK_BINUTILS:=	no
319MK_CLANG:=	no
320MK_GCC:=	no
321MK_GDB:=	no
322.endif
323
324.if ${MK_CLANG} == "no"
325MK_CLANG_EXTRAS:= no
326MK_CLANG_FULL:= no
327.endif
328
329#
330# Set defaults for the MK_*_SUPPORT variables.
331#
332
333#
334# MK_*_SUPPORT options which default to "yes" unless their corresponding
335# MK_* variable is set to "no".
336#
337.for var in \
338    BZIP2 \
339    GNU \
340    INET \
341    INET6 \
342    KERBEROS \
343    KVM \
344    NETGRAPH \
345    PAM \
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.endif
374