diff options
author | Bjoern B. Brandenburg <bbb@koruna.cs.unc.edu> | 2009-03-25 20:52:40 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@koruna.cs.unc.edu> | 2009-03-25 20:52:40 -0400 |
commit | 8ce85aaacafa0a46827f7799d051a20fac639ee9 (patch) | |
tree | d17c1421ba1d416dac444e6498995ddbc9fb2a9a | |
parent | 1cf9e8f4da7133d657b369adf5b38bed1dd02834 (diff) |
cleanup the setting of architecture-dependent flags
This change moves all flags into the config section instead of hiding them below.
-rw-r--r-- | SConstruct | 29 |
1 files changed, 17 insertions, 12 deletions
@@ -6,6 +6,15 @@ LITMUS_KERNEL = '../litmus2008' | |||
6 | # Internal configuration. | 6 | # Internal configuration. |
7 | DEBUG_FLAGS = '-Wall -g -Wdeclaration-after-statement' | 7 | DEBUG_FLAGS = '-Wall -g -Wdeclaration-after-statement' |
8 | API_FLAGS = '-D_XOPEN_SOURCE=600 -D_GNU_SOURCE' | 8 | API_FLAGS = '-D_XOPEN_SOURCE=600 -D_GNU_SOURCE' |
9 | X86_32_FLAGS = '-m32' | ||
10 | X86_64_FLAGS = '-m64' | ||
11 | V9_FLAGS = '-mcpu=v9 -m64' | ||
12 | SUPPORTED_ARCHS = { | ||
13 | 'sparc64' : V9_FLAGS, | ||
14 | 'i686' : X86_32_FLAGS, | ||
15 | 'i386' : X86_32_FLAGS, | ||
16 | 'x86_64' : X86_64_FLAGS, | ||
17 | } | ||
9 | 18 | ||
10 | KERNEL_INCLUDE = '%s/include/' % LITMUS_KERNEL | 19 | KERNEL_INCLUDE = '%s/include/' % LITMUS_KERNEL |
11 | INCLUDE_DIRS = 'include/ ' + KERNEL_INCLUDE | 20 | INCLUDE_DIRS = 'include/ ' + KERNEL_INCLUDE |
@@ -42,27 +51,23 @@ if 'ARCH' in ARGUMENTS: | |||
42 | elif 'ARCH' in environ: | 51 | elif 'ARCH' in environ: |
43 | arch = environ['ARCH'] | 52 | arch = environ['ARCH'] |
44 | 53 | ||
45 | if not GetOption('clean') and arch not in ('sparc64', 'i686', 'x86', 'i386'): | 54 | if arch not in SUPPORTED_ARCHS: |
46 | print 'Error: Building liblitmus is only supported on i686 and sparc64.' | 55 | print 'Error: Building ft_tools is only supported for the following', \ |
56 | 'architectures: %s.' % ', '.join(sorted(SUPPORTED_ARCHS)) | ||
47 | Exit(1) | 57 | Exit(1) |
58 | else: | ||
59 | arch_flags = Split(SUPPORTED_ARCHS[arch]) | ||
48 | 60 | ||
49 | env = Environment( | 61 | env = Environment( |
50 | CC = 'gcc', | 62 | CC = 'gcc', |
51 | CPPPATH = Split(INCLUDE_DIRS), | 63 | CPPPATH = Split(INCLUDE_DIRS), |
52 | CCFLAGS = Split(DEBUG_FLAGS) + Split(API_FLAGS) | 64 | CCFLAGS = Split(DEBUG_FLAGS) + Split(API_FLAGS) + arch_flags, |
65 | LINKFLAGS = arch_flags, | ||
53 | ) | 66 | ) |
54 | 67 | ||
55 | if arch == 'sparc64': | ||
56 | # build 64 bit sparc v9 binaries | ||
57 | v9 = Split('-mcpu=v9 -m64') | ||
58 | env.Append(CCFLAGS = v9, LINKFLAGS = v9) | ||
59 | |||
60 | if arch in ('i386', 'x86', 'i686'): | ||
61 | x86flags = Split('-m32') | ||
62 | env.Append(CCFLAGS = x86flags, LINKFLAGS = x86flags) | ||
63 | |||
64 | # Check compile environment | 68 | # Check compile environment |
65 | if not env.GetOption('clean'): | 69 | if not env.GetOption('clean'): |
70 | print 'Building %s binaries.' % arch | ||
66 | # Check for kernel headers. | 71 | # Check for kernel headers. |
67 | conf = Configure(env, custom_tests = {'CheckASMLink' : CheckASMLink}) | 72 | conf = Configure(env, custom_tests = {'CheckASMLink' : CheckASMLink}) |
68 | if not conf.CheckCHeader('litmus/rt_param.h'): | 73 | if not conf.CheckCHeader('litmus/rt_param.h'): |