Update GenBuild to append FLAGS from FPD files to the FLAGS defined in tools_def.txt
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 4 Oct 2006 23:00:35 +0000 (23:00 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 4 Oct 2006 23:00:35 +0000 (23:00 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1656 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java

index e5e4d5e..ceb19d9 100644 (file)
@@ -24,6 +24,8 @@ import java.util.Iterator;
 import java.util.List;\r
 import java.util.Map;\r
 import java.util.Set;\r
+import java.util.regex.Matcher;\r
+import java.util.regex.Pattern;\r
 \r
 import org.apache.xmlbeans.XmlException;\r
 import org.apache.xmlbeans.XmlObject;\r
@@ -731,11 +733,11 @@ public class GlobalData {
         ToolChainMap toolChainConfig = toolsDef.getConfig();\r
         String setting = null;\r
 \r
+        setting = toolChainConfig.get(toolChainKey);\r
+        if (setting == null) {\r
+          setting = "";\r
+        }\r
         if (!commandDescription[ToolChainElement.ATTRIBUTE.value].equals(ToolChainAttribute.FLAGS.toString())) {\r
-            setting = toolChainConfig.get(toolChainKey);\r
-            if (setting == null) {\r
-                setting = "";\r
-            }\r
             return setting;\r
         }\r
 \r
@@ -746,7 +748,98 @@ public class GlobalData {
         ToolChainMap option = moduleToolChainOption.get(fpdModuleId);\r
         ToolChainKey toolChainFamilyKey = null;\r
 \r
-        if ((option == null) || (option != null && (setting = option.get(toolChainKey)) == null)) {\r
+        if (option != null && option.get(toolChainKey) != null)  \r
+        {\r
+          String str = option.get(toolChainKey);\r
+\r
+          Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+");\r
+          Matcher matcher = myPattern.matcher(str + " ");\r
+          while (matcher.find()) \r
+          {\r
+            setting = setting + " " + str.substring(matcher.start(1), matcher.end(1));\r
+          }\r
+        } \r
+//        else \r
+//        {\r
+          if (toolChainFamilyKey == null) \r
+          {\r
+            toolChainFamilyKey = new ToolChainKey(commandDescription);\r
+            toolChainFamilyKey.setKey(ToolChainAttribute.FAMILY.toString(), ToolChainElement.ATTRIBUTE.value);\r
+            String family = toolChainConfig.get(toolChainFamilyKey);\r
+            toolChainFamilyKey.setKey(family, ToolChainElement.TOOLCHAIN.value);\r
+            toolChainFamilyKey.setKey(ToolChainAttribute.FLAGS.toString(), ToolChainElement.ATTRIBUTE.value);\r
+          }\r
+\r
+          option = moduleToolChainFamilyOption.get(fpdModuleId);\r
+          if (option != null && option.get(toolChainFamilyKey) != null) \r
+          {\r
+            String str = option.get(toolChainFamilyKey);\r
+\r
+            Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+");\r
+            Matcher matcher = myPattern.matcher(str + " ");\r
+            while (matcher.find()) \r
+            {\r
+              setting = setting + " " + str.substring(matcher.start(1), matcher.end(1));\r
+            }\r
+          }\r
+//        }\r
+\r
+        //\r
+        // get platform options, if any\r
+        //\r
+        // tool tag first\r
+//        if (platformToolChainOption != null && platformToolChainOption.get(toolChainKey) != null) \r
+        if (platformToolChainOption.get(toolChainKey) != null) \r
+        {\r
+          String str = platformToolChainOption.get(toolChainKey);\r
+\r
+          Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+");\r
+          Matcher matcher = myPattern.matcher(str + " ");\r
+          while (matcher.find()) \r
+          {\r
+            setting = setting + " " + str.substring(matcher.start(1), matcher.end(1));\r
+          }\r
+        } \r
+//        else \r
+//        {\r
+          // then tool chain family\r
+          if (toolChainFamilyKey == null) \r
+          {\r
+            toolChainFamilyKey = new ToolChainKey(commandDescription);\r
+            toolChainFamilyKey.setKey(ToolChainAttribute.FAMILY.toString(), ToolChainElement.ATTRIBUTE.value);\r
+            String family = toolChainConfig.get(toolChainFamilyKey);\r
+            toolChainFamilyKey.setKey(family, ToolChainElement.TOOLCHAIN.value);\r
+            toolChainFamilyKey.setKey(ToolChainAttribute.FLAGS.toString(), ToolChainElement.ATTRIBUTE.value);\r
+          }\r
+\r
+//          if (platformToolChainFamilyOption != null && platformToolChainFamilyOption.get(toolChainFamilyKey) != null) \r
+          if (platformToolChainFamilyOption.get(toolChainFamilyKey) != null) \r
+          {\r
+            String str = platformToolChainFamilyOption.get(toolChainFamilyKey);\r
+\r
+            setting = setting + " " + str;\r
+\r
+//            Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+");\r
+//            Matcher matcher = myPattern.matcher(str + " ");\r
+//            while (matcher.find()) \r
+//            {\r
+//              setting = setting + " " + str.substring(matcher.start(1), matcher.end(1));\r
+//            }\r
+          }\r
+//        }\r
+\r
+        return setting;\r
+\r
+/*\r
+        //\r
+        // get module specific options, if any\r
+        //\r
+        // tool tag first\r
+        ToolChainMap option = moduleToolChainOption.get(fpdModuleId);\r
+        ToolChainKey toolChainFamilyKey = null;\r
+        \r
+        if ((option == null) || (option != null && (setting = option.get(toolChainKey)) == null)) \r
+        {\r
             //\r
             // then tool chain family\r
             //\r
@@ -786,6 +879,7 @@ public class GlobalData {
         }\r
 \r
         return setting;\r
+*/\r
     }\r
 \r
     public static void setToolChainEnvInfo(ToolChainInfo envInfo) {\r