summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/Python/AutoGen')
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py35
-rw-r--r--BaseTools/Source/Python/AutoGen/GenMake.py8
-rw-r--r--BaseTools/Source/Python/AutoGen/StrGather.py10
3 files changed, 49 insertions, 4 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 028c4e34e3..647e1d0052 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1061,12 +1061,45 @@ class PlatformAutoGen(AutoGen):
#
def _ExpandBuildOption(self, Options):
BuildOptions = {}
+ FamilyMatch = False
+ FamilyIsNull = True
for Key in Options:
Family = Key[0]
Target, Tag, Arch, Tool, Attr = Key[1].split("_")
# if tool chain family doesn't match, skip it
- if Family and Tool in self.ToolDefinition and Family != self.ToolDefinition[Tool]["FAMILY"]:
+ if Tool in self.ToolDefinition and Family != "":
+ FamilyIsNull = False
+ if self.ToolDefinition[Tool].get(TAB_TOD_DEFINES_BUILDRULEFAMILY, "") != "":
+ if Family != self.ToolDefinition[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]:
+ continue
+ elif Family != self.ToolDefinition[Tool][TAB_TOD_DEFINES_FAMILY]:
+ continue
+ FamilyMatch = True
+ # expand any wildcard
+ if Target == "*" or Target == self.BuildTarget:
+ if Tag == "*" or Tag == self.ToolChain:
+ if Arch == "*" or Arch == self.Arch:
+ if Tool not in BuildOptions:
+ BuildOptions[Tool] = {}
+ if Attr != "FLAGS" or Attr not in BuildOptions[Tool]:
+ BuildOptions[Tool][Attr] = Options[Key]
+ else:
+ # append options for the same tool
+ BuildOptions[Tool][Attr] += " " + Options[Key]
+ # Build Option Family has been checked, which need't to be checked again for family.
+ if FamilyMatch or FamilyIsNull:
+ return BuildOptions
+
+ for Key in Options:
+ Family = Key[0]
+ Target, Tag, Arch, Tool, Attr = Key[1].split("_")
+ # if tool chain family doesn't match, skip it
+ if Tool not in self.ToolDefinition or Family =="":
continue
+ # option has been added before
+ if Family != self.ToolDefinition[Tool][TAB_TOD_DEFINES_FAMILY]:
+ continue
+
# expand any wildcard
if Target == "*" or Target == self.BuildTarget:
if Tag == "*" or Tag == self.ToolChain:
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index f689a8692d..c5d8991e07 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1308,8 +1308,14 @@ ${END}\t@cd $(BUILD_DIR)\n
if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "":
FdfFileList = [PlatformInfo.FdfFile]
# macros passed to GenFds
+ # MacroList.append('"%s=%s"' % ("WORKSPACE", GlobalData.gWorkspace))
+ MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource))
+ MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource))
for MacroName in GlobalData.gGlobalDefines:
- MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName]))
+ if GlobalData.gGlobalDefines[MacroName] != "":
+ MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName]))
+ else:
+ MacroList.append('"%s"' % MacroName)
else:
FdfFileList = []
diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py b/BaseTools/Source/Python/AutoGen/StrGather.py
index e82ad3a10b..0f644445dc 100644
--- a/BaseTools/Source/Python/AutoGen/StrGather.py
+++ b/BaseTools/Source/Python/AutoGen/StrGather.py
@@ -171,9 +171,15 @@ def CreateHFileContent(BaseName, UniObjectClass):
if Name != None:
Line = ''
if Referenced == True:
- Line = DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4)
+ if (ValueStartPtr - len(DEFINE_STR + Name)) <= 0:
+ Line = DEFINE_STR + ' ' + Name + ' ' + DecToHexStr(Token, 4)
+ else:
+ Line = DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4)
else:
- Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
+ if (ValueStartPtr - len(DEFINE_STR + Name)) <= 0:
+ Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
+ else:
+ Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
Str = WriteLine(Str, Line)
Str = WriteLine(Str, '')