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