usermode/library/configuration/pmalloc.py

00001 import os
00002 import string
00003 import SCons.Environment
00004 from SCons.Script import ARGUMENTS, Dir
00005 from SCons.Variables import Variables, EnumVariable, BoolVariable
00006 import helper
00007 import mnemosyne
00008 
00009 class Environment(mnemosyne.Environment):
00010         """
00011                 A specialization of the SCons Environment class which does some particular
00012                 munging of the build variables needed in the source files.
00013         """
00014         
00015         def __init__(self, mainEnv, configuration_name = 'default'):
00016                 """
00017                         Applies the definitions in configuration_name to generate a correct
00018                         environment (specificall the set of compilation flags() for the
00019                         TinySTM library. That environment is returned
00020                 """
00021                 mnemosyne.Environment.__init__(self, mainEnv, configuration_name)
00022                 
00023                 # Apply the configuration variables specific to MTM.
00024                 directives = helper.Directives(configuration_name, 'pmalloc', ARGUMENTS, self._boolean_directive_vars, self._enumerable_directive_vars, self._numerical_directive_vars)
00025 
00026 
00027                 # Bring in appropriate environment variables and preprocessor definitions.
00028                 # Note: the inclusion of the OS environment reportedly threatens to make
00029                 # this build more brittle, but otherwise I have to write an SCons builder
00030                 # for libatomic_ops as well. Instead, I let the system paths make it
00031                 # visible and assume that the user has installed libatomic_ops themselves.
00032                 if ('INCLUDE' in os.environ):
00033                         osinclude = string.split(os.environ['INCLUDE'], ':')
00034                 else:
00035                         osinclude = []
00036                 self.Append(
00037                         CPPDEFINES = directives.getPreprocessorDefinitions(),
00038                         CPPPATH = ['include'] + osinclude,
00039                         ENV = os.environ)
00040 
00041 
00042         #: BUILD DIRECTIVES
00043 
00044         #: Build directives which are either on or off.
00045         _boolean_directive_vars = [
00046         ]
00047         
00048         #: Build directives which have enumerated values.
00049         _enumerable_directive_vars = [
00050             ('GENALLOC',
00051                                  'Determines the generic persistent memory allocator.',
00052                                  'GENALLOC_DOUGLEA',
00053                                  ['GENALLOC_DOUGLEA', 'GENALLOC_VISTAHEAP'])
00054 
00055         ]
00056         
00057         #: Build directives which have numerical values
00058         _numerical_directive_vars = [
00059         ]

Generated on Sat Apr 23 11:43:35 2011 for Mnemosyne by  doxygen 1.4.7