diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2016-05-06 15:20:23 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2016-05-25 13:43:54 +0800 |
commit | e4979beee9e5d334d97fd8e2c79670ad08587bc6 (patch) | |
tree | 800cb8b3a1cc1842d7dc85f61427a9ac21db0030 /BaseTools | |
parent | 07fb9c264400d7ca2c14d3d8076102584038eb96 (diff) | |
download | edk2-platforms-e4979beee9e5d334d97fd8e2c79670ad08587bc6.tar.xz |
BaseTools/GenFds: enhance to get TOOL_CHAIN_TAG and TARGET value
when user don't set TOOL_CHAIN_TAG and TARGET by –D Flag, then GenFds
would report failure for format:
FILE DATA = $(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/testfile
so this patch enhance to get the TOOL_CHAIN_TAG and TARGET value by
following priority (high to low): 1. the Macro value set by -D Flag;
2. Get the value by the -t/-b option. 3. get the value from target.txt
file. Besides, this patch also remove the error checking for missing
-t/-b option.
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/Python/GenFds/GenFds.py | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py index 672d103870..68232c5e6d 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -119,13 +119,9 @@ def main(): if (Options.BuildTarget):
GenFdsGlobalVariable.TargetName = Options.BuildTarget
- else:
- EdkLogger.error("GenFds", OPTION_MISSING, "Missing build target")
if (Options.ToolChain):
GenFdsGlobalVariable.ToolChainTag = Options.ToolChain
- else:
- EdkLogger.error("GenFds", OPTION_MISSING, "Missing tool chain tag")
if (Options.activePlatform):
ActivePlatform = Options.activePlatform
@@ -161,7 +157,23 @@ def main(): GenFdsGlobalVariable.ConfDir = ConfDirectoryPath
BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt"))
if os.path.isfile(BuildConfigurationFile) == True:
- TargetTxtClassObject.TargetTxtClassObject(BuildConfigurationFile)
+ TargetTxt = TargetTxtClassObject.TargetTxtClassObject()
+ TargetTxt.LoadTargetTxtFile(BuildConfigurationFile)
+ # if no build target given in command line, get it from target.txt
+ if not GenFdsGlobalVariable.TargetName:
+ BuildTargetList = TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TARGET]
+ if len(BuildTargetList) != 1:
+ EdkLogger.error("GenFds", OPTION_VALUE_INVALID, ExtraData="Only allows one instance for Target.")
+ GenFdsGlobalVariable.TargetName = BuildTargetList[0]
+
+ # if no tool chain given in command line, get it from target.txt
+ if not GenFdsGlobalVariable.ToolChainTag:
+ ToolChainList = TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_TAG]
+ if ToolChainList == None or len(ToolChainList) == 0:
+ EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE, ExtraData="No toolchain given. Don't know how to build.")
+ if len(ToolChainList) != 1:
+ EdkLogger.error("GenFds", OPTION_VALUE_INVALID, ExtraData="Only allows one instance for ToolChain.")
+ GenFdsGlobalVariable.ToolChainTag = ToolChainList[0]
else:
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=BuildConfigurationFile)
@@ -176,6 +188,8 @@ def main(): Pair = Pair[:-1]
List = Pair.split('=')
if len(List) == 2:
+ if not List[1].strip():
+ EdkLogger.error("GenFds", OPTION_VALUE_INVALID, ExtraData="No Value given for Macro %s" %List[0])
if List[0].strip() == "EFI_SOURCE":
GlobalData.gEfiSource = List[1].strip()
GlobalData.gGlobalDefines["EFI_SOURCE"] = GlobalData.gEfiSource
@@ -192,6 +206,14 @@ def main(): GlobalData.gCommandLineDefines[List[0].strip()] = "TRUE"
os.environ["WORKSPACE"] = Workspace
+ # Use the -t and -b option as gGlobalDefines's TOOLCHAIN and TARGET if they are not defined
+ if "TARGET" not in GlobalData.gGlobalDefines.keys():
+ GlobalData.gGlobalDefines["TARGET"] = GenFdsGlobalVariable.TargetName
+ if "TOOLCHAIN" not in GlobalData.gGlobalDefines.keys():
+ GlobalData.gGlobalDefines["TOOLCHAIN"] = GenFdsGlobalVariable.ToolChainTag
+ if "TOOL_CHAIN_TAG" not in GlobalData.gGlobalDefines.keys():
+ GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = GenFdsGlobalVariable.ToolChainTag
+
"""call Workspace build create database"""
GlobalData.gDatabasePath = os.path.normpath(os.path.join(ConfDirectoryPath, GlobalData.gDatabasePath))
BuildWorkSpace = WorkspaceDatabase(GlobalData.gDatabasePath)
|