]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools:fixed the incorrect autogen makefile which cause build failure.
authorFan, ZhijuX <zhijux.fan@intel.com>
Thu, 18 Apr 2019 11:20:46 +0000 (19:20 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Mon, 22 Apr 2019 08:50:25 +0000 (16:50 +0800)
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1729

On some build environment, build fails but on the other build machines,
build success. This is the regression issue introduced by commit
 05217d210e8da37b47d0be58ec363f7af2fa1c18

As Dict is unordered, an error occurs when extract the index of the Dict
in the order of the keys after the creation of a new item.
Keys are indexed inconsistently before and after adding a new item.
The logic of the program is to store the key's corresponding index as
reference data in the MakeFile and use it as part of the macro.
The data model is: $(LIST_%d) % Dict.keys().index(Key)
So for now, use OrdereDict instead of Dict.

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

index 7562dc68b36c31e5f0d0c4029607b17a4e8e3114..3e770ad7c425d1e6b8db3f49d4bccd9ed4905a3c 100644 (file)
@@ -429,7 +429,7 @@ cleanlib:
         self.CommonFileDependency = []\r
         self.FileListMacros = {}\r
         self.ListFileMacros = {}\r
-        self.ObjTargetDict = {}\r
+        self.ObjTargetDict = OrderedDict()\r
         self.FileCache = {}\r
         self.LibraryBuildCommandList = []\r
         self.LibraryFileList = []\r
@@ -943,6 +943,12 @@ cleanlib:
             DependencyDict[File] = list(NewDepSet)\r
 \r
         # Convert target description object to target string in makefile\r
+        if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT and TAB_C_CODE_FILE in self._AutoGenObject.Targets:\r
+            for T in self._AutoGenObject.Targets[TAB_C_CODE_FILE]:\r
+                NewFile = self.PlaceMacro(str(T), self.Macros)\r
+                if not self.ObjTargetDict.get(T.Target.SubDir):\r
+                    self.ObjTargetDict[T.Target.SubDir] = set()\r
+                self.ObjTargetDict[T.Target.SubDir].add(NewFile)\r
         for Type in self._AutoGenObject.Targets:\r
             for T in self._AutoGenObject.Targets[Type]:\r
                 # Generate related macros if needed\r
@@ -952,13 +958,6 @@ cleanlib:
                     self.ListFileMacros[T.ListFileMacro] = []\r
                 if T.GenIncListFile and T.IncListFileMacro not in self.ListFileMacros:\r
                     self.ListFileMacros[T.IncListFileMacro] = []\r
-                if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT and Type == TAB_C_CODE_FILE:\r
-                    NewFile = self.PlaceMacro(str(T), self.Macros)\r
-                    if self.ObjTargetDict.get(T.Target.SubDir):\r
-                        self.ObjTargetDict[T.Target.SubDir].add(NewFile)\r
-                    else:\r
-                        self.ObjTargetDict[T.Target.SubDir] = set()\r
-                        self.ObjTargetDict[T.Target.SubDir].add(NewFile)\r
 \r
                 Deps = []\r
                 CCodeDeps = []\r