xref: /openbmc/qemu/trace/meson.build (revision f15bff25f7c6843d698e122dc8d1b5927360f6c1)
1trace_events_files = []
2foreach dir : [ '.' ] + trace_events_subdirs
3  trace_events_file = meson.source_root() / dir / 'trace-events'
4  trace_events_files += [ trace_events_file ]
5  group_name = dir == '.' ? 'root' : dir.underscorify()
6  group = '--group=' + group_name
7  fmt = '@0@-' + group_name + '.@1@'
8
9  trace_h = custom_target(fmt.format('trace', 'h'),
10                          output: fmt.format('trace', 'h'),
11                          input: trace_events_file,
12                          command: [ tracetool, group, '--format=h', '@INPUT@' ],
13                          capture: true)
14  genh += trace_h
15  trace_c = custom_target(fmt.format('trace', 'c'),
16                          output: fmt.format('trace', 'c'),
17                          input: trace_events_file,
18                          command: [ tracetool, group, '--format=c', '@INPUT@' ],
19                          capture: true)
20  if 'CONFIG_TRACE_UST' in config_host
21    trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
22                                output: fmt.format('trace-ust', 'h'),
23                                input: trace_events_file,
24                                command: [ tracetool, group, '--format=ust-events-h', '@INPUT@' ],
25                                capture: true)
26    trace_ss.add(trace_ust_h, lttng, urcubp)
27    genh += trace_ust_h
28  endif
29  trace_ss.add(trace_h, trace_c)
30  if 'CONFIG_TRACE_DTRACE' in config_host
31    trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'),
32                                 output: fmt.format('trace-dtrace', 'dtrace'),
33                                 input: trace_events_file,
34                                 command: [ tracetool, group, '--format=d', '@INPUT@' ],
35                                 capture: true)
36    trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
37                                   output: fmt.format('trace-dtrace', 'h'),
38                                   input: trace_dtrace,
39                                   command: [ 'dtrace', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
40    trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
41                                   output: fmt.format('trace-dtrace', 'o'),
42                                   input: trace_dtrace,
43                                   command: [ 'dtrace', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
44
45    trace_ss.add(trace_dtrace_h, trace_dtrace_o)
46    genh += trace_dtrace_h
47  endif
48endforeach
49
50custom_target('trace-events-all',
51              output: 'trace-events-all',
52              input: trace_events_files,
53              command: [ 'cat', '@INPUT@' ],
54              capture: true,
55              install: true,
56              install_dir: config_host['qemu_datadir'])
57
58foreach d : [
59  ['generated-tcg-tracers.h', 'tcg-h'],
60  ['generated-helpers.c', 'tcg-helper-c'],
61  ['generated-helpers.h', 'tcg-helper-h'],
62  ['generated-helpers-wrappers.h', 'tcg-helper-wrapper-h'],
63]
64  custom_target(d[0],
65                output: d[0],
66                input: meson.source_root() / 'trace-events',
67                command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@' ],
68                build_by_default: true, # to be removed when added to a target
69                capture: true)
70endforeach
71
72if 'CONFIG_TRACE_UST' in config_host
73  trace_ust_all_h = custom_target('trace-ust-all.h',
74                                  output: 'trace-ust-all.h',
75                                  input: trace_events_files,
76                                  command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@' ],
77                                  capture: true)
78  trace_ust_all_c = custom_target('trace-ust-all.c',
79                                  output: 'trace-ust-all.c',
80                                  input: trace_events_files,
81                                  command: [ tracetool, '--group=all', '--format=ust-events-c', '@INPUT@' ],
82                                  capture: true)
83  trace_ss.add(trace_ust_all_h, trace_ust_all_c)
84  genh += trace_ust_all_h
85endif
86
87trace_ss.add(when: 'CONFIG_TRACE_SIMPLE', if_true: files('simple.c'))
88trace_ss.add(when: 'CONFIG_TRACE_FTRACE', if_true: files('ftrace.c'))
89trace_ss.add(files('control.c'))
90trace_ss.add(files('qmp.c'))
91