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