Home | History | Annotate | Download | only in build
      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 # Shared definitions for all V8-related targets.
     29 
     30 {
     31   'variables': {
     32     'use_system_v8%': 0,
     33     'msvs_use_common_release': 0,
     34     'gcc_version%': 'unknown',
     35     'v8_compress_startup_data%': 'off',
     36     'v8_target_arch%': '<(target_arch)',
     37 
     38     # Setting 'v8_can_use_unaligned_accesses' to 'true' will allow the code
     39     # generated by V8 to do unaligned memory access, and setting it to 'false'
     40     # will ensure that the generated code will always do aligned memory
     41     # accesses. The default value of 'default' will try to determine the correct
     42     # setting. Note that for Intel architectures (ia32 and x64) unaligned memory
     43     # access is allowed for all CPUs.
     44     'v8_can_use_unaligned_accesses%': 'default',
     45 
     46     # Setting 'v8_can_use_vfp_instructions' to 'true' will enable use of ARM VFP
     47     # instructions in the V8 generated code. VFP instructions will be enabled
     48     # both for the snapshot and for the ARM target. Leaving the default value
     49     # of 'false' will avoid VFP instructions in the snapshot and use CPU feature
     50     # probing when running on the target.
     51     'v8_can_use_vfp_instructions%': 'false',
     52 
     53     # Similar to vfp but on MIPS.
     54     'v8_can_use_fpu_instructions%': 'true',
     55 
     56     # Setting v8_use_arm_eabi_hardfloat to true will turn on V8 support for ARM
     57     # EABI calling convention where double arguments are passed in VFP
     58     # registers. Note that the GCC flag '-mfloat-abi=hard' should be used as
     59     # well when compiling for the ARM target.
     60     'v8_use_arm_eabi_hardfloat%': 'false',
     61 
     62     # Similar to the ARM hard float ABI but on MIPS.
     63     'v8_use_mips_abi_hardfloat%': 'true',
     64 
     65     # Default arch variant for MIPS.
     66     'mips_arch_variant%': 'mips32r2',
     67 
     68     'v8_enable_debugger_support%': 1,
     69 
     70     'v8_enable_disassembler%': 0,
     71 
     72     'v8_object_print%': 0,
     73 
     74     'v8_enable_gdbjit%': 0,
     75 
     76     # Enable profiling support. Only required on Windows.
     77     'v8_enable_prof%': 0,
     78 
     79     # Some versions of GCC 4.5 seem to need -fno-strict-aliasing.
     80     'v8_no_strict_aliasing%': 0,
     81 
     82     # Chrome needs this definition unconditionally. For standalone V8 builds,
     83     # it's handled in build/standalone.gypi.
     84     'want_separate_host_toolset%': 1,
     85 
     86     'v8_use_snapshot%': 'true',
     87     'host_os%': '<(OS)',
     88     'v8_use_liveobjectlist%': 'false',
     89     'werror%': '-Werror',
     90 
     91     # With post mortem support enabled, metadata is embedded into libv8 that
     92     # describes various parameters of the VM for use by debuggers. See
     93     # tools/gen-postmortem-metadata.py for details.
     94     'v8_postmortem_support%': 'false',
     95 
     96     # For a shared library build, results in "libv8-<(soname_version).so".
     97     'soname_version%': '',
     98   },
     99   'target_defaults': {
    100     'conditions': [
    101       ['v8_enable_debugger_support==1', {
    102         'defines': ['ENABLE_DEBUGGER_SUPPORT',],
    103       }],
    104       ['v8_enable_disassembler==1', {
    105         'defines': ['ENABLE_DISASSEMBLER',],
    106       }],
    107       ['v8_object_print==1', {
    108         'defines': ['OBJECT_PRINT',],
    109       }],
    110       ['v8_enable_gdbjit==1', {
    111         'defines': ['ENABLE_GDB_JIT_INTERFACE',],
    112       }],
    113       ['OS!="mac"', {
    114         # TODO(mark): The OS!="mac" conditional is temporary. It can be
    115         # removed once the Mac Chromium build stops setting target_arch to
    116         # ia32 and instead sets it to mac. Other checks in this file for
    117         # OS=="mac" can be removed at that time as well. This can be cleaned
    118         # up once http://crbug.com/44205 is fixed.
    119         'conditions': [
    120           ['v8_target_arch=="arm"', {
    121             'defines': [
    122               'V8_TARGET_ARCH_ARM',
    123             ],
    124             'conditions': [
    125               [ 'v8_can_use_unaligned_accesses=="true"', {
    126                 'defines': [
    127                   'CAN_USE_UNALIGNED_ACCESSES=1',
    128                 ],
    129               }],
    130               [ 'v8_can_use_unaligned_accesses=="false"', {
    131                 'defines': [
    132                   'CAN_USE_UNALIGNED_ACCESSES=0',
    133                 ],
    134               }],
    135               [ 'v8_can_use_vfp_instructions=="true"', {
    136                 'defines': [
    137                   'CAN_USE_VFP_INSTRUCTIONS',
    138                 ],
    139               }],
    140               [ 'v8_use_arm_eabi_hardfloat=="true"', {
    141                 'defines': [
    142                   'USE_EABI_HARDFLOAT=1',
    143                   'CAN_USE_VFP_INSTRUCTIONS',
    144                 ],
    145                 'cflags': [
    146                   '-mfloat-abi=hard',
    147                 ],
    148               }, {
    149                 'defines': [
    150                   'USE_EABI_HARDFLOAT=0',
    151                 ],
    152               }],
    153               # The ARM assembler assumes the host is 32 bits,
    154               # so force building 32-bit host tools.
    155               ['host_arch=="x64" or OS=="android"', {
    156                 'target_conditions': [
    157                   ['_toolset=="host"', {
    158                     'cflags': ['-m32'],
    159                     'ldflags': ['-m32'],
    160                   }],
    161                 ],
    162               }],
    163             ],
    164           }],
    165           ['v8_target_arch=="ia32"', {
    166             'defines': [
    167               'V8_TARGET_ARCH_IA32',
    168             ],
    169           }],
    170           ['v8_target_arch=="mips"', {
    171             'defines': [
    172               'V8_TARGET_ARCH_MIPS',
    173             ],
    174             'conditions': [
    175               [ 'target_arch=="mips"', {
    176                 'target_conditions': [
    177                   ['_toolset=="target"', {
    178                     'cflags': ['-EL'],
    179                     'ldflags': ['-EL'],
    180                     'conditions': [
    181                       [ 'v8_use_mips_abi_hardfloat=="true"', {
    182                         'cflags': ['-mhard-float'],
    183                         'ldflags': ['-mhard-float'],
    184                       }, {
    185                         'cflags': ['-msoft-float'],
    186                         'ldflags': ['-msoft-float'],
    187                       }],
    188                       ['mips_arch_variant=="mips32r2"', {
    189                         'cflags': ['-mips32r2', '-Wa,-mips32r2'],
    190                       }],
    191                       ['mips_arch_variant=="loongson"', {
    192                         'cflags': ['-mips3', '-Wa,-mips3'],
    193                       }, {
    194                         'cflags': ['-mips32', '-Wa,-mips32'],
    195                       }],
    196                     ],
    197                   }],
    198                 ],
    199               }],
    200               [ 'v8_can_use_fpu_instructions=="true"', {
    201                 'defines': [
    202                   'CAN_USE_FPU_INSTRUCTIONS',
    203                 ],
    204               }],
    205               [ 'v8_use_mips_abi_hardfloat=="true"', {
    206                 'defines': [
    207                   '__mips_hard_float=1',
    208                   'CAN_USE_FPU_INSTRUCTIONS',
    209                 ],
    210               }, {
    211                 'defines': [
    212                   '__mips_soft_float=1'
    213                 ],
    214               }],
    215               ['mips_arch_variant=="mips32r2"', {
    216                 'defines': ['_MIPS_ARCH_MIPS32R2',],
    217               }],
    218               ['mips_arch_variant=="loongson"', {
    219                 'defines': ['_MIPS_ARCH_LOONGSON',],
    220               }],
    221               # The MIPS assembler assumes the host is 32 bits,
    222               # so force building 32-bit host tools.
    223               ['host_arch=="x64"', {
    224                 'target_conditions': [
    225                   ['_toolset=="host"', {
    226                     'cflags': ['-m32'],
    227                     'ldflags': ['-m32'],
    228                   }],
    229                 ],
    230               }],
    231             ],
    232           }],
    233           ['v8_target_arch=="x64"', {
    234             'defines': [
    235               'V8_TARGET_ARCH_X64',
    236             ],
    237           }],
    238         ],
    239       }],
    240       ['v8_use_liveobjectlist=="true"', {
    241         'defines': [
    242           'ENABLE_DEBUGGER_SUPPORT',
    243           'INSPECTOR',
    244           'OBJECT_PRINT',
    245           'LIVEOBJECTLIST',
    246         ],
    247       }],
    248       ['v8_compress_startup_data=="bz2"', {
    249         'defines': [
    250           'COMPRESS_STARTUP_DATA_BZ2',
    251         ],
    252       }],
    253       ['OS=="win"', {
    254         'defines': [
    255           'WIN32',
    256         ],
    257       }],
    258       ['OS=="win" and v8_enable_prof==1', {
    259         'msvs_settings': {
    260           'VCLinkerTool': {
    261             'GenerateMapFile': 'true',
    262           },
    263         },
    264       }],
    265       ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
    266          or OS=="netbsd"', {
    267         'conditions': [
    268           [ 'target_arch=="ia32"', {
    269             'cflags': [ '-m32' ],
    270             'ldflags': [ '-m32' ],
    271           }],
    272           [ 'v8_no_strict_aliasing==1', {
    273             'cflags': [ '-fno-strict-aliasing' ],
    274           }],
    275         ],  # conditions
    276       }],
    277       ['OS=="solaris"', {
    278         'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
    279       }],
    280     ],  # conditions
    281     'configurations': {
    282       'Debug': {
    283         'defines': [
    284           'DEBUG',
    285           'ENABLE_DISASSEMBLER',
    286           'V8_ENABLE_CHECKS',
    287           'OBJECT_PRINT',
    288         ],
    289         'msvs_settings': {
    290           'VCCLCompilerTool': {
    291             'Optimization': '0',
    292 
    293             'conditions': [
    294               ['OS=="win" and component=="shared_library"', {
    295                 'RuntimeLibrary': '3',  # /MDd
    296               }, {
    297                 'RuntimeLibrary': '1',  # /MTd
    298               }],
    299             ],
    300           },
    301           'VCLinkerTool': {
    302             'LinkIncremental': '2',
    303             # For future reference, the stack size needs to be increased
    304             # when building for Windows 64-bit, otherwise some test cases
    305             # can cause stack overflow.
    306             # 'StackReserveSize': '297152',
    307           },
    308         },
    309         'conditions': [
    310           ['OS=="freebsd" or OS=="openbsd"', {
    311             'cflags': [ '-I/usr/local/include' ],
    312           }],
    313           ['OS=="netbsd"', {
    314             'cflags': [ '-I/usr/pkg/include' ],
    315           }],
    316           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
    317             'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
    318                         '-Wnon-virtual-dtor', '-Woverloaded-virtual' ],
    319           }],
    320         ],
    321       },  # Debug
    322       'Release': {
    323         'conditions': [
    324           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \
    325             or OS=="android"', {
    326             'cflags!': [
    327               '-O2',
    328               '-Os',
    329             ],
    330             'cflags': [
    331               '-fdata-sections',
    332               '-ffunction-sections',
    333               '-fomit-frame-pointer',
    334               '-O3',
    335             ],
    336             'conditions': [
    337               [ 'gcc_version==44 and clang==0', {
    338                 'cflags': [
    339                   # Avoid crashes with gcc 4.4 in the v8 test suite.
    340                   '-fno-tree-vrp',
    341                 ],
    342               }],
    343             ],
    344           }],
    345           ['OS=="freebsd" or OS=="openbsd"', {
    346             'cflags': [ '-I/usr/local/include' ],
    347           }],
    348           ['OS=="netbsd"', {
    349             'cflags': [ '-I/usr/pkg/include' ],
    350           }],
    351           ['OS=="mac"', {
    352             'xcode_settings': {
    353               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
    354 
    355               # -fstrict-aliasing.  Mainline gcc
    356               # enables this at -O2 and above,
    357               # but Apple gcc does not unless it
    358               # is specified explicitly.
    359               'GCC_STRICT_ALIASING': 'YES',
    360             },
    361           }],  # OS=="mac"
    362           ['OS=="win"', {
    363             'msvs_configuration_attributes': {
    364               'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
    365               'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
    366               'CharacterSet': '1',
    367             },
    368             'msvs_settings': {
    369               'VCCLCompilerTool': {
    370                 'Optimization': '2',
    371                 'InlineFunctionExpansion': '2',
    372                 'EnableIntrinsicFunctions': 'true',
    373                 'FavorSizeOrSpeed': '0',
    374                 'OmitFramePointers': 'true',
    375                 'StringPooling': 'true',
    376 
    377                 'conditions': [
    378                   ['OS=="win" and component=="shared_library"', {
    379                     'RuntimeLibrary': '2',  #/MD
    380                   }, {
    381                     'RuntimeLibrary': '0',  #/MT
    382                   }],
    383                 ],
    384               },
    385               'VCLinkerTool': {
    386                 'LinkIncremental': '1',
    387                 'OptimizeReferences': '2',
    388                 'OptimizeForWindows98': '1',
    389                 'EnableCOMDATFolding': '2',
    390                 # For future reference, the stack size needs to be
    391                 # increased when building for Windows 64-bit, otherwise
    392                 # some test cases can cause stack overflow.
    393                 # 'StackReserveSize': '297152',
    394               },
    395             },
    396           }],  # OS=="win"
    397         ],  # conditions
    398       },  # Release
    399     },  # configurations
    400   },  # target_defaults
    401 }
    402