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