X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FAutoGen%2FGenMake.py;h=3720c8bfedbdfb8abdd2ba8ae669f7c2bf540c2f;hp=e3f5c2b6ecdea07ffb37ac560347e175e034ddba;hb=79b74a03e018ecbf03d8d50e6f20301e249c1ba5;hpb=40d841f6a8f84e75409178e19e69b95e01bada0f diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index e3f5c2b6ec..3720c8bfed 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -26,12 +26,12 @@ from BuildEngine import * import Common.GlobalData as GlobalData ## Regular expression for finding header file inclusions -gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:[\"<]?[ \t]*)([\w.\\/]+)(?:[ \t]*[\">]?)", re.MULTILINE|re.UNICODE) +gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE|re.UNICODE|re.IGNORECASE) ## Regular expression for matching macro used in header file inclusion gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE) -## pattern for include style in R8.x code +## pattern for include style in Edk.x code gProtocolDefinition = "Protocol/%(HeaderKey)s/%(HeaderKey)s.h" gGuidDefinition = "Guid/%(HeaderKey)s/%(HeaderKey)s.h" gArchProtocolDefinition = "ArchProtocol/%(HeaderKey)s/%(HeaderKey)s.h" @@ -448,7 +448,7 @@ cleanlib: % (self._AutoGenObject.BuildTarget, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), ExtraData="[%s]" % str(self._AutoGenObject)) - # convert dependent libaries to build command + # convert dependent libraries to build command self.ProcessDependentLibrary() if len(self._AutoGenObject.Module.ModuleEntryPointList) > 0: ModuleEntryPoint = self._AutoGenObject.Module.ModuleEntryPointList[0] @@ -462,13 +462,13 @@ cleanlib: ArchEntryPoint = ModuleEntryPoint if self._AutoGenObject.Arch == "EBC": - # EBC compiler always use "EfiStart" as entry point. Only applies to R9 modules + # EBC compiler always use "EfiStart" as entry point. Only applies to EdkII modules ImageEntryPoint = "EfiStart" elif self._AutoGenObject.AutoGenVersion < 0x00010005: - # R8 modules use entry point specified in INF file + # Edk modules use entry point specified in INF file ImageEntryPoint = ModuleEntryPoint else: - # R9 modules always use "_ModuleEntryPoint" as entry point + # EdkII modules always use "_ModuleEntryPoint" as entry point ImageEntryPoint = "_ModuleEntryPoint" # tools definitions @@ -493,7 +493,7 @@ cleanlib: # convert source files and binary files to build targets self.ResultFileList = [str(T.Target) for T in self._AutoGenObject.CodaTargetList] - if len(self.ResultFileList) == 0: + if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) <> 0: EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build", ExtraData="[%s]" % str(self._AutoGenObject)) @@ -535,7 +535,7 @@ cleanlib: False ) - # R8 modules need StrDefs.h for string ID + # Edk modules need StrDefs.h for string ID #if self._AutoGenObject.AutoGenVersion < 0x00010005 and len(self._AutoGenObject.UnicodeFileList) > 0: # BcTargetList = ['strdefs'] #else: @@ -614,7 +614,7 @@ cleanlib: self.FileDependency = self.GetFileDependency( SourceFileList, ForceIncludedFile, - self._AutoGenObject.IncludePathList + self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList ) DepSet = None for File in self.FileDependency: @@ -632,7 +632,7 @@ cleanlib: if DepSet == None: DepSet = set() # - # Extract comman files list in the dependency files + # Extract common files list in the dependency files # for File in DepSet: self.CommonFileDependency.append(self.PlaceMacro(File.Path, self.Macros)) @@ -728,6 +728,9 @@ cleanlib: gDependencyDatabase[self._AutoGenObject.Arch] = {} DepDb = gDependencyDatabase[self._AutoGenObject.Arch] + # add path of given source file into search path list. + if File.Dir not in SearchPathList: + SearchPathList.append(File.Dir) while len(FileStack) > 0: F = FileStack.pop() @@ -754,6 +757,7 @@ cleanlib: CurrentFilePath = F.Dir for Inc in IncludedFileList: + Inc = Inc.strip() # if there's macro used to reference header file, expand it HeaderList = gMacroPattern.findall(Inc) if len(HeaderList) == 1 and len(HeaderList[0]) == 2: @@ -768,7 +772,7 @@ cleanlib: Inc = os.path.normpath(Inc) for SearchPath in [CurrentFilePath] + SearchPathList: FilePath = os.path.join(SearchPath, Inc) - if not os.path.exists(FilePath) or FilePath in CurrentFileDependencyList: + if not os.path.isfile(FilePath) or FilePath in CurrentFileDependencyList: continue FilePath = PathClass(FilePath) CurrentFileDependencyList.append(FilePath) @@ -776,7 +780,7 @@ cleanlib: FileStack.append(FilePath) break else: - EdkLogger.debug(EdkLogger.DEBUG_9, "%s included by %s was not found"\ + EdkLogger.debug(EdkLogger.DEBUG_9, "%s included by %s was not found "\ "in any given path:\n\t%s" % (Inc, F, "\n\t".join(SearchPathList))) if not MacroUsedByIncludedFile: @@ -1249,7 +1253,7 @@ ${END}\t@cd $(BUILD_DIR) # fds: init \t-@cd $(FV_DIR) -${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list} ${extra_options}${END}${BEGIN} -r ${fd} ${END}${BEGIN} -i ${fv} ${END}${BEGIN} -D ${macro} ${END} +${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list}${END}${BEGIN}${extra_options}${END}${BEGIN} -r ${fd}${END}${BEGIN} -i ${fv}${END}${BEGIN} -C ${cap}${END}${BEGIN} -D${macro}${END} # # run command for emulator platform only @@ -1331,6 +1335,9 @@ ${END}\t@cd $(BUILD_DIR)\n if GlobalData.gCaseInsensitive: ExtraOption += " -c" + ExtraOptionList = [] + if ExtraOption: + ExtraOptionList.append(ExtraOption) MakefileName = self._FILE_NAME_[self._FileType] SubBuildCommandList = [] @@ -1361,7 +1368,8 @@ ${END}\t@cd $(BUILD_DIR)\n "active_platform" : str(PlatformInfo), "fd" : PlatformInfo.FdTargetList, "fv" : PlatformInfo.FvTargetList, - "extra_options" : ExtraOption, + "cap" : PlatformInfo.CapTargetList, + "extra_options" : ExtraOptionList, "macro" : MacroList, }