]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools: Fix build failure for DynamicEx Pcd used in the Library
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / GenMake.py
index 8913a72111e210aff841b6231254f2ce80e7a516..ea07b97786182700d2da51a211286f4437bc8ac8 100644 (file)
@@ -488,6 +488,11 @@ cleanlib:
         if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
             self._AutoGenObject.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint\r
 \r
+        PCI_COMPRESS_Flag = False\r
+        for k, v in self._AutoGenObject.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
@@ -505,6 +510,14 @@ cleanlib:
                     # Remove duplicated include path, if any\r
                     if Attr == "FLAGS":\r
                         Value = RemoveDupOption(Value, IncPrefix, self._AutoGenObject.IncludePathList)\r
+                        if Tool == "OPTROM" and PCI_COMPRESS_Flag:\r
+                            ValueList = Value.split()\r
+                            if ValueList:\r
+                                for i, v in enumerate(ValueList):\r
+                                    if '-e' == v:\r
+                                        ValueList[i] = '-ec'\r
+                                Value = ' '.join(ValueList)\r
+\r
                     ToolsDef.append("%s_%s = %s" % (Tool, Attr, Value))\r
             ToolsDef.append("")\r
 \r
@@ -597,10 +610,11 @@ cleanlib:
         while not found and os.sep in package_rel_dir:\r
             index = package_rel_dir.index(os.sep)\r
             current_dir = mws.join(current_dir, package_rel_dir[:index])\r
-            for fl in os.listdir(current_dir):\r
-                if fl.endswith('.dec'):\r
-                    found = True\r
-                    break\r
+            if os.path.exists(current_dir):\r
+                for fl in os.listdir(current_dir):\r
+                    if fl.endswith('.dec'):\r
+                        found = True\r
+                        break\r
             package_rel_dir = package_rel_dir[index + 1:]\r
 \r
         MakefileTemplateDict = {\r
@@ -754,7 +768,11 @@ cleanlib:
                                     break\r
                             else:\r
                                 break\r
-                        RespDict[Key] = Value\r
+\r
+                        if self._AutoGenObject.ToolChainFamily == 'GCC':\r
+                            RespDict[Key] = Value.replace('\\', '/')\r
+                        else:\r
+                            RespDict[Key] = Value\r
                         for Target in BuildTargets:\r
                             for i, SingleCommand in enumerate(BuildTargets[Target].Commands):\r
                                 if FlagDict[Flag]['Macro'] in SingleCommand:\r
@@ -783,6 +801,9 @@ cleanlib:
             if not self.FileDependency[File]:\r
                 self.FileDependency[File] = ['$(FORCE_REBUILD)']\r
                 continue\r
+\r
+            self._AutoGenObject.AutoGenDepSet |= set(self.FileDependency[File])\r
+\r
             # skip non-C files\r
             if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c":\r
                 continue\r
@@ -853,7 +874,8 @@ cleanlib:
     ## For creating makefile targets for dependent libraries\r
     def ProcessDependentLibrary(self):\r
         for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList:\r
-            self.LibraryBuildDirectoryList.append(self.PlaceMacro(LibraryAutoGen.BuildDir, self.Macros))\r
+            if not LibraryAutoGen.IsBinaryModule:\r
+                self.LibraryBuildDirectoryList.append(self.PlaceMacro(LibraryAutoGen.BuildDir, self.Macros))\r
 \r
     ## Return a list containing source file's dependencies\r
     #\r
@@ -1427,6 +1449,11 @@ 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
+                    ExtraOption += " --pcd " + GlobalData.gCommand[index+1]\r
+\r
         MakefileName = self._FILE_NAME_[self._FileType]\r
         SubBuildCommandList = []\r
         for A in PlatformInfo.ArchList:\r