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