WebKit merge 81877:81934.
[chromium-blink-merge.git] / build / common.gypi
blob955ff11277eec300c0b3daa568c86915d74bc3f3
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 # IMPORTANT:
6 # Please don't directly include this file if you are building via gyp_chromium,
7 # since gyp_chromium is automatically forcing its inclusion.
9   # Variables expected to be overriden on the GYP command line (-D) or by
10   # ~/.gyp/include.gypi.
11   'variables': {
12     # Putting a variables dict inside another variables dict looks kind of
13     # weird.  This is done so that 'host_arch', 'chromeos', etc are defined as
14     # variables within the outer variables dict here.  This is necessary
15     # to get these variables defined for the conditions within this variables
16     # dict that operate on these variables (e.g., for setting 'toolkit_views',
17     # we need to have 'chromeos' already set).
18     'variables': {
19       'variables': {
20         'variables': {
21           # Whether we're building a ChromeOS build.
22           'chromeos%': 0,
24           # Disable touch support by default.
25           'touchui%': 0,
27           # Disable file manager component extension by default.
28           'file_manager_extension%': 0,
29         },
30         # Copy conditionally-set variables out one scope.
31         'chromeos%': '<(chromeos)',
32         'touchui%': '<(touchui)',
33         'file_manager_extension%': '<(file_manager_extension)',
35         # To do a shared build on linux we need to be able to choose between
36         # type static_library and shared_library. We default to doing a static
37         # build but you can override this with "gyp -Dlibrary=shared_library"
38         # or you can add the following line (without the #) to
39         # ~/.gyp/include.gypi {'variables': {'library': 'shared_library'}}
40         # to compile as shared by default
41         'library%': 'static_library',
43         # Compute the architecture that we're building on.
44         'conditions': [
45           [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
46             # This handles the Linux platforms we generally deal with. Anything
47             # else gets passed through, which probably won't work very well; such
48             # hosts should pass an explicit target_arch to gyp.
49             'host_arch%':
50               '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/")',
51           }, {  # OS!="linux"
52             'host_arch%': 'ia32',
53           }],
55           # Set default value of toolkit_views on for Windows, Chrome OS
56           # and the touch UI.
57           ['OS=="win" or chromeos==1 or touchui==1', {
58             'toolkit_views%': 1,
59           }, {
60             'toolkit_views%': 0,
61           }],
62         ],
63       },
65       # Copy conditionally-set variables out one scope.
66       'chromeos%': '<(chromeos)',
67       'touchui%': '<(touchui)',
68       'file_manager_extension%': '<(file_manager_extension)',
69       'host_arch%': '<(host_arch)',
70       'library%': '<(library)',
71       'toolkit_views%': '<(toolkit_views)',
73       # Override branding to select the desired branding flavor.
74       'branding%': 'Chromium',
76       # Override buildtype to select the desired build flavor.
77       # Dev - everyday build for development/testing
78       # Official - release build (generally implies additional processing)
79       # TODO(mmoss) Once 'buildtype' is fully supported (e.g. Windows gyp
80       # conversion is done), some of the things which are now controlled by
81       # 'branding', such as symbol generation, will need to be refactored based
82       # on 'buildtype' (i.e. we don't care about saving symbols for non-Official
83       # builds).
84       'buildtype%': 'Dev',
86       # Default architecture we're building for is the architecture we're
87       # building on.
88       'target_arch%': '<(host_arch)',
90       # This variable tells WebCore.gyp and JavaScriptCore.gyp whether they are
91       # are built under a chromium full build (1) or a webkit.org chromium
92       # build (0).
93       'inside_chromium_build%': 1,
95       # Set to 1 to enable fast builds. It disables debug info for fastest
96       # compilation.
97       'fastbuild%': 0,
99       # Python version.
100       'python_ver%': '2.5',
102       # Set ARM-v7 compilation flags
103       'armv7%': 0,
105       # Set Neon compilation flags (only meaningful if armv7==1).
106       'arm_neon%': 1,
108       # The system root for cross-compiles. Default: none.
109       'sysroot%': '',
111       # On Linux, we build with sse2 for Chromium builds.
112       'disable_sse2%': 0,
114       # Use libjpeg-turbo as the JPEG codec used by Chromium.
115       'use_libjpeg_turbo%': 1,
117       # Variable 'component' is for cases where we would like to build some
118       # components as dynamic shared libraries but still need variable
119       # 'library' for static libraries.
120       # By default, component is set to whatever library is set to and
121       # it can be overriden by the GYP command line or by ~/.gyp/include.gypi.
122       'component%': '<(library)',
124       # Set to select the Title Case versions of strings in GRD files.
125       'use_titlecase_in_grd_files%': 0,
127       # Use translations provided by volunteers at launchpad.net.  This
128       # currently only works on Linux.
129       'use_third_party_translations%': 0,
131       # Remoting compilation is enabled by default. Set to 0 to disable.
132       'remoting%': 1,
134       # If this is set, the clang plugins used on the buildbot will be used.
135       # Run tools/clang/scripts/update.sh to make sure they are compiled.
136       # This causes 'clang_chrome_plugins_flags' to be set.
137       # Has no effect if 'clang' is not set as well.
138       'clang_use_chrome_plugins%': 0,
140       'conditions': [
141         # A flag to enable or disable our compile-time dependency
142         # on gnome-keyring. If that dependency is disabled, no gnome-keyring
143         # support will be available. This option is useful
144         # for Linux distributions.
145         ['chromeos==1', {
146           'use_gnome_keyring%': 0,
147         }, {
148           'use_gnome_keyring%': 1,
149         }],
151         # Set to 1 compile with -fPIC cflag on linux. This is a must for shared
152         # libraries on linux x86-64 and arm.
153         ['host_arch=="ia32"', {
154           'linux_fpic%': 0,
155         }, {
156           'linux_fpic%': 1,
157         }],
159         ['toolkit_views==0 or OS=="mac"', {
160           # GTK+ and Mac wants Title Case strings
161           'use_titlecase_in_grd_files%': 1,
162         }],
164         # Enable some hacks to support Flapper only on Chrome OS.
165         ['chromeos==1', {
166           'enable_flapper_hacks%': 1,
167         }, {
168           'enable_flapper_hacks%': 0,
169         }],
170       ],
171     },
173     # Copy conditionally-set variables out one scope.
174     'branding%': '<(branding)',
175     'buildtype%': '<(buildtype)',
176     'target_arch%': '<(target_arch)',
177     'host_arch%': '<(host_arch)',
178     'toolkit_views%': '<(toolkit_views)',
179     'use_gnome_keyring%': '<(use_gnome_keyring)',
180     'linux_fpic%': '<(linux_fpic)',
181     'enable_flapper_hacks%': '<(enable_flapper_hacks)',
182     'chromeos%': '<(chromeos)',
183     'touchui%': '<(touchui)',
184     'file_manager_extension%': '<(file_manager_extension)',
185     'inside_chromium_build%': '<(inside_chromium_build)',
186     'fastbuild%': '<(fastbuild)',
187     'python_ver%': '<(python_ver)',
188     'armv7%': '<(armv7)',
189     'arm_neon%': '<(arm_neon)',
190     'sysroot%': '<(sysroot)',
191     'disable_sse2%': '<(disable_sse2)',
192     'library%': '<(library)',
193     'component%': '<(component)',
194     'use_titlecase_in_grd_files%': '<(use_titlecase_in_grd_files)',
195     'use_third_party_translations%': '<(use_third_party_translations)',
196     'remoting%': '<(remoting)',
197     'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
199     # The release channel that this build targets. This is used to restrict
200     # channel-specific build options, like which installer packages to create.
201     # The default is 'all', which does no channel-specific filtering.
202     'channel%': 'all',
204     # Override chromium_mac_pch and set it to 0 to suppress the use of
205     # precompiled headers on the Mac.  Prefix header injection may still be
206     # used, but prefix headers will not be precompiled.  This is useful when
207     # using distcc to distribute a build to compile slaves that don't
208     # share the same compiler executable as the system driving the compilation,
209     # because precompiled headers rely on pointers into a specific compiler
210     # executable's image.  Setting this to 0 is needed to use an experimental
211     # Linux-Mac cross compiler distcc farm.
212     'chromium_mac_pch%': 1,
214     # Mac OS X SDK and deployment target support.
215     # The SDK identifies the version of the system headers that will be used,
216     # and corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time macro.
217     # "Maximum allowed" refers to the operating system version whose APIs are
218     # available in the headers.
219     # The deployment target identifies the minimum system version that the
220     # built products are expected to function on.  It corresponds to the
221     # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.
222     # To ensure these macros are available, #include <AvailabilityMacros.h>.
223     # Additional documentation on these macros is available at
224     # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
225     # Chrome normally builds with the Mac OS X 10.5 SDK and sets the
226     # deployment target to 10.5.  Other projects, such as O3D, may override
227     # these defaults.
228     'mac_sdk%': '10.5',
229     'mac_deployment_target%': '10.5',
231     # Set to 1 to enable code coverage.  In addition to build changes
232     # (e.g. extra CFLAGS), also creates a new target in the src/chrome
233     # project file called "coverage".
234     # Currently ignored on Windows.
235     'coverage%': 0,
237     # Overridable specification for potential use of alternative
238     # JavaScript engines.
239     'javascript_engine%': 'v8',
241     # Although base/allocator lets you select a heap library via an
242     # environment variable, the libcmt shim it uses sometimes gets in
243     # the way.  To disable it entirely, and switch to normal msvcrt, do e.g.
244     #  'win_use_allocator_shim': 0,
245     #  'win_release_RuntimeLibrary': 2
246     # to ~/.gyp/include.gypi, gclient runhooks --force, and do a release build.
247     'win_use_allocator_shim%': 1, # 1 = shim allocator via libcmt; 0 = msvcrt
249     # Whether usage of OpenMAX is enabled.
250     'enable_openmax%': 0,
252     # Whether proprietary audio/video codecs are assumed to be included with
253     # this build (only meaningful if branding!=Chrome).
254     'proprietary_codecs%': 0,
256     # TODO(bradnelson): eliminate this when possible.
257     # To allow local gyp files to prevent release.vsprops from being included.
258     # Yes(1) means include release.vsprops.
259     # Once all vsprops settings are migrated into gyp, this can go away.
260     'msvs_use_common_release%': 1,
262     # TODO(bradnelson): eliminate this when possible.
263     # To allow local gyp files to override additional linker options for msvs.
264     # Yes(1) means set use the common linker options.
265     'msvs_use_common_linker_extras%': 1,
267     # TODO(sgk): eliminate this if possible.
268     # It would be nicer to support this via a setting in 'target_defaults'
269     # in chrome/app/locales/locales.gypi overriding the setting in the
270     # 'Debug' configuration in the 'target_defaults' dict below,
271     # but that doesn't work as we'd like.
272     'msvs_debug_link_incremental%': '2',
274     # Needed for some of the largest modules.
275     'msvs_debug_link_nonincremental%': '1',
277     # This is the location of the sandbox binary. Chrome looks for this before
278     # running the zygote process. If found, and SUID, it will be used to
279     # sandbox the zygote process and, thus, all renderer processes.
280     'linux_sandbox_path%': '',
282     # Set this to true to enable SELinux support.
283     'selinux%': 0,
285     # Set this to true when building with Clang.
286     # See http://code.google.com/p/chromium/wiki/Clang for details.
287     # TODO: eventually clang should behave identically to gcc, and this
288     # won't be necessary.
289     'clang%': 0,
291     # These two variables can be set in GYP_DEFINES while running
292     # |gclient runhooks| to let clang run a plugin in every compilation.
293     # Only has an effect if 'clang=1' is in GYP_DEFINES as well.
294     # Example:
295     #     GYP_DEFINES='clang=1 clang_load=/abs/path/to/libPrintFunctionNames.dylib clang_add_plugin=print-fns' gclient runhooks
297     'clang_load%': '',
298     'clang_add_plugin%': '',
300     # Enable sampling based profiler.
301     # See http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html
302     'profiling%': '0',
304     # Override whether we should use Breakpad on Linux. I.e. for Chrome bot.
305     'linux_breakpad%': 0,
306     # And if we want to dump symbols for Breakpad-enabled builds.
307     'linux_dump_symbols%': 0,
308     # And if we want to strip the binary after dumping symbols.
309     'linux_strip_binary%': 0,
310     # Strip the test binaries needed for Linux reliability tests.
311     'linux_strip_reliability_tests%': 0,
313     # Enable TCMalloc.
314     'linux_use_tcmalloc%': 1,
316     # Disable TCMalloc's debugallocation.
317     'linux_use_debugallocation%': 0,
319     # Disable TCMalloc's heapchecker.
320     'linux_use_heapchecker%': 0,
322     # Disable shadow stack keeping used by heapcheck to unwind the stacks
323     # better.
324     'linux_keep_shadow_stacks%': 0,
326     # Set to 1 to turn on seccomp sandbox by default.
327     # (Note: this is ignored for official builds.)
328     'linux_use_seccomp_sandbox%': 0,
330     # Set to 1 to link against libgnome-keyring instead of using dlopen().
331     'linux_link_gnome_keyring%': 0,
333     # Used to disable Native Client at compile time, for platforms where it
334     # isn't supported
335     'disable_nacl%': 0,
337     # Set Thumb compilation flags.
338     'arm_thumb%': 0,
340     # Set ARM fpu compilation flags (only meaningful if armv7==1 and
341     # arm_neon==0).
342     'arm_fpu%': 'vfpv3',
344     # Enable new NPDevice API.
345     'enable_new_npdevice_api%': 0,
347     # Enable EGLImage support in OpenMAX
348     'enable_eglimage%': 1,
350     # Enable a variable used elsewhere throughout the GYP files to determine
351     # whether to compile in the sources for the GPU plugin / process.
352     'enable_gpu%': 1,
354     # Use OpenSSL instead of NSS. Under development: see http://crbug.com/62803
355     'use_openssl%': 0,
357     # .gyp files or targets should set chromium_code to 1 if they build
358     # Chromium-specific code, as opposed to external code.  This variable is
359     # used to control such things as the set of warnings to enable, and
360     # whether warnings are treated as errors.
361     'chromium_code%': 0,
363     # Set to 1 to compile with the built in pdf viewer.
364     'internal_pdf%': 0,
366     # This allows to use libcros from the current system, ie. /usr/lib/
367     # The cros_api will be pulled in as a static library, and all headers
368     # from the system include dirs.
369     'system_libcros%': 0,
371     # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_'
372     # so Cocoa is happy (http://crbug.com/20441).
373     'locales': [
374       'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
375       'en-US', 'es-419', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'he',
376       'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
377       'ml', 'mr', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru',
378       'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
379       'vi', 'zh-CN', 'zh-TW',
380     ],
382     'grit_defines': [],
384     # Use Harfbuzz-NG instead of Harfbuzz.
385     # Under development: http://crbug.com/68551
386     'use_harfbuzz_ng%': 0,
388     # Point to ICU directory.
389     'icu_src_dir': '../third_party/icu',
391     'conditions': [
392       ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
393         # This will set gcc_version to XY if you are running gcc X.Y.*.
394         # This is used to tweak build flags for gcc 4.4.
395         'gcc_version%': '<!(python <(DEPTH)/build/compiler_version.py)',
396         # Figure out the python architecture to decide if we build pyauto.
397         'python_arch%': '<!(<(DEPTH)/build/linux/python_arch.sh <(sysroot)/usr/lib/libpython<(python_ver).so.1.0)',
398         'conditions': [
399           ['branding=="Chrome"', {
400             'linux_breakpad%': 1,
401           }],
402           # All Chrome builds have breakpad symbols, but only process the
403           # symbols from official builds.
404           ['(branding=="Chrome" and buildtype=="Official")', {
405             'linux_dump_symbols%': 1,
406           }],
407         ],
408       }],  # OS=="linux" or OS=="freebsd" or OS=="openbsd"
410       ['OS=="mac"', {
411         'conditions': [
412           # mac_product_name is set to the name of the .app bundle as it should
413           # appear on disk.  This duplicates data from
414           # chrome/app/theme/chromium/BRANDING and
415           # chrome/app/theme/google_chrome/BRANDING, but is necessary to get
416           # these names into the build system.
417           ['branding=="Chrome"', {
418             'mac_product_name%': 'Google Chrome',
419           }, { # else: branding!="Chrome"
420             'mac_product_name%': 'Chromium',
421           }],
423           # Feature variables for enabling Mac Breakpad and Keystone auto-update
424           # support.  Both features are on by default in official builds with
425           # Chrome branding.
426           ['branding=="Chrome" and buildtype=="Official"', {
427             'mac_breakpad%': 1,
428             'mac_keystone%': 1,
429           }, { # else: branding!="Chrome" or buildtype!="Official"
430             'mac_breakpad%': 0,
431             'mac_keystone%': 0,
432           }],
433         ],
434       }],  # OS=="mac"
436       # Whether to use multiple cores to compile with visual studio. This is
437       # optional because it sometimes causes corruption on VS 2005.
438       # It is on by default on VS 2008 and off on VS 2005.
439       ['OS=="win"', {
440         'conditions': [
441           ['component=="shared_library"', {
442             'win_use_allocator_shim%': 0,
443           }],
444           ['MSVS_VERSION=="2005"', {
445             'msvs_multi_core_compile%': 0,
446           },{
447             'msvs_multi_core_compile%': 1,
448           }],
449           # Don't do incremental linking for large modules on 32-bit.
450           ['MSVS_OS_BITS==32', {
451             'msvs_large_module_debug_link_mode%': '1',  # No
452           },{
453             'msvs_large_module_debug_link_mode%': '2',  # Yes
454           }],
455           ['MSVS_VERSION=="2010e" or MSVS_VERSION=="2008e" or MSVS_VERSION=="2005e"', {
456             'msvs_express%': 1,
457             'secure_atl%': 0,
458           },{
459             'msvs_express%': 0,
460             'secure_atl%': 1,
461           }],
462         ],
463         'nacl_win64_defines': [
464           # This flag is used to minimize dependencies when building
465           # Native Client loader for 64-bit Windows.
466           'NACL_WIN64',
467         ],
468       }],
470       ['OS=="mac" or (OS=="linux" and chromeos==0 and target_arch!="arm")', {
471         'use_cups%': 1,
472       }, {
473         'use_cups%': 0,
474       }],
476       # Set the relative path from this file to the GYP file of the JPEG
477       # library used by Chromium.
478       ['use_libjpeg_turbo==1', {
479         'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp',
480       }, {
481         'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp',
482       }],  # use_libjpeg_turbo==1
484       # Use GConf, the GNOME configuration system.
485       ['chromeos==1', {
486         'use_gconf%': 0,
487       }, {
488         'use_gconf%': 1,
489       }],
491       # Setup -D flags passed into grit.
492       ['branding=="Chrome"', {
493         # TODO(mmoss) The .grd files look for _google_chrome, but for
494         # consistency they should look for google_chrome_build like C++.
495         'grit_defines': ['-D', '_google_chrome'],
496       }, {
497         'grit_defines': ['-D', '_chromium'],
498       }],
499       ['chromeos==1', {
500         'grit_defines': ['-D', 'chromeos'],
501       }],
502       ['toolkit_views==1', {
503         'grit_defines': ['-D', 'toolkit_views'],
504       }],
505       ['touchui==1', {
506         'grit_defines': ['-D', 'touchui'],
507       }],
508       ['file_manager_extension==1', {
509         'grit_defines': ['-D', 'file_manager_extension'],
510       }],
511       ['remoting==1', {
512         'grit_defines': ['-D', 'remoting'],
513       }],
514       ['use_titlecase_in_grd_files==1', {
515         'grit_defines': ['-D', 'use_titlecase'],
516       }],
517       ['use_third_party_translations==1', {
518         'grit_defines': ['-D', 'use_third_party_translations'],
519         'locales': ['ast', 'eu', 'gl', 'ka', 'ku', 'ug'],
520       }],
522       ['clang_use_chrome_plugins==1', {
523         'clang_chrome_plugins_flags':
524             '<!(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)',
525       }],
526     ],
527   },
528   'target_defaults': {
529     'variables': {
530       # The condition that operates on chromium_code is in a target_conditions
531       # section, and will not have access to the default fallback value of
532       # chromium_code at the top of this file, or to the chromium_code
533       # variable placed at the root variables scope of .gyp files, because
534       # those variables are not set at target scope.  As a workaround,
535       # if chromium_code is not set at target scope, define it in target scope
536       # to contain whatever value it has during early variable expansion.
537       # That's enough to make it available during target conditional
538       # processing.
539       'chromium_code%': '<(chromium_code)',
541       # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
542       'mac_release_optimization%': '3', # Use -O3 unless overridden
543       'mac_debug_optimization%': '0',   # Use -O0 unless overridden
544       # See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx
545       'win_release_Optimization%': '2', # 2 = /Os
546       'win_debug_Optimization%': '0',   # 0 = /Od
547       # See http://msdn.microsoft.com/en-us/library/8wtf2dfz(VS.71).aspx
548       'win_debug_RuntimeChecks%': '3',    # 3 = all checks enabled, 0 = off
549       # See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx
550       'win_debug_InlineFunctionExpansion%': '',    # empty = default, 0 = off,
551       'win_release_InlineFunctionExpansion%': '2', # 1 = only __inline, 2 = max
552       # VS inserts quite a lot of extra checks to algorithms like
553       # std::partial_sort in Debug build which make them O(N^2)
554       # instead of O(N*logN). This is particularly slow under memory
555       # tools like ThreadSanitizer so we want it to be disablable.
556       # See http://msdn.microsoft.com/en-us/library/aa985982(v=VS.80).aspx
557       'win_debug_disable_iterator_debugging%': '0',
559       'release_extra_cflags%': '',
560       'debug_extra_cflags%': '',
561       'release_valgrind_build%': 0,
563       'conditions': [
564         ['OS=="win" and component=="shared_library"', {
565           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
566           'win_release_RuntimeLibrary%': '2', # 2 = /MT (nondebug DLL)
567           'win_debug_RuntimeLibrary%': '3',   # 3 = /MTd (debug DLL)
568         }, {
569           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
570           'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
571           'win_debug_RuntimeLibrary%': '1',   # 1 = /MTd (debug static)
572         }],
573       ],
574     },
575     'conditions': [
576       ['branding=="Chrome"', {
577         'defines': ['GOOGLE_CHROME_BUILD'],
578       }, {  # else: branding!="Chrome"
579         'defines': ['CHROMIUM_BUILD'],
580       }],
581       ['toolkit_views==1', {
582         'defines': ['TOOLKIT_VIEWS=1'],
583       }],
584       ['chromeos==1', {
585         'defines': ['OS_CHROMEOS=1'],
586       }],
587       ['touchui==1', {
588         'defines': ['TOUCH_UI=1'],
589       }],
590       ['file_manager_extension==1', {
591         'defines': ['FILE_MANAGER_EXTENSION=1'],
592       }],
593       ['profiling==1', {
594         'defines': ['ENABLE_PROFILING=1'],
595       }],
596       ['remoting==1', {
597         'defines': ['ENABLE_REMOTING=1'],
598       }],
599       ['proprietary_codecs==1', {
600         'defines': ['USE_PROPRIETARY_CODECS'],
601       }],
602       ['enable_flapper_hacks==1', {
603         'defines': ['ENABLE_FLAPPER_HACKS=1'],
604       }],
605       ['fastbuild!=0', {
606         'conditions': [
607           # For Windows, we don't genererate debug information.
608           ['OS=="win"', {
609             'msvs_settings': {
610               'VCLinkerTool': {
611                 'GenerateDebugInformation': 'false',
612               },
613               'VCCLCompilerTool': {
614                 'DebugInformationFormat': '0',
615               }
616             }
617           }, { # else: OS != "win", generate less debug information.
618             'variables': {
619               'debug_extra_cflags': '-g1',
620             },
621           }],
622           # Clang creates chubby debug information, which makes linking very
623           # slow. For now, don't create debug information with clang.  See
624           # http://crbug.com/70000
625           ['OS=="linux" and clang==1', {
626             'variables': {
627               'debug_extra_cflags': '-g0',
628             },
629           }],
630         ],  # conditions for fastbuild.
631       }],  # fastbuild!=0
632       ['selinux==1', {
633         'defines': ['CHROMIUM_SELINUX=1'],
634       }],
635       ['win_use_allocator_shim==0', {
636         'conditions': [
637           ['OS=="win"', {
638             'defines': ['NO_TCMALLOC'],
639           }],
640         ],
641       }],
642       ['enable_gpu==1', {
643         'defines': [
644           'ENABLE_GPU=1',
645         ],
646       }],
647       ['use_openssl==1', {
648         'defines': [
649           'USE_OPENSSL=1',
650         ],
651       }],
652       ['enable_eglimage==1', {
653         'defines': [
654           'ENABLE_EGLIMAGE=1',
655         ],
656       }],
657       ['coverage!=0', {
658         'conditions': [
659           ['OS=="mac"', {
660             'xcode_settings': {
661               'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES',  # -fprofile-arcs
662               'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',  # -ftest-coverage
663             },
664             # Add -lgcov for types executable, shared_library, and
665             # loadable_module; not for static_library.
666             # This is a delayed conditional.
667             'target_conditions': [
668               ['_type!="static_library"', {
669                 'xcode_settings': { 'OTHER_LDFLAGS': [ '-lgcov' ] },
670               }],
671             ],
672           }],
673           ['OS=="linux"', {
674             'cflags': [ '-ftest-coverage',
675                         '-fprofile-arcs' ],
676             'link_settings': { 'libraries': [ '-lgcov' ] },
677           }],
678           # Finally, for Windows, we simply turn on profiling.
679           ['OS=="win"', {
680             'msvs_settings': {
681               'VCLinkerTool': {
682                 'Profile': 'true',
683               },
684               'VCCLCompilerTool': {
685                 # /Z7, not /Zi, so coverage is happyb
686                 'DebugInformationFormat': '1',
687                 'AdditionalOptions': ['/Yd'],
688               }
689             }
690          }],  # OS==win
691         ],  # conditions for coverage
692       }],  # coverage!=0
693       ['OS=="win"', {
694         'defines': [
695           '__STD_C',
696           '_CRT_SECURE_NO_DEPRECATE',
697           '_SCL_SECURE_NO_DEPRECATE',
698         ],
699         'include_dirs': [
700           '<(DEPTH)/third_party/wtl/include',
701         ],
702       }],  # OS==win
703     ],  # conditions for 'target_defaults'
704     'target_conditions': [
705       ['chromium_code==0', {
706         'conditions': [
707           [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
708             # We don't want to get warnings from third-party code,
709             # so remove any existing warning-enabling flags like -Wall.
710             'cflags!': [
711               '-Wall',
712               '-Wextra',
713               '-Werror',
714             ],
715             'cflags': [
716               # Don't warn about hash_map in third-party code.
717               '-Wno-deprecated',
718               # Don't warn about printf format problems.
719               # This is off by default in gcc but on in Ubuntu's gcc(!).
720               '-Wno-format',
721             ],
722           }],
723           [ 'OS=="win"', {
724             'defines': [
725               '_CRT_SECURE_NO_DEPRECATE',
726               '_CRT_NONSTDC_NO_WARNINGS',
727               '_CRT_NONSTDC_NO_DEPRECATE',
728               '_SCL_SECURE_NO_DEPRECATE',
729             ],
730             'msvs_disabled_warnings': [4800],
731             'msvs_settings': {
732               'VCCLCompilerTool': {
733                 'WarnAsError': 'false',
734                 'Detect64BitPortabilityProblems': 'false',
735               },
736             },
737           }],
738           [ 'OS=="mac"', {
739             'xcode_settings': {
740               'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
741               'WARNING_CFLAGS!': ['-Wall', '-Wextra'],
742             },
743           }],
744         ],
745       }, {
746         # In Chromium code, we define __STDC_FORMAT_MACROS in order to get the
747         # C99 macros on Mac and Linux.
748         'defines': [
749           '__STDC_FORMAT_MACROS',
750         ],
751         'conditions': [
752           ['OS!="win"', {
753             'sources/': [ ['exclude', '_win(_unittest)?\\.(h|cc)$'],
754                           ['exclude', '(^|/)win/'],
755                           ['exclude', '(^|/)win_[^/]*\\.(h|cc)$'] ],
756           }],
757           ['OS!="mac"', {
758             'sources/': [ ['exclude', '_(cocoa|mac)(_unittest)?\\.(h|cc)$'],
759                           ['exclude', '(^|/)(cocoa|mac)/'],
760                           ['exclude', '\\.mm?$' ] ],
761           }],
762           ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', {
763             'sources/': [
764               ['exclude', '_(chromeos|gtk|x|x11|xdg)(_unittest)?\\.(h|cc)$'],
765               ['exclude', '(^|/)gtk/'],
766               ['exclude', '(^|/)(gtk|x11)_[^/]*\\.(h|cc)$'],
767             ],
768           }],
769           ['OS!="linux"', {
770             'sources/': [
771               ['exclude', '_linux(_unittest)?\\.(h|cc)$'],
772               ['exclude', '(^|/)linux/'],
773             ],
774           }],
775           # We use "POSIX" to refer to all non-Windows operating systems.
776           ['OS=="win"', {
777             'sources/': [ ['exclude', '_posix\\.(h|cc)$'] ],
778             # turn on warnings for signed/unsigned mismatch on chromium code.
779             'msvs_settings': {
780               'VCCLCompilerTool': {
781                 'AdditionalOptions': ['/we4389'],
782               },
783             },
784           }],
785           ['chromeos!=1', {
786             'sources/': [ ['exclude', '_chromeos\\.(h|cc)$'] ]
787           }],
788           ['toolkit_views==0', {
789             'sources/': [ ['exclude', '_views\\.(h|cc)$'] ]
790           }],
791         ],
792       }],
793     ],  # target_conditions for 'target_defaults'
794     'default_configuration': 'Debug',
795     'configurations': {
796       # VCLinkerTool LinkIncremental values below:
797       #   0 == default
798       #   1 == /INCREMENTAL:NO
799       #   2 == /INCREMENTAL
800       # Debug links incremental, Release does not.
801       #
802       # Abstract base configurations to cover common attributes.
803       #
804       'Common_Base': {
805         'abstract': 1,
806         'msvs_configuration_attributes': {
807           'OutputDirectory': '$(SolutionDir)$(ConfigurationName)',
808           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
809           'CharacterSet': '1',
810         },
811       },
812       'x86_Base': {
813         'abstract': 1,
814         'msvs_settings': {
815           'VCLinkerTool': {
816             'TargetMachine': '1',
817           },
818         },
819         'msvs_configuration_platform': 'Win32',
820       },
821       'x64_Base': {
822         'abstract': 1,
823         'msvs_configuration_platform': 'x64',
824         'msvs_settings': {
825           'VCLinkerTool': {
826             'TargetMachine': '17', # x86 - 64
827             'AdditionalLibraryDirectories!':
828               ['<(DEPTH)/third_party/platformsdk_win7/files/Lib'],
829             'AdditionalLibraryDirectories':
830               ['<(DEPTH)/third_party/platformsdk_win7/files/Lib/x64'],
831           },
832           'VCLibrarianTool': {
833             'AdditionalLibraryDirectories!':
834               ['<(DEPTH)/third_party/platformsdk_win7/files/Lib'],
835             'AdditionalLibraryDirectories':
836               ['<(DEPTH)/third_party/platformsdk_win7/files/Lib/x64'],
837           },
838         },
839         'defines': [
840           # Not sure if tcmalloc works on 64-bit Windows.
841           'NO_TCMALLOC',
842         ],
843       },
844       'Debug_Base': {
845         'abstract': 1,
846         'defines': ['DYNAMIC_ANNOTATIONS_ENABLED=1'],
847         'xcode_settings': {
848           'COPY_PHASE_STRIP': 'NO',
849           'GCC_OPTIMIZATION_LEVEL': '<(mac_debug_optimization)',
850           'OTHER_CFLAGS': [ '<@(debug_extra_cflags)', ],
851         },
852         'msvs_settings': {
853           'VCCLCompilerTool': {
854             'Optimization': '<(win_debug_Optimization)',
855             'PreprocessorDefinitions': ['_DEBUG'],
856             'BasicRuntimeChecks': '<(win_debug_RuntimeChecks)',
857             'RuntimeLibrary': '<(win_debug_RuntimeLibrary)',
858             'conditions': [
859               # According to MSVS, InlineFunctionExpansion=0 means
860               # "default inlining", not "/Ob0".
861               # Thus, we have to handle InlineFunctionExpansion==0 separately.
862               ['win_debug_InlineFunctionExpansion==0', {
863                 'AdditionalOptions': ['/Ob0'],
864               }],
865               ['win_debug_InlineFunctionExpansion!=""', {
866                 'InlineFunctionExpansion':
867                   '<(win_debug_InlineFunctionExpansion)',
868               }],
869               ['win_debug_disable_iterator_debugging==1', {
870                 'PreprocessorDefinitions': ['_HAS_ITERATOR_DEBUGGING=0'],
871               }],
872             ],
873           },
874           'VCLinkerTool': {
875             'LinkIncremental': '<(msvs_debug_link_incremental)',
876           },
877           'VCResourceCompilerTool': {
878             'PreprocessorDefinitions': ['_DEBUG'],
879           },
880         },
881         'conditions': [
882           ['OS=="linux"', {
883             'cflags': [
884               '<@(debug_extra_cflags)',
885             ],
886           }],
887         ],
888       },
889       'Release_Base': {
890         'abstract': 1,
891         'defines': [
892           'NDEBUG',
893         ],
894         'xcode_settings': {
895           'DEAD_CODE_STRIPPING': 'YES',  # -Wl,-dead_strip
896           'GCC_OPTIMIZATION_LEVEL': '<(mac_release_optimization)',
897           'OTHER_CFLAGS': [ '<@(release_extra_cflags)', ],
898         },
899         'msvs_settings': {
900           'VCCLCompilerTool': {
901             'Optimization': '<(win_release_Optimization)',
902             'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
903             'conditions': [
904               # According to MSVS, InlineFunctionExpansion=0 means
905               # "default inlining", not "/Ob0".
906               # Thus, we have to handle InlineFunctionExpansion==0 separately.
907               ['win_release_InlineFunctionExpansion==0', {
908                 'AdditionalOptions': ['/Ob0'],
909               }],
910               ['win_release_InlineFunctionExpansion!=""', {
911                 'InlineFunctionExpansion':
912                   '<(win_release_InlineFunctionExpansion)',
913               }],
914             ],
915           },
916           'VCLinkerTool': {
917             'LinkIncremental': '1',
918           },
919         },
920         'conditions': [
921           ['release_valgrind_build==0', {
922             'defines': ['NVALGRIND', 'DYNAMIC_ANNOTATIONS_ENABLED=0'],
923           }, {
924             'defines': ['DYNAMIC_ANNOTATIONS_ENABLED=1'],
925           }],
926           ['win_use_allocator_shim==0', {
927             'defines': ['NO_TCMALLOC'],
928           }],
929           ['OS=="linux"', {
930             'cflags': [
931              '<@(release_extra_cflags)',
932             ],
933           }],
934         ],
935       },
936       'Purify_Base': {
937         'abstract': 1,
938         'defines': [
939           'PURIFY',
940           'NO_TCMALLOC',
941         ],
942         'msvs_settings': {
943           'VCCLCompilerTool': {
944             'Optimization': '0',
945             'RuntimeLibrary': '0',
946             'BufferSecurityCheck': 'false',
947           },
948           'VCLinkerTool': {
949             'EnableCOMDATFolding': '1',
950             'LinkIncremental': '1',
951           },
952         },
953       },
954       #
955       # Concrete configurations
956       #
957       'Debug': {
958         'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'],
959       },
960       'Release': {
961         'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
962         'conditions': [
963           ['msvs_use_common_release', {
964             'includes': ['release.gypi'],
965           }],
966         ]
967       },
968       'conditions': [
969         [ 'OS=="win"', {
970           # TODO(bradnelson): add a gyp mechanism to make this more graceful.
971           'Purify': {
972             'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base', 'Purify'],
973           },
974           'Debug_x64': {
975             'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
976           },
977           'Release_x64': {
978             'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
979           },
980           'Purify_x64': {
981             'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base', 'Purify_Base'],
982           },
983         }],
984       ],
985     },
986   },
987   'conditions': [
988     ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
989       'target_defaults': {
990         # Enable -Werror by default, but put it in a variable so it can
991         # be disabled in ~/.gyp/include.gypi on the valgrind builders.
992         'variables': {
993           # Use -fno-strict-aliasing by default since gcc 4.4 has periodic
994           # issues that slip through the cracks. We could do this just for
995           # gcc 4.4 but it makes more sense to be consistent on all
996           # compilers in use. TODO(Craig): turn this off again when
997           # there is some 4.4 test infrastructure in place and existing
998           # aliasing issues have been fixed.
999           'no_strict_aliasing%': 1,
1000           'conditions': [['OS=="linux"', {'werror%': '-Werror',}],
1001                          ['OS=="freebsd"', {'werror%': '',}],
1002                          ['OS=="openbsd"', {'werror%': '',}],
1003           ],
1004         },
1005         'cflags': [
1006           '<(werror)',  # See note above about the werror variable.
1007           '-pthread',
1008           '-fno-exceptions',
1009           '-Wall',
1010           # TODO(evan): turn this back on once all the builds work.
1011           # '-Wextra',
1012           # Don't warn about unused function params.  We use those everywhere.
1013           '-Wno-unused-parameter',
1014           # Don't warn about the "struct foo f = {0};" initialization pattern.
1015           '-Wno-missing-field-initializers',
1016           '-D_FILE_OFFSET_BITS=64',
1017           # Don't export any symbols (for example, to plugins we dlopen()).
1018           # Note: this is *required* to make some plugins work.
1019           '-fvisibility=hidden',
1020           '-pipe',
1021         ],
1022         'cflags_cc': [
1023           '-fno-rtti',
1024           '-fno-threadsafe-statics',
1025           # Make inline functions have hidden visiblity by default.
1026           # Surprisingly, not covered by -fvisibility=hidden.
1027           '-fvisibility-inlines-hidden',
1028         ],
1029         'ldflags': [
1030           '-pthread', '-Wl,-z,noexecstack',
1031         ],
1032         'configurations': {
1033           'Debug_Base': {
1034             'variables': {
1035               'debug_optimize%': '0',
1036             },
1037             'defines': [
1038               '_DEBUG',
1039             ],
1040             'cflags': [
1041               '-O>(debug_optimize)',
1042               '-g',
1043             ],
1044           },
1045           'Release_Base': {
1046             'variables': {
1047               'release_optimize%': '2',
1048               # Binaries become big and gold is unable to perform GC
1049               # and remove unused sections for some of test targets
1050               # on 32 bit platform.
1051               # (This is currently observed only in chromeos valgrind bots)
1052               # The following flag is to disable --gc-sections linker
1053               # option for these bots.
1054               'no_gc_sections%': 0,
1055             },
1056             'cflags': [
1057               '-O>(release_optimize)',
1058               # Don't emit the GCC version ident directives, they just end up
1059               # in the .comment section taking up binary size.
1060               '-fno-ident',
1061               # Put data and code in their own sections, so that unused symbols
1062               # can be removed at link time with --gc-sections.
1063               '-fdata-sections',
1064               '-ffunction-sections',
1065             ],
1066             'ldflags': [
1067               # Specifically tell the linker to perform optimizations.
1068               # See http://lwn.net/Articles/192624/ .
1069               '-Wl,-O1',
1070               '-Wl,--as-needed',
1071             ],
1072             'conditions' : [
1073               ['no_gc_sections==0', {
1074                 'ldflags': [
1075                   '-Wl,--gc-sections',
1076                 ],
1077               }],
1078               ['clang==1', {
1079                 'cflags!': [
1080                   '-fno-ident',
1081                 ],
1082               }],
1083               ['profiling==1', {
1084                 'cflags': [
1085                   '-fno-omit-frame-pointer',
1086                   '-g',
1087                 ],
1088               }],
1089             ]
1090           },
1091         },
1092         'variants': {
1093           'coverage': {
1094             'cflags': ['-fprofile-arcs', '-ftest-coverage'],
1095             'ldflags': ['-fprofile-arcs'],
1096           },
1097           'profile': {
1098             'cflags': ['-pg', '-g'],
1099             'ldflags': ['-pg'],
1100           },
1101           'symbols': {
1102             'cflags': ['-g'],
1103           },
1104         },
1105         'conditions': [
1106           [ 'target_arch=="ia32"', {
1107             'asflags': [
1108               # Needed so that libs with .s files (e.g. libicudata.a)
1109               # are compatible with the general 32-bit-ness.
1110               '-32',
1111             ],
1112             # All floating-point computations on x87 happens in 80-bit
1113             # precision.  Because the C and C++ language standards allow
1114             # the compiler to keep the floating-point values in higher
1115             # precision than what's specified in the source and doing so
1116             # is more efficient than constantly rounding up to 64-bit or
1117             # 32-bit precision as specified in the source, the compiler,
1118             # especially in the optimized mode, tries very hard to keep
1119             # values in x87 floating-point stack (in 80-bit precision)
1120             # as long as possible. This has important side effects, that
1121             # the real value used in computation may change depending on
1122             # how the compiler did the optimization - that is, the value
1123             # kept in 80-bit is different than the value rounded down to
1124             # 64-bit or 32-bit. There are possible compiler options to make
1125             # this behavior consistent (e.g. -ffloat-store would keep all
1126             # floating-values in the memory, thus force them to be rounded
1127             # to its original precision) but they have significant runtime
1128             # performance penalty.
1129             #
1130             # -mfpmath=sse -msse2 makes the compiler use SSE instructions
1131             # which keep floating-point values in SSE registers in its
1132             # native precision (32-bit for single precision, and 64-bit for
1133             # double precision values). This means the floating-point value
1134             # used during computation does not change depending on how the
1135             # compiler optimized the code, since the value is always kept
1136             # in its specified precision.
1137             'conditions': [
1138               ['branding=="Chromium" and disable_sse2==0', {
1139                 'cflags': [
1140                   '-march=pentium4',
1141                   '-msse2',
1142                   '-mfpmath=sse',
1143                 ],
1144               }],
1145               # ChromeOS targets Pinetrail, which is sse3, but most of the
1146               # benefit comes from sse2 so this setting allows ChromeOS
1147               # to build on other CPUs.  In the future -march=atom would help
1148               # but requires a newer compiler.
1149               ['chromeos==1 and disable_sse2==0', {
1150                 'cflags': [
1151                   '-msse2',
1152                 ],
1153               }],
1154               # Install packages have started cropping up with
1155               # different headers between the 32-bit and 64-bit
1156               # versions, so we have to shadow those differences off
1157               # and make sure a 32-bit-on-64-bit build picks up the
1158               # right files.
1159               ['host_arch!="ia32"', {
1160                 'include_dirs+': [
1161                   '/usr/include32',
1162                 ],
1163               }],
1164             ],
1165             # -mmmx allows mmintrin.h to be used for mmx intrinsics.
1166             # video playback is mmx and sse2 optimized.
1167             'cflags': [
1168               '-m32',
1169               '-mmmx',
1170             ],
1171             'ldflags': [
1172               '-m32',
1173             ],
1174           }],
1175           ['target_arch=="arm"', {
1176             'target_conditions': [
1177               ['_toolset=="target"', {
1178                 'cflags_cc': [
1179                   # The codesourcery arm-2009q3 toolchain warns at that the ABI
1180                   # has changed whenever it encounters a varargs function. This
1181                   # silences those warnings, as they are not helpful and
1182                   # clutter legitimate warnings.
1183                   '-Wno-abi',
1184                 ],
1185                 'conditions': [
1186                   ['arm_thumb == 1', {
1187                     'cflags': [
1188                     '-mthumb',
1189                     # TODO(piman): -Wa,-mimplicit-it=thumb is needed for
1190                     # inline assembly that uses condition codes but it's
1191                     # suboptimal. Better would be to #ifdef __thumb__ at the
1192                     # right place and have a separate thumb path.
1193                     '-Wa,-mimplicit-it=thumb',
1194                     ]
1195                   }],
1196                   ['armv7==1', {
1197                     'cflags': [
1198                       '-march=armv7-a',
1199                       '-mtune=cortex-a8',
1200                       '-mfloat-abi=softfp',
1201                     ],
1202                     'conditions': [
1203                       ['arm_neon==1', {
1204                         'cflags': [ '-mfpu=neon', ],
1205                       }, {
1206                         'cflags': [ '-mfpu=<(arm_fpu)', ],
1207                       }]
1208                     ],
1209                   }],
1210                 ],
1211               }],
1212             ],
1213           }],
1214           ['linux_fpic==1', {
1215             'cflags': [
1216               '-fPIC',
1217             ],
1218           }],
1219           ['sysroot!=""', {
1220             'target_conditions': [
1221               ['_toolset=="target"', {
1222                 'cflags': [
1223                   '--sysroot=<(sysroot)',
1224                 ],
1225                 'ldflags': [
1226                   '--sysroot=<(sysroot)',
1227                 ],
1228               }]]
1229           }],
1230           ['clang==1', {
1231             'target_conditions': [
1232               ['_toolset=="target"', {
1233                 'cflags': [
1234                   # Clang spots more unused functions.
1235                   '-Wno-unused-function',
1236                   # Don't die on dtoa code that uses a char as an array index.
1237                   '-Wno-char-subscripts',
1238                   # Survive EXPECT_EQ(unnamed_enum, unsigned int) -- see
1239                   # http://code.google.com/p/googletest/source/detail?r=446 .
1240                   # TODO(thakis): Use -isystem instead (http://crbug.com/58751 )
1241                   '-Wno-unnamed-type-template-args',
1242                 ],
1243                 'cflags!': [
1244                   # Clang doesn't seem to know know this flag.
1245                   '-mfpmath=sse',
1246                 ],
1247               }]],
1248           }],
1249           ['clang==1 and clang_use_chrome_plugins==1', {
1250             'target_conditions': [
1251               ['_toolset=="target"', {
1252                 'cflags': [
1253                   '<(clang_chrome_plugins_flags)',
1254                 ],
1255               }]],
1256           }],
1257           ['clang==1 and clang_load!="" and clang_add_plugin!=""', {
1258             'target_conditions': [
1259               ['_toolset=="target"', {
1260                 'cflags': [
1261                   '-Xclang', '-load', '-Xclang', '<(clang_load)',
1262                   '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
1263                 ],
1264               }]],
1265           }],
1266           ['no_strict_aliasing==1', {
1267             'cflags': [
1268               '-fno-strict-aliasing',
1269             ],
1270           }],
1271           ['linux_breakpad==1', {
1272             'cflags': [ '-g' ],
1273             'defines': ['USE_LINUX_BREAKPAD'],
1274           }],
1275           ['library=="shared_library"', {
1276             # When building with shared libraries, remove the visiblity-hiding
1277             # flag.
1278             'cflags!': [ '-fvisibility=hidden' ],
1279             'conditions': [
1280               ['target_arch=="x64" or target_arch=="arm"', {
1281                 # Shared libraries need -fPIC on x86-64 and arm
1282                 'cflags': ['-fPIC']
1283               }]
1284             ],
1285             'ldflags!': [
1286               # --as-needed confuses library interdependencies.
1287               # See http://code.google.com/p/chromium/issues/detail?id=61430
1288               '-Wl,--as-needed',
1289             ],
1290           }],
1291           ['linux_use_heapchecker==1', {
1292             'variables': {'linux_use_tcmalloc%': 1},
1293           }],
1294           ['linux_use_tcmalloc==0', {
1295             'defines': ['NO_TCMALLOC'],
1296           }],
1297           ['linux_use_heapchecker==0', {
1298             'defines': ['NO_HEAPCHECKER'],
1299           }],
1300           ['linux_keep_shadow_stacks==1', {
1301             'defines': ['KEEP_SHADOW_STACKS'],
1302             'cflags': ['-finstrument-functions'],
1303           }],
1304         ],
1305       },
1306     }],
1307     # FreeBSD-specific options; note that most FreeBSD options are set above,
1308     # with Linux.
1309     ['OS=="freebsd"', {
1310       'target_defaults': {
1311         'ldflags': [
1312           '-Wl,--no-keep-memory',
1313         ],
1314       },
1315     }],
1316     ['OS=="solaris"', {
1317       'cflags!': ['-fvisibility=hidden'],
1318       'cflags_cc!': ['-fvisibility-inlines-hidden'],
1319     }],
1320     ['OS=="mac"', {
1321       'target_defaults': {
1322         'variables': {
1323           # These should be 'mac_real_dsym%' and 'mac_strip%', but there
1324           # seems to be a bug with % in variables that are intended to be
1325           # set to different values in different targets, like these two.
1326           'mac_strip': 1,      # Strip debugging symbols from the target.
1327           'mac_real_dsym': 0,  # Fake .dSYMs are fine in most cases.
1328         },
1329         'mac_bundle': 0,
1330         'xcode_settings': {
1331           'ALWAYS_SEARCH_USER_PATHS': 'NO',
1332           'GCC_C_LANGUAGE_STANDARD': 'c99',         # -std=c99
1333           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
1334           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
1335                                                     # (Equivalent to -fPIC)
1336           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
1337           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
1338           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
1339           # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
1340           'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
1341           'GCC_OBJC_CALL_CXX_CDTORS': 'YES',        # -fobjc-call-cxx-cdtors
1342           'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
1343           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
1344           'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',    # -Werror
1345           'GCC_VERSION': '4.2',
1346           'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
1347           # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
1348           'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
1349           'PREBINDING': 'NO',                       # No -Wl,-prebind
1350           'USE_HEADERMAP': 'NO',
1351           'WARNING_CFLAGS': [
1352             '-Wall',
1353             '-Wendif-labels',
1354             '-Wextra',
1355             # Don't warn about unused function parameters.
1356             '-Wno-unused-parameter',
1357             # Don't warn about the "struct foo f = {0};" initialization
1358             # pattern.
1359             '-Wno-missing-field-initializers',
1360           ],
1361           'conditions': [
1362             ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'},
1363                                  {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'}
1364             ],
1365             ['clang==1', {
1366               'WARNING_CFLAGS': [
1367                 # Don't die on dtoa code that uses a char as an array index.
1368                 # This is required solely for base/third_party/dmg_fp/dtoa.cc.
1369                 '-Wno-char-subscripts',
1370                 # Clang spots more unused functions.
1371                 '-Wno-unused-function',
1372                 # Survive EXPECT_EQ(unnamed_enum, unsigned int) -- see
1373                 # http://code.google.com/p/googletest/source/detail?r=446 .
1374                 # TODO(thakis): Use -isystem instead (http://crbug.com/58751 ).
1375                 '-Wno-unnamed-type-template-args',
1376               ],
1377               'OTHER_CFLAGS': [
1378                 # TODO(thakis): Causes many warnings - http://crbug.com/75001
1379                 '-fobjc-exceptions',
1380               ],
1381             }],
1382             ['clang==1 and clang_use_chrome_plugins==1', {
1383               'OTHER_CFLAGS': [
1384                 '<(clang_chrome_plugins_flags)',
1385               ],
1386             }],
1387             ['clang==1 and clang_load!="" and clang_add_plugin!=""', {
1388               'OTHER_CFLAGS': [
1389                 '-Xclang', '-load', '-Xclang', '<(clang_load)',
1390                 '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
1391               ],
1392             }],
1393           ],
1394         },
1395         'target_conditions': [
1396           ['_type!="static_library"', {
1397             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
1398           }],
1399           ['_mac_bundle', {
1400             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
1401           }],
1402           ['(_type=="executable" or _type=="shared_library" or \
1403              _type=="loadable_module") and mac_strip!=0', {
1404             'target_conditions': [
1405               ['mac_real_dsym == 1', {
1406                 # To get a real .dSYM bundle produced by dsymutil, set the
1407                 # debug information format to dwarf-with-dsym.  Since
1408                 # strip_from_xcode will not be used, set Xcode to do the
1409                 # stripping as well.
1410                 'configurations': {
1411                   'Release_Base': {
1412                     'xcode_settings': {
1413                       'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
1414                       'DEPLOYMENT_POSTPROCESSING': 'YES',
1415                       'STRIP_INSTALLED_PRODUCT': 'YES',
1416                       'target_conditions': [
1417                         ['_type=="shared_library" or _type=="loadable_module"', {
1418                           # The Xcode default is to strip debugging symbols
1419                           # only (-S).  Local symbols should be stripped as
1420                           # well, which will be handled by -x.  Xcode will
1421                           # continue to insert -S when stripping even when
1422                           # additional flags are added with STRIPFLAGS.
1423                           'STRIPFLAGS': '-x',
1424                         }],  # _type=="shared_library" or _type=="loadable_module"'
1425                       ],  # target_conditions
1426                     },  # xcode_settings
1427                   },  # configuration "Release"
1428                 },  # configurations
1429               }, {  # mac_real_dsym != 1
1430                 # To get a fast fake .dSYM bundle, use a post-build step to
1431                 # produce the .dSYM and strip the executable.  strip_from_xcode
1432                 # only operates in the Release configuration.
1433                 'postbuilds': [
1434                   {
1435                     'variables': {
1436                       # Define strip_from_xcode in a variable ending in _path
1437                       # so that gyp understands it's a path and performs proper
1438                       # relativization during dict merging.
1439                       'strip_from_xcode_path': 'mac/strip_from_xcode',
1440                     },
1441                     'postbuild_name': 'Strip If Needed',
1442                     'action': ['<(strip_from_xcode_path)'],
1443                   },
1444                 ],  # postbuilds
1445               }],  # mac_real_dsym
1446             ],  # target_conditions
1447           }],  # (_type=="executable" or _type=="shared_library" or
1448                #  _type=="loadable_module") and mac_strip!=0
1449         ],  # target_conditions
1450       },  # target_defaults
1451     }],  # OS=="mac"
1452     ['OS=="win"', {
1453       'target_defaults': {
1454         'defines': [
1455           '_WIN32_WINNT=0x0600',
1456           'WINVER=0x0600',
1457           'WIN32',
1458           '_WINDOWS',
1459           'NOMINMAX',
1460           '_CRT_RAND_S',
1461           'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
1462           'WIN32_LEAN_AND_MEAN',
1463           '_ATL_NO_OPENGL',
1464           '_HAS_TR1=0',
1465         ],
1466         'conditions': [
1467           ['component=="static_library"', {
1468             'defines': [
1469               '_HAS_EXCEPTIONS=0',
1470             ],
1471           }],
1472           ['secure_atl', {
1473             'defines': [
1474               '_SECURE_ATL',
1475             ],
1476           }],
1477         ],
1478         'msvs_system_include_dirs': [
1479           '<(DEPTH)/third_party/platformsdk_win7/files/Include',
1480           '<(DEPTH)/third_party/directxsdk/files/Include',
1481           '$(VSInstallDir)/VC/atlmfc/include',
1482         ],
1483         'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
1484         'msvs_disabled_warnings': [4351, 4396, 4503, 4819],
1485         'msvs_settings': {
1486           'VCCLCompilerTool': {
1487             'MinimalRebuild': 'false',
1488             'BufferSecurityCheck': 'true',
1489             'EnableFunctionLevelLinking': 'true',
1490             'RuntimeTypeInfo': 'false',
1491             'WarningLevel': '3',
1492             'WarnAsError': 'true',
1493             'DebugInformationFormat': '3',
1494             'conditions': [
1495               ['msvs_multi_core_compile', {
1496                 'AdditionalOptions': ['/MP'],
1497               }],
1498               ['MSVS_VERSION=="2005e"', {
1499                 'AdditionalOptions': ['/w44068'], # Unknown pragma to 4 (ATL)
1500               }],
1501               ['component=="shared_library"', {
1502                 'ExceptionHandling': '1',  # /EHsc
1503               }, {
1504                 'ExceptionHandling': '0',
1505               }],
1506             ],
1507           },
1508           'VCLibrarianTool': {
1509             'AdditionalOptions': ['/ignore:4221'],
1510             'AdditionalLibraryDirectories': [
1511               '<(DEPTH)/third_party/platformsdk_win7/files/Lib',
1512               '<(DEPTH)/third_party/directxsdk/files/Lib/x86',
1513             ],
1514           },
1515           'VCLinkerTool': {
1516             'AdditionalDependencies': [
1517               'wininet.lib',
1518               'dnsapi.lib',
1519               'version.lib',
1520               'msimg32.lib',
1521               'ws2_32.lib',
1522               'usp10.lib',
1523               'psapi.lib',
1524               'dbghelp.lib',
1525             ],
1526             'conditions': [ 
1527               ['msvs_express', {
1528                 # Explicitly required when using the ATL with express
1529                 'AdditionalDependencies': [
1530                   'atlthunk.lib',
1531                 ],
1532               }],
1533               ['MSVS_VERSION=="2005e"', {
1534                 # Non-express versions link automatically to these
1535                 'AdditionalDependencies': [
1536                   'advapi32.lib',
1537                   'comdlg32.lib',
1538                   'ole32.lib',
1539                   'shell32.lib',
1540                   'user32.lib',
1541                   'winspool.lib',
1542                 ],
1543               }],
1544             ],
1545             'AdditionalLibraryDirectories': [
1546               '<(DEPTH)/third_party/platformsdk_win7/files/Lib',
1547               '<(DEPTH)/third_party/directxsdk/files/Lib/x86',
1548             ],
1549             'GenerateDebugInformation': 'true',
1550             'MapFileName': '$(OutDir)\\$(TargetName).map',
1551             'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
1552             'FixedBaseAddress': '1',
1553             # SubSystem values:
1554             #   0 == not set
1555             #   1 == /SUBSYSTEM:CONSOLE
1556             #   2 == /SUBSYSTEM:WINDOWS
1557             # Most of the executables we'll ever create are tests
1558             # and utilities with console output.
1559             'SubSystem': '1',
1560           },
1561           'VCMIDLTool': {
1562             'GenerateStublessProxies': 'true',
1563             'TypeLibraryName': '$(InputName).tlb',
1564             'OutputDirectory': '$(IntDir)',
1565             'HeaderFileName': '$(InputName).h',
1566             'DLLDataFileName': 'dlldata.c',
1567             'InterfaceIdentifierFileName': '$(InputName)_i.c',
1568             'ProxyFileName': '$(InputName)_p.c',
1569           },
1570           'VCResourceCompilerTool': {
1571             'Culture' : '1033',
1572             'AdditionalIncludeDirectories': [
1573               '<(DEPTH)',
1574               '<(SHARED_INTERMEDIATE_DIR)',
1575             ],
1576           },
1577         },
1578       },
1579     }],
1580     ['disable_nacl==1 or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
1581       'target_defaults': {
1582         'defines': [
1583           'DISABLE_NACL',
1584         ],
1585       },
1586     }],
1587     ['OS=="win" and msvs_use_common_linker_extras', {
1588       'target_defaults': {
1589         'msvs_settings': {
1590           'VCLinkerTool': {
1591             'DelayLoadDLLs': [
1592               'dbghelp.dll',
1593               'dwmapi.dll',
1594               'uxtheme.dll',
1595             ],
1596           },
1597         },
1598         'configurations': {
1599           'x86_Base': {
1600             'msvs_settings': {
1601               'VCLinkerTool': {
1602                 'AdditionalOptions': [
1603                   '/safeseh',
1604                   '/dynamicbase',
1605                   '/ignore:4199',
1606                   '/ignore:4221',
1607                   '/nxcompat',
1608                 ],
1609               },
1610             },
1611           },
1612           'x64_Base': {
1613             'msvs_settings': {
1614               'VCLinkerTool': {
1615                 'AdditionalOptions': [
1616                   # safeseh is not compatible with x64
1617                   '/dynamicbase',
1618                   '/ignore:4199',
1619                   '/ignore:4221',
1620                   '/nxcompat',
1621                 ],
1622               },
1623             },
1624           },
1625         },
1626       },
1627     }],
1628     ['enable_new_npdevice_api==1', {
1629       'target_defaults': {
1630         'defines': [
1631           'ENABLE_NEW_NPDEVICE_API',
1632         ],
1633       },
1634     }],
1635   ],
1636   'xcode_settings': {
1637     # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
1638     # This block adds *project-wide* configuration settings to each project
1639     # file.  It's almost always wrong to put things here.  Specify your
1640     # custom xcode_settings in target_defaults to add them to targets instead.
1642     # In an Xcode Project Info window, the "Base SDK for All Configurations"
1643     # setting sets the SDK on a project-wide basis.  In order to get the
1644     # configured SDK to show properly in the Xcode UI, SDKROOT must be set
1645     # here at the project level.
1646     'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
1648     # The Xcode generator will look for an xcode_settings section at the root
1649     # of each dict and use it to apply settings on a file-wide basis.  Most
1650     # settings should not be here, they should be in target-specific
1651     # xcode_settings sections, or better yet, should use non-Xcode-specific
1652     # settings in target dicts.  SYMROOT is a special case, because many other
1653     # Xcode variables depend on it, including variables such as
1654     # PROJECT_DERIVED_FILE_DIR.  When a source group corresponding to something
1655     # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the
1656     # files to appear (when present) in the UI as actual files and not red
1657     # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR,
1658     # and therefore SYMROOT, needs to be set at the project level.
1659     'SYMROOT': '<(DEPTH)/xcodebuild',
1660   },
1663 # Local Variables:
1664 # tab-width:2
1665 # indent-tabs-mode:nil
1666 # End:
1667 # vim: set expandtab tabstop=2 shiftwidth=2: