a) Cleaned tools_def.template

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
This commit is contained in:
jwang36
2006-10-13 09:21:14 +00:00
parent 713ace4c96
commit 8c84e1b1ac
3 changed files with 143 additions and 236 deletions

View File

@ -15,6 +15,23 @@ IDENTIFIER = Default TOOL_CHAIN_CONF
#################################################################################### ####################################################################################
# #
# format: TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE = <string> # format: TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE = <string>
# priorty:
# TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE (Highest)
# ******_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE
# TARGET_*********_ARCH_COMMANDTYPE_ATTRIBUTE
# ******_*********_ARCH_COMMANDTYPE_ATTRIBUTE
# TARGET_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE
# ******_TOOLCHAIN_****_COMMANDTYPE_ATTRIBUTE
# TARGET_*********_****_COMMANDTYPE_ATTRIBUTE
# ******_*********_****_COMMANDTYPE_ATTRIBUTE
# TARGET_TOOLCHAIN_ARCH_***********_ATTRIBUTE
# ******_TOOLCHAIN_ARCH_***********_ATTRIBUTE
# TARGET_*********_ARCH_***********_ATTRIBUTE
# ******_*********_ARCH_***********_ATTRIBUTE
# TARGET_TOOLCHAIN_****_***********_ATTRIBUTE
# ******_TOOLCHAIN_****_***********_ATTRIBUTE
# TARGET_*********_****_***********_ATTRIBUTE
# ******_*********_****_***********_ATTRIBUTE (Lowest)
# #
#################################################################################### ####################################################################################
#################################################################################### ####################################################################################
@ -124,10 +141,12 @@ RELEASE_WINDDK3790x1830_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OP
################## ##################
# IPF definitions # IPF definitions
################## ##################
*_WINDDK3790x1830_IPF_APP_NAME = cl.exe
*_WINDDK3790x1830_IPF_ASM_NAME = ias.exe *_WINDDK3790x1830_IPF_ASM_NAME = ias.exe
*_WINDDK3790x1830_IPF_ASM_EXT = .s *_WINDDK3790x1830_IPF_ASM_EXT = .s
*_WINDDK3790x1830_IPF_*_PATH = C:\WINDDK\3790.1830\bin\win64\x86 *_WINDDK3790x1830_IPF_*_PATH = C:\WINDDK\3790.1830\bin\win64\x86
*_WINDDK3790x1830_IPF_APP_FLAGS = /nologo /P /TC
*_WINDDK3790x1830_IPF_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h *_WINDDK3790x1830_IPF_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
*_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 *_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
*_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 *_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
@ -155,10 +174,7 @@ RELEASE_WINDDK3790x1830_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OP
################## ##################
*_WINDDK3790x1830_*_ASL_FAMILY = INTEL *_WINDDK3790x1830_*_ASL_FAMILY = INTEL
*_WINDDK3790x1830_*_ASL_NAME = iasl.exe *_WINDDK3790x1830_*_ASL_NAME = iasl.exe
*_WINDDK3790x1830_IA32_ASL_PATH = C:\ASL *_WINDDK3790x1830_*_ASL_PATH = C:\ASL
*_WINDDK3790x1830_X64_ASL_PATH = C:\ASL
*_WINDDK3790x1830_IPF_ASL_PATH = C:\ASL
*_WINDDK3790x1830_EBC_ASL_PATH = C:\ASL
#################################################################################### ####################################################################################
# #
@ -248,10 +264,7 @@ RELEASE_VS2005PRO_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF
################## ##################
*_VS2005PRO_*_ASL_FAMILY = INTEL *_VS2005PRO_*_ASL_FAMILY = INTEL
*_VS2005PRO_*_ASL_NAME = iasl.exe *_VS2005PRO_*_ASL_NAME = iasl.exe
*_VS2005PRO_IA32_ASL_PATH = C:\ASL *_VS2005PRO_*_ASL_PATH = C:\ASL
*_VS2005PRO_X64_ASL_PATH = C:\ASL
*_VS2005PRO_IPF_ASL_PATH = C:\ASL
*_VS2005PRO_EBC_ASL_PATH = C:\ASL
#################################################################################### ####################################################################################
# #
@ -330,10 +343,7 @@ RELEASE_VS2005PRO_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF
# #
# *_*_*_ASL_FAMILY = INTEL # *_*_*_ASL_FAMILY = INTEL
# *_*_*_ASL_NAME = iasl.exe # *_*_*_ASL_NAME = iasl.exe
# *_*_IA32_ASL_PATH = C:\ASL # *_*_*_ASL_PATH = C:\ASL
# *_*_X64_ASL_PATH = C:\ASL
# *_*_IPF_ASL_PATH = C:\ASL
# *_*_EBC_ASL_PATH = C:\ASL
# #
#################################################################################### ####################################################################################
# #
@ -343,10 +353,7 @@ RELEASE_VS2005PRO_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF
# #
# *_*_*_ASL_FAMILY = MSFT # *_*_*_ASL_FAMILY = MSFT
# *_*_*_ASL_NAME = asl.exe # *_*_*_ASL_NAME = asl.exe
# *_*_IA32_ASL_PATH = C:\ASL # *_*_*_ASL_PATH = C:\ASL
# *_*_X64_ASL_PATH = C:\ASL
# *_*_IPF_ASL_PATH = C:\ASL
# *_*_EBC_ASL_PATH = C:\ASL
# #
#################################################################################### ####################################################################################
@ -359,20 +366,20 @@ RELEASE_VS2005PRO_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF
# ASL - Intel ACPI Source Language COmpiler # ASL - Intel ACPI Source Language COmpiler
# #
#################################################################################### ####################################################################################
*_MYTOOLS_*_*_FAMILY = MSFT
*_MYTOOLS_*_CC_NAME = cl.exe
*_MYTOOLS_*_SLINK_NAME = lib.exe
*_MYTOOLS_*_DLINK_NAME = link.exe
*_MYTOOLS_*_ASMLINK_NAME = link.exe
*_MYTOOLS_*_PP_NAME = cl.exe
*_MYTOOLS_*_ASM_NAME = ml.exe
################## ##################
# IA32 definitions # IA32 definitions
################## ##################
*_MYTOOLS_IA32_*_FAMILY = MSFT
*_MYTOOLS_IA32_CC_NAME = cl.exe
*_MYTOOLS_IA32_SLINK_NAME = lib.exe
*_MYTOOLS_IA32_DLINK_NAME = link.exe
*_MYTOOLS_IA32_ASMLINK_NAME = link.exe
*_MYTOOLS_IA32_PP_NAME = cl.exe
*_MYTOOLS_IA32_ASM_NAME = ml.exe
*_MYTOOLS_IA32_ASM_EXT = .asm
*_MYTOOLS_IA32_PCH_NAME = cl.exe *_MYTOOLS_IA32_PCH_NAME = cl.exe
*_MYTOOLS_IA32_ASM_EXT = .asm
*_MYTOOLS_IA32_*_PATH = C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin *_MYTOOLS_IA32_*_PATH = C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin
*_MYTOOLS_IA32_*_DPATH = C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE *_MYTOOLS_IA32_*_DPATH = C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE
@ -392,22 +399,14 @@ RELEASE_MYTOOLS_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /
################## ##################
# x64 definitions # x64 definitions
################## ##################
*_MYTOOLS_X64_*_FAMILY = MSFT
*_MYTOOLS_X64_CC_NAME = cl.exe
*_MYTOOLS_X64_SLINK_NAME = lib.exe
*_MYTOOLS_X64_DLINK_NAME = link.exe
*_MYTOOLS_X64_ASMLINK_NAME = link.exe
*_MYTOOLS_X64_PP_NAME = cl.exe
*_MYTOOLS_X64_PCH_NAME = cl.exe *_MYTOOLS_X64_PCH_NAME = cl.exe
*_MYTOOLS_X64_SLINK_FLAGS = /nologo /LTCG
*_MYTOOLS_X64_ASM_NAME = ml64.exe *_MYTOOLS_X64_ASM_NAME = ml64.exe
*_MYTOOLS_X64_ASM_EXT = .asm *_MYTOOLS_X64_ASM_EXT = .asm
*_MYTOOLS_X64_*_PATH = C:\WINDDK\3790.1830\bin\win64\x86\amd64 *_MYTOOLS_X64_*_PATH = C:\WINDDK\3790.1830\bin\win64\x86\amd64
*_MYTOOLS_X64_ASMLINK_PATH = C:\WINDDK\3790.1830\bin\bin16\ *_MYTOOLS_X64_ASMLINK_PATH = C:\WINDDK\3790.1830\bin\bin16\
*_MYTOOLS_X64_SLINK_FLAGS = /nologo /LTCG
*_MYTOOLS_X64_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h *_MYTOOLS_X64_PP_FLAGS = /nologo /P /TC /FI${DEST_DIR_DEBUG}/AutoGen.h
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 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
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 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
@ -421,19 +420,11 @@ RELEASE_MYTOOLS_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /O
################## ##################
# IPF definitions # IPF definitions
################## ##################
*_MYTOOLS_IPF_*_FAMILY = MSFT
*_MYTOOLS_IPF_APP_NAME = cl.exe
*_MYTOOLS_IPF_PP_NAME = cl.exe
*_MYTOOLS_IPF_CC_NAME = cl.exe
*_MYTOOLS_IPF_SLINK_NAME = lib.exe
*_MYTOOLS_IPF_DLINK_NAME = link.exe
*_MYTOOLS_IPF_PCH_NAME = cl.exe *_MYTOOLS_IPF_PCH_NAME = cl.exe
*_MYTOOLS_IPF_APP_NAME = cl.exe
*_MYTOOLS_IPF_SLINK_FLAGS = /nologo /LTCG
*_MYTOOLS_IPF_ASM_NAME = ias.exe *_MYTOOLS_IPF_ASM_NAME = ias.exe
*_MYTOOLS_IPF_ASM_EXT = .s *_MYTOOLS_IPF_ASM_EXT = .s
*_MYTOOLS_IPF_*_PATH = C:\WINDDK\3790.1830\bin\win64\x86 *_MYTOOLS_IPF_*_PATH = C:\WINDDK\3790.1830\bin\win64\x86
*_MYTOOLS_IPF_APP_FLAGS = /nologo /P /TC *_MYTOOLS_IPF_APP_FLAGS = /nologo /P /TC
@ -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 *_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
*_MYTOOLS_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4 *_MYTOOLS_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4
*_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 *_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
*_MYTOOLS_IPF_SLINK_FLAGS = /nologo /LTCG
################## ##################
# EBC definitions # EBC definitions
@ -451,6 +443,7 @@ RELEASE_MYTOOLS_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /O
*_MYTOOLS_EBC_CC_NAME = iec.exe *_MYTOOLS_EBC_CC_NAME = iec.exe
*_MYTOOLS_EBC_DLINK_NAME = link.exe *_MYTOOLS_EBC_DLINK_NAME = link.exe
*_MYTOOLS_EBC_SLINK_NAME = link.exe *_MYTOOLS_EBC_SLINK_NAME = link.exe
*_MYTOOLS_EBC_*_PATH = C:\Program Files\Intel\EBC\Bin *_MYTOOLS_EBC_*_PATH = C:\Program Files\Intel\EBC\Bin
*_MYTOOLS_EBC_*_SPATH = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" *_MYTOOLS_EBC_*_SPATH = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib"
@ -464,7 +457,4 @@ RELEASE_MYTOOLS_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /O
################## ##################
*_MYTOOLS_*_ASL_FAMILY = INTEL *_MYTOOLS_*_ASL_FAMILY = INTEL
*_MYTOOLS_*_ASL_NAME = iasl.exe *_MYTOOLS_*_ASL_NAME = iasl.exe
*_MYTOOLS_IA32_ASL_PATH = C:\ASL *_MYTOOLS_*_ASL_PATH = C:\ASL
*_MYTOOLS_X64_ASL_PATH = C:\ASL
*_MYTOOLS_IPF_ASL_PATH = C:\ASL
*_MYTOOLS_EBC_ASL_PATH = C:\ASL

