a) Cleaned tools_def.template
authorjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 13 Oct 2006 09:21:14 +0000 (09:21 +0000)
committerjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 13 Oct 2006 09:21:14 +0000 (09:21 +0000)
b) Changed overriding priority of tool chain definition. Now right non-* has higher priority.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1744 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Conf/tools_def.template
Tools/Java/Source/GenBuild/org/tianocore/build/global/GlobalData.java
Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainMap.java

index 6cb197f..f36bcf2 100644 (file)
@@ -15,6 +15,23 @@ IDENTIFIER = Default TOOL_CHAIN_CONF
 ####################################################################################\r
 #\r
 # format: TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE = <string>\r
+# priorty:\r
+#         TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE (Highest)\r
+#         ******_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE\r
+#         TARGET_*********_ARCH_COMMANDTYPE_ATTRIBUTE\r
+#         ******_*********_ARCH_COMMANDTYPE_ATTRIBUTE\r
+#         TARGET_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE\r
+#         ******_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE\r
+#         TARGET_*********_****_COMMANDTYPE_ATTRIBUTE\r
+#         ******_*********_****_COMMANDTYPE_ATTRIBUTE\r
+#         TARGET_TOOLCHAIN_ARCH_***********_ATTRIBUTE\r
+#         ******_TOOLCHAIN_ARCH_***********_ATTRIBUTE\r
+#         TARGET_*********_ARCH_***********_ATTRIBUTE\r
+#         ******_*********_ARCH_***********_ATTRIBUTE\r
+#         TARGET_TOOLCHAIN_****_***********_ATTRIBUTE\r
+#         ******_TOOLCHAIN_****_***********_ATTRIBUTE\r
+#         TARGET_*********_****_***********_ATTRIBUTE\r
+#         ******_*********_****_***********_ATTRIBUTE (Lowest)\r
 #\r
 ####################################################################################\r
 ####################################################################################\r
@@ -124,10 +141,12 @@ RELEASE_WINDDK3790x1830_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OP
 ##################\r
 # IPF definitions\r
 ##################\r
+*_WINDDK3790x1830_IPF_APP_NAME      = cl.exe\r
 *_WINDDK3790x1830_IPF_ASM_NAME      = ias.exe\r
 *_WINDDK3790x1830_IPF_ASM_EXT       = .s\r
 *_WINDDK3790x1830_IPF_*_PATH        = C:\WINDDK\3790.1830\bin\win64\x86\r
 \r
+*_WINDDK3790x1830_IPF_APP_FLAGS     = /nologo /P /TC\r
 *_WINDDK3790x1830_IPF_PP_FLAGS      = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h\r
 *_WINDDK3790x1830_IPF_CC_FLAGS      = /GS- /nologo /W4 /WX /EHs-c- /Gy /c /D EFI64 /O1i /DEFI_FIRMWARE_VENDOR=L\"INTEL\" /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h\r
 *_WINDDK3790x1830_IPF_PCH_FLAGS     = /GS- /nologo /W4 /WX /EHs-c- /Gy /c /D EFI64 /O1i /DEFI_FIRMWARE_VENDOR=L\"INTEL\" /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC\r
@@ -155,10 +174,7 @@ RELEASE_WINDDK3790x1830_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OP
 ##################\r
 *_WINDDK3790x1830_*_ASL_FAMILY  = INTEL\r
 *_WINDDK3790x1830_*_ASL_NAME    = iasl.exe\r
-*_WINDDK3790x1830_IA32_ASL_PATH = C:\ASL\r
-*_WINDDK3790x1830_X64_ASL_PATH  = C:\ASL\r
-*_WINDDK3790x1830_IPF_ASL_PATH  = C:\ASL\r
-*_WINDDK3790x1830_EBC_ASL_PATH  = C:\ASL\r
+*_WINDDK3790x1830_*_ASL_PATH    = C:\ASL\r
 \r
 ####################################################################################\r
 #\r
@@ -248,10 +264,7 @@ RELEASE_VS2005PRO_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF
 ##################\r
 *_VS2005PRO_*_ASL_FAMILY  = INTEL\r
 *_VS2005PRO_*_ASL_NAME    = iasl.exe\r
