xref: /openbmc/qemu/trace/meson.build (revision 1da79ecc)
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                          depend_files: tracetool_depends)
17  genh += trace_h
18  trace_c = custom_target(fmt.format('trace', 'c'),
19                          output: fmt.format('trace', 'c'),
20                          input: trace_events_file,
21                          command: [ tracetool, group, '--format=c', '@INPUT@', '@OUTPUT@' ],
22                          depend_files: tracetool_depends)
23  if 'CONFIG_TRACE_UST' in config_host
24    trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
25                                output: fmt.format('trace-ust', 'h'),
26                                input: trace_events_file,
27                                command: [ tracetool, group, '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
28                                depend_files: tracetool_depends)
29    trace_ss.add(trace_ust_h, lttng, urcubp)
30    genh += trace_ust_h
31  endif
32  trace_ss.add(trace_h, trace_c)
33  if 'CONFIG_TRACE_DTRACE' in config_host
34    trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'),
35                                 output: fmt.format('trace-dtrace', 'dtrace'),
36                                 input: trace_events_file,
37                                 command: [ tracetool, group, '--format=d', '@INPUT@', '@OUTPUT@' ],
38                                 depend_files: tracetool_depends)
39    trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
40                                   output: fmt.format('trace-dtrace', 'h'),
41                                   input: trace_dtrace,
42                                   command: [ 'dtrace', '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
43    trace_ss.add(trace_dtrace_h)
44    if host_machine.system() != 'darwin'
45      trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
46                                     output: fmt.format('trace-dtrace', 'o'),
47                                     input: trace_dtrace,
48                                     command: [ 'dtrace', '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
49      trace_ss.add(trace_dtrace_o)
50    endif
51
52    genh += trace_dtrace_h
53  endif
54endforeach
55
56trace_events_all = custom_target('trace-events-all',
57                                 output: 'trace-events-all',
58                                 input: trace_events_files,
59                                 command: [ 'cat', '@INPUT@' ],
60                                 capture: true,
61                                 install: true,
62                                 install_dir: qemu_datadir)
63
64foreach d : [
65  ['generated-tcg-tracers.h', 'tcg-h'],
66  ['generated-helpers.c', 'tcg-helper-c'],
67  ['generated-helpers.h', 'tcg-helper-h'],
68  ['generated-helpers-wrappers.h', 'tcg-helper-wrapper-h'],
69]
70  gen = custom_target(d[0],
71                output: d[0],
72                input: meson.source_root() / 'trace-events',
73                command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@', '@OUTPUT@' ],
74                depend_files: tracetool_depends)
75  specific_ss.add(when: 'CONFIG_TCG', if_true: gen)
76endforeach
77
78if 'CONFIG_TRACE_UST' in config_host
79  trace_ust_all_h = custom_target('trace-ust-all.h',
80                                  output: 'trace-ust-all.h',
81                                  input: trace_events_files,
82                                  command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
83                                  depend_files: tracetool_depends)
84  trace_ust_all_c = custom_target('trace-ust-all.c',
85                                  output: 'trace-ust-all.c',
86                                  input: trace_events_files,
87                                  command: [ tracetool, '--group=all', '--format=ust-events-c', '@INPUT@', '@OUTPUT@' ],
88                                  depend_files: tracetool_depends)
89  trace_ss.add(trace_ust_all_h, trace_ust_all_c)
90  genh += trace_ust_all_h
91endif
92
93trace_ss.add(when: 'CONFIG_TRACE_SIMPLE', if_true: files('simple.c'))
94trace_ss.add(when: 'CONFIG_TRACE_FTRACE', if_true: files('ftrace.c'))
95trace_ss.add(files('control.c'))
96trace_ss.add(files('qmp.c'))
97