[0382b68] | 1 | # |
---|
| 2 | # RTEMS Tools Project (http://www.rtems.org/) |
---|
[c81066f] | 3 | # Copyright 2014-2016 Chris Johns (chrisj@rtems.org) |
---|
[0382b68] | 4 | # All rights reserved. |
---|
| 5 | # |
---|
| 6 | # This file is part of the RTEMS Tools package in 'rtems-tools'. |
---|
| 7 | # |
---|
[c81066f] | 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. |
---|
[0382b68] | 11 | # |
---|
[c81066f] | 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. |
---|
[0382b68] | 19 | # |
---|
| 20 | |
---|
[ec24a37] | 21 | # |
---|
| 22 | # RTEMS Linker build script. |
---|
| 23 | # |
---|
| 24 | import sys |
---|
| 25 | |
---|
[7148cae] | 26 | def init(ctx): |
---|
| 27 | pass |
---|
| 28 | |
---|
[ec24a37] | 29 | def options(opt): |
---|
[b7d48ef] | 30 | opt.load('compiler_c') |
---|
| 31 | opt.load('compiler_cxx') |
---|
[ec24a37] | 32 | |
---|
| 33 | def configure(conf): |
---|
[b7d48ef] | 34 | conf.load('compiler_c') |
---|
| 35 | conf.load('compiler_cxx') |
---|
[ec24a37] | 36 | |
---|
[87e0e76] | 37 | conf.write_config_header('config.h') |
---|
[ec24a37] | 38 | |
---|
| 39 | def build(bld): |
---|
[be8e188] | 40 | # |
---|
| 41 | # Build the doxygen documentation. |
---|
| 42 | # |
---|
| 43 | if bld.cmd == 'doxy': |
---|
| 44 | bld(features = 'doxygen', |
---|
[e78e2b0] | 45 | doxyfile = 'rtl-host.conf') |
---|
[be8e188] | 46 | return |
---|
| 47 | |
---|
[ec24a37] | 48 | # |
---|
[87e0e76] | 49 | # The local configuration. |
---|
[ec24a37] | 50 | # |
---|
[87e0e76] | 51 | conf = {} |
---|
[ec24a37] | 52 | |
---|
| 53 | # |
---|
| 54 | # Build flags. |
---|
| 55 | # |
---|
[87e0e76] | 56 | rtemstoolkit = '../rtemstoolkit' |
---|
| 57 | conf['includes'] = [rtemstoolkit, |
---|
| 58 | rtemstoolkit + '/elftoolchain/libelf', |
---|
[8dd3803] | 59 | rtemstoolkit + '/elftoolchain/libdwarf', |
---|
[87e0e76] | 60 | rtemstoolkit + '/elftoolchain/common', |
---|
| 61 | rtemstoolkit + '/libiberty'] |
---|
[3badbb0] | 62 | if bld.env.DEST_OS == 'win32': |
---|
| 63 | conf['includes'] += [rtemstoolkit + '/win32'] |
---|
[87e0e76] | 64 | conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic'] |
---|
| 65 | conf['optflags'] = bld.env.C_OPTS |
---|
| 66 | conf['cflags'] = ['-pipe', '-g'] + conf['optflags'] |
---|
[8dd3803] | 67 | conf['cxxflags'] = ['-pipe', '-g', '--std=c++11'] + conf['optflags'] |
---|
[87e0e76] | 68 | conf['linkflags'] = ['-g'] |
---|
[ea29902] | 69 | |
---|
| 70 | # |
---|
| 71 | # The list of modules. |
---|
| 72 | # |
---|
[1e21ea7] | 73 | modules = ['rld', 'dwarf', 'elf', 'iberty'] |
---|
[ea29902] | 74 | |
---|
[efc4f09] | 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 | |
---|
[ec24a37] | 82 | # |
---|
| 83 | # Build the linker. |
---|
| 84 | # |
---|
| 85 | bld.program(target = 'rtems-ld', |
---|
[31bf375] | 86 | source = ['rtems-ld.cpp'], |
---|
[efc4f09] | 87 | defines = defines, |
---|
[87e0e76] | 88 | includes = ['.'] + conf['includes'], |
---|
| 89 | cflags = conf['cflags'] + conf['warningflags'], |
---|
| 90 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
| 91 | linkflags = conf['linkflags'], |
---|
[53ed116] | 92 | use = modules) |
---|
| 93 | |
---|
| 94 | # |
---|
| 95 | # Build the ra linker. |
---|
| 96 | # |
---|
| 97 | bld.program(target = 'rtems-ra', |
---|
[31bf375] | 98 | source = ['rtems-ra.cpp'], |
---|
[efc4f09] | 99 | defines = defines, |
---|
[87e0e76] | 100 | includes = ['.'] + conf['includes'], |
---|
| 101 | cflags = conf['cflags'] + conf['warningflags'], |
---|
| 102 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
| 103 | linkflags = conf['linkflags'], |
---|
[ea29902] | 104 | use = modules) |
---|
| 105 | |
---|
| 106 | # |
---|
| 107 | # Build the trace linker. |
---|
| 108 | # |
---|
| 109 | bld.program(target = 'rtems-tld', |
---|
| 110 | source = ['rtems-tld.cpp'], |
---|
[efc4f09] | 111 | defines = defines, |
---|
[87e0e76] | 112 | includes = ['.'] + conf['includes'], |
---|
| 113 | cflags = conf['cflags'] + conf['warningflags'], |
---|
| 114 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
| 115 | linkflags = conf['linkflags'], |
---|
[977c3de] | 116 | use = modules) |
---|
[6506aa1] | 117 | bld.install_files('${PREFIX}/share/rtems/trace-linker', |
---|
[8de6f6b] | 118 | ['libc.ini', |
---|
| 119 | 'libc-heap.ini', |
---|
| 120 | 'rtems.ini', |
---|
[5025439] | 121 | 'rtems-api.ini', |
---|
[b69cd3f] | 122 | 'rtems-posix.ini', |
---|
[5025439] | 123 | 'rtems-score.ini', |
---|
| 124 | 'rtems-score-object.ini', |
---|
| 125 | 'rtems-score-thread.ini', |
---|
[b76fa74] | 126 | 'rtems-score-threadq.ini', |
---|
[5025439] | 127 | 'rtems-score-heap.ini', |
---|
| 128 | 'rtld-base.ini', |
---|
[b988768] | 129 | 'rtld-trace-buffer.ini', |
---|
[5025439] | 130 | 'rtld-print.ini']) |
---|
[977c3de] | 131 | |
---|
| 132 | # |
---|
| 133 | # Build the symbols. |
---|
| 134 | # |
---|
| 135 | bld.program(target = 'rtems-syms', |
---|
[ea29902] | 136 | source = ['rtems-syms.cpp'], |
---|
[efc4f09] | 137 | defines = defines, |
---|
[87e0e76] | 138 | includes = ['.'] + conf['includes'], |
---|
| 139 | cflags = conf['cflags'] + conf['warningflags'], |
---|
| 140 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
| 141 | linkflags = conf['linkflags'], |
---|
[8bb0d53] | 142 | use = modules) |
---|
| 143 | |
---|
| 144 | # |
---|
| 145 | # Build the RAP utility. |
---|
| 146 | # |
---|
| 147 | bld.program(target = 'rtems-rap', |
---|
[ea29902] | 148 | source = ['rtems-rapper.cpp'], |
---|
[efc4f09] | 149 | defines = defines, |
---|
[87e0e76] | 150 | includes = ['.'] + conf['includes'], |
---|
| 151 | cflags = conf['cflags'] + conf['warningflags'], |
---|
| 152 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
| 153 | linkflags = conf['linkflags'], |
---|
[ec24a37] | 154 | use = modules) |
---|
| 155 | |
---|
[c81066f] | 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 | |
---|
[1ec9633] | 168 | def tags(ctx): |
---|
| 169 | ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True) |
---|