BaseTools: AutoGen - clean up access
authorJaben Carsey <jaben.carsey@intel.com>
Wed, 27 Jun 2018 21:27:48 +0000 (05:27 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Fri, 29 Jun 2018 07:38:51 +0000 (15:38 +0800)
1) add a property so others can access needed data
2) change GenMake to use property
3) add local variable in GenMake to speed up access

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/AutoGen/GenMake.py

index 381dbc0..c8009d0 100644 (file)
@@ -2780,7 +2780,7 @@ class ModuleAutoGen(AutoGen):
             self._Macro = OrderedDict()\r
             self._Macro["WORKSPACE"             ] = self.WorkspaceDir\r
             self._Macro["MODULE_NAME"           ] = self.Name\r
-            self._Macro["MODULE_NAME_GUID"      ] = self._GetUniqueBaseName()\r
+            self._Macro["MODULE_NAME_GUID"      ] = self.UniqueBaseName\r
             self._Macro["MODULE_GUID"           ] = self.Guid\r
             self._Macro["MODULE_VERSION"        ] = self.Version\r
             self._Macro["MODULE_TYPE"           ] = self.ModuleType\r
@@ -4408,6 +4408,7 @@ class ModuleAutoGen(AutoGen):
     BuildCommand            = property(_GetBuildCommand)\r
     \r
     FixedAtBuildPcds         = property(_GetFixedAtBuildPcds)\r
+    UniqueBaseName          = property(_GetUniqueBaseName)\r
 \r
 # This acts like the main() function for the script, unless it is 'import'ed into another script.\r
 if __name__ == '__main__':\r
index f3b23ed..992de54 100644 (file)
@@ -458,59 +458,60 @@ cleanlib:
         if self._FileType not in self._SEP_:\r
             EdkLogger.error("build", PARAMETER_INVALID, "Invalid Makefile type [%s]" % self._FileType,\r
                             ExtraData="[%s]" % str(self._AutoGenObject))\r
+        MyAgo = self._AutoGenObject\r
         Separator = self._SEP_[self._FileType]\r
 \r
         # break build if no source files and binary files are found\r
-        if len(self._AutoGenObject.SourceFileList) == 0 and len(self._AutoGenObject.BinaryFileList) == 0:\r
+        if len(MyAgo.SourceFileList) == 0 and len(MyAgo.BinaryFileList) == 0:\r
             EdkLogger.error("build", AUTOGEN_ERROR, "No files to be built in module [%s, %s, %s]"\r
-                            % (self._AutoGenObject.BuildTarget, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch),\r
-                            ExtraData="[%s]" % str(self._AutoGenObject))\r
+                            % (MyAgo.BuildTarget, MyAgo.ToolChain, MyAgo.Arch),\r
+                            ExtraData="[%s]" % str(MyAgo))\r
 \r
         # convert dependent libraries to build command\r
         self.ProcessDependentLibrary()\r
-        if len(self._AutoGenObject.Module.ModuleEntryPointList) > 0:\r
-            ModuleEntryPoint = self._AutoGenObject.Module.ModuleEntryPointList[0]\r
+        if len(MyAgo.Module.ModuleEntryPointList) > 0:\r
+            ModuleEntryPoint = MyAgo.Module.ModuleEntryPointList[0]\r
         else:\r
             ModuleEntryPoint = "_ModuleEntryPoint"\r
 \r
         # Intel EBC compiler enforces EfiMain\r
-        if self._AutoGenObject.AutoGenVersion < 0x00010005 and self._AutoGenObject.Arch == "EBC":\r
+        if MyAgo.AutoGenVersion < 0x00010005 and MyAgo.Arch == "EBC":\r
             ArchEntryPoint = "EfiMain"\r
         else:\r
             ArchEntryPoint = ModuleEntryPoint\r
 \r
-        if self._AutoGenObject.Arch == "EBC":\r
+        if MyAgo.Arch == "EBC":\r
             # EBC compiler always use "EfiStart" as entry point. Only applies to EdkII modules\r
             ImageEntryPoint = "EfiStart"\r
