summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2008-06-04 23:57:55 +0900
committerJosé Fonseca <[email protected]>2008-06-04 23:58:45 +0900
commit113ab51a8cf767cc95bdc9f6faea6956e17c1da7 (patch)
tree1dfa9bf26d9585fb653a326f116a4a918ec7672c
parent5c9c6b0d2398715d035e939eb8672ed7e95cfec5 (diff)
scons: Some provisions to cross-compile x86 on x86_64 machines and vice-versa.
-rw-r--r--common.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/common.py b/common.py
index b6251d3960d..c82f3026ddb 100644
--- a/common.py
+++ b/common.py
@@ -226,6 +226,10 @@ def generate(env):
cflags += ['-O3', '-g3']
if env['profile']:
cflags += ['-pg']
+ if env['machine'] == 'x86' and default_machine == 'x86_64':
+ cflags += ['-m32']
+ if env['machine'] == 'x86_64' and default_machine == 'x86':
+ cflags += ['-m64']
cflags += [
'-Wall',
'-Wmissing-prototypes',
@@ -293,10 +297,16 @@ def generate(env):
env.Append(CXXFLAGS = cflags)
# Linker options
+ linkflags = []
+ if gcc:
+ if env['machine'] == 'x86' and default_machine == 'x86_64':
+ linkflags += ['-m32']
+ if env['machine'] == 'x86_64' and default_machine == 'x86':
+ linkflags += ['-m64']
if platform == 'winddk':
# See also:
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
- env.Append(LINKFLAGS = [
+ linkflags += [
'/merge:_PAGE=PAGE',
'/merge:_TEXT=.text',
'/section:INIT,d',
@@ -322,7 +332,8 @@ def generate(env):
'/base:0x10000',
'/entry:DrvEnableDriver',
- ])
+ ]
+ env.Append(LINKFLAGS = linkflags)
createConvenienceLibBuilder(env)