From 08dd311f5dc735c595d39faf2e6f7e2810bb79a9 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Mon, 11 Oct 2010 06:26:52 +0000 Subject: Sync EDKII BaseTools to BaseTools project r2065. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10915 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 42 +++++++++++------------ BaseTools/Source/Python/AutoGen/GenMake.py | 4 +-- BaseTools/Source/Python/AutoGen/UniClassObject.py | 7 ++++ 3 files changed, 30 insertions(+), 23 deletions(-) (limited to 'BaseTools/Source/Python/AutoGen') diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index d95f40bf82..aaba768b4a 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -162,6 +162,10 @@ class WorkspaceAutoGen(AutoGen): # parse FDF file to get PCDs in it, if any if self.FdfFile != None and self.FdfFile != '': + # + # Make global macros available when parsing FDF file + # + InputMacroDict.update(self.BuildDatabase.WorkspaceDb._GlobalMacros) Fdf = FdfParser(self.FdfFile.Path) Fdf.ParseFile() PcdSet = Fdf.Profile.PcdDict @@ -544,9 +548,18 @@ class PlatformAutoGen(AutoGen): DecPcdEntry = eachDec.Pcds[DecPcd] if (DecPcdEntry.TokenSpaceGuidCName == DscPcdEntry.TokenSpaceGuidCName) and \ (DecPcdEntry.TokenCName == DscPcdEntry.TokenCName): + # Print warning message to let the developer make a determine. + EdkLogger.warn("build", "Unreferenced vpd pcd used!", + File=self.MetaFile, \ + ExtraData = "PCD: %s.%s used in the DSC file %s is unreferenced." \ + %(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, self.Platform.MetaFile.Path)) + DscPcdEntry.DatumType = DecPcdEntry.DatumType DscPcdEntry.DefaultValue = DecPcdEntry.DefaultValue - Sku.DefaultValue = DecPcdEntry.DefaultValue + # Only fix the value while no value provided in DSC file. + if (Sku.DefaultValue == "" or Sku.DefaultValue==None): + DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]].DefaultValue = DecPcdEntry.DefaultValue + VpdFile.Add(DscPcdEntry, Sku.VpdOffset) # if the offset of a VPD is *, then it need to be fixed up by third party tool. @@ -569,11 +582,9 @@ class PlatformAutoGen(AutoGen): except: EdkLogger.error("build", FILE_WRITE_FAILURE, "Fail to create FV folder under %s" % self.BuildDir) - VpdFileName = self.Platform.VpdFileName - if VpdFileName == None or VpdFileName == "" : - VpdFilePath = os.path.join(FvPath, "%s.txt" % self.Platform.VpdToolGuid) - else : - VpdFilePath = os.path.join(FvPath, "%s.txt" % VpdFileName) + + VpdFilePath = os.path.join(FvPath, "%s.txt" % self.Platform.VpdToolGuid) + if not os.path.exists(VpdFilePath) or os.path.getmtime(VpdFilePath) < DscTimeStamp: VpdFile.Write(VpdFilePath) @@ -588,16 +599,13 @@ class PlatformAutoGen(AutoGen): break # Call third party GUID BPDG tool. if BPDGToolName != None: - VpdInfoFile.CallExtenalBPDGTool(BPDGToolName, VpdFilePath, VpdFileName) + VpdInfoFile.CallExtenalBPDGTool(BPDGToolName, VpdFilePath) else: EdkLogger.error("Build", FILE_NOT_FOUND, "Fail to find third-party BPDG tool to process VPD PCDs. BPDG Guid tool need to be defined in tools_def.txt and VPD_TOOL_GUID need to be provided in DSC file.") # Process VPD map file generated by third party BPDG tool if NeedProcessVpdMapFile: - if VpdFileName == None or VpdFileName == "" : - VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % self.Platform.VpdToolGuid) - else : - VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % VpdFileName) + VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % self.Platform.VpdToolGuid) if os.path.exists(VpdMapFilePath): VpdFile.Read(VpdMapFilePath) @@ -1709,12 +1717,12 @@ class ModuleAutoGen(AutoGen): self._SourceFileList = [] for F in self.Module.Sources: # match tool chain - if F.TagName != "" and F.TagName != self.ToolChain: + if F.TagName not in ("", "*", self.ToolChain): EdkLogger.debug(EdkLogger.DEBUG_9, "The toolchain [%s] for processing file [%s] is found, " "but [%s] is needed" % (F.TagName, str(F), self.ToolChain)) continue # match tool chain family - if F.ToolChainFamily != "" and F.ToolChainFamily != self.ToolChainFamily: + if F.ToolChainFamily not in ("", "*", self.ToolChainFamily): EdkLogger.debug( EdkLogger.DEBUG_0, "The file [%s] must be built by tools of [%s], " \ @@ -2128,14 +2136,6 @@ class ModuleAutoGen(AutoGen): self._ApplyBuildRule(Lib.Target, TAB_UNKNOWN_FILE) return self._LibraryAutoGenList - ## Return build command string - # - # @retval string Build command string - # - def _GetBuildCommand(self): - return self.PlatformInfo.BuildCommand - - Module = property(_GetModule) Name = property(_GetBaseName) Guid = property(_GetGuid) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 2e18f6771c..b1e438547f 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -26,7 +26,7 @@ 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]+)(?:[ \t]*[\">]?)", re.MULTILINE|re.UNICODE|re.IGNORECASE) +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) @@ -769,7 +769,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) diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/Source/Python/AutoGen/UniClassObject.py index 76a0549a75..1eb65c1e9a 100644 --- a/BaseTools/Source/Python/AutoGen/UniClassObject.py +++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py @@ -444,6 +444,13 @@ class UniFileClassObject(object): # Add a string to list # def AddStringToList(self, Name, Language, Value, Token = None, Referenced = False, UseOtherLangDef = '', Index = -1): + for LangNameItem in self.LanguageDef: + if Language == LangNameItem[0]: + break + else: + EdkLogger.error('Unicode File Parser', FORMAT_NOT_SUPPORTED, "The language '%s' for %s is not defined in Unicode file %s." \ + % (Language, Name, self.File)) + if Language not in self.OrderedStringList: self.OrderedStringList[Language] = [] -- cgit v1.2.3