source: rtems-tools/linkers/wscript @ 1e21ea7

Last change on this file since 1e21ea7 was 1e21ea7, checked in by Chris Johns <chrisj@…>, on May 8, 2018 at 5:09:47 AM

linkers/exe-info: Add DWARF support to gather and check producer details.

  • Provide support to list the compilers and assemblers used to build an executable.
  • List the machine flags showing which flags are common and which are not.
  • Property mode set to 100644
File size: 5.5 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
37    conf.write_config_header('config.h')
38
39def 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/libdwarf',
60                        rtemstoolkit + '/elftoolchain/common',
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', '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
168def tags(ctx):
169    ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True)
Note: See TracBrowser for help on using the repository browser.