-        elif self._AutoGenObject.AutoGenVersion < 0x00010005:\r
+        elif MyAgo.AutoGenVersion < 0x00010005:\r
             # Edk modules use entry point specified in INF file\r
             ImageEntryPoint = ModuleEntryPoint\r
         else:\r
             # EdkII modules always use "_ModuleEntryPoint" as entry point\r
             ImageEntryPoint = "_ModuleEntryPoint"\r
 \r
-        for k, v in self._AutoGenObject.Module.Defines.iteritems():\r
-            if k not in self._AutoGenObject.Macros:\r
-                self._AutoGenObject.Macros[k] = v\r
+        for k, v in MyAgo.Module.Defines.iteritems():\r
+            if k not in MyAgo.Macros:\r
+                MyAgo.Macros[k] = v\r
 \r
-        if 'MODULE_ENTRY_POINT' not in self._AutoGenObject.Macros:\r
-            self._AutoGenObject.Macros['MODULE_ENTRY_POINT'] = ModuleEntryPoint\r
-        if 'ARCH_ENTRY_POINT' not in self._AutoGenObject.Macros:\r
-            self._AutoGenObject.Macros['ARCH_ENTRY_POINT'] = ArchEntryPoint\r
-        if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros:\r
-            self._AutoGenObject.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint\r
+        if 'MODULE_ENTRY_POINT' not in MyAgo.Macros:\r
+            MyAgo.Macros['MODULE_ENTRY_POINT'] = ModuleEntryPoint\r
+        if 'ARCH_ENTRY_POINT' not in MyAgo.Macros:\r
+            MyAgo.Macros['ARCH_ENTRY_POINT'] = ArchEntryPoint\r
+        if 'IMAGE_ENTRY_POINT' not in MyAgo.Macros:\r
+            MyAgo.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint\r
 \r
         PCI_COMPRESS_Flag = False\r
-        for k, v in self._AutoGenObject.Module.Defines.iteritems():\r
+        for k, v in MyAgo.Module.Defines.iteritems():\r
             if 'PCI_COMPRESS' == k and 'TRUE' == v:\r
                 PCI_COMPRESS_Flag = True\r
 \r
         # tools definitions\r
         ToolsDef = []\r
-        IncPrefix = self._INC_FLAG_[self._AutoGenObject.ToolChainFamily]\r
-        for Tool in self._AutoGenObject.BuildOption:\r
-            for Attr in self._AutoGenObject.BuildOption[Tool]:\r
-                Value = self._AutoGenObject.BuildOption[Tool][Attr]\r
+        IncPrefix = self._INC_FLAG_[MyAgo.ToolChainFamily]\r
+        for Tool in MyAgo.BuildOption:\r
+            for Attr in MyAgo.BuildOption[Tool]:\r
+                Value = MyAgo.BuildOption[Tool][Attr]\r
                 if Attr == "FAMILY":\r
                     continue\r
                 elif Attr == "PATH":\r
@@ -521,7 +522,7 @@ cleanlib:
                         continue\r
                     # Remove duplicated include path, if any\r
                     if Attr == "FLAGS":\r
-                        Value = RemoveDupOption(Value, IncPrefix, self._AutoGenObject.IncludePathList)\r
+                        Value = RemoveDupOption(Value, IncPrefix, MyAgo.IncludePathList)\r
                         if Tool == "OPTROM" and PCI_COMPRESS_Flag:\r
                             ValueList = Value.split()\r
                             if ValueList:\r
@@ -535,11 +536,11 @@ cleanlib:
 \r
         # generate the Response file and Response flag\r
         RespDict = self.CommandExceedLimit()\r
-        RespFileList = os.path.join(self._AutoGenObject.OutputDir, 'respfilelist.txt')\r
+        RespFileList = os.path.join(MyAgo.OutputDir, 'respfilelist.txt')\r
         if RespDict:\r
             RespFileListContent = ''\r
             for Resp in RespDict:\r
-                RespFile = os.path.join(self._AutoGenObject.OutputDir, str(Resp).lower() + '.txt')\r
+                RespFile = os.path.join(MyAgo.OutputDir, str(Resp).lower() + '.txt')\r
                 StrList = RespDict[Resp].split(' ')\r
                 UnexpandMacro = []\r
                 NewStr = []\r
@@ -560,10 +561,10 @@ cleanlib:
                 os.remove(RespFileList)\r
 \r
         # convert source files and binary files to build targets\r
