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), 293 MakeAction(makeTheISA, " [ CFG ISA] $STRIP_TARGET")) |
294 295######################################################################## 296# 297# Prevent any SimObjects from being added after this point, they 298# should all have been added in the SConscripts above 299# 300SimObject.fixed = True 301 --- 125 unchanged lines hidden (view full) --- 427 flag = key[5:] 428 _globals[flag] = val 429del _globals 430""") 431 code.write(target[0].abspath) 432 433defines_info = [ Value(build_env), Value(env['HG_INFO']) ] 434# Generate a file with all of the compile options in it |
435env.Command('python/m5/defines.py', defines_info, 436 MakeAction(makeDefinesPyFile, " [ DEFINES] $STRIP_TARGET")) |
437PySource('m5', 'python/m5/defines.py') 438 439# Generate python file containing info about the M5 source code 440def makeInfoPyFile(target, source, env): 441 code = code_formatter() 442 for src in source: 443 data = ''.join(file(src.srcnode().abspath, 'r').xreadlines()) 444 code('$src = ${{repr(data)}}') 445 code.write(str(target[0])) 446 447# Generate a file that wraps the basic top level files 448env.Command('python/m5/info.py', 449 [ '#/AUTHORS', '#/LICENSE', '#/README', '#/RELEASE_NOTES' ], |
450 MakeAction(makeInfoPyFile, " [ INFO] $STRIP_TARGET")) |
451PySource('m5', 'python/m5/info.py') 452 453######################################################################## 454# 455# Create all of the SimObject param headers and enum headers 456# 457 458def createSimObjectParam(target, source, env): --- 58 unchanged lines hidden (view full) --- 517# Generate all of the SimObject param struct header files 518params_hh_files = [] 519for name,simobj in sorted(sim_objects.iteritems()): 520 py_source = PySource.modules[simobj.__module__] 521 extra_deps = [ py_source.tnode ] 522 523 hh_file = File('params/%s.hh' % name) 524 params_hh_files.append(hh_file) |
525 env.Command(hh_file, Value(name), 526 MakeAction(createSimObjectParam, " [SO PARAM] $STRIP_TARGET")) |
527 env.Depends(hh_file, depends + extra_deps) 528 529# Generate any parameter header files needed 530params_i_files = [] 531for name,param in all_params.iteritems(): 532 i_file = File('python/m5/internal/%s_%s.i' % (param.file_ext, name)) 533 params_i_files.append(i_file) |
534 env.Command(i_file, Value(name), 535 MakeAction(createSwigParam, " [SW PARAM] $STRIP_TARGET")) |
536 env.Depends(i_file, depends) 537 SwigSource('m5.internal', i_file) 538 539# Generate all enum header files 540for name,enum in sorted(all_enums.iteritems()): 541 py_source = PySource.modules[enum.__module__] 542 extra_deps = [ py_source.tnode ] 543 544 cc_file = File('enums/%s.cc' % name) |
545 env.Command(cc_file, Value(name), 546 MakeAction(createEnumStrings, " [ENUM STR] $STRIP_TARGET")) |
547 env.Depends(cc_file, depends + extra_deps) 548 Source(cc_file) 549 550 hh_file = File('enums/%s.hh' % name) |
551 env.Command(hh_file, Value(name), 552 MakeAction(createEnumParam, " [EN PARAM] $STRIP_TARGET")) |
553 env.Depends(hh_file, depends + extra_deps) 554 555 i_file = File('python/m5/internal/enum_%s.i' % name) |
556 env.Command(i_file, Value(name), 557 MakeAction(createEnumSwig, " [ENUMSWIG] $STRIP_TARGET")) |
558 env.Depends(i_file, depends + extra_deps) 559 SwigSource('m5.internal', i_file) 560 561def buildParam(target, source, env): 562 name = source[0].get_contents() 563 obj = sim_objects[name] 564 class_path = obj.cxx_class.split('::') 565 classname = class_path[-1] --- 22 unchanged lines hidden (view full) --- 588 code() 589 590 code('%include "params/$obj.hh"') 591 592 code.write(target[0].abspath) 593 594for name in sim_objects.iterkeys(): 595 params_file = File('python/m5/internal/param_%s.i' % name) |
596 env.Command(params_file, Value(name), 597 MakeAction(buildParam, " [BLDPARAM] $STRIP_TARGET")) |
598 env.Depends(params_file, depends) 599 SwigSource('m5.internal', params_file) 600 601# Generate the main swig init file 602def makeEmbeddedSwigInit(target, source, env): 603 code = code_formatter() 604 module = source[0].get_contents() 605 code('''\ --- 5 unchanged lines hidden (view full) --- 611 612EmbeddedSwig embed_swig_${module}(init_${module}); 613''') 614 code.write(str(target[0])) 615 616# Build all swig modules 617for swig in SwigSource.all: 618 env.Command([swig.cc_source.tnode, swig.py_source.tnode], swig.tnode, |
619 MakeAction('$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} ' 620 '-o ${TARGETS[0]} $SOURCES', " [ SWIG] $STRIP_TARGET")) |
621 init_file = 'python/swig/init_%s.cc' % swig.module |
622 env.Command(init_file, Value(swig.module), 623 MakeAction(makeEmbeddedSwigInit, " [EMBED SW] $STRIP_TARGET")) |
624 Source(init_file) 625 env.Depends(swig.py_source.tnode, swig.tnode) 626 env.Depends(swig.cc_source.tnode, swig.tnode) 627 628def getFlags(source_flags): 629 flagsMap = {} 630 flagsList = [] 631 for s in source_flags: --- 208 unchanged lines hidden (view full) --- 840/* namespace Trace */ } 841 842#endif // __BASE_TRACE_FLAGS_HH__ 843''') 844 845 code.write(str(target[0])) 846 847flags = map(Value, trace_flags.values()) |
848env.Command('base/traceflags.py', flags, 849 MakeAction(traceFlagsPy, " [ TRACING] $STRIP_TARGET")) |
850PySource('m5', 'base/traceflags.py') 851 |
852env.Command('base/traceflags.hh', flags, 853 MakeAction(traceFlagsHH, " [ TRACING] $STRIP_TARGET")) 854env.Command('base/traceflags.cc', flags, 855 MakeAction(traceFlagsCC, " [ TRACING] $STRIP_TARGET")) |
856Source('base/traceflags.cc') 857 858# Embed python files. All .py files that have been indicated by a 859# PySource() call in a SConscript need to be embedded into the M5 860# library. To do that, we compile the file to byte code, marshal the 861# byte code, compress it, and then generate a c++ file that 862# inserts the result into an array. 863def embedPyFile(target, source, env): --- 40 unchanged lines hidden (view full) --- 904 ${{len(data)}}, 905 ${{len(marshalled)}}); 906 907/* namespace */ } 908''') 909 code.write(str(target[0])) 910 911for source in PySource.all: |
912 env.Command(source.cpp, source.tnode, 913 MakeAction(embedPyFile, " [EMBED PY] $STRIP_TARGET")) |
914 Source(source.cpp) 915 916######################################################################## 917# 918# Define binaries. Each different build type (debug, opt, etc.) gets 919# a slightly different build environment. 920# 921 --- 74 unchanged lines hidden (view full) --- 996 997 targets = new_env.Program(progname, bin_objs + static_objs) 998 999 if strip: 1000 if sys.platform == 'sunos5': 1001 cmd = 'cp $SOURCE $TARGET; strip $TARGET' 1002 else: 1003 cmd = 'strip $SOURCE -o $TARGET' |
1004 targets = new_env.Command(exename, progname, 1005 MakeAction(cmd, " [ STRIP] $STRIP_TARGET")) |
1006 1007 new_env.M5Binary = targets[0] 1008 envList.append(new_env) 1009 1010# Debug binary 1011ccflags = {} 1012if env['GCC']: 1013 if sys.platform == 'sunos5': --- 41 unchanged lines hidden --- |