1 | # |
---|
2 | # RTEMS Tools Project (http://www.rtems.org/) |
---|
3 | # Copyright 2014-2016 Chris Johns (chrisj@rtems.org) |
---|
4 | # All rights reserved. |
---|
5 | # |
---|
6 | # This file is part of the RTEMS Tools package in 'rtems-tools'. |
---|
7 | # |
---|
8 | # Permission to use, copy, modify, and/or distribute this software for any |
---|
9 | # purpose with or without fee is hereby granted, provided that the above |
---|
10 | # copyright notice and this permission notice appear in all copies. |
---|
11 | # |
---|
12 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
---|
13 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
---|
14 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
---|
15 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
---|
16 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
---|
17 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
---|
18 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
---|
19 | # |
---|
20 | |
---|
21 | # |
---|
22 | # RTEMS Linker build script. |
---|
23 | # |
---|
24 | import sys |
---|
25 | |
---|
26 | def init(ctx): |
---|
27 | pass |
---|
28 | |
---|
29 | def options(opt): |
---|
30 | opt.load('compiler_c') |
---|
31 | opt.load('compiler_cxx') |
---|
32 | |
---|
33 | def configure(conf): |
---|
34 | conf.load('compiler_c') |
---|
35 | conf.load('compiler_cxx') |
---|
36 | |
---|
37 | conf.write_config_header('config.h') |
---|
38 | |
---|
39 | def build(bld): |
---|
40 | # |
---|
41 | # Build the doxygen documentation. |
---|
42 | # |
---|
43 | if bld.cmd == 'doxy': |
---|
44 | bld(features = 'doxygen', |
---|
45 | doxyfile = 'rtl-host.conf') |
---|
46 | return |
---|
47 | |
---|
48 | # |
---|
49 | # The local configuration. |
---|
50 | # |
---|
51 | conf = {} |
---|
52 | |
---|
53 | # |
---|
54 | # Build flags. |
---|
55 | # |
---|
56 | rtemstoolkit = '../rtemstoolkit' |
---|
57 | conf['includes'] = [rtemstoolkit, |
---|
58 | rtemstoolkit + '/elftoolchain/libelf', |
---|
59 | rtemstoolkit + '/elftoolchain/common', |
---|
60 | rtemstoolkit + '/libiberty'] |
---|
61 | if bld.env.DEST_OS == 'win32': |
---|
62 | conf['includes'] += [rtemstoolkit + '/win32'] |
---|
63 | conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic'] |
---|
64 | conf['optflags'] = bld.env.C_OPTS |
---|
65 | conf['cflags'] = ['-pipe', '-g'] + conf['optflags'] |
---|
66 | conf['cxxflags'] = ['-pipe', '-g'] + conf['optflags'] |
---|
67 | conf['linkflags'] = ['-g'] |
---|
68 | |
---|
69 | # |
---|
70 | # The list of modules. |
---|
71 | # |
---|
72 | modules = ['rld', 'elf', 'iberty'] |
---|
73 | |
---|
74 | # |
---|
75 | # The list of defines |
---|
76 | # |
---|
77 | defines = ['HAVE_CONFIG_H=1', |
---|
78 | 'RTEMS_VERSION=\"%s\"' % (bld.env.RTEMS_VERSION), |
---|
79 | 'RTEMS_RELEASE=\"%s\"' % (bld.env.RTEMS_RELEASE)] |
---|
80 | |
---|
81 | # |
---|
82 | # Build the linker. |
---|
83 | # |
---|
84 | bld.program(target = 'rtems-ld', |
---|
85 | source = ['rtems-ld.cpp'], |
---|
86 | defines = defines, |
---|
87 | includes = ['.'] + conf['includes'], |
---|
88 | cflags = conf['cflags'] + conf['warningflags'], |
---|
89 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
90 | linkflags = conf['linkflags'], |
---|
91 | use = modules) |
---|
92 | |
---|
93 | # |
---|
94 | # Build the ra linker. |
---|
95 | # |
---|
96 | bld.program(target = 'rtems-ra', |
---|
97 | source = ['rtems-ra.cpp'], |
---|
98 | defines = defines, |
---|
99 | includes = ['.'] + conf['includes'], |
---|
100 | cflags = conf['cflags'] + conf['warningflags'], |
---|
101 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
102 | linkflags = conf['linkflags'], |
---|
103 | use = modules) |
---|
104 | |
---|
105 | # |
---|
106 | # Build the trace linker. |
---|
107 | # |
---|
108 | bld.program(target = 'rtems-tld', |
---|
109 | source = ['rtems-tld.cpp'], |
---|
110 | defines = defines, |
---|
111 | includes = ['.'] + conf['includes'], |
---|
112 | cflags = conf['cflags'] + conf['warningflags'], |
---|
113 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
114 | linkflags = conf['linkflags'], |
---|
115 | use = modules) |
---|
116 | bld.install_files('${PREFIX}/share/rtems/trace-linker', |
---|
117 | ['libc.ini', |
---|
118 | 'libc-heap.ini', |
---|
119 | 'rtems.ini', |
---|
120 | 'rtems-api.ini', |
---|
121 | 'rtems-posix.ini', |
---|
122 | 'rtems-score.ini', |
---|
123 | 'rtems-score-object.ini', |
---|
124 | 'rtems-score-thread.ini', |
---|
125 | 'rtems-score-heap.ini', |
---|
126 | 'rtems-score-coremutex.ini', |
---|
127 | 'rtld-base.ini', |
---|
128 | 'rtld-trace-buffer.ini', |
---|
129 | 'rtld-print.ini']) |
---|
130 | |
---|
131 | # |
---|
132 | # Build the symbols. |
---|
133 | # |
---|
134 | bld.program(target = 'rtems-syms', |
---|
135 | source = ['rtems-syms.cpp'], |
---|
136 | defines = defines, |
---|
137 | includes = ['.'] + conf['includes'], |
---|
138 | cflags = conf['cflags'] + conf['warningflags'], |
---|
139 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
140 | linkflags = conf['linkflags'], |
---|
141 | use = modules) |
---|
142 | |
---|
143 | # |
---|
144 | # Build the RAP utility. |
---|
145 | # |
---|
146 | bld.program(target = 'rtems-rap', |
---|
147 | source = ['rtems-rapper.cpp'], |
---|
148 | defines = defines, |
---|
149 | includes = ['.'] + conf['includes'], |
---|
150 | cflags = conf['cflags'] + conf['warningflags'], |
---|
151 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
152 | linkflags = conf['linkflags'], |
---|
153 | use = modules) |
---|
154 | |
---|
155 | # |
---|
156 | # Build the EXE information tool. |
---|
157 | # |
---|
158 | bld.program(target = 'rtems-exeinfo', |
---|
159 | source = ['rtems-exeinfo.cpp'], |
---|
160 | defines = defines, |
---|
161 | includes = ['.'] + conf['includes'], |
---|
162 | cflags = conf['cflags'] + conf['warningflags'], |
---|
163 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
164 | linkflags = conf['linkflags'], |
---|
165 | use = modules) |
---|
166 | |
---|
167 | def tags(ctx): |
---|
168 | ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True) |
---|