xref: /qemu/trace/meson.build (revision 2e8f72ac)
1
2specific_ss.add(files('control-target.c'))
3
4trace_events_files = []
5foreach dir : [ '.' ] + trace_events_subdirs
6  trace_events_file = meson.source_root() / dir / 'trace-events'
7  trace_events_files += [ trace_events_file ]
8  group_name = dir == '.' ? 'root' : dir.underscorify()
9  group = '--group=' + group_name
10  fmt = '@0@-' + group_name + '.@1@'
11
12  trace_h = custom_target(fmt.format('trace', 'h'),
13                          output: fmt.format('trace', 'h'),
14                          input: trace_events_file,
15                          command: [ tracetool, group, '--format=h', '@INPUT@', '@OUTPUT@' ])
16  genh += trace_h
17  trace_c = custom_target(fmt.format('trace', 'c'),
18                          output: fmt.format('trace', 'c'),
19                          input: trace_events_file,
20                          command: [ tracetool, group, '--format=c', '@INPUT@', '@OUTPUT@' ])
21  if 'CONFIG_TRACE_UST' in config_host
22    trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
23                                output: fmt.format('trace-ust', 'h'),
24                                input: trace_events_file,
25                                command: [ tracetool, group, '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ])
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@', '@OUTPUT@' ])
35    trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
36                                   output: fmt.format('trace-dtrace', 'h'),
37                                   input: trace_dtrace,
38                                   command: [ 'dtrace', '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
39    trace_ss.add(trace_dtrace_h)
40    if host_machine.system() != 'darwin'
41      trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
42                                     output: fmt.format('trace-dtrace', 'o'),
43                                     input: trace_dtrace,
44                                     command: [ 'dtrace', '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
45      trace_ss.add(trace_dtrace_o)
46    endif
47
48    genh += trace_dtrace_h
49  endif
50endforeach
51
52trace_events_all = custom_target('trace-events-all',
53                                 output: 'trace-events-all',
54                                 input: trace_events_files,
55                                 command: [ 'cat', '@INPUT@' ],
56                                 capture: true,
57                                 install: true,
58                                 install_dir: qemu_datadir)
59
60foreach d : [
61  ['generated-tcg-tracers.h', 'tcg-h'],
62  ['generated-helpers.c', 'tcg-helper-c'],
63  ['generated-helpers.h', 'tcg-helper-h'],
64  ['generated-helpers-wrappers.h', 'tcg-helper-wrapper-h'],
65]
66  gen = custom_target(d[0],
67                output: d[0],
68                input: meson.source_root() / 'trace-events',
69                command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@', '@OUTPUT@' ])
70  specific_ss.add(when: 'CONFIG_TCG', if_true: gen)
71endforeach
72
73if 'CONFIG_TRACE_UST' in config_host
74  trace_ust_all_h = custom_target('trace-ust-all.h',
75                                  output: 'trace-ust-all.h',
76                                  input: trace_events_files,
77                                  command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ])
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@', '@OUTPUT@' ])
82  trace_ss.add(trace_ust_all_h, trace_ust_all_c)
83  genh += trace_ust_all_h
84endif
85
86trace_ss.add(when: 'CONFIG_TRACE_SIMPLE', if_true: files('simple.c'))
87trace_ss.add(when: 'CONFIG_TRACE_FTRACE', if_true: files('ftrace.c'))
88trace_ss.add(files('control.c'))
89trace_ss.add(files('qmp.c'))
90