BUILDRULEFAMILY supports BuildOptions in INF and DSC.
authorlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Tue, 21 Jul 2009 10:15:37 +0000 (10:15 +0000)
committerlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Tue, 21 Jul 2009 10:15:37 +0000 (10:15 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1664 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/AutoGen/AutoGen.py

index 86f33fb..a3383ae 100755 (executable)
@@ -1061,12 +1061,45 @@ class PlatformAutoGen(AutoGen):
     #
     def _ExpandBuildOption(self, Options):
         BuildOptions = {}
+        FamilyMatch  = False
+        for Key in Options:
+            Family = Key[0]
+            Target, Tag, Arch, Tool, Attr = Key[1].split("_")
+            if Tool not in self.ToolDefinition:
+                continue
+            # if tool chain family doesn't match, skip it
+            if Family != "":
+                FamilyIsNull = False
+                if self.ToolDefinition[Tool][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 Family and Tool in self.ToolDefinition and Family != self.ToolDefinition[Tool]["FAMILY"]:
+            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: