+ #\r
+ # Create BuildOptions Macro & PCD metafile, also add the Active Platform and FDF file.\r
+ #\r
+ content = 'gCommandLineDefines: '\r
+ content += str(GlobalData.gCommandLineDefines)\r
+ content += os.linesep\r
+ content += 'BuildOptionPcd: '\r
+ content += str(GlobalData.BuildOptionPcd)\r
+ content += os.linesep\r
+ content += 'Active Platform: '\r
+ content += str(self.Platform)\r
+ content += os.linesep\r
+ if self.FdfFile:\r
+ content += 'Flash Image Definition: '\r
+ content += str(self.FdfFile)\r
+ SaveFileOnChange(os.path.join(self.BuildDir, 'BuildOptions'), content, False)\r
+\r
+ #\r
+ # Create PcdToken Number file for Dynamic/DynamicEx Pcd.\r
+ #\r
+ PcdTokenNumber = 'PcdTokenNumber: '\r
+ if Pa.PcdTokenNumber:\r
+ if Pa.DynamicPcdList:\r
+ for Pcd in Pa.DynamicPcdList:\r
+ PcdTokenNumber += os.linesep\r
+ PcdTokenNumber += str((Pcd.TokenCName, Pcd.TokenSpaceGuidCName))\r
+ PcdTokenNumber += ' : '\r
+ PcdTokenNumber += str(Pa.PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName])\r
+ SaveFileOnChange(os.path.join(self.BuildDir, 'PcdTokenNumber'), PcdTokenNumber, False)\r
+\r
+ #\r
+ # Get set of workspace metafiles\r
+ #\r
+ AllWorkSpaceMetaFiles = self._GetMetaFiles(Target, Toolchain, Arch)\r
+\r
+ #\r
+ # Retrieve latest modified time of all metafiles\r
+ #\r
+ SrcTimeStamp = 0\r
+ for f in AllWorkSpaceMetaFiles:\r
+ if os.stat(f)[8] > SrcTimeStamp:\r
+ SrcTimeStamp = os.stat(f)[8]\r
+ self._SrcTimeStamp = SrcTimeStamp\r
+\r
+ #\r
+ # Write metafile list to build directory\r
+ #\r
+ AutoGenFilePath = os.path.join(self.BuildDir, 'AutoGen')\r
+ if os.path.exists (AutoGenFilePath):\r
+ os.remove(AutoGenFilePath)\r
+ if not os.path.exists(self.BuildDir):\r
+ os.makedirs(self.BuildDir)\r
+ with open(os.path.join(self.BuildDir, 'AutoGen'), 'w+') as file:\r
+ for f in AllWorkSpaceMetaFiles:\r
+ print >> file, f\r