From 0cfd37f0c9a5ae801c8c53a5c5d81f03a02098fb Mon Sep 17 00:00:00 2001 From: xatmes <> Date: Tue, 22 May 2007 01:20:06 +0000 Subject: [PATCH] SConstruct: Added conditions to add compiler/linker flags from user's environemn t if they have any set. --- CHANGELOG.txt | 4 ++++ SConstruct | 24 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 307fb69f8..1cacde20e 100755 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D2X-Rebirth Changelog +20070522 +-------- +SConstruct: Added conditions to add compiler/linker flags from user's environemnt if they have any set. + 20070521 -------- ui/window.c: use new 3 argument mouse_get_delta to avoid compiler errors diff --git a/SConstruct b/SConstruct index e0a4a9875..1d5e86c38 100644 --- a/SConstruct +++ b/SConstruct @@ -3,6 +3,7 @@ # needed imports import sys import os +import SCons.Util PROGRAM_NAME = 'D2X-Rebirth' @@ -325,6 +326,18 @@ env.Append(CPPPATH = ['include', 'main', 'arch/include']) generic_libs = ['SDL', 'physfs'] sdlmixerlib = ['SDL_mixer'] +# Get traditional compiler environment variables +if os.environ.has_key('CC'): + env['CC'] = os.environ['CC'] +if os.environ.has_key('CFLAGS'): + env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS']) +if os.environ.has_key('CXX'): + env['CXX'] = os.environ['CXX'] +if os.environ.has_key('CXXFLAGS'): + env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS']) +if os.environ.has_key('LDFLAGS'): + env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS']) + # windows or *nix? if sys.platform == 'win32': print "compiling on Windows" @@ -493,6 +506,15 @@ Help(PROGRAM_NAME + ', SConstruct file help:' + 'gp2x=1' compile for GP2X handheld Default values: - """ + ' sharepath = ' + DATA_DIR + '\n') + """ + ' sharepath = ' + DATA_DIR + """ + Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + + CXX C++ compiler command + CXXFLAGS C++ compiler flags + """) #EOF