X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FAutoGen%2FGenMake.py;h=5c992d7c267437bcfe79c798f40e442f0c5f1c3b;hp=7562dc68b36c31e5f0d0c4029607b17a4e8e3114;hb=1fa6699e6cd4ff7c8f830958f8c26d1eb368a4a7;hpb=05217d210e8da37b47d0be58ec363f7af2fa1c18 diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 7562dc68b3..5c992d7c26 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 = [] @@ -905,6 +905,44 @@ cleanlib: ForceIncludedFile, self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList ) + + # Check if header files are listed in metafile + # Get a list of unique module header source files from MetaFile + headerFilesInMetaFileSet = set() + for aFile in self._AutoGenObject.SourceFileList: + aFileName = str(aFile) + if not aFileName.endswith('.h'): + continue + headerFilesInMetaFileSet.add(aFileName.lower()) + + # Get a list of unique module autogen files + localAutoGenFileSet = set() + for aFile in self._AutoGenObject.AutoGenFileList: + localAutoGenFileSet.add(str(aFile).lower()) + + # Get a list of unique module dependency header files + # Exclude autogen files and files not in the source directory + headerFileDependencySet = set() + localSourceDir = str(self._AutoGenObject.SourceDir).lower() + for Dependency in FileDependencyDict.values(): + for aFile in Dependency: + aFileName = str(aFile).lower() + if not aFileName.endswith('.h'): + continue + if aFileName in localAutoGenFileSet: + continue + if localSourceDir not in aFileName: + continue + headerFileDependencySet.add(aFileName) + + # Check if a module dependency header file is missing from the module's MetaFile + for aFile in headerFileDependencySet: + if aFile in headerFilesInMetaFileSet: + continue + EdkLogger.warn("build","Module MetaFile [Sources] is missing local header!", + ExtraData = "Local Header: " + aFile + " not found in " + self._AutoGenObject.MetaFile.Path + ) + DepSet = None for File,Dependency in FileDependencyDict.items(): if not Dependency: @@ -943,6 +981,12 @@ cleanlib: DependencyDict[File] = list(NewDepSet) # Convert target description object to target string in makefile + if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT and TAB_C_CODE_FILE in self._AutoGenObject.Targets: + for T in self._AutoGenObject.Targets[TAB_C_CODE_FILE]: + NewFile = self.PlaceMacro(str(T), self.Macros) + if not self.ObjTargetDict.get(T.Target.SubDir): + self.ObjTargetDict[T.Target.SubDir] = set() + self.ObjTargetDict[T.Target.SubDir].add(NewFile) for Type in self._AutoGenObject.Targets: for T in self._AutoGenObject.Targets[Type]: # Generate related macros if needed @@ -952,13 +996,6 @@ cleanlib: self.ListFileMacros[T.ListFileMacro] = [] if T.GenIncListFile and T.IncListFileMacro not in self.ListFileMacros: 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: - self.ObjTargetDict[T.Target.SubDir] = set() - self.ObjTargetDict[T.Target.SubDir].add(NewFile) Deps = [] CCodeDeps = [] @@ -1024,7 +1061,7 @@ cleanlib: CommandList = T.Commands[:] for Item in CommandList[:]: SingleCommandList = Item.split() - if len(SingleCommandList) > 0 and '$(CC)' in SingleCommandList[0]: + if len(SingleCommandList) > 0 and self.CheckCCCmd(SingleCommandList): for Temp in SingleCommandList: if Temp.startswith('/Fo'): CmdSign = '%s%s' % (Temp.rsplit(TAB_SLASH, 1)[0], TAB_SLASH) @@ -1044,6 +1081,11 @@ cleanlib: T.Commands.pop(Index) return T, CmdSumDict, CmdTargetDict, CmdCppDict + def CheckCCCmd(self, CommandList): + for cmd in CommandList: + if '$(CC)' in cmd: + return True + return False ## For creating makefile targets for dependent libraries def ProcessDependentLibrary(self): for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList: