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):
938 objs = [env.Object(s) for s in sources]
939
940 # make date.cc depend on all other objects so it always gets
941 # recompiled whenever anything else does
942 date_obj = env.Object('base/date.cc')
943
944 # Make the generation of program_info.cc dependend on all
945 # the other cc files and the compiling of program_info.cc
946 # dependent on all the objects but program_info.o
947 pinfo_obj = env.Object('base/program_info.cc')
948 env.Depends('base/program_info.cc', sources)
949 env.Depends(date_obj, objs)
950 env.Depends(pinfo_obj, objs)
951 objs.extend([date_obj,pinfo_obj])
952 return objs
953
954# Function to create a new build environment as clone of current
955# environment 'env' with modified object suffix and optional stripped
956# binary. Additional keyword arguments are appended to corresponding
957# build environment vars.
958def makeEnv(label, objsfx, strip = False, **kwargs):
959 newEnv = env.Copy(OBJSUFFIX=objsfx)
960 newEnv.Label = label
961 newEnv.Append(**kwargs)
962
963 swig_env = newEnv.Copy()
964 if env['GCC']:
965 swig_env.Append(CCFLAGS='-Wno-uninitialized')
966 swig_env.Append(CCFLAGS='-Wno-sign-compare')
967 swig_env.Append(CCFLAGS='-Wno-parentheses')
968 swig_objs = [ swig_env.Object(s) for s in cc_swig_sources ]
969
970 # First make a library of everything but main() so other programs can
971 # link against m5.
972 #
973 # SCons doesn't know to append a library suffix when there is a '.' in the
974 # name. Use '_' instead.
975
976 m5lib = newEnv.Library('m5_' + label,
977 make_objs(cc_lib_sources, newEnv) + swig_objs)
978
979 for target, sources in unit_tests:
980 objs = [ newEnv.StaticObject(s) for s in sources ]
981 newEnv.Program("unittest/%s.%s" % (target, label), objs + m5lib)
982
983 # Now link a stub with main() and the library.
984 exe = 'm5.' + label # final executable
985 objects = [newEnv.Object(s) for s in cc_bin_sources] + m5lib
986 if strip:
987 unstripped_exe = exe + '.unstripped'
988 newEnv.Program(unstripped_exe, objects)
989 if sys.platform == 'sunos5':
990 cmd = 'cp $SOURCE $TARGET; strip $TARGET'
991 else:
992 cmd = 'strip $SOURCE -o $TARGET'
993 targets = newEnv.Command(exe, unstripped_exe, cmd)
994 else:
995 targets = newEnv.Program(exe, objects)
996
997 newEnv.M5Binary = targets[0]
998 envList.append(newEnv)
999
1000# Debug binary
1001ccflags = {}
1002if env['GCC']:
1003 if sys.platform == 'sunos5':
1004 ccflags['debug'] = '-gstabs+'
1005 else:
1006 ccflags['debug'] = '-ggdb3'

--- 38 unchanged lines hidden ---