SConscript (5522:e56c3d89be79) SConscript (5554:e6fabe023fe1)
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

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

538params_file = File('params/params.i')
539names = sort_list(sim_objects.keys())
540env.Command(params_file, [ Value(v) for v in names ], buildParams)
541env.Depends(params_file, params_hh_files + params_i_files + depends)
542SwigSource('m5.objects', params_file)
543
544# Build all swig modules
545swig_modules = []
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

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

538params_file = File('params/params.i')
539names = sort_list(sim_objects.keys())
540env.Command(params_file, [ Value(v) for v in names ], buildParams)
541env.Depends(params_file, params_hh_files + params_i_files + depends)
542SwigSource('m5.objects', params_file)
543
544# Build all swig modules
545swig_modules = []
546cc_swig_sources = []
546for source,package in swig_sources:
547 filename = str(source)
548 assert filename.endswith('.i')
549
550 base = '.'.join(filename.split('.')[:-1])
551 module = basename(base)
552 cc_file = base + '_wrap.cc'
553 py_file = base + '.py'
554
555 env.Command([cc_file, py_file], source,
556 '$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
557 '-o ${TARGETS[0]} $SOURCES')
558 env.Depends(py_file, source)
559 env.Depends(cc_file, source)
560
561 swig_modules.append(Value(module))
547for source,package in swig_sources:
548 filename = str(source)
549 assert filename.endswith('.i')
550
551 base = '.'.join(filename.split('.')[:-1])
552 module = basename(base)
553 cc_file = base + '_wrap.cc'
554 py_file = base + '.py'
555
556 env.Command([cc_file, py_file], source,
557 '$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
558 '-o ${TARGETS[0]} $SOURCES')
559 env.Depends(py_file, source)
560 env.Depends(cc_file, source)
561
562 swig_modules.append(Value(module))
562 Source(cc_file)
563 cc_swig_sources.append(File(cc_file))
563 PySource(package, py_file)
564
565# Generate the main swig init file
566def makeSwigInit(target, source, env):
567 f = file(str(target[0]), 'w')
568 print >>f, 'extern "C" {'
569 for module in source:
570 print >>f, ' void init_%s();' % module.get_contents()

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

940# environment 'env' with modified object suffix and optional stripped
941# binary. Additional keyword arguments are appended to corresponding
942# build environment vars.
943def makeEnv(label, objsfx, strip = False, **kwargs):
944 newEnv = env.Copy(OBJSUFFIX=objsfx)
945 newEnv.Label = label
946 newEnv.Append(**kwargs)
947
564 PySource(package, py_file)
565
566# Generate the main swig init file
567def makeSwigInit(target, source, env):
568 f = file(str(target[0]), 'w')
569 print >>f, 'extern "C" {'
570 for module in source:
571 print >>f, ' void init_%s();' % module.get_contents()

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

941# environment 'env' with modified object suffix and optional stripped
942# binary. Additional keyword arguments are appended to corresponding
943# build environment vars.
944def makeEnv(label, objsfx, strip = False, **kwargs):
945 newEnv = env.Copy(OBJSUFFIX=objsfx)
946 newEnv.Label = label
947 newEnv.Append(**kwargs)
948
949 swig_env = newEnv.Copy()
950 swig_env.Append(CCFLAGS='-Wno-uninitialized')
951 swig_objs = [ swig_env.Object(s) for s in cc_swig_sources ]
952
948 # First make a library of everything but main() so other programs can
949 # link against m5.
950 #
951 # SCons doesn't know to append a library suffix when there is a '.' in the
952 # name. Use '_' instead.
953 # First make a library of everything but main() so other programs can
954 # link against m5.
955 #
956 # SCons doesn't know to append a library suffix when there is a '.' in the
957 # name. Use '_' instead.
953 m5lib = newEnv.Library('m5_' + label, make_objs(cc_lib_sources, newEnv))
954
958
959 m5lib = newEnv.Library('m5_' + label,
960 make_objs(cc_lib_sources, newEnv) + swig_objs)
961
955 # Now link a stub with main() and the library.
956 exe = 'm5.' + label # final executable
957 objects = [newEnv.Object(s) for s in cc_bin_sources] + m5lib
958 if strip:
959 unstripped_exe = exe + '.unstripped'
960 newEnv.Program(unstripped_exe, objects)
961 if sys.platform == 'sunos5':
962 cmd = 'cp $SOURCE $TARGET; strip $TARGET'

--- 54 unchanged lines hidden ---
962 # Now link a stub with main() and the library.
963 exe = 'm5.' + label # final executable
964 objects = [newEnv.Object(s) for s in cc_bin_sources] + m5lib
965 if strip:
966 unstripped_exe = exe + '.unstripped'
967 newEnv.Program(unstripped_exe, objects)
968 if sys.platform == 'sunos5':
969 cmd = 'cp $SOURCE $TARGET; strip $TARGET'

--- 54 unchanged lines hidden ---