-*_VS2005PRO_IA32_ASL_PATH = C:\ASL\r
-*_VS2005PRO_X64_ASL_PATH  = C:\ASL\r
-*_VS2005PRO_IPF_ASL_PATH  = C:\ASL\r
-*_VS2005PRO_EBC_ASL_PATH  = C:\ASL\r
+*_VS2005PRO_*_ASL_PATH    = C:\ASL\r
 \r
 ####################################################################################\r
 #\r
@@ -330,10 +343,7 @@ RELEASE_VS2005PRO_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF
 # \r
 # *_*_*_ASL_FAMILY  = INTEL\r
 # *_*_*_ASL_NAME    = iasl.exe\r
-# *_*_IA32_ASL_PATH = C:\ASL\r
-# *_*_X64_ASL_PATH  = C:\ASL\r
-# *_*_IPF_ASL_PATH  = C:\ASL\r
-# *_*_EBC_ASL_PATH  = C:\ASL\r
+# *_*_*_ASL_PATH    = C:\ASL\r
 # \r
 ####################################################################################\r
 #\r
@@ -343,10 +353,7 @@ RELEASE_VS2005PRO_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF
 # \r
 # *_*_*_ASL_FAMILY  = MSFT\r
 # *_*_*_ASL_NAME    = asl.exe\r
-# *_*_IA32_ASL_PATH = C:\ASL\r
-# *_*_X64_ASL_PATH  = C:\ASL\r
-# *_*_IPF_ASL_PATH  = C:\ASL\r
-# *_*_EBC_ASL_PATH  = C:\ASL\r
+# *_*_*_ASL_PATH    = C:\ASL\r
 # \r
 \r
 ####################################################################################\r
@@ -359,20 +366,20 @@ RELEASE_VS2005PRO_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF
 #   ASL  - Intel ACPI Source Language COmpiler\r
 #\r
 ####################################################################################\r
+*_MYTOOLS_*_*_FAMILY             = MSFT\r
+\r
+*_MYTOOLS_*_CC_NAME              = cl.exe  \r
+*_MYTOOLS_*_SLINK_NAME           = lib.exe\r
+*_MYTOOLS_*_DLINK_NAME           = link.exe\r
+*_MYTOOLS_*_ASMLINK_NAME         = link.exe\r
+*_MYTOOLS_*_PP_NAME              = cl.exe \r
+*_MYTOOLS_*_ASM_NAME             = ml.exe\r
 \r
 ##################\r
 # IA32 definitions\r
 ##################\r
-*_MYTOOLS_IA32_*_FAMILY          = MSFT\r
-\r
-*_MYTOOLS_IA32_CC_NAME           = cl.exe  \r
-*_MYTOOLS_IA32_SLINK_NAME        = lib.exe\r
-*_MYTOOLS_IA32_DLINK_NAME        = link.exe\r
-*_MYTOOLS_IA32_ASMLINK_NAME      = link.exe\r
-*_MYTOOLS_IA32_PP_NAME           = cl.exe \r
-*_MYTOOLS_IA32_ASM_NAME          = ml.exe\r
-*_MYTOOLS_IA32_ASM_EXT           = .asm\r
 *_MYTOOLS_IA32_PCH_NAME          = cl.exe \r
+*_MYTOOLS_IA32_ASM_EXT           = .asm\r
 \r
 *_MYTOOLS_IA32_*_PATH            = C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\r
 *_MYTOOLS_IA32_*_DPATH           = C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\r
@@ -392,22 +399,14 @@ RELEASE_MYTOOLS_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /
 ##################\r
 # x64 definitions\r
 ##################\r
-*_MYTOOLS_X64_*_FAMILY          = MSFT\r
-\r
-*_MYTOOLS_X64_CC_NAME           = cl.exe\r
-*_MYTOOLS_X64_SLINK_NAME        = lib.exe\r
-*_MYTOOLS_X64_DLINK_NAME        = link.exe\r
-*_MYTOOLS_X64_ASMLINK_NAME      = link.exe\r
-*_MYTOOLS_X64_PP_NAME           = cl.exe\r
 *_MYTOOLS_X64_PCH_NAME          = cl.exe\r
