from GuidSection import GuidSection\r
from FvImageSection import FvImageSection\r
from Common.Misc import PeImageClass\r
+from AutoGen.GenDepex import DependencyExpression\r
\r
## generate FFS from INF\r
#\r
self.OptRomDefs = {}\r
self.PiSpecVersion = '0x00000000'\r
self.InfModule = None\r
- self.FinalBuildTargetList = []\r
+ self.FinalTargetSuffixMap = {}\r
\r
- ## GetFinalBuildTargetList() method\r
+ ## GetFinalTargetSuffixMap() method\r
#\r
# Get final build target list\r
- def GetFinalBuildTargetList(self):\r
+ def GetFinalTargetSuffixMap(self):\r
if not self.InfModule or not self.CurrentArch:\r
return []\r
- if not self.FinalBuildTargetList:\r
- self.FinalBuildTargetList = GenFdsGlobalVariable.GetModuleCodaTargetList(self.InfModule, self.CurrentArch)\r
- return self.FinalBuildTargetList\r
+ if not self.FinalTargetSuffixMap:\r
+ FinalBuildTargetList = GenFdsGlobalVariable.GetModuleCodaTargetList(self.InfModule, self.CurrentArch)\r
+ for File in FinalBuildTargetList:\r
+ self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1], []).append(File)\r
+\r
+ # Check if current INF module has DEPEX\r
+ if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != "USER_DEFINED" \\r
+ and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:\r
+ ModuleType = self.InfModule.ModuleType\r
+ PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
+\r
+ if ModuleType != DataType.SUP_MODULE_USER_DEFINED:\r
+ for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys():\r
+ if LibraryClass.startswith("NULL") and PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:\r
+ self.InfModule.LibraryClasses[LibraryClass] = PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]\r
+\r
+ StrModule = str(self.InfModule)\r
+ PlatformModule = None\r
+ if StrModule in PlatformDataBase.Modules:\r
+ PlatformModule = PlatformDataBase.Modules[StrModule]\r
+ for LibraryClass in PlatformModule.LibraryClasses:\r
+ if LibraryClass.startswith("NULL"):\r
+ self.InfModule.LibraryClasses[LibraryClass] = PlatformModule.LibraryClasses[LibraryClass]\r
+\r
+ DependencyList = [self.InfModule]\r
+ LibraryInstance = {}\r
+ DepexList = []\r
+ while len(DependencyList) > 0:\r
+ Module = DependencyList.pop(0)\r
+ if not Module:\r
+ continue\r
+ for Dep in Module.Depex[self.CurrentArch, ModuleType]:\r
+ if DepexList != []:\r
+ DepexList.append('AND')\r
+ DepexList.append('(')\r
+ DepexList.extend(Dep)\r
+ if DepexList[-1] == 'END': # no need of a END at this time\r
+ DepexList.pop()\r
+ DepexList.append(')')\r
+ if 'BEFORE' in DepexList or 'AFTER' in DepexList:\r
+ break\r
+ for LibName in Module.LibraryClasses:\r
+ if LibName in LibraryInstance:\r
+ continue\r
+ if PlatformModule and LibName in PlatformModule.LibraryClasses:\r
+ LibraryPath = PlatformModule.LibraryClasses[LibName]\r
+ else:\r
+ LibraryPath = PlatformDataBase.LibraryClasses[LibName, ModuleType]\r
+ if not LibraryPath:\r
+ LibraryPath = Module.LibraryClasses[LibName]\r
+ if not LibraryPath:\r
+ continue\r
+ LibraryModule = GenFdsGlobalVariable.WorkSpace.BuildObject[LibraryPath, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
+ LibraryInstance[LibName] = LibraryModule\r
+ DependencyList.append(LibraryModule)\r
+ if DepexList:\r
+ Dpx = DependencyExpression(DepexList, ModuleType, True)\r
+ if len(Dpx.PostfixNotation) != 0:\r
+ # It means this module has DEPEX\r
+ self.FinalTargetSuffixMap['.depex'] = [os.path.join(self.EfiOutputPath, self.BaseName) + '.depex']\r
+ return self.FinalTargetSuffixMap\r
\r
## __InfParse() method\r
#\r