mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
07fb9c2644
commit
e4979beee9
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue