1 | # |
---|
2 | # RTEMS Tools Project (http://www.rtems.org/) |
---|
3 | # Copyright 2014-2016 Chris Johns (chrisj@rtems.org) |
---|
4 | # Copyright 2018 embedded brains GmbH |
---|
5 | # All rights reserved. |
---|
6 | # |
---|
7 | # This file is part of the RTEMS Tools package in 'rtems-tools'. |
---|
8 | # |
---|
9 | # Permission to use, copy, modify, and/or distribute this software for any |
---|
10 | # purpose with or without fee is hereby granted, provided that the above |
---|
11 | # copyright notice and this permission notice appear in all copies. |
---|
12 | # |
---|
13 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
---|
14 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
---|
15 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
---|
16 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
---|
17 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
---|
18 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
---|
19 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
---|
20 | # |
---|
21 | |
---|
22 | # |
---|
23 | # RTEMS miscellaneous build script. |
---|
24 | # |
---|
25 | import sys |
---|
26 | |
---|
27 | def init(ctx): |
---|
28 | pass |
---|
29 | |
---|
30 | def options(opt): |
---|
31 | opt.load('compiler_c') |
---|
32 | |
---|
33 | def configure(conf): |
---|
34 | conf.load('compiler_c') |
---|
35 | |
---|
36 | conf.check_cc(fragment = ''' |
---|
37 | #include <string.h> |
---|
38 | int main() { size_t l = strnlen("string", 10); } ''', |
---|
39 | cflags = '-Wall', define_name = 'HAVE_STRNLEN', |
---|
40 | msg = 'Checking for strnlen', mandatory = False) |
---|
41 | conf.write_config_header('config.h') |
---|
42 | |
---|
43 | def build(bld): |
---|
44 | # |
---|
45 | # The local configuration. |
---|
46 | # |
---|
47 | conf = {} |
---|
48 | |
---|
49 | # |
---|
50 | # Build flags. |
---|
51 | # |
---|
52 | conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic'] |
---|
53 | conf['optflags'] = bld.env.C_OPTS |
---|
54 | conf['cflags'] = ['-pipe', '-g'] + conf['optflags'] |
---|
55 | conf['linkflags'] = ['-g'] |
---|
56 | |
---|
57 | # |
---|
58 | # The list of defines |
---|
59 | # |
---|
60 | defines = ['RTEMS_VERSION=\"%s\"' % (bld.env.RTEMS_VERSION), |
---|
61 | 'RTEMS_RELEASE=\"%s\"' % (bld.env.RTEMS_RELEASE)] |
---|
62 | |
---|
63 | # |
---|
64 | # Build the bin2c. |
---|
65 | # |
---|
66 | bld.program(target = 'rtems-bin2c', |
---|
67 | source = ['bin2c/rtems-bin2c.c', 'bin2c/compat.c'], |
---|
68 | includes = ['.'], |
---|
69 | defines = defines, |
---|
70 | cflags = conf['cflags'] + conf['warningflags'], |
---|
71 | linkflags = conf['linkflags']) |
---|
72 | |
---|
73 | # |
---|
74 | # Install the boot image code. |
---|
75 | # |
---|
76 | bld(features = 'py', |
---|
77 | source = ['tools/boot.py', |
---|
78 | 'tools/cmd-boot-image.py'], |
---|
79 | install_from = '.', |
---|
80 | install_path = '${PREFIX}/share/rtems/misc') |
---|
81 | bld.install_files('${PREFIX}/bin', |
---|
82 | ['rtems-boot-image'], |
---|
83 | chmod = 0o755) |
---|
84 | bld.install_files('${PREFIX}/share/rtems/tools/config', |
---|
85 | 'tools/config/rtems-boot.ini') |
---|
86 | |
---|
87 | def tags(ctx): |
---|
88 | ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True) |
---|