targets/Xenomai/__init__.py
changeset 633 70c84e6ff92c
parent 615 72bc3e53a1fa
child 634 5b925a1d8fed
--- a/targets/Xenomai/__init__.py	Tue Nov 08 22:39:44 2011 +0100
+++ b/targets/Xenomai/__init__.py	Wed Nov 16 12:50:16 2011 +0100
@@ -3,29 +3,23 @@
 
 class Xenomai_target(toolchain_gcc):
     extension = ".so"
-    def getXenoConfig(self):
+    def getXenoConfig(self, flagsname):
         """ Get xeno-config from target parameters """
-        return self.PluginsRootInstance.GetTarget().getcontent()["value"].getXenoConfig()
+        xeno_config=self.PluginsRootInstance.GetTarget().getcontent()["value"].getXenoConfig()
+        if xeno_config:
+            status, result, err_result = ProcessLogger(self.PluginsRootInstance.logger,
+                                                       xeno_config + " --skin=native --"+flagsname,
+                                                       no_stdout=True).spin()
+            if status:
+                self.PluginsRootInstance.logger.write_error(_("Unable to get Xenomai's %s \n")%flagsname)
+            return [result.strip()]
+        return []
     
     def getBuilderLDFLAGS(self):
-        # get xeno-config from target parameters
-        xeno_config = self.getXenoConfig()
-
-        status, result, err_result = ProcessLogger(self.PluginsRootInstance.logger, xeno_config + " --skin=native --ldflags", no_stdout=True).spin()
-        if status:
-            self.PluginsRootInstance.logger.write_error(_("Unable to get Xenomai's LDFLAGS\n"))
-        xeno_ldlags = result.strip()
-        
-        return toolchain_gcc.getBuilderLDFLAGS(self) + [xeno_ldlags, "-shared", "-lnative"]
+        xeno_ldflags = self.getXenoConfig("ldflags")
+        return toolchain_gcc.getBuilderLDFLAGS(self) + xeno_ldlags + ["-shared", "-lnative"]
 
     def getBuilderCFLAGS(self):
-        # get xeno-config from target parameters
-        xeno_config = self.getXenoConfig()
-
-        status, result, err_result = ProcessLogger(self.PluginsRootInstance.logger, xeno_config + " --skin=native --cflags", no_stdout=True).spin()
-        if status:
-            self.PluginsRootInstance.logger.write_error(_("Unable to get Xenomai's CFLAGS\n"))
-        xeno_cflags = result.strip()
+        xeno_cflags = self.getXenoConfig("cflags")
+        return toolchain_gcc.getBuilderCFLAGS(self) + xeno_cflags
         
-        return toolchain_gcc.getBuilderCFLAGS(self) + [xeno_cflags]
-