xref: /freebsd/share/mk/src.opts.mk (revision c6063d0da8e1f8d8452b0c2ee1c7ad718c1a7052)
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    BMAKE \
69    BOOT \
70    BSD_CPIO \
71    BSNMP \
72    BZIP2 \
73    CALENDAR \
74    CAPSICUM \
75    CASPER \
76    CDDL \
77    CPP \
78    CROSS_COMPILER \
79    CRYPT \
80    CTM \
81    CXX \
82    DICT \
83    DMAGENT \
84    DYNAMICROOT \
85    ED_CRYPTO \
86    EXAMPLES \
87    FDT \
88    FLOPPY \
89    FMTREE \
90    FORMAT_EXTENSIONS \
91    FORTH \
92    FP_LIBC \
93    FREEBSD_UPDATE \
94    GAMES \
95    GCOV \
96    GDB \
97    GNU \
98    GNU_GREP_COMPAT \
99    GPIB \
100    GPIO \
101    GPL_DTC \
102    GROFF \
103    HTML \
104    ICONV \
105    INET \
106    INET6 \
107    IPFILTER \
108    IPFW \
109    JAIL \
110    KDUMP \
111    KERNEL_SYMBOLS \
112    KVM \
113    LDNS \
114    LDNS_UTILS \
115    LEGACY_CONSOLE \
116    LIB32 \
117    LIBPTHREAD \
118    LIBTHR \
119    LOCALES \
120    LOCATE \
121    LPR \
122    LS_COLORS \
123    LZMA_SUPPORT \
124    MAIL \
125    MAILWRAPPER \
126    MAKE \
127    NCURSESW \
128    NDIS \
129    NETCAT \
130    NETGRAPH \
131    NLS_CATALOGS \
132    NS_CACHING \
133    NTP \
134    OPENSSL \
135    PAM \
136    PC_SYSINSTALL \
137    PF \
138    PKGBOOTSTRAP \
139    PMC \
140    PORTSNAP \
141    PPP \
142    QUOTAS \
143    RCMDS \
144    RCS \
145    RESCUE \
146    ROUTED \
147    SENDMAIL \
148    SETUID_LOGIN \
149    SHAREDOCS \
150    SOURCELESS \
151    SOURCELESS_HOST \
152    SOURCELESS_UCODE \
153    SVNLITE \
154    SYSCALL_COMPAT \
155    SYSCONS \
156    SYSINSTALL \
157    TCSH \
158    TELNET \
159    TEXTPROC \
160    UNBOUND \
161    USB \
162    UTMPX \
163    VI \
164    WIRELESS \
165    WPA_SUPPLICANT_EAPOL \
166    ZFS \
167    ZONEINFO
168
169__DEFAULT_NO_OPTIONS = \
170    BSD_GREP \
171    CLANG_EXTRAS \
172    EISA \
173    HESIOD \
174    LLDB \
175    NAND \
176    OFED \
177    OPENLDAP \
178    OPENSSH_NONE_CIPHER \
179    SHARED_TOOLCHAIN \
180    SORT_THREADS \
181    SVN \
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# Supported NO_* options (if defined, MK_* will be forced to "no",
236# regardless of user's setting).
237#
238# These are transitional and will disappaer in the FreeBSD 12.
239#
240.for var in \
241    CTF \
242    DEBUG_FILES \
243    INSTALLLIB \
244    MAN \
245    PROFILE
246.if defined(NO_${var})
247.warning "NO_${var} is defined, but deprecated. Please use MK_${var}=no instead."
248MK_${var}:=no
249.endif
250.endfor
251
252#
253# MK_* options that default to "yes" if the compiler is a C++11 compiler.
254#
255.include <bsd.compiler.mk>
256.for var in \
257    LIBCPLUSPLUS
258.if !defined(MK_${var})
259.if ${COMPILER_FEATURES:Mc++11}
260.if defined(WITHOUT_${var})
261MK_${var}:=	no
262.else
263MK_${var}:=	yes
264.endif
265.else
266.if defined(WITH_${var})
267MK_${var}:=	yes
268.else
269MK_${var}:=	no
270.endif
271.endif
272.endif
273.endfor
274
275#
276# Force some options off if their dependencies are off.
277# Order is somewhat important.
278#
279.if ${MK_LIBPTHREAD} == "no"
280MK_LIBTHR:=	no
281.endif
282
283.if ${MK_LDNS} == "no"
284MK_LDNS_UTILS:=	no
285MK_UNBOUND:= no
286.endif
287
288.if ${MK_SOURCELESS} == "no"
289MK_SOURCELESS_HOST:=	no
290MK_SOURCELESS_UCODE:= no
291.endif
292
293.if ${MK_CDDL} == "no"
294MK_ZFS:=	no
295MK_CTF:=	no
296.endif
297
298.if ${MK_CRYPT} == "no"
299MK_OPENSSL:=	no
300MK_OPENSSH:=	no
301MK_KERBEROS:=	no
302.endif
303
304.if ${MK_CXX} == "no"
305MK_CLANG:=	no
306MK_GROFF:=	no
307.endif
308
309.if ${MK_MAIL} == "no"
310MK_MAILWRAPPER:= no
311MK_SENDMAIL:=	no
312MK_DMAGENT:=	no
313.endif
314
315.if ${MK_NETGRAPH} == "no"
316MK_ATM:=	no
317MK_BLUETOOTH:=	no
318.endif
319
320.if ${MK_OPENSSL} == "no"
321MK_OPENSSH:=	no
322MK_KERBEROS:=	no
323.endif
324
325.if ${MK_PF} == "no"
326MK_AUTHPF:=	no
327.endif
328
329.if ${MK_TEXTPROC} == "no"
330MK_GROFF:=	no
331.endif
332
333.if ${MK_CROSS_COMPILER} == "no"
334MK_BINUTILS_BOOTSTRAP:= no
335MK_CLANG_BOOTSTRAP:= no
336MK_GCC_BOOTSTRAP:= no
337.endif
338
339.if ${MK_TOOLCHAIN} == "no"
340MK_BINUTILS:=	no
341MK_CLANG:=	no
342MK_GCC:=	no
343MK_GDB:=	no
344.endif
345
346.if ${MK_CLANG} == "no"
347MK_CLANG_EXTRAS:= no
348MK_CLANG_FULL:= no
349.endif
350
351#
352# Set defaults for the MK_*_SUPPORT variables.
353#
354
355#
356# MK_*_SUPPORT options which default to "yes" unless their corresponding
357# MK_* variable is set to "no".
358#
359.for var in \
360    BZIP2 \
361    GNU \
362    INET \
363    INET6 \
364    KERBEROS \
365    KVM \
366    NETGRAPH \
367    PAM \
368    WIRELESS
369.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
370MK_${var}_SUPPORT:= no
371.else
372MK_${var}_SUPPORT:= yes
373.endif
374.endfor
375
376#
377# MK_* options whose default value depends on another option.
378#
379.for vv in \
380    GSSAPI/KERBEROS \
381    MAN_UTILS/MAN
382.if defined(WITH_${vv:H})
383MK_${vv:H}:=	yes
384.elif defined(WITHOUT_${vv:H})
385MK_${vv:H}:=	no
386.else
387MK_${vv:H}:=	${MK_${vv:T}}
388.endif
389.endfor
390
391.if !${COMPILER_FEATURES:Mc++11}
392MK_LLDB:=	no
393.endif
394
395.endif
396