Make all gyp targets automatically include common.gypi

Do this, rather than including common.gypi explicitly in all our gyp files, so that gyp files we use but do not maintain (e.g., third_party/externals/libjpeg/libjpeg.gyp) will include common.gypi too.
Review URL: https://codereview.appspot.com/5820068

git-svn-id: http://skia.googlecode.com/svn/trunk@3411 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gyp/FileReaderApp.gyp b/gyp/FileReaderApp.gyp
index c5651c7..545eff2 100644
--- a/gyp/FileReaderApp.gyp
+++ b/gyp/FileReaderApp.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'FileReaderApp',
diff --git a/gyp/SampleApp.gyp b/gyp/SampleApp.gyp
index 1f97dc6..b915821 100644
--- a/gyp/SampleApp.gyp
+++ b/gyp/SampleApp.gyp
@@ -1,8 +1,5 @@
 
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'SampleApp',
diff --git a/gyp/SimpleCocoaApp.gyp b/gyp/SimpleCocoaApp.gyp
index ed35d54..f5e41c4 100644
--- a/gyp/SimpleCocoaApp.gyp
+++ b/gyp/SimpleCocoaApp.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'SimpleCocoaApp',
diff --git a/gyp/android_system.gyp b/gyp/android_system.gyp
index 27a82f3..bbc1e69 100644
--- a/gyp/android_system.gyp
+++ b/gyp/android_system.gyp
@@ -15,7 +15,6 @@
 # variable expansion step for gyp happens after the includes are processed. 
 {
   'includes': [
-    'common.gypi',
     '../../android/gyp/android.gypi',
   ],
-}
\ No newline at end of file
+}
diff --git a/gyp/animator.gyp b/gyp/animator.gyp
index f713f3f..744cd37 100644
--- a/gyp/animator.gyp
+++ b/gyp/animator.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'animator',
diff --git a/gyp/bench.gyp b/gyp/bench.gyp
index 0c5e2ea..1935f9d 100644
--- a/gyp/bench.gyp
+++ b/gyp/bench.gyp
@@ -3,7 +3,6 @@
 {
   'includes': [
     'apptype_console.gypi',
-    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/common.gypi b/gyp/common.gypi
index 30424de..aa6e276 100644
--- a/gyp/common.gypi
+++ b/gyp/common.gypi
@@ -2,10 +2,22 @@
 #
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
+#
+# This file is automatically included by gyp_skia when building any target.
+
 {
-  'includes': [
-    'common_variables.gypi',
-  ],
+  # Define all variables, allowing for override in GYP_DEFINES.
+  #
+  # One such variable is 'skia_os', which we use instead of 'OS' throughout
+  # our gyp files.  We set it automatically based on 'OS', but allow the
+  # user to override it via GYP_DEFINES if they like.
+  'variables': {
+    'skia_scalar%': 'float',
+    'skia_os%': '<(OS)',
+    'skia_mesa%': 0,
+    'skia_target_arch%': 'x86',
+  },
+
   'target_defaults': {
 
     # Validate the 'skia_os' setting against 'OS', because only certain
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
deleted file mode 100644
index 6a8587e..0000000
--- a/gyp/common_variables.gypi
+++ /dev/null
@@ -1,25 +0,0 @@
-# variables used in both common.gypi and skia.gyp in chromium
-#
-{
-  # Define all variables, allowing for override in GYP_DEFINES.
-  #
-  # One such variable is 'skia_os', which we use instead of 'OS' throughout
-  # our gyp files.  We set it automatically based on 'OS', but allow the
-  # user to override it via GYP_DEFINES if they like.
-  'variables': {
-    'skia_scalar%': 'float',
-    'skia_os%': '<(OS)',
-    'skia_mesa%': 0,
-    'skia_target_arch%': 'x86',
-  },
-  'skia_scalar%': '<(skia_scalar)',
-  'skia_os': '<(skia_os)',
-  'skia_mesa': '<(skia_mesa)',
-  'skia_target_arch': '<(skia_target_arch)',
-}
-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/gyp/core.gyp b/gyp/core.gyp
index 077d395..1d0630e 100644
--- a/gyp/core.gyp
+++ b/gyp/core.gyp
@@ -1,8 +1,5 @@
 # Core Skia library code.
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'core',
diff --git a/gyp/effects.gyp b/gyp/effects.gyp
index ac56510..692a5bb 100644
--- a/gyp/effects.gyp
+++ b/gyp/effects.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'effects',
diff --git a/gyp/experimental.gyp b/gyp/experimental.gyp
index c5b8c5e..09711ac 100644
--- a/gyp/experimental.gyp
+++ b/gyp/experimental.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'experimental',
diff --git a/gyp/freetype.gyp b/gyp/freetype.gyp
index e86a338..4a885a1 100644
--- a/gyp/freetype.gyp
+++ b/gyp/freetype.gyp
@@ -1,7 +1,4 @@
 {
-#  'includes': [
-#    'common.gypi',
-#  ],
   'targets': [
     {
       'target_name': 'skfreetype',
diff --git a/gyp/gm.gyp b/gyp/gm.gyp
index 3c5e12e..9e3eaac 100644
--- a/gyp/gm.gyp
+++ b/gyp/gm.gyp
@@ -2,7 +2,6 @@
 {
   'includes': [
     'apptype_console.gypi',
-    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/gpu.gyp b/gyp/gpu.gyp
index bb13bbd..410a5b7 100644
--- a/gyp/gpu.gyp
+++ b/gyp/gpu.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'target_defaults': {
     'conditions': [
       ['skia_os != "win"', {
diff --git a/gyp/images.gyp b/gyp/images.gyp
index c167bd4..a93ba06 100644
--- a/gyp/images.gyp
+++ b/gyp/images.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'images',
diff --git a/gyp/libtess.gyp b/gyp/libtess.gyp
index d74bcc7..c90ca12 100644
--- a/gyp/libtess.gyp
+++ b/gyp/libtess.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'libtess',
diff --git a/gyp/opts.gyp b/gyp/opts.gyp
index b3c1be9..2ec076c 100644
--- a/gyp/opts.gyp
+++ b/gyp/opts.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     # Due to an unfortunate intersection of lameness between gcc and gyp,
     # we have to build the *_SSE2.cpp files in a separate target.  The
diff --git a/gyp/pdf.gyp b/gyp/pdf.gyp
index f0c6b47..0d5fef5 100644
--- a/gyp/pdf.gyp
+++ b/gyp/pdf.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'pdf',
diff --git a/gyp/ports.gyp b/gyp/ports.gyp
index 5dc88d5..73dd594 100644
--- a/gyp/ports.gyp
+++ b/gyp/ports.gyp
@@ -1,8 +1,5 @@
 # Port-specific Skia library code.
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'ports',
diff --git a/gyp/sfnt.gyp b/gyp/sfnt.gyp
index 2f2fc76..17dd2d8 100644
--- a/gyp/sfnt.gyp
+++ b/gyp/sfnt.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'sfnt',
diff --git a/gyp/svg.gyp b/gyp/svg.gyp
index c72b99f..9e90f28 100644
--- a/gyp/svg.gyp
+++ b/gyp/svg.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'svg',
diff --git a/gyp/tests.gyp b/gyp/tests.gyp
index cf793ab..1eecc39 100644
--- a/gyp/tests.gyp
+++ b/gyp/tests.gyp
@@ -2,7 +2,6 @@
 {
   'includes': [
     'apptype_console.gypi',
-    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/tools.gyp b/gyp/tools.gyp
index 1e419cd..6175eee 100644
--- a/gyp/tools.gyp
+++ b/gyp/tools.gyp
@@ -8,7 +8,6 @@
 {
   'includes': [
     'apptype_console.gypi',
-    'common.gypi',
   ],
   'targets': [
     {
diff --git a/gyp/utils.gyp b/gyp/utils.gyp
index 8d2415a..87d6e97 100644
--- a/gyp/utils.gyp
+++ b/gyp/utils.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'utils',
diff --git a/gyp/views.gyp b/gyp/views.gyp
index e91b28e..e997573 100644
--- a/gyp/views.gyp
+++ b/gyp/views.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'views',
diff --git a/gyp/xml.gyp b/gyp/xml.gyp
index 7da8666..6650a5c 100644
--- a/gyp/xml.gyp
+++ b/gyp/xml.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'xml',
diff --git a/gyp/xps.gyp b/gyp/xps.gyp
index ff68d6f..8090166 100644
--- a/gyp/xps.gyp
+++ b/gyp/xps.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'xps',
diff --git a/gyp/zlib.gyp b/gyp/zlib.gyp
index 5ed9d14..d41924d 100644
--- a/gyp/zlib.gyp
+++ b/gyp/zlib.gyp
@@ -1,7 +1,4 @@
 {
-  'includes': [
-    'common.gypi',
-  ],
   'targets': [
     {
       'target_name': 'zlib',
diff --git a/gyp_skia b/gyp_skia
index 75a3a21..cf55084 100755
--- a/gyp_skia
+++ b/gyp_skia
@@ -44,6 +44,12 @@
     if os.path.realpath(path) not in specified_includes:
       result.append(path)
 
+  # Always include common.gypi.
+  # We do this, rather than including common.gypi explicitly in all our gyp
+  # files, so that gyp files we use but do not maintain (e.g.,
+  # third_party/externals/libjpeg/libjpeg.gyp) will include common.gypi too.
+  AddInclude(os.path.join(gyp_config_dir, 'common.gypi'))
+
   return result
 
 if __name__ == '__main__':