Reviewed-by: Liming Gao <[email protected]>

> -----Original Message-----
> From: edk2-devel [mailto:[email protected]] On Behalf Of
> Yonghong Zhu
> Sent: Monday, July 04, 2016 5:27 PM
> To: [email protected]
> Cc: Gao, Liming <[email protected]>
> Subject: [edk2] [Patch] BaseTools: Add support for $(FAMILY) macro
> 
> Build spec mentions $(FAMILY) macro be used in DSC/FDF to specify the tool
> chain family, like GCC, MSFT. This patch add the support for this macro.
> 
> Cc: Liming Gao <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu <[email protected]>
> ---
>  BaseTools/Source/Python/build/build.py | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/BaseTools/Source/Python/build/build.py
> b/BaseTools/Source/Python/build/build.py
> index 4f859bf..d9afdcc 100644
> --- a/BaseTools/Source/Python/build/build.py
> +++ b/BaseTools/Source/Python/build/build.py
> @@ -784,10 +784,11 @@ class Build():
>              self.Db         = WorkspaceDatabase(":memory:")
>          else:
>              self.Db = WorkspaceDatabase(GlobalData.gDatabasePath,
> self.Reparse)
>          self.BuildDatabase = self.Db.BuildObject
>          self.Platform = None
> +        self.ToolChainFamily = None
>          self.LoadFixAddress = 0
>          self.UniFlag        = BuildOptions.Flag
>          self.BuildModules = []
>          self.Db_Flag = False
>          self.LaunchPrebuildFlag = False
> @@ -876,10 +877,21 @@ class Build():
>              EdkLogger.error("build", RESOURCE_NOT_AVAILABLE,
>                              ExtraData="[%s] not defined. No toolchain 
> available for
> build!\n" % ", ".join(self.ToolChainList))
>          else:
>              self.ToolChainList = NewToolChainList
> 
> +        ToolChainFamily = []
> +        ToolDefinition = self.ToolDef.ToolsDefTxtDatabase
> +        for Tool in self.ToolChainList:
> +            if TAB_TOD_DEFINES_FAMILY not in ToolDefinition or Tool not in
> ToolDefinition[TAB_TOD_DEFINES_FAMILY] \
> +               or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool]:
> +                EdkLogger.warn("No tool chain family found in configuration 
> for %s.
> Default to MSFT." % Tool)
> +                ToolChainFamily.append("MSFT")
> +            else:
> +
> ToolChainFamily.append(ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool])
> +        self.ToolChainFamily = ToolChainFamily
> +
>          if self.ThreadNumber == None:
>              self.ThreadNumber =
> self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_MAX_CONC
> URRENT_THREAD_NUMBER]
>              if self.ThreadNumber == '':
>                  self.ThreadNumber = 0
>              else:
> @@ -934,10 +946,12 @@ class Build():
>          if self.ArchList:
>              GlobalData.gGlobalDefines['ARCH'] = self.ArchList[0]
>          if self.ToolChainList:
>              GlobalData.gGlobalDefines['TOOLCHAIN'] = self.ToolChainList[0]
>              GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = 
> self.ToolChainList[0]
> +        if self.ToolChainFamily:
> +            GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[0]
>          if 'PREBUILD' in GlobalData.gCommandLineDefines.keys():
>              self.Prebuild   = GlobalData.gCommandLineDefines.get('PREBUILD')
>          else:
>              self.Db.InitDatabase()
>              self.Db_Flag = True
> @@ -1597,13 +1611,16 @@ class Build():
>      #
>      def _BuildPlatform(self):
>          SaveFileOnChange(self.PlatformBuildPath, '# DO NOT EDIT \n# FILE
> auto-generated\n', False)
>          for BuildTarget in self.BuildTargetList:
>              GlobalData.gGlobalDefines['TARGET'] = BuildTarget
> +            index = 0
>              for ToolChain in self.ToolChainList:
>                  GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain
>                  GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain
> +                GlobalData.gGlobalDefines['FAMILY'] = 
> self.ToolChainFamily[index]
> +                index += 1
>                  Wa = WorkspaceAutoGen(
>                          self.WorkspaceDir,
>                          self.PlatformFile,
>                          BuildTarget,
>                          ToolChain,
> @@ -1677,13 +1694,16 @@ class Build():
>      ## Build active module for different build targets, different tool 
> chains and
> different archs
>      #
>      def _BuildModule(self):
>          for BuildTarget in self.BuildTargetList:
>              GlobalData.gGlobalDefines['TARGET'] = BuildTarget
> +            index = 0
>              for ToolChain in self.ToolChainList:
>                  GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain
>                  GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain
> +                GlobalData.gGlobalDefines['FAMILY'] = 
> self.ToolChainFamily[index]
> +                index += 1
>                  #
>                  # module build needs platform build information, so get 
> platform
>                  # AutoGen first
>                  #
>                  Wa = WorkspaceAutoGen(
> @@ -1771,13 +1791,16 @@ class Build():
>      #
>      def _MultiThreadBuildPlatform(self):
>          SaveFileOnChange(self.PlatformBuildPath, '# DO NOT EDIT \n# FILE
> auto-generated\n', False)
>          for BuildTarget in self.BuildTargetList:
>              GlobalData.gGlobalDefines['TARGET'] = BuildTarget
> +            index = 0
>              for ToolChain in self.ToolChainList:
>                  GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain
>                  GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain
> +                GlobalData.gGlobalDefines['FAMILY'] = 
> self.ToolChainFamily[index]
> +                index += 1
>                  Wa = WorkspaceAutoGen(
>                          self.WorkspaceDir,
>                          self.PlatformFile,
>                          BuildTarget,
>                          ToolChain,
> --
> 2.6.1.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to