[1cd75c4] | 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(function_name = 'strnlen', header_name="string.h", |
---|
| 37 | features = 'c', mandatory = False) |
---|
| 38 | conf.write_config_header('config.h') |
---|
| 39 | |
---|
| 40 | def build(bld): |
---|
| 41 | # |
---|
| 42 | # The local configuration. |
---|
| 43 | # |
---|
| 44 | conf = {} |
---|
| 45 | |
---|
| 46 | # |
---|
| 47 | # Build flags. |
---|
| 48 | # |
---|
| 49 | conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic'] |
---|
| 50 | conf['optflags'] = bld.env.C_OPTS |
---|
| 51 | conf['cflags'] = ['-pipe', '-g'] + conf['optflags'] |
---|
| 52 | conf['linkflags'] = ['-g'] |
---|
| 53 | |
---|
| 54 | # |
---|
| 55 | # The list of defines |
---|
| 56 | # |
---|
| 57 | defines = ['RTEMS_VERSION=\"%s\"' % (bld.env.RTEMS_VERSION), |
---|
| 58 | 'RTEMS_RELEASE=\"%s\"' % (bld.env.RTEMS_RELEASE)] |
---|
| 59 | |
---|
| 60 | # |
---|
| 61 | # Build the bin2c. |
---|
| 62 | # |
---|
| 63 | bld.program(target = 'rtems-bin2c', |
---|
| 64 | source = ['bin2c/rtems-bin2c.c', 'bin2c/compat.c'], |
---|
| 65 | includes = ['.'], |
---|
| 66 | defines = defines, |
---|
| 67 | cflags = conf['cflags'] + conf['warningflags'], |
---|
| 68 | linkflags = conf['linkflags']) |
---|
| 69 | |
---|
| 70 | def tags(ctx): |
---|
| 71 | ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True) |
---|