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>
This commit is contained in:
Gabe Black
2021-07-20 23:26:53 -07:00
parent 76cbc20a54
commit 611207eff0

View File

@@ -690,15 +690,12 @@ depends.sort(key = lambda x: x.name)
# Generate Python file containing a dict specifying the current
# buildEnv flags.
def makeDefinesPyFile(target, source, env):
build_env = source[0].get_contents().decode('utf-8')
code = code_formatter()
code("buildEnv = dict($build_env)")
code("buildEnv = $0", FromValue(source[0]))
code.write(target[0].abspath)
defines_info = Value(build_env)
# Generate a file with all of the compile options in it
env.Command('python/m5/defines.py', defines_info,
env.Command('python/m5/defines.py', ToValue(dict(build_env)),
MakeAction(makeDefinesPyFile, Transform("DEFINES", 0)))
PySource('m5', 'python/m5/defines.py')