1 | # |
---|
2 | # RTEMS Linker build script. |
---|
3 | # |
---|
4 | import sys |
---|
5 | |
---|
6 | version_major = 1 |
---|
7 | version_minor = 0 |
---|
8 | version_revision = 0 |
---|
9 | |
---|
10 | def options(opt): |
---|
11 | opt.load('compiler_c') |
---|
12 | opt.load('compiler_cxx') |
---|
13 | |
---|
14 | def configure(conf): |
---|
15 | conf.load('compiler_c') |
---|
16 | conf.load('compiler_cxx') |
---|
17 | |
---|
18 | conf.env.C_OPTS = conf.options.c_opts.split(',') |
---|
19 | conf.env.RTEMS_VERSION = conf.options.rtems_version |
---|
20 | conf.write_config_header('config.h') |
---|
21 | |
---|
22 | def build(bld): |
---|
23 | # |
---|
24 | # Build the doxygen documentation. |
---|
25 | # |
---|
26 | if bld.cmd == 'doxy': |
---|
27 | bld(features = 'doxygen', |
---|
28 | doxyfile = 'rtl-host.conf') |
---|
29 | return |
---|
30 | |
---|
31 | # |
---|
32 | # The local configuration. |
---|
33 | # |
---|
34 | conf = {} |
---|
35 | |
---|
36 | # |
---|
37 | # Build flags. |
---|
38 | # |
---|
39 | rtemstoolkit = '../rtemstoolkit' |
---|
40 | conf['includes'] = [rtemstoolkit, |
---|
41 | rtemstoolkit + '/elftoolchain/libelf', |
---|
42 | rtemstoolkit + '/elftoolchain/common', |
---|
43 | rtemstoolkit + '/libiberty'] |
---|
44 | if bld.env.DEST_OS == 'win32': |
---|
45 | conf['includes'] += [rtemstoolkit + '/win32'] |
---|
46 | conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic'] |
---|
47 | conf['optflags'] = bld.env.C_OPTS |
---|
48 | conf['cflags'] = ['-pipe', '-g'] + conf['optflags'] |
---|
49 | conf['cxxflags'] = ['-pipe', '-g'] + conf['optflags'] |
---|
50 | conf['linkflags'] = ['-g'] |
---|
51 | |
---|
52 | # |
---|
53 | # The list of modules. |
---|
54 | # |
---|
55 | modules = ['rld', 'elf', 'iberty'] |
---|
56 | |
---|
57 | # |
---|
58 | # Build the linker. |
---|
59 | # |
---|
60 | bld.program(target = 'rtems-ld', |
---|
61 | source = ['rtems-ld.cpp'], |
---|
62 | defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION], |
---|
63 | includes = ['.'] + conf['includes'], |
---|
64 | cflags = conf['cflags'] + conf['warningflags'], |
---|
65 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
66 | linkflags = conf['linkflags'], |
---|
67 | use = modules) |
---|
68 | |
---|
69 | # |
---|
70 | # Build the ra linker. |
---|
71 | # |
---|
72 | bld.program(target = 'rtems-ra', |
---|
73 | source = ['rtems-ra.cpp'], |
---|
74 | defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION], |
---|
75 | includes = ['.'] + conf['includes'], |
---|
76 | cflags = conf['cflags'] + conf['warningflags'], |
---|
77 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
78 | linkflags = conf['linkflags'], |
---|
79 | use = modules) |
---|
80 | |
---|
81 | # |
---|
82 | # Build the trace linker. |
---|
83 | # |
---|
84 | bld.program(target = 'rtems-tld', |
---|
85 | source = ['rtems-tld.cpp'], |
---|
86 | defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION], |
---|
87 | includes = ['.'] + conf['includes'], |
---|
88 | cflags = conf['cflags'] + conf['warningflags'], |
---|
89 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
90 | linkflags = conf['linkflags'], |
---|
91 | use = modules) |
---|
92 | bld.install_files('${PREFIX}/share/rtems/trace-linker', |
---|
93 | ['libc.ini', |
---|
94 | 'libc-heap.ini', |
---|
95 | 'rtems.ini', |
---|
96 | 'rtems-api.ini', |
---|
97 | 'rtems-posix.ini', |
---|
98 | 'rtems-score.ini', |
---|
99 | 'rtems-score-object.ini', |
---|
100 | 'rtems-score-thread.ini', |
---|
101 | 'rtems-score-heap.ini', |
---|
102 | 'rtems-score-coremutex.ini', |
---|
103 | 'rtld-base.ini', |
---|
104 | 'rtld-trace-buffer.ini', |
---|
105 | 'rtld-print.ini']) |
---|
106 | |
---|
107 | # |
---|
108 | # Build the symbols. |
---|
109 | # |
---|
110 | bld.program(target = 'rtems-syms', |
---|
111 | source = ['rtems-syms.cpp'], |
---|
112 | defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION], |
---|
113 | includes = ['.'] + conf['includes'], |
---|
114 | cflags = conf['cflags'] + conf['warningflags'], |
---|
115 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
116 | linkflags = conf['linkflags'], |
---|
117 | use = modules) |
---|
118 | |
---|
119 | # |
---|
120 | # Build the RAP utility. |
---|
121 | # |
---|
122 | bld.program(target = 'rtems-rap', |
---|
123 | source = ['rtems-rapper.cpp'], |
---|
124 | defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION], |
---|
125 | includes = ['.'] + conf['includes'], |
---|
126 | cflags = conf['cflags'] + conf['warningflags'], |
---|
127 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
128 | linkflags = conf['linkflags'], |
---|
129 | use = modules) |
---|
130 | |
---|
131 | def tags(ctx): |
---|
132 | ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True) |
---|