source: rtems-tools/linkers/wscript

Last change on this file was 75ffa67, checked in by Chris Johns <chrisj@…>, on 11/20/23 at 23:11:13

python: Updates for Python 3.12

  • Fix escape sequences in strings

Updates #4968

  • Property mode set to 100644
File size: 6.0 KB
Line 
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#
24import sys
25
26def init(ctx):
27    pass
28
29def options(opt):
30    opt.load('compiler_c')
31    opt.load('compiler_cxx')
32
33def configure(conf):
34    conf.load('compiler_c')
35    conf.load('compiler_cxx')
36    conf.write_config_header('config.h')
37
38def build(bld):
39    #
40    # Build the doxygen documentation.
41    #
42    if bld.cmd == 'doxy':
43        bld(features = 'doxygen',
44            doxyfile = 'rtl-host.conf')
45        return
46
47    #
48    # The local configuration.
49    #
50    conf = {}
51
52    #
53    # Build flags.
54    #
55    rtemstoolkit = '../rtemstoolkit'
56    conf['includes'] = [rtemstoolkit,
57                        rtemstoolkit + '/elftoolchain/libelf',
58                        rtemstoolkit + '/elftoolchain/libdwarf',
59                        rtemstoolkit + '/elftoolchain/common',
60                        rtemstoolkit + '/elftoolchain/libelftc',
61                        rtemstoolkit + '/libiberty']
62    if bld.env.DEST_OS == 'win32':
63        conf['includes'] += [rtemstoolkit + '/win32']
64    conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic']
65    conf['optflags'] = bld.env.C_OPTS
66    conf['cflags'] = ['-pipe', '-g'] + conf['optflags']
67    conf['cxxflags'] = ['-pipe', '-g', '--std=c++11'] + conf['optflags']
68    conf['linkflags'] = ['-g']
69
70    #
71    # The list of modules.
72    #
73    modules = ['rld', 'elftc', 'dwarf', 'elf', 'iberty']
74
75    #
76    # The list of defines
77    #
78    defines = ['HAVE_CONFIG_H=1',
79               'RTEMS_VERSION=\"%s\"' % (bld.env.RTEMS_VERSION),
80               'RTEMS_RELEASE=\"%s\"' % (bld.env.RTEMS_RELEASE)]
81
82    #
83    # Build the linker.
84    #
85    bld.program(target = 'rtems-ld',
86                source = ['rtems-ld.cpp'],
87                defines = defines,
88                includes = ['.'] + conf['includes'],
89                cflags = conf['cflags'] + conf['warningflags'],
90                cxxflags = conf['cxxflags'] + conf['warningflags'],
91                linkflags = conf['linkflags'],
92                use = modules)
93
94    #
95    # Build the ra linker.
96    #
97    bld.program(target = 'rtems-ra',
98                source = ['rtems-ra.cpp'],
99                defines = defines,
100                includes = ['.'] + conf['includes'],
101                cflags = conf['cflags'] + conf['warningflags'],
102                cxxflags = conf['cxxflags'] + conf['warningflags'],
103                linkflags = conf['linkflags'],
104                use = modules)
105
106    #
107    # Build the trace linker.
108    #
109    bld.program(target = 'rtems-tld',
110                source = ['rtems-tld.cpp'],
111                defines = defines,
112                includes = ['.'] + conf['includes'],
113                cflags = conf['cflags'] + conf['warningflags'],
114                cxxflags = conf['cxxflags'] + conf['warningflags'],
115                linkflags = conf['linkflags'],
116                use = modules)
117    bld.install_files('${PREFIX}/share/rtems/trace-linker',
118                      ['libc.ini',
119                       'libc-heap.ini',
120                       'rtems.ini',
121                       'rtems-api.ini',
122                       'rtems-posix.ini',
123                       'rtems-score.ini',
124                       'rtems-score-object.ini',
125                       'rtems-score-thread.ini',
126                       'rtems-score-threadq.ini',
127                       'rtems-score-heap.ini',
128                       'rtld-base.ini',
129                       'rtld-trace-buffer.ini',
130                       'rtld-print.ini'])
131
132    #
133    # Build the symbols.
134    #
135    bld.program(target = 'rtems-syms',
136                source = ['rtems-syms.cpp'],
137                defines = defines,
138                includes = ['.'] + conf['includes'],
139                cflags = conf['cflags'] + conf['warningflags'],
140                cxxflags = conf['cxxflags'] + conf['warningflags'],
141                linkflags = conf['linkflags'],
142                use = modules)
143
144    #
145    # Build the RAP utility.
146    #
147    bld.program(target = 'rtems-rap',
148                source = ['rtems-rapper.cpp'],
149                defines = defines,
150                includes = ['.'] + conf['includes'],
151                cflags = conf['cflags'] + conf['warningflags'],
152                cxxflags = conf['cxxflags'] + conf['warningflags'],
153                linkflags = conf['linkflags'],
154                use = modules)
155
156    #
157    # Build the EXE information tool.
158    #
159    bld.program(target = 'rtems-exeinfo',
160                source = ['rtems-exeinfo.cpp'],
161                defines = defines,
162                includes = ['.'] + conf['includes'],
163                cflags = conf['cflags'] + conf['warningflags'],
164                cxxflags = conf['cxxflags'] + conf['warningflags'],
165                linkflags = conf['linkflags'],
166                use = modules)
167
168    #
169    # Build the address to line tool.
170    #
171    bld.program(target = 'rtems-addr2line',
172                source = ['rtems-addr2line.cpp'],
173                defines = defines,
174                includes = ['.'] + conf['includes'],
175                cflags = conf['cflags'] + conf['warningflags'],
176                cxxflags = conf['cxxflags'] + conf['warningflags'],
177                linkflags = conf['linkflags'],
178                use = modules)
179
180def tags(ctx):
181    ctx.exec_command('etags $(find . -name \\*.[sSch])', shell = True)
Note: See TracBrowser for help on using the repository browser.