-        self.ResultFileList = [str(T.Target) for T in self._AutoGenObject.CodaTargetList]\r
-        if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) != 0:\r
+        self.ResultFileList = [str(T.Target) for T in MyAgo.CodaTargetList]\r
+        if len(self.ResultFileList) == 0 and len(MyAgo.SourceFileList) != 0:\r
             EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build",\r
-                            ExtraData="[%s]" % str(self._AutoGenObject))\r
+                            ExtraData="[%s]" % str(MyAgo))\r
 \r
         self.ProcessBuildTargetList()\r
         self.ParserGenerateFfsCmd()\r
@@ -582,7 +583,7 @@ cleanlib:
         # INC_LIST is special\r
         FileMacro = ""\r
         IncludePathList = []\r
-        for P in  self._AutoGenObject.IncludePathList:\r
+        for P in  MyAgo.IncludePathList:\r
             IncludePathList.append(IncPrefix + self.PlaceMacro(P, self.Macros))\r
             if FileBuildRule.INC_LIST_MACRO in self.ListFileMacros:\r
                 self.ListFileMacros[FileBuildRule.INC_LIST_MACRO].append(IncPrefix + P)\r
@@ -596,7 +597,7 @@ cleanlib:
 \r
         # Generate macros used to represent files containing list of input files\r
         for ListFileMacro in self.ListFileMacros:\r
-            ListFileName = os.path.join(self._AutoGenObject.OutputDir, "%s.lst" % ListFileMacro.lower()[:len(ListFileMacro) - 5])\r
+            ListFileName = os.path.join(MyAgo.OutputDir, "%s.lst" % ListFileMacro.lower()[:len(ListFileMacro) - 5])\r
             FileMacroList.append("%s = %s" % (ListFileMacro, ListFileName))\r
             SaveFileOnChange(\r
                 ListFileName,\r
@@ -605,7 +606,7 @@ cleanlib:
                 )\r
 \r
         # Edk modules need <BaseName>StrDefs.h for string ID\r
-        #if self._AutoGenObject.AutoGenVersion < 0x00010005 and len(self._AutoGenObject.UnicodeFileList) > 0:\r
+        #if MyAgo.AutoGenVersion < 0x00010005 and len(MyAgo.UnicodeFileList) > 0:\r
         #    BcTargetList = ['strdefs']\r
         #else:\r
         #    BcTargetList = []\r
@@ -617,7 +618,7 @@ cleanlib:
             Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":os.path.join(D, MakefileName)}\r
             LibraryMakeCommandList.append(Command)\r
 \r
-        package_rel_dir = self._AutoGenObject.SourceDir\r
+        package_rel_dir = MyAgo.SourceDir\r
         current_dir = self.Macros["WORKSPACE"]\r
         found = False\r
         while not found and os.sep in package_rel_dir:\r
@@ -639,29 +640,29 @@ cleanlib:
             "platform_version"          : self.PlatformInfo.Version,\r
             "platform_relative_directory": self.PlatformInfo.SourceDir,\r
             "platform_output_directory" : self.PlatformInfo.OutputDir,\r
-            "ffs_output_directory"      : self._AutoGenObject.Macros["FFS_OUTPUT_DIR"],\r
-            "platform_dir"              : self._AutoGenObject.Macros["PLATFORM_DIR"],\r
-\r
-            "module_name"               : self._AutoGenObject.Name,\r
-            "module_guid"               : self._AutoGenObject.Guid,\r
-            "module_name_guid"          : self._AutoGenObject._GetUniqueBaseName(),\r
-            "module_version"            : self._AutoGenObject.Version,\r
-            "module_type"               : self._AutoGenObject.ModuleType,\r
-            "module_file"               : self._AutoGenObject.MetaFile.Name,\r
-            "module_file_base_name"     : self._AutoGenObject.MetaFile.BaseName,\r
-            "module_relative_directory" : self._AutoGenObject.SourceDir,\r
-            "module_dir"                : mws.join (self.Macros["WORKSPACE"], self._AutoGenObject.SourceDir),\r
+            "ffs_output_directory"      : MyAgo.Macros["FFS_OUTPUT_DIR"],\r
+            "platform_dir"              : MyAgo.Macros["PLATFORM_DIR"],\r
+\r
+            "module_name"               : MyAgo.Name,\r
+            "module_guid"               : MyAgo.Guid,\r
+            "module_name_guid"          : MyAgo.UniqueBaseName,\r
+            "module_version"            : MyAgo.Version,\r
+            "module_type"               : MyAgo.ModuleType,\r
+            "module_file"               : MyAgo.MetaFile.Name,\r
+            "module_file_base_name"     : MyAgo.MetaFile.BaseName,\r
+            "module_relative_directory" : MyAgo.SourceDir,\r
+            "module_dir"                : mws.join (self.Macros["WORKSPACE"], MyAgo.SourceDir),\r
             "package_relative_directory": package_rel_dir,\r
