1 | # |
---|
2 | # RTEMS Tools Project (http://www.rtems.org/) |
---|
3 | # Copyright 2014, 2015 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 | # Redistribution and use in source and binary forms, with or without |
---|
9 | # modification, are permitted provided that the following conditions are met: |
---|
10 | # |
---|
11 | # 1. Redistributions of source code must retain the above copyright notice, |
---|
12 | # this list of conditions and the following disclaimer. |
---|
13 | # |
---|
14 | # 2. Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | # this list of conditions and the following disclaimer in the documentation |
---|
16 | # and/or other materials provided with the distribution. |
---|
17 | # |
---|
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
21 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
---|
22 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
23 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
24 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
25 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
26 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
27 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
28 | # POSSIBILITY OF SUCH DAMAGE. |
---|
29 | # |
---|
30 | |
---|
31 | # |
---|
32 | # RTEMS Linker build script. |
---|
33 | # |
---|
34 | import sys |
---|
35 | |
---|
36 | def init(ctx): |
---|
37 | pass |
---|
38 | |
---|
39 | def options(opt): |
---|
40 | opt.load('compiler_c') |
---|
41 | opt.load('compiler_cxx') |
---|
42 | |
---|
43 | def configure(conf): |
---|
44 | conf.load('compiler_c') |
---|
45 | conf.load('compiler_cxx') |
---|
46 | |
---|
47 | conf.write_config_header('config.h') |
---|
48 | |
---|
49 | def build(bld): |
---|
50 | # |
---|
51 | # Build the doxygen documentation. |
---|
52 | # |
---|
53 | if bld.cmd == 'doxy': |
---|
54 | bld(features = 'doxygen', |
---|
55 | doxyfile = 'rtl-host.conf') |
---|
56 | return |
---|
57 | |
---|
58 | # |
---|
59 | # The local configuration. |
---|
60 | # |
---|
61 | conf = {} |
---|
62 | |
---|
63 | # |
---|
64 | # Build flags. |
---|
65 | # |
---|
66 | rtemstoolkit = '../rtemstoolkit' |
---|
67 | conf['includes'] = [rtemstoolkit, |
---|
68 | rtemstoolkit + '/elftoolchain/libelf', |
---|
69 | rtemstoolkit + '/elftoolchain/common', |
---|
70 | rtemstoolkit + '/libiberty'] |
---|
71 | if bld.env.DEST_OS == 'win32': |
---|
72 | conf['includes'] += [rtemstoolkit + '/win32'] |
---|
73 | conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic'] |
---|
74 | conf['optflags'] = bld.env.C_OPTS |
---|
75 | conf['cflags'] = ['-pipe', '-g'] + conf['optflags'] |
---|
76 | conf['cxxflags'] = ['-pipe', '-g'] + conf['optflags'] |
---|
77 | conf['linkflags'] = ['-g'] |
---|
78 | |
---|
79 | # |
---|
80 | # The list of modules. |
---|
81 | # |
---|
82 | modules = ['rld', 'elf', 'iberty'] |
---|
83 | |
---|
84 | # |
---|
85 | # The list of defines |
---|
86 | # |
---|
87 | defines = ['HAVE_CONFIG_H=1', |
---|
88 | 'RTEMS_VERSION=\"%s\"' % (bld.env.RTEMS_VERSION), |
---|
89 | 'RTEMS_RELEASE=\"%s\"' % (bld.env.RTEMS_RELEASE)] |
---|
90 | |
---|
91 | # |
---|
92 | # Build the linker. |
---|
93 | # |
---|
94 | bld.program(target = 'rtems-ld', |
---|
95 | source = ['rtems-ld.cpp'], |
---|
96 | defines = defines, |
---|
97 | includes = ['.'] + conf['includes'], |
---|
98 | cflags = conf['cflags'] + conf['warningflags'], |
---|
99 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
100 | linkflags = conf['linkflags'], |
---|
101 | use = modules) |
---|
102 | |
---|
103 | # |
---|
104 | # Build the ra linker. |
---|
105 | # |
---|
106 | bld.program(target = 'rtems-ra', |
---|
107 | source = ['rtems-ra.cpp'], |
---|
108 | defines = defines, |
---|
109 | includes = ['.'] + conf['includes'], |
---|
110 | cflags = conf['cflags'] + conf['warningflags'], |
---|
111 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
112 | linkflags = conf['linkflags'], |
---|
113 | use = modules) |
---|
114 | |
---|
115 | # |
---|
116 | # Build the trace linker. |
---|
117 | # |
---|
118 | bld.program(target = 'rtems-tld', |
---|
119 | source = ['rtems-tld.cpp'], |
---|
120 | defines = defines, |
---|
121 | includes = ['.'] + conf['includes'], |
---|
122 | cflags = conf['cflags'] + conf['warningflags'], |
---|
123 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
124 | linkflags = conf['linkflags'], |
---|
125 | use = modules) |
---|
126 | bld.install_files('${PREFIX}/share/rtems/trace-linker', |
---|
127 | ['libc.ini', |
---|
128 | 'libc-heap.ini', |
---|
129 | 'rtems.ini', |
---|
130 | 'rtems-api.ini', |
---|
131 | 'rtems-posix.ini', |
---|
132 | 'rtems-score.ini', |
---|
133 | 'rtems-score-object.ini', |
---|
134 | 'rtems-score-thread.ini', |
---|
135 | 'rtems-score-heap.ini', |
---|
136 | 'rtems-score-coremutex.ini', |
---|
137 | 'rtld-base.ini', |
---|
138 | 'rtld-trace-buffer.ini', |
---|
139 | 'rtld-print.ini']) |
---|
140 | |
---|
141 | # |
---|
142 | # Build the symbols. |
---|
143 | # |
---|
144 | bld.program(target = 'rtems-syms', |
---|
145 | source = ['rtems-syms.cpp'], |
---|
146 | defines = defines, |
---|
147 | includes = ['.'] + conf['includes'], |
---|
148 | cflags = conf['cflags'] + conf['warningflags'], |
---|
149 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
150 | linkflags = conf['linkflags'], |
---|
151 | use = modules) |
---|
152 | |
---|
153 | # |
---|
154 | # Build the RAP utility. |
---|
155 | # |
---|
156 | bld.program(target = 'rtems-rap', |
---|
157 | source = ['rtems-rapper.cpp'], |
---|
158 | defines = defines, |
---|
159 | includes = ['.'] + conf['includes'], |
---|
160 | cflags = conf['cflags'] + conf['warningflags'], |
---|
161 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
162 | linkflags = conf['linkflags'], |
---|
163 | use = modules) |
---|
164 | |
---|
165 | def tags(ctx): |
---|
166 | ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True) |
---|