]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Revert "BaseTools: Improve GetDependencyList function"
authorLiming Gao <liming.gao@intel.com>
Fri, 20 Sep 2019 06:00:12 +0000 (14:00 +0800)
committerLiming Gao <liming.gao@intel.com>
Fri, 20 Sep 2019 16:25:48 +0000 (00:25 +0800)
This reverts commit bc9e4194cf3edaf9524c83098ba3f72008c70190.
This change causes the dependent header files are missing in Makefile.
It makes the incremental build not work. So, revert this change.

Cc: Bob Feng<bob.c.feng@Intel.com>
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng<bob.c.feng@Intel.com>
BaseTools/Source/Python/AutoGen/GenMake.py

index 940136248f5b84c6d937ec2ffc95a7018b2fc0f7..2fe0e78bec7e735f2ba20d112a07610b36cfe44d 100755 (executable)
@@ -1696,25 +1696,22 @@ def GetDependencyList(AutoGenObject, FileCache, File, ForceList, SearchPathList)
             CurrentFileDependencyList = DepDb[F]\r
         else:\r
             try:\r
-                with open(F.Path, 'rb') as Fd:\r
-                    FileContent = Fd.read(1)\r
-                    Fd.seek(0)\r
-                    if not FileContent:\r
-                        continue\r
-                    if FileContent[0] == 0xff or FileContent[0] == 0xfe:\r
-                        FileContent2 = Fd.read()\r
-                        FileContent2 = FileContent2.decode('utf-16')\r
-                        IncludedFileList = gIncludePattern.findall(FileContent2)\r
-                    else:\r
-                        FileLines = Fd.readlines()\r
-                        FileContent2 = [line for line in FileLines if str(line).lstrip("#\t ")[:8] == "include "]\r
-                        simpleFileContent="".join(FileContent2)\r
-\r
-                        IncludedFileList = gIncludePattern.findall(simpleFileContent)\r
+                Fd = open(F.Path, 'rb')\r
+                FileContent = Fd.read()\r
+                Fd.close()\r
             except BaseException as X:\r
                 EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=F.Path + "\n\t" + str(X))\r
-            if not FileContent:\r
+            if len(FileContent) == 0:\r
+                continue\r
+            try:\r
+                if FileContent[0] == 0xff or FileContent[0] == 0xfe:\r
+                    FileContent = FileContent.decode('utf-16')\r
+                else:\r
+                    FileContent = FileContent.decode()\r
+            except:\r
+                # The file is not txt file. for example .mcb file\r
                 continue\r
+            IncludedFileList = gIncludePattern.findall(FileContent)\r
 \r
             for Inc in IncludedFileList:\r
                 Inc = Inc.strip()\r