Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/40972 )

Change subject: scons: Update comments in SConstruct.
......................................................................

scons: Update comments in SConstruct.

Make them consistently styled, gramatically and factually correct, and
try to make sure they're reasonably clear.

Change-Id: I3566734b0ac386113ef45ac7fd24c9fb1f2007d3
---
M SConstruct
1 file changed, 69 insertions(+), 32 deletions(-)



diff --git a/SConstruct b/SConstruct
index 7397d03..adad0e9 100755
--- a/SConstruct
+++ b/SConstruct
@@ -47,7 +47,7 @@
 # While in this directory ('gem5'), just type 'scons' to build the default
 # configuration (see below), or type 'scons build/<CONFIG>/<binary>'
 # to build some other configuration (e.g., 'build/X86/gem5.opt' for
-# the optimized full-system version).
+# the optimized X86 version).
 #
 # You can build gem5 in a different directory as long as there is a
 # 'build/<CONFIG>' somewhere along the target path.  The build system
@@ -75,7 +75,7 @@
 #
 ###################################################

-# Global Python includes
+# Global Python imports
 import atexit
 import os
 import sys
@@ -85,13 +85,20 @@
 from os.path import isdir, isfile
 from os.path import join, split

-# SCons includes
+# SCons imports
 import SCons
 import SCons.Node
 import SCons.Node.FS

 from m5.util import compareVersions, readCommand, readCommandWithReturn

+
+########################################################################
+#
+# Command line options.
+#
+########################################################################
+
 AddOption('--no-colors', dest='use_colors', action='store_false',
           help="Don't add color to abbreviated scons output")
 AddOption('--with-cxx-config', action='store_true',
@@ -118,6 +125,8 @@
 AddOption('--with-systemc-tests', action='store_true',
           help='Build systemc tests')

+# Imports of gem5_scons happen here since it depends on some options which are
+# declared above.
 from gem5_scons import error, warning, summarize_warnings, parse_build_path
 from gem5_scons import EnvDefaults, MakeAction, MakeActionTool
 import gem5_scons
@@ -125,6 +134,7 @@

 Export('MakeAction')

+
 ########################################################################
 #
 # Set up the main build environment.
@@ -136,6 +146,8 @@
         ConfigFile, AddLocalRPATH, SwitchingHeaders,
     ])

+Export('main')
+
 from gem5_scons.util import get_termcap
 termcap = get_termcap()

@@ -143,15 +155,16 @@
 if not ('CC' in main and 'CXX' in main):
     error("No C++ compiler installed (package g++ on Ubuntu and RedHat)")

-###################################################
+# Find default configuration & binary.
+Default(environ.get('M5_DEFAULT_BINARY', 'build/ARM/gem5.debug'))
+
+
+########################################################################
 #
 # Figure out which configurations to set up based on the path(s) of
 # the target(s).
 #
-###################################################
-
-# Find default configuration & binary.
-Default(environ.get('M5_DEFAULT_BINARY', 'build/ARM/gem5.debug'))
+########################################################################

 # Take a list of paths (or SCons Nodes) and return a list with all
 # paths made absolute and ~-expanded.  Paths will be interpreted
@@ -193,14 +206,15 @@
     mkdir(build_root)
 main['BUILDROOT'] = build_root

-Export('main')
-
 main.SConsignFile(os.path.join(build_root, "sconsign"))

+
+########################################################################
 #
 # Set up global sticky variables... these are common to an entire build
 # tree (not specific to a particular build like X86)
 #
+########################################################################

 global_vars_file = os.path.join(build_root, 'variables.global')

@@ -233,6 +247,13 @@
 # Save sticky variable settings back to current variables file
 global_vars.Save(global_vars_file, main)

+
+########################################################################
+#
+# Set up various paths.
+#
+########################################################################
+
 # Parse EXTRAS variable to build list of all directories where we're
 # look for sources etc.  This list is exported as extras_dir_list.
 base_dir = Dir('#src').abspath
@@ -250,6 +271,14 @@
 # Add shared top-level headers
 main.Prepend(CPPPATH=Dir('include'))

+
+########################################################################
+#
+# Set command line options based on the configuration of the host and
+# build settings.
+#
+########################################################################
+
 # Initialize the Link-Time Optimization (LTO) flags
 main['LTO_CCFLAGS'] = []
 main['LTO_LDFLAGS'] = []
@@ -396,10 +425,6 @@
     # cygwin has some header file issues...
     main.Append(CCFLAGS=["-Wno-uninitialized"])

-
-main['HAVE_PKG_CONFIG'] = main.Detect('pkg-config')
-
-
 # We should compile a 64 bit binary on Mac OS X/Darwin
 if sys.platform == "darwin":
     main.Append(CCFLAGS=['-arch', 'x86_64'])
@@ -418,6 +443,13 @@
     if not conf.CheckLinkFlag('-gz'):
         warning("Can't enable executable debug section compression")

+
+########################################################################
+#
+# Detect and configure external dependencies.
+#
+########################################################################
+
 main['USE_PYTHON'] = not GetOption('without_python')
 if main['USE_PYTHON']:
     # Find Python include and library directories for embedding the
@@ -473,19 +505,18 @@
         warning('Embedded python library too new. '
                 'Python 3 expected, found %s.' % ver_string)

+main['HAVE_PKG_CONFIG'] = main.Detect('pkg-config')
+
 # On Solaris you need to use libsocket for socket ops
 if not conf.CheckLibWithHeader(
         [None, 'socket'], 'sys/socket.h', 'C++', 'accept(0,0,0);'):
    error("Can't find library with socket calls (e.g. accept()).")

-# Check for zlib.  If the check passes, libz will be automatically
-# added to the LIBS environment variable.
 if not conf.CheckLibWithHeader('z', 'zlib.h', 'C++','zlibVersion();'):
     error('Did not find needed zlib compression library '
           'and/or zlib.h header file.\n'
           'Please install zlib and try again.')

-
 if not GetOption('without_tcmalloc'):
     if conf.CheckLib('tcmalloc'):
         main.Append(CCFLAGS=main['TCMALLOC_CCFLAGS'])
@@ -496,17 +527,15 @@
                 "installing tcmalloc (libgoogle-perftools-dev package "
                 "on Ubuntu or RedHat).")

-
-######################################################################
-#
-# Finish the configuration
-#
 main = conf.Finish()

-######################################################################
+
+########################################################################
 #
-# Collect all non-global variables
+# Read and process SConsopts files. These can add new settings which
+# affect each variant directory independently.
 #
+########################################################################

# Register a callback which is called after all SConsopts files have been read.
 after_sconsopts_callbacks = []
@@ -525,8 +554,6 @@
 export_vars = []
 Export('export_vars')

-# For Ruby
-
 # Walk the tree and execute all SConsopts scripts that wil add to the
 # above variables
 if GetOption('verbose'):
@@ -540,13 +567,22 @@
                 print("Reading", os.path.join(root, 'SConsopts'))
             SConscript(os.path.join(root, 'SConsopts'))

+# Call any callbacks which the SConsopts files registered.
 for cb in after_sconsopts_callbacks:
     cb()

+# Add any generic sticky variables here.
 sticky_vars.Add(BoolVariable('USE_EFENCE',
     'Link with Electric Fence malloc debugger', False))

-# builds in ext are shared across all configs in the build root.
+
+########################################################################
+#
+# Find and process all the SConscript files in ext. These are shared by
+# all variants in a build root.
+#
+########################################################################
+
 ext_dir = Dir('#ext').abspath
 ext_build_dirs = []
 for root, dirs, files in os.walk(ext_dir):
@@ -559,11 +595,12 @@
 gdb_xml_dir = os.path.join(ext_dir, 'gdb-xml')
 Export('gdb_xml_dir')

-###################################################
+
+########################################################################
 #
-# Define build environments for selected configurations.
+# Define build environments for required variants.
 #
-###################################################
+########################################################################

 for variant_path in variant_paths:
     if not GetOption('silent'):
@@ -591,9 +628,9 @@
         # Things in ext are built without a variant directory.
         continue
     else:
-        # Build dir-specific variables file doesn't exist.
+        # Variant specific variables file doesn't exist.

-        # Make sure the directory is there so we can create it later
+        # Make sure the directory is there so we can create the file later.
         opt_dir = dirname(current_vars_file)
         if not isdir(opt_dir):
             mkdir(opt_dir)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40972
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: I3566734b0ac386113ef45ac7fd24c9fb1f2007d3
Gerrit-Change-Number: 40972
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to