]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/src.opts.mk
Update mandoc to 1.13.1
[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.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 .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     EXAMPLES \
77     FDT \
78     FLOPPY \
79     FMTREE \
80     FORTH \
81     FP_LIBC \
82     FREEBSD_UPDATE \
83     GAMES \
84     GCOV \
85     GDB \
86     GNU \
87     GNU_GREP_COMPAT \
88     GPIB \
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 # Clang is only for x86, powerpc and little-endian arm right now, by default.
194 .if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
195 __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
196 .elif ${__TT} == "arm" && ${__T:Marm*eb*} == ""
197 __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP
198 # GCC is unable to build the full clang on arm, disable it by default.
199 __DEFAULT_NO_OPTIONS+=CLANG_FULL
200 .else
201 __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
202 .endif
203 # Clang the default system compiler only on little-endian arm and x86.
204 .if ${__T} == "amd64" || (${__TT} == "arm" && ${__T:Marm*eb*} == "") || \
205     ${__T} == "i386"
206 __DEFAULT_YES_OPTIONS+=CLANG_IS_CC
207 __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
208 .else
209 # If clang is not cc, then build gcc by default
210 __DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG CLANG_BOOTSTRAP
211 __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
212 .endif
213
214 .include <bsd.mkopt.mk>
215
216 #
217 # MK_* options that default to "yes" if the compiler is a C++11 compiler.
218 #
219 .include <bsd.compiler.mk>
220 .for var in \
221     LIBCPLUSPLUS
222 .if !defined(MK_${var})
223 .if ${COMPILER_FEATURES:Mc++11}
224 .if defined(WITHOUT_${var})
225 MK_${var}:=     no
226 .else
227 MK_${var}:=     yes
228 .endif
229 .else
230 .if defined(WITH_${var})
231 MK_${var}:=     yes
232 .else
233 MK_${var}:=     no
234 .endif
235 .endif
236 .endif
237 .endfor
238
239 #
240 # Force some options off if their dependencies are off.
241 # Order is somewhat important.
242 #
243 .if ${MK_LIBPTHREAD} == "no"
244 MK_LIBTHR:=     no
245 .endif
246
247 .if ${MK_LDNS} == "no"
248 MK_LDNS_UTILS:= no
249 MK_UNBOUND:= no
250 .endif
251
252 .if ${MK_SOURCELESS} == "no"
253 MK_SOURCELESS_HOST:=    no
254 MK_SOURCELESS_UCODE:= no
255 .endif
256
257 .if ${MK_CDDL} == "no"
258 MK_ZFS:=        no
259 MK_CTF:=        no
260 .endif
261
262 .if ${MK_CRYPT} == "no"
263 MK_OPENSSL:=    no
264 MK_OPENSSH:=    no
265 MK_KERBEROS:=   no
266 .endif
267
268 .if ${MK_CXX} == "no"
269 MK_CLANG:=      no
270 MK_GROFF:=      no
271 MK_GNUCXX:=     no
272 .endif
273
274 .if ${MK_MAIL} == "no"
275 MK_MAILWRAPPER:= no
276 MK_SENDMAIL:=   no
277 MK_DMAGENT:=    no
278 .endif
279
280 .if ${MK_NETGRAPH} == "no"
281 MK_ATM:=        no
282 MK_BLUETOOTH:=  no
283 .endif
284
285 .if ${MK_OPENSSL} == "no"
286 MK_OPENSSH:=    no
287 MK_KERBEROS:=   no
288 .endif
289
290 .if ${MK_PF} == "no"
291 MK_AUTHPF:=     no
292 .endif
293
294 .if ${MK_TEXTPROC} == "no"
295 MK_GROFF:=      no
296 .endif
297
298 .if ${MK_CROSS_COMPILER} == "no"
299 MK_BINUTILS_BOOTSTRAP:= no
300 MK_CLANG_BOOTSTRAP:= no
301 MK_GCC_BOOTSTRAP:= no
302 .endif
303
304 .if ${MK_TOOLCHAIN} == "no"
305 MK_BINUTILS:=   no
306 MK_CLANG:=      no
307 MK_GCC:=        no
308 MK_GDB:=        no
309 MK_INCLUDES:=   no
310 .endif
311
312 .if ${MK_CLANG} == "no"
313 MK_CLANG_EXTRAS:= no
314 MK_CLANG_FULL:= no
315 .endif
316
317 #
318 # Set defaults for the MK_*_SUPPORT variables.
319 #
320
321 #
322 # MK_*_SUPPORT options which default to "yes" unless their corresponding
323 # MK_* variable is set to "no".
324 #
325 .for var in \
326     BZIP2 \
327     GNU \
328     INET \
329     INET6 \
330     KERBEROS \
331     KVM \
332     NETGRAPH \
333     PAM \
334     TESTS \
335     WIRELESS
336 .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
337 MK_${var}_SUPPORT:= no
338 .else
339 MK_${var}_SUPPORT:= yes
340 .endif
341 .endfor
342
343 #
344 # MK_* options whose default value depends on another option.
345 #
346 .for vv in \
347     GSSAPI/KERBEROS \
348     MAN_UTILS/MAN
349 .if defined(WITH_${vv:H})
350 MK_${vv:H}:=    yes
351 .elif defined(WITHOUT_${vv:H})
352 MK_${vv:H}:=    no
353 .else
354 MK_${vv:H}:=    ${MK_${vv:T}}
355 .endif
356 .endfor
357
358 .if !${COMPILER_FEATURES:Mc++11}
359 MK_LLDB:=       no
360 .endif
361
362 # gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case.
363 # while in theory we could build it with that, we don't want to do
364 # that since it creates too much confusion for too little gain.
365 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800
366 MK_GNUCXX:=no
367 MK_GCC:=no
368 .endif
369
370 .endif #  !target(__<src.opts.mk>__)