Deleted Added
sdiff udiff text old ( 5584:e08e65fd0f76 ) new ( 5601:1acb7016d0e4 )
full compact
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

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

929# List of constructed environments to pass back to SConstruct
930envList = []
931
932# This function adds the specified sources to the given build
933# environment, and returns a list of all the corresponding SCons
934# Object nodes (including an extra one for date.cc). We explicitly
935# add the Object nodes so we can set up special dependencies for
936# date.cc.
937def make_objs(sources, env, static):
938 if static:
939 XObject = env.StaticObject
940 else:
941 XObject = env.SharedObject
942
943 objs = [ XObject(s) for s in sources ]
944
945 # make date.cc depend on all other objects so it always gets
946 # recompiled whenever anything else does
947 date_obj = XObject('base/date.cc')
948
949 # Make the generation of program_info.cc dependend on all
950 # the other cc files and the compiling of program_info.cc
951 # dependent on all the objects but program_info.o
952 pinfo_obj = XObject('base/program_info.cc')
953 env.Depends('base/program_info.cc', sources)
954 env.Depends(date_obj, objs)
955 env.Depends(pinfo_obj, objs)
956 objs.extend([date_obj, pinfo_obj])
957 return objs
958
959# Function to create a new build environment as clone of current
960# environment 'env' with modified object suffix and optional stripped
961# binary. Additional keyword arguments are appended to corresponding
962# build environment vars.
963def makeEnv(label, objsfx, strip = False, **kwargs):
964 # SCons doesn't know to append a library suffix when there is a '.' in the
965 # name. Use '_' instead.
966 libname = 'm5_' + label
967 exename = 'm5.' + label
968
969 new_env = env.Copy(OBJSUFFIX=objsfx, SHOBJSUFFIX=objsfx + 's')
970 new_env.Label = label
971 new_env.Append(**kwargs)
972
973 swig_env = new_env.Copy()
974 if env['GCC']:
975 swig_env.Append(CCFLAGS='-Wno-uninitialized')
976 swig_env.Append(CCFLAGS='-Wno-sign-compare')
977 swig_env.Append(CCFLAGS='-Wno-parentheses')
978
979 static_objs = make_objs(cc_lib_sources, new_env, static=True)
980 shared_objs = make_objs(cc_lib_sources, new_env, static=False)
981 static_objs += [ swig_env.StaticObject(s) for s in cc_swig_sources ]
982 shared_objs += [ swig_env.SharedObject(s) for s in cc_swig_sources ]
983
984 # First make a library of everything but main() so other programs can
985 # link against m5.
986 static_lib = new_env.StaticLibrary(libname, static_objs + static_objs)
987 shared_lib = new_env.SharedLibrary(libname, shared_objs + shared_objs)
988
989 for target, sources in unit_tests:
990 objs = [ new_env.StaticObject(s) for s in sources ]
991 new_env.Program("unittest/%s.%s" % (target, label), objs + static_lib)
992
993 # Now link a stub with main() and the static library.
994 objects = [new_env.Object(s) for s in cc_bin_sources] + static_lib
995 if strip:
996 unstripped_exe = exename + '.unstripped'
997 new_env.Program(unstripped_exe, objects)
998 if sys.platform == 'sunos5':
999 cmd = 'cp $SOURCE $TARGET; strip $TARGET'
1000 else:
1001 cmd = 'strip $SOURCE -o $TARGET'
1002 targets = new_env.Command(exename, unstripped_exe, cmd)
1003 else:
1004 targets = new_env.Program(exename, objects)
1005
1006 new_env.M5Binary = targets[0]
1007 envList.append(new_env)
1008
1009# Debug binary
1010ccflags = {}
1011if env['GCC']:
1012 if sys.platform == 'sunos5':
1013 ccflags['debug'] = '-gstabs+'
1014 else:
1015 ccflags['debug'] = '-ggdb3'

--- 38 unchanged lines hidden ---