aboutsummaryrefslogtreecommitdiffstats
path: root/SConstruct
blob: cf18b319f67f1f8a14711f003c0f305975f432dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# #####################################################################
# User configuration.
LITMUS_KERNEL = '../litmus2008'

# #####################################################################
# Internal configuration.
DEBUG_FLAGS  = '-Wall -g -Wdeclaration-after-statement'
API_FLAGS    = '-D_XOPEN_SOURCE=600 -D_GNU_SOURCE'

INCLUDE_DIRS = 'include/  %s/include/' % LITMUS_KERNEL

# #####################################################################
# Build configuration.
from os import uname

# sanity check
(os, _, _, _, arch) = uname()
if os != 'Linux':
    print 'Error: Building liblitmus is only supported on Linux.'
    Exit(1)

if arch not in ('sparc64', 'i686'):
    print 'Error: Building liblitmus is only supported on i686 and sparc64.'
    Exit(1)

env = Environment(
    CC = 'gcc',
    CPPPATH = Split(INCLUDE_DIRS),
    CCFLAGS = Split(DEBUG_FLAGS) + Split(API_FLAGS)
)

if arch == 'sparc64':
    # build 64 bit sparc v9 binaries
    env.Append(CCFLAGS = Split('-mcpu=v9 -m64'))

# link with lib libtmus
rt = env.Clone(
    LIBS     = 'litmus',
    LIBPATH  = '.'
)
rt.Append(LINKFLAGS = '-static')

# multithreaded real-time tasks
mtrt = rt.Clone()
mtrt.Append(LINKFLAGS = '-pthread')


# #####################################################################
# Targets: liblitmus
# All the files in src/ are part of the library.
env.Library('litmus', Glob('src/*.c'))

# #####################################################################
# Targets: simple tools that do not depend on liblitmus
env.Program('cycles', 'bin/cycles.c')

# #####################################################################
# Targets: tools that depend on liblitmus
rt.Program('base_task', 'bin/base_task.c')
mtrt.Program('base_mt_task', 'bin/base_mt_task.c')
rt.Program('wait_test', 'bin/wait_test.c')
rt.Program('mode_test', 'bin/mode_test.c')
rt.Program('np_test', 'bin/np_test.c')
rt.Program('rt_launch', ['bin/rt_launch.c', 'bin/common.c'])
rt.Program('rtspin', ['bin/rtspin.c', 'bin/common.c'])
rt.Program('release_ts', 'bin/release_ts.c')
rt.Program('showst', 'bin/showst.c')