summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLogan Chien <loganchien@google.com>2011-11-25 08:33:31 +0800
committerLogan Chien <loganchien@google.com>2011-11-25 08:33:31 +0800
commitd0a50547516df5893ea80cc335498d703f8db221 (patch)
treed60f49642e02735b3e047846fddf4a9c8fb53e7a
parente377572f9ab49b27dda7dabbd9123d4d7a4950ed (diff)
downloadlinkloader-d0a50547516df5893ea80cc335498d703f8db221.tar.gz
Update standalone build script for cross compilation.
Change-Id: If2af6f23625c4e1250cfc59cabd7fc620ba83773
-rw-r--r--SConstruct25
1 files changed, 22 insertions, 3 deletions
diff --git a/SConstruct b/SConstruct
index 7a61f44..03a47d3 100644
--- a/SConstruct
+++ b/SConstruct
@@ -35,12 +35,25 @@ toolsets = {
'CXX': 'g++',
},
+ 'mips-gcc': {
+ 'CC': 'mips-linux-gnu-gcc',
+ 'CXX': 'mips-linux-gnu-g++',
+ },
+
'clang': {
'CC': 'clang',
'CXX': 'clang++',
},
}
+toolset_configs = {
+ 'gcc': { 'CFLAGS': [], 'CXXFLAGS': [], 'LDFLAGS': [] },
+ 'clang': { 'CFLAGS': [], 'CXXFLAGS': [], 'LDFLAGS': [] },
+ 'mips-gcc': { 'CFLAGS': ['-EL', '-mips32r2'],
+ 'CXXFLAGS': ['-EL', '-mips32r2'],
+ 'LDFLAGS': ['-EL', '-mips32r2'] }
+}
+
mode = ARGUMENTS.get('mode', 'release')
toolset = ARGUMENTS.get('toolset', 'gcc')
@@ -54,19 +67,25 @@ if not toolset in toolsets:
build_config = configs[mode]
build_toolset = toolsets[toolset]
+build_toolset_config = toolset_configs[toolset]
print '===> BUILDING IN', mode.upper(), 'MODE ...'
import os
+cflags = build_config['CFLAGS'] + build_toolset_config['CFLAGS']
+cxxflags = build_config['CXXFLAGS'] + build_toolset_config['CXXFLAGS']
+linkflags = build_toolset_config['LDFLAGS']
+
env = Environment(CC=build_toolset['CC'],
CXX=build_toolset['CXX'],
- CFLAGS=build_config['CFLAGS'],
- CXXFLAGS=build_config['CXXFLAGS'],
+ CFLAGS=cflags,
+ CXXFLAGS=cxxflags,
+ LINKFLAGS=linkflags,
CPPPATH=['.', 'include'],
ENV={'PATH': os.environ['PATH']})
-env.ParseConfig('llvm-config --cxxflags --ldflags --libs support')
+env.ParseConfig('llvm-config-2 --cxxflags --ldflags --libs support')
env.Program('rsloader',
source=['lib/ELFHeader.cpp',