Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/40968 )

Change subject: scons: Move MakeAction into gem5_scons.
......................................................................

scons: Move MakeAction into gem5_scons.

That will make it usable from builders defined outside of SConstruct.

Change-Id: Id1231a1a370b7d519a382db892ded93c604eb56f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40968
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travagl...@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travagl...@arm.com>
---
M SConstruct
M site_scons/gem5_scons/__init__.py
2 files changed, 30 insertions(+), 22 deletions(-)

Approvals:
  Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/SConstruct b/SConstruct
index d235414..3e2df39 100755
--- a/SConstruct
+++ b/SConstruct
@@ -122,15 +122,20 @@

 from gem5_scons import Transform, error, warning, summarize_warnings
 from gem5_scons import TempFileSpawn, parse_build_path, EnvDefaults
+from gem5_scons import MakeAction, MakeActionTool
 import gem5_scons

+Export('MakeAction')
+
 ########################################################################
 #
 # Set up the main build environment.
 #
 ########################################################################

-main = Environment(tools=['default', 'git', TempFileSpawn, EnvDefaults])
+main = Environment(tools=[
+        'default', 'git', TempFileSpawn, EnvDefaults, MakeActionTool
+    ])

 main.Tool(SCons.Tool.FindTool(['gcc', 'clang'], main))
 main.Tool(SCons.Tool.FindTool(['g++', 'clang++'], main))
@@ -256,23 +261,6 @@
 # Add shared top-level headers
 main.Prepend(CPPPATH=Dir('include'))

-if GetOption('verbose'):
-    def MakeAction(action, string, *args, **kwargs):
-        return Action(action, *args, **kwargs)
-else:
-    MakeAction = Action
-    main['CCCOMSTR']        = Transform("CC")
-    main['CXXCOMSTR']       = Transform("CXX")
-    main['ASCOMSTR']        = Transform("AS")
-    main['ARCOMSTR']        = Transform("AR", 0)
-    main['LINKCOMSTR']      = Transform("LINK", 0)
-    main['SHLINKCOMSTR']    = Transform("SHLINK", 0)
-    main['RANLIBCOMSTR']    = Transform("RANLIB", 0)
-    main['M4COMSTR']        = Transform("M4")
-    main['SHCCCOMSTR']      = Transform("SHCC")
-    main['SHCXXCOMSTR']     = Transform("SHCXX")
-Export('MakeAction')
-
 # Initialize the Link-Time Optimization (LTO) flags
 main['LTO_CCFLAGS'] = []
 main['LTO_LDFLAGS'] = []
diff --git a/site_scons/gem5_scons/__init__.py b/site_scons/gem5_scons/__init__.py
index ae407fb..91764b0 100644
--- a/site_scons/gem5_scons/__init__.py
+++ b/site_scons/gem5_scons/__init__.py
@@ -238,7 +238,27 @@

     return os.path.join('/', *path_dirs), variant_dir

-__all__ = [
-        'Configure', 'EnvDefaults', 'Transform', 'warning', 'error',
-        'parse_build_dir'
-]
+# The MakeAction wrapper, and a SCons tool to set up the *COMSTR variables.
+if SCons.Script.GetOption('verbose'):
+    def MakeAction(action, string, *args, **kwargs):
+        return SCons.Script.Action(action, *args, **kwargs)
+
+    def MakeActionTool(env):
+        pass
+else:
+    MakeAction = SCons.Script.Action
+
+    def MakeActionTool(env):
+        env['CCCOMSTR']        = Transform("CC")
+        env['CXXCOMSTR']       = Transform("CXX")
+        env['ASCOMSTR']        = Transform("AS")
+        env['ARCOMSTR']        = Transform("AR", 0)
+        env['LINKCOMSTR']      = Transform("LINK", 0)
+        env['SHLINKCOMSTR']    = Transform("SHLINK", 0)
+        env['RANLIBCOMSTR']    = Transform("RANLIB", 0)
+        env['M4COMSTR']        = Transform("M4")
+        env['SHCCCOMSTR']      = Transform("SHCC")
+        env['SHCXXCOMSTR']     = Transform("SHCXX")
+
+__all__ = ['Configure', 'EnvDefaults', 'Transform', 'warning', 'error',
+           'MakeAction', 'MakeActionTool']



14 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40968
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id1231a1a370b7d519a382db892ded93c604eb56f
Gerrit-Change-Number: 40968
Gerrit-PatchSet: 18
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to