1 | # |
---|
2 | # RTEMS Tools Project (http://www.rtems.org/) |
---|
3 | # Copyright 2014-2016 Chris Johns (chrisj@rtems.org) |
---|
4 | # Copyright 2019 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 record build script. |
---|
24 | # |
---|
25 | |
---|
26 | def init(ctx): |
---|
27 | pass |
---|
28 | |
---|
29 | def options(opt): |
---|
30 | opt.load('compiler_c') |
---|
31 | opt.load('compiler_cxx') |
---|
32 | |
---|
33 | def configure(conf): |
---|
34 | conf.load('compiler_c') |
---|
35 | conf.load('compiler_cxx') |
---|
36 | try: |
---|
37 | cppflags = conf.cmd_and_log(['llvm-config', '--cppflags']) |
---|
38 | ldflags = conf.cmd_and_log(['llvm-config', '--ldflags']) |
---|
39 | conf.env.append_value('CPPFLAGS', cppflags.split()) |
---|
40 | conf.env.append_value('LDFLAGS', ldflags.split()) |
---|
41 | except: |
---|
42 | pass |
---|
43 | if conf.check_cxx(lib = 'LLVM', mandatory=False): |
---|
44 | conf.check(header_name='llvm/DebugInfo/Symbolize/Symbolize.h', features='cxx', mandatory=False) |
---|
45 | if conf.check(header_name='zlib.h', features='cxx', mandatory=False): |
---|
46 | conf.check_cxx(lib = 'z') |
---|
47 | conf.check_cxx(lib = 'ws2_32', mandatory=False) |
---|
48 | conf.write_config_header('config.h') |
---|
49 | |
---|
50 | def build(bld): |
---|
51 | # |
---|
52 | # The local configuration. |
---|
53 | # |
---|
54 | conf = {} |
---|
55 | |
---|
56 | # |
---|
57 | # Build flags. |
---|
58 | # |
---|
59 | conf['includes'] = ['.', 'record', 'record/inih'] |
---|
60 | conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic'] |
---|
61 | conf['optflags'] = bld.env.C_OPTS |
---|
62 | conf['cflags'] = ['-pipe', '-g'] + conf['optflags'] |
---|
63 | conf['cxxflags'] = ['-std=c++11'] + conf['cflags'] |
---|
64 | conf['linkflags'] = ['-g'] |
---|
65 | conf['lib'] = [] |
---|
66 | if bld.env.LIB_WS2_32: |
---|
67 | conf['lib'].extend(bld.env.LIB_WS2_32) |
---|
68 | if bld.env.LIB_LLVM: |
---|
69 | conf['lib'].extend(bld.env.LIB_LLVM) |
---|
70 | if bld.env.LIB_Z: |
---|
71 | conf['lib'].extend(bld.env.LIB_Z) |
---|
72 | |
---|
73 | # |
---|
74 | # The list of defines |
---|
75 | # |
---|
76 | defines = ['HAVE_CONFIG_H', |
---|
77 | 'RTEMS_VERSION=\"%s\"' % (bld.env.RTEMS_VERSION), |
---|
78 | 'RTEMS_RELEASE=\"%s\"' % (bld.env.RTEMS_RELEASE)] |
---|
79 | |
---|
80 | # |
---|
81 | # Build rtems-record-lttng |
---|
82 | # |
---|
83 | bld.program(target = 'rtems-record-lttng', |
---|
84 | source = ['record/record-client.c', |
---|
85 | 'record/record-text.c', |
---|
86 | 'record/record-client-base.cc', |
---|
87 | 'record/record-filter-base64.cc', |
---|
88 | 'record/record-filter-zlib.cc', |
---|
89 | 'record/record-main-lttng.cc', |
---|
90 | 'record/inih/ini.c'], |
---|
91 | includes = conf['includes'], |
---|
92 | defines = defines, |
---|
93 | cflags = conf['cflags'] + conf['warningflags'], |
---|
94 | cxxflags = conf['cxxflags'] + conf['warningflags'], |
---|
95 | linkflags = conf['linkflags'], |
---|
96 | lib = conf['lib']) |
---|
97 | |
---|
98 | def tags(ctx): |
---|
99 | ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True) |
---|