Deleted Added
sdiff udiff text old ( 7722:c10bc8ad3f97 ) new ( 7756:846fb3ffe0dc )
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

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

284
285#define THE_ISA ${{define(target_isa)}}
286#define TheISA ${{namespace(target_isa)}}
287
288#endif // __CONFIG_THE_ISA_HH__''')
289
290 code.write(str(target[0]))
291
292env.Command('config/the_isa.hh', map(Value, all_isa_list), makeTheISA)
293
294########################################################################
295#
296# Prevent any SimObjects from being added after this point, they
297# should all have been added in the SConscripts above
298#
299SimObject.fixed = True
300

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

426 flag = key[5:]
427 _globals[flag] = val
428del _globals
429""")
430 code.write(target[0].abspath)
431
432defines_info = [ Value(build_env), Value(env['HG_INFO']) ]
433# Generate a file with all of the compile options in it
434env.Command('python/m5/defines.py', defines_info, makeDefinesPyFile)
435PySource('m5', 'python/m5/defines.py')
436
437# Generate python file containing info about the M5 source code
438def makeInfoPyFile(target, source, env):
439 code = code_formatter()
440 for src in source:
441 data = ''.join(file(src.srcnode().abspath, 'r').xreadlines())
442 code('$src = ${{repr(data)}}')
443 code.write(str(target[0]))
444
445# Generate a file that wraps the basic top level files
446env.Command('python/m5/info.py',
447 [ '#/AUTHORS', '#/LICENSE', '#/README', '#/RELEASE_NOTES' ],
448 makeInfoPyFile)
449PySource('m5', 'python/m5/info.py')
450
451########################################################################
452#
453# Create all of the SimObject param headers and enum headers
454#
455
456def createSimObjectParam(target, source, env):

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

515# Generate all of the SimObject param struct header files
516params_hh_files = []
517for name,simobj in sorted(sim_objects.iteritems()):
518 py_source = PySource.modules[simobj.__module__]
519 extra_deps = [ py_source.tnode ]
520
521 hh_file = File('params/%s.hh' % name)
522 params_hh_files.append(hh_file)
523 env.Command(hh_file, Value(name), createSimObjectParam)
524 env.Depends(hh_file, depends + extra_deps)
525
526# Generate any parameter header files needed
527params_i_files = []
528for name,param in all_params.iteritems():
529 i_file = File('python/m5/internal/%s_%s.i' % (param.file_ext, name))
530 params_i_files.append(i_file)
531 env.Command(i_file, Value(name), createSwigParam)
532 env.Depends(i_file, depends)
533 SwigSource('m5.internal', i_file)
534
535# Generate all enum header files
536for name,enum in sorted(all_enums.iteritems()):
537 py_source = PySource.modules[enum.__module__]
538 extra_deps = [ py_source.tnode ]
539
540 cc_file = File('enums/%s.cc' % name)
541 env.Command(cc_file, Value(name), createEnumStrings)
542 env.Depends(cc_file, depends + extra_deps)
543 Source(cc_file)
544
545 hh_file = File('enums/%s.hh' % name)
546 env.Command(hh_file, Value(name), createEnumParam)
547 env.Depends(hh_file, depends + extra_deps)
548
549 i_file = File('python/m5/internal/enum_%s.i' % name)
550 env.Command(i_file, Value(name), createEnumSwig)
551 env.Depends(i_file, depends + extra_deps)
552 SwigSource('m5.internal', i_file)
553
554def buildParam(target, source, env):
555 name = source[0].get_contents()
556 obj = sim_objects[name]
557 class_path = obj.cxx_class.split('::')
558 classname = class_path[-1]

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

581 code()
582
583 code('%include "params/$obj.hh"')
584
585 code.write(target[0].abspath)
586
587for name in sim_objects.iterkeys():
588 params_file = File('python/m5/internal/param_%s.i' % name)
589 env.Command(params_file, Value(name), buildParam)
590 env.Depends(params_file, depends)
591 SwigSource('m5.internal', params_file)
592
593# Generate the main swig init file
594def makeEmbeddedSwigInit(target, source, env):
595 code = code_formatter()
596 module = source[0].get_contents()
597 code('''\

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

603
604EmbeddedSwig embed_swig_${module}(init_${module});
605''')
606 code.write(str(target[0]))
607
608# Build all swig modules
609for swig in SwigSource.all:
610 env.Command([swig.cc_source.tnode, swig.py_source.tnode], swig.tnode,
611 '$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
612 '-o ${TARGETS[0]} $SOURCES')
613 init_file = 'python/swig/init_%s.cc' % swig.module
614 env.Command(init_file, Value(swig.module), makeEmbeddedSwigInit)
615 Source(init_file)
616 env.Depends(swig.py_source.tnode, swig.tnode)
617 env.Depends(swig.cc_source.tnode, swig.tnode)
618
619def getFlags(source_flags):
620 flagsMap = {}
621 flagsList = []
622 for s in source_flags:

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

831/* namespace Trace */ }
832
833#endif // __BASE_TRACE_FLAGS_HH__
834''')
835
836 code.write(str(target[0]))
837
838flags = map(Value, trace_flags.values())
839env.Command('base/traceflags.py', flags, traceFlagsPy)
840PySource('m5', 'base/traceflags.py')
841
842env.Command('base/traceflags.hh', flags, traceFlagsHH)
843env.Command('base/traceflags.cc', flags, traceFlagsCC)
844Source('base/traceflags.cc')
845
846# Embed python files. All .py files that have been indicated by a
847# PySource() call in a SConscript need to be embedded into the M5
848# library. To do that, we compile the file to byte code, marshal the
849# byte code, compress it, and then generate a c++ file that
850# inserts the result into an array.
851def embedPyFile(target, source, env):

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

892 ${{len(data)}},
893 ${{len(marshalled)}});
894
895/* namespace */ }
896''')
897 code.write(str(target[0]))
898
899for source in PySource.all:
900 env.Command(source.cpp, source.tnode, embedPyFile)
901 Source(source.cpp)
902
903########################################################################
904#
905# Define binaries. Each different build type (debug, opt, etc.) gets
906# a slightly different build environment.
907#
908

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

983
984 targets = new_env.Program(progname, bin_objs + static_objs)
985
986 if strip:
987 if sys.platform == 'sunos5':
988 cmd = 'cp $SOURCE $TARGET; strip $TARGET'
989 else:
990 cmd = 'strip $SOURCE -o $TARGET'
991 targets = new_env.Command(exename, progname, cmd)
992
993 new_env.M5Binary = targets[0]
994 envList.append(new_env)
995
996# Debug binary
997ccflags = {}
998if env['GCC']:
999 if sys.platform == 'sunos5':

--- 41 unchanged lines hidden ---