OLD | NEW |
| (Empty) |
1 # Copyright 2012 the V8 project authors. All rights reserved. | |
2 # Redistribution and use in source and binary forms, with or without | |
3 # modification, are permitted provided that the following conditions are | |
4 # met: | |
5 # | |
6 # * Redistributions of source code must retain the above copyright | |
7 # notice, this list of conditions and the following disclaimer. | |
8 # * Redistributions in binary form must reproduce the above | |
9 # copyright notice, this list of conditions and the following | |
10 # disclaimer in the documentation and/or other materials provided | |
11 # with the distribution. | |
12 # * Neither the name of Google Inc. nor the names of its | |
13 # contributors may be used to endorse or promote products derived | |
14 # from this software without specific prior written permission. | |
15 # | |
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | |
28 # Definitions to be used when building stand-alone V8 binaries. | |
29 | |
30 { | |
31 # We need to include toolchain.gypi here for third-party sources that don't | |
32 # directly include it themselves. | |
33 'includes': ['toolchain.gypi'], | |
34 'variables': { | |
35 'component%': 'static_library', | |
36 'clang_xcode%': 0, | |
37 # Track where uninitialized memory originates from. From fastest to | |
38 # slowest: 0 - no tracking, 1 - track only the initial allocation site, 2 | |
39 # - track the chain of stores leading from allocation site to use site. | |
40 'msan_track_origins%': 2, | |
41 'visibility%': 'hidden', | |
42 'v8_enable_backtrace%': 0, | |
43 'v8_enable_i18n_support%': 1, | |
44 'v8_deprecation_warnings': 1, | |
45 'v8_imminent_deprecation_warnings': 1, | |
46 'msvs_multi_core_compile%': '1', | |
47 'mac_deployment_target%': '10.7', | |
48 'release_extra_cflags%': '', | |
49 'variables': { | |
50 'variables': { | |
51 'variables': { | |
52 'conditions': [ | |
53 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or \ | |
54 OS=="netbsd" or OS=="mac" or OS=="qnx" or OS=="aix"', { | |
55 # This handles the Unix platforms we generally deal with. | |
56 # Anything else gets passed through, which probably won't work | |
57 # very well; such hosts should pass an explicit target_arch | |
58 # to gyp. | |
59 'host_arch%': '<!pymod_do_main(detect_v8_host_arch)', | |
60 }, { | |
61 # OS!="linux" and OS!="freebsd" and OS!="openbsd" and | |
62 # OS!="netbsd" and OS!="mac" and OS!="aix" | |
63 'host_arch%': 'ia32', | |
64 }], | |
65 ], | |
66 }, | |
67 'host_arch%': '<(host_arch)', | |
68 'target_arch%': '<(host_arch)', | |
69 'base_dir%': '<!(cd <(DEPTH) && python -c "import os; print os.getcwd()"
)', | |
70 | |
71 # Instrument for code coverage and use coverage wrapper to exclude some | |
72 # files. Uses gcov if clang=0 is set explicitly. Otherwise, | |
73 # sanitizer_coverage must be set too. | |
74 'coverage%': 0, | |
75 }, | |
76 'base_dir%': '<(base_dir)', | |
77 'host_arch%': '<(host_arch)', | |
78 'target_arch%': '<(target_arch)', | |
79 'v8_target_arch%': '<(target_arch)', | |
80 'coverage%': '<(coverage)', | |
81 'asan%': 0, | |
82 'lsan%': 0, | |
83 'msan%': 0, | |
84 'tsan%': 0, | |
85 # Enable coverage gathering instrumentation in sanitizer tools. This flag | |
86 # also controls coverage granularity (1 for function-level, 2 for | |
87 # block-level, 3 for edge-level). | |
88 'sanitizer_coverage%': 0, | |
89 # Use libc++ (buildtools/third_party/libc++ and | |
90 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard | |
91 # library. This is intended to be used for instrumented builds. | |
92 'use_custom_libcxx%': 0, | |
93 | |
94 'clang_dir%': '<(base_dir)/third_party/llvm-build/Release+Asserts', | |
95 | |
96 'use_lto%': 0, | |
97 | |
98 # Control Flow Integrity for virtual calls and casts. | |
99 # See http://clang.llvm.org/docs/ControlFlowIntegrity.html | |
100 'cfi_vptr%': 0, | |
101 'cfi_diag%': 0, | |
102 | |
103 'cfi_blacklist%': '<(base_dir)/tools/cfi/blacklist.txt', | |
104 | |
105 # Set to 1 to enable fast builds. | |
106 # TODO(machenbach): Only configured for windows. | |
107 'fastbuild%': 0, | |
108 | |
109 # goma settings. | |
110 # 1 to use goma. | |
111 # If no gomadir is set, it uses the default gomadir. | |
112 'use_goma%': 0, | |
113 'gomadir%': '', | |
114 | |
115 # Check if valgrind directories are present. | |
116 'has_valgrind%': '<!pymod_do_main(has_valgrind)', | |
117 | |
118 'test_isolation_mode%': 'noop', | |
119 | |
120 'conditions': [ | |
121 # Set default gomadir. | |
122 ['OS=="win"', { | |
123 'gomadir': 'c:\\goma\\goma-win', | |
124 }, { | |
125 'gomadir': '<!(/bin/echo -n ${HOME}/goma)', | |
126 }], | |
127 ['host_arch!="ppc" and host_arch!="ppc64" and host_arch!="ppc64le" and h
ost_arch!="s390" and host_arch!="s390x"', { | |
128 'host_clang%': 1, | |
129 }, { | |
130 'host_clang%': 0, | |
131 }], | |
132 # linux_use_bundled_gold: whether to use the gold linker binary checked | |
133 # into third_party/binutils. Force this off via GYP_DEFINES when you | |
134 # are using a custom toolchain and need to control -B in ldflags. | |
135 # Do not use 32-bit gold on 32-bit hosts as it runs out address space | |
136 # for component=static_library builds. | |
137 ['(OS=="linux" or OS=="android") and (target_arch=="x64" or target_arch=
="arm" or (target_arch=="ia32" and host_arch=="x64"))', { | |
138 'linux_use_bundled_gold%': 1, | |
139 }, { | |
140 'linux_use_bundled_gold%': 0, | |
141 }], | |
142 ], | |
143 }, | |
144 'base_dir%': '<(base_dir)', | |
145 'clang_dir%': '<(clang_dir)', | |
146 'host_arch%': '<(host_arch)', | |
147 'host_clang%': '<(host_clang)', | |
148 'target_arch%': '<(target_arch)', | |
149 'v8_target_arch%': '<(v8_target_arch)', | |
150 'werror%': '-Werror', | |
151 'use_goma%': '<(use_goma)', | |
152 'gomadir%': '<(gomadir)', | |
153 'asan%': '<(asan)', | |
154 'lsan%': '<(lsan)', | |
155 'msan%': '<(msan)', | |
156 'tsan%': '<(tsan)', | |
157 'sanitizer_coverage%': '<(sanitizer_coverage)', | |
158 'use_custom_libcxx%': '<(use_custom_libcxx)', | |
159 'linux_use_bundled_gold%': '<(linux_use_bundled_gold)', | |
160 'use_lto%': '<(use_lto)', | |
161 'cfi_vptr%': '<(cfi_vptr)', | |
162 'cfi_diag%': '<(cfi_diag)', | |
163 'cfi_blacklist%': '<(cfi_blacklist)', | |
164 'test_isolation_mode%': '<(test_isolation_mode)', | |
165 'fastbuild%': '<(fastbuild)', | |
166 'coverage%': '<(coverage)', | |
167 'has_valgrind%': '<(has_valgrind)', | |
168 | |
169 # Add a simple extras solely for the purpose of the cctests | |
170 'v8_extra_library_files': ['../test/cctest/test-extra.js'], | |
171 'v8_experimental_extra_library_files': ['../test/cctest/test-experimental-ex
tra.js'], | |
172 | |
173 # .gyp files or targets should set v8_code to 1 if they build V8 specific | |
174 # code, as opposed to external code. This variable is used to control such | |
175 # things as the set of warnings to enable, and whether warnings are treated | |
176 # as errors. | |
177 'v8_code%': 0, | |
178 | |
179 # Speeds up Debug builds: | |
180 # 0 - Compiler optimizations off (debuggable) (default). This may | |
181 # be 5x slower than Release (or worse). | |
182 # 1 - Turn on optimizations and disable slow DCHECKs, but leave | |
183 # V8_ENABLE_CHECKS and most other assertions enabled. This may cause | |
184 # some v8 tests to fail in the Debug configuration. This roughly | |
185 # matches the performance of a Release build and can be used by | |
186 # embedders that need to build their own code as debug but don't want | |
187 # or need a debug version of V8. This should produce near-release | |
188 # speeds. | |
189 'v8_optimized_debug%': 0, | |
190 | |
191 # Use external files for startup data blobs: | |
192 # the JS builtins sources and the start snapshot. | |
193 # Embedders that don't use standalone.gypi will need to add | |
194 # their own default value. | |
195 'v8_use_external_startup_data%': 1, | |
196 | |
197 # Relative path to icu.gyp from this file. | |
198 'icu_gyp_path': '../third_party/icu/icu.gyp', | |
199 | |
200 'conditions': [ | |
201 ['(v8_target_arch=="arm" and host_arch!="arm") or \ | |
202 (v8_target_arch=="arm64" and host_arch!="arm64") or \ | |
203 (v8_target_arch=="mipsel" and host_arch!="mipsel") or \ | |
204 (v8_target_arch=="mips64el" and host_arch!="mips64el") or \ | |
205 (v8_target_arch=="x64" and host_arch!="x64") or \ | |
206 (OS=="android" or OS=="qnx")', { | |
207 'want_separate_host_toolset': 1, | |
208 }, { | |
209 'want_separate_host_toolset': 0, | |
210 }], | |
211 ['OS == "win"', { | |
212 'os_posix%': 0, | |
213 }, { | |
214 'os_posix%': 1, | |
215 }], | |
216 ['OS=="win" and use_goma==1', { | |
217 # goma doesn't support pch yet. | |
218 'chromium_win_pch': 0, | |
219 # goma doesn't support PDB yet. | |
220 'fastbuild%': 1, | |
221 }], | |
222 ['((v8_target_arch=="ia32" or v8_target_arch=="x64" or v8_target_arch=="x8
7") and \ | |
223 (OS=="linux" or OS=="mac")) or (v8_target_arch=="ppc64" and OS=="linux")
', { | |
224 'v8_enable_gdbjit%': 1, | |
225 }, { | |
226 'v8_enable_gdbjit%': 0, | |
227 }], | |
228 ['(OS=="linux" or OS=="mac") and (target_arch=="ia32" or target_arch=="x64
") and \ | |
229 (v8_target_arch!="x87" and v8_target_arch!="x32")', { | |
230 'clang%': 1, | |
231 }, { | |
232 'clang%': 0, | |
233 }], | |
234 ['asan==1 or lsan==1 or msan==1 or tsan==1', { | |
235 'clang%': 1, | |
236 'use_allocator%': 'none', | |
237 }], | |
238 ['asan==1 and OS=="linux"', { | |
239 'use_custom_libcxx%': 1, | |
240 }], | |
241 ['tsan==1', { | |
242 'use_custom_libcxx%': 1, | |
243 }], | |
244 ['msan==1', { | |
245 # Use a just-built, MSan-instrumented libc++ instead of the system-wide | |
246 # libstdc++. This is required to avoid false positive reports whenever | |
247 # the C++ standard library is used. | |
248 'use_custom_libcxx%': 1, | |
249 }], | |
250 ['cfi_vptr==1', { | |
251 'use_lto%': 1, | |
252 }], | |
253 ['OS=="android"', { | |
254 # Location of Android NDK. | |
255 'variables': { | |
256 'variables': { | |
257 # The Android toolchain needs to use the absolute path to the NDK | |
258 # because it is used at different levels in the GYP files. | |
259 'android_ndk_root%': '<(base_dir)/third_party/android_tools/ndk/', | |
260 'android_host_arch%': "<!(uname -m | sed -e 's/i[3456]86/x86/')", | |
261 'host_os%': "<!(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')", | |
262 'os_folder_name%': "<!(uname -s | sed -e 's/Linux/linux/;s/Darwin/da
rwin/')", | |
263 }, | |
264 | |
265 # Copy conditionally-set variables out one scope. | |
266 'android_ndk_root%': '<(android_ndk_root)', | |
267 'host_os%': '<(host_os)', | |
268 'os_folder_name%': '<(os_folder_name)', | |
269 | |
270 'conditions': [ | |
271 ['target_arch == "ia32"', { | |
272 'android_toolchain%': '<(android_ndk_root)/toolchains/x86-4.9/preb
uilt/<(os_folder_name)-<(android_host_arch)/bin', | |
273 'android_target_arch%': 'x86', | |
274 'android_target_platform%': '16', | |
275 'arm_version%': 'default', | |
276 }], | |
277 ['target_arch == "x64"', { | |
278 'android_toolchain%': '<(android_ndk_root)/toolchains/x86_64-4.9/p
rebuilt/<(os_folder_name)-<(android_host_arch)/bin', | |
279 'android_target_arch%': 'x86_64', | |
280 'android_target_platform%': '21', | |
281 'arm_version%': 'default', | |
282 }], | |
283 ['target_arch=="arm"', { | |
284 'android_toolchain%': '<(android_ndk_root)/toolchains/arm-linux-an
droideabi-4.9/prebuilt/<(os_folder_name)-<(android_host_arch)/bin', | |
285 'android_target_arch%': 'arm', | |
286 'android_target_platform%': '16', | |
287 'arm_version%': 7, | |
288 }], | |
289 ['target_arch == "arm64"', { | |
290 'android_toolchain%': '<(android_ndk_root)/toolchains/aarch64-linu
x-android-4.9/prebuilt/<(os_folder_name)-<(android_host_arch)/bin', | |
291 'android_target_arch%': 'arm64', | |
292 'android_target_platform%': '21', | |
293 'arm_version%': 'default', | |
294 }], | |
295 ['target_arch == "mipsel"', { | |
296 'android_toolchain%': '<(android_ndk_root)/toolchains/mipsel-linux
-android-4.9/prebuilt/<(os_folder_name)-<(android_host_arch)/bin', | |
297 'android_target_arch%': 'mips', | |
298 'android_target_platform%': '16', | |
299 'arm_version%': 'default', | |
300 }], | |
301 ['target_arch == "mips64el"', { | |
302 'android_toolchain%': '<(android_ndk_root)/toolchains/mips64el-lin
ux-android-4.9/prebuilt/<(os_folder_name)-<(android_host_arch)/bin', | |
303 'android_target_arch%': 'mips64', | |
304 'android_target_platform%': '21', | |
305 'arm_version%': 'default', | |
306 }], | |
307 ], | |
308 }, | |
309 | |
310 # Copy conditionally-set variables out one scope. | |
311 'android_target_arch%': '<(android_target_arch)', | |
312 'android_target_platform%': '<(android_target_platform)', | |
313 'android_toolchain%': '<(android_toolchain)', | |
314 'arm_version%': '<(arm_version)', | |
315 'host_os%': '<(host_os)', | |
316 | |
317 'conditions': [ | |
318 ['android_ndk_root==""', { | |
319 'variables': { | |
320 'android_sysroot': '<(android_toolchain)/sysroot/', | |
321 'android_stl': '<(android_toolchain)/sources/cxx-stl/', | |
322 }, | |
323 'conditions': [ | |
324 ['target_arch=="x64"', { | |
325 'android_lib': '<(android_sysroot)/usr/lib64', | |
326 }, { | |
327 'android_lib': '<(android_sysroot)/usr/lib', | |
328 }], | |
329 ], | |
330 'android_libcpp_include': '<(android_stl)/llvm-libc++/libcxx/include
', | |
331 'android_libcpp_abi_include': '<(android_stl)/llvm-libc++abi/libcxxa
bi/include', | |
332 'android_libcpp_libs': '<(android_stl)/llvm-libc++/libs', | |
333 'android_support_include': '<(android_toolchain)/sources/android/sup
port/include', | |
334 'android_sysroot': '<(android_sysroot)', | |
335 }, { | |
336 'variables': { | |
337 'android_sysroot': '<(android_ndk_root)/platforms/android-<(androi
d_target_platform)/arch-<(android_target_arch)', | |
338 'android_stl': '<(android_ndk_root)/sources/cxx-stl/', | |
339 }, | |
340 'conditions': [ | |
341 ['target_arch=="x64"', { | |
342 'android_lib': '<(android_sysroot)/usr/lib64', | |
343 }, { | |
344 'android_lib': '<(android_sysroot)/usr/lib', | |
345 }], | |
346 ], | |
347 'android_libcpp_include': '<(android_stl)/llvm-libc++/libcxx/include
', | |
348 'android_libcpp_abi_include': '<(android_stl)/llvm-libc++abi/libcxxa
bi/include', | |
349 'android_libcpp_libs': '<(android_stl)/llvm-libc++/libs', | |
350 'android_support_include': '<(android_ndk_root)/sources/android/supp
ort/include', | |
351 'android_sysroot': '<(android_sysroot)', | |
352 }], | |
353 ], | |
354 'android_libcpp_library': 'c++_static', | |
355 }], # OS=="android" | |
356 ['host_clang==1', { | |
357 'conditions':[ | |
358 ['OS=="android"', { | |
359 'host_ld': '<!(which ld)', | |
360 'host_ranlib': '<!(which ranlib)', | |
361 }], | |
362 ], | |
363 'host_cc': '<(clang_dir)/bin/clang', | |
364 'host_cxx': '<(clang_dir)/bin/clang++', | |
365 }, { | |
366 'host_cc': '<!(which gcc)', | |
367 'host_cxx': '<!(which g++)', | |
368 }], | |
369 ], | |
370 # Default ARM variable settings. | |
371 'arm_version%': 'default', | |
372 'arm_fpu%': 'vfpv3', | |
373 'arm_float_abi%': 'default', | |
374 'arm_thumb': 'default', | |
375 | |
376 # Default MIPS variable settings. | |
377 'mips_arch_variant%': 'r2', | |
378 # Possible values fp32, fp64, fpxx. | |
379 # fp32 - 32 32-bit FPU registers are available, doubles are placed in | |
380 # register pairs. | |
381 # fp64 - 32 64-bit FPU registers are available. | |
382 # fpxx - compatibility mode, it chooses fp32 or fp64 depending on runtime | |
383 # detection | |
384 'mips_fpu_mode%': 'fp32', | |
385 | |
386 # Indicates if gcmole tools are downloaded by a hook. | |
387 'gcmole%': 0, | |
388 }, | |
389 'target_defaults': { | |
390 'variables': { | |
391 'v8_code%': '<(v8_code)', | |
392 'clang_warning_flags': [ | |
393 # TODO(thakis): https://crbug.com/604888 | |
394 '-Wno-undefined-var-template', | |
395 ], | |
396 'conditions':[ | |
397 ['OS=="android"', { | |
398 'host_os%': '<(host_os)', | |
399 }], | |
400 ], | |
401 }, | |
402 'includes': [ 'set_clang_warning_flags.gypi', ], | |
403 'default_configuration': 'Debug', | |
404 'configurations': { | |
405 'DebugBaseCommon': { | |
406 'conditions': [ | |
407 ['OS=="aix"', { | |
408 'cflags': [ '-g', '-Og', '-gxcoff' ], | |
409 }, { | |
410 'cflags': [ '-g', '-O0' ], | |
411 }], | |
412 ], | |
413 }, | |
414 'Optdebug': { | |
415 'inherit_from': [ 'DebugBaseCommon', 'DebugBase1' ], | |
416 }, | |
417 'Debug': { | |
418 # Xcode insists on this empty entry. | |
419 }, | |
420 'Release': { | |
421 'cflags+': ['<@(release_extra_cflags)'], | |
422 }, | |
423 'conditions': [ | |
424 ['OS=="win"', { | |
425 'Optdebug_x64': { | |
426 'inherit_from': ['Optdebug'], | |
427 }, | |
428 'Debug_x64': { | |
429 'inherit_from': ['Debug'], | |
430 }, | |
431 'Release_x64': { | |
432 'inherit_from': ['Release'], | |
433 }, | |
434 }], | |
435 ], | |
436 }, | |
437 'conditions':[ | |
438 ['clang==0', { | |
439 'cflags+': ['-Wno-sign-compare',], | |
440 }], | |
441 ['clang==1 or host_clang==1', { | |
442 # This is here so that all files get recompiled after a clang roll and | |
443 # when turning clang on or off. | |
444 # (defines are passed via the command line, and build systems rebuild | |
445 # things when their commandline changes). Nothing should ever read this | |
446 # define. | |
447 'defines': ['CR_CLANG_REVISION=<!(python <(DEPTH)/tools/clang/scripts/up
date.py --print-revision)'], | |
448 'conditions': [ | |
449 ['host_clang==1', { | |
450 'target_conditions': [ | |
451 ['_toolset=="host"', { | |
452 'cflags+': [ | |
453 '-Wno-format-pedantic', | |
454 ], | |
455 }], | |
456 ], | |
457 }], | |
458 ['clang==1', { | |
459 'target_conditions': [ | |
460 ['_toolset=="target"', { | |
461 'cflags+': [ | |
462 '-Wno-format-pedantic', | |
463 ], | |
464 }], | |
465 ], | |
466 }], | |
467 ], | |
468 }], | |
469 ['clang==1 and target_arch=="ia32"', { | |
470 'cflags': ['-mstack-alignment=16', '-mstackrealign'], | |
471 }], | |
472 ['fastbuild!=0', { | |
473 'conditions': [ | |
474 ['OS=="win" and fastbuild==1', { | |
475 'msvs_settings': { | |
476 'VCLinkerTool': { | |
477 # This tells the linker to generate .pdbs, so that | |
478 # we can get meaningful stack traces. | |
479 'GenerateDebugInformation': 'true', | |
480 }, | |
481 'VCCLCompilerTool': { | |
482 # No debug info to be generated by compiler. | |
483 'DebugInformationFormat': '0', | |
484 }, | |
485 }, | |
486 }], | |
487 ], | |
488 }], # fastbuild!=0 | |
489 ], | |
490 'target_conditions': [ | |
491 ['v8_code == 0', { | |
492 'defines!': [ | |
493 'DEBUG', | |
494 ], | |
495 'conditions': [ | |
496 ['os_posix == 1 and OS != "mac"', { | |
497 # We don't want to get warnings from third-party code, | |
498 # so remove any existing warning-enabling flags like -Wall. | |
499 'cflags!': [ | |
500 '-pedantic', | |
501 '-Wall', | |
502 '-Werror', | |
503 '-Wextra', | |
504 '-Wshorten-64-to-32', | |
505 ], | |
506 'cflags+': [ | |
507 # Clang considers the `register` keyword as deprecated, but | |
508 # ICU uses it all over the place. | |
509 '-Wno-deprecated-register', | |
510 # ICU uses its own deprecated functions. | |
511 '-Wno-deprecated-declarations', | |
512 # ICU prefers `a && b || c` over `(a && b) || c`. | |
513 '-Wno-logical-op-parentheses', | |
514 # ICU has some `unsigned < 0` checks. | |
515 '-Wno-tautological-compare', | |
516 # uresdata.c has switch(RES_GET_TYPE(x)) code. The | |
517 # RES_GET_TYPE macro returns an UResType enum, but some switch | |
518 # statement contains case values that aren't part of that | |
519 # enum (e.g. URES_TABLE32 which is in UResInternalType). This | |
520 # is on purpose. | |
521 '-Wno-switch', | |
522 ], | |
523 'cflags_cc!': [ | |
524 '-Wnon-virtual-dtor', | |
525 ], | |
526 }], | |
527 ['OS == "mac"', { | |
528 'xcode_settings': { | |
529 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', # -Werror | |
530 }, | |
531 }], | |
532 ['OS == "win"', { | |
533 'msvs_settings': { | |
534 'VCCLCompilerTool': { | |
535 'WarnAsError': 'false', | |
536 }, | |
537 }, | |
538 }], | |
539 ], | |
540 }], | |
541 ], | |
542 }, | |
543 'conditions': [ | |
544 ['os_posix==1 and OS!="mac"', { | |
545 'target_defaults': { | |
546 'conditions': [ | |
547 # Common options for AddressSanitizer, LeakSanitizer, | |
548 # ThreadSanitizer, MemorySanitizer and CFI builds. | |
549 ['asan==1 or lsan==1 or tsan==1 or msan==1 or cfi_vptr==1', { | |
550 'target_conditions': [ | |
551 ['_toolset=="target"', { | |
552 'cflags': [ | |
553 '-fno-omit-frame-pointer', | |
554 '-gline-tables-only', | |
555 ], | |
556 'cflags!': [ | |
557 '-fomit-frame-pointer', | |
558 ], | |
559 }], | |
560 ], | |
561 }], | |
562 ['asan==1', { | |
563 'target_conditions': [ | |
564 ['_toolset=="target"', { | |
565 'cflags': [ | |
566 '-fsanitize=address', | |
567 ], | |
568 'ldflags': [ | |
569 '-fsanitize=address', | |
570 ], | |
571 'defines': [ | |
572 'ADDRESS_SANITIZER', | |
573 ], | |
574 }], | |
575 ], | |
576 }], | |
577 ['lsan==1', { | |
578 'target_conditions': [ | |
579 ['_toolset=="target"', { | |
580 'cflags': [ | |
581 '-fsanitize=leak', | |
582 ], | |
583 'ldflags': [ | |
584 '-fsanitize=leak', | |
585 ], | |
586 'defines': [ | |
587 'LEAK_SANITIZER', | |
588 ], | |
589 }], | |
590 ], | |
591 }], | |
592 ['tsan==1', { | |
593 'target_conditions': [ | |
594 ['_toolset=="target"', { | |
595 'cflags': [ | |
596 '-fsanitize=thread', | |
597 ], | |
598 'ldflags': [ | |
599 '-fsanitize=thread', | |
600 ], | |
601 'defines': [ | |
602 'THREAD_SANITIZER', | |
603 ], | |
604 }], | |
605 ], | |
606 }], | |
607 ['msan==1', { | |
608 'target_conditions': [ | |
609 ['_toolset=="target"', { | |
610 'cflags': [ | |
611 '-fsanitize=memory', | |
612 '-fsanitize-memory-track-origins=<(msan_track_origins)', | |
613 '-fPIC', | |
614 ], | |
615 'ldflags': [ | |
616 '-fsanitize=memory', | |
617 '-pie', | |
618 ], | |
619 'defines': [ | |
620 'MEMORY_SANITIZER', | |
621 ], | |
622 }], | |
623 ], | |
624 }], | |
625 ['use_custom_libcxx==1', { | |
626 'dependencies': [ | |
627 '<(DEPTH)/buildtools/third_party/libc++/libc++.gyp:libcxx_proxy', | |
628 ], | |
629 }], | |
630 ['sanitizer_coverage!=0', { | |
631 'target_conditions': [ | |
632 ['_toolset=="target"', { | |
633 'cflags': [ | |
634 '-fsanitize-coverage=<(sanitizer_coverage)', | |
635 ], | |
636 'defines': [ | |
637 'SANITIZER_COVERAGE', | |
638 ], | |
639 }], | |
640 ], | |
641 }], | |
642 ['linux_use_bundled_gold==1 and not (clang==0 and use_lto==1)', { | |
643 # Put our binutils, which contains gold in the search path. We pass | |
644 # the path to gold to the compiler. gyp leaves unspecified what the | |
645 # cwd is when running the compiler, so the normal gyp path-munging | |
646 # fails us. This hack gets the right path. | |
647 # | |
648 # Disabled when using GCC LTO because GCC also uses the -B search | |
649 # path at link time to find "as", and our bundled "as" can only | |
650 # target x86. | |
651 'ldflags': [ | |
652 # Note, Chromium allows ia32 host arch as well, we limit this to | |
653 # x64 in v8. | |
654 '-B<(base_dir)/third_party/binutils/Linux_x64/Release/bin', | |
655 ], | |
656 }], | |
657 ], | |
658 }, | |
659 }], | |
660 ['OS=="mac"', { | |
661 'target_defaults': { | |
662 'conditions': [ | |
663 ['asan==1', { | |
664 'xcode_settings': { | |
665 # FIXME(machenbach): This is outdated compared to common.gypi. | |
666 'OTHER_CFLAGS+': [ | |
667 '-fno-omit-frame-pointer', | |
668 '-gline-tables-only', | |
669 '-fsanitize=address', | |
670 '-w', # http://crbug.com/162783 | |
671 ], | |
672 'OTHER_CFLAGS!': [ | |
673 '-fomit-frame-pointer', | |
674 ], | |
675 'defines': [ | |
676 'ADDRESS_SANITIZER', | |
677 ], | |
678 }, | |
679 'dependencies': [ | |
680 '<(DEPTH)/build/mac/asan.gyp:asan_dynamic_runtime', | |
681 ], | |
682 'target_conditions': [ | |
683 ['_type!="static_library"', { | |
684 'xcode_settings': {'OTHER_LDFLAGS': ['-fsanitize=address']}, | |
685 }], | |
686 ], | |
687 }], | |
688 ['sanitizer_coverage!=0', { | |
689 'target_conditions': [ | |
690 ['_toolset=="target"', { | |
691 'cflags': [ | |
692 '-fsanitize-coverage=<(sanitizer_coverage)', | |
693 ], | |
694 'defines': [ | |
695 'SANITIZER_COVERAGE', | |
696 ], | |
697 }], | |
698 ], | |
699 }], | |
700 ], | |
701 }, # target_defaults | |
702 }], # OS=="mac" | |
703 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ | |
704 or OS=="netbsd" or OS=="aix"', { | |
705 'target_defaults': { | |
706 'cflags': [ | |
707 '-Wall', | |
708 '<(werror)', | |
709 '-Wno-unused-parameter', | |
710 '-Wno-long-long', | |
711 '-pthread', | |
712 '-pedantic', | |
713 # Don't warn about the "struct foo f = {0};" initialization pattern. | |
714 '-Wno-missing-field-initializers', | |
715 '-Wno-gnu-zero-variadic-macro-arguments', | |
716 ], | |
717 'cflags_cc': [ | |
718 '-Wnon-virtual-dtor', | |
719 '-fno-exceptions', | |
720 '-fno-rtti', | |
721 '-std=gnu++11', | |
722 ], | |
723 'ldflags': [ '-pthread', ], | |
724 'conditions': [ | |
725 # Don't warn about TRACE_EVENT_* macros with zero arguments passed to | |
726 # ##__VA_ARGS__. C99 strict mode prohibits having zero variadic macro | |
727 # arguments in gcc. | |
728 [ 'clang==0', { | |
729 'cflags!' : [ | |
730 '-pedantic' , | |
731 # Don't warn about unrecognized command line option. | |
732 '-Wno-gnu-zero-variadic-macro-arguments', | |
733 ], | |
734 }], | |
735 [ 'clang==1 and (v8_target_arch=="x64" or v8_target_arch=="arm64" \ | |
736 or v8_target_arch=="mips64el")', { | |
737 'cflags': [ '-Wshorten-64-to-32' ], | |
738 }], | |
739 [ 'host_arch=="ppc64" and OS!="aix"', { | |
740 'cflags': [ '-mminimal-toc' ], | |
741 }], | |
742 [ 'visibility=="hidden" and v8_enable_backtrace==0', { | |
743 'cflags': [ '-fvisibility=hidden' ], | |
744 }], | |
745 [ 'component=="shared_library"', { | |
746 'cflags': [ '-fPIC', ], | |
747 }], | |
748 [ 'clang==0 and coverage==1', { | |
749 'cflags': [ '-fprofile-arcs', '-ftest-coverage'], | |
750 'ldflags': [ '-fprofile-arcs'], | |
751 }], | |
752 ], | |
753 }, | |
754 }], | |
755 # 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" | |
756 # or OS=="netbsd"' | |
757 ['OS=="qnx"', { | |
758 'target_defaults': { | |
759 'cflags': [ | |
760 '-Wall', | |
761 '<(werror)', | |
762 '-Wno-unused-parameter', | |
763 # Don't warn about the "struct foo f = {0};" initialization pattern. | |
764 '-Wno-missing-field-initializers', | |
765 '-Wno-gnu-zero-variadic-macro-arguments', | |
766 ], | |
767 'cflags_cc': [ | |
768 '-Wnon-virtual-dtor', | |
769 '-fno-exceptions', | |
770 '-fno-rtti', | |
771 '-std=gnu++11', | |
772 ], | |
773 'conditions': [ | |
774 [ 'visibility=="hidden"', { | |
775 'cflags': [ '-fvisibility=hidden' ], | |
776 }], | |
777 [ 'component=="shared_library"', { | |
778 'cflags': [ '-fPIC' ], | |
779 }], | |
780 ], | |
781 'target_conditions': [ | |
782 [ '_toolset=="host" and host_os=="linux"', { | |
783 'cflags': [ '-pthread' ], | |
784 'ldflags': [ '-pthread' ], | |
785 'libraries': [ '-lrt' ], | |
786 }], | |
787 [ '_toolset=="target"', { | |
788 'cflags': [ '-Wno-psabi' ], | |
789 'libraries': [ '-lbacktrace', '-lsocket', '-lm' ], | |
790 }], | |
791 ], | |
792 }, | |
793 }], # OS=="qnx" | |
794 ['OS=="win"', { | |
795 'target_defaults': { | |
796 'defines': [ | |
797 '_CRT_SECURE_NO_DEPRECATE', | |
798 '_CRT_NONSTDC_NO_DEPRECATE', | |
799 '_USING_V110_SDK71_', | |
800 ], | |
801 'conditions': [ | |
802 ['component=="static_library"', { | |
803 'defines': [ | |
804 '_HAS_EXCEPTIONS=0', | |
805 ], | |
806 }], | |
807 ], | |
808 'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'], | |
809 'msvs_disabled_warnings': [ | |
810 # C4091: 'typedef ': ignored on left of 'X' when no variable is | |
811 # declared. | |
812 # This happens in a number of Windows headers. Dumb. | |
813 4091, | |
814 | |
815 # C4127: conditional expression is constant | |
816 # This warning can in theory catch dead code and other problems, but | |
817 # triggers in far too many desirable cases where the conditional | |
818 # expression is either set by macros or corresponds some legitimate | |
819 # compile-time constant expression (due to constant template args, | |
820 # conditionals comparing the sizes of different types, etc.). Some of | |
821 # these can be worked around, but it's not worth it. | |
822 4127, | |
823 | |
824 # C4351: new behavior: elements of array 'array' will be default | |
825 # initialized | |
826 # This is a silly "warning" that basically just alerts you that the | |
827 # compiler is going to actually follow the language spec like it's | |
828 # supposed to, instead of not following it like old buggy versions | |
829 # did. There's absolutely no reason to turn this on. | |
830 4351, | |
831 | |
832 # C4355: 'this': used in base member initializer list | |
833 # It's commonly useful to pass |this| to objects in a class' | |
834 # initializer list. While this warning can catch real bugs, most of | |
835 # the time the constructors in question don't attempt to call methods | |
836 # on the passed-in pointer (until later), and annotating every legit | |
837 # usage of this is simply more hassle than the warning is worth. | |
838 4355, | |
839 | |
840 # C4503: 'identifier': decorated name length exceeded, name was | |
841 # truncated | |
842 # This only means that some long error messages might have truncated | |
843 # identifiers in the presence of lots of templates. It has no effect | |
844 # on program correctness and there's no real reason to waste time | |
845 # trying to prevent it. | |
846 4503, | |
847 | |
848 # Warning C4589 says: "Constructor of abstract class ignores | |
849 # initializer for virtual base class." Disable this warning because it | |
850 # is flaky in VS 2015 RTM. It triggers on compiler generated | |
851 # copy-constructors in some cases. | |
852 4589, | |
853 | |
854 # C4611: interaction between 'function' and C++ object destruction is | |
855 # non-portable | |
856 # This warning is unavoidable when using e.g. setjmp/longjmp. MSDN | |
857 # suggests using exceptions instead of setjmp/longjmp for C++, but | |
858 # Chromium code compiles without exception support. We therefore have | |
859 # to use setjmp/longjmp for e.g. JPEG decode error handling, which | |
860 # means we have to turn off this warning (and be careful about how | |
861 # object destruction happens in such cases). | |
862 4611, | |
863 | |
864 # TODO(jochen): These warnings are level 4. They will be slowly | |
865 # removed as code is fixed. | |
866 4100, # Unreferenced formal parameter | |
867 4121, # Alignment of a member was sensitive to packing | |
868 4244, # Conversion from 'type1' to 'type2', possible loss of data | |
869 4302, # Truncation from 'type 1' to 'type 2' | |
870 4309, # Truncation of constant value | |
871 4311, # Pointer truncation from 'type' to 'type' | |
872 4312, # Conversion from 'type1' to 'type2' of greater size | |
873 4505, # Unreferenced local function has been removed | |
874 4510, # Default constructor could not be generated | |
875 4512, # Assignment operator could not be generated | |
876 4610, # Object can never be instantiated | |
877 4800, # Forcing value to bool. | |
878 4838, # Narrowing conversion. Doesn't seem to be very useful. | |
879 4995, # 'X': name was marked as #pragma deprecated | |
880 4996, # 'X': was declared deprecated (for GetVersionEx). | |
881 | |
882 # These are variable shadowing warnings that are new in VS2015. We | |
883 # should work through these at some point -- they may be removed from | |
884 # the RTM release in the /W4 set. | |
885 4456, 4457, 4458, 4459, | |
886 ], | |
887 'msvs_settings': { | |
888 'VCCLCompilerTool': { | |
889 'MinimalRebuild': 'false', | |
890 'BufferSecurityCheck': 'true', | |
891 'EnableFunctionLevelLinking': 'true', | |
892 'RuntimeTypeInfo': 'false', | |
893 'WarningLevel': '3', | |
894 'WarnAsError': 'true', | |
895 'DebugInformationFormat': '3', | |
896 'Detect64BitPortabilityProblems': 'false', | |
897 'conditions': [ | |
898 [ 'msvs_multi_core_compile', { | |
899 'AdditionalOptions': ['/MP'], | |
900 }], | |
901 ['component=="shared_library"', { | |
902 'ExceptionHandling': '1', # /EHsc | |
903 }, { | |
904 'ExceptionHandling': '0', | |
905 }], | |
906 ], | |
907 }, | |
908 'VCLibrarianTool': { | |
909 'AdditionalOptions': ['/ignore:4221'], | |
910 'conditions': [ | |
911 ['v8_target_arch=="x64"', { | |
912 'TargetMachine': '17', # x64 | |
913 }, { | |
914 'TargetMachine': '1', # ia32 | |
915 }], | |
916 ], | |
917 }, | |
918 'VCLinkerTool': { | |
919 'AdditionalDependencies': [ | |
920 'ws2_32.lib', | |
921 ], | |
922 'GenerateDebugInformation': 'true', | |
923 'MapFileName': '$(OutDir)\\$(TargetName).map', | |
924 'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib', | |
925 'FixedBaseAddress': '1', | |
926 # LinkIncremental values: | |
927 # 0 == default | |
928 # 1 == /INCREMENTAL:NO | |
929 # 2 == /INCREMENTAL | |
930 'LinkIncremental': '1', | |
931 # SubSystem values: | |
932 # 0 == not set | |
933 # 1 == /SUBSYSTEM:CONSOLE | |
934 # 2 == /SUBSYSTEM:WINDOWS | |
935 'SubSystem': '1', | |
936 | |
937 'conditions': [ | |
938 ['v8_enable_i18n_support==1', { | |
939 'AdditionalDependencies': [ | |
940 'advapi32.lib', | |
941 ], | |
942 }], | |
943 ['v8_target_arch=="x64"', { | |
944 'MinimumRequiredVersion': '5.02', # Server 2003. | |
945 'TargetMachine': '17', # x64 | |
946 }, { | |
947 'MinimumRequiredVersion': '5.01', # XP. | |
948 'TargetMachine': '1', # ia32 | |
949 }], | |
950 ], | |
951 }, | |
952 'conditions': [ | |
953 ['clang==1', { | |
954 'VCCLCompilerTool': { | |
955 'AdditionalOptions': [ | |
956 # Don't warn about unused function parameters. | |
957 # (This is also used on other platforms.) | |
958 '-Wno-unused-parameter', | |
959 # Don't warn about the "struct foo f = {0};" initialization | |
960 # pattern. | |
961 '-Wno-missing-field-initializers', | |
962 | |
963 # Many files use intrinsics without including this header. | |
964 # TODO(hans): Fix those files, or move this to sub-GYPs. | |
965 '/FIIntrin.h', | |
966 | |
967 # TODO(hans): Make this list shorter eventually, http://crbug.
com/504657 | |
968 '-Qunused-arguments', # http://crbug.com/504658 | |
969 '-Wno-microsoft-enum-value', # http://crbug.com/505296 | |
970 '-Wno-unknown-pragmas', # http://crbug.com/505314 | |
971 '-Wno-microsoft-cast', # http://crbug.com/550065 | |
972 ], | |
973 }, | |
974 }], | |
975 ['clang==1 and MSVS_VERSION == "2013"', { | |
976 'VCCLCompilerTool': { | |
977 'AdditionalOptions': [ | |
978 '-fmsc-version=1800', | |
979 ], | |
980 }, | |
981 }], | |
982 ['clang==1 and MSVS_VERSION == "2015"', { | |
983 'VCCLCompilerTool': { | |
984 'AdditionalOptions': [ | |
985 '-fmsc-version=1900', | |
986 ], | |
987 }, | |
988 }], | |
989 ], | |
990 }, | |
991 }, | |
992 }], # OS=="win" | |
993 ['OS=="mac"', { | |
994 'xcode_settings': { | |
995 'SDKROOT': 'macosx', | |
996 'SYMROOT': '<(DEPTH)/xcodebuild', | |
997 }, | |
998 'target_defaults': { | |
999 'xcode_settings': { | |
1000 'ALWAYS_SEARCH_USER_PATHS': 'NO', | |
1001 'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99 | |
1002 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks | |
1003 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic | |
1004 # (Equivalent to -fPIC) | |
1005 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions | |
1006 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti | |
1007 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings | |
1008 # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden | |
1009 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', | |
1010 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden | |
1011 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics | |
1012 'GCC_WARN_NON_VIRTUAL_DESTRUCTOR': 'YES', # -Wnon-virtual-dtor | |
1013 # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min | |
1014 'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)', | |
1015 'PREBINDING': 'NO', # No -Wl,-prebind | |
1016 'SYMROOT': '<(DEPTH)/xcodebuild', | |
1017 'USE_HEADERMAP': 'NO', | |
1018 'OTHER_CFLAGS': [ | |
1019 '-fno-strict-aliasing', | |
1020 ], | |
1021 'WARNING_CFLAGS': [ | |
1022 '-Wall', | |
1023 '-Wendif-labels', | |
1024 '-Wno-unused-parameter', | |
1025 # Don't warn about the "struct foo f = {0};" initialization pattern. | |
1026 '-Wno-missing-field-initializers', | |
1027 '-Wno-gnu-zero-variadic-macro-arguments', | |
1028 ], | |
1029 }, | |
1030 'conditions': [ | |
1031 ['werror==""', { | |
1032 'xcode_settings': {'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO'}, | |
1033 }, { | |
1034 'xcode_settings': {'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES'}, | |
1035 }], | |
1036 ['clang==1', { | |
1037 'xcode_settings': { | |
1038 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', | |
1039 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', # -std=c++11 | |
1040 }, | |
1041 'conditions': [ | |
1042 ['clang_xcode==0', { | |
1043 'xcode_settings': { | |
1044 'CC': '<(clang_dir)/bin/clang', | |
1045 'LDPLUSPLUS': '<(clang_dir)/bin/clang++', | |
1046 'CLANG_CXX_LIBRARY': 'libc++' | |
1047 }, | |
1048 }], | |
1049 ['v8_target_arch=="x64" or v8_target_arch=="arm64" \ | |
1050 or v8_target_arch=="mips64el"', { | |
1051 'xcode_settings': {'WARNING_CFLAGS': ['-Wshorten-64-to-32']}, | |
1052 }], | |
1053 ], | |
1054 }], | |
1055 ], | |
1056 'target_conditions': [ | |
1057 ['_type!="static_library"', { | |
1058 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']}, | |
1059 }], | |
1060 ], # target_conditions | |
1061 }, # target_defaults | |
1062 }], # OS=="mac" | |
1063 ['OS=="android"', { | |
1064 'target_defaults': { | |
1065 'defines': [ | |
1066 'ANDROID', | |
1067 'V8_ANDROID_LOG_STDOUT', | |
1068 ], | |
1069 'configurations': { | |
1070 'Release': { | |
1071 'cflags': [ | |
1072 '-fomit-frame-pointer', | |
1073 ], | |
1074 }, # Release | |
1075 }, # configurations | |
1076 'cflags': [ '-Wno-abi', '-Wall', '-W', '-Wno-unused-parameter'], | |
1077 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-fno-exceptions', | |
1078 '-std=gnu++11' ], | |
1079 'target_conditions': [ | |
1080 ['_toolset=="target"', { | |
1081 'cflags!': [ | |
1082 '-pthread', # Not supported by Android toolchain. | |
1083 ], | |
1084 'cflags': [ | |
1085 '-ffunction-sections', | |
1086 '-funwind-tables', | |
1087 '-fstack-protector', | |
1088 '-fno-short-enums', | |
1089 '-finline-limit=64', | |
1090 '-Wa,--noexecstack', | |
1091 '--sysroot=<(android_sysroot)', | |
1092 ], | |
1093 'cflags_cc': [ | |
1094 '-isystem<(android_libcpp_include)', | |
1095 '-isystem<(android_libcpp_abi_include)', | |
1096 '-isystem<(android_support_include)', | |
1097 ], | |
1098 'defines': [ | |
1099 'ANDROID', | |
1100 #'__GNU_SOURCE=1', # Necessary for clone() | |
1101 'HAVE_OFF64_T', | |
1102 'HAVE_SYS_UIO_H', | |
1103 'ANDROID_BINSIZE_HACK', # Enable temporary hacks to reduce binsize
. | |
1104 ], | |
1105 'ldflags!': [ | |
1106 '-pthread', # Not supported by Android toolchain. | |
1107 ], | |
1108 'ldflags': [ | |
1109 '-Wl,--no-undefined', | |
1110 '--sysroot=<(android_sysroot)', | |
1111 '-nostdlib', | |
1112 ], | |
1113 'libraries!': [ | |
1114 '-lrt', # librt is built into Bionic. | |
1115 # Not supported by Android toolchain. | |
1116 # Where do these come from? Can't find references in | |
1117 # any Chromium gyp or gypi file. Maybe they come from | |
1118 # gyp itself? | |
1119 '-lpthread', '-lnss3', '-lnssutil3', '-lsmime3', '-lplds4', '-lp
lc4', '-lnspr4', | |
1120 ], | |
1121 'libraries': [ | |
1122 '-l<(android_libcpp_library)', | |
1123 '-latomic', | |
1124 # Manually link the libgcc.a that the cross compiler uses. | |
1125 '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)', | |
1126 '-lc', | |
1127 '-ldl', | |
1128 '-lm', | |
1129 ], | |
1130 'conditions': [ | |
1131 ['target_arch == "arm"', { | |
1132 'ldflags': [ | |
1133 # Enable identical code folding to reduce size. | |
1134 '-Wl,--icf=safe', | |
1135 ], | |
1136 }], | |
1137 ['target_arch=="arm" and arm_version==7', { | |
1138 'cflags': [ | |
1139 '-march=armv7-a', | |
1140 '-mtune=cortex-a8', | |
1141 '-mfpu=vfp3', | |
1142 ], | |
1143 'ldflags': [ | |
1144 '-L<(android_libcpp_libs)/armeabi-v7a', | |
1145 ], | |
1146 }], | |
1147 ['target_arch=="arm" and arm_version < 7', { | |
1148 'ldflags': [ | |
1149 '-L<(android_libcpp_libs)/armeabi', | |
1150 ], | |
1151 }], | |
1152 ['target_arch=="x64"', { | |
1153 'ldflags': [ | |
1154 '-L<(android_libcpp_libs)/x86_64', | |
1155 ], | |
1156 }], | |
1157 ['target_arch=="arm64"', { | |
1158 'ldflags': [ | |
1159 '-L<(android_libcpp_libs)/arm64-v8a', | |
1160 ], | |
1161 }], | |
1162 ['target_arch=="ia32" or target_arch=="x87"', { | |
1163 # The x86 toolchain currently has problems with stack-protector. | |
1164 'cflags!': [ | |
1165 '-fstack-protector', | |
1166 ], | |
1167 'cflags': [ | |
1168 '-fno-stack-protector', | |
1169 ], | |
1170 'ldflags': [ | |
1171 '-L<(android_libcpp_libs)/x86', | |
1172 ], | |
1173 }], | |
1174 ['target_arch=="mipsel"', { | |
1175 # The mips toolchain currently has problems with stack-protector
. | |
1176 'cflags!': [ | |
1177 '-fstack-protector', | |
1178 '-U__linux__' | |
1179 ], | |
1180 'cflags': [ | |
1181 '-fno-stack-protector', | |
1182 ], | |
1183 'ldflags': [ | |
1184 '-L<(android_libcpp_libs)/mips', | |
1185 ], | |
1186 }], | |
1187 ['(target_arch=="arm" or target_arch=="arm64" or target_arch=="x64
" or target_arch=="ia32") and component!="shared_library"', { | |
1188 'cflags': [ | |
1189 '-fPIE', | |
1190 ], | |
1191 'ldflags': [ | |
1192 '-pie', | |
1193 ], | |
1194 }], | |
1195 ], | |
1196 'target_conditions': [ | |
1197 ['_type=="executable"', { | |
1198 'conditions': [ | |
1199 ['target_arch=="arm64" or target_arch=="x64"', { | |
1200 'ldflags': [ | |
1201 '-Wl,-dynamic-linker,/system/bin/linker64', | |
1202 ], | |
1203 }, { | |
1204 'ldflags': [ | |
1205 '-Wl,-dynamic-linker,/system/bin/linker', | |
1206 ], | |
1207 }] | |
1208 ], | |
1209 'ldflags': [ | |
1210 '-Bdynamic', | |
1211 '-Wl,-z,nocopyreloc', | |
1212 # crtbegin_dynamic.o should be the last item in ldflags. | |
1213 '<(android_lib)/crtbegin_dynamic.o', | |
1214 ], | |
1215 'libraries': [ | |
1216 # crtend_android.o needs to be the last item in libraries. | |
1217 # Do not add any libraries after this! | |
1218 '<(android_lib)/crtend_android.o', | |
1219 ], | |
1220 }], | |
1221 ['_type=="shared_library"', { | |
1222 'ldflags': [ | |
1223 '-Wl,-shared,-Bsymbolic', | |
1224 '<(android_lib)/crtbegin_so.o', | |
1225 ], | |
1226 }], | |
1227 ['_type=="static_library"', { | |
1228 'ldflags': [ | |
1229 # Don't export symbols from statically linked libraries. | |
1230 '-Wl,--exclude-libs=ALL', | |
1231 ], | |
1232 }], | |
1233 ], | |
1234 }], # _toolset=="target" | |
1235 # Settings for building host targets using the system toolchain. | |
1236 ['_toolset=="host"', { | |
1237 'cflags': [ '-pthread' ], | |
1238 'ldflags': [ '-pthread' ], | |
1239 'ldflags!': [ | |
1240 '-Wl,-z,noexecstack', | |
1241 '-Wl,--gc-sections', | |
1242 '-Wl,-O1', | |
1243 '-Wl,--as-needed', | |
1244 ], | |
1245 }], | |
1246 ], # target_conditions | |
1247 }, # target_defaults | |
1248 }], # OS=="android" | |
1249 ['OS=="android" and clang==0', { | |
1250 # Hardcode the compiler names in the Makefile so that | |
1251 # it won't depend on the environment at make time. | |
1252 'make_global_settings': [ | |
1253 ['LD', '<!(/bin/echo -n <(android_toolchain)/../*/bin/ld)'], | |
1254 ['RANLIB', '<!(/bin/echo -n <(android_toolchain)/../*/bin/ranlib)'], | |
1255 ['CC', '<!(/bin/echo -n <(android_toolchain)/*-gcc)'], | |
1256 ['CXX', '<!(/bin/echo -n <(android_toolchain)/*-g++)'], | |
1257 ['LD.host', '<(host_ld)'], | |
1258 ['RANLIB.host', '<(host_ranlib)'], | |
1259 ['CC.host', '<(host_cc)'], | |
1260 ['CXX.host', '<(host_cxx)'], | |
1261 ], | |
1262 }], | |
1263 ['clang!=1 and host_clang==1 and target_arch!="ia32" and target_arch!="x64"'
, { | |
1264 'make_global_settings': [ | |
1265 ['CC.host', '<(clang_dir)/bin/clang'], | |
1266 ['CXX.host', '<(clang_dir)/bin/clang++'], | |
1267 ], | |
1268 }], | |
1269 ['clang==0 and host_clang==1 and target_arch!="ia32" and target_arch!="x64"'
, { | |
1270 'target_conditions': [ | |
1271 ['_toolset=="host"', { | |
1272 'cflags_cc': [ '-std=gnu++11', ], | |
1273 }], | |
1274 ], | |
1275 'target_defaults': { | |
1276 'target_conditions': [ | |
1277 ['_toolset=="host"', { 'cflags!': [ '-Wno-unused-local-typedefs' ]}], | |
1278 ], | |
1279 }, | |
1280 }], | |
1281 ['clang==1 and "<(GENERATOR)"=="ninja"', { | |
1282 # See http://crbug.com/110262 | |
1283 'target_defaults': { | |
1284 'cflags': [ '-fcolor-diagnostics' ], | |
1285 'xcode_settings': { 'OTHER_CFLAGS': [ '-fcolor-diagnostics' ] }, | |
1286 }, | |
1287 }], | |
1288 ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) ' | |
1289 'and OS!="win" and "<(GENERATOR)"=="make"', { | |
1290 'make_global_settings': [ | |
1291 ['CC', '<(clang_dir)/bin/clang'], | |
1292 ['CXX', '<(clang_dir)/bin/clang++'], | |
1293 ['CC.host', '$(CC)'], | |
1294 ['CXX.host', '$(CXX)'], | |
1295 ], | |
1296 }], | |
1297 ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) ' | |
1298 'and OS!="win" and "<(GENERATOR)"=="ninja"', { | |
1299 'make_global_settings': [ | |
1300 ['CC', '<(clang_dir)/bin/clang'], | |
1301 ['CXX', '<(clang_dir)/bin/clang++'], | |
1302 ['CC.host', '$(CC)'], | |
1303 ['CXX.host', '$(CXX)'], | |
1304 ], | |
1305 }], | |
1306 ['clang==1 and OS=="win"', { | |
1307 'make_global_settings': [ | |
1308 # On Windows, gyp's ninja generator only looks at CC. | |
1309 ['CC', '<(clang_dir)/bin/clang-cl'], | |
1310 ], | |
1311 }], | |
1312 ['OS=="linux" and target_arch=="arm" and host_arch!="arm" and clang==0 and "
<(GENERATOR)"=="ninja"', { | |
1313 # Set default ARM cross tools on linux. These can be overridden | |
1314 # using CC,CXX,CC.host and CXX.host environment variables. | |
1315 'make_global_settings': [ | |
1316 ['CC', '<!(which arm-linux-gnueabihf-gcc)'], | |
1317 ['CXX', '<!(which arm-linux-gnueabihf-g++)'], | |
1318 ['CC.host', '<(host_cc)'], | |
1319 ['CXX.host', '<(host_cxx)'], | |
1320 ], | |
1321 }], | |
1322 # TODO(yyanagisawa): supports GENERATOR==make | |
1323 # make generator doesn't support CC_wrapper without CC | |
1324 # in make_global_settings yet. | |
1325 ['use_goma==1 and ("<(GENERATOR)"=="ninja" or clang==1)', { | |
1326 'conditions': [ | |
1327 ['coverage==1', { | |
1328 # Wrap goma with coverage wrapper. | |
1329 'make_global_settings': [ | |
1330 ['CC_wrapper', '<(base_dir)/build/coverage_wrapper.py <(gomadir)/gom
acc'], | |
1331 ['CXX_wrapper', '<(base_dir)/build/coverage_wrapper.py <(gomadir)/go
macc'], | |
1332 ['CC.host_wrapper', '<(base_dir)/build/coverage_wrapper.py <(gomadir
)/gomacc'], | |
1333 ['CXX.host_wrapper', '<(base_dir)/build/coverage_wrapper.py <(gomadi
r)/gomacc'], | |
1334 ], | |
1335 }, { | |
1336 # Use only goma wrapper. | |
1337 'make_global_settings': [ | |
1338 ['CC_wrapper', '<(gomadir)/gomacc'], | |
1339 ['CXX_wrapper', '<(gomadir)/gomacc'], | |
1340 ['CC.host_wrapper', '<(gomadir)/gomacc'], | |
1341 ['CXX.host_wrapper', '<(gomadir)/gomacc'], | |
1342 ], | |
1343 }], | |
1344 ], | |
1345 }, { | |
1346 'conditions': [ | |
1347 ['coverage==1', { | |
1348 # Use only coverage wrapper. | |
1349 'make_global_settings': [ | |
1350 ['CC_wrapper', '<(base_dir)/build/coverage_wrapper.py'], | |
1351 ['CXX_wrapper', '<(base_dir)/build/coverage_wrapper.py'], | |
1352 ['CC.host_wrapper', '<(base_dir)/build/coverage_wrapper.py'], | |
1353 ['CXX.host_wrapper', '<(base_dir)/build/coverage_wrapper.py'], | |
1354 ], | |
1355 }], | |
1356 ], | |
1357 }], | |
1358 ['use_lto==1', { | |
1359 'target_defaults': { | |
1360 'target_conditions': [ | |
1361 ['_toolset=="target"', { | |
1362 'cflags': [ | |
1363 '-flto', | |
1364 ], | |
1365 }], | |
1366 ], | |
1367 }, | |
1368 }], | |
1369 ['use_lto==1 and clang==0', { | |
1370 'target_defaults': { | |
1371 'target_conditions': [ | |
1372 ['_toolset=="target"', { | |
1373 'cflags': [ | |
1374 '-ffat-lto-objects', | |
1375 ], | |
1376 }], | |
1377 ], | |
1378 }, | |
1379 }], | |
1380 ['use_lto==1 and clang==1', { | |
1381 'target_defaults': { | |
1382 'target_conditions': [ | |
1383 ['_toolset=="target"', { | |
1384 'arflags': [ | |
1385 '--plugin', '<(clang_dir)/lib/LLVMgold.so', | |
1386 ], | |
1387 # Apply a lower optimization level with lto. Chromium does this | |
1388 # for non-official builds only - a differentiation that doesn't | |
1389 # exist in v8. | |
1390 'ldflags': [ | |
1391 '-Wl,--plugin-opt,O1', | |
1392 ], | |
1393 }], | |
1394 ], | |
1395 }, | |
1396 }], | |
1397 ['use_lto==1 and clang==0', { | |
1398 'target_defaults': { | |
1399 'target_conditions': [ | |
1400 ['_toolset=="target"', { | |
1401 'ldflags': [ | |
1402 '-flto=32', | |
1403 ], | |
1404 }], | |
1405 ], | |
1406 }, | |
1407 }], | |
1408 ['use_lto==1 and clang==1', { | |
1409 'target_defaults': { | |
1410 'target_conditions': [ | |
1411 ['_toolset=="target"', { | |
1412 'ldflags': [ | |
1413 '-flto', | |
1414 ], | |
1415 }], | |
1416 ], | |
1417 }, | |
1418 }], | |
1419 ['cfi_diag==1', { | |
1420 'target_defaults': { | |
1421 'target_conditions': [ | |
1422 ['_toolset=="target"', { | |
1423 'cflags': [ | |
1424 '-fno-sanitize-trap=cfi', | |
1425 '-fno-sanitize-recover=cfi', | |
1426 ], | |
1427 'cflags_cc!': [ | |
1428 '-fno-rtti', | |
1429 ], | |
1430 'cflags!': [ | |
1431 '-fno-rtti', | |
1432 ], | |
1433 'ldflags': [ | |
1434 '-fno-sanitize-trap=cfi', | |
1435 '-fno-sanitize-recover=cfi', | |
1436 ], | |
1437 }], | |
1438 ], | |
1439 }, | |
1440 }], | |
1441 ['cfi_vptr==1', { | |
1442 'target_defaults': { | |
1443 'target_conditions': [ | |
1444 ['_toolset=="target"', { | |
1445 'cflags': [ | |
1446 '-fsanitize=cfi-vcall', | |
1447 '-fsanitize=cfi-derived-cast', | |
1448 '-fsanitize=cfi-unrelated-cast', | |
1449 '-fsanitize-blacklist=<(cfi_blacklist)', | |
1450 ], | |
1451 'ldflags': [ | |
1452 '-fsanitize=cfi-vcall', | |
1453 '-fsanitize=cfi-derived-cast', | |
1454 '-fsanitize=cfi-unrelated-cast', | |
1455 ], | |
1456 }], | |
1457 ], | |
1458 }, | |
1459 }], | |
1460 ], | |
1461 } | |
OLD | NEW |