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
00024 directives = helper.Directives(configuration_name, 'pmalloc', ARGUMENTS, self._boolean_directive_vars, self._enumerable_directive_vars, self._numerical_directive_vars)
00025
00026
00027
00028
00029
00030
00031
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
00043
00044
00045 _boolean_directive_vars = [
00046 ]
00047
00048
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
00058 _numerical_directive_vars = [
00059 ]