• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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              # Enable feedback-directed optimisation when building in android.
625              [ 'android_webview_build == 1', {
626                'aosp_build_settings': {
627                  'LOCAL_FDO_SUPPORT': 'true',
628                },
629              }],
630            ],
631            'xcode_settings': {
632              'ARCHS': [ 'i386' ],
633            },
634          }],
635        ],
636      }],
637      ['(OS=="linux" or OS=="android") and \
638        (v8_target_arch=="x64" or v8_target_arch=="arm64")', {
639        'target_conditions': [
640          ['_toolset=="host"', {
641            'conditions': [
642              ['host_cxx_is_biarch==1', {
643                'cflags': [ '-m64' ],
644                'ldflags': [ '-m64' ]
645              }],
646             ],
647           }],
648           ['_toolset=="target"', {
649             'conditions': [
650               ['target_cxx_is_biarch==1', {
651                 'cflags': [ '-m64' ],
652                 'ldflags': [ '-m64' ],
653               }],
654               # Enable feedback-directed optimisation when building in android.
655               [ 'android_webview_build == 1', {
656                 'aosp_build_settings': {
657                   'LOCAL_FDO_SUPPORT': 'true',
658                 },
659               }],
660             ]
661           }],
662         ],
663      }],
664      ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
665         or OS=="netbsd" or OS=="qnx"', {
666        'conditions': [
667          [ 'v8_no_strict_aliasing==1', {
668            'cflags': [ '-fno-strict-aliasing' ],
669          }],
670        ],  # conditions
671      }],
672      ['OS=="solaris"', {
673        'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
674      }],
675      ['OS=="freebsd" or OS=="openbsd"', {
676        'cflags': [ '-I/usr/local/include' ],
677      }],
678      ['OS=="netbsd"', {
679        'cflags': [ '-I/usr/pkg/include' ],
680      }],
681    ],  # conditions
682    'configurations': {
683      # Abstract configuration for v8_optimized_debug == 0.
684      'DebugBase0': {
685        'abstract': 1,
686        'msvs_settings': {
687          'VCCLCompilerTool': {
688            'Optimization': '0',
689            'conditions': [
690              ['component=="shared_library"', {
691                'RuntimeLibrary': '3',  # /MDd
692              }, {
693                'RuntimeLibrary': '1',  # /MTd
694              }],
695            ],
696          },
697          'VCLinkerTool': {
698            'LinkIncremental': '2',
699          },
700        },
701        'conditions': [
702          ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
703            OS=="qnx"', {
704            'cflags!': [
705              '-O0',
706              '-O3',
707              '-O2',
708              '-O1',
709              '-Os',
710            ],
711            'cflags': [
712              '-fdata-sections',
713              '-ffunction-sections',
714            ],
715          }],
716          ['OS=="mac"', {
717            'xcode_settings': {
718               'GCC_OPTIMIZATION_LEVEL': '0',  # -O0
719            },
720          }],
721        ],
722      },  # DebugBase0
723      # Abstract configuration for v8_optimized_debug == 1.
724      'DebugBase1': {
725        'abstract': 1,
726        'msvs_settings': {
727          'VCCLCompilerTool': {
728            'Optimization': '1',
729            'InlineFunctionExpansion': '2',
730            'EnableIntrinsicFunctions': 'true',
731            'FavorSizeOrSpeed': '0',
732            'StringPooling': 'true',
733            'BasicRuntimeChecks': '0',
734            'conditions': [
735              ['component=="shared_library"', {
736                'RuntimeLibrary': '3',  # /MDd
737              }, {
738                'RuntimeLibrary': '1',  # /MTd
739              }],
740            ],
741          },
742          'VCLinkerTool': {
743            'LinkIncremental': '2',
744          },
745        },
746        'conditions': [
747          ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
748            OS=="qnx"', {
749            'cflags!': [
750              '-O0',
751              '-O3', # TODO(2807) should be -O1.
752              '-O2',
753              '-Os',
754            ],
755            'cflags': [
756              '-fdata-sections',
757              '-ffunction-sections',
758              '-O1', # TODO(2807) should be -O3.
759            ],
760            'conditions': [
761              ['gcc_version==44 and clang==0', {
762                'cflags': [
763                  # Avoid crashes with gcc 4.4 in the v8 test suite.
764                  '-fno-tree-vrp',
765                ],
766              }],
767            ],
768          }],
769          ['OS=="mac"', {
770            'xcode_settings': {
771               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
772               'GCC_STRICT_ALIASING': 'YES',
773            },
774          }],
775        ],
776      },  # DebugBase1
777      # Abstract configuration for v8_optimized_debug == 2.
778      'DebugBase2': {
779        'abstract': 1,
780        'msvs_settings': {
781          'VCCLCompilerTool': {
782            'Optimization': '2',
783            'InlineFunctionExpansion': '2',
784            'EnableIntrinsicFunctions': 'true',
785            'FavorSizeOrSpeed': '0',
786            'StringPooling': 'true',
787            'BasicRuntimeChecks': '0',
788            'conditions': [
789              ['component=="shared_library"', {
790                'RuntimeLibrary': '3',  #/MDd
791              }, {
792                'RuntimeLibrary': '1',  #/MTd
793              }],
794              ['v8_target_arch=="x64"', {
795                # TODO(2207): remove this option once the bug is fixed.
796                'WholeProgramOptimization': 'true',
797              }],
798            ],
799          },
800          'VCLinkerTool': {
801            'LinkIncremental': '1',
802            'OptimizeReferences': '2',
803            'EnableCOMDATFolding': '2',
804          },
805        },
806        'conditions': [
807          ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
808            OS=="qnx"', {
809            'cflags!': [
810              '-O0',
811              '-O1',
812              '-Os',
813            ],
814            'cflags': [
815              '-fdata-sections',
816              '-ffunction-sections',
817            ],
818            'defines': [
819              'OPTIMIZED_DEBUG'
820            ],
821            'conditions': [
822              # TODO(crbug.com/272548): Avoid -O3 in NaCl
823              ['nacl_target_arch=="none"', {
824                'cflags': ['-O3'],
825                'cflags!': ['-O2'],
826                }, {
827                'cflags': ['-O2'],
828                'cflags!': ['-O3'],
829              }],
830              ['gcc_version==44 and clang==0', {
831                'cflags': [
832                  # Avoid crashes with gcc 4.4 in the v8 test suite.
833                  '-fno-tree-vrp',
834                ],
835              }],
836            ],
837          }],
838          ['OS=="mac"', {
839            'xcode_settings': {
840              'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
841              'GCC_STRICT_ALIASING': 'YES',
842            },
843          }],
844        ],
845      },  # DebugBase2
846      # Common settings for the Debug configuration.
847      'DebugBaseCommon': {
848        'abstract': 1,
849        'defines': [
850          'ENABLE_DISASSEMBLER',
851          'V8_ENABLE_CHECKS',
852          'OBJECT_PRINT',
853          'VERIFY_HEAP',
854          'DEBUG'
855        ],
856        'conditions': [
857          ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
858            OS=="qnx"', {
859            'cflags': [ '-Woverloaded-virtual', '<(wno_array_bounds)', ],
860          }],
861          ['OS=="linux" and v8_enable_backtrace==1', {
862            # Support for backtrace_symbols.
863            'ldflags': [ '-rdynamic' ],
864          }],
865          ['OS=="android"', {
866            'variables': {
867              'android_full_debug%': 1,
868            },
869            'conditions': [
870              ['android_full_debug==0', {
871                # Disable full debug if we want a faster v8 in a debug build.
872                # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
873                'defines!': [
874                  'DEBUG',
875                ],
876              }],
877            ],
878          }],
879        ],
880      },  # DebugBaseCommon
881      'Debug': {
882        'inherit_from': ['DebugBaseCommon'],
883        'conditions': [
884          ['v8_optimized_debug==0', {
885            'inherit_from': ['DebugBase0'],
886          }],
887          ['v8_optimized_debug==1', {
888            'inherit_from': ['DebugBase1'],
889          }],
890          ['v8_optimized_debug==2', {
891            'inherit_from': ['DebugBase2'],
892          }],
893        ],
894      },  # Debug
895      'Release': {
896        'conditions': [
897          ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
898            'cflags!': [
899              '-Os',
900            ],
901            'cflags': [
902              '-fdata-sections',
903              '-ffunction-sections',
904              '<(wno_array_bounds)',
905            ],
906            'conditions': [
907              [ 'gcc_version==44 and clang==0', {
908                'cflags': [
909                  # Avoid crashes with gcc 4.4 in the v8 test suite.
910                  '-fno-tree-vrp',
911                ],
912              }],
913              # TODO(crbug.com/272548): Avoid -O3 in NaCl
914              ['nacl_target_arch=="none"', {
915                'cflags': ['-O3'],
916                'cflags!': ['-O2'],
917              }, {
918                'cflags': ['-O2'],
919                'cflags!': ['-O3'],
920              }],
921            ],
922          }],
923          ['OS=="android"', {
924            'cflags!': [
925              '-O3',
926              '-Os',
927            ],
928            'cflags': [
929              '-fdata-sections',
930              '-ffunction-sections',
931              '-O2',
932            ],
933            'conditions': [
934              [ 'gcc_version==44 and clang==0', {
935                'cflags': [
936                  # Avoid crashes with gcc 4.4 in the v8 test suite.
937                  '-fno-tree-vrp',
938                ],
939              }],
940            ],
941          }],
942          ['OS=="mac"', {
943            'xcode_settings': {
944              'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
945
946              # -fstrict-aliasing.  Mainline gcc
947              # enables this at -O2 and above,
948              # but Apple gcc does not unless it
949              # is specified explicitly.
950              'GCC_STRICT_ALIASING': 'YES',
951            },
952          }],  # OS=="mac"
953          ['OS=="win"', {
954            'msvs_settings': {
955              'VCCLCompilerTool': {
956                'Optimization': '2',
957                'InlineFunctionExpansion': '2',
958                'EnableIntrinsicFunctions': 'true',
959                'FavorSizeOrSpeed': '0',
960                'StringPooling': 'true',
961                'conditions': [
962                  ['component=="shared_library"', {
963                    'RuntimeLibrary': '2',  #/MD
964                  }, {
965                    'RuntimeLibrary': '0',  #/MT
966                  }],
967                  ['v8_target_arch=="x64"', {
968                    # TODO(2207): remove this option once the bug is fixed.
969                    'WholeProgramOptimization': 'true',
970                  }],
971                ],
972              },
973              'VCLinkerTool': {
974                'LinkIncremental': '1',
975                'OptimizeReferences': '2',
976                'EnableCOMDATFolding': '2',
977              },
978            },
979          }],  # OS=="win"
980        ],  # conditions
981      },  # Release
982    },  # configurations
983  },  # target_defaults
984}
985