-\r
-*_MYTOOLS_X64_SLINK_FLAGS       = /nologo /LTCG\r
-\r
 *_MYTOOLS_X64_ASM_NAME          = ml64.exe\r
 *_MYTOOLS_X64_ASM_EXT           = .asm\r
+\r
 *_MYTOOLS_X64_*_PATH            = C:\WINDDK\3790.1830\bin\win64\x86\amd64\r
 *_MYTOOLS_X64_ASMLINK_PATH      = C:\WINDDK\3790.1830\bin\bin16\\r
 \r
+*_MYTOOLS_X64_SLINK_FLAGS       = /nologo /LTCG\r
 *_MYTOOLS_X64_PP_FLAGS          = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h \r
 DEBUG_MYTOOLS_X64_CC_FLAGS      = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DOLDSMM=1 /D EFI_FIRMWARE_VENDOR=L\"INTEL\" /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /Zi /Gm /EHs-c- /GF\r
 RELEASE_MYTOOLS_X64_CC_FLAGS    = /nologo /X /W4 /WX /c /Gs8192 /GS- /D UNICODE /O1ib2s /GL /Gy /D EFIX64 /DOLDSMM=1 /D EFI_FIRMWARE_VENDOR=L\"INTEL\" /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yu${DEST_DIR_DEBUG}/AutoGen.h /EHs-c- /GF\r
@@ -421,19 +420,11 @@ RELEASE_MYTOOLS_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /O
 ##################\r
 # IPF definitions\r
 ##################\r
-*_MYTOOLS_IPF_*_FAMILY      = MSFT\r
-\r
-*_MYTOOLS_IPF_APP_NAME      = cl.exe\r
-*_MYTOOLS_IPF_PP_NAME       = cl.exe\r
-*_MYTOOLS_IPF_CC_NAME       = cl.exe\r
-*_MYTOOLS_IPF_SLINK_NAME    = lib.exe\r
-*_MYTOOLS_IPF_DLINK_NAME    = link.exe\r
 *_MYTOOLS_IPF_PCH_NAME      = cl.exe\r
-\r
-*_MYTOOLS_IPF_SLINK_FLAGS   = /nologo /LTCG\r
-\r
+*_MYTOOLS_IPF_APP_NAME      = cl.exe\r
 *_MYTOOLS_IPF_ASM_NAME      = ias.exe\r
 *_MYTOOLS_IPF_ASM_EXT       = .s\r
+\r
 *_MYTOOLS_IPF_*_PATH        = C:\WINDDK\3790.1830\bin\win64\x86\r
 \r
 *_MYTOOLS_IPF_APP_FLAGS     = /nologo /P /TC\r
@@ -442,6 +433,7 @@ RELEASE_MYTOOLS_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /O
 *_MYTOOLS_IPF_PCH_FLAGS     = /GS- /nologo /W4 /WX /EHs-c- /Gy /c /D EFI64 /O1i /DEFI_FIRMWARE_VENDOR=L\"INTEL\" /DSTRING_ARRAY_NAME=${BASE_NAME}Strings /FI${DEST_DIR_DEBUG}/AutoGen.h /Fp${DEST_DIR_OUTPUT}/AutoGen.h.gch /Yc /TC\r
 *_MYTOOLS_IPF_ASM_FLAGS     = -N us -X explicit -M ilp64 -N so -W4\r
 *_MYTOOLS_IPF_DLINK_FLAGS   = /NOLOGO /NODEFAULTLIB /LTCG /OPT:REF /IGNORE:4086 /MAP /MACHINE:IA64 /ENTRY:${ENTRYPOINT} /SUBSYSTEM:CONSOLE /MAP:${DEST_DIR_DEBUG}/${BASE_NAME}.map /PDB:${DEST_DIR_DEBUG}/${BASE_NAME}.pdb \r
+*_MYTOOLS_IPF_SLINK_FLAGS   = /nologo /LTCG\r
 \r
 ##################\r
 # EBC definitions\r
@@ -451,6 +443,7 @@ RELEASE_MYTOOLS_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /O
 *_MYTOOLS_EBC_CC_NAME       = iec.exe\r
 *_MYTOOLS_EBC_DLINK_NAME    = link.exe\r
 *_MYTOOLS_EBC_SLINK_NAME    = link.exe\r
