]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix an incremental build issue caused by macro in #include
authorLin, Derek (HPS SW) <derek.lin2@hpe.com>
Wed, 16 Oct 2019 06:17:26 +0000 (14:17 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Fri, 18 Oct 2019 00:30:38 +0000 (08:30 +0800)
When c/h file use macro after #include, for example,
In this case, GenMake is not able to create a healthy dependency for the c
file. GenMake used to add $(FORCE_REBUILD) dependency in the c file, this
guarantee the c file is always compiled in incremental build. But, this
function is broken since 05217d210e8da37b47d0be58ec363f7af2fa1c18 which
enable /MP for MSVC compiler, in order to compile multiple c files in one
command multi-processing. The fix here is adding '$(FORCE_REBUILD)' back to
retain the original function.

Line number 1728 and 978 are the code pieces which handle this logic.

Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/Python/AutoGen/GenMake.py

index 97ba158ff271090d69baa0682a3f21d36e925747..59a01a7f243ac0a1644ecee0d58eb42df4c6dbb6 100755 (executable)
@@ -1080,13 +1080,17 @@ cleanlib:
                     else:\r
                         CmdCppDict[item.Target.SubDir] = ['$(MAKE_FILE)', Path]\r
                     if CppPath.Path in DependencyDict:\r
-                        for Temp in DependencyDict[CppPath.Path]:\r
-                            try:\r
-                                Path = self.PlaceMacro(Temp.Path, self.Macros)\r
-                            except:\r
-                                continue\r
-                            if Path not in (self.CommonFileDependency + CmdCppDict[item.Target.SubDir]):\r
-                                CmdCppDict[item.Target.SubDir].append(Path)\r
+                        if '$(FORCE_REBUILD)' in DependencyDict[CppPath.Path]:\r
+                            if '$(FORCE_REBUILD)' not in (self.CommonFileDependency + CmdCppDict[item.Target.SubDir]):\r
+                                CmdCppDict[item.Target.SubDir].append('$(FORCE_REBUILD)')\r
+                        else:\r
+                            for Temp in DependencyDict[CppPath.Path]:\r
+                                try:\r
+                                    Path = self.PlaceMacro(Temp.Path, self.Macros)\r
+                                except:\r
+                                    continue\r
+                                if Path not in (self.CommonFileDependency + CmdCppDict[item.Target.SubDir]):\r
+                                    CmdCppDict[item.Target.SubDir].append(Path)\r
         if T.Commands:\r
             CommandList = T.Commands[:]\r
             for Item in CommandList[:]:\r