summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Workspace
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/Python/Workspace')
-rw-r--r--BaseTools/Source/Python/Workspace/DecBuildData.py3
-rw-r--r--BaseTools/Source/Python/Workspace/DscBuildData.py3
-rw-r--r--BaseTools/Source/Python/Workspace/InfBuildData.py191
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py22
-rw-r--r--BaseTools/Source/Python/Workspace/WorkspaceCommon.py29
5 files changed, 51 insertions, 197 deletions
diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/Source/Python/Workspace/DecBuildData.py
index 13b653bd98..36b39be5d5 100644
--- a/BaseTools/Source/Python/Workspace/DecBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DecBuildData.py
@@ -18,7 +18,7 @@ from types import *
from collections import OrderedDict
from CommonDataClass.DataClass import *
from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, PcdClassObject
-from Common.GlobalData import gGlobalDefines, gEcpSource
+from Common.GlobalData import gGlobalDefines
from re import compile
## Platform build information from DEC file
@@ -300,7 +300,6 @@ class DecBuildData(PackageBuildClassObject):
PublicInclues = []
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch]
Macros = self._Macros
- Macros["EDK_SOURCE"] = gEcpSource
for Record in RecordList:
File = PathClass(NormPath(Record[0], Macros), self._PackageDir, Arch=self._Arch)
LineNo = Record[-1]
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 3b0b23ca8f..ff41af1372 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -715,7 +715,6 @@ class DscBuildData(PlatformBuildClassObject):
self._Modules = OrderedDict()
RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch]
Macros = self._Macros
- Macros["EDK_SOURCE"] = GlobalData.gEcpSource
for Record in RecordList:
DuplicatedFile = False
@@ -858,8 +857,6 @@ class DscBuildData(PlatformBuildClassObject):
continue
self._LibraryClasses[LibraryClass, ModuleType] = LibraryInstance
- # for Edk style library instances, which are listed in different section
- Macros["EDK_SOURCE"] = GlobalData.gEcpSource
RecordList = self._RawData[MODEL_EFI_LIBRARY_INSTANCE, self._Arch]
for Record in RecordList:
File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 99bbecfd1f..02d6c1c756 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -145,10 +145,6 @@ class InfBuildData(ModuleBuildClassObject):
@cached_property
def _Macros(self):
RetVal = {}
- # EDK_GLOBAL defined macros can be applied to EDK module
- if self.AutoGenVersion < 0x00010005:
- RetVal.update(GlobalData.gEdkGlobal)
- RetVal.update(GlobalData.gGlobalDefines)
return RetVal
## Get architecture
@@ -246,106 +242,50 @@ class InfBuildData(ModuleBuildClassObject):
#
# Retrieve information in sections specific to Edk.x modules
#
- if self.AutoGenVersion >= 0x00010005:
- if not self._ModuleType:
- EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
- "MODULE_TYPE is not given", File=self.MetaFile)
- if self._ModuleType not in SUP_MODULE_LIST:
- RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]
- for Record in RecordList:
- Name = Record[1]
- if Name == "MODULE_TYPE":
- LineNo = Record[6]
- break
- EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
- "MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self._ModuleType, ' '.join(l for l in SUP_MODULE_LIST)),
- File=self.MetaFile, Line=LineNo)
- if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
- if self._ModuleType == SUP_MODULE_SMM_CORE:
- EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.MetaFile)
- if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):
- if self._ModuleType == SUP_MODULE_MM_CORE_STANDALONE:
- EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)
- if self._ModuleType == SUP_MODULE_MM_STANDALONE:
- EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)
- if 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \
- and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in self._Defs:
- self._BuildType = 'UEFI_OPTIONROM'
- if 'PCI_COMPRESS' in self._Defs:
- if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):
- EdkLogger.error("build", FORMAT_INVALID, "Expected TRUE/FALSE for PCI_COMPRESS: %s" % self.MetaFile)
-
- elif 'UEFI_HII_RESOURCE_SECTION' in self._Defs \
- and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':
- self._BuildType = 'UEFI_HII'
- else:
- self._BuildType = self._ModuleType.upper()
-
- if self._DxsFile:
- File = PathClass(NormPath(self._DxsFile), self._ModuleDir, Arch=self._Arch)
- # check the file validation
- ErrorCode, ErrorInfo = File.Validate(".dxs", CaseSensitive=False)
- if ErrorCode != 0:
- EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,
- File=self.MetaFile, Line=LineNo)
- if not self._DependencyFileList:
- self._DependencyFileList = []
- self._DependencyFileList.append(File)
+ if not self._ModuleType:
+ EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
+ "MODULE_TYPE is not given", File=self.MetaFile)
+ if self._ModuleType not in SUP_MODULE_LIST:
+ RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]
+ for Record in RecordList:
+ Name = Record[1]
+ if Name == "MODULE_TYPE":
+ LineNo = Record[6]
+ break
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
+ "MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self._ModuleType, ' '.join(l for l in SUP_MODULE_LIST)),
+ File=self.MetaFile, Line=LineNo)
+ if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
+ if self._ModuleType == SUP_MODULE_SMM_CORE:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.MetaFile)
+ if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):
+ if self._ModuleType == SUP_MODULE_MM_CORE_STANDALONE:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)
+ if self._ModuleType == SUP_MODULE_MM_STANDALONE:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)
+ if 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \
+ and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in self._Defs:
+ self._BuildType = 'UEFI_OPTIONROM'
+ if 'PCI_COMPRESS' in self._Defs:
+ if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):
+ EdkLogger.error("build", FORMAT_INVALID, "Expected TRUE/FALSE for PCI_COMPRESS: %s" % self.MetaFile)
+
+ elif 'UEFI_HII_RESOURCE_SECTION' in self._Defs \
+ and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':
+ self._BuildType = 'UEFI_HII'
else:
- if not self._ComponentType:
- EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
- "COMPONENT_TYPE is not given", File=self.MetaFile)
- self._BuildType = self._ComponentType.upper()
- if self._ComponentType in COMPONENT_TO_MODULE_MAP_DICT:
- self._ModuleType = COMPONENT_TO_MODULE_MAP_DICT[self._ComponentType]
- if self._ComponentType == EDK_COMPONENT_TYPE_LIBRARY:
- self._LibraryClass = [LibraryClassObject(self._BaseName, SUP_MODULE_LIST)]
- # make use some [nmake] section macros
- Macros = self._Macros
- Macros["EDK_SOURCE"] = GlobalData.gEcpSource
- Macros['PROCESSOR'] = self._Arch
- RecordList = self._RawData[MODEL_META_DATA_NMAKE, self._Arch, self._Platform]
- for Name, Value, Dummy, Arch, Platform, ID, LineNo in RecordList:
- Value = ReplaceMacro(Value, Macros, True)
- if Name == "IMAGE_ENTRY_POINT":
- if self._ModuleEntryPointList is None:
- self._ModuleEntryPointList = []
- self._ModuleEntryPointList.append(Value)
- elif Name == "DPX_SOURCE":
- File = PathClass(NormPath(Value), self._ModuleDir, Arch=self._Arch)
- # check the file validation
- ErrorCode, ErrorInfo = File.Validate(".dxs", CaseSensitive=False)
- if ErrorCode != 0:
- EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,
- File=self.MetaFile, Line=LineNo)
- if not self._DependencyFileList:
- self._DependencyFileList = []
- self._DependencyFileList.append(File)
- else:
- ToolList = self._NMAKE_FLAG_PATTERN_.findall(Name)
- if len(ToolList) == 1:
- if self._BuildOptions is None:
- self._BuildOptions = OrderedDict()
+ self._BuildType = self._ModuleType.upper()
- if ToolList[0] in self._TOOL_CODE_:
- Tool = self._TOOL_CODE_[ToolList[0]]
- else:
- Tool = ToolList[0]
- ToolChain = "*_*_*_%s_FLAGS" % Tool
- # Edk.x only support MSFT tool chain
- # ignore not replaced macros in value
- ValueList = GetSplitList(' ' + Value, '/D')
- Dummy = ValueList[0]
- for Index in range(1, len(ValueList)):
- if ValueList[Index][-1] == '=' or ValueList[Index] == '':
- continue
- Dummy = Dummy + ' /D ' + ValueList[Index]
- Value = Dummy.strip()
- if (TAB_COMPILER_MSFT, ToolChain) not in self._BuildOptions:
- self._BuildOptions[TAB_COMPILER_MSFT, ToolChain] = Value
- else:
- OptionString = self._BuildOptions[TAB_COMPILER_MSFT, ToolChain]
- self._BuildOptions[TAB_COMPILER_MSFT, ToolChain] = OptionString + " " + Value
+ if self._DxsFile:
+ File = PathClass(NormPath(self._DxsFile), self._ModuleDir, Arch=self._Arch)
+ # check the file validation
+ ErrorCode, ErrorInfo = File.Validate(".dxs", CaseSensitive=False)
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,
+ File=self.MetaFile, Line=LineNo)
+ if not self._DependencyFileList:
+ self._DependencyFileList = []
+ self._DependencyFileList.append(File)
## Retrieve file version
@cached_property
@@ -524,7 +464,6 @@ class InfBuildData(ModuleBuildClassObject):
RetVal = []
RecordList = self._RawData[MODEL_EFI_BINARY_FILE, self._Arch, self._Platform]
Macros = self._Macros
- Macros["EDK_SOURCE"] = GlobalData.gEcpSource
Macros['PROCESSOR'] = self._Arch
for Record in RecordList:
FileType = Record[0]
@@ -572,31 +511,13 @@ class InfBuildData(ModuleBuildClassObject):
ToolChainFamily = Record[1]
TagName = Record[2]
ToolCode = Record[3]
- if self.AutoGenVersion < 0x00010005:
- Macros["EDK_SOURCE"] = GlobalData.gEcpSource
- Macros['PROCESSOR'] = self._Arch
- SourceFile = NormPath(Record[0], Macros)
- if SourceFile[0] == os.path.sep:
- SourceFile = mws.join(GlobalData.gWorkspace, SourceFile[1:])
- # old module source files (Edk)
- File = PathClass(SourceFile, self._ModuleDir, self._SourceOverridePath,
- '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)
- # check the file validation
- ErrorCode, ErrorInfo = File.Validate(CaseSensitive=False)
- if ErrorCode != 0:
- if File.Ext.lower() == '.h':
- EdkLogger.warn('build', 'Include file not found', ExtraData=ErrorInfo,
- File=self.MetaFile, Line=LineNo)
- continue
- else:
- EdkLogger.error('build', ErrorCode, ExtraData=File, File=self.MetaFile, Line=LineNo)
- else:
- File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, '',
- '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)
- # check the file validation
- ErrorCode, ErrorInfo = File.Validate()
- if ErrorCode != 0:
- EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)
+
+ File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, '',
+ '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)
+ # check the file validation
+ ErrorCode, ErrorInfo = File.Validate()
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)
RetVal.append(File)
# add any previously found dependency files to the source list
@@ -716,7 +637,6 @@ class InfBuildData(ModuleBuildClassObject):
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch, self._Platform]
for Record in RecordList:
if Record[0].find('EDK_SOURCE') > -1:
- Macros['EDK_SOURCE'] = GlobalData.gEcpSource
File = NormPath(Record[0], self._Macros)
if File[0] == '.':
File = os.path.join(self._ModuleDir, File)
@@ -727,7 +647,6 @@ class InfBuildData(ModuleBuildClassObject):
RetVal.append(File)
# TRICK: let compiler to choose correct header file
- Macros['EDK_SOURCE'] = GlobalData.gEdkSource
File = NormPath(Record[0], self._Macros)
if File[0] == '.':
File = os.path.join(self._ModuleDir, File)
@@ -745,17 +664,6 @@ class InfBuildData(ModuleBuildClassObject):
File = RealPath(os.path.normpath(File))
if File:
RetVal.append(File)
- if not File and Record[0].find('EFI_SOURCE') > -1:
- # tricky to regard WorkSpace as EFI_SOURCE
- Macros['EFI_SOURCE'] = GlobalData.gWorkspace
- File = NormPath(Record[0], Macros)
- if File[0] == '.':
- File = os.path.join(self._ModuleDir, File)
- else:
- File = os.path.join(GlobalData.gWorkspace, File)
- File = RealPath(os.path.normpath(File))
- if File:
- RetVal.append(File)
return RetVal
## Retrieve packages this module depends on
@@ -764,7 +672,6 @@ class InfBuildData(ModuleBuildClassObject):
RetVal = []
RecordList = self._RawData[MODEL_META_DATA_PACKAGE, self._Arch, self._Platform]
Macros = self._Macros
- Macros['EDK_SOURCE'] = GlobalData.gEcpSource
for Record in RecordList:
File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)
# check the file validation
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 9e524fefa5..f2322b36ac 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -686,18 +686,6 @@ class InfParser(MetaFileParser):
Value = self._ValueList[Index]
if not Value:
continue
-
- if Value.upper().find('$(EFI_SOURCE)\Edk'.upper()) > -1 or Value.upper().find('$(EFI_SOURCE)/Edk'.upper()) > -1:
- Value = '$(EDK_SOURCE)' + Value[17:]
- if Value.find('$(EFI_SOURCE)') > -1 or Value.find('$(EDK_SOURCE)') > -1:
- pass
- elif Value.startswith('.'):
- pass
- elif Value.startswith('$('):
- pass
- else:
- Value = '$(EFI_SOURCE)/' + Value
-
self._ValueList[Index] = ReplaceMacro(Value, Macros)
## Parse [Sources] section
@@ -1600,16 +1588,6 @@ class DscParser(MetaFileParser):
# Allow using system environment variables in path after !include
#
__IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']
- if "ECP_SOURCE" in GlobalData.gGlobalDefines:
- __IncludeMacros['ECP_SOURCE'] = GlobalData.gGlobalDefines['ECP_SOURCE']
- #
- # During GenFds phase call DSC parser, will go into this branch.
- #
- elif "ECP_SOURCE" in GlobalData.gCommandLineDefines:
- __IncludeMacros['ECP_SOURCE'] = GlobalData.gCommandLineDefines['ECP_SOURCE']
-
- __IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE']
- __IncludeMacros['EDK_SOURCE'] = GlobalData.gGlobalDefines['EDK_SOURCE']
#
# Allow using MACROs comes from [Defines] section to keep compatible.
#
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
index 55d01fa4b2..ee238e5143 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
@@ -90,10 +90,7 @@ def GetDeclaredPcd(Platform, BuildDatabase, Arch, Target, Toolchain, additionalP
# @retval: List of dependent libraries which are InfBuildData instances
#
def GetLiabraryInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain):
- if Module.AutoGenVersion >= 0x00010005:
- return GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain)
- else:
- return _ResolveLibraryReference(Module, Platform)
+ return GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain)
def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain, FileName = '', EdkLogger = None):
ModuleType = Module.ModuleType
@@ -255,27 +252,3 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
#
SortedLibraryList.reverse()
return SortedLibraryList
-
-def _ResolveLibraryReference(Module, Platform):
- LibraryConsumerList = [Module]
-
- # "CompilerStub" is a must for Edk modules
- if Module.Libraries:
- Module.Libraries.append("CompilerStub")
- LibraryList = []
- while len(LibraryConsumerList) > 0:
- M = LibraryConsumerList.pop()
- for LibraryName in M.Libraries:
- Library = Platform.LibraryClasses[LibraryName, ':dummy:']
- if Library is None:
- for Key in Platform.LibraryClasses.data:
- if LibraryName.upper() == Key.upper():
- Library = Platform.LibraryClasses[Key, ':dummy:']
- break
- if Library is None:
- continue
-
- if Library not in LibraryList:
- LibraryList.append(Library)
- LibraryConsumerList.append(Library)
- return LibraryList