Commit Graph

326 Commits

Author SHA1 Message Date
Gabe Black
473d3c72c8 scons: Clone the gem5py_env environment in src/SConscript.
This will avoid cross contamination between variants, where the gem5py
executable from one variant is used by another variant, potentially
crashing SCons on a clean build.

Change-Id: I6c1741d431892ff11c2e05a6beb5e87c2b0d67eb
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51087
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-09-29 23:55:35 +00:00
Gabe Black
84abf07777 scons: Pull the rest of the embedPyFile function into marshal.py.
This further unburdens src/SConscript, and makes marshal.py a mostly
self contained implementation of that build step.

Change-Id: I4eb9da40de56feec9ab32c384aa5730be70ae498
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49399
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-09-24 21:24:06 +00:00
Gabe Black
64c9e07498 scons: Pull bytesToCppArray into build_tools.
This mechanism will be used by various small scripts which perform steps
of the build.

Change-Id: I91d842c022d6f568715e8a10310894cb8afbab20
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49398
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-09-24 21:23:52 +00:00
Gabe Black
cc75a47b84 python,scons: Move grammar.py and code_formatter.py into build_tools.
These are only used in a build, and so don't need to be built into gem5.
grammar.py is used by slicc and the fast model project file parser, and
code_formatter.py is only used by SConscripts.

Change-Id: Id43e62459d69f07fdb2ed125548a83e38bbb7590
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49396
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-09-24 21:23:27 +00:00
Gabe Black
6cc3b4f6c1 scons,python: Move the marshal.py script into build_tools.
It's really a part of the build system and not part of gem5, and so it
should probably live outside of the main tree. It would be confusing to
have a bunch of python scripts which don't end up inside gem5 alongside
a bunch of ones that do in src/python.

The directory is called build_tools instead of build so it doesn't get
confused with an actual build output directory.

Change-Id: Ie12475a15517508dc2044f0ca4db71a601b7ab6d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49393
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-09-24 21:23:11 +00:00
Gabe Black
dfec508976 scons,python: Split the marshal binary into a c++ wrapper and script.
The new c++ wrapper is called gem5py, and will run any python script
using gem5's embedded python interpreter. The "marshal" functionality is
split out into a separate python script gem5py can run.

The command line for gem5py should look like this:

gem5py ${SCRIPT TO RUN} ${ARGS TO THE SCRIPT}

So, for instance, to marshal a file called foo.py, the command line
might look like this:

gem5py python/marshal.py foo.py

Also, this change reorders the sources for the python embedding action
and limits the max_sources for Transform() to 1, so that it just shows
the python file being embedded and not gem5py or the marshal.py script.
Those are still sources so dependency tracking works correctly, but they
are also implied and just add visual noise to the build output.

Change-Id: I7ae6bd114973ae44c3b634884b6dafc6577e0788
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49392
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-09-24 18:49:53 +00:00
Gabe Black
b0f960f765 scons: Get rid of a loop which touched all the param ptype attributes.
As far as I can tell, this code is left over from when gem5 used SWIG,
and is not necessary any more.

Change-Id: Id36887773d2fc1373ffe689ee1b50b4989bf5a38
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49390
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
2021-09-16 20:39:30 +00:00
Gabe Black
977b9d7521 scons: Use source filters to exclude python source if --without-python.
We were simply not declaring the source files for PySource files if
built --without-python. Instead, we should declare them, but then
explicitly exclude them if that option is set.

Since we're already doing that, we can simply remove the check from the
PySource constructor.

Change-Id: I437ebeee1082fa00065bedd61f91d5721b915ae5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49389
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
2021-09-16 20:39:30 +00:00
Gabe Black
6bbaceca91 scons: Simplify the PySource class slightly.
Demote the cpp attribute to a local variable, and get rid of the unused
"package" attribute.

Change-Id: I190792274ea9bdd9853aa3b6e07ce4151b378251
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49388
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
2021-09-16 20:39:30 +00:00
Gabe Black
0b06c55520 scons: Eliminate the tnode dict in PySource.
Rather than pass these values to the embedPyFile function indirectly
through python, we should pass them through the environment so SCons can
know about them, and also to simplify the PySource class.

Change-Id: I466613c194bfd965a6f5f34e1e92131834fb8b66
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49387
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
2021-09-16 20:39:30 +00:00
Gabe Black
ec931a6413 scons: Declare PySource Source files in the PySource __init__.
There's no reason to wait until the end to loop over all PySource files
and declare their Source-s then.

Change-Id: I94de1b2123bb94324a647bbc005a923012080cab
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49386
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
2021-09-16 00:55:11 +00:00
Gabe Black
6a36839da5 scons: Create a namedtuple for debug flag info.
This avoids having to rely on certain bits of information being in
certain positions, and also makes it more obvious which piece of
information you're referring to when manipulating the objects.

