1 # Copyright 2013 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
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.
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.
28 # Shared definitions for all V8-related targets.
32 'msvs_use_common_release': 0,
33 'gcc_version%': 'unknown',
34 'CXX%': '${CXX:-$(which g++)}', # Used to assemble a shell command.
35 'v8_target_arch%': '<(target_arch)',
36 # Native Client builds currently use the V8 ARM JIT and
37 # arm/simulator-arm.cc to defer the significant effort required
38 # for NaCl JIT support. The nacl_target_arch variable provides
39 # the 'true' target arch for places in this file that need it.
40 # TODO(bradchen): get rid of nacl_target_arch when someday
41 # NaCl V8 builds stop using the ARM simulator
42 'nacl_target_arch%': 'none', # must be set externally
44 # Setting 'v8_can_use_vfp32dregs' to 'true' will cause V8 to use the VFP
45 # registers d16-d31 in the generated code, both in the snapshot and for the
46 # ARM target. Leaving the default value of 'false' will avoid the use of
47 # these registers in the snapshot and use CPU feature probing when running
49 'v8_can_use_vfp32dregs%': 'false',
52 # Similar to vfp but on MIPS.
53 'v8_can_use_fpu_instructions%': 'true',
55 # Similar to the ARM hard float ABI but on MIPS.
56 'v8_use_mips_abi_hardfloat%': 'true',
58 # Default arch variant for MIPS.
59 'mips_arch_variant%': 'mips32r2',
61 'v8_enable_backtrace%': 0,
63 # Enable profiling support. Only required on Windows.
66 # Some versions of GCC 4.5 seem to need -fno-strict-aliasing.
67 'v8_no_strict_aliasing%': 0,
69 # Chrome needs this definition unconditionally. For standalone V8 builds,
70 # it's handled in build/standalone.gypi.
71 'want_separate_host_toolset%': 1,
73 # Toolset the d8 binary should be compiled for. Possible values are 'host'
74 # and 'target'. If you want to run v8 tests, it needs to be set to 'target'.
75 # The setting is ignored if want_separate_host_toolset is 0.
76 'v8_toolset_for_d8%': 'target',
80 # For a shared library build, results in "libv8-<(soname_version).so".
81 'soname_version%': '',
83 # Allow to suppress the array bounds warning (default is no suppression).
84 'wno_array_bounds%': '',
88 ['v8_target_arch=="arm"', {
92 'target_conditions': [
93 ['_toolset=="host"', {
95 'armcompiler': '<!($(echo ${CXX_host:-$(which g++)}) -v 2>&1 | grep -q "^Target: arm" && echo "yes" || echo "no")',
98 ['armcompiler=="yes"', {
100 [ 'arm_version==7', {
101 'cflags': ['-march=armv7-a',],
103 [ 'arm_version==7 or arm_version=="default"', {
106 'cflags': ['-mfpu=neon',],
110 [ 'arm_fpu!="default"', {
111 'cflags': ['-mfpu=<(arm_fpu)',],
117 [ 'arm_float_abi!="default"', {
118 'cflags': ['-mfloat-abi=<(arm_float_abi)',],
121 'cflags': ['-mthumb',],
124 'cflags': ['-marm',],
126 [ 'arm_test=="on"', {
135 [ 'arm_version==7 or arm_version=="default"', {
137 'CAN_USE_ARMV7_INSTRUCTIONS=1',
140 [ 'arm_fpu=="default"', {
142 'CAN_USE_VFP3_INSTRUCTIONS',
145 [ 'arm_fpu=="vfpv3-d16"', {
147 'CAN_USE_VFP3_INSTRUCTIONS',
150 [ 'arm_fpu=="vfpv3"', {
152 'CAN_USE_VFP3_INSTRUCTIONS',
153 'CAN_USE_VFP32DREGS',
156 [ 'arm_fpu=="neon" or arm_neon==1', {
158 'CAN_USE_VFP3_INSTRUCTIONS',
159 'CAN_USE_VFP32DREGS',
164 [ 'arm_float_abi=="hard"', {
166 'USE_EABI_HARDFLOAT=1',
169 [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
171 'USE_EABI_HARDFLOAT=0',
180 }], # _toolset=="host"
181 ['_toolset=="target"', {
183 'armcompiler': '<!($(echo ${CXX_target:-<(CXX)}) -v 2>&1 | grep -q "^Target: arm" && echo "yes" || echo "no")',
186 ['armcompiler=="yes"', {
188 [ 'arm_version==7', {
189 'cflags': ['-march=armv7-a',],
191 [ 'arm_version==7 or arm_version=="default"', {
194 'cflags': ['-mfpu=neon',],
198 [ 'arm_fpu!="default"', {
199 'cflags': ['-mfpu=<(arm_fpu)',],
205 [ 'arm_float_abi!="default"', {
206 'cflags': ['-mfloat-abi=<(arm_float_abi)',],
209 'cflags': ['-mthumb',],
212 'cflags': ['-marm',],
214 [ 'arm_test=="on"', {
223 [ 'arm_version==7 or arm_version=="default"', {
225 'CAN_USE_ARMV7_INSTRUCTIONS=1',
228 [ 'arm_fpu=="default"', {
230 'CAN_USE_VFP3_INSTRUCTIONS',
233 [ 'arm_fpu=="vfpv3-d16"', {
235 'CAN_USE_VFP3_INSTRUCTIONS',
238 [ 'arm_fpu=="vfpv3"', {
240 'CAN_USE_VFP3_INSTRUCTIONS',
241 'CAN_USE_VFP32DREGS',
244 [ 'arm_fpu=="neon" or arm_neon==1', {
246 'CAN_USE_VFP3_INSTRUCTIONS',
247 'CAN_USE_VFP32DREGS',
252 [ 'arm_float_abi=="hard"', {
254 'USE_EABI_HARDFLOAT=1',
257 [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
259 'USE_EABI_HARDFLOAT=0',
268 }], # _toolset=="target"
270 }], # v8_target_arch=="arm"
271 ['v8_target_arch=="arm64"', {
273 'V8_TARGET_ARCH_ARM64',
276 ['v8_target_arch=="ia32"', {
278 'V8_TARGET_ARCH_IA32',
280 }], # v8_target_arch=="ia32"
281 ['v8_target_arch=="mips"', {
283 'V8_TARGET_ARCH_MIPS',
286 'mipscompiler': '<!($(echo <(CXX)) -v 2>&1 | grep -q "^Target: mips" && echo "yes" || echo "no")',
289 ['mipscompiler=="yes"', {
290 'target_conditions': [
291 ['_toolset=="target"', {
295 [ 'v8_use_mips_abi_hardfloat=="true"', {
296 'cflags': ['-mhard-float'],
297 'ldflags': ['-mhard-float'],
299 'cflags': ['-msoft-float'],
300 'ldflags': ['-msoft-float'],
302 ['mips_arch_variant=="mips32r2"', {
303 'cflags': ['-mips32r2', '-Wa,-mips32r2'],
305 ['mips_arch_variant=="mips32r1"', {
306 'cflags': ['-mips32', '-Wa,-mips32'],
312 [ 'v8_can_use_fpu_instructions=="true"', {
314 'CAN_USE_FPU_INSTRUCTIONS',
317 [ 'v8_use_mips_abi_hardfloat=="true"', {
319 '__mips_hard_float=1',
320 'CAN_USE_FPU_INSTRUCTIONS',
324 '__mips_soft_float=1'
327 ['mips_arch_variant=="mips32r2"', {
328 'defines': ['_MIPS_ARCH_MIPS32R2',],
331 }], # v8_target_arch=="mips"
332 ['v8_target_arch=="mipsel"', {
334 'V8_TARGET_ARCH_MIPS',
337 'mipscompiler': '<!($(echo <(CXX)) -v 2>&1 | grep -q "^Target: mips" && echo "yes" || echo "no")',
340 ['mipscompiler=="yes"', {
341 'target_conditions': [
342 ['_toolset=="target"', {
346 [ 'v8_use_mips_abi_hardfloat=="true"', {
347 'cflags': ['-mhard-float'],
348 'ldflags': ['-mhard-float'],
350 'cflags': ['-msoft-float'],
351 'ldflags': ['-msoft-float'],
353 ['mips_arch_variant=="mips32r2"', {
354 'cflags': ['-mips32r2', '-Wa,-mips32r2'],
356 ['mips_arch_variant=="mips32r1"', {
357 'cflags': ['-mips32', '-Wa,-mips32'],
359 ['mips_arch_variant=="loongson"', {
360 'cflags': ['-mips3', '-Wa,-mips3'],
366 [ 'v8_can_use_fpu_instructions=="true"', {
368 'CAN_USE_FPU_INSTRUCTIONS',
371 [ 'v8_use_mips_abi_hardfloat=="true"', {
373 '__mips_hard_float=1',
374 'CAN_USE_FPU_INSTRUCTIONS',
378 '__mips_soft_float=1'
381 ['mips_arch_variant=="mips32r2"', {
382 'defines': ['_MIPS_ARCH_MIPS32R2',],
384 ['mips_arch_variant=="loongson"', {
385 'defines': ['_MIPS_ARCH_LOONGSON',],
388 }], # v8_target_arch=="mipsel"
389 ['v8_target_arch=="x64"', {
391 'V8_TARGET_ARCH_X64',
394 'ARCHS': [ 'x86_64' ],
398 'StackReserveSize': '2097152',
401 'msvs_configuration_platform': 'x64',
402 }], # v8_target_arch=="x64"
407 'msvs_configuration_attributes': {
408 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
409 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
413 ['OS=="win" and v8_enable_prof==1', {
416 'GenerateMapFile': 'true',
420 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
421 or OS=="netbsd" or OS=="qnx"', {
423 [ 'v8_no_strict_aliasing==1', {
424 'cflags': [ '-fno-strict-aliasing' ],
429 'defines': [ '__C99FEATURES__=1' ], # isinf() etc.
431 ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
432 or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
433 (v8_target_arch=="arm" or v8_target_arch=="ia32" or \
434 v8_target_arch=="mips" or v8_target_arch=="mipsel")', {
435 # Check whether the host compiler and target compiler support the
436 # '-m32' option and set it if so.
437 'target_conditions': [
438 ['_toolset=="host"', {
440 'm32flag': '<!(($(echo ${CXX_host:-$(which g++)}) -m32 -E - > /dev/null 2>&1 < /dev/null) && echo "-m32" || true)',
442 'cflags': [ '<(m32flag)' ],
443 'ldflags': [ '<(m32flag)' ],
448 ['_toolset=="target"', {
450 'm32flag': '<!(($(echo ${CXX_target:-<(CXX)}) -m32 -E - > /dev/null 2>&1 < /dev/null) && echo "-m32" || true)',
454 ['((OS!="android" and OS!="qnx") or clang==1) and \
455 nacl_target_arch!="nacl_x64"', {
456 'cflags': [ '<(m32flag)' ],
457 'ldflags': [ '<(m32flag)' ],
466 ['(OS=="linux" or OS=="android") and \
467 (v8_target_arch=="x64" or v8_target_arch=="arm64")', {
468 # Check whether the host compiler and target compiler support the
469 # '-m64' option and set it if so.
470 'target_conditions': [
471 ['_toolset=="host"', {
473 'm64flag': '<!(($(echo ${CXX_host:-$(which g++)}) -m64 -E - > /dev/null 2>&1 < /dev/null) && echo "-m64" || true)',
475 'cflags': [ '<(m64flag)' ],
476 'ldflags': [ '<(m64flag)' ],
478 ['_toolset=="target"', {
480 'm64flag': '<!(($(echo ${CXX_target:-<(CXX)}) -m64 -E - > /dev/null 2>&1 < /dev/null) && echo "-m64" || true)',
483 ['((OS!="android" and OS!="qnx") or clang==1)', {
484 'cflags': [ '<(m64flag)' ],
485 'ldflags': [ '<(m64flag)' ],
491 ['OS=="freebsd" or OS=="openbsd"', {
492 'cflags': [ '-I/usr/local/include' ],
495 'cflags': [ '-I/usr/pkg/include' ],
499 # Abstract configuration for v8_optimized_debug == 0.
503 'VCCLCompilerTool': {
506 ['component=="shared_library"', {
507 'RuntimeLibrary': '3', # /MDd
509 'RuntimeLibrary': '1', # /MTd
514 'LinkIncremental': '2',
518 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
529 '-ffunction-sections',
534 'GCC_OPTIMIZATION_LEVEL': '0', # -O0
539 # Abstract configuration for v8_optimized_debug == 1.
543 'VCCLCompilerTool': {
545 'InlineFunctionExpansion': '2',
546 'EnableIntrinsicFunctions': 'true',
547 'FavorSizeOrSpeed': '0',
548 'StringPooling': 'true',
549 'BasicRuntimeChecks': '0',
551 ['component=="shared_library"', {
552 'RuntimeLibrary': '3', # /MDd
554 'RuntimeLibrary': '1', # /MTd
559 'LinkIncremental': '2',
563 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
567 '-O3', # TODO(2807) should be -O1.
573 '-ffunction-sections',
574 '-O1', # TODO(2807) should be -O3.
577 ['gcc_version==44 and clang==0', {
579 # Avoid crashes with gcc 4.4 in the v8 test suite.
587 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
588 'GCC_STRICT_ALIASING': 'YES',
593 # Abstract configuration for v8_optimized_debug == 2.
597 'VCCLCompilerTool': {
599 'InlineFunctionExpansion': '2',
600 'EnableIntrinsicFunctions': 'true',
601 'FavorSizeOrSpeed': '0',
602 'StringPooling': 'true',
603 'BasicRuntimeChecks': '0',
605 ['component=="shared_library"', {
606 'RuntimeLibrary': '3', #/MDd
608 'RuntimeLibrary': '1', #/MTd
610 ['v8_target_arch=="x64"', {
611 # TODO(2207): remove this option once the bug is fixed.
612 'WholeProgramOptimization': 'true',
617 'LinkIncremental': '1',
618 'OptimizeReferences': '2',
619 'EnableCOMDATFolding': '2',
623 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
632 '-ffunction-sections',
638 # TODO(crbug.com/272548): Avoid -O3 in NaCl
639 ['nacl_target_arch=="none"', {
646 ['gcc_version==44 and clang==0', {
648 # Avoid crashes with gcc 4.4 in the v8 test suite.
656 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
657 'GCC_STRICT_ALIASING': 'YES',
662 # Common settings for the Debug configuration.
666 'ENABLE_DISASSEMBLER',
673 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
675 'cflags': [ '-Woverloaded-virtual', '<(wno_array_bounds)', ],
677 ['OS=="linux" and v8_enable_backtrace==1', {
678 # Support for backtrace_symbols.
679 'ldflags': [ '-rdynamic' ],
683 'android_full_debug%': 1,
686 ['android_full_debug==0', {
687 # Disable full debug if we want a faster v8 in a debug build.
688 # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
698 'inherit_from': ['DebugBaseCommon'],
700 ['v8_optimized_debug==0', {
701 'inherit_from': ['DebugBase0'],
703 ['v8_optimized_debug==1', {
704 'inherit_from': ['DebugBase1'],
706 ['v8_optimized_debug==2', {
707 'inherit_from': ['DebugBase2'],
713 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
719 '-ffunction-sections',
720 '<(wno_array_bounds)',
723 [ 'gcc_version==44 and clang==0', {
725 # Avoid crashes with gcc 4.4 in the v8 test suite.
729 # TODO(crbug.com/272548): Avoid -O3 in NaCl
730 ['nacl_target_arch=="none"', {
746 '-ffunction-sections',
750 [ 'gcc_version==44 and clang==0', {
752 # Avoid crashes with gcc 4.4 in the v8 test suite.
760 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
762 # -fstrict-aliasing. Mainline gcc
763 # enables this at -O2 and above,
764 # but Apple gcc does not unless it
765 # is specified explicitly.
766 'GCC_STRICT_ALIASING': 'YES',
771 'VCCLCompilerTool': {
773 'InlineFunctionExpansion': '2',
774 'EnableIntrinsicFunctions': 'true',
775 'FavorSizeOrSpeed': '0',
776 'StringPooling': 'true',
778 ['component=="shared_library"', {
779 'RuntimeLibrary': '2', #/MD
781 'RuntimeLibrary': '0', #/MT
783 ['v8_target_arch=="x64"', {
784 # TODO(2207): remove this option once the bug is fixed.
785 'WholeProgramOptimization': 'true',
790 'LinkIncremental': '1',
791 'OptimizeReferences': '2',
792 'EnableCOMDATFolding': '2',