+\r
 *_MYTOOLS_EBC_*_PATH        = C:\Program Files\Intel\EBC\Bin\r
 *_MYTOOLS_EBC_*_SPATH       = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib"\r
 \r
@@ -464,7 +457,4 @@ RELEASE_MYTOOLS_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /O
 ##################\r
 *_MYTOOLS_*_ASL_FAMILY  = INTEL\r
 *_MYTOOLS_*_ASL_NAME    = iasl.exe\r
-*_MYTOOLS_IA32_ASL_PATH = C:\ASL\r
-*_MYTOOLS_X64_ASL_PATH  = C:\ASL\r
-*_MYTOOLS_IPF_ASL_PATH  = C:\ASL\r
-*_MYTOOLS_EBC_ASL_PATH  = C:\ASL\r
+*_MYTOOLS_*_ASL_PATH    = C:\ASL\r
index ceb19d9..9138036 100644 (file)
@@ -132,6 +132,7 @@ public class GlobalData {
     private static Map<FpdModuleIdentification, ToolChainMap> moduleToolChainOption = new HashMap<FpdModuleIdentification, ToolChainMap>();\r
     private static Map<FpdModuleIdentification, ToolChainMap> moduleToolChainFamilyOption = new HashMap<FpdModuleIdentification, ToolChainMap>();\r
 \r
+    private static Pattern flagPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+");\r
     /**\r
       Parse framework database (DB) and all SPD files listed in DB to initialize\r
       the environment for next build. This method will only be executed only once\r
@@ -733,153 +734,71 @@ public class GlobalData {
         ToolChainMap toolChainConfig = toolsDef.getConfig();\r
         String setting = null;\r
 \r
+        //\r
+        // Default in tools_def.txt\r
+        // \r
         setting = toolChainConfig.get(toolChainKey);\r
         if (setting == null) {\r
-          setting = "";\r
+            setting = "";\r
         }\r
         if (!commandDescription[ToolChainElement.ATTRIBUTE.value].equals(ToolChainAttribute.FLAGS.toString())) {\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.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
+        // tool's option can be in .fpd and/or .msa file\r
+        //\r
+        String optionString;\r
+        ToolChainMap option = null;\r
+        ToolChainKey toolChainFamilyKey = new ToolChainKey(commandDescription);\r
 \r
-        return setting;\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
         //\r
-        // get module specific options, if any\r
+        // Platform's tool chain family option\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
-            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
-            option = moduleToolChainFamilyOption.get(fpdModuleId);\r
-            if (option != null) {\r
-                setting = option.get(toolChainFamilyKey);\r
-            }\r
+        optionString = platformToolChainFamilyOption.get(toolChainFamilyKey);\r
+        if (optionString != null) {\r
+            setting += (" " + optionString);\r
         }\r
 \r
         //\r
-        // get platform options, if any\r
+        // Platform's tool chain tag option\r
         //\r
-        if (setting == null) {\r
-            // tool tag first\r
-            if (platformToolChainOption == null || (setting = platformToolChainOption.get(toolChainKey)) == null) {\r
-                // then tool chain family\r
-                if (toolChainFamilyKey == null) {\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
+        optionString = platformToolChainOption.get(toolChainKey);\r
+        if (optionString != null) {\r
+            Matcher matcher = flagPattern.matcher(optionString + " ");\r
+            while (matcher.find()) {\r
+                setting += (" " + optionString.substring(matcher.start(1), matcher.end(1)));\r
+            }\r
+        }\r
 \r
-                setting = platformToolChainFamilyOption.get(toolChainFamilyKey);\r
+        //\r
+        // Module's tool chain family option\r
+        //\r
+        option = moduleToolChainFamilyOption.get(fpdModuleId);\r
+        if (option != null && (optionString = option.get(toolChainFamilyKey)) != null) {\r
+            Matcher matcher = flagPattern.matcher(optionString + " ");\r
+            while (matcher.find()) {\r
+                setting += (" " + optionString.substring(matcher.start(1), matcher.end(1)));\r
             }\r
         }\r
 \r
-        if (setting == null) {\r
-            setting = "";\r
+        //\r
+        // Module's tool chain tag option\r
+        //\r
+        option = moduleToolChainOption.get(fpdModuleId);\r
+        if (option != null && (optionString = option.get(toolChainKey)) != null) {\r
+            Matcher matcher = flagPattern.matcher(optionString + " ");\r
+            while (matcher.find()) {\r
+                setting += (" " + optionString.substring(matcher.start(1), matcher.end(1)));\r
+            }\r
         }\r
 \r
         return setting;\r
-*/\r
     }\r
 \r
     public static void setToolChainEnvInfo(ToolChainInfo envInfo) {\r
index b9d24eb..f3f0779 100644 (file)
@@ -29,7 +29,7 @@ public class ToolChainMap {
     //\r
     // From which part of key can be used to match "*"\r
     // \r
-    private int matchLevel = ToolChainKey.keyLength - 2;\r
+    private int matchLevel = ToolChainKey.keyLength - 1;\r
 \r
     //\r
     // A Map object in which tool chain configuration information will be stored\r
@@ -211,98 +211,96 @@ public class ToolChainMap {
         ///\r
         /// In the current tool chain definition format (in name/value pair), \r
         /// there're five parts in the "name". The last part of the "name" must\r
-        /// not be "wildcard". So we should start combining "*" from the fourth part.\r
+        /// not be "wildcard". We should start combining "*" from left to right.\r
         /// We'll try all the possible combinations until the value can be fetched.\r
         ///  \r
         /// The following code implements the logic which will try to use, for example,\r
         /// following key parts combinations sequentially to get the value.\r
         /// \r
         /// TARGET_TOOLCHAIN_ARCH_TOOLCODE_ATTRIBUTE\r
-        /// TARGET_TOOLCHAIN_ARCH_*_ATTRIBUTE\r
-        /// TARGET_TOOLCHAIN_*_TOOLCODE_ATTRIBUTE\r
-        /// TARGET_TOOLCHAIN_*_*_ATTRIBUTE\r
-        /// TARGET_*_ARCH_TOOLCODE_ATTRIBUTE\r
-        /// TARGET_*_ARCH_*_ATTRIBUTE\r
-        /// TARGET_*_*_TOOLCODE_ATTRIBUTE\r
-        /// TARGET_*_*_*_ATTRIBUTE\r
-        /// *_TOOLCHAIN_ARCH_TOOLCODE_ATTRIBUTE\r
-        /// *_TOOLCHAIN_ARCH_*_ATTRIBUTE\r
-        /// *_TOOLCHAIN_*_TOOLCODE_ATTRIBUTE\r
-        /// *_TOOLCHAIN_*_*_ATTRIBUTE\r
-        /// *_*_ARCH_TOOLCODE_ATTRIBUTE\r
-        /// *_*_ARCH_*_ATTRIBUTE\r
-        /// *_*_*_TOOLCODE_ATTRIBUTE\r
-        /// *_*_*_*_ATTRIBUTE\r
+        /// ******_TOOLCHAIN_ARCH_TOOLCODE_ATTRIBUTE\r
+        /// TARGET_*********_ARCH_TOOLCODE_ATTRIBUTE\r
+        /// ******_*********_ARCH_TOOLCODE_ATTRIBUTE\r
+        /// TARGET_TOOLCHAIN_****_TOOLCODE_ATTRIBUTE\r
+        /// ******_TOOLCHAIN_****_TOOLCODE_ATTRIBUTE\r
+        /// TARGET_*********_****_TOOLCODE_ATTRIBUTE\r
+        /// ******_*********_****_TOOLCODE_ATTRIBUTE\r
+        /// TARGET_TOOLCHAIN_ARCH_********_ATTRIBUTE\r
+        /// ******_TOOLCHAIN_ARCH_********_ATTRIBUTE\r
+        /// TARGET_*********_ARCH_********_ATTRIBUTE\r
+        /// ******_*********_ARCH_********_ATTRIBUTE\r
+        /// TARGET_TOOLCHAIN_****_********_ATTRIBUTE\r
+        /// ******_TOOLCHAIN_****_********_ATTRIBUTE\r
+        /// TARGET_*********_****_********_ATTRIBUTE\r
+        /// ******_*********_****_********_ATTRIBUTE\r
         /// \r
 \r
         //\r
-        // level is used to control if all parts of "name" have been "wildcarded"\r
+        // The wildcard "*" appears regularly (2^n). "*" in TARGET appears 2^0 \r
+        // times at every 2^0 TARGET, "*" in TOOLCHAIN appears 2^1 times at \r
+        // every 2^1 TOOLCHAIN,  and "*" in TOOLCODE appears 2^3 times at every \r
+        // 2^3 TOOLCODE. We're going to use this to form all the combinations of key.\r
         // \r
-        int level = matchLevel;\r
-        while (level >= 0) {\r
+        int[] combinations = new int[matchLevel];\r
+        for (int i = 0; i < matchLevel; ++i) {\r
             //\r
-            // tmplevel is used to control if all parts of "name" between first\r
-            // "*" and fourth name part have been "wildcarded".\r
+            // initialize the array with 2^n\r
             // \r
-            int tmpLevel = level;\r
-            while (tmpLevel >= level) {\r
-                String[] tmpKeySet = tmpKey.getKeySet();\r
+            combinations[i] = 1 << (i + 1);\r
+        }\r
+\r
+        //\r
+        // when last part goes down to zero, we tried all combinations of key\r
+        // \r
+        int lastIndex = matchLevel - 1;\r
+        while (combinations[lastIndex] > 0) {\r
+            //\r
+            // form the key which has "*" in it\r
+            // \r
+            for (int i = 0; i < matchLevel; ++i) {\r
+                //\r
+                // start again if not finished\r
+                // \r
+                if (combinations[i] == 0) {\r
+                    combinations[i] = 1 << (i + 1);\r
+                }\r
+\r
+                //\r
+                // half of 2^n is "*", the rest is non-*\r
+                // \r
                 try {\r
-                    if (!tmpKeySet[tmpLevel].equals("*")) {\r
-                        //\r
-                        // If "tmplevel" part is not "*", set it to "*".\r
-                        // For example, at first loop, the key will become\r
-                        // TARGET_TOOLCHAIN_ARCH_*_ATTRIBUTE, and at next loop,\r
-                        // become TARGET_TOOLCHAIN_*_ARCH_ATTRIBUTE\r
-                        // \r
-                        tmpKey.setKey("*", tmpLevel);\r
-                        //\r
-                        // We'll try all possible combinations between current\r
-                        // part and the fourth part.\r
-                        // \r
-                        tmpLevel = matchLevel;\r
+                    if (combinations[i] > (1 << i)) {\r
+                        tmpKey.setKey(keySet[i], i);\r
                     } else {\r
-                        //\r
-                        // Restore original value of key if "*" at "tmplevel"\r
-                        // part of "name" has been checked\r
-                        // \r
-                        tmpKey.setKey(keySet[tmpLevel], tmpLevel);\r
-                        //\r
-                        // Try "*" at part left to "tmplevel" part of "name"\r
-                        // \r
-                        --tmpLevel;\r
-                        continue;\r
+                        tmpKey.setKey("*", i);\r
                     }\r
                 } catch (Exception e) {\r
                     return null;\r
                 }\r
 \r
+                combinations[i] -= 1;\r
+            }\r
+\r
+            //\r
+            // Try get the value from the map\r
+            // \r
+            result = map.get(tmpKey);\r
+            if (result != null) {\r
                 //\r
-                // Try get the value from the map\r
+                // The map actually has no exact key as the given "key", \r
+                // putting it back into map can speed up the get() next time\r
                 // \r
-                result = map.get(tmpKey);\r
-                if (result != null) {\r
-                    //\r
-                    // The map actually has no exact key as the given "key", \r
-                    // putting it back into map can speed up the get() next time\r
-                    // \r
-                    map.put(key, result);\r
-                    return result;\r
-                }\r
+                map.put(key, result);\r
+                return result;\r
             }\r
-            ///\r
-            /// If all possible combinations of "wildcard" between "level" and \r
-            /// the fourth part of "name" have been tried, try the left part\r
-            /// \r
-            --level;\r
         }\r
 \r
         //\r
         // The map actually has no exact key as the given "key", putting it back\r
         // into map can speed up the get() next time even we got nothing.\r
         // \r
-        map.put(key, result);\r
-        return result;\r
+        map.put(key, null);\r
+        return null;\r
     }\r
 \r
     /**\r