View File

@ -132,6 +132,7 @@ public class GlobalData {
private static Map<FpdModuleIdentification, ToolChainMap> moduleToolChainOption = new HashMap<FpdModuleIdentification, ToolChainMap>(); private static Map<FpdModuleIdentification, ToolChainMap> moduleToolChainOption = new HashMap<FpdModuleIdentification, ToolChainMap>();
private static Map<FpdModuleIdentification, ToolChainMap> moduleToolChainFamilyOption = new HashMap<FpdModuleIdentification, ToolChainMap>(); private static Map<FpdModuleIdentification, ToolChainMap> moduleToolChainFamilyOption = new HashMap<FpdModuleIdentification, ToolChainMap>();
private static Pattern flagPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+");
/** /**
Parse framework database (DB) and all SPD files listed in DB to initialize Parse framework database (DB) and all SPD files listed in DB to initialize
the environment for next build. This method will only be executed only once the environment for next build. This method will only be executed only once
@ -733,153 +734,71 @@ public class GlobalData {
ToolChainMap toolChainConfig = toolsDef.getConfig(); ToolChainMap toolChainConfig = toolsDef.getConfig();
String setting = null; String setting = null;
//
// Default in tools_def.txt
//
setting = toolChainConfig.get(toolChainKey); setting = toolChainConfig.get(toolChainKey);
if (setting == null) { if (setting == null) {
setting = ""; setting = "";
} }
if (!commandDescription[ToolChainElement.ATTRIBUTE.value].equals(ToolChainAttribute.FLAGS.toString())) { if (!commandDescription[ToolChainElement.ATTRIBUTE.value].equals(ToolChainAttribute.FLAGS.toString())) {
return setting; return setting;
} }
// //
// get module specific options, if any // tool's option can be in .fpd and/or .msa file
// //
// tool tag first String optionString;
ToolChainMap option = moduleToolChainOption.get(fpdModuleId); ToolChainMap option = null;
ToolChainKey toolChainFamilyKey = null; ToolChainKey toolChainFamilyKey = new ToolChainKey(commandDescription);
if (option != null && option.get(toolChainKey) != null) toolChainFamilyKey.setKey(ToolChainAttribute.FAMILY.toString(), ToolChainElement.ATTRIBUTE.value);
{ String family = toolChainConfig.get(toolChainFamilyKey);
String str = option.get(toolChainKey); toolChainFamilyKey.setKey(family, ToolChainElement.TOOLCHAIN.value);
toolChainFamilyKey.setKey(ToolChainAttribute.FLAGS.toString(), ToolChainElement.ATTRIBUTE.value);
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 // Platform's tool chain family option
// //
// tool tag first optionString = platformToolChainFamilyOption.get(toolChainFamilyKey);
// if (platformToolChainOption != null && platformToolChainOption.get(toolChainKey) != null) if (optionString != null) {
if (platformToolChainOption.get(toolChainKey) != null) setting += (" " + optionString);
{ }
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 // Platform's tool chain tag option
// //
// tool tag first optionString = platformToolChainOption.get(toolChainKey);
ToolChainMap option = moduleToolChainOption.get(fpdModuleId); if (optionString != null) {
ToolChainKey toolChainFamilyKey = null; Matcher matcher = flagPattern.matcher(optionString + " ");
while (matcher.find()) {
if ((option == null) || (option != null && (setting = option.get(toolChainKey)) == null)) setting += (" " + optionString.substring(matcher.start(1), matcher.end(1)));
{
//
// then tool chain family
//
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) {
setting = option.get(toolChainFamilyKey);
} }
} }
// //
// get platform options, if any // Module's tool chain family option
// //
if (setting == null) { option = moduleToolChainFamilyOption.get(fpdModuleId);
// tool tag first if (option != null && (optionString = option.get(toolChainFamilyKey)) != null) {
if (platformToolChainOption == null || (setting = platformToolChainOption.get(toolChainKey)) == null) { Matcher matcher = flagPattern.matcher(optionString + " ");
// then tool chain family while (matcher.find()) {
if (toolChainFamilyKey == null) { setting += (" " + optionString.substring(matcher.start(1), matcher.end(1)));
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);
}
setting = platformToolChainFamilyOption.get(toolChainFamilyKey);
} }
} }
if (setting == null) { //
setting = ""; // Module's tool chain tag option
//
option = moduleToolChainOption.get(fpdModuleId);
if (option != null && (optionString = option.get(toolChainKey)) != null) {
Matcher matcher = flagPattern.matcher(optionString + " ");
while (matcher.find()) {
setting += (" " + optionString.substring(matcher.start(1), matcher.end(1)));
}
} }
return setting; return setting;
*/
} }
public static void setToolChainEnvInfo(ToolChainInfo envInfo) { public static void setToolChainEnvInfo(ToolChainInfo envInfo) {

View File

@ -29,7 +29,7 @@ public class ToolChainMap {
// //
// From which part of key can be used to match "*" // From which part of key can be used to match "*"
// //
private int matchLevel = ToolChainKey.keyLength - 2; private int matchLevel = ToolChainKey.keyLength - 1;
// //
// A Map object in which tool chain configuration information will be stored // A Map object in which tool chain configuration information will be stored
@ -211,98 +211,96 @@ public class ToolChainMap {
/// ///
/// In the current tool chain definition format (in name/value pair), /// In the current tool chain definition format (in name/value pair),
/// there're five parts in the "name". The last part of the "name" must /// there're five parts in the "name". The last part of the "name" must
/// not be "wildcard". So we should start combining "*" from the fourth part. /// not be "wildcard". We should start combining "*" from left to right.
/// We'll try all the possible combinations until the value can be fetched. /// We'll try all the possible combinations until the value can be fetched.
/// ///
/// The following code implements the logic which will try to use, for example, /// The following code implements the logic which will try to use, for example,
/// following key parts combinations sequentially to get the value. /// following key parts combinations sequentially to get the value.
/// ///
/// TARGET_TOOLCHAIN_ARCH_TOOLCODE_ATTRIBUTE /// TARGET_TOOLCHAIN_ARCH_TOOLCODE_ATTRIBUTE
/// TARGET_TOOLCHAIN_ARCH_*_ATTRIBUTE /// ******_TOOLCHAIN_ARCH_TOOLCODE_ATTRIBUTE
/// TARGET_TOOLCHAIN_*_TOOLCODE_ATTRIBUTE /// TARGET_*********_ARCH_TOOLCODE_ATTRIBUTE
/// TARGET_TOOLCHAIN_*_*_ATTRIBUTE /// ******_*********_ARCH_TOOLCODE_ATTRIBUTE
/// TARGET_*_ARCH_TOOLCODE_ATTRIBUTE /// TARGET_TOOLCHAIN_****_TOOLCODE_ATTRIBUTE
/// TARGET_*_ARCH_*_ATTRIBUTE /// ******_TOOLCHAIN_****_TOOLCODE_ATTRIBUTE
/// TARGET_*_*_TOOLCODE_ATTRIBUTE /// TARGET_*********_****_TOOLCODE_ATTRIBUTE
/// TARGET_*_*_*_ATTRIBUTE /// ******_*********_****_TOOLCODE_ATTRIBUTE
/// *_TOOLCHAIN_ARCH_TOOLCODE_ATTRIBUTE /// TARGET_TOOLCHAIN_ARCH_********_ATTRIBUTE
/// *_TOOLCHAIN_ARCH_*_ATTRIBUTE /// ******_TOOLCHAIN_ARCH_********_ATTRIBUTE
/// *_TOOLCHAIN_*_TOOLCODE_ATTRIBUTE /// TARGET_*********_ARCH_********_ATTRIBUTE
/// *_TOOLCHAIN_*_*_ATTRIBUTE /// ******_*********_ARCH_********_ATTRIBUTE
/// *_*_ARCH_TOOLCODE_ATTRIBUTE /// TARGET_TOOLCHAIN_****_********_ATTRIBUTE
/// *_*_ARCH_*_ATTRIBUTE /// ******_TOOLCHAIN_****_********_ATTRIBUTE
/// *_*_*_TOOLCODE_ATTRIBUTE /// TARGET_*********_****_********_ATTRIBUTE
/// *_*_*_*_ATTRIBUTE /// ******_*********_****_********_ATTRIBUTE
/// ///
// //
// level is used to control if all parts of "name" have been "wildcarded" // The wildcard "*" appears regularly (2^n). "*" in TARGET appears 2^0
// times at every 2^0 TARGET, "*" in TOOLCHAIN appears 2^1 times at
// every 2^1 TOOLCHAIN, and "*" in TOOLCODE appears 2^3 times at every
// 2^3 TOOLCODE. We're going to use this to form all the combinations of key.
// //
int level = matchLevel; int[] combinations = new int[matchLevel];
while (level >= 0) { for (int i = 0; i < matchLevel; ++i) {
// //
// tmplevel is used to control if all parts of "name" between first // initialize the array with 2^n
// "*" and fourth name part have been "wildcarded".
// //
int tmpLevel = level; combinations[i] = 1 << (i + 1);
while (tmpLevel >= level) { }
String[] tmpKeySet = tmpKey.getKeySet();
//
// when last part goes down to zero, we tried all combinations of key
//
int lastIndex = matchLevel - 1;
while (combinations[lastIndex] > 0) {
//
// form the key which has "*" in it
//
for (int i = 0; i < matchLevel; ++i) {
//
// start again if not finished
//
if (combinations[i] == 0) {
combinations[i] = 1 << (i + 1);
}
//
// half of 2^n is "*", the rest is non-*
//
try { try {
if (!tmpKeySet[tmpLevel].equals("*")) { if (combinations[i] > (1 << i)) {
// tmpKey.setKey(keySet[i], i);
// If "tmplevel" part is not "*", set it to "*".
// For example, at first loop, the key will become
// TARGET_TOOLCHAIN_ARCH_*_ATTRIBUTE, and at next loop,
// become TARGET_TOOLCHAIN_*_ARCH_ATTRIBUTE
//
tmpKey.setKey("*", tmpLevel);
//
// We'll try all possible combinations between current
// part and the fourth part.
//
tmpLevel = matchLevel;
} else { } else {
// tmpKey.setKey("*", i);
// Restore original value of key if "*" at "tmplevel"
// part of "name" has been checked
//
tmpKey.setKey(keySet[tmpLevel], tmpLevel);
//
// Try "*" at part left to "tmplevel" part of "name"
//
--tmpLevel;
continue;
} }
} catch (Exception e) { } catch (Exception e) {
return null; return null;
} }
// combinations[i] -= 1;
// Try get the value from the map }
//
result = map.get(tmpKey); //
if (result != null) { // Try get the value from the map
// //
// The map actually has no exact key as the given "key", result = map.get(tmpKey);
// putting it back into map can speed up the get() next time if (result != null) {
// //
map.put(key, result); // The map actually has no exact key as the given "key",
return result; // putting it back into map can speed up the get() next time
} //
map.put(key, result);
return result;
} }
///
/// If all possible combinations of "wildcard" between "level" and
/// the fourth part of "name" have been tried, try the left part
///
--level;
} }
// //
// The map actually has no exact key as the given "key", putting it back // The map actually has no exact key as the given "key", putting it back
// into map can speed up the get() next time even we got nothing. // into map can speed up the get() next time even we got nothing.
// //
map.put(key, result); map.put(key, null);
return result; return null;
} }
/** /**