Home | History | Annotate | Download | only in gyp
      1 # Copyright 2009 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 {
     29   'variables': {
     30     'chromium_code': 1,
     31     'msvs_use_common_release': 0,
     32     'gcc_version%': 'unknown',
     33     'target_arch%': 'ia32',
     34     'v8_use_snapshot%': 'true',
     35     'v8_regexp%': 'native',
     36   },
     37   'target_defaults': {
     38     'defines': [
     39       'ENABLE_LOGGING_AND_PROFILING',
     40       'ENABLE_DEBUGGER_SUPPORT',
     41     ],
     42     'conditions': [
     43       ['target_arch=="arm"', {
     44         'defines': [
     45           'V8_TARGET_ARCH_ARM',
     46         ],
     47       }],
     48       ['target_arch=="ia32"', {
     49         'defines': [
     50           'V8_TARGET_ARCH_IA32',
     51           'V8_NATIVE_REGEXP',
     52         ],
     53       }],
     54       ['target_arch=="x64"', {
     55         'defines': [
     56           'V8_TARGET_ARCH_X64',
     57           'V8_NATIVE_REGEXP',
     58         ],
     59       }],
     60     ],
     61     'configurations': {
     62       'Debug': {
     63         'defines': [
     64           'DEBUG',
     65           '_DEBUG',
     66           'ENABLE_DISASSEMBLER',
     67           'V8_ENABLE_CHECKS'
     68         ],
     69         'msvs_settings': {
     70           'VCCLCompilerTool': {
     71             'Optimizations': '0',
     72             'RuntimeLibrary': '1',
     73           },
     74           'VCLinkerTool': {
     75             'LinkIncremental': '2',
     76           },
     77         },
     78       },
     79       'Release': {
     80         'conditions': [
     81           ['OS=="linux"', {
     82             'cflags!': [
     83               '-O2',
     84               '-Os',
     85             ],
     86             'cflags': [
     87               '-fomit-frame-pointer',
     88               '-O3',
     89             ],
     90             'conditions': [
     91               [ 'gcc_version==44', {
     92                 'cflags': [
     93                   # Avoid gcc 4.4 strict aliasing issues in dtoa.c
     94                   '-fno-strict-aliasing',
     95                   # Avoid crashes with gcc 4.4 in the v8 test suite.
     96                   '-fno-tree-vrp',
     97                 ],
     98               }],
     99             ],
    100           }],
    101           ['OS=="mac"', {
    102             'xcode_settings': {
    103               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
    104               'GCC_STRICT_ALIASING': 'YES',   # -fstrict-aliasing.  Mainline gcc
    105                                               # enables this at -O2 and above,
    106                                               # but Apple gcc does not unless it
    107                                               # is specified explicitly.
    108             },
    109           }],
    110           ['OS=="win"', {
    111             'msvs_configuration_attributes': {
    112               'OutputDirectory': '$(SolutionDir)$(ConfigurationName)',
    113               'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
    114               'CharacterSet': '1',
    115             },
    116             'msvs_settings': {
    117               'VCCLCompilerTool': {
    118                 'RuntimeLibrary': '0',
    119                 'Optimizations': '2',
    120                 'InlineFunctionExpansion': '2',
    121                 'EnableIntrinsicFunctions': 'true',
    122                 'FavorSizeOrSpeed': '0',
    123                 'OmitFramePointers': 'true',
    124                 'StringPooling': 'true',
    125               },
    126               'VCLinkerTool': {
    127                 'LinkIncremental': '1',
    128                 'OptimizeReferences': '2',
    129                 'OptimizeForWindows98': '1',
    130                 'EnableCOMDATFolding': '2',
    131               },
    132             },
    133           }],
    134         ],
    135       },
    136     },
    137   },
    138   'targets': [
    139     {
    140       'target_name': 'v8',
    141       'type': 'none',
    142       'conditions': [
    143         ['v8_use_snapshot=="true"', {
    144           'dependencies': ['v8_snapshot'],
    145         },
    146         {
    147           'dependencies': ['v8_nosnapshot'],
    148         }],
    149       ],
    150       'direct_dependent_settings': {
    151         'include_dirs': [
    152           '../../include',
    153         ],
    154       },
    155     },
    156     {
    157       'target_name': 'v8_snapshot',
    158       'type': '<(library)',
    159       'dependencies': [
    160         'mksnapshot#host',
    161         'js2c#host',
    162         'v8_base',
    163       ],
    164       'include_dirs+': [
    165         '../../src',
    166       ],
    167       'sources': [
    168         '<(SHARED_INTERMEDIATE_DIR)/libraries-empty.cc',
    169         '<(INTERMEDIATE_DIR)/snapshot.cc',
    170       ],
    171       'actions': [
    172         {
    173           'action_name': 'run_mksnapshot',
    174           'inputs': [
    175             '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)mksnapshot<(EXECUTABLE_SUFFIX)',
    176           ],
    177           'outputs': [
    178             '<(INTERMEDIATE_DIR)/snapshot.cc',
    179           ],
    180           'action': ['<@(_inputs)', '<@(_outputs)'],
    181         },
    182       ],
    183     },
    184     {
    185       'target_name': 'v8_nosnapshot',
    186       'type': '<(library)',
    187       'toolsets': ['host', 'target'],
    188       'dependencies': [
    189         'js2c#host',
    190         'v8_base',
    191       ],
    192       'include_dirs+': [
    193         '../../src',
    194       ],
    195       'sources': [
    196         '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
    197         '../../src/snapshot-empty.cc',
    198       ],
    199       'conditions': [
    200         # The ARM assembler assumes the host is 32 bits, so force building
    201         # 32-bit host tools.
    202         ['target_arch=="arm" and host_arch=="x64" and _toolset=="host"', {
    203           'cflags': ['-m32'],
    204           'ldflags': ['-m32'],
    205         }]
    206       ]
    207     },
    208     {
    209       'target_name': 'v8_base',
    210       'type': '<(library)',
    211       'toolsets': ['host', 'target'],
    212       'include_dirs+': [
    213         '../../src',
    214       ],
    215       'sources': [
    216         '../../src/accessors.cc',
    217         '../../src/accessors.h',
    218         '../../src/allocation.cc',
    219         '../../src/allocation.h',
    220         '../../src/api.cc',
    221         '../../src/api.h',
    222         '../../src/apiutils.h',
    223         '../../src/arguments.h',
    224         '../../src/assembler.cc',
    225         '../../src/assembler.h',
    226         '../../src/ast.cc',
    227         '../../src/ast.h',
    228         '../../src/bootstrapper.cc',
    229         '../../src/bootstrapper.h',
    230         '../../src/builtins.cc',
    231         '../../src/builtins.h',
    232         '../../src/bytecodes-irregexp.h',
    233         '../../src/char-predicates-inl.h',
    234         '../../src/char-predicates.h',
    235         '../../src/checks.cc',
    236         '../../src/checks.h',
    237         '../../src/code-stubs.cc',
    238         '../../src/code-stubs.h',
    239         '../../src/code.h',
    240         '../../src/codegen-inl.h',
    241         '../../src/codegen.cc',
    242         '../../src/codegen.h',
    243         '../../src/compilation-cache.cc',
    244         '../../src/compilation-cache.h',
    245         '../../src/compiler.cc',
    246         '../../src/compiler.h',
    247         '../../src/contexts.cc',
    248         '../../src/contexts.h',
    249         '../../src/conversions-inl.h',
    250         '../../src/conversions.cc',
    251         '../../src/conversions.h',
    252         '../../src/counters.cc',
    253         '../../src/counters.h',
    254         '../../src/cpu.h',
    255 	'../../src/data-flow.cc',
    256 	'../../src/data-flow.h',
    257         '../../src/dateparser.cc',
    258         '../../src/dateparser.h',
    259         '../../src/dateparser-inl.h',
    260         '../../src/debug.cc',
    261         '../../src/debug.h',
    262         '../../src/debug-agent.cc',
    263         '../../src/debug-agent.h',
    264         '../../src/disasm.h',
    265         '../../src/disassembler.cc',
    266         '../../src/disassembler.h',
    267         '../../src/dtoa-config.c',
    268         '../../src/execution.cc',
    269         '../../src/execution.h',
    270         '../../src/factory.cc',
    271         '../../src/factory.h',
    272         '../../src/fast-codegen.h',
    273         '../../src/flag-definitions.h',
    274         '../../src/flags.cc',
    275         '../../src/flags.h',
    276         '../../src/frame-element.cc',
    277         '../../src/frame-element.h',
    278         '../../src/frames-inl.h',
    279         '../../src/frames.cc',
    280         '../../src/frames.h',
    281         '../../src/full-codegen.cc',
    282         '../../src/full-codegen.h',
    283         '../../src/func-name-inferrer.cc',
    284         '../../src/func-name-inferrer.h',
    285         '../../src/global-handles.cc',
    286         '../../src/global-handles.h',
    287         '../../src/globals.h',
    288         '../../src/handles-inl.h',
    289         '../../src/handles.cc',
    290         '../../src/handles.h',
    291         '../../src/hashmap.cc',
    292         '../../src/hashmap.h',
    293         '../../src/heap-inl.h',
    294         '../../src/heap.cc',
    295         '../../src/heap.h',
    296         '../../src/heap-profiler.cc',
    297         '../../src/heap-profiler.h',
    298         '../../src/ic-inl.h',
    299         '../../src/ic.cc',
    300         '../../src/ic.h',
    301         '../../src/interpreter-irregexp.cc',
    302         '../../src/interpreter-irregexp.h',
    303         '../../src/jump-target.cc',
    304         '../../src/jump-target.h',
    305         '../../src/jump-target-inl.h',
    306         '../../src/jsregexp.cc',
    307         '../../src/jsregexp.h',
    308         '../../src/list-inl.h',
    309         '../../src/list.h',
    310         '../../src/liveedit.cc',
    311         '../../src/liveedit.h',
    312         '../../src/log-inl.h',
    313         '../../src/log-utils.cc',
    314         '../../src/log-utils.h',
    315         '../../src/log.cc',
    316         '../../src/log.h',
    317         '../../src/macro-assembler.h',
    318         '../../src/mark-compact.cc',
    319         '../../src/mark-compact.h',
    320         '../../src/memory.h',
    321         '../../src/messages.cc',
    322         '../../src/messages.h',
    323         '../../src/natives.h',
    324 	'../../src/number-info.h',
    325         '../../src/objects-debug.cc',
    326         '../../src/objects-inl.h',
    327         '../../src/objects.cc',
    328         '../../src/objects.h',
    329         '../../src/oprofile-agent.h',
    330         '../../src/oprofile-agent.cc',
    331         '../../src/parser.cc',
    332         '../../src/parser.h',
    333         '../../src/platform.h',
    334         '../../src/prettyprinter.cc',
    335         '../../src/prettyprinter.h',
    336         '../../src/property.cc',
    337         '../../src/property.h',
    338         '../../src/regexp-macro-assembler-irregexp-inl.h',
    339         '../../src/regexp-macro-assembler-irregexp.cc',
    340         '../../src/regexp-macro-assembler-irregexp.h',
    341         '../../src/regexp-macro-assembler-tracer.cc',
    342         '../../src/regexp-macro-assembler-tracer.h',
    343         '../../src/regexp-macro-assembler.cc',
    344         '../../src/regexp-macro-assembler.h',
    345         '../../src/regexp-stack.cc',
    346         '../../src/regexp-stack.h',
    347         '../../src/register-allocator.h',
    348         '../../src/register-allocator-inl.h',
    349         '../../src/register-allocator.cc',
    350         '../../src/rewriter.cc',
    351         '../../src/rewriter.h',
    352         '../../src/runtime.cc',
    353         '../../src/runtime.h',
    354         '../../src/scanner.cc',
    355         '../../src/scanner.h',
    356         '../../src/scopeinfo.cc',
    357         '../../src/scopeinfo.h',
    358         '../../src/scopes.cc',
    359         '../../src/scopes.h',
    360         '../../src/serialize.cc',
    361         '../../src/serialize.h',
    362         '../../src/shell.h',
    363         '../../src/smart-pointer.h',
    364         '../../src/snapshot-common.cc',
    365         '../../src/snapshot.h',
    366         '../../src/spaces-inl.h',
    367         '../../src/spaces.cc',
    368         '../../src/spaces.h',
    369         '../../src/string-stream.cc',
    370         '../../src/string-stream.h',
    371         '../../src/stub-cache.cc',
    372         '../../src/stub-cache.h',
    373         '../../src/token.cc',
    374         '../../src/token.h',
    375         '../../src/top.cc',
    376         '../../src/top.h',
    377         '../../src/unicode-inl.h',
    378         '../../src/unicode.cc',
    379         '../../src/unicode.h',
    380         '../../src/usage-analyzer.cc',
    381         '../../src/usage-analyzer.h',
    382         '../../src/utils.cc',
    383         '../../src/utils.h',
    384         '../../src/v8-counters.cc',
    385         '../../src/v8-counters.h',
    386         '../../src/v8.cc',
    387         '../../src/v8.h',
    388         '../../src/v8threads.cc',
    389         '../../src/v8threads.h',
    390         '../../src/variables.cc',
    391         '../../src/variables.h',
    392         '../../src/version.cc',
    393         '../../src/version.h',
    394         '../../src/virtual-frame.h',
    395         '../../src/virtual-frame.cc',
    396         '../../src/zone-inl.h',
    397         '../../src/zone.cc',
    398         '../../src/zone.h',
    399       ],
    400       'conditions': [
    401         ['target_arch=="arm"', {
    402           'include_dirs+': [
    403             '../../src/arm',
    404           ],
    405           'sources': [
    406             '../../src/fast-codegen.cc',
    407             '../../src/arm/assembler-arm-inl.h',
    408             '../../src/arm/assembler-arm.cc',
    409             '../../src/arm/assembler-arm.h',
    410             '../../src/arm/builtins-arm.cc',
    411             '../../src/arm/codegen-arm.cc',
    412             '../../src/arm/codegen-arm.h',
    413             '../../src/arm/constants-arm.h',
    414             '../../src/arm/constants-arm.cc',
    415             '../../src/arm/cpu-arm.cc',
    416             '../../src/arm/debug-arm.cc',
    417             '../../src/arm/disasm-arm.cc',
    418             '../../src/arm/fast-codegen-arm.cc',
    419             '../../src/arm/frames-arm.cc',
    420             '../../src/arm/frames-arm.h',
    421             '../../src/arm/full-codegen-arm.cc',
    422             '../../src/arm/ic-arm.cc',
    423             '../../src/arm/jump-target-arm.cc',
    424             '../../src/arm/macro-assembler-arm.cc',
    425             '../../src/arm/macro-assembler-arm.h',
    426             '../../src/arm/regexp-macro-assembler-arm.cc',
    427             '../../src/arm/regexp-macro-assembler-arm.h',
    428             '../../src/arm/register-allocator-arm.cc',
    429             '../../src/arm/simulator-arm.cc',
    430             '../../src/arm/stub-cache-arm.cc',
    431             '../../src/arm/virtual-frame-arm.cc',
    432             '../../src/arm/virtual-frame-arm.h',
    433           ],
    434           'conditions': [
    435             # The ARM assembler assumes the host is 32 bits, so force building
    436             # 32-bit host tools.
    437             ['host_arch=="x64" and _toolset=="host"', {
    438               'cflags': ['-m32'],
    439               'ldflags': ['-m32'],
    440             }]
    441           ]
    442         }],
    443         ['target_arch=="ia32"', {
    444           'include_dirs+': [
    445             '../../src/ia32',
    446           ],
    447           'sources': [
    448             '../../src/ia32/assembler-ia32-inl.h',
    449             '../../src/ia32/assembler-ia32.cc',
    450             '../../src/ia32/assembler-ia32.h',
    451             '../../src/ia32/builtins-ia32.cc',
    452             '../../src/ia32/codegen-ia32.cc',
    453             '../../src/ia32/codegen-ia32.h',
    454             '../../src/ia32/cpu-ia32.cc',
    455             '../../src/ia32/debug-ia32.cc',
    456             '../../src/ia32/disasm-ia32.cc',
    457             '../../src/ia32/fast-codegen-ia32.cc',
    458             '../../src/ia32/fast-codegen-ia32.h',
    459             '../../src/ia32/frames-ia32.cc',
    460             '../../src/ia32/frames-ia32.h',
    461             '../../src/ia32/full-codegen-ia32.cc',
    462             '../../src/ia32/ic-ia32.cc',
    463             '../../src/ia32/jump-target-ia32.cc',
    464             '../../src/ia32/macro-assembler-ia32.cc',
    465             '../../src/ia32/macro-assembler-ia32.h',
    466             '../../src/ia32/regexp-macro-assembler-ia32.cc',
    467             '../../src/ia32/regexp-macro-assembler-ia32.h',
    468             '../../src/ia32/register-allocator-ia32.cc',
    469             '../../src/ia32/stub-cache-ia32.cc',
    470             '../../src/ia32/virtual-frame-ia32.cc',
    471             '../../src/ia32/virtual-frame-ia32.h',
    472           ],
    473         }],
    474         ['target_arch=="x64"', {
    475           'include_dirs+': [
    476             '../../src/x64',
    477           ],
    478           'sources': [
    479             '../../src/fast-codegen.cc',
    480             '../../src/x64/assembler-x64-inl.h',
    481             '../../src/x64/assembler-x64.cc',
    482             '../../src/x64/assembler-x64.h',
    483             '../../src/x64/builtins-x64.cc',
    484             '../../src/x64/codegen-x64.cc',
    485             '../../src/x64/codegen-x64.h',
    486             '../../src/x64/cpu-x64.cc',
    487             '../../src/x64/debug-x64.cc',
    488             '../../src/x64/disasm-x64.cc',
    489             '../../src/x64/fast-codegen-x64.cc',
    490             '../../src/x64/frames-x64.cc',
    491             '../../src/x64/frames-x64.h',
    492             '../../src/x64/full-codegen-x64.cc',
    493             '../../src/x64/ic-x64.cc',
    494             '../../src/x64/jump-target-x64.cc',
    495             '../../src/x64/macro-assembler-x64.cc',
    496             '../../src/x64/macro-assembler-x64.h',
    497             '../../src/x64/regexp-macro-assembler-x64.cc',
    498             '../../src/x64/regexp-macro-assembler-x64.h',
    499             '../../src/x64/register-allocator-x64.cc',
    500             '../../src/x64/stub-cache-x64.cc',
    501             '../../src/x64/virtual-frame-x64.cc',
    502             '../../src/x64/virtual-frame-x64.h',
    503           ],
    504         }],
    505         ['OS=="linux"', {
    506             'link_settings': {
    507               'libraries': [
    508                 # Needed for clock_gettime() used by src/platform-linux.cc.
    509                 '-lrt',
    510             ]},
    511             'sources': [
    512               '../../src/platform-linux.cc',
    513               '../../src/platform-posix.cc'
    514             ],
    515           }
    516         ],
    517         ['OS=="openbsd"', {
    518             'link_settings': {
    519               'libraries': [
    520                 '-L/usr/local/lib -lexecinfo',
    521             ]},
    522             'sources': [
    523               '../../src/platform-openbsd.cc',
    524               '../../src/platform-posix.cc'
    525             ],
    526           }
    527         ],
    528         ['OS=="mac"', {
    529           'sources': [
    530             '../../src/platform-macos.cc',
    531             '../../src/platform-posix.cc'
    532           ]},
    533         ],
    534         ['OS=="win"', {
    535           'sources': [
    536             '../../src/platform-win32.cc',
    537           ],
    538           # 4355, 4800 came from common.vsprops
    539           # 4018, 4244 were a per file config on dtoa-config.c
    540           # TODO: It's probably possible and desirable to stop disabling the
    541           # dtoa-specific warnings by modifying dtoa as was done in Chromium
    542           # r9255.  Refer to that revision for details.
    543           'msvs_disabled_warnings': [4355, 4800, 4018, 4244],
    544           'link_settings':  {
    545             'libraries': [ '-lwinmm.lib' ],
    546           },
    547         }],
    548       ],
    549     },
    550     {
    551       'target_name': 'js2c',
    552       'type': 'none',
    553       'toolsets': ['host'],
    554       'variables': {
    555         'library_files': [
    556           '../../src/runtime.js',
    557           '../../src/v8natives.js',
    558           '../../src/array.js',
    559           '../../src/string.js',
    560           '../../src/uri.js',
    561           '../../src/math.js',
    562           '../../src/messages.js',
    563           '../../src/apinatives.js',
    564           '../../src/debug-debugger.js',
    565           '../../src/mirror-debugger.js',
    566           '../../src/date.js',
    567           '../../src/json.js',
    568           '../../src/regexp.js',
    569           '../../src/macros.py',
    570         ],
    571       },
    572       'actions': [
    573         {
    574           'action_name': 'js2c',
    575           'inputs': [
    576             '../../tools/js2c.py',
    577             '<@(library_files)',
    578           ],
    579           'outputs': [
    580             '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
    581             '<(SHARED_INTERMEDIATE_DIR)/libraries-empty.cc',
    582           ],
    583           'action': [
    584             'python',
    585             '../../tools/js2c.py',
    586             '<@(_outputs)',
    587             'CORE',
    588             '<@(library_files)'
    589           ],
    590         },
    591       ],
    592     },
    593     {
    594       'target_name': 'mksnapshot',
    595       'type': 'executable',
    596       'toolsets': ['host'],
    597       'dependencies': [
    598         'v8_nosnapshot',
    599       ],
    600       'include_dirs+': [
    601         '../../src',
    602       ],
    603       'sources': [
    604         '../../src/mksnapshot.cc',
    605       ],
    606       'conditions': [
    607         # The ARM assembler assumes the host is 32 bits, so force building
    608         # 32-bit host tools.
    609         ['target_arch=="arm" and host_arch=="x64" and _toolset=="host"', {
    610           'cflags': ['-m32'],
    611           'ldflags': ['-m32'],
    612         }]
    613       ]
    614     },
    615     {
    616       'target_name': 'v8_shell',
    617       'type': 'executable',
    618       'dependencies': [
    619         'v8'
    620       ],
    621       'sources': [
    622         '../../samples/shell.cc',
    623       ],
    624       'conditions': [
    625         [ 'OS=="win"', {
    626           # This could be gotten by not setting chromium_code, if that's OK.
    627           'defines': ['_CRT_SECURE_NO_WARNINGS'],
    628         }],
    629       ],
    630     },
    631   ],
    632 }
    633