## @file
# This file is used to define each component of tools_def.txt file
#
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
##
# Import Modules
#
import os
import re
import EdkLogger
from Dictionary import *
from BuildToolError import *
from TargetTxtClassObject import *
##
# Static variables used for pattern
#
## ToolDefClassObject
#
# This class defined content used in file tools_def.txt
#
# @param object: Inherited from object class
# @param Filename: Input value for full path of tools_def.txt
#
# @var ToolsDefTxtDictionary: To store keys and values defined in target.txt
# @var MacroDictionary: To store keys and values defined in DEFINE statement
#
self.MacroDictionary = {}
if FileName != None:
## LoadToolDefFile
#
# Load target.txt file and parse it, return a set structure to store keys and values
#
# @param Filename: Input value for full path of tools_def.txt
#
FileContent = []
try:
FileContent = F.readlines()
except:
else:
TAB_TOD_DEFINES_TARGET : [],
}
continue
EdkLogger.warn("tools_def.txt parser", "Line %d: not correct assignment statement, skipped" % (Index + 1))
continue
if Name == "IDENTIFIER":
EdkLogger.debug(EdkLogger.DEBUG_8, "Line %d: Found identifier statement, skipped: %s" % ((Index + 1), Value))
continue
if MacroDefinition != []:
if not Done:
"Macro or Environment has not been defined",
EdkLogger.debug(EdkLogger.DEBUG_8, "Line %d: Found macro: %s = %s" % ((Index + 1), MacroName, Value))
continue
if not Done:
"Macro or Environment has not been defined",
continue
continue
else:
EdkLogger.verbose("Line %d: No override allowed for the family of a tool chain: %s" % ((Index + 1), Name))
EdkLogger.verbose("Line %d: The family is not specified, but BuildRuleFamily is specified for the tool chain: %s" % ((Index + 1), Name))
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET]))
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]))
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH]))
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE]))
KeyList = [TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG, TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_TYPE]
continue
## ExpandMacros
#
# Replace defined macros with real value
#
# @param Value: The string with unreplaced macros
#
# @retval Value: The string which has been replaced with real value
#
for Ref in EnvReference:
else:
for Ref in MacroReference:
## ToolDefDict
#
# Load tools_def.txt in input workspace dir
#
# @param WorkSpace: Workspace dir
#
# @retval ToolDef An instance of ToolDefClassObject() with loaded tools_def.txt
#
return ToolDef
##
#
# This acts like the main() function for the script, unless it is 'import'ed into another
# script.
#
if __name__ == '__main__':
pass