xref: /openbmc/qemu/trace/meson.build (revision 5db05230)
1de6cd759SPhilippe Mathieu-Daudésystem_ss.add(files('trace-hmp-cmds.c'))
2aadac5b3SPeter Maydell
30e1309d0SMarc-André Lureauspecific_ss.add(files('control-target.c'))
40e1309d0SMarc-André Lureau
5a81df1b6SPaolo Bonzinitrace_events_files = []
6b83a80e8SVladimir Sementsov-Ogievskiyforeach item : [ '.' ] + trace_events_subdirs + qapi_trace_events
7b83a80e8SVladimir Sementsov-Ogievskiy  if item in qapi_trace_events
8b83a80e8SVladimir Sementsov-Ogievskiy    trace_events_file = item
9b83a80e8SVladimir Sementsov-Ogievskiy    group_name = item.full_path().split('/')[-1].underscorify()
10b83a80e8SVladimir Sementsov-Ogievskiy  else
11b83a80e8SVladimir Sementsov-Ogievskiy    trace_events_file = meson.project_source_root() / item / 'trace-events'
12b83a80e8SVladimir Sementsov-Ogievskiy    group_name = item == '.' ? 'root' : item.underscorify()
13b83a80e8SVladimir Sementsov-Ogievskiy  endif
14a81df1b6SPaolo Bonzini  trace_events_files += [ trace_events_file ]
15a81df1b6SPaolo Bonzini  group = '--group=' + group_name
16a81df1b6SPaolo Bonzini  fmt = '@0@-' + group_name + '.@1@'
17a81df1b6SPaolo Bonzini
18a81df1b6SPaolo Bonzini  trace_h = custom_target(fmt.format('trace', 'h'),
19a81df1b6SPaolo Bonzini                          output: fmt.format('trace', 'h'),
20a81df1b6SPaolo Bonzini                          input: trace_events_file,
210572d6cdSStefan Hajnoczi                          command: [ tracetool, group, '--format=h', '@INPUT@', '@OUTPUT@' ],
220572d6cdSStefan Hajnoczi                          depend_files: tracetool_depends)
23a81df1b6SPaolo Bonzini  genh += trace_h
24a81df1b6SPaolo Bonzini  trace_c = custom_target(fmt.format('trace', 'c'),
25a81df1b6SPaolo Bonzini                          output: fmt.format('trace', 'c'),
26a81df1b6SPaolo Bonzini                          input: trace_events_file,
270572d6cdSStefan Hajnoczi                          command: [ tracetool, group, '--format=c', '@INPUT@', '@OUTPUT@' ],
280572d6cdSStefan Hajnoczi                          depend_files: tracetool_depends)
299c29b741SPaolo Bonzini  if 'ust' in get_option('trace_backends')
30a81df1b6SPaolo Bonzini    trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
31a81df1b6SPaolo Bonzini                                output: fmt.format('trace-ust', 'h'),
32a81df1b6SPaolo Bonzini                                input: trace_events_file,
330572d6cdSStefan Hajnoczi                                command: [ tracetool, group, '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
340572d6cdSStefan Hajnoczi                                depend_files: tracetool_depends)
35bbe47ed2SPaolo Bonzini    trace_ss.add(trace_ust_h, lttng)
36a81df1b6SPaolo Bonzini    genh += trace_ust_h
37a81df1b6SPaolo Bonzini  endif
38a81df1b6SPaolo Bonzini  trace_ss.add(trace_h, trace_c)
399c29b741SPaolo Bonzini  if 'dtrace' in get_option('trace_backends')
40a81df1b6SPaolo Bonzini    trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'),
41a81df1b6SPaolo Bonzini                                 output: fmt.format('trace-dtrace', 'dtrace'),
42a81df1b6SPaolo Bonzini                                 input: trace_events_file,
430572d6cdSStefan Hajnoczi                                 command: [ tracetool, group, '--format=d', '@INPUT@', '@OUTPUT@' ],
440572d6cdSStefan Hajnoczi                                 depend_files: tracetool_depends)
45a81df1b6SPaolo Bonzini    trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
46a81df1b6SPaolo Bonzini                                   output: fmt.format('trace-dtrace', 'h'),
47a81df1b6SPaolo Bonzini                                   input: trace_dtrace,
48d051d0e1SPaolo Bonzini                                   command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
49568ac779SRoman Bolshakov    trace_ss.add(trace_dtrace_h)
50568ac779SRoman Bolshakov    if host_machine.system() != 'darwin'
51a81df1b6SPaolo Bonzini      trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
52a81df1b6SPaolo Bonzini                                     output: fmt.format('trace-dtrace', 'o'),
53a81df1b6SPaolo Bonzini                                     input: trace_dtrace,
54d051d0e1SPaolo Bonzini                                     command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
55568ac779SRoman Bolshakov      trace_ss.add(trace_dtrace_o)
56568ac779SRoman Bolshakov    endif
57a81df1b6SPaolo Bonzini
58a81df1b6SPaolo Bonzini    genh += trace_dtrace_h
59a81df1b6SPaolo Bonzini  endif
60a81df1b6SPaolo Bonziniendforeach
61a81df1b6SPaolo Bonzini
6210e1d263SMarc-André Lureautrace_events_all = custom_target('trace-events-all',
63a81df1b6SPaolo Bonzini                                 output: 'trace-events-all',
64a81df1b6SPaolo Bonzini                                 input: trace_events_files,
65a81df1b6SPaolo Bonzini                                 command: [ 'cat', '@INPUT@' ],
66a81df1b6SPaolo Bonzini                                 capture: true,
67*5db05230SCarlos Santos                                 install: get_option('trace_backends') != [ 'nop' ],
68ab4c0996SMarc-André Lureau                                 install_dir: qemu_datadir)
69a81df1b6SPaolo Bonzini
709c29b741SPaolo Bonziniif 'ust' in get_option('trace_backends')
71a81df1b6SPaolo Bonzini  trace_ust_all_h = custom_target('trace-ust-all.h',
72a81df1b6SPaolo Bonzini                                  output: 'trace-ust-all.h',
73a81df1b6SPaolo Bonzini                                  input: trace_events_files,
740572d6cdSStefan Hajnoczi                                  command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
750572d6cdSStefan Hajnoczi                                  depend_files: tracetool_depends)
76a81df1b6SPaolo Bonzini  trace_ust_all_c = custom_target('trace-ust-all.c',
77a81df1b6SPaolo Bonzini                                  output: 'trace-ust-all.c',
78a81df1b6SPaolo Bonzini                                  input: trace_events_files,
790572d6cdSStefan Hajnoczi                                  command: [ tracetool, '--group=all', '--format=ust-events-c', '@INPUT@', '@OUTPUT@' ],
800572d6cdSStefan Hajnoczi                                  depend_files: tracetool_depends)
81a81df1b6SPaolo Bonzini  trace_ss.add(trace_ust_all_h, trace_ust_all_c)
82a81df1b6SPaolo Bonzini  genh += trace_ust_all_h
83a81df1b6SPaolo Bonziniendif
84a81df1b6SPaolo Bonzini
859c29b741SPaolo Bonziniif 'simple' in get_option('trace_backends')
869c29b741SPaolo Bonzini  trace_ss.add(files('simple.c'))
879c29b741SPaolo Bonziniendif
889c29b741SPaolo Bonziniif 'ftrace' in get_option('trace_backends')
899c29b741SPaolo Bonzini  trace_ss.add(files('ftrace.c'))
909c29b741SPaolo Bonziniendif
91a81df1b6SPaolo Bonzinitrace_ss.add(files('control.c'))
925ac034b1SPhilippe Mathieu-Daudéif have_system or have_tools or have_ga
93a81df1b6SPaolo Bonzini  trace_ss.add(files('qmp.c'))
945ac034b1SPhilippe Mathieu-Daudéendif
95