SConscript (12306:25caccab1be4) SConscript (12307:cac42e5d3191)
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 937 unchanged lines hidden (view full) ---

946 libname = 'gem5_' + label
947 exename = 'gem5.' + label
948 secondary_exename = 'm5.' + label
949
950 new_env = env.Clone(OBJSUFFIX=objsfx, SHOBJSUFFIX=objsfx + 's')
951 new_env.Label = label
952 new_env.Append(**kwargs)
953
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 937 unchanged lines hidden (view full) ---

946 libname = 'gem5_' + label
947 exename = 'gem5.' + label
948 secondary_exename = 'm5.' + label
949
950 new_env = env.Clone(OBJSUFFIX=objsfx, SHOBJSUFFIX=objsfx + 's')
951 new_env.Label = label
952 new_env.Append(**kwargs)
953
954 def make_obj(source, static):
955 '''This function creates a scons node of the requested type.'''
956 if static:
957 return new_env.StaticObject(source.tnode)
958 else:
959 return new_env.SharedObject(source.tnode)
954 make_static = lambda source: new_env.StaticObject(source.tnode)
955 make_shared = lambda source: new_env.SharedObject(source.tnode)
960
961 lib_sources = Source.all.with_tag('gem5 lib')
962
963 # Without Python, leave out all Python content from the library
964 # builds. The option doesn't affect gem5 built as a program
965 if GetOption('without_python'):
966 lib_sources = lib_sources.without_tag('python')
967
968 static_objs = []
969 shared_objs = []
970
971 for s in lib_sources.with_tag(Source.ungrouped_tag):
956
957 lib_sources = Source.all.with_tag('gem5 lib')
958
959 # Without Python, leave out all Python content from the library
960 # builds. The option doesn't affect gem5 built as a program
961 if GetOption('without_python'):
962 lib_sources = lib_sources.without_tag('python')
963
964 static_objs = []
965 shared_objs = []
966
967 for s in lib_sources.with_tag(Source.ungrouped_tag):
972 static_objs.append(make_obj(s, True))
973 shared_objs.append(make_obj(s, False))
968 static_objs.append(make_static(s))
969 shared_objs.append(make_shared(s))
974
975 partial_objs = []
976
977 for group in Source.source_groups:
978 srcs = lib_sources.with_tag(Source.link_group_tag(group))
979 if not srcs:
980 continue
981
982 # If partial linking is disabled, add these sources to the build
983 # directly, and short circuit this loop.
984 if disable_partial:
985 for s in srcs:
970
971 partial_objs = []
972
973 for group in Source.source_groups:
974 srcs = lib_sources.with_tag(Source.link_group_tag(group))
975 if not srcs:
976 continue
977
978 # If partial linking is disabled, add these sources to the build
979 # directly, and short circuit this loop.
980 if disable_partial:
981 for s in srcs:
986 static_objs.append(make_obj(s, True))
987 shared_objs.append(make_obj(s, False))
982 static_objs.append(make_static(s))
983 shared_objs.append(make_shared(s))
988 continue
989
990 # Set up the static partially linked objects.
984 continue
985
986 # Set up the static partially linked objects.
991 source_objs = [ make_obj(s, True) for s in srcs ]
987 source_objs = [ make_static(s) for s in srcs ]
992 file_name = new_env.subst("${OBJPREFIX}lib${OBJSUFFIX}.partial")
993 target = File(joinpath(group, file_name))
994 partial = env.PartialStatic(target=target, source=source_objs)
995 static_objs.append(partial)
996
997 # Set up the shared partially linked objects.
988 file_name = new_env.subst("${OBJPREFIX}lib${OBJSUFFIX}.partial")
989 target = File(joinpath(group, file_name))
990 partial = env.PartialStatic(target=target, source=source_objs)
991 static_objs.append(partial)
992
993 # Set up the shared partially linked objects.
998 source_objs = [ make_obj(s, False) for s in srcs ]
994 source_objs = [ make_shared(s) for s in srcs ]
999 file_name = new_env.subst("${SHOBJPREFIX}lib${SHOBJSUFFIX}.partial")
1000 target = File(joinpath(group, file_name))
1001 partial = env.PartialShared(target=target, source=source_objs)
1002 shared_objs.append(partial)
1003
995 file_name = new_env.subst("${SHOBJPREFIX}lib${SHOBJSUFFIX}.partial")
996 target = File(joinpath(group, file_name))
997 partial = env.PartialShared(target=target, source=source_objs)
998 shared_objs.append(partial)
999
1004 static_date = make_obj(date_source, static=True)
1000 static_date = make_static(date_source)
1005 new_env.Depends(static_date, static_objs)
1006 static_objs.append(static_date)
1007
1001 new_env.Depends(static_date, static_objs)
1002 static_objs.append(static_date)
1003
1008 shared_date = make_obj(date_source, static=False)
1004 shared_date = make_shared(date_source)
1009 new_env.Depends(shared_date, shared_objs)
1010 shared_objs.append(shared_date)
1011
1012 # First make a library of everything but main() so other programs can
1013 # link against m5.
1014 static_lib = new_env.StaticLibrary(libname, static_objs)
1015 shared_lib = new_env.SharedLibrary(libname, shared_objs)
1016
1017 # Now link a stub with main() and the static library.
1005 new_env.Depends(shared_date, shared_objs)
1006 shared_objs.append(shared_date)
1007
1008 # First make a library of everything but main() so other programs can
1009 # link against m5.
1010 static_lib = new_env.StaticLibrary(libname, static_objs)
1011 shared_lib = new_env.SharedLibrary(libname, shared_objs)
1012
1013 # Now link a stub with main() and the static library.
1018 main_objs = [ make_obj(s, True) for s in Source.all.with_tag('main') ]
1014 main_objs = [ make_static(s) for s in Source.all.with_tag('main') ]
1019
1020 for test in UnitTest.all:
1021 test_sources = Source.all.with_tag(str(test.target))
1015
1016 for test in UnitTest.all:
1017 test_sources = Source.all.with_tag(str(test.target))
1022 test_objs = [ make_obj(s, static=True) for s in test_sources ]
1018 test_objs = [ make_static(s) for s in test_sources ]
1023 if test.main:
1024 test_objs += main_objs
1025 path = 'unittest/%s.%s' % (test.target, label)
1026 new_env.Program(path, test_objs + static_objs)
1027
1028 progname = exename
1029 if strip:
1030 progname += '.unstripped'

--- 123 unchanged lines hidden ---
1019 if test.main:
1020 test_objs += main_objs
1021 path = 'unittest/%s.%s' % (test.target, label)
1022 new_env.Program(path, test_objs + static_objs)
1023
1024 progname = exename
1025 if strip:
1026 progname += '.unstripped'

--- 123 unchanged lines hidden ---