Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / v8 / build / toolchain.gypi
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
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     'msvs_use_common_release': 0,
33     'gcc_version%': 'unknown',
34     'clang%': 0,
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
43
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
48     # on the target.
49     'v8_can_use_vfp32dregs%': 'false',
50     'arm_test_noprobe%': 'off',
51
52     # Similar to vfp but on MIPS.
53     'v8_can_use_fpu_instructions%': 'true',
54
55     # Similar to the ARM hard float ABI but on MIPS.
56     'v8_use_mips_abi_hardfloat%': 'true',
57
58     # Default arch variant for MIPS.
59     'mips_arch_variant%': 'r2',
60
61     # Possible values fp32, fp64, fpxx.
62     # fp32 - 32 32-bit FPU registers are available, doubles are placed in
63     #        register pairs.
64     # fp64 - 32 64-bit FPU registers are available.
65     # fpxx - compatibility mode, it chooses fp32 or fp64 depending on runtime
66     #        detection
67     'mips_fpu_mode%': 'fp32',
68
69     'v8_enable_backtrace%': 0,
70
71     # Enable profiling support. Only required on Windows.
72     'v8_enable_prof%': 0,
73
74     # Some versions of GCC 4.5 seem to need -fno-strict-aliasing.
75     'v8_no_strict_aliasing%': 0,
76
77     # Chrome needs this definition unconditionally. For standalone V8 builds,
78     # it's handled in build/standalone.gypi.
79     'want_separate_host_toolset%': 1,
80
81     # Toolset the d8 binary should be compiled for. Possible values are 'host'
82     # and 'target'. If you want to run v8 tests, it needs to be set to 'target'.
83     # The setting is ignored if want_separate_host_toolset is 0.
84     'v8_toolset_for_d8%': 'target',
85
86     'host_os%': '<(OS)',
87     'werror%': '-Werror',
88     # For a shared library build, results in "libv8-<(soname_version).so".
89     'soname_version%': '',
90
91     # Allow to suppress the array bounds warning (default is no suppression).
92     'wno_array_bounds%': '',
93
94     # Link-Time Optimizations
95     'use_lto%': 0,
96
97     'variables': {
98       # This is set when building the Android WebView inside the Android build
99       # system, using the 'android' gyp backend.
100       'android_webview_build%': 0,
101     },
102     # Copy it out one scope.
103     'android_webview_build%': '<(android_webview_build)',
104   },
105   'conditions': [
106     ['host_arch=="ia32" or host_arch=="x64" or clang==1', {
107       'variables': {
108         'host_cxx_is_biarch%': 1,
109        },
110      }, {
111       'variables': {
112         'host_cxx_is_biarch%': 0,
113       },
114     }],
115     ['target_arch=="ia32" or target_arch=="x64" or target_arch=="x87" or \
116       clang==1', {
117       'variables': {
118         'target_cxx_is_biarch%': 1,
119        },
120      }, {
121       'variables': {
122         'target_cxx_is_biarch%': 0,
123       },
124     }],
125   ],
126   'target_defaults': {
127     'conditions': [
128       ['v8_target_arch=="arm"', {
129         'defines': [
130           'V8_TARGET_ARCH_ARM',
131         ],
132         'conditions': [
133           [ 'arm_version==7 or arm_version=="default"', {
134             'defines': [
135               'CAN_USE_ARMV7_INSTRUCTIONS',
136             ],
137           }],
138           [ 'arm_fpu=="vfpv3-d16" or arm_fpu=="default"', {
139             'defines': [
140               'CAN_USE_VFP3_INSTRUCTIONS',
141             ],
142           }],
143           [ 'arm_fpu=="vfpv3"', {
144             'defines': [
145               'CAN_USE_VFP3_INSTRUCTIONS',
146               'CAN_USE_VFP32DREGS',
147             ],
148           }],
149           [ 'arm_fpu=="neon"', {
150             'defines': [
151               'CAN_USE_VFP3_INSTRUCTIONS',
152               'CAN_USE_VFP32DREGS',
153               'CAN_USE_NEON',
154             ],
155           }],
156           [ 'arm_test_noprobe=="on"', {
157             'defines': [
158               'ARM_TEST_NO_FEATURE_PROBE',
159             ],
160           }],
161         ],
162         'target_conditions': [
163           ['_toolset=="host"', {
164             'conditions': [
165               ['v8_target_arch==host_arch and android_webview_build==0', {
166                 # Host built with an Arm CXX compiler.
167                 'conditions': [
168                   [ 'arm_version==7', {
169                     'cflags': ['-march=armv7-a',],
170                   }],
171                   [ 'arm_version==7 or arm_version=="default"', {
172                     'conditions': [
173                       [ 'arm_fpu!="default"', {
174                         'cflags': ['-mfpu=<(arm_fpu)',],
175                       }],
176                     ],
177                   }],
178                   [ 'arm_float_abi!="default"', {
179                     'cflags': ['-mfloat-abi=<(arm_float_abi)',],
180                   }],
181                   [ 'arm_thumb==1', {
182                     'cflags': ['-mthumb',],
183                   }],
184                   [ 'arm_thumb==0', {
185                     'cflags': ['-marm',],
186                   }],
187                 ],
188               }, {
189                 # 'v8_target_arch!=host_arch'
190                 # Host not built with an Arm CXX compiler (simulator build).
191                 'conditions': [
192                   [ 'arm_float_abi=="hard"', {
193                     'defines': [
194                       'USE_EABI_HARDFLOAT=1',
195                     ],
196                   }],
197                   [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
198                     'defines': [
199                       'USE_EABI_HARDFLOAT=0',
200                     ],
201                   }],
202                 ],
203               }],
204             ],
205           }],  # _toolset=="host"
206           ['_toolset=="target"', {
207             'conditions': [
208               ['v8_target_arch==target_arch and android_webview_build==0', {
209                 # Target built with an Arm CXX compiler.
210                 'conditions': [
211                   [ 'arm_version==7', {
212                     'cflags': ['-march=armv7-a',],
213                   }],
214                   [ 'arm_version==7 or arm_version=="default"', {
215                     'conditions': [
216                       [ 'arm_fpu!="default"', {
217                         'cflags': ['-mfpu=<(arm_fpu)',],
218                       }],
219                     ],
220                   }],
221                   [ 'arm_float_abi!="default"', {
222                     'cflags': ['-mfloat-abi=<(arm_float_abi)',],
223                   }],
224                   [ 'arm_thumb==1', {
225                     'cflags': ['-mthumb',],
226                   }],
227                   [ 'arm_thumb==0', {
228                     'cflags': ['-marm',],
229                   }],
230                 ],
231               }, {
232                 # 'v8_target_arch!=target_arch'
233                 # Target not built with an Arm CXX compiler (simulator build).
234                 'conditions': [
235                   [ 'arm_float_abi=="hard"', {
236                     'defines': [
237                       'USE_EABI_HARDFLOAT=1',
238                     ],
239                   }],
240                   [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
241                     'defines': [
242                       'USE_EABI_HARDFLOAT=0',
243                     ],
244                   }],
245                 ],
246               }],
247               # Disable LTO for v8
248               # v8 is optimized for speed, which takes precedence over
249               # size optimization in LTO.
250               ['use_lto==1', {
251                 'cflags!': [
252                   '-flto',
253                   '-ffat-lto-objects',
254                 ],
255               }],
256             ],
257           }],  # _toolset=="target"
258         ],
259       }],  # v8_target_arch=="arm"
260       ['v8_target_arch=="arm64"', {
261         'defines': [
262           'V8_TARGET_ARCH_ARM64',
263         ],
264       }],
265       ['v8_target_arch=="ia32"', {
266         'defines': [
267           'V8_TARGET_ARCH_IA32',
268         ],
269       }],  # v8_target_arch=="ia32"
270       ['v8_target_arch=="x87"', {
271         'defines': [
272           'V8_TARGET_ARCH_X87',
273         ],
274         'cflags': ['-march=i586'],
275       }],  # v8_target_arch=="x87"
276       ['v8_target_arch=="mips"', {
277         'defines': [
278           'V8_TARGET_ARCH_MIPS',
279         ],
280         'conditions': [
281           ['v8_target_arch==target_arch and android_webview_build==0', {
282             # Target built with a Mips CXX compiler.
283             'target_conditions': [
284               ['_toolset=="target"', {
285                 'cflags': ['-EB'],
286                 'ldflags': ['-EB'],
287                 'conditions': [
288                   [ 'v8_use_mips_abi_hardfloat=="true"', {
289                     'cflags': ['-mhard-float'],
290                     'ldflags': ['-mhard-float'],
291                   }, {
292                     'cflags': ['-msoft-float'],
293                     'ldflags': ['-msoft-float'],
294                   }],
295                   ['mips_fpu_mode=="fp64"', {
296                     'cflags': ['-mfp64'],
297                   }],
298                   ['mips_fpu_mode=="fpxx"', {
299                     'cflags': ['-mfpxx'],
300                   }],
301                   ['mips_fpu_mode=="fp32"', {
302                     'cflags': ['-mfp32'],
303                   }],
304                   ['mips_arch_variant=="r6"', {
305                     'cflags!': ['-mfp32'],
306                     'cflags': ['-mips32r6', '-Wa,-mips32r6'],
307                     'ldflags': [
308                       '-mips32r6',
309                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
310                       '-Wl,--rpath=$(LD_R_PATH)',
311                     ],
312                   }],
313                   ['mips_arch_variant=="r2"', {
314                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
315                   }],
316                   ['mips_arch_variant=="r1"', {
317                     'cflags!': ['-mfp64'],
318                     'cflags': ['-mips32', '-Wa,-mips32'],
319                   }],
320                   ['mips_arch_variant=="rx"', {
321                     'cflags!': ['-mfp64'],
322                     'cflags': ['-mips32', '-Wa,-mips32'],
323                   }],
324                 ],
325               }],
326             ],
327           }],
328           [ 'v8_can_use_fpu_instructions=="true"', {
329             'defines': [
330               'CAN_USE_FPU_INSTRUCTIONS',
331             ],
332           }],
333           [ 'v8_use_mips_abi_hardfloat=="true"', {
334             'defines': [
335               '__mips_hard_float=1',
336               'CAN_USE_FPU_INSTRUCTIONS',
337             ],
338           }, {
339             'defines': [
340               '__mips_soft_float=1'
341             ],
342           }],
343           ['mips_arch_variant=="rx"', {
344             'defines': [
345               '_MIPS_ARCH_MIPS32RX',
346               'FPU_MODE_FPXX',
347             ],
348           }],
349           ['mips_arch_variant=="r6"', {
350             'defines': [
351               '_MIPS_ARCH_MIPS32R6',
352               'FPU_MODE_FP64',
353             ],
354           }],
355           ['mips_arch_variant=="r2"', {
356             'defines': ['_MIPS_ARCH_MIPS32R2',],
357             'conditions': [
358               ['mips_fpu_mode=="fp64"', {
359                 'defines': ['FPU_MODE_FP64',],
360               }],
361               ['mips_fpu_mode=="fpxx"', {
362                 'defines': ['FPU_MODE_FPXX',],
363               }],
364               ['mips_fpu_mode=="fp32"', {
365                 'defines': ['FPU_MODE_FP32',],
366               }],
367             ],
368           }],
369           ['mips_arch_variant=="r1"', {
370             'defines': ['FPU_MODE_FP32',],
371           }],
372         ],
373       }],  # v8_target_arch=="mips"
374       ['v8_target_arch=="mipsel"', {
375         'defines': [
376           'V8_TARGET_ARCH_MIPS',
377         ],
378         'conditions': [
379           ['v8_target_arch==target_arch and android_webview_build==0', {
380             # Target built with a Mips CXX compiler.
381             'target_conditions': [
382               ['_toolset=="target"', {
383                 'cflags': ['-EL'],
384                 'ldflags': ['-EL'],
385                 'conditions': [
386                   [ 'v8_use_mips_abi_hardfloat=="true"', {
387                     'cflags': ['-mhard-float'],
388                     'ldflags': ['-mhard-float'],
389                   }, {
390                     'cflags': ['-msoft-float'],
391                     'ldflags': ['-msoft-float'],
392                   }],
393                   ['mips_fpu_mode=="fp64"', {
394                     'cflags': ['-mfp64'],
395                   }],
396                   ['mips_fpu_mode=="fpxx"', {
397                     'cflags': ['-mfpxx'],
398                   }],
399                   ['mips_fpu_mode=="fp32"', {
400                     'cflags': ['-mfp32'],
401                   }],
402                   ['mips_arch_variant=="r6"', {
403                     'cflags!': ['-mfp32'],
404                     'cflags': ['-mips32r6', '-Wa,-mips32r6'],
405                     'ldflags': [
406                       '-mips32r6',
407                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
408                       '-Wl,--rpath=$(LD_R_PATH)',
409                     ],
410                   }],
411                   ['mips_arch_variant=="r2"', {
412                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
413                   }],
414                   ['mips_arch_variant=="r1"', {
415                     'cflags!': ['-mfp64'],
416                     'cflags': ['-mips32', '-Wa,-mips32'],
417                   }],
418                   ['mips_arch_variant=="rx"', {
419                     'cflags!': ['-mfp64'],
420                     'cflags': ['-mips32', '-Wa,-mips32'],
421                   }],
422                   ['mips_arch_variant=="loongson"', {
423                     'cflags!': ['-mfp64'],
424                     'cflags': ['-mips3', '-Wa,-mips3'],
425                   }],
426                 ],
427               }],
428             ],
429           }],
430           [ 'v8_can_use_fpu_instructions=="true"', {
431             'defines': [
432               'CAN_USE_FPU_INSTRUCTIONS',
433             ],
434           }],
435           [ 'v8_use_mips_abi_hardfloat=="true"', {
436             'defines': [
437               '__mips_hard_float=1',
438               'CAN_USE_FPU_INSTRUCTIONS',
439             ],
440           }, {
441             'defines': [
442               '__mips_soft_float=1'
443             ],
444           }],
445           ['mips_arch_variant=="rx"', {
446             'defines': [
447               '_MIPS_ARCH_MIPS32RX',
448               'FPU_MODE_FPXX',
449             ],
450           }],
451           ['mips_arch_variant=="r6"', {
452             'defines': [
453               '_MIPS_ARCH_MIPS32R6',
454                'FPU_MODE_FP64',
455             ],
456           }],
457           ['mips_arch_variant=="r2"', {
458             'defines': ['_MIPS_ARCH_MIPS32R2',],
459             'conditions': [
460               ['mips_fpu_mode=="fp64"', {
461                 'defines': ['FPU_MODE_FP64',],
462               }],
463               ['mips_fpu_mode=="fpxx"', {
464                 'defines': ['FPU_MODE_FPXX',],
465               }],
466               ['mips_fpu_mode=="fp32"', {
467                 'defines': ['FPU_MODE_FP32',],
468               }],
469             ],
470           }],
471           ['mips_arch_variant=="r1"', {
472             'defines': ['FPU_MODE_FP32',],
473           }],
474           ['mips_arch_variant=="loongson"', {
475             'defines': [
476               '_MIPS_ARCH_LOONGSON',
477               'FPU_MODE_FP32',
478             ],
479           }],
480         ],
481       }],  # v8_target_arch=="mipsel"
482       ['v8_target_arch=="mips64el"', {
483         'defines': [
484           'V8_TARGET_ARCH_MIPS64',
485         ],
486         'conditions': [
487           ['v8_target_arch==target_arch and android_webview_build==0', {
488             # Target built with a Mips CXX compiler.
489             'target_conditions': [
490               ['_toolset=="target"', {
491                 'cflags': ['-EL'],
492                 'ldflags': ['-EL'],
493                 'conditions': [
494                   [ 'v8_use_mips_abi_hardfloat=="true"', {
495                     'cflags': ['-mhard-float'],
496                     'ldflags': ['-mhard-float'],
497                   }, {
498                     'cflags': ['-msoft-float'],
499                     'ldflags': ['-msoft-float'],
500                   }],
501                   ['mips_arch_variant=="r6"', {
502                     'cflags': ['-mips64r6', '-mabi=64', '-Wa,-mips64r6'],
503                     'ldflags': [
504                       '-mips64r6', '-mabi=64',
505                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
506                       '-Wl,--rpath=$(LD_R_PATH)',
507                     ],
508                   }],
509                   ['mips_arch_variant=="r2"', {
510                     'cflags': ['-mips64r2', '-mabi=64', '-Wa,-mips64r2'],
511                     'ldflags': [
512                       '-mips64r2', '-mabi=64',
513                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
514                       '-Wl,--rpath=$(LD_R_PATH)',
515                     ],
516                   }],
517                 ],
518               }],
519             ],
520           }],
521           [ 'v8_can_use_fpu_instructions=="true"', {
522             'defines': [
523               'CAN_USE_FPU_INSTRUCTIONS',
524             ],
525           }],
526           [ 'v8_use_mips_abi_hardfloat=="true"', {
527             'defines': [
528               '__mips_hard_float=1',
529               'CAN_USE_FPU_INSTRUCTIONS',
530             ],
531           }, {
532             'defines': [
533               '__mips_soft_float=1'
534             ],
535           }],
536           ['mips_arch_variant=="r6"', {
537             'defines': ['_MIPS_ARCH_MIPS64R6',],
538           }],
539           ['mips_arch_variant=="r2"', {
540             'defines': ['_MIPS_ARCH_MIPS64R2',],
541           }],
542         ],
543       }],  # v8_target_arch=="mips64el"
544       ['v8_target_arch=="x64"', {
545         'defines': [
546           'V8_TARGET_ARCH_X64',
547         ],
548         'xcode_settings': {
549           'ARCHS': [ 'x86_64' ],
550         },
551         'msvs_settings': {
552           'VCLinkerTool': {
553             'StackReserveSize': '2097152',
554           },
555         },
556         'msvs_configuration_platform': 'x64',
557       }],  # v8_target_arch=="x64"
558       ['v8_target_arch=="x32"', {
559         'defines': [
560           # x32 port shares the source code with x64 port.
561           'V8_TARGET_ARCH_X64',
562           'V8_TARGET_ARCH_32_BIT',
563         ],
564         'cflags': [
565           '-mx32',
566           # Inhibit warning if long long type is used.
567           '-Wno-long-long',
568         ],
569         'ldflags': [
570           '-mx32',
571         ],
572       }],  # v8_target_arch=="x32"
573       ['OS=="win"', {
574         'defines': [
575           'WIN32',
576         ],
577         # 4351: VS 2005 and later are warning us that they've fixed a bug
578         #       present in VS 2003 and earlier.
579         'msvs_disabled_warnings': [4351],
580         'msvs_configuration_attributes': {
581           'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
582           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
583           'CharacterSet': '1',
584         },
585       }],
586       ['OS=="win" and v8_target_arch=="ia32"', {
587         'msvs_settings': {
588           'VCCLCompilerTool': {
589             # Ensure no surprising artifacts from 80bit double math with x86.
590             'AdditionalOptions': ['/arch:SSE2'],
591           },
592         },
593       }],
594       ['OS=="win" and v8_enable_prof==1', {
595         'msvs_settings': {
596           'VCLinkerTool': {
597             'GenerateMapFile': 'true',
598           },
599         },
600       }],
601       ['(OS=="linux" or OS=="freebsd"  or OS=="openbsd" or OS=="solaris" \
602          or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
603         (v8_target_arch=="arm" or v8_target_arch=="ia32" or \
604          v8_target_arch=="x87" or v8_target_arch=="mips" or \
605          v8_target_arch=="mipsel")', {
606         'target_conditions': [
607           ['_toolset=="host"', {
608             'conditions': [
609               ['host_cxx_is_biarch==1', {
610                 'cflags': [ '-m32' ],
611                 'ldflags': [ '-m32' ]
612               }],
613             ],
614             'xcode_settings': {
615               'ARCHS': [ 'i386' ],
616             },
617           }],
618           ['_toolset=="target"', {
619             'conditions': [
620               ['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', {
621                 'cflags': [ '-m32' ],
622                 'ldflags': [ '-m32' ],
623               }],
624             ],
625             'xcode_settings': {
626               'ARCHS': [ 'i386' ],
627             },
628           }],
629         ],
630       }],
631       ['(OS=="linux" or OS=="android") and \
632         (v8_target_arch=="x64" or v8_target_arch=="arm64")', {
633         'target_conditions': [
634           ['_toolset=="host"', {
635             'conditions': [
636               ['host_cxx_is_biarch==1', {
637                 'cflags': [ '-m64' ],
638                 'ldflags': [ '-m64' ]
639               }],
640              ],
641            }],
642            ['_toolset=="target"', {
643              'conditions': [
644                ['target_cxx_is_biarch==1', {
645                  'cflags': [ '-m64' ],
646                  'ldflags': [ '-m64' ],
647                }],
648              ]
649            }],
650          ],
651       }],
652       ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
653          or OS=="netbsd" or OS=="qnx"', {
654         'conditions': [
655           [ 'v8_no_strict_aliasing==1', {
656             'cflags': [ '-fno-strict-aliasing' ],
657           }],
658         ],  # conditions
659       }],
660       ['OS=="solaris"', {
661         'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
662       }],
663       ['OS=="freebsd" or OS=="openbsd"', {
664         'cflags': [ '-I/usr/local/include' ],
665       }],
666       ['OS=="netbsd"', {
667         'cflags': [ '-I/usr/pkg/include' ],
668       }],
669     ],  # conditions
670     'configurations': {
671       # Abstract configuration for v8_optimized_debug == 0.
672       'DebugBase0': {
673         'abstract': 1,
674         'msvs_settings': {
675           'VCCLCompilerTool': {
676             'Optimization': '0',
677             'conditions': [
678               ['component=="shared_library"', {
679                 'RuntimeLibrary': '3',  # /MDd
680               }, {
681                 'RuntimeLibrary': '1',  # /MTd
682               }],
683             ],
684           },
685           'VCLinkerTool': {
686             'LinkIncremental': '2',
687           },
688         },
689         'conditions': [
690           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
691             OS=="qnx"', {
692             'cflags!': [
693               '-O0',
694               '-O3',
695               '-O2',
696               '-O1',
697               '-Os',
698             ],
699             'cflags': [
700               '-fdata-sections',
701               '-ffunction-sections',
702             ],
703           }],
704           ['OS=="mac"', {
705             'xcode_settings': {
706                'GCC_OPTIMIZATION_LEVEL': '0',  # -O0
707             },
708           }],
709         ],
710       },  # DebugBase0
711       # Abstract configuration for v8_optimized_debug == 1.
712       'DebugBase1': {
713         'abstract': 1,
714         'msvs_settings': {
715           'VCCLCompilerTool': {
716             'Optimization': '1',
717             'InlineFunctionExpansion': '2',
718             'EnableIntrinsicFunctions': 'true',
719             'FavorSizeOrSpeed': '0',
720             'StringPooling': 'true',
721             'BasicRuntimeChecks': '0',
722             'conditions': [
723               ['component=="shared_library"', {
724                 'RuntimeLibrary': '3',  # /MDd
725               }, {
726                 'RuntimeLibrary': '1',  # /MTd
727               }],
728             ],
729           },
730           'VCLinkerTool': {
731             'LinkIncremental': '2',
732           },
733         },
734         'conditions': [
735           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
736             OS=="qnx"', {
737             'cflags!': [
738               '-O0',
739               '-O3', # TODO(2807) should be -O1.
740               '-O2',
741               '-Os',
742             ],
743             'cflags': [
744               '-fdata-sections',
745               '-ffunction-sections',
746               '-O1', # TODO(2807) should be -O3.
747             ],
748             'conditions': [
749               ['gcc_version==44 and clang==0', {
750                 'cflags': [
751                   # Avoid crashes with gcc 4.4 in the v8 test suite.
752                   '-fno-tree-vrp',
753                 ],
754               }],
755             ],
756           }],
757           ['OS=="mac"', {
758             'xcode_settings': {
759                'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
760                'GCC_STRICT_ALIASING': 'YES',
761             },
762           }],
763         ],
764       },  # DebugBase1
765       # Abstract configuration for v8_optimized_debug == 2.
766       'DebugBase2': {
767         'abstract': 1,
768         'msvs_settings': {
769           'VCCLCompilerTool': {
770             'Optimization': '2',
771             'InlineFunctionExpansion': '2',
772             'EnableIntrinsicFunctions': 'true',
773             'FavorSizeOrSpeed': '0',
774             'StringPooling': 'true',
775             'BasicRuntimeChecks': '0',
776             'conditions': [
777               ['component=="shared_library"', {
778                 'RuntimeLibrary': '3',  #/MDd
779               }, {
780                 'RuntimeLibrary': '1',  #/MTd
781               }],
782               ['v8_target_arch=="x64"', {
783                 # TODO(2207): remove this option once the bug is fixed.
784                 'WholeProgramOptimization': 'true',
785               }],
786             ],
787           },
788           'VCLinkerTool': {
789             'LinkIncremental': '1',
790             'OptimizeReferences': '2',
791             'EnableCOMDATFolding': '2',
792           },
793         },
794         'conditions': [
795           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
796             OS=="qnx"', {
797             'cflags!': [
798               '-O0',
799               '-O1',
800               '-Os',
801             ],
802             'cflags': [
803               '-fdata-sections',
804               '-ffunction-sections',
805             ],
806             'defines': [
807               'OPTIMIZED_DEBUG'
808             ],
809             'conditions': [
810               # TODO(crbug.com/272548): Avoid -O3 in NaCl
811               ['nacl_target_arch=="none"', {
812                 'cflags': ['-O3'],
813                 'cflags!': ['-O2'],
814                 }, {
815                 'cflags': ['-O2'],
816                 'cflags!': ['-O3'],
817               }],
818               ['gcc_version==44 and clang==0', {
819                 'cflags': [
820                   # Avoid crashes with gcc 4.4 in the v8 test suite.
821                   '-fno-tree-vrp',
822                 ],
823               }],
824             ],
825           }],
826           ['OS=="mac"', {
827             'xcode_settings': {
828               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
829               'GCC_STRICT_ALIASING': 'YES',
830             },
831           }],
832         ],
833       },  # DebugBase2
834       # Common settings for the Debug configuration.
835       'DebugBaseCommon': {
836         'abstract': 1,
837         'defines': [
838           'ENABLE_DISASSEMBLER',
839           'V8_ENABLE_CHECKS',
840           'OBJECT_PRINT',
841           'VERIFY_HEAP',
842           'DEBUG'
843         ],
844         'conditions': [
845           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
846             OS=="qnx"', {
847             'cflags': [ '-Woverloaded-virtual', '<(wno_array_bounds)', ],
848           }],
849           ['OS=="linux" and v8_enable_backtrace==1', {
850             # Support for backtrace_symbols.
851             'ldflags': [ '-rdynamic' ],
852           }],
853           ['OS=="android"', {
854             'variables': {
855               'android_full_debug%': 1,
856             },
857             'conditions': [
858               ['android_full_debug==0', {
859                 # Disable full debug if we want a faster v8 in a debug build.
860                 # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
861                 'defines!': [
862                   'DEBUG',
863                 ],
864               }],
865             ],
866           }],
867         ],
868       },  # DebugBaseCommon
869       'Debug': {
870         'inherit_from': ['DebugBaseCommon'],
871         'conditions': [
872           ['v8_optimized_debug==0', {
873             'inherit_from': ['DebugBase0'],
874           }],
875           ['v8_optimized_debug==1', {
876             'inherit_from': ['DebugBase1'],
877           }],
878           ['v8_optimized_debug==2', {
879             'inherit_from': ['DebugBase2'],
880           }],
881         ],
882       },  # Debug
883       'Release': {
884         'conditions': [
885           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
886             'cflags!': [
887               '-Os',
888             ],
889             'cflags': [
890               '-fdata-sections',
891               '-ffunction-sections',
892               '<(wno_array_bounds)',
893             ],
894             'conditions': [
895               [ 'gcc_version==44 and clang==0', {
896                 'cflags': [
897                   # Avoid crashes with gcc 4.4 in the v8 test suite.
898                   '-fno-tree-vrp',
899                 ],
900               }],
901               # TODO(crbug.com/272548): Avoid -O3 in NaCl
902               ['nacl_target_arch=="none"', {
903                 'cflags': ['-O3'],
904                 'cflags!': ['-O2'],
905               }, {
906                 'cflags': ['-O2'],
907                 'cflags!': ['-O3'],
908               }],
909             ],
910           }],
911           ['OS=="android"', {
912             'cflags!': [
913               '-O3',
914               '-Os',
915             ],
916             'cflags': [
917               '-fdata-sections',
918               '-ffunction-sections',
919               '-O2',
920             ],
921             'conditions': [
922               [ 'gcc_version==44 and clang==0', {
923                 'cflags': [
924                   # Avoid crashes with gcc 4.4 in the v8 test suite.
925                   '-fno-tree-vrp',
926                 ],
927               }],
928             ],
929           }],
930           ['OS=="mac"', {
931             'xcode_settings': {
932               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
933
934               # -fstrict-aliasing.  Mainline gcc
935               # enables this at -O2 and above,
936               # but Apple gcc does not unless it
937               # is specified explicitly.
938               'GCC_STRICT_ALIASING': 'YES',
939             },
940           }],  # OS=="mac"
941           ['OS=="win"', {
942             'msvs_settings': {
943               'VCCLCompilerTool': {
944                 'Optimization': '2',
945                 'InlineFunctionExpansion': '2',
946                 'EnableIntrinsicFunctions': 'true',
947                 'FavorSizeOrSpeed': '0',
948                 'StringPooling': 'true',
949                 'conditions': [
950                   ['component=="shared_library"', {
951                     'RuntimeLibrary': '2',  #/MD
952                   }, {
953                     'RuntimeLibrary': '0',  #/MT
954                   }],
955                   ['v8_target_arch=="x64"', {
956                     # TODO(2207): remove this option once the bug is fixed.
957                     'WholeProgramOptimization': 'true',
958                   }],
959                 ],
960               },
961               'VCLinkerTool': {
962                 'LinkIncremental': '1',
963                 'OptimizeReferences': '2',
964                 'EnableCOMDATFolding': '2',
965               },
966             },
967           }],  # OS=="win"
968         ],  # conditions
969       },  # Release
970     },  # configurations
971   },  # target_defaults
972 }