-            "module_extra_defines"      : ["%s = %s" % (k, v) for k, v in self._AutoGenObject.Module.Defines.iteritems()],\r
+            "module_extra_defines"      : ["%s = %s" % (k, v) for k, v in MyAgo.Module.Defines.iteritems()],\r
 \r
-            "architecture"              : self._AutoGenObject.Arch,\r
-            "toolchain_tag"             : self._AutoGenObject.ToolChain,\r
-            "build_target"              : self._AutoGenObject.BuildTarget,\r
+            "architecture"              : MyAgo.Arch,\r
+            "toolchain_tag"             : MyAgo.ToolChain,\r
+            "build_target"              : MyAgo.BuildTarget,\r
 \r
             "platform_build_directory"  : self.PlatformInfo.BuildDir,\r
-            "module_build_directory"    : self._AutoGenObject.BuildDir,\r
-            "module_output_directory"   : self._AutoGenObject.OutputDir,\r
-            "module_debug_directory"    : self._AutoGenObject.DebugDir,\r
+            "module_build_directory"    : MyAgo.BuildDir,\r
+            "module_output_directory"   : MyAgo.OutputDir,\r
+            "module_debug_directory"    : MyAgo.DebugDir,\r
 \r
             "separator"                 : Separator,\r
             "module_tool_definitions"   : ToolsDef,\r
@@ -1205,32 +1206,33 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\
     # Compose a dict object containing information used to do replacement in template\r
     def _CreateTemplateDict(self):\r
         Separator = self._SEP_[self._FileType]\r
-        if self._FileType not in self._AutoGenObject.CustomMakefile:\r
+        MyAgo = self._AutoGenObject\r
+        if self._FileType not in MyAgo.CustomMakefile:\r
             EdkLogger.error('build', OPTION_NOT_SUPPORTED, "No custom makefile for %s" % self._FileType,\r
-                            ExtraData="[%s]" % str(self._AutoGenObject))\r
+                            ExtraData="[%s]" % str(MyAgo))\r
         MakefilePath = mws.join(\r
-                                self._AutoGenObject.WorkspaceDir,\r
-                                self._AutoGenObject.CustomMakefile[self._FileType]\r
+                                MyAgo.WorkspaceDir,\r
+                                MyAgo.CustomMakefile[self._FileType]\r
                                 )\r
         try:\r
             CustomMakefile = open(MakefilePath, 'r').read()\r
         except:\r
-            EdkLogger.error('build', FILE_OPEN_FAILURE, File=str(self._AutoGenObject),\r
-                            ExtraData=self._AutoGenObject.CustomMakefile[self._FileType])\r
+            EdkLogger.error('build', FILE_OPEN_FAILURE, File=str(MyAgo),\r
+                            ExtraData=MyAgo.CustomMakefile[self._FileType])\r
 \r
         # tools definitions\r
         ToolsDef = []\r
-        for Tool in self._AutoGenObject.BuildOption:\r
+        for Tool in MyAgo.BuildOption:\r
             # Don't generate MAKE_FLAGS in makefile. It's put in environment variable.\r
             if Tool == "MAKE":\r
                 continue\r
-            for Attr in self._AutoGenObject.BuildOption[Tool]:\r
+            for Attr in MyAgo.BuildOption[Tool]:\r
                 if Attr == "FAMILY":\r
                     continue\r
                 elif Attr == "PATH":\r
-                    ToolsDef.append("%s = %s" % (Tool, self._AutoGenObject.BuildOption[Tool][Attr]))\r
+                    ToolsDef.append("%s = %s" % (Tool, MyAgo.BuildOption[Tool][Attr]))\r
                 else:\r
-                    ToolsDef.append("%s_%s = %s" % (Tool, Attr, self._AutoGenObject.BuildOption[Tool][Attr]))\r
+                    ToolsDef.append("%s_%s = %s" % (Tool, Attr, MyAgo.BuildOption[Tool][Attr]))\r
             ToolsDef.append("")\r
 \r
         MakefileName = self._FILE_NAME_[self._FileType]\r
@@ -1242,26 +1244,26 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\
             "platform_version"          : self.PlatformInfo.Version,\r
             "platform_relative_directory": self.PlatformInfo.SourceDir,\r
             "platform_output_directory" : self.PlatformInfo.OutputDir,\r
-            "platform_dir"              : self._AutoGenObject.Macros["PLATFORM_DIR"],\r
-\r
-            "module_name"               : self._AutoGenObject.Name,\r
-            "module_guid"               : self._AutoGenObject.Guid,\r
-            "module_name_guid"          : self._AutoGenObject._GetUniqueBaseName(),\r
-            "module_version"            : self._AutoGenObject.Version,\r
-            "module_type"               : self._AutoGenObject.ModuleType,\r
-            "module_file"               : self._AutoGenObject.MetaFile,\r
-            "module_file_base_name"     : self._AutoGenObject.MetaFile.BaseName,\r
-            "module_relative_directory" : self._AutoGenObject.SourceDir,\r
-            "module_dir"                : mws.join (self._AutoGenObject.WorkspaceDir, self._AutoGenObject.SourceDir),\r
-\r
-            "architecture"              : self._AutoGenObject.Arch,\r
-            "toolchain_tag"             : self._AutoGenObject.ToolChain,\r
-            "build_target"              : self._AutoGenObject.BuildTarget,\r
+            "platform_dir"              : MyAgo.Macros["PLATFORM_DIR"],\r
+\r
+            "module_name"               : MyAgo.Name,\r
+            "module_guid"               : MyAgo.Guid,\r
+            "module_name_guid"          : MyAgo.UniqueBaseName,\r
+            "module_version"            : MyAgo.Version,\r
+            "module_type"               : MyAgo.ModuleType,\r
+            "module_file"               : MyAgo.MetaFile,\r
+            "module_file_base_name"     : MyAgo.MetaFile.BaseName,\r
+            "module_relative_directory" : MyAgo.SourceDir,\r
+            "module_dir"                : mws.join (MyAgo.WorkspaceDir, MyAgo.SourceDir),\r
+\r
+            "architecture"              : MyAgo.Arch,\r
+            "toolchain_tag"             : MyAgo.ToolChain,\r
+            "build_target"              : MyAgo.BuildTarget,\r
 \r
             "platform_build_directory"  : self.PlatformInfo.BuildDir,\r
-            "module_build_directory"    : self._AutoGenObject.BuildDir,\r
-            "module_output_directory"   : self._AutoGenObject.OutputDir,\r
-            "module_debug_directory"    : self._AutoGenObject.DebugDir,\r
+            "module_build_directory"    : MyAgo.BuildDir,\r
+            "module_output_directory"   : MyAgo.OutputDir,\r
+            "module_debug_directory"    : MyAgo.DebugDir,\r
 \r
             "separator"                 : Separator,\r
             "module_tool_definitions"   : ToolsDef,\r
@@ -1396,10 +1398,10 @@ cleanlib:
     def _CreateTemplateDict(self):\r
         Separator = self._SEP_[self._FileType]\r
 \r
-        PlatformInfo = self._AutoGenObject\r
-        if "MAKE" not in PlatformInfo.ToolDefinition or "PATH" not in PlatformInfo.ToolDefinition["MAKE"]:\r
+        MyAgo = self._AutoGenObject\r
+        if "MAKE" not in MyAgo.ToolDefinition or "PATH" not in MyAgo.ToolDefinition["MAKE"]:\r
             EdkLogger.error("build", OPTION_MISSING, "No MAKE command defined. Please check your tools_def.txt!",\r
-                            ExtraData="[%s]" % str(self._AutoGenObject))\r
+                            ExtraData="[%s]" % str(MyAgo))\r
 \r
         self.IntermediateDirectoryList = ["$(BUILD_DIR)"]\r
         self.ModuleBuildDirectoryList = self.GetModuleBuildDirectoryList()\r
@@ -1409,7 +1411,7 @@ cleanlib:
         LibraryMakefileList = []\r
         LibraryMakeCommandList = []\r
         for D in self.LibraryBuildDirectoryList:\r
-            D = self.PlaceMacro(D, {"BUILD_DIR":PlatformInfo.BuildDir})\r
+            D = self.PlaceMacro(D, {"BUILD_DIR":MyAgo.BuildDir})\r
             Makefile = os.path.join(D, MakefileName)\r
             Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":Makefile}\r
             LibraryMakefileList.append(Makefile)\r
@@ -1419,7 +1421,7 @@ cleanlib:
         ModuleMakefileList = []\r
         ModuleMakeCommandList = []\r
         for D in self.ModuleBuildDirectoryList:\r
-            D = self.PlaceMacro(D, {"BUILD_DIR":PlatformInfo.BuildDir})\r
+            D = self.PlaceMacro(D, {"BUILD_DIR":MyAgo.BuildDir})\r
             Makefile = os.path.join(D, MakefileName)\r
             Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":Makefile}\r
             ModuleMakefileList.append(Makefile)\r
@@ -1428,23 +1430,23 @@ cleanlib:
         MakefileTemplateDict = {\r
             "makefile_header"           : self._FILE_HEADER_[self._FileType],\r
             "makefile_path"             : os.path.join("$(BUILD_DIR)", MakefileName),\r
-            "make_path"                 : PlatformInfo.ToolDefinition["MAKE"]["PATH"],\r
+            "make_path"                 : MyAgo.ToolDefinition["MAKE"]["PATH"],\r
             "makefile_name"             : MakefileName,\r
-            "platform_name"             : PlatformInfo.Name,\r
-            "platform_guid"             : PlatformInfo.Guid,\r
-            "platform_version"          : PlatformInfo.Version,\r
-            "platform_file"             : self._AutoGenObject.MetaFile,\r
-            "platform_relative_directory": PlatformInfo.SourceDir,\r
-            "platform_output_directory" : PlatformInfo.OutputDir,\r
-            "platform_build_directory"  : PlatformInfo.BuildDir,\r
-            "platform_dir"              : self._AutoGenObject.Macros["PLATFORM_DIR"],\r
-\r
-            "toolchain_tag"             : PlatformInfo.ToolChain,\r
-            "build_target"              : PlatformInfo.BuildTarget,\r
+            "platform_name"             : MyAgo.Name,\r
+            "platform_guid"             : MyAgo.Guid,\r
+            "platform_version"          : MyAgo.Version,\r
+            "platform_file"             : MyAgo.MetaFile,\r
+            "platform_relative_directory": MyAgo.SourceDir,\r
+            "platform_output_directory" : MyAgo.OutputDir,\r
+            "platform_build_directory"  : MyAgo.BuildDir,\r
+            "platform_dir"              : MyAgo.Macros["PLATFORM_DIR"],\r
+\r
+            "toolchain_tag"             : MyAgo.ToolChain,\r
+            "build_target"              : MyAgo.BuildTarget,\r
             "shell_command_code"        : self._SHELL_CMD_[self._FileType].keys(),\r
             "shell_command"             : self._SHELL_CMD_[self._FileType].values(),\r
-            "build_architecture_list"   : self._AutoGenObject.Arch,\r
-            "architecture"              : self._AutoGenObject.Arch,\r
+            "build_architecture_list"   : MyAgo.Arch,\r
+            "architecture"              : MyAgo.Arch,\r
             "separator"                 : Separator,\r
             "create_directory_command"  : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList),\r
             "cleanall_command"          : self.GetRemoveDirectoryCommand(self.IntermediateDirectoryList),\r
@@ -1503,20 +1505,20 @@ class TopLevelMakefile(BuildFile):
         Separator = self._SEP_[self._FileType]\r
 \r
         # any platform autogen object is ok because we just need common information\r
-        PlatformInfo = self._AutoGenObject\r
+        MyAgo = self._AutoGenObject\r
 \r
-        if "MAKE" not in PlatformInfo.ToolDefinition or "PATH" not in PlatformInfo.ToolDefinition["MAKE"]:\r
+        if "MAKE" not in MyAgo.ToolDefinition or "PATH" not in MyAgo.ToolDefinition["MAKE"]:\r
             EdkLogger.error("build", OPTION_MISSING, "No MAKE command defined. Please check your tools_def.txt!",\r
-                            ExtraData="[%s]" % str(self._AutoGenObject))\r
+                            ExtraData="[%s]" % str(MyAgo))\r
 \r
-        for Arch in PlatformInfo.ArchList:\r
+        for Arch in MyAgo.ArchList:\r
             self.IntermediateDirectoryList.append(Separator.join(["$(BUILD_DIR)", Arch]))\r
         self.IntermediateDirectoryList.append("$(FV_DIR)")\r
 \r
         # TRICK: for not generating GenFds call in makefile if no FDF file\r
         MacroList = []\r
-        if PlatformInfo.FdfFile is not None and PlatformInfo.FdfFile != "":\r
-            FdfFileList = [PlatformInfo.FdfFile]\r
+        if MyAgo.FdfFile is not None and MyAgo.FdfFile != "":\r
+            FdfFileList = [MyAgo.FdfFile]\r
             # macros passed to GenFds\r
             MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource.replace('\\', '\\\\')))\r
             MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource.replace('\\', '\\\\')))\r
@@ -1562,35 +1564,35 @@ class TopLevelMakefile(BuildFile):
 \r
         MakefileName = self._FILE_NAME_[self._FileType]\r
         SubBuildCommandList = []\r
-        for A in PlatformInfo.ArchList:\r
+        for A in MyAgo.ArchList:\r
             Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":os.path.join("$(BUILD_DIR)", A, MakefileName)}\r
             SubBuildCommandList.append(Command)\r
 \r
         MakefileTemplateDict = {\r
             "makefile_header"           : self._FILE_HEADER_[self._FileType],\r
             "makefile_path"             : os.path.join("$(BUILD_DIR)", MakefileName),\r
-            "make_path"                 : PlatformInfo.ToolDefinition["MAKE"]["PATH"],\r
-            "platform_name"             : PlatformInfo.Name,\r
-            "platform_guid"             : PlatformInfo.Guid,\r
-            "platform_version"          : PlatformInfo.Version,\r
-            "platform_build_directory"  : PlatformInfo.BuildDir,\r
+            "make_path"                 : MyAgo.ToolDefinition["MAKE"]["PATH"],\r
+            "platform_name"             : MyAgo.Name,\r
+            "platform_guid"             : MyAgo.Guid,\r
+            "platform_version"          : MyAgo.Version,\r
+            "platform_build_directory"  : MyAgo.BuildDir,\r
             "conf_directory"            : GlobalData.gConfDirectory,\r
 \r
-            "toolchain_tag"             : PlatformInfo.ToolChain,\r
-            "build_target"              : PlatformInfo.BuildTarget,\r
+            "toolchain_tag"             : MyAgo.ToolChain,\r
+            "build_target"              : MyAgo.BuildTarget,\r
             "shell_command_code"        : self._SHELL_CMD_[self._FileType].keys(),\r
             "shell_command"             : self._SHELL_CMD_[self._FileType].values(),\r
-            'arch'                      : list(PlatformInfo.ArchList),\r
-            "build_architecture_list"   : ','.join(PlatformInfo.ArchList),\r
+            'arch'                      : list(MyAgo.ArchList),\r
+            "build_architecture_list"   : ','.join(MyAgo.ArchList),\r
             "separator"                 : Separator,\r
             "create_directory_command"  : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList),\r
             "cleanall_command"          : self.GetRemoveDirectoryCommand(self.IntermediateDirectoryList),\r
             "sub_build_command"         : SubBuildCommandList,\r
             "fdf_file"                  : FdfFileList,\r
-            "active_platform"           : str(PlatformInfo),\r
-            "fd"                        : PlatformInfo.FdTargetList,\r
-            "fv"                        : PlatformInfo.FvTargetList,\r
-            "cap"                       : PlatformInfo.CapTargetList,\r
+            "active_platform"           : str(MyAgo),\r
+            "fd"                        : MyAgo.FdTargetList,\r
+            "fv"                        : MyAgo.FvTargetList,\r
+            "cap"                       : MyAgo.CapTargetList,\r
             "extra_options"             : ExtraOption,\r
             "macro"                     : MacroList,\r
         }\r