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