Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Selten <michel@mselten.demon.nl>2004-03-01 00:40:48 +0300
committerMichel Selten <michel@mselten.demon.nl>2004-03-01 00:40:48 +0300
commit70a4ead0ae6f8ffabb1178ec2ed4d1fafa3e232e (patch)
tree2a81baeb98325e8e74ea4bea96074ec74508f563
parent5998c12c607ea0bfe0d9934f7b9011636ad3936a (diff)
SCons updates
* Blender static now links. By default this option is disabled on all platforms. Simply set the option in config.opts to 'true'. * Added the following flags to config.opts: - HOST_CC. This is the C compiler for the host platform. This value is the same as TARGET_CC when not cross compiling. - HOST_CXX. This is the C++ compiler for the host platform. This value is the same as TARGET_CXX when not cross compiling. - TARGET_CC. This is the C compiler for the target platform. - TARGET_CXX. This is the C++ compiler for the target platform. - TARGET_AR. This is the linker command for linking libraries. - PATH This is the standard search path All SConscript files have been updated to reflect these changes. Now it's possible to change only the root SConstruct file, and all compiler specific variables are passed automatically to all SConscript files. Of course, this does not apply to makesdna because there the host and target platform is different from all other libraries. To pass a variable that applies to all platforms, all we now have to do is set the correct value in library_env Note: as usual, to get the latest options in the config.opts file, first remove your version.
-rw-r--r--SConstruct45
-rw-r--r--intern/SoundSystem/SConscript12
-rw-r--r--intern/bmfont/SConscript12
-rw-r--r--intern/bsp/SConscript12
-rw-r--r--intern/container/SConscript12
-rw-r--r--intern/decimation/SConscript12
-rw-r--r--intern/ghost/SConscript12
-rw-r--r--intern/guardedalloc/SConscript12
-rw-r--r--intern/iksolver/SConscript12
-rw-r--r--intern/memutil/SConscript12
-rw-r--r--intern/moto/SConscript12
-rw-r--r--intern/string/SConscript12
-rw-r--r--source/blender/avi/SConscript12
-rw-r--r--source/blender/blenkernel/SConscript12
-rw-r--r--source/blender/blenlib/SConscript12
-rw-r--r--source/blender/blenloader/SConscript12
-rw-r--r--source/blender/blenpluginapi/SConscript12
-rw-r--r--source/blender/deflate/SConscript12
-rw-r--r--source/blender/ftfont/SConscript11
-rw-r--r--source/blender/imbuf/SConscript12
-rw-r--r--source/blender/img/SConscript12
-rw-r--r--source/blender/inflate/SConscript13
-rw-r--r--source/blender/makesdna/SConscript12
-rw-r--r--source/blender/makesdna/intern/SConscript5
-rw-r--r--source/blender/python/SConscript16
-rw-r--r--source/blender/quicktime/SConscript13
-rw-r--r--source/blender/radiosity/SConscript12
-rw-r--r--source/blender/readblenfile/SConscript12
-rw-r--r--source/blender/readstreamglue/SConscript12
-rw-r--r--source/blender/render/SConscript12
-rw-r--r--source/blender/renderconverter/SConscript12
-rw-r--r--source/blender/src/SConscript12
-rw-r--r--source/blender/writeblenfile/SConscript12
-rw-r--r--source/blender/writestreamglue/SConscript12
-rw-r--r--source/blender/yafray/SConscript12
-rw-r--r--source/creator/SConscript11
-rwxr-xr-xsource/gameengine/BlenderRoutines/SConscript12
-rwxr-xr-xsource/gameengine/Converter/SConscript12
-rwxr-xr-xsource/gameengine/Expressions/SConscript12
-rwxr-xr-xsource/gameengine/GameLogic/SConscript12
-rwxr-xr-xsource/gameengine/Ketsji/KXNetwork/SConscript12
-rw-r--r--source/gameengine/Ketsji/SConscript12
-rwxr-xr-xsource/gameengine/Network/LoopBackNetwork/SConscript12
-rwxr-xr-xsource/gameengine/Network/SConscript12
-rwxr-xr-xsource/gameengine/Physics/BlOde/SConscript12
-rwxr-xr-xsource/gameengine/Physics/Dummy/SConscript12
-rwxr-xr-xsource/gameengine/Physics/Sumo/SConscript16
-rwxr-xr-xsource/gameengine/Physics/common/SConscript12
-rwxr-xr-xsource/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript12
-rwxr-xr-xsource/gameengine/Rasterizer/SConscript12
-rwxr-xr-xsource/gameengine/SceneGraph/SConscript12
-rw-r--r--source/kernel/SConscript12
52 files changed, 196 insertions, 462 deletions
diff --git a/SConstruct b/SConstruct
index ae2242e7c63..e29f6423f06 100644
--- a/SConstruct
+++ b/SConstruct
@@ -217,8 +217,6 @@ elif sys.platform == 'cygwin':
sdl_libpath = sdl_env.Dictionary()['LIBPATH']
sdl_lib = sdl_env.Dictionary()['LIBS']
#sdl_cflags = '-DWIN32'
- # We need to force the Cygwin environment to use the g++ linker.
- link_env.Replace (CC='g++')
# Python variables.
python_include = sysconfig.get_python_inc ()
python_libpath = sysconfig.get_python_lib (0, 1) + '/config'
@@ -521,6 +519,7 @@ if os.path.exists (config_file):
print "Using config file: " + config_file
else:
print "Creating new config file: " + config_file
+ env_dict = env.Dictionary()
config=open (config_file, 'w')
config.write ("# Configuration file containing user definable options.\n")
config.write ("VERSION = '2.32-cvs'\n")
@@ -540,6 +539,13 @@ else:
config.write ("USE_OPENAL = %r\n"%(use_openal))
config.write ("USE_FMOD = %r\n"%(use_fmod))
config.write ("USE_QUICKTIME = %r\n"%(use_quicktime))
+ config.write ("\n# Compiler information.\n")
+ config.write ("HOST_CC = %r\n"%(env_dict['CC']))
+ config.write ("HOST_CXX = %r\n"%(env_dict['CXX']))
+ config.write ("TARGET_CC = %r\n"%(env_dict['CC']))
+ config.write ("TARGET_CXX = %r\n"%(env_dict['CXX']))
+ config.write ("TARGET_AR = %r\n"%(env_dict['AR']))
+ config.write ("PATH = %r\n"%(os.environ['PATH']))
config.write ("\n# External library information.\n")
config.write ("PYTHON_INCLUDE = %r\n"%(python_include))
config.write ("PYTHON_LIBPATH = %r\n"%(python_libpath))
@@ -634,6 +640,12 @@ user_options.AddOptions (
(BoolOption ('USE_QUICKTIME',
'Set to 1 to add support for QuickTime.',
'false')),
+ ('HOST_CC', 'C compiler for the host platfor. This is the same as target platform when not cross compiling.'),
+ ('HOST_CXX', 'C++ compiler for the host platform. This is the same as target platform when not cross compiling.'),
+ ('TARGET_CC', 'C compiler for the target platform.'),
+ ('TARGET_CXX', 'C++ compiler for the target platform.'),
+ ('TARGET_AR', 'Linker command for linking libraries.'),
+ ('PATH', 'Standard search path'),
('PYTHON_INCLUDE', 'Include directory for Python header files.'),
('PYTHON_LIBPATH', 'Library path where the Python lib is located.'),
('PYTHON_LIBRARY', 'Python library name.'),
@@ -701,18 +713,31 @@ else:
platform_linkflags += ['/DEBUG','/PDB:blender.pdb']
#-----------------------------------------------------------------------------
+# Generic library generation environment. This one is the basis for each
+# library.
+#-----------------------------------------------------------------------------
+library_env = Environment ()
+library_env.Replace (CC = user_options_dict['TARGET_CC'])
+library_env.Replace (CXX = user_options_dict['TARGET_CXX'])
+library_env.Replace (PATH = user_options_dict['PATH'])
+library_env.Replace (AR = user_options_dict['TARGET_AR'])
+library_env.Append (CCFLAGS = cflags)
+library_env.Append (CXXFLAGS = cxxflags)
+library_env.Append (CPPDEFINES = defines)
+
+#-----------------------------------------------------------------------------
# Settings to be exported to other SConscript files
#-----------------------------------------------------------------------------
Export ('cflags')
Export ('defines')
-Export ('cxxflags')
Export ('window_system')
Export ('extra_includes')
Export ('platform_libs')
Export ('platform_libpath')
Export ('platform_linkflags')
Export ('user_options_dict')
+Export ('library_env')
BuildDir (root_build_dir+'/intern', 'intern', duplicate=0)
SConscript (root_build_dir+'intern/SConscript')
@@ -757,7 +782,13 @@ libraries = (['blender_creator',
link_env.Append (LIBS=libraries)
link_env.Append (LIBPATH=libpath)
-link_env.Append (CPPDEFINES=defines)
+link_env.Replace (CC = user_options_dict['TARGET_CC'])
+link_env.Replace (CXX = user_options_dict['TARGET_CXX'])
+link_env.Replace (PATH = user_options_dict['PATH'])
+link_env.Replace (AR = user_options_dict['TARGET_AR'])
+link_env.Append (CCFLAGS = cflags)
+link_env.Append (CXXFLAGS = cxxflags)
+link_env.Append (CPPDEFINES = defines)
if user_options_dict['USE_INTERNATIONAL'] == 1:
link_env.Append (LIBS=user_options_dict['FREETYPE_LIBRARY'])
@@ -837,7 +868,6 @@ if user_options_dict['BUILD_BLENDER_DYNAMIC'] == 1:
'BUILD_TYPE=\'"dynamic"\'',
'NAN_BUILDINFO',
'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])
- dy_blender.Append (CCFLAGS=cflags)
d_obj = [dy_blender.Object (root_build_dir+'source/creator/d_buildinfo',
[root_build_dir+'source/creator/buildinfo.c'])]
if sys.platform == 'win32':
@@ -847,13 +877,16 @@ if user_options_dict['BUILD_BLENDER_DYNAMIC'] == 1:
dy_blender.Program (target='blender', source=d_obj)
if user_options_dict['BUILD_BLENDER_STATIC'] == 1:
st_blender = link_env.Copy ()
+ # The next line is to make sure that the LINKFLAGS are appended at the end
+ # of the link command. This 'trick' is needed because the GL and GLU static
+ # libraries need to be at the end of the command.
+ st_blender.Replace(LINKCOM="$LINK -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $LINKFLAGS")
if user_options_dict['USE_BUILDINFO'] == 1:
st_blender.Append (CPPDEFINES = ['BUILD_TIME=\'"%s"\''%(build_time),
'BUILD_DATE=\'"%s"\''%(build_date),
'BUILD_TYPE=\'"static"\'',
'NAN_BUILDINFO',
'BUILD_PLATFORM=\'"%s"\''%(sys.platform)])
- st_blender.Append (CCFLAGS=cflags)
st_blender.Append (LINKFLAGS=user_options_dict['OPENGL_STATIC'])
s_obj = [st_blender.Object (root_build_dir+'source/creator/s_buildinfo',
[root_build_dir+'source/creator/buildinfo.c'])]
diff --git a/intern/SoundSystem/SConscript b/intern/SoundSystem/SConscript
index 89a0716dc85..6da9be3dd9a 100644
--- a/intern/SoundSystem/SConscript
+++ b/intern/SoundSystem/SConscript
@@ -1,17 +1,10 @@
-# TODO: Add the options for building with fmod and/or OpenAL
import sys
-soundsys_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
Import ('extra_includes')
+Import ('library_env')
-soundsys_env.Append (CCFLAGS = cflags)
-soundsys_env.Append (CXXFLAGS = cxxflags)
+soundsys_env = library_env.Copy ()
source_files = ['dummy/SND_DummyDevice.cpp',
'intern/SND_AudioDevice.cpp',
@@ -39,7 +32,6 @@ if user_options_dict['USE_OPENAL'] == 1:
soundsys_env.Append (CPPPATH=user_options_dict['OPENAL_INCLUDE'])
if sys.platform=='win32':
defines += ['_LIB']
- soundsys_env.Append(CPPDEFINES = defines)
if user_options_dict['USE_FMOD'] == 1:
source_files += ['fmod/SND_FmodDevice.cpp']
diff --git a/intern/bmfont/SConscript b/intern/bmfont/SConscript
index 5779fd25cbb..c5207760c5a 100644
--- a/intern/bmfont/SConscript
+++ b/intern/bmfont/SConscript
@@ -1,13 +1,7 @@
-bmfont_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-bmfont_env.Append (CCFLAGS = cflags)
-bmfont_env.Append (CXXFLAGS = cxxflags)
-bmfont_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+bmfont_env = library_env.Copy ()
source_files = ['intern/BMF_Api.cpp',
'intern/BMF_BitmapFont.cpp',
diff --git a/intern/bsp/SConscript b/intern/bsp/SConscript
index 975c9c9ba7d..dd21285cd0e 100644
--- a/intern/bsp/SConscript
+++ b/intern/bsp/SConscript
@@ -1,13 +1,7 @@
-bsp_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-bsp_env.Append (CCFLAGS = cflags)
-bsp_env.Append (CXXFLAGS = cxxflags)
-bsp_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+bsp_env = library_env.Copy ()
source_files = ['intern/BSP_CSGHelper.cpp',
'intern/BSP_CSGMesh.cpp',
diff --git a/intern/container/SConscript b/intern/container/SConscript
index 6e03cc9d900..e7b8e09b811 100644
--- a/intern/container/SConscript
+++ b/intern/container/SConscript
@@ -1,13 +1,7 @@
-cont_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-cont_env.Append (CCFLAGS = cflags)
-cont_env.Append (CXXFLAGS = cxxflags)
-cont_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+cont_env = library_env.Copy ()
source_files = ['intern/CTR_List.cpp']
diff --git a/intern/decimation/SConscript b/intern/decimation/SConscript
index 8bb7b9873f8..b4b8fa0e840 100644
--- a/intern/decimation/SConscript
+++ b/intern/decimation/SConscript
@@ -1,13 +1,7 @@
-dec_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-dec_env.Append (CCFLAGS = cflags)
-dec_env.Append (CXXFLAGS = cxxflags)
-dec_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+dec_env = library_env.Copy ()
source_files = ['intern/LOD_EdgeCollapser.cpp',
'intern/LOD_ExternNormalEditor.cpp',
diff --git a/intern/ghost/SConscript b/intern/ghost/SConscript
index 7dbcb2703c6..6b58f056d9c 100644
--- a/intern/ghost/SConscript
+++ b/intern/ghost/SConscript
@@ -1,14 +1,8 @@
-ghost_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
+Import ('library_env')
Import ('window_system')
-ghost_env.Append (CCFLAGS = cflags)
-ghost_env.Append (CXXFLAGS = cxxflags)
-ghost_env.Append (CPPDEFINES = defines)
+
+ghost_env = library_env.Copy ()
source_files = ['intern/GHOST_Buttons.cpp',
'intern/GHOST_C-api.cpp',
diff --git a/intern/guardedalloc/SConscript b/intern/guardedalloc/SConscript
index 21e2c8f66b0..8fdcafb573d 100644
--- a/intern/guardedalloc/SConscript
+++ b/intern/guardedalloc/SConscript
@@ -1,13 +1,7 @@
-guardal_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-guardal_env.Append (CCFLAGS = cflags)
-guardal_env.Append (CXXFLAGS = cxxflags)
-guardal_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+guardal_env = library_env.Copy ()
source_files = ['intern/mallocn.c']
diff --git a/intern/iksolver/SConscript b/intern/iksolver/SConscript
index 0121024110e..7a8b60b3c0e 100644
--- a/intern/iksolver/SConscript
+++ b/intern/iksolver/SConscript
@@ -1,13 +1,7 @@
-iksolver_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-iksolver_env.Append (CCFLAGS = cflags)
-iksolver_env.Append (CXXFLAGS = cxxflags)
-iksolver_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+iksolver_env = library_env.Copy ()
source_files = ['intern/IK_QChain.cpp',
'intern/IK_QJacobianSolver.cpp',
diff --git a/intern/memutil/SConscript b/intern/memutil/SConscript
index 6bc45f62088..bac0672230c 100644
--- a/intern/memutil/SConscript
+++ b/intern/memutil/SConscript
@@ -1,13 +1,7 @@
-memutil_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-memutil_env.Append (CCFLAGS = cflags)
-memutil_env.Append (CXXFLAGS = cxxflags)
-memutil_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+memutil_env = library_env.Copy ()
source_files = ['intern/MEM_RefCountedC-Api.cpp']
diff --git a/intern/moto/SConscript b/intern/moto/SConscript
index cc74c942716..502dd096a30 100644
--- a/intern/moto/SConscript
+++ b/intern/moto/SConscript
@@ -1,13 +1,7 @@
-moto_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-moto_env.Append (CCFLAGS = cflags)
-moto_env.Append (CXXFLAGS = cxxflags)
-moto_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+moto_env = library_env.Copy ()
source_files = ['intern/MT_CmMatrix4x4.cpp',
'intern/MT_Matrix3x3.cpp',
diff --git a/intern/string/SConscript b/intern/string/SConscript
index 14304ec73cd..8cceecc5f9f 100644
--- a/intern/string/SConscript
+++ b/intern/string/SConscript
@@ -1,13 +1,7 @@
-string_env = Environment ()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-string_env.Append (CCFLAGS = cflags)
-string_env.Append (CXXFLAGS = cxxflags)
-string_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+string_env = library_env.Copy ()
source_files = ['intern/STR_String.cpp']
diff --git a/source/blender/avi/SConscript b/source/blender/avi/SConscript
index 752b647bc88..0b5fce4f2d0 100644
--- a/source/blender/avi/SConscript
+++ b/source/blender/avi/SConscript
@@ -1,14 +1,8 @@
-avi_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('extra_includes')
Import ('user_options_dict')
-avi_env.Append (CCFLAGS = cflags)
-avi_env.Append (CXXFLAGS = cxxflags)
-avi_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+avi_env = library_env.Copy ()
source_files = ['intern/avi.c',
'intern/avirgb.c',
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index 479980673d2..35fb11d79bd 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -1,13 +1,7 @@
-blenkernel_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-blenkernel_env.Append (CCFLAGS = cflags)
-blenkernel_env.Append (CXXFLAGS = cxxflags)
-blenkernel_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+blenkernel_env = library_env.Copy ()
source_files = ['intern/constraint.c',
'intern/group.c',
diff --git a/source/blender/blenlib/SConscript b/source/blender/blenlib/SConscript
index bc36cd234e6..f26d7e87031 100644
--- a/source/blender/blenlib/SConscript
+++ b/source/blender/blenlib/SConscript
@@ -1,14 +1,8 @@
-blenlib_env = Environment ()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('extra_includes')
Import ('user_options_dict')
-blenlib_env.Append (CCFLAGS = cflags)
-blenlib_env.Append (CXXFLAGS = cxxflags)
-blenlib_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+blenlib_env = library_env.Copy ()
source_files = ['intern/BLI_dynstr.c',
'intern/BLI_ghash.c',
diff --git a/source/blender/blenloader/SConscript b/source/blender/blenloader/SConscript
index fdaa06afa62..26796a8eb38 100644
--- a/source/blender/blenloader/SConscript
+++ b/source/blender/blenloader/SConscript
@@ -1,13 +1,7 @@
-blenloader_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-blenloader_env.Append (CCFLAGS = cflags)
-blenloader_env.Append (CXXFLAGS = cxxflags)
-blenloader_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+blenloader_env = library_env.Copy ()
source_files = ['intern/genfile.c',
'intern/readblenentry.c',
diff --git a/source/blender/blenpluginapi/SConscript b/source/blender/blenpluginapi/SConscript
index 91854db6816..2077f7ad2b6 100644
--- a/source/blender/blenpluginapi/SConscript
+++ b/source/blender/blenpluginapi/SConscript
@@ -1,13 +1,7 @@
-blenplugin_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-blenplugin_env.Append (CCFLAGS = cflags)
-blenplugin_env.Append (CXXFLAGS = cxxflags)
-blenplugin_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+blenplugin_env = library_env.Copy ()
source_files = ['intern/pluginapi.c']
diff --git a/source/blender/deflate/SConscript b/source/blender/deflate/SConscript
index 06604f846ff..400c290f4e4 100644
--- a/source/blender/deflate/SConscript
+++ b/source/blender/deflate/SConscript
@@ -1,14 +1,8 @@
-deflate_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('extra_includes')
Import ('user_options_dict')
-deflate_env.Append (CCFLAGS = cflags)
-deflate_env.Append (CXXFLAGS = cxxflags)
-deflate_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+deflate_env = library_env.Copy ()
source_files = ['intern/BLO_deflate.c']
diff --git a/source/blender/ftfont/SConscript b/source/blender/ftfont/SConscript
index 8cfe4223f1b..bb73cc2cd73 100644
--- a/source/blender/ftfont/SConscript
+++ b/source/blender/ftfont/SConscript
@@ -1,9 +1,8 @@
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
Import ('extra_includes')
-Import ('defines')
Import ('user_options_dict')
+Import ('library_env')
+
+ftf_env = library_env.Copy ()
source_files = ['intern/FTF_Api.cpp',
'intern/FTF_TTFont.cpp']
@@ -13,14 +12,10 @@ include_paths = ['.',
'../blenlib',
'../makesdna']
-ftf_env = Environment()
ftf_env.Append(CPPPATH = extra_includes)
ftf_env.Append(CPPPATH = include_paths)
ftf_env.Prepend (CPPPATH = user_options_dict['FTGL_INCLUDE'])
ftf_env.Prepend (CPPPATH = user_options_dict['FREETYPE_INCLUDE'])
ftf_env.Prepend (CPPPATH = user_options_dict['GETTEXT_INCLUDE'])
-ftf_env.Append(CCFLAGS = cflags)
-ftf_env.Append(CXXFLAGS = cxxflags)
-ftf_env.Append(CPPDEFINES = defines)
ftf_env.Append(CPPDEFINES = 'FTGL_STATIC_LIBRARY')
ftf_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/blender_FTF', source=source_files)
diff --git a/source/blender/imbuf/SConscript b/source/blender/imbuf/SConscript
index d3387380ecc..60910aa0ee4 100644
--- a/source/blender/imbuf/SConscript
+++ b/source/blender/imbuf/SConscript
@@ -1,14 +1,8 @@
-imbuf_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('extra_includes')
Import ('user_options_dict')
-imbuf_env.Append (CCFLAGS = cflags)
-imbuf_env.Append (CXXFLAGS = cxxflags)
-imbuf_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+imbuf_env = library_env.Copy ()
source_files = ['intern/allocimbuf.c',
'intern/amiga.c',
diff --git a/source/blender/img/SConscript b/source/blender/img/SConscript
index 99f8d84e97c..2ea4101e66c 100644
--- a/source/blender/img/SConscript
+++ b/source/blender/img/SConscript
@@ -1,13 +1,7 @@
-img_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-img_env.Append (CCFLAGS = cflags)
-img_env.Append (CXXFLAGS = cxxflags)
-img_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+img_env = library_env.Copy ()
source_files = ['intern/IMG_Api.cpp',
'intern/IMG_BrushRGBA32.cpp',
diff --git a/source/blender/inflate/SConscript b/source/blender/inflate/SConscript
index cca725d13e7..54d2ae487d4 100644
--- a/source/blender/inflate/SConscript
+++ b/source/blender/inflate/SConscript
@@ -1,15 +1,8 @@
-inflate_env = Environment ()
-# TODO: add the option to build with Quicktime
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('extra_includes')
Import ('user_options_dict')
-inflate_env.Append (CCFLAGS = cflags)
-inflate_env.Append (CXXFLAGS = cxxflags)
-inflate_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+inflate_env = library_env.Copy ()
source_files = ['intern/BLO_inflate.c']
diff --git a/source/blender/makesdna/SConscript b/source/blender/makesdna/SConscript
index a73336c1aed..793d36ff602 100644
--- a/source/blender/makesdna/SConscript
+++ b/source/blender/makesdna/SConscript
@@ -1,13 +1,7 @@
-makesdna_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-makesdna_env.Append (CCFLAGS = cflags)
-makesdna_env.Append (CXXFLAGS = cxxflags)
-makesdna_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+makesdna_env = library_env.Copy ()
objs = []
diff --git a/source/blender/makesdna/intern/SConscript b/source/blender/makesdna/intern/SConscript
index 5924dcb7eb3..85f339bc5fa 100644
--- a/source/blender/makesdna/intern/SConscript
+++ b/source/blender/makesdna/intern/SConscript
@@ -1,7 +1,6 @@
import sys
# Import the C flags set in the SConstruct file
Import ('cflags')
-Import ('cxxflags')
Import ('defines')
Import ('platform_libs')
Import ('platform_libpath')
@@ -29,8 +28,10 @@ makesdna_tool = Environment (CCFLAGS='-DBASE_HEADER="\\"source/blender/makesdna/
makesdna_tool.Append (CPPPATH = ['#/intern/guardedalloc',
'..'])
+makesdna_tool.Replace (CC = user_options_dict['HOST_CC'])
+makesdna_tool.Replace (PATH = user_options_dict['PATH'])
+
makesdna_tool.Append (CCFLAGS = cflags)
-makesdna_tool.Append (CXXFLAGS = cxxflags)
makesdna_tool.Append (CPPDEFINES = defines)
makesdna_tool.Append (LINKFLAGS = platform_linkflags)
makesdna_tool.Append (LIBPATH = '#'+user_options_dict['BUILD_DIR']+'/lib')
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript
index d8780a409ad..21cc9d558e9 100644
--- a/source/blender/python/SConscript
+++ b/source/blender/python/SConscript
@@ -1,14 +1,8 @@
-python_env = Environment ()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('extra_includes')
Import ('user_options_dict')
-python_env.Append (CCFLAGS = cflags)
-python_env.Append (CXXFLAGS = cxxflags)
-python_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+python_env = library_env.Copy ()
source_files = ['BPY_interface.c',
'BPY_menus.c',
@@ -45,8 +39,8 @@ source_files = ['BPY_interface.c',
'api2_2x/vector.c',
'api2_2x/constant.c',
'api2_2x/matrix.c',
- 'api2_2x/euler.c',
- 'api2_2x/quat.c',
+ 'api2_2x/euler.c',
+ 'api2_2x/quat.c',
'api2_2x/Mathutils.c',
'api2_2x/rgbTuple.c',
'api2_2x/gen_utils.c',
diff --git a/source/blender/quicktime/SConscript b/source/blender/quicktime/SConscript
index 07c22398fef..5a37d18b5ea 100644
--- a/source/blender/quicktime/SConscript
+++ b/source/blender/quicktime/SConscript
@@ -1,15 +1,10 @@
-quicktime_env = Environment ()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
Import ('extra_includes')
-Import ('defines')
Import ('user_options_dict')
-quicktime_env.Append (CCFLAGS = cflags)
-quicktime_env.Append (CXXFLAGS = cxxflags)
+Import ('library_env')
+
+quicktime_env = library_env.Copy ()
+
quicktime_env.Append (CPPPATH = extra_includes)
-quicktime_env.Append (CPPDEFINES = defines)
source_files = ['apple/quicktime_import.c',
'apple/quicktime_export.c']
diff --git a/source/blender/radiosity/SConscript b/source/blender/radiosity/SConscript
index 512d7dad0a4..2e7be6ae331 100644
--- a/source/blender/radiosity/SConscript
+++ b/source/blender/radiosity/SConscript
@@ -1,13 +1,7 @@
-rad_env = Environment ()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-rad_env.Append (CCFLAGS = cflags)
-rad_env.Append (CXXFLAGS = cxxflags)
-rad_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+rad_env = library_env.Copy ()
source_files = ['intern/source/raddisplay.c',
'intern/source/radfactors.c',
diff --git a/source/blender/readblenfile/SConscript b/source/blender/readblenfile/SConscript
index 4452b21f718..69671732055 100644
--- a/source/blender/readblenfile/SConscript
+++ b/source/blender/readblenfile/SConscript
@@ -1,13 +1,7 @@
-readblenfile_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-readblenfile_env.Append (CCFLAGS = cflags)
-readblenfile_env.Append (CXXFLAGS = cxxflags)
-readblenfile_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+readblenfile_env = library_env.Copy ()
source_files = ['intern/BLO_readblenfile.c']
diff --git a/source/blender/readstreamglue/SConscript b/source/blender/readstreamglue/SConscript
index a77806da21e..2a7484a766a 100644
--- a/source/blender/readstreamglue/SConscript
+++ b/source/blender/readstreamglue/SConscript
@@ -1,14 +1,8 @@
-readstrgl_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('extra_includes')
Import ('user_options_dict')
-readstrgl_env.Append (CCFLAGS = cflags)
-readstrgl_env.Append (CXXFLAGS = cxxflags)
-readstrgl_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+readstrgl_env = library_env.Copy ()
source_files = ['intern/BLO_readStreamGlue.c',
'intern/BLO_readStreamGlueLoopBack.c']
diff --git a/source/blender/render/SConscript b/source/blender/render/SConscript
index ea9d30a7003..5bce095ceb7 100644
--- a/source/blender/render/SConscript
+++ b/source/blender/render/SConscript
@@ -1,13 +1,7 @@
-render_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-render_env.Append (CCFLAGS = cflags)
-render_env.Append (CXXFLAGS = cxxflags)
-render_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+render_env = library_env.Copy ()
source_files = ['intern/source/RE_callbacks.c',
'intern/source/edgeRender.c',
diff --git a/source/blender/renderconverter/SConscript b/source/blender/renderconverter/SConscript
index 1cd12c181f9..5ab99c09b11 100644
--- a/source/blender/renderconverter/SConscript
+++ b/source/blender/renderconverter/SConscript
@@ -1,13 +1,7 @@
-renderconv_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-renderconv_env.Append (CCFLAGS = cflags)
-renderconv_env.Append (CXXFLAGS = cxxflags)
-renderconv_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+renderconv_env = library_env.Copy ()
source_files = ['intern/convertBlenderScene.c']
diff --git a/source/blender/src/SConscript b/source/blender/src/SConscript
index 4e434655059..c5586204b77 100644
--- a/source/blender/src/SConscript
+++ b/source/blender/src/SConscript
@@ -1,15 +1,9 @@
-src_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('extra_includes')
Import ('user_options_dict')
-src_env.Append (CCFLAGS = cflags)
+Import ('library_env')
+
+src_env = library_env.Copy ()
src_env.Append (CCFLAGS = user_options_dict['SDL_CFLAGS'])
-src_env.Append (CXXFLAGS = cxxflags)
-src_env.Append (CPPDEFINES = defines)
source_files = ['B.blend.c',
'Bfont.c',
diff --git a/source/blender/writeblenfile/SConscript b/source/blender/writeblenfile/SConscript
index 6a30c7df3aa..8e7efdaacf3 100644
--- a/source/blender/writeblenfile/SConscript
+++ b/source/blender/writeblenfile/SConscript
@@ -1,14 +1,8 @@
-wrblenfile_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('extra_includes')
Import ('user_options_dict')
-wrblenfile_env.Append (CCFLAGS = cflags)
-wrblenfile_env.Append (CXXFLAGS = cxxflags)
-wrblenfile_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+wrblenfile_env = library_env.Copy ()
source_files = ['intern/BLO_writeblenfile.c']
diff --git a/source/blender/writestreamglue/SConscript b/source/blender/writestreamglue/SConscript
index 0973f2714e0..1a41ecee12c 100644
--- a/source/blender/writestreamglue/SConscript
+++ b/source/blender/writestreamglue/SConscript
@@ -1,14 +1,8 @@
-wrstrgl_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('extra_includes')
Import ('user_options_dict')
-wrstrgl_env.Append (CCFLAGS = cflags)
-wrstrgl_env.Append (CXXFLAGS = cxxflags)
-wrstrgl_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+wrstrgl_env = library_env.Copy ()
source_files = ['intern/BLO_dumpFromMemory.c',
'intern/BLO_getPubKey.c',
diff --git a/source/blender/yafray/SConscript b/source/blender/yafray/SConscript
index 88cc6ff44bc..ad0f4c62c29 100644
--- a/source/blender/yafray/SConscript
+++ b/source/blender/yafray/SConscript
@@ -1,13 +1,7 @@
-yafray_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-yafray_env.Append (CCFLAGS = cflags)
-yafray_env.Append (CXXFLAGS = cxxflags)
-yafray_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+yafray_env = library_env.Copy ()
source_files = ['intern/yafray_Render.cpp',
'intern/export_File.cpp',
diff --git a/source/creator/SConscript b/source/creator/SConscript
index 6210f578af2..749fb6b75e2 100644
--- a/source/creator/SConscript
+++ b/source/creator/SConscript
@@ -1,12 +1,7 @@
-creator_env = Environment ()
-
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-creator_env.Append (CCFLAGS = cflags)
-creator_env.Append (CXXFLAGS = cxxflags)
-creator_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+creator_env = library_env.Copy ()
source_files = ['creator.c']
diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript
index bd6e42d1622..594f516dc77 100755
--- a/source/gameengine/BlenderRoutines/SConscript
+++ b/source/gameengine/BlenderRoutines/SConscript
@@ -1,13 +1,7 @@
-kx_blenderhook_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-kx_blenderhook_env.Append (CCFLAGS = cflags)
-kx_blenderhook_env.Append (CXXFLAGS = cxxflags)
-kx_blenderhook_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+kx_blenderhook_env = library_env.Copy ()
source_files = ['KX_BlenderSystem.cpp',
'KX_BlenderRenderTools.cpp',
diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript
index 81968e1f864..a488ce8e524 100755
--- a/source/gameengine/Converter/SConscript
+++ b/source/gameengine/Converter/SConscript
@@ -1,13 +1,7 @@
-kx_converter_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-kx_converter_env.Append (CCFLAGS = cflags)
-kx_converter_env.Append (CXXFLAGS = cxxflags)
-kx_converter_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+kx_converter_env = library_env.Copy ()
source_files = ['KX_IpoConvert.cpp',
'KX_ConvertSensors.cpp',
diff --git a/source/gameengine/Expressions/SConscript b/source/gameengine/Expressions/SConscript
index 4ee0e322cc5..a5d748e456c 100755
--- a/source/gameengine/Expressions/SConscript
+++ b/source/gameengine/Expressions/SConscript
@@ -1,13 +1,7 @@
-expressions_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-expressions_env.Append (CCFLAGS = cflags)
-expressions_env.Append (CXXFLAGS = cxxflags)
-expressions_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+expressions_env = library_env.Copy ()
source_files = ['BoolValue.cpp',
'ConstExpr.cpp',
diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript
index 5659b510552..3d086af749d 100755
--- a/source/gameengine/GameLogic/SConscript
+++ b/source/gameengine/GameLogic/SConscript
@@ -1,13 +1,7 @@
-sca_gamelogic_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-sca_gamelogic_env.Append (CCFLAGS = cflags)
-sca_gamelogic_env.Append (CXXFLAGS = cxxflags)
-sca_gamelogic_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+sca_gamelogic_env = library_env.Copy ()
source_files = ['SCA_ANDController.cpp',
'SCA_AlwaysEventManager.cpp',
diff --git a/source/gameengine/Ketsji/KXNetwork/SConscript b/source/gameengine/Ketsji/KXNetwork/SConscript
index 2f4be26cdf5..50d99d5099a 100755
--- a/source/gameengine/Ketsji/KXNetwork/SConscript
+++ b/source/gameengine/Ketsji/KXNetwork/SConscript
@@ -1,13 +1,7 @@
-kx_network_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-kx_network_env.Append (CCFLAGS = cflags)
-kx_network_env.Append (CXXFLAGS = cxxflags)
-kx_network_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+kx_network_env = library_env.Copy ()
source_files = ['KX_NetworkEventManager.cpp',
'KX_NetworkMessageActuator.cpp',
diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript
index 489d112ba5e..fddf4762013 100644
--- a/source/gameengine/Ketsji/SConscript
+++ b/source/gameengine/Ketsji/SConscript
@@ -1,13 +1,7 @@
-ketsji_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-ketsji_env.Append (CCFLAGS = cflags)
-ketsji_env.Append (CXXFLAGS = cxxflags)
-ketsji_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+ketsji_env = library_env.Copy ()
source_files = ['KX_WorldIpoController.cpp',
'KX_WorldInfo.cpp',
diff --git a/source/gameengine/Network/LoopBackNetwork/SConscript b/source/gameengine/Network/LoopBackNetwork/SConscript
index 65157902f48..2233a1820b2 100755
--- a/source/gameengine/Network/LoopBackNetwork/SConscript
+++ b/source/gameengine/Network/LoopBackNetwork/SConscript
@@ -1,13 +1,7 @@
-ng_loopbacknetwork_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-ng_loopbacknetwork_env.Append (CCFLAGS = cflags)
-ng_loopbacknetwork_env.Append (CXXFLAGS = cxxflags)
-ng_loopbacknetwork_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+ng_loopbacknetwork_env = library_env.Copy ()
source_files = ['NG_LoopBackNetworkDeviceInterface.cpp']
diff --git a/source/gameengine/Network/SConscript b/source/gameengine/Network/SConscript
index 15c42cae371..3b050bf779e 100755
--- a/source/gameengine/Network/SConscript
+++ b/source/gameengine/Network/SConscript
@@ -1,13 +1,7 @@
-ng_network_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-ng_network_env.Append (CCFLAGS = cflags)
-ng_network_env.Append (CXXFLAGS = cxxflags)
-ng_network_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+ng_network_env = library_env.Copy ()
source_files = ['NG_NetworkMessage.cpp',
'NG_NetworkObject.cpp',
diff --git a/source/gameengine/Physics/BlOde/SConscript b/source/gameengine/Physics/BlOde/SConscript
index 03be5c12b46..ff06d91423f 100755
--- a/source/gameengine/Physics/BlOde/SConscript
+++ b/source/gameengine/Physics/BlOde/SConscript
@@ -1,13 +1,7 @@
-phy_ode_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-phy_ode_env.Append (CCFLAGS = cflags)
-phy_ode_env.Append (CXXFLAGS = cxxflags)
-phy_ode_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+phy_ode_env = library_env.Copy ()
source_files = ['OdePhysicsController.cpp',
'OdePhysicsEnvironment.cpp']
diff --git a/source/gameengine/Physics/Dummy/SConscript b/source/gameengine/Physics/Dummy/SConscript
index 7d634918b38..80a1e78dd1d 100755
--- a/source/gameengine/Physics/Dummy/SConscript
+++ b/source/gameengine/Physics/Dummy/SConscript
@@ -1,13 +1,7 @@
-phy_dummy_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-phy_dummy_env.Append (CCFLAGS = cflags)
-phy_dummy_env.Append (CXXFLAGS = cxxflags)
-phy_dummy_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+phy_dummy_env = library_env.Copy ()
source_files = ['DummyPhysicsEnvironment.cpp']
diff --git a/source/gameengine/Physics/Sumo/SConscript b/source/gameengine/Physics/Sumo/SConscript
index 556b470f60e..c58e98ca4ce 100755
--- a/source/gameengine/Physics/Sumo/SConscript
+++ b/source/gameengine/Physics/Sumo/SConscript
@@ -1,14 +1,7 @@
-phy_sumo_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
-Import ('solid_include')
Import ('user_options_dict')
-phy_sumo_env.Append (CCFLAGS = cflags)
-phy_sumo_env.Append (CXXFLAGS = cxxflags)
-phy_sumo_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+phy_sumo_env = library_env.Copy ()
source_files = ['SumoPhysicsController.cpp',
'SumoPhysicsEnvironment.cpp',
@@ -19,8 +12,9 @@ source_files = ['SumoPhysicsController.cpp',
phy_sumo_env.Append (CPPPATH = ['.',
'../common',
'Fuzzics/include',
- solid_include,
'#/intern/moto/include'
])
+phy_sumo_env.Append (CPPPATH = user_options_dict['solid_include'])
+
phy_sumo_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/PHY_Sumo', source=source_files)
diff --git a/source/gameengine/Physics/common/SConscript b/source/gameengine/Physics/common/SConscript
index 016f06b39d3..07a1cea766b 100755
--- a/source/gameengine/Physics/common/SConscript
+++ b/source/gameengine/Physics/common/SConscript
@@ -1,13 +1,7 @@
-phy_physics_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-phy_physics_env.Append (CCFLAGS = cflags)
-phy_physics_env.Append (CXXFLAGS = cxxflags)
-phy_physics_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+phy_physics_env = library_env.Copy ()
source_files = ['PHY_IMotionState.cpp',
'PHY_IPhysicsController.cpp',
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
index 88747440ed7..003ddbf404e 100755
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
@@ -1,13 +1,7 @@
-ras_openglrasterizer_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-ras_openglrasterizer_env.Append (CCFLAGS = cflags)
-ras_openglrasterizer_env.Append (CXXFLAGS = cxxflags)
-ras_openglrasterizer_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+ras_openglrasterizer_env = library_env.Copy ()
source_files = ['RAS_CheckVertexArrays.cpp',
'RAS_OpenGLRasterizer.cpp',
diff --git a/source/gameengine/Rasterizer/SConscript b/source/gameengine/Rasterizer/SConscript
index b27992e6b5c..41cf80df144 100755
--- a/source/gameengine/Rasterizer/SConscript
+++ b/source/gameengine/Rasterizer/SConscript
@@ -1,13 +1,7 @@
-ras_rasterizer_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-ras_rasterizer_env.Append (CCFLAGS = cflags)
-ras_rasterizer_env.Append (CXXFLAGS = cxxflags)
-ras_rasterizer_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+ras_rasterizer_env = library_env.Copy ()
source_files = ['RAS_BucketManager.cpp',
'RAS_FramingManager.cpp',
diff --git a/source/gameengine/SceneGraph/SConscript b/source/gameengine/SceneGraph/SConscript
index 4e98000a36c..3782d60d828 100755
--- a/source/gameengine/SceneGraph/SConscript
+++ b/source/gameengine/SceneGraph/SConscript
@@ -1,13 +1,7 @@
-sg_scenegraph_env = Environment()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-sg_scenegraph_env.Append (CCFLAGS = cflags)
-sg_scenegraph_env.Append (CXXFLAGS = cxxflags)
-sg_scenegraph_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+sg_scenegraph_env = library_env.Copy ()
source_files = ['SG_Controller.cpp',
'SG_IObject.cpp',
diff --git a/source/kernel/SConscript b/source/kernel/SConscript
index 88e968b66c6..d9d8f914cf5 100644
--- a/source/kernel/SConscript
+++ b/source/kernel/SConscript
@@ -1,13 +1,7 @@
-kernel_env = Environment ()
-
-# Import the C flags set in the SConstruct file
-Import ('cflags')
-Import ('cxxflags')
-Import ('defines')
Import ('user_options_dict')
-kernel_env.Append (CCFLAGS = cflags)
-kernel_env.Append (CXXFLAGS = cxxflags)
-kernel_env.Append (CPPDEFINES = defines)
+Import ('library_env')
+
+kernel_env = library_env.Copy ()
source_files = ['gen_messaging/intern/messaging.c',
'gen_system/GEN_HashedPtr.cpp',