As the Dict is unordered, an error occurs when using the Dict while creating a new item.So for now, use OrdereDict instead of Dict. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/GenMake.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 7562dc68b3..426e6ca51a 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -429,7 +429,7 @@ cleanlib: self.CommonFileDependency = [] self.FileListMacros = {} self.ListFileMacros = {} - self.ObjTargetDict = {} + self.ObjTargetDict = OrderedDict() self.FileCache = {} self.LibraryBuildCommandList = [] self.LibraryFileList = [] @@ -954,11 +954,9 @@ cleanlib: self.ListFileMacros[T.IncListFileMacro] = [] if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT and Type == TAB_C_CODE_FILE: NewFile = self.PlaceMacro(str(T), self.Macros) - if self.ObjTargetDict.get(T.Target.SubDir): - self.ObjTargetDict[T.Target.SubDir].add(NewFile) - else: + if not self.ObjTargetDict.get(T.Target.SubDir): self.ObjTargetDict[T.Target.SubDir] = set() - self.ObjTargetDict[T.Target.SubDir].add(NewFile) + self.ObjTargetDict[T.Target.SubDir].add(NewFile) Deps = [] CCodeDeps = [] -- 2.14.1.windows.1