Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/5984
Change subject: scons: Break make_obj into make_static and make_shared
functions.
......................................................................
scons: Break make_obj into make_static and make_shared functions.
The make_obj function took a boolean value which just selected which
of the two lines it in would actually do something. This change breaks
it into two lambdas, make_static and make_shared, which just do
whichever line would have been requested, making the funciton name more
self descriptive and getting rid of the generally unnamed and opaque
boolean argument.
Change-Id: I457e40034b7e7f5a3e7294a8e1f15bbd42e0720e
---
M src/SConscript
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/src/SConscript b/src/SConscript
index 61af95b..28ae354 100755
--- a/src/SConscript
+++ b/src/SConscript
@@ -951,12 +951,8 @@
new_env.Label = label
new_env.Append(**kwargs)
- def make_obj(source, static):
- '''This function creates a scons node of the requested type.'''
- if static:
- return new_env.StaticObject(source.tnode)
- else:
- return new_env.SharedObject(source.tnode)
+ make_static = lambda source: new_env.StaticObject(source.tnode)
+ make_shared = lambda source: new_env.SharedObject(source.tnode)
lib_sources = Source.all.with_tag('gem5 lib')
@@ -969,8 +965,8 @@
shared_objs = []
for s in lib_sources.with_tag(Source.ungrouped_tag):
- static_objs.append(make_obj(s, True))
- shared_objs.append(make_obj(s, False))
+ static_objs.append(make_static(s))
+ shared_objs.append(make_shared(s))
partial_objs = []
@@ -983,29 +979,29 @@
# directly, and short circuit this loop.
if disable_partial:
for s in srcs:
- static_objs.append(make_obj(s, True))
- shared_objs.append(make_obj(s, False))
+ static_objs.append(make_static(s))
+ shared_objs.append(make_shared(s))
continue
# Set up the static partially linked objects.
- source_objs = [ make_obj(s, True) for s in srcs ]
+ source_objs = [ make_static(s) for s in srcs ]
file_name = new_env.subst("${OBJPREFIX}lib${OBJSUFFIX}.partial")
target = File(joinpath(group, file_name))
partial = env.PartialStatic(target=target, source=source_objs)
static_objs.append(partial)
# Set up the shared partially linked objects.
- source_objs = [ make_obj(s, False) for s in srcs ]
+ source_objs = [ make_shared(s) for s in srcs ]
file_name =
new_env.subst("${SHOBJPREFIX}lib${SHOBJSUFFIX}.partial")
target = File(joinpath(group, file_name))
partial = env.PartialShared(target=target, source=source_objs)
shared_objs.append(partial)
- static_date = make_obj(date_source, static=True)
+ static_date = make_static(date_source)
new_env.Depends(static_date, static_objs)
static_objs.append(static_date)
- shared_date = make_obj(date_source, static=False)
+ shared_date = make_shared(date_source)
new_env.Depends(shared_date, shared_objs)
shared_objs.append(shared_date)
@@ -1015,11 +1011,11 @@
shared_lib = new_env.SharedLibrary(libname, shared_objs)
# Now link a stub with main() and the static library.
- main_objs = [ make_obj(s, True) for s in Source.all.with_tag('main') ]
+ main_objs = [ make_static(s) for s in Source.all.with_tag('main') ]
for test in UnitTest.all:
test_sources = Source.all.with_tag(str(test.target))
- test_objs = [ make_obj(s, static=True) for s in test_sources ]
+ test_objs = [ make_static(s) for s in test_sources ]
if test.main:
test_objs += main_objs
path = 'unittest/%s.%s' % (test.target, label)
--
To view, visit https://gem5-review.googlesource.com/5984
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I457e40034b7e7f5a3e7294a8e1f15bbd42e0720e
Gerrit-Change-Number: 5984
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev