+ def ParserGenerateFfsCmd(self):\r
+ #Add Ffs cmd to self.BuildTargetList\r
+ OutputFile = ''\r
+ DepsFileList = []\r
+\r
+ for Cmd in self.GenFfsList:\r
+ if Cmd[2]:\r
+ for CopyCmd in Cmd[2]:\r
+ Src, Dst = CopyCmd\r
+ Src = self.ReplaceMacro(Src)\r
+ Dst = self.ReplaceMacro(Dst)\r
+ if Dst not in self.ResultFileList:\r
+ self.ResultFileList.append('%s' % Dst)\r
+ if '%s :' %(Dst) not in self.BuildTargetList:\r
+ self.BuildTargetList.append("%s :" %(Dst))\r
+ self.BuildTargetList.append('\t' + self._CP_TEMPLATE_[self._FileType] %{'Src': Src, 'Dst': Dst})\r
+\r
+ FfsCmdList = Cmd[0]\r
+ for index, Str in enumerate(FfsCmdList):\r
+ if '-o' == Str:\r
+ OutputFile = FfsCmdList[index + 1]\r
+ if '-i' == Str:\r
+ if DepsFileList == []:\r
+ DepsFileList = [FfsCmdList[index + 1]]\r
+ else:\r
+ DepsFileList.append(FfsCmdList[index + 1])\r
+ DepsFileString = ' '.join(DepsFileList).strip()\r
+ if DepsFileString == '':\r
+ continue\r
+ OutputFile = self.ReplaceMacro(OutputFile)\r
+ self.ResultFileList.append('%s' % OutputFile)\r
+ DepsFileString = self.ReplaceMacro(DepsFileString)\r
+ self.BuildTargetList.append('%s : %s' % (OutputFile, DepsFileString))\r
+ CmdString = ' '.join(FfsCmdList).strip()\r
+ CmdString = self.ReplaceMacro(CmdString)\r
+ self.BuildTargetList.append('\t%s' % CmdString)\r
+\r
+ self.ParseSecCmd(DepsFileList, Cmd[1])\r
+ for SecOutputFile, SecDepsFile, SecCmd in self.FfsOutputFileList :\r
+ self.BuildTargetList.append('%s : %s' % (self.ReplaceMacro(SecOutputFile), self.ReplaceMacro(SecDepsFile)))\r
+ self.BuildTargetList.append('\t%s' % self.ReplaceMacro(SecCmd))\r
+ self.FfsOutputFileList = []\r
+\r
+ def ParseSecCmd(self, OutputFileList, CmdTuple):\r
+ for OutputFile in OutputFileList:\r
+ for SecCmdStr in CmdTuple:\r
+ SecDepsFileList = []\r
+ SecCmdList = SecCmdStr.split()\r
+ CmdName = SecCmdList[0]\r
+ for index, CmdItem in enumerate(SecCmdList):\r
+ if '-o' == CmdItem and OutputFile == SecCmdList[index + 1]:\r
+ index = index + 1\r
+ while index + 1 < len(SecCmdList):\r
+ if not SecCmdList[index+1].startswith('-'):\r
+ SecDepsFileList.append(SecCmdList[index + 1])\r
+ index = index + 1\r
+ if CmdName == 'Trim':\r
+ SecDepsFileList.append(os.path.join('$(DEBUG_DIR)', os.path.basename(OutputFile).replace('offset', 'efi')))\r
+ if OutputFile.endswith('.ui') or OutputFile.endswith('.ver'):\r
+ SecDepsFileList.append(os.path.join('$(MODULE_DIR)','$(MODULE_FILE)'))\r
+ self.FfsOutputFileList.append((OutputFile, ' '.join(SecDepsFileList), SecCmdStr))\r
+ if len(SecDepsFileList) > 0:\r
+ self.ParseSecCmd(SecDepsFileList, CmdTuple)\r
+ break\r
+ else:\r
+ continue\r
+\r
+ def ReplaceMacro(self, str):\r
+ for Macro in self.MacroList:\r
+ if self._AutoGenObject.Macros[Macro] and self._AutoGenObject.Macros[Macro] in str:\r
+ str = str.replace(self._AutoGenObject.Macros[Macro], '$(' + Macro + ')')\r
+ return str\r
+\r