SConscript (11718:09f8fda798bc) SConscript (11802:be62996c95d1)
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

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

478
479 def find_module(self, fullname, path):
480 if fullname == 'm5.defines':
481 return self
482
483 if fullname == 'm5.objects':
484 return self
485
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

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

478
479 def find_module(self, fullname, path):
480 if fullname == 'm5.defines':
481 return self
482
483 if fullname == 'm5.objects':
484 return self
485
486 if fullname.startswith('m5.internal'):
486 if fullname.startswith('_m5'):
487 return None
488
489 source = self.modules.get(fullname, None)
490 if source is not None and fullname.startswith('m5.objects'):
491 return self
492
493 return None
494

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

583
584# Generate Python file containing a dict specifying the current
585# buildEnv flags.
586def makeDefinesPyFile(target, source, env):
587 build_env = source[0].get_contents()
588
589 code = code_formatter()
590 code("""
487 return None
488
489 source = self.modules.get(fullname, None)
490 if source is not None and fullname.startswith('m5.objects'):
491 return self
492
493 return None
494

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

583
584# Generate Python file containing a dict specifying the current
585# buildEnv flags.
586def makeDefinesPyFile(target, source, env):
587 build_env = source[0].get_contents()
588
589 code = code_formatter()
590 code("""
591import m5.internal
591import _m5.core
592import m5.util
593
594buildEnv = m5.util.SmartDict($build_env)
595
592import m5.util
593
594buildEnv = m5.util.SmartDict($build_env)
595
596compileDate = m5.internal.core.compileDate
596compileDate = _m5.core.compileDate
597_globals = globals()
597_globals = globals()
598for key,val in m5.internal.core.__dict__.iteritems():
598for key,val in _m5.core.__dict__.iteritems():
599 if key.startswith('flag_'):
600 flag = key[5:]
601 _globals[flag] = val
602del _globals
603""")
604 code.write(target[0].abspath)
605
606defines_info = Value(build_env)

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

768 if not hasattr(simobj, 'abstract') or not simobj.abstract]
769 Depends(cxx_config_init_cc_file, cxx_param_hh_files +
770 [File('sim/cxx_config.hh')])
771 Source(cxx_config_init_cc_file)
772
773# Generate any needed param SWIG wrapper files
774params_i_files = []
775for name,param in sorted(params_to_swig.iteritems()):
599 if key.startswith('flag_'):
600 flag = key[5:]
601 _globals[flag] = val
602del _globals
603""")
604 code.write(target[0].abspath)
605
606defines_info = Value(build_env)

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

768 if not hasattr(simobj, 'abstract') or not simobj.abstract]
769 Depends(cxx_config_init_cc_file, cxx_param_hh_files +
770 [File('sim/cxx_config.hh')])
771 Source(cxx_config_init_cc_file)
772
773# Generate any needed param SWIG wrapper files
774params_i_files = []
775for name,param in sorted(params_to_swig.iteritems()):
776 i_file = File('python/m5/internal/%s.i' % (param.swig_module_name()))
776 i_file = File('python/_m5/%s.i' % (param.swig_module_name()))
777 params_i_files.append(i_file)
778 env.Command(i_file, Value(name),
779 MakeAction(createParamSwigWrapper, Transform("SW PARAM")))
780 env.Depends(i_file, depends)
781 env.Depends(SWIG, i_file)
777 params_i_files.append(i_file)
778 env.Command(i_file, Value(name),
779 MakeAction(createParamSwigWrapper, Transform("SW PARAM")))
780 env.Depends(i_file, depends)
781 env.Depends(SWIG, i_file)
782 SwigSource('m5.internal', i_file)
782 SwigSource('_m5', i_file)
783
784# Generate all enum header files
785for name,enum in sorted(all_enums.iteritems()):
786 py_source = PySource.modules[enum.__module__]
787 extra_deps = [ py_source.tnode ]
788
789 cc_file = File('enums/%s.cc' % name)
790 env.Command(cc_file, Value(name),
791 MakeAction(createEnumStrings, Transform("ENUM STR")))
792 env.Depends(cc_file, depends + extra_deps)
793 env.Depends(SWIG, cc_file)
794 Source(cc_file)
795
796 hh_file = File('enums/%s.hh' % name)
797 env.Command(hh_file, Value(name),
798 MakeAction(createEnumDecls, Transform("ENUMDECL")))
799 env.Depends(hh_file, depends + extra_deps)
800 env.Depends(SWIG, hh_file)
801
783
784# Generate all enum header files
785for name,enum in sorted(all_enums.iteritems()):
786 py_source = PySource.modules[enum.__module__]
787 extra_deps = [ py_source.tnode ]
788
789 cc_file = File('enums/%s.cc' % name)
790 env.Command(cc_file, Value(name),
791 MakeAction(createEnumStrings, Transform("ENUM STR")))
792 env.Depends(cc_file, depends + extra_deps)
793 env.Depends(SWIG, cc_file)
794 Source(cc_file)
795
796 hh_file = File('enums/%s.hh' % name)
797 env.Command(hh_file, Value(name),
798 MakeAction(createEnumDecls, Transform("ENUMDECL")))
799 env.Depends(hh_file, depends + extra_deps)
800 env.Depends(SWIG, hh_file)
801
802 i_file = File('python/m5/internal/enum_%s.i' % name)
802 i_file = File('python/_m5/enum_%s.i' % name)
803 env.Command(i_file, Value(name),
804 MakeAction(createEnumSwigWrapper, Transform("ENUMSWIG")))
805 env.Depends(i_file, depends + extra_deps)
806 env.Depends(SWIG, i_file)
803 env.Command(i_file, Value(name),
804 MakeAction(createEnumSwigWrapper, Transform("ENUMSWIG")))
805 env.Depends(i_file, depends + extra_deps)
806 env.Depends(SWIG, i_file)
807 SwigSource('m5.internal', i_file)
807 SwigSource('_m5', i_file)
808
809# Generate SimObject SWIG wrapper files
810for name,simobj in sorted(sim_objects.iteritems()):
811 py_source = PySource.modules[simobj.__module__]
812 extra_deps = [ py_source.tnode ]
808
809# Generate SimObject SWIG wrapper files
810for name,simobj in sorted(sim_objects.iteritems()):
811 py_source = PySource.modules[simobj.__module__]
812 extra_deps = [ py_source.tnode ]
813 i_file = File('python/m5/internal/param_%s.i' % name)
813 i_file = File('python/_m5/param_%s.i' % name)
814 env.Command(i_file, Value(name),
815 MakeAction(createSimObjectSwigWrapper, Transform("SO SWIG")))
816 env.Depends(i_file, depends + extra_deps)
814 env.Command(i_file, Value(name),
815 MakeAction(createSimObjectSwigWrapper, Transform("SO SWIG")))
816 env.Depends(i_file, depends + extra_deps)
817 SwigSource('m5.internal', i_file)
817 SwigSource('_m5', i_file)
818
819# Generate the main swig init file
820def makeEmbeddedSwigInit(package):
821 def body(target, source, env):
822 assert len(target) == 1 and len(source) == 1
823
824 code = code_formatter()
825 module = source[0].get_contents()

--- 524 unchanged lines hidden ---
818
819# Generate the main swig init file
820def makeEmbeddedSwigInit(package):
821 def body(target, source, env):
822 assert len(target) == 1 and len(source) == 1
823
824 code = code_formatter()
825 module = source[0].get_contents()

--- 524 unchanged lines hidden ---