From 0923e8b3b22a10416d9c8e0a192f0e88758a1b90 Mon Sep 17 00:00:00 2001 From: mdkinney Date: Wed, 4 Oct 2006 23:00:35 +0000 Subject: [PATCH] Update GenBuild to append FLAGS from FPD files to the FLAGS defined in tools_def.txt git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1656 6f19259b-4bc3-4df7-8a09-765794883524 --- .../tianocore/build/global/GlobalData.java | 104 +++++++++++++++++- 1 file changed, 99 insertions(+), 5 deletions(-) diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java index e5e4d5e671..ceb19d91db 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java @@ -24,6 +24,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.xmlbeans.XmlException; import org.apache.xmlbeans.XmlObject; @@ -731,11 +733,11 @@ public class GlobalData { ToolChainMap toolChainConfig = toolsDef.getConfig(); String setting = null; + setting = toolChainConfig.get(toolChainKey); + if (setting == null) { + setting = ""; + } if (!commandDescription[ToolChainElement.ATTRIBUTE.value].equals(ToolChainAttribute.FLAGS.toString())) { - setting = toolChainConfig.get(toolChainKey); - if (setting == null) { - setting = ""; - } return setting; } @@ -746,7 +748,98 @@ public class GlobalData { ToolChainMap option = moduleToolChainOption.get(fpdModuleId); ToolChainKey toolChainFamilyKey = null; - if ((option == null) || (option != null && (setting = option.get(toolChainKey)) == null)) { + if (option != null && option.get(toolChainKey) != null) + { + String str = option.get(toolChainKey); + + Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+"); + Matcher matcher = myPattern.matcher(str + " "); + while (matcher.find()) + { + setting = setting + " " + str.substring(matcher.start(1), matcher.end(1)); + } + } +// else +// { + if (toolChainFamilyKey == null) + { + toolChainFamilyKey = new ToolChainKey(commandDescription); + toolChainFamilyKey.setKey(ToolChainAttribute.FAMILY.toString(), ToolChainElement.ATTRIBUTE.value); + String family = toolChainConfig.get(toolChainFamilyKey); + toolChainFamilyKey.setKey(family, ToolChainElement.TOOLCHAIN.value); + toolChainFamilyKey.setKey(ToolChainAttribute.FLAGS.toString(), ToolChainElement.ATTRIBUTE.value); + } + + option = moduleToolChainFamilyOption.get(fpdModuleId); + if (option != null && option.get(toolChainFamilyKey) != null) + { + String str = option.get(toolChainFamilyKey); + + Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+"); + Matcher matcher = myPattern.matcher(str + " "); + while (matcher.find()) + { + setting = setting + " " + str.substring(matcher.start(1), matcher.end(1)); + } + } +// } + + // + // get platform options, if any + // + // tool tag first +// if (platformToolChainOption != null && platformToolChainOption.get(toolChainKey) != null) + if (platformToolChainOption.get(toolChainKey) != null) + { + String str = platformToolChainOption.get(toolChainKey); + + Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+"); + Matcher matcher = myPattern.matcher(str + " "); + while (matcher.find()) + { + setting = setting + " " + str.substring(matcher.start(1), matcher.end(1)); + } + } +// else +// { + // then tool chain family + if (toolChainFamilyKey == null) + { + toolChainFamilyKey = new ToolChainKey(commandDescription); + toolChainFamilyKey.setKey(ToolChainAttribute.FAMILY.toString(), ToolChainElement.ATTRIBUTE.value); + String family = toolChainConfig.get(toolChainFamilyKey); + toolChainFamilyKey.setKey(family, ToolChainElement.TOOLCHAIN.value); + toolChainFamilyKey.setKey(ToolChainAttribute.FLAGS.toString(), ToolChainElement.ATTRIBUTE.value); + } + +// if (platformToolChainFamilyOption != null && platformToolChainFamilyOption.get(toolChainFamilyKey) != null) + if (platformToolChainFamilyOption.get(toolChainFamilyKey) != null) + { + String str = platformToolChainFamilyOption.get(toolChainFamilyKey); + + setting = setting + " " + str; + +// Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+"); +// Matcher matcher = myPattern.matcher(str + " "); +// while (matcher.find()) +// { +// setting = setting + " " + str.substring(matcher.start(1), matcher.end(1)); +// } + } +// } + + return setting; + +/* + // + // get module specific options, if any + // + // tool tag first + ToolChainMap option = moduleToolChainOption.get(fpdModuleId); + ToolChainKey toolChainFamilyKey = null; + + if ((option == null) || (option != null && (setting = option.get(toolChainKey)) == null)) + { // // then tool chain family // @@ -786,6 +879,7 @@ public class GlobalData { } return setting; +*/ } public static void setToolChainEnvInfo(ToolChainInfo envInfo) { -- 2.39.2