xref: /openbmc/qemu/trace/meson.build (revision 73ec0ead)
1softmmu_ss.add(files('trace-hmp-cmds.c'))
2
3specific_ss.add(files('control-target.c'))
4
5trace_events_files = []
6foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events
7  if item in qapi_trace_events
8    trace_events_file = item
9    group_name = item.full_path().split('/')[-1].underscorify()
10  else
11    trace_events_file = meson.project_source_root() / item / 'trace-events'
12    group_name = item == '.' ? 'root' : item.underscorify()
13  endif
14  trace_events_files += [ trace_events_file ]
15  group = '--group=' + group_name
16  fmt = '@0@-' + group_name + '.@1@'
17
18  trace_h = custom_target(fmt.format('trace', 'h'),
19                          output: fmt.format('trace', 'h'),
20                          input: trace_events_file,
21                          command: [ tracetool, group, '--format=h', '@INPUT@', '@OUTPUT@' ],
22                          depend_files: tracetool_depends)
23  genh += trace_h
24  trace_c = custom_target(fmt.format('trace', 'c'),
25                          output: fmt.format('trace', 'c'),
26                          input: trace_events_file,
27                          command: [ tracetool, group, '--format=c', '@INPUT@', '@OUTPUT@' ],
28                          depend_files: tracetool_depends)
29  if 'ust' in get_option('trace_backends')
30    trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
31                                output: fmt.format('trace-ust', 'h'),
32                                input: trace_events_file,
33                                command: [ tracetool, group, '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
34                                depend_files: tracetool_depends)
35    trace_ss.add(trace_ust_h, lttng)
36    genh += trace_ust_h
37  endif
38  trace_ss.add(trace_h, trace_c)
39  if 'dtrace' in get_option('trace_backends')
40    trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'),
41                                 output: fmt.format('trace-dtrace', 'dtrace'),
42                                 input: trace_events_file,
43                                 command: [ tracetool, group, '--format=d', '@INPUT@', '@OUTPUT@' ],
44                                 depend_files: tracetool_depends)
45    trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
46                                   output: fmt.format('trace-dtrace', 'h'),
47                                   input: trace_dtrace,
48                                   command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
49    trace_ss.add(trace_dtrace_h)
50    if host_machine.system() != 'darwin'
51      trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
52                                     output: fmt.format('trace-dtrace', 'o'),
53                                     input: trace_dtrace,
54                                     command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
55      trace_ss.add(trace_dtrace_o)
56    endif
57
58    genh += trace_dtrace_h
59  endif
60endforeach
61
62trace_events_all = custom_target('trace-events-all',
63                                 output: 'trace-events-all',
64                                 input: trace_events_files,
65                                 command: [ 'cat', '@INPUT@' ],
66                                 capture: true,
67                                 install: true,
68                                 install_dir: qemu_datadir)
69
70if 'ust' in get_option('trace_backends')
71  trace_ust_all_h = custom_target('trace-ust-all.h',
72                                  output: 'trace-ust-all.h',
73                                  input: trace_events_files,
74                                  command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
75                                  depend_files: tracetool_depends)
76  trace_ust_all_c = custom_target('trace-ust-all.c',
77                                  output: 'trace-ust-all.c',
78                                  input: trace_events_files,
79                                  command: [ tracetool, '--group=all', '--format=ust-events-c', '@INPUT@', '@OUTPUT@' ],
80                                  depend_files: tracetool_depends)
81  trace_ss.add(trace_ust_all_h, trace_ust_all_c)
82  genh += trace_ust_all_h
83endif
84
85if 'simple' in get_option('trace_backends')
86  trace_ss.add(files('simple.c'))
87endif
88if 'ftrace' in get_option('trace_backends')
89  trace_ss.add(files('ftrace.c'))
90endif
91trace_ss.add(files('control.c'))
92if have_system or have_tools or have_ga
93  trace_ss.add(files('qmp.c'))
94endif
95