Restructure GYP to easier read and use.
authorHalton Huo <halton.huo@intel.com>
Fri, 2 Aug 2013 08:14:19 +0000 (16:14 +0800)
committerHalton Huo <halton.huo@intel.com>
Mon, 5 Aug 2013 05:54:01 +0000 (13:54 +0800)
Changes summary:
1. Use dependencies instead of includes in tizen-wrt.gyp.
2. Move shared gyp from tizen-wrt.gyp into common/common.gypi to allow each
   module include it.
3. pkg-config.gypi -> common/pkg-config.gypi
4. xwalk_js2c.gypi -> common/xwalk_js2c.gypi
5. <module>/*.gypi -> <module>/*.gyp

bluetooth/bluetooth.gyp [moved from bluetooth/bluetooth.gypi with 78% similarity]
common/common.gypi [new file with mode: 0644]
common/pkg-config.gypi [moved from pkg-config.gypi with 100% similarity]
common/xwalk_js2c.gypi [moved from xwalk_js2c.gypi with 92% similarity]
networkbearerselection/networkbearerselection.gyp [moved from networkbearerselection/networkbearerselection.gypi with 94% similarity]
notification/notification.gyp [moved from notification/notification.gypi with 85% similarity]
power/power.gyp [moved from power/power.gypi with 85% similarity]
system_info/system_info.gyp [moved from system_info/system_info.gypi with 94% similarity]
time/time.gyp [moved from time/time.gypi with 78% similarity]
tizen-wrt.gyp
tizen/tizen.gyp [moved from tizen/tizen.gypi with 80% similarity]

similarity index 78%
rename from bluetooth/bluetooth.gypi
rename to bluetooth/bluetooth.gyp
index 9b94ca0..6156752 100644 (file)
@@ -1,20 +1,25 @@
 {
+  'includes':[
+    '../common/common.gypi',
+  ],
   'targets': [
     {
+      'target_name': 'tizen_bluetooth',
+      'type': 'loadable_module',
       'variables': {
-        'packages': ['gio-2.0'],
+        'packages': [
+          'gio-2.0',
+        ],
         'bluetooth%': 'bluez4',
       },
-
-      'includes': [ '../pkg-config.gypi' ],
-      'target_name': 'tizen_bluetooth',
-      'type': 'loadable_module',
+      'includes': [
+        '../common/pkg-config.gypi',
+      ],
       'sources': [
         'bluetooth_api.js',
         'bluetooth_context.cc',
         'bluetooth_context.h',
       ],
-
       'conditions': [
         [ 'bluetooth == "bluez5"', {
             'sources': ['bluetooth_context_bluez5.cc'],
diff --git a/common/common.gypi b/common/common.gypi
new file mode 100644 (file)
index 0000000..ba86883
--- /dev/null
@@ -0,0 +1,57 @@
+{
+  'variables': {
+    # Copy conditionally-set variables out one scope.
+    'extension_host_os%': '<(extension_host_os)',
+    'extension_build_type%': '<(extension_build_type)',
+    'extension_host_os%': 'mobile',
+    'extension_build_type%': 'Debug',
+  },
+  'target_defaults': {
+    'conditions': [
+      ['extension_host_os != "mobile"', {
+        'sources/': [['exclude', '_mobile\\.cc$|mobile/']],
+        'includes/': [['exclude', '_mobile\\.gypi$|mobile/']],
+      }],
+      ['extension_host_os != "desktop"', {
+        'sources/': [['exclude', '_desktop\\.cc$|desktop/']],
+        'sources/': [['exclude', '_desktop\\.gypi$|desktop/']],
+      }],
+      ['extension_host_os == "mobile"', { 'defines': ['TIZEN_MOBILE'] } ],
+      ['extension_host_os == "desktop"', { 'defines': ['GENERIC_DESKTOP'] } ],
+      ['extension_build_type== "Debug"', {
+        'defines': ['_DEBUG', ],
+        'cflags': [ '-O0', '-g', ],
+      }],
+      ['extension_build_type == "Release"', {
+        'defines': ['NDEBUG', ],
+        'cflags': [
+          '-O2',
+          # Don't emit the GCC version ident directives, they just end up
+          # in the .comment section taking up binary size.
+          '-fno-ident',
+          # Put data and code in their own sections, so that unused symbols
+          # can be removed at link time with --gc-sections.
+          '-fdata-sections',
+          '-ffunction-sections',
+        ],
+      }],
+    ],
+    'includes': [
+      'xwalk_js2c.gypi',
+      'tizen_mobile.gypi',
+    ],
+    'include_dirs': [
+      '../',
+      '<(SHARED_INTERMEDIATE_DIR)',
+    ],
+    'sources': [
+      'extension_adapter.h',
+      'picojson.h',
+      'utils.h',
+    ],
+    'cflags': [
+      '-fPIC',
+      '-fvisibility=hidden',
+    ],
+  },
+}
similarity index 100%
rename from pkg-config.gypi
rename to common/pkg-config.gypi
similarity index 92%
rename from xwalk_js2c.gypi
rename to common/xwalk_js2c.gypi
index 8e20a2d..9b2b930 100644 (file)
@@ -4,7 +4,7 @@
       'rule_name': 'xwalk_js2c',
       'extension': 'js',
       'inputs': [
-        './tools/generate_api.py',
+        '../tools/generate_api.py',
       ],
       'outputs': [
         '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).cc'
@@ -1,4 +1,7 @@
 {
+  'includes':[
+    '../common/common.gypi',
+  ],
   'targets': [
     {
       'target_name': 'tizen_networkbearerselection',
similarity index 85%
rename from notification/notification.gypi
rename to notification/notification.gyp
index 09eb284..10ad535 100644 (file)
@@ -1,8 +1,14 @@
 {
+  'includes':[
+    '../common/common.gypi',
+  ],
   'targets': [
     {
       'target_name': 'tizen_notification',
       'type': 'loadable_module',
+      'includes': [
+        '../common/pkg-config.gypi',
+      ],
       'sources': [
         'notification_api.js',
         'notification_context.cc',
@@ -21,8 +27,6 @@
             'variables': { 'packages': ['notification'] },
         }],
       ],
-
-      'includes': [ '../pkg-config.gypi' ],
     },
   ],
 }
similarity index 85%
rename from power/power.gypi
rename to power/power.gyp
index 268254b..d76cd21 100644 (file)
@@ -1,4 +1,7 @@
 {
+  'includes':[
+    '../common/common.gypi',
+  ],
   'targets': [
     {
       'target_name': 'tizen_power',
@@ -21,7 +24,7 @@
         }],
         [ 'extension_host_os == "desktop"', {
             'variables': { 'packages': ['gio-2.0'] },
-            'includes': [ '../pkg-config.gypi' ],
+            'includes': [ '../common/pkg-config.gypi' ],
         }],
       ],
     },
similarity index 94%
rename from system_info/system_info.gypi
rename to system_info/system_info.gyp
index 73934ed..94f3c9e 100644 (file)
@@ -1,4 +1,7 @@
 {
+  'includes':[
+    '../common/common.gypi',
+  ],
   'targets': [
     {
       'target_name': 'tizen_system_info',
@@ -25,7 +28,7 @@
         ]
       },
       'includes': [
-        '../pkg-config.gypi',
+        '../common/pkg-config.gypi',
       ],
       'sources': [
         'system_info_api.js',
@@ -77,7 +80,7 @@
            '<(SHARED_INTERMEDIATE_DIR)/system_info_marshaller.h',
           ],
           'action': [
-            '<(DEPTH)/tools/redirect-stdout.sh',
+            '../tools/redirect-stdout.sh',
             'glib-genmarshal --header <@(_inputs)',
             '<@(_outputs)',
           ],
@@ -92,7 +95,7 @@
            '<(SHARED_INTERMEDIATE_DIR)/system_info_marshaller.c',
           ],
           'action': [
-            '<(DEPTH)/tools/redirect-stdout.sh',
+            '../tools/redirect-stdout.sh',
             'glib-genmarshal --body <@(_inputs)',
             '<@(_outputs)',
           ],
similarity index 78%
rename from time/time.gypi
rename to time/time.gyp
index 04b5381..dcf61f5 100644 (file)
@@ -1,4 +1,7 @@
 {
+  'includes':[
+    '../common/common.gypi',
+  ],
   'targets': [
     {
       'target_name': 'tizen_time',
index 0da2da2..5a0a60f 100644 (file)
@@ -1,60 +1,17 @@
 {
-  'variables': { 'type%': 'mobile' },
-  'target_defaults': {
-    'conditions': [
-      ['extension_host_os != "mobile"', {
-        'sources/': [['exclude', '_mobile\\.cc$|mobile/']],
-        'includes/': [['exclude', '_mobile\\.gypi$|mobile/']],
-      }],
-      ['extension_host_os != "desktop"', {
-        'sources/': [['exclude', '_desktop\\.cc$|desktop/']],
-        'includes/': [['exclude', '_desktop\\.gypi$|desktop/']],
-      }],
-      ['extension_host_os == "mobile"', { 'defines': ['TIZEN_MOBILE'] } ],
-      ['extension_host_os == "desktop"', { 'defines': ['GENERIC_DESKTOP'] } ],
-      ['extensino_build_type == "Debug"', {
-        'defines': ['_DEBUG', ],
-        'cflags': [ '-O0', '-g', ],
-      }],
-      ['extension_build_type == "Release"', {
-        'defines': ['NDEBUG', ],
-        'cflags': [
-          '-O2',
-          # Don't emit the GCC version ident directives, they just end up
-          # in the .comment section taking up binary size.
-          '-fno-ident',
-          # Put data and code in their own sections, so that unused symbols
-          # can be removed at link time with --gc-sections.
-          '-fdata-sections',
-          '-ffunction-sections',
-        ],
-      }],
-    ],
-    'includes': [
-      'xwalk_js2c.gypi',
-    ],
-    'include_dirs': [
-      '.',
-      '<(SHARED_INTERMEDIATE_DIR)',
-    ],
-    'sources': [
-      '../common/extension_adapter.h',
-      '../common/picojson.h',
-      '../common/utils.h',
-    ],
-    'cflags': [
-      '-fPIC',
-      '-fvisibility=hidden',
-    ],
-  },
-  'includes': {
-    'common/tizen_mobile.gypi',
-    'bluetooth/bluetooth.gypi',
-    'notification/notification.gypi',
-    'power/power.gypi',
-    'system_info/system_info.gypi',
-    'tizen/tizen.gypi',
-    'networkbearerselection/networkbearerselection.gypi',
-    'time/time.gypi',
-  },
+  'targets': [
+    {
+      'target_name': 'build_all_tizen_extensions',
+      'type': 'none',
+      'dependencies': [
+        'bluetooth/bluetooth.gyp:*',
+        'networkbearerselection/networkbearerselection.gyp:*',
+        'notification/notification.gyp:*',
+        'power/power.gyp:*',
+        'system_info/system_info.gyp:*',
+        'time/time.gyp:*',
+        'tizen/tizen.gyp:*',
+      ],
+    },
+  ],
 }
similarity index 80%
rename from tizen/tizen.gypi
rename to tizen/tizen.gyp
index 343a153..cf3c45c 100644 (file)
@@ -1,4 +1,7 @@
 {
+  'includes':[
+    '../common/common.gypi',
+  ],
   'targets': [
     {
       'target_name': 'tizen',