937,938c937,943
< def make_objs(sources, env):
< objs = [env.Object(s) for s in sources]
---
> def make_objs(sources, env, static):
> if static:
> XObject = env.StaticObject
> else:
> XObject = env.SharedObject
>
> objs = [ XObject(s) for s in sources ]
942c947
< date_obj = env.Object('base/date.cc')
---
> date_obj = XObject('base/date.cc')
947c952
< pinfo_obj = env.Object('base/program_info.cc')
---
> pinfo_obj = XObject('base/program_info.cc')
951c956
< objs.extend([date_obj,pinfo_obj])
---
> objs.extend([date_obj, pinfo_obj])
959,961c964,967
< newEnv = env.Copy(OBJSUFFIX=objsfx)
< newEnv.Label = label
< newEnv.Append(**kwargs)
---
> # SCons doesn't know to append a library suffix when there is a '.' in the
> # name. Use '_' instead.
> libname = 'm5_' + label
> exename = 'm5.' + label
963c969,973
< swig_env = newEnv.Copy()
---
> new_env = env.Copy(OBJSUFFIX=objsfx, SHOBJSUFFIX=objsfx + 's')
> new_env.Label = label
> new_env.Append(**kwargs)
>
> swig_env = new_env.Copy()
968d977
< swig_objs = [ swig_env.Object(s) for s in cc_swig_sources ]
969a979,983
> static_objs = make_objs(cc_lib_sources, new_env, static=True)
> shared_objs = make_objs(cc_lib_sources, new_env, static=False)
> static_objs += [ swig_env.StaticObject(s) for s in cc_swig_sources ]
> shared_objs += [ swig_env.SharedObject(s) for s in cc_swig_sources ]
>
972,974c986,987
< #
< # SCons doesn't know to append a library suffix when there is a '.' in the
< # name. Use '_' instead.
---
> static_lib = new_env.StaticLibrary(libname, static_objs + static_objs)
> shared_lib = new_env.SharedLibrary(libname, shared_objs + shared_objs)
976,978d988
< m5lib = newEnv.Library('m5_' + label,
< make_objs(cc_lib_sources, newEnv) + swig_objs)
<
980,981c990,991
< objs = [ newEnv.StaticObject(s) for s in sources ]
< newEnv.Program("unittest/%s.%s" % (target, label), objs + m5lib)
---
> objs = [ new_env.StaticObject(s) for s in sources ]
> new_env.Program("unittest/%s.%s" % (target, label), objs + static_lib)
983,985c993,994
< # Now link a stub with main() and the library.
< exe = 'm5.' + label # final executable
< objects = [newEnv.Object(s) for s in cc_bin_sources] + m5lib
---
> # Now link a stub with main() and the static library.
> objects = [new_env.Object(s) for s in cc_bin_sources] + static_lib
987,988c996,997
< unstripped_exe = exe + '.unstripped'
< newEnv.Program(unstripped_exe, objects)
---
> unstripped_exe = exename + '.unstripped'
> new_env.Program(unstripped_exe, objects)
993c1002
< targets = newEnv.Command(exe, unstripped_exe, cmd)
---
> targets = new_env.Command(exename, unstripped_exe, cmd)
995c1004
< targets = newEnv.Program(exe, objects)
---
> targets = new_env.Program(exename, objects)
997,998c1006,1007
< newEnv.M5Binary = targets[0]
< envList.append(newEnv)
---
> new_env.M5Binary = targets[0]
> envList.append(new_env)