]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/AutoGen/AutoGen.py
MdePkg/DevicePathLib: Fix FromText bug for multi-instance devicepath
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / AutoGen.py
index 79bc7c6ced839c091002011a75b43f4c7e1bb412..06e674a5067b3c06566c921805b2272cc819c9fa 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # Generate AutoGen.h, AutoGen.c and *.depex files\r
 #\r
-# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -72,7 +72,8 @@ gAutoGenHeaderFileName = "AutoGen.h"
 gAutoGenStringFileName = "%(module_name)sStrDefs.h"\r
 gAutoGenStringFormFileName = "%(module_name)sStrDefs.hpk"\r
 gAutoGenDepexFileName = "%(module_name)s.depex"\r
-\r
+gAutoGenImageDefFileName = "%(module_name)sImgDefs.h"\r
+gAutoGenIdfFileName = "%(module_name)sIdf.hpk"\r
 gInfSpecVersion = "0x00010017"\r
 \r
 #\r
@@ -1717,7 +1718,10 @@ class PlatformAutoGen(AutoGen):
                         if self.BuildOption[Tool][Attr].startswith('='):\r
                             Value = self.BuildOption[Tool][Attr][1:]\r
                         else:\r
-                            Value += " " + self.BuildOption[Tool][Attr]\r
+                            if Attr != 'PATH':\r
+                                Value += " " + self.BuildOption[Tool][Attr]\r
+                            else:\r
+                                Value = self.BuildOption[Tool][Attr]\r
 \r
                     if Attr == "PATH":\r
                         # Don't put MAKE definition in the file\r
@@ -2380,8 +2384,11 @@ class PlatformAutoGen(AutoGen):
                         if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):\r
                             BuildOptions[Tool][Attr] = Options[Key]\r
                         else:\r
-                            # append options for the same tool\r
-                            BuildOptions[Tool][Attr] += " " + Options[Key]\r
+                            # append options for the same tool except PATH\r
+                            if Attr != 'PATH':\r
+                                BuildOptions[Tool][Attr] += " " + Options[Key]\r
+                            else:\r
+                                BuildOptions[Tool][Attr] = Options[Key]\r
         # Build Option Family has been checked, which need't to be checked again for family.\r
         if FamilyMatch or FamilyIsNull:\r
             return BuildOptions\r
@@ -2412,8 +2419,11 @@ class PlatformAutoGen(AutoGen):
                         if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):\r
                             BuildOptions[Tool][Attr] = Options[Key]\r
                         else:\r
-                            # append options for the same tool\r
-                            BuildOptions[Tool][Attr] += " " + Options[Key]\r
+                            # append options for the same tool except PATH\r
+                            if Attr != 'PATH':\r
+                                BuildOptions[Tool][Attr] += " " + Options[Key]\r
+                            else:\r
+                                BuildOptions[Tool][Attr] = Options[Key]\r
         return BuildOptions\r
 \r
     ## Append build options in platform to a module\r
@@ -2472,7 +2482,10 @@ class PlatformAutoGen(AutoGen):
                         BuildOptions[Tool][Attr] = ToolPath\r
                     else:\r
                         Value = mws.handleWsMacro(Value)\r
-                        BuildOptions[Tool][Attr] += " " + Value\r
+                        if Attr != 'PATH':\r
+                            BuildOptions[Tool][Attr] += " " + Value\r
+                        else:\r
+                            BuildOptions[Tool][Attr] = Value\r
         if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag != None:\r
             #\r
             # Override UNI flag only for EDK module.\r
@@ -2590,6 +2603,8 @@ class ModuleAutoGen(AutoGen):
         self._IncludePathLength = 0\r
         self._AutoGenFileList = None\r
         self._UnicodeFileList = None\r
+        self._VfrFileList = None\r
+        self._IdfFileList = None\r
         self._SourceFileList  = None\r
         self._ObjectFileList  = None\r
         self._BinaryFileList  = None\r
@@ -3114,6 +3129,24 @@ class ModuleAutoGen(AutoGen):
                 self._UnicodeFileList = []\r
         return self._UnicodeFileList\r
 \r
+    ## Return the list of vfr files\r
+    def _GetVfrFileList(self):\r
+        if self._VfrFileList == None:\r
+            if TAB_VFR_FILE in self.FileTypes:\r
+                self._VfrFileList = self.FileTypes[TAB_VFR_FILE]\r
+            else:\r
+                self._VfrFileList = []\r
+        return self._VfrFileList\r
+\r
+    ## Return the list of Image Definition files\r
+    def _GetIdfFileList(self):\r
+        if self._IdfFileList == None:\r
+            if TAB_IMAGE_FILE in self.FileTypes:\r
+                self._IdfFileList = self.FileTypes[TAB_IMAGE_FILE]\r
+            else:\r
+                self._IdfFileList = []\r
+        return self._IdfFileList\r
+\r
     ## Return a list of files which can be built from binary\r
     #\r
     #  "Build" binary files are just to copy them to build directory.\r
@@ -3276,15 +3309,19 @@ class ModuleAutoGen(AutoGen):
     #\r
     def _GetAutoGenFileList(self):\r
         UniStringAutoGenC = True\r
+        IdfStringAutoGenC = True\r
         UniStringBinBuffer = StringIO()\r
+        IdfGenBinBuffer = StringIO()\r
         if self.BuildType == 'UEFI_HII':\r
             UniStringAutoGenC = False\r
+            IdfStringAutoGenC = False\r
         if self._AutoGenFileList == None:\r
             self._AutoGenFileList = {}\r
             AutoGenC = TemplateString()\r
             AutoGenH = TemplateString()\r
             StringH = TemplateString()\r
-            GenC.CreateCode(self, AutoGenC, AutoGenH, StringH, UniStringAutoGenC, UniStringBinBuffer)\r
+            StringIdf = TemplateString()\r
+            GenC.CreateCode(self, AutoGenC, AutoGenH, StringH, UniStringAutoGenC, UniStringBinBuffer, StringIdf, IdfStringAutoGenC, IdfGenBinBuffer)\r
             #\r
             # AutoGen.c is generated if there are library classes in inf, or there are object files\r
             #\r
@@ -3308,6 +3345,17 @@ class ModuleAutoGen(AutoGen):
                 self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)\r
             if UniStringBinBuffer != None:\r
                 UniStringBinBuffer.close()\r
+            if str(StringIdf) != "":\r
+                AutoFile = PathClass(gAutoGenImageDefFileName % {"module_name":self.Name}, self.DebugDir)\r
+                self._AutoGenFileList[AutoFile] = str(StringIdf)\r
+                self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)\r
+            if IdfGenBinBuffer != None and IdfGenBinBuffer.getvalue() != "":\r
+                AutoFile = PathClass(gAutoGenIdfFileName % {"module_name":self.Name}, self.OutputDir)\r
+                self._AutoGenFileList[AutoFile] = IdfGenBinBuffer.getvalue()\r
+                AutoFile.IsBinary = True\r
+                self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)\r
+            if IdfGenBinBuffer != None:\r
+                IdfGenBinBuffer.close()\r
         return self._AutoGenFileList\r
 \r
     ## Return the list of library modules explicitly or implicityly used by this module\r
@@ -4054,6 +4102,7 @@ class ModuleAutoGen(AutoGen):
     IncludePathLength = property(_GetIncludePathLength)\r
     AutoGenFileList = property(_GetAutoGenFileList)\r
     UnicodeFileList = property(_GetUnicodeFileList)\r
+    VfrFileList     = property(_GetVfrFileList)\r
     SourceFileList  = property(_GetSourceFileList)\r
     BinaryFileList  = property(_GetBinaryFiles) # FileType : [File List]\r
     Targets         = property(_GetTargets)\r
@@ -4061,6 +4110,7 @@ class ModuleAutoGen(AutoGen):
     CodaTargetList  = property(_GetFinalTargetList)\r
     FileTypes       = property(_GetFileTypes)\r
     BuildRules      = property(_GetBuildRules)\r
+    IdfFileList     = property(_GetIdfFileList)\r
 \r
     DependentPackageList    = property(_GetDependentPackageList)\r
     DependentLibraryList    = property(_GetLibraryList)\r