]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools: Fix a bug for Size incorrect of Void* Fixatbuild Pcd
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / GenMake.py
index 4b924d21e099b0bee55554cd8a8194a95b12c3e6..b7594d8988da5a10ec6d35676a80de8670ed16ab 100644 (file)
@@ -25,6 +25,7 @@ from Common.Misc import *
 from Common.String import *\r
 from BuildEngine import *\r
 import Common.GlobalData as GlobalData\r
+from collections import OrderedDict\r
 \r
 ## Regular expression for finding header file inclusions\r
 gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | re.IGNORECASE)\r
@@ -442,7 +443,7 @@ cleanlib:
         self.LibraryMakefileList = []\r
         self.LibraryBuildDirectoryList = []\r
         self.SystemLibraryList = []\r
-        self.Macros = sdict()\r
+        self.Macros = OrderedDict()\r
         self.Macros["OUTPUT_DIR"      ] = self._AutoGenObject.Macros["OUTPUT_DIR"]\r
         self.Macros["DEBUG_DIR"       ] = self._AutoGenObject.Macros["DEBUG_DIR"]\r
         self.Macros["MODULE_BUILD_DIR"] = self._AutoGenObject.Macros["MODULE_BUILD_DIR"]\r
@@ -491,7 +492,7 @@ cleanlib:
             ImageEntryPoint = "_ModuleEntryPoint"\r
 \r
         for k, v in self._AutoGenObject.Module.Defines.iteritems():\r
-            if k not in self._AutoGenObject.Macros.keys():\r
+            if k not in self._AutoGenObject.Macros:\r
                 self._AutoGenObject.Macros[k] = v\r
 \r
         if 'MODULE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
@@ -906,12 +907,12 @@ cleanlib:
             # skip non-C files\r
             if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c":\r
                 continue\r
-            elif DepSet == None:\r
+            elif DepSet is None:\r
                 DepSet = set(self.FileDependency[File])\r
             else:\r
                 DepSet &= set(self.FileDependency[File])\r
         # in case nothing in SourceFileList\r
-        if DepSet == None:\r
+        if DepSet is None:\r
             DepSet = set()\r
         #\r
         # Extract common files list in the dependency files\r
@@ -1516,7 +1517,7 @@ class TopLevelMakefile(BuildFile):
 \r
         # TRICK: for not generating GenFds call in makefile if no FDF file\r
         MacroList = []\r
-        if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "":\r
+        if PlatformInfo.FdfFile is not None and PlatformInfo.FdfFile != "":\r
             FdfFileList = [PlatformInfo.FdfFile]\r
             # macros passed to GenFds\r
             MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource.replace('\\', '\\\\')))\r
@@ -1551,26 +1552,15 @@ class TopLevelMakefile(BuildFile):
         if GlobalData.gIgnoreSource:\r
             ExtraOption += " --ignore-sources"\r
 \r
-        if GlobalData.BuildOptionPcd:\r
-            for index, option in enumerate(GlobalData.gCommand):\r
-                if "--pcd" == option and GlobalData.gCommand[index+1]:\r
-                    pcdName, pcdValue = GlobalData.gCommand[index+1].split('=')\r
-                    for Item in GlobalData.BuildOptionPcd:\r
-                        if '.'.join(Item[0:2]) == pcdName:\r
-                            pcdValue = Item[2]\r
-                            if pcdValue.startswith('L') or pcdValue.startswith('"'):\r
-                                pcdValue, Size = ParseFieldValue(pcdValue)\r
-                                NewVal = '{'\r
-                                for S in range(Size):\r
-                                    NewVal = NewVal + '0x%02X' % ((pcdValue >> S * 8) & 0xff)\r
-                                    NewVal += ','\r
-                                pcdValue =  NewVal[:-1] + '}'\r
-                            break\r
-                    if pcdValue.startswith('{'):\r
-                        pcdValue = 'H' + '"' + pcdValue + '"'\r
-                        ExtraOption += " --pcd " + pcdName + '=' + pcdValue\r
-                    else:\r
-                        ExtraOption += " --pcd " + GlobalData.gCommand[index+1]\r
+        for pcd in GlobalData.BuildOptionPcd:\r
+            if pcd[2]:\r
+                pcdname = '.'.join(pcd[0:3])\r
+            else:\r
+                pcdname = '.'.join(pcd[0:2])\r
+            if pcd[3].startswith('{'):\r
+                ExtraOption += " --pcd " + pcdname + '=' + 'H' + '"' + pcd[3] + '"'\r
+            else:\r
+                ExtraOption += " --pcd " + pcdname + '=' + pcd[3]\r
 \r
         MakefileName = self._FILE_NAME_[self._FileType]\r
         SubBuildCommandList = []\r