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