Change-Id: I93799d00261002996a42a62a7de34c4c275847c5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49385
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
2021-09-16 00:55:11 +00:00
Gabe Black
7a133da281 scons: Simplify the makeDebugFlagCC python function.
Change-Id: I3fdbdc5a4f2b45153550c65e0d447a3d6cec34f1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49384
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
2021-09-16 00:55:11 +00:00
Gabe Black
93339d7057 scons: Accumulate debug flags in a construction variable.
Do this instead of putting them in a dictionary side channel.

Change-Id: I52319f2d42c87ef8e7861e7dc700ba45b8e1629e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49383
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
2021-09-15 20:17:23 +00:00
Gabe Black
611207eff0 scons: Clean up the definition of m5.defines a little bit.
Use the new helper functions to go to/from a Value(), and tidy things up
slightly.

Change-Id: I9a31004b5a610bb8e94848d1fb88606dda6fc3c2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48381
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
2021-09-15 20:16:58 +00:00
Gabe Black
a2c42a12b1 scons,python: Stop importing some values in m5.defines.
The compileDate and gem5Version fields are used in only one place,
gem5's python main function. These fields are the remaining difference
between the "fake" defines.py provided by the SimObject importer, and
the real one composed later. It makes sense to exclude them in the
"fake" version since those values come from c++, but it would feel like
an arbitrary and unexpected difference to people trying to use it.

Change-Id: Ie344765bf7c8063197da24f5b55f762379deff94
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48380
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
2021-09-15 04:18:26 +00:00
Gabe Black
ad1f240a12 scons: Eliminate flag_* entries from m5.defines.
These are not used anywhere, and are very old.

Change-Id: If37a8fe2e0c3374fba1930353e502746f333d86d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48379
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
2021-09-15 04:18:26 +00:00
Gabe Black
8e28a06f11 scons: Pull the "Blob" builder out of src/SConscript.
Change-Id: Ib52c7b51d52aeccdcd2ca05cb0a71267268d969d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48378
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
2021-09-15 04:18:26 +00:00
Gabe Black
88a932522d scons: Move the bytesToCppArray helper to gem5_scons.util.
Change-Id: Ib8789dd33ebbfb8e10446de5d1079654a2200d2d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48377
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
2021-09-15 04:18:26 +00:00
Gabe Black
b61f539f05 scons: Move the source related helper classes out of src/SConscript.
By having them in gem5_scons.sources, they can be used by mechanisms
outside of src/SConscript, like separated out builders.

Change-Id: Ic3769723c8413e7db48aef536572ad3f2f948658
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48376
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
2021-09-14 23:26:49 +00:00
Gabe Black
38d3c5f4be scons: Build the source filter factories dict in SourceFilter.
This is a little cleaner since it avoids an additional global variable.

Change-Id: I19d9a0afd12fdfeeda0b524bd71943d155ed5d7d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48375
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
2021-09-14 23:26:31 +00:00
Gabe Black
4b86614d31 scons: Tidy up the definition of SourceFile slightly.
Use {} notation for creating a set, and rely on the fact that applying
File() to something that already is does nothing.

Change-Id: I2ec99e4a4859df9a0a88bcc38e93233841124de6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48373
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
2021-09-14 22:12:25 +00:00
Gabe Black
d73e4b789e scons: Define the rules for building debug flag hdrs in place.
Define the rules for building debug flag header files in place, instead
of looping over them all after they've been accumulated.

Change-Id: I02113a21529958c3f971b5462ea340d70d1b18d7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48372
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
2021-09-14 22:12:25 +00:00
Gabe Black
98b50f3f2b scons: Generalize the Executable class to cover libraries too.
This way the shared and static gem5 libraries can be treated like other
top level build targets.

Change-Id: I04dd82f9be86df0a5cabd2e4934077c33235911c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48369
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
2021-09-14 22:12:25 +00:00
Gabe Black
f4d8200178 scons: Pull some python related mechanisms out of USE_PYTHON guards.
We don't want to build certain files if USE_PYTHON is disabled, but we
can still tell scons how to.

Change-Id: I38c7c93f609cfcedc350f8270f0b239b69c4f101
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48367
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
2021-09-10 04:19:24 +00:00
Gabe Black
e20e3cf47e scons: Change how the test object file suffix is applied.
This had been done by prepending the letter "t" to the suffix, with the
intention of turning a suffix like ".o" to ".to". Unfortunately SCons
stores both the actual suffix and the "." in that variable, so what we
ended up with was ".o" => "t.o", so test.o would become testt.o.

This change updates that logic to prepend a ".t" in front of the
existing suffix, skipping over it's first character which is assumed to
be a ".".

Change-Id: Id8c5f893413284868c2dc2a1a5e879b86790ed76
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50067
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-09-10 04:19:24 +00:00
Gabe Black
77a0372fe9 scons,debug: Implement the "All" flag in C++ and not scons.
Create an AllFlagsFlag class which inherits from the CompoundFlag class.
This class is a singleton, and the SimpleFlags install themselves in it
instead of having SCons collect them.

The allFlagsVersion global variable was supposed to be for debugging
according to a comment, but was actually an important part of the "All"
flags inner workings. It was not exposed in the header, but was
redefined/pulled through in src/python/pybind11/debug.cc. The
AllFlagsFlag class now tracks that value, and it can be accessed without
reaching behind the curtain.

This also somewhat decentralizes the debug flag building process in
SCons. The debug/flags.cc still includes all flags at once which
centralizes them, but at least now the "All" flag won't also.

Change-Id: I8430e0fe9022846aade028fb46c80777169a2007
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48370
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Nathanael Premillieu <nathanael.premillieu@huawei.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2021-09-05 17:13:53 +00:00
Gabe Black
269258831e scons: Eliminate the "Arch" enum.
This is not the one from the object file loader, it's another one which
was only used by the System class. That use has been eliminated, so this
enum can be as well.

Change-Id: I476d7c1ef1bc1e34cbf904fc33c6735038e999c9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48712
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
2021-09-05 17:12:48 +00:00
Gabe Black
1253c15ebe scons,python,sim: Eliminate a redundant member of EmbeddedPython.
The filename member was just a less specific version of the abspath
member, and can be replaced by it to simplify things a little.

Change-Id: I61b312f2c356045e03462159e3232ac717954669
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48365
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
2021-09-05 04:22:26 +00:00
Gabe Black
9db4c91510 scons: Update the special module importer API.
In the SConscript, there is a special importer which enables importing
embedded code using various m5.* paths. This was implemented using an
API which has been deprecated and replaced in more recent versions of
python.

Change-Id: I5900f269af48befbcedcb9d25353f04f6297ce9d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48363
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
2021-09-05 04:21:28 +00:00
Gabe Black
ab6a7a0bab scons: Get rid of some unused or unnecessary PySource members.
These were either not used at all, or were unnecessary since they, for
instance, were used to name a variable in an anonymous namespace where
the actual name is hidden and largely irrelevant.

Change-Id: I738960cf0d84017ccc133428aef56701c1d40b03
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48139
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-31 23:46:00 +00:00
Gabe Black
8b3565d507 scons: Stop caching the first version of object files.
Don't cache the first version requested of object files to use for
subsequent requests. This was originally put in place to avoid an error
when object files could be built with trivially different command lines,
ie command lines which are technically different but not in a
necessarily meaningful way, or less seriously a warning when the command
lines were the same.

The warning was disabled in an earlier change, and the error was avoided
by using a different object file suffix when building unit tests.

This helps avoid bugs if the object files actually *would* turn out to
be different in a meaningful way based on the flags used, and simplifies
the build.

Change-Id: I6b90e6e36b13adb73e587bb8fc533984f764d95a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48138
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-28 12:25:41 +00:00
Gabe Black
8317146103 scons: Get rid of special handling of the _m5 package.
This package is handled specially by the DictImporter used during the
build, and an assert shows that that code is never actually used. That
makes sense, since _m5 won't be added to gem5 using the PySource
mechanism.

Change-Id: I36a39f1ebb94a7620c8ba296e0fe856bd33285f9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48362
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-08-28 04:20:43 +00:00
Gabe Black
9fa9840691 scons: Turn the Blob method into a builder.
Build the blob .cc and .hh files in the same directory as the file
they're based off of. Move the GDB XML files into the arch directories
they go with.

Change-Id: I12fe48873312c3aba5910989d6e3049ebd5e5bbf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48136
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-28 04:19:40 +00:00
Gabe Black
4a20df608e scons: Use a different suffix for test object files.
These files are built with a different command line, and so should be
distinct build artifacts in the build directory.

Change-Id: Iec9403ad73fbdbcb1cd268d68716c3aa85a80b24
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48137
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
2021-08-25 14:35:47 +00:00
Gabe Black
3094d42113 scons: Factor out the core of blobToCpp.
blobToCpp is called in two places, one which uses all its functionality,
and one which disables most of it. Instead, factor out the small core so
that it can be called directly by the call sight which uses only that
part, and blobToCpp itself.

This change also removes the ability to leave out a namespace or header
file code formatter, since the function is not called that way any more.
That simplifies blobToCpp significantly.

Change-Id: I63139311521bb4f9287fe41ff51e4e5301a18349
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48135
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-25 14:35:02 +00:00
Gabe Black
c0353b3dc8 scons: Get rid of a redundant import of code_formatter.
This module was already imported at the top of the SConscript.

Change-Id: I1357beda2adcc085c122df15397c769694a73fab
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48361
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
2021-08-21 00:58:43 +00:00
Gabe Black
b9b1de76d5 scons: Turn the ProtoBuf and GrpcProtoBuf classes into methods.
These now instantiate Builders for the protobuf .cc and .h files of the
right flavors, and install the .cc files as sources.

Also, this sets up the builder for .cc files so that it will know how to
build those files from .proto using the protobuf compiler. This is
optional, but will make it possible to pass .proto files in place of .cc
files or even object files as sources for other builders, and for scons
to figure out what chain of rules to use to get the desired results.

This is a step towards handing over more responsibility to scons and
eliminating at least some of our bespoke build code.

Change-Id: I7188a0917e999ad9148f7079830b2c26bcd563db
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48134
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-14 14:54:16 +00:00
Gabe Black
8419df8adb scons: Delay evaluating the EXE_SUFFIX and ENV_LABEL values.
Delay evaluating these so that hopefully the same rules can be reused
between environments.

Change-Id: I4918d3a1a98f49ecad8ab6a8b89898c14316f6f5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48132
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-14 14:54:16 +00:00
Gabe Black
0c6f38119d scons: Build up different environments for different binaries.
Rather than collect parameters describing what environments to use for
each binary, build up the environments themselves and skip the middle
man.

Change-Id: I57ff03a3522708396149b7d053dac014477859a7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48131
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-14 14:54:16 +00:00
Gabe Black
b7aebc1220 scons: Further simplify the_gpu_isa.hh.
Turn the "namespace" function into a simple variable. Also, since the
only thing defined in the file is a macro, we can drop the compiler
guards and use that macro as its own compiler guard.

Change-Id: I1e8559fc7add61105b2990f76226714ba282581d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48967
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
2021-08-07 03:12:56 +00:00
Gabe Black
774f801589 scons: Remove cruft from the_gpu_isa.hh.
Some values in the_gpu_isa.hh were simply copy/pasted from the_isa.hh,
and were not used at all in the code. This change removes them, leaving
only the definition of the TheGpuISA namespace.

Change-Id: I0d66ae84d78e990088eb8099c678b9cf1cc42748
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48966
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
2021-08-07 03:12:56 +00:00
Gabe Black
64168fd4ea scons: Turn the ISA and GPU ISA lists into construction variables.
Change-Id: I4135709f5bceee959b5178a4700656aa782b1d6b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48965
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
2021-08-07 03:12:56 +00:00
Gabe Black
2f053f1bc5 scons: Use a loop to build binary flavors.
Track structured data related to different binary flavors (opt, debug,
etc), using a class instead of various lists, etc. Also use a loop to
set up SCons environments to build these binaries instead of a spelled
out loop.

Change-Id: Ie35a914ab79342190e4cdc27a945a0fecd54a476
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48130
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-08-06 15:59:44 +00:00
Gabe Black
6811158b28 scons: Use sets instead of lists to track needed target environments.
This simple change intrinsically collapses away duplicates.

Change-Id: I697c21897a81c47cbf540caa49806413dce80dba
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48129
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-06 10:50:06 +00:00
Gabe Black
9278d7eda4 scons: Remove the unused env.Label assignment in makeEnv.
Change-Id: I33fe01bb0381061528c450bc5e8312b52882615e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48128
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-06 10:49:59 +00:00
Gabe Black
1a8a3864cd scons: Use Dir().Dir() and not os.path to extend CPPPATH.
Since we're already working with Dir nodes, they can figure out
appending to a path themselves without using os.path.join.

Change-Id: Ib46946d7ec181dbbf443f957f23196eb0fd7f6b5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48127
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-06 10:49:52 +00:00
Gabe Black
1c7f63c84a scons: Use the os.path prefix when using components of that module.
That makes it obvious where the methods involved are coming from. Also
some of the imported names weren't being used.

Change-Id: I6ec75eef1e5ea9eae51e7df675e477dccb351bd1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48126
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-06 04:42:20 +00:00
Gabe Black
0eab559913 scons: Delete the comparison operators from SourceFile.
These are apparently not used and can be deleted.

Change-Id: I201d565d2e0207e0f43e94bbbb43ec03c2b695ab
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48125
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-06 04:42:07 +00:00
Gabe Black
a74fe97ac9 scons: Eliminate the SourceFile.basename property.
This value is used in only two places, and can be calculated in place to
avoid complexity.

Change-Id: I1e59b92521250b3f5a3e2cba599236ededf1761d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48124
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-08-06 04:41:56 +00:00