summaryrefslogtreecommitdiff
path: root/linkers/wscript
blob: 5dd151caa9877c25c8b4d48bc464e72d39e45eeb (plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#
# RTEMS Linker build script.
#
import sys

version_major = 1
version_minor = 0
version_revision = 0

def options(opt):
    opt.load("g++")
    opt.load("gcc")

def configure(conf):
    conf.load("g++")
    conf.load("gcc")

    conf.env.C_OPTS = conf.options.c_opts.split(',')
    conf.env.RTEMS_VERSION = conf.options.rtems_version
    conf.write_config_header('config.h')

def build(bld):
    #
    # Build the doxygen documentation.
    #
    if bld.cmd == 'doxy':
        bld(features = 'doxygen',
            doxyfile = 'rtl-host.conf')
        return

    #
    # The local configuration.
    #
    conf = {}

    #
    # Build flags.
    #
    rtemstoolkit = '../rtemstoolkit'
    conf['includes'] = [rtemstoolkit,
                        rtemstoolkit + '/elftoolchain/libelf',
                        rtemstoolkit + '/elftoolchain/common',
                        rtemstoolkit + '/libiberty']
    conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic']
    conf['optflags'] = bld.env.C_OPTS
    conf['cflags'] = ['-pipe', '-g'] + conf['optflags']
    conf['cxxflags'] = ['-pipe', '-g'] + conf['optflags']
    conf['linkflags'] = ['-g']

    #
    # The list of modules.
    #
    modules = ['rld', 'fastlz', 'elf', 'iberty']

    #
    # Build the linker.
    #
    bld.program(target = 'rtems-ld',
                source = ['rtems-ld.cpp'],
                defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION],
                includes = ['.'] + conf['includes'],
                cflags = conf['cflags'] + conf['warningflags'],
                cxxflags = conf['cxxflags'] + conf['warningflags'],
                linkflags = conf['linkflags'],
                use = modules)

    #
    # Build the ra linker.
    #
    bld.program(target = 'rtems-ra',
                source = ['rtems-ra.cpp'],
                defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION],
                includes = ['.'] + conf['includes'],
                cflags = conf['cflags'] + conf['warningflags'],
                cxxflags = conf['cxxflags'] + conf['warningflags'],
                linkflags = conf['linkflags'],
                use = modules)

    #
    # Build the trace linker.
    #
    bld.program(target = 'rtems-tld',
                source = ['rtems-tld.cpp'],
                defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION],
                includes = ['.'] + conf['includes'],
                cflags = conf['cflags'] + conf['warningflags'],
                cxxflags = conf['cxxflags'] + conf['warningflags'],
                linkflags = conf['linkflags'],
                use = modules)
    bld.install_files('${PREFIX}/share/rtems/trace-linker',
                      ['rtems.ini', 'rtld-base.ini'])

    #
    # Build the symbols.
    #
    bld.program(target = 'rtems-syms',
                source = ['rtems-syms.cpp'],
                defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION],
                includes = ['.'] + conf['includes'],
                cflags = conf['cflags'] + conf['warningflags'],
                cxxflags = conf['cxxflags'] + conf['warningflags'],
                linkflags = conf['linkflags'],
                use = modules)

    #
    # Build the RAP utility.
    #
    bld.program(target = 'rtems-rap',
                source = ['rtems-rapper.cpp'],
                defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION],
                includes = ['.'] + conf['includes'],
                cflags = conf['cflags'] + conf['warningflags'],
                cxxflags = conf['cxxflags'] + conf['warningflags'],
                linkflags = conf['linkflags'],
                use = modules)

def tags(ctx):
    ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True)