xref: /openbmc/qemu/trace/meson.build (revision b83a80e8)
1aadac5b3SPeter Maydell
20e1309d0SMarc-André Lureauspecific_ss.add(files('control-target.c'))
30e1309d0SMarc-André Lureau
4a81df1b6SPaolo Bonzinitrace_events_files = []
5*b83a80e8SVladimir Sementsov-Ogievskiyforeach item : [ '.' ] + trace_events_subdirs + qapi_trace_events
6*b83a80e8SVladimir Sementsov-Ogievskiy  if item in qapi_trace_events
7*b83a80e8SVladimir Sementsov-Ogievskiy    trace_events_file = item
8*b83a80e8SVladimir Sementsov-Ogievskiy    group_name = item.full_path().split('/')[-1].underscorify()
9*b83a80e8SVladimir Sementsov-Ogievskiy  else
10*b83a80e8SVladimir Sementsov-Ogievskiy    trace_events_file = meson.project_source_root() / item / 'trace-events'
11*b83a80e8SVladimir Sementsov-Ogievskiy    group_name = item == '.' ? 'root' : item.underscorify()
12*b83a80e8SVladimir Sementsov-Ogievskiy  endif
13a81df1b6SPaolo Bonzini  trace_events_files += [ trace_events_file ]
14a81df1b6SPaolo Bonzini  group = '--group=' + group_name
15a81df1b6SPaolo Bonzini  fmt = '@0@-' + group_name + '.@1@'
16a81df1b6SPaolo Bonzini
17a81df1b6SPaolo Bonzini  trace_h = custom_target(fmt.format('trace', 'h'),
18a81df1b6SPaolo Bonzini                          output: fmt.format('trace', 'h'),
19a81df1b6SPaolo Bonzini                          input: trace_events_file,
200572d6cdSStefan Hajnoczi                          command: [ tracetool, group, '--format=h', '@INPUT@', '@OUTPUT@' ],
210572d6cdSStefan Hajnoczi                          depend_files: tracetool_depends)
22a81df1b6SPaolo Bonzini  genh += trace_h
23a81df1b6SPaolo Bonzini  trace_c = custom_target(fmt.format('trace', 'c'),
24a81df1b6SPaolo Bonzini                          output: fmt.format('trace', 'c'),
25a81df1b6SPaolo Bonzini                          input: trace_events_file,
260572d6cdSStefan Hajnoczi                          command: [ tracetool, group, '--format=c', '@INPUT@', '@OUTPUT@' ],
270572d6cdSStefan Hajnoczi                          depend_files: tracetool_depends)
289c29b741SPaolo Bonzini  if 'ust' in get_option('trace_backends')
29a81df1b6SPaolo Bonzini    trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
30a81df1b6SPaolo Bonzini                                output: fmt.format('trace-ust', 'h'),
31a81df1b6SPaolo Bonzini                                input: trace_events_file,
320572d6cdSStefan Hajnoczi                                command: [ tracetool, group, '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
330572d6cdSStefan Hajnoczi                                depend_files: tracetool_depends)
34bbe47ed2SPaolo Bonzini    trace_ss.add(trace_ust_h, lttng)
35a81df1b6SPaolo Bonzini    genh += trace_ust_h
36a81df1b6SPaolo Bonzini  endif
37a81df1b6SPaolo Bonzini  trace_ss.add(trace_h, trace_c)
389c29b741SPaolo Bonzini  if 'dtrace' in get_option('trace_backends')
39a81df1b6SPaolo Bonzini    trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'),
40a81df1b6SPaolo Bonzini                                 output: fmt.format('trace-dtrace', 'dtrace'),
41a81df1b6SPaolo Bonzini                                 input: trace_events_file,
420572d6cdSStefan Hajnoczi                                 command: [ tracetool, group, '--format=d', '@INPUT@', '@OUTPUT@' ],
430572d6cdSStefan Hajnoczi                                 depend_files: tracetool_depends)
44a81df1b6SPaolo Bonzini    trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
45a81df1b6SPaolo Bonzini                                   output: fmt.format('trace-dtrace', 'h'),
46a81df1b6SPaolo Bonzini                                   input: trace_dtrace,
47d051d0e1SPaolo Bonzini                                   command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
48568ac779SRoman Bolshakov    trace_ss.add(trace_dtrace_h)
49568ac779SRoman Bolshakov    if host_machine.system() != 'darwin'
50a81df1b6SPaolo Bonzini      trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
51a81df1b6SPaolo Bonzini                                     output: fmt.format('trace-dtrace', 'o'),
52a81df1b6SPaolo Bonzini                                     input: trace_dtrace,
53d051d0e1SPaolo Bonzini                                     command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
54568ac779SRoman Bolshakov      trace_ss.add(trace_dtrace_o)
55568ac779SRoman Bolshakov    endif
56a81df1b6SPaolo Bonzini
57a81df1b6SPaolo Bonzini    genh += trace_dtrace_h
58a81df1b6SPaolo Bonzini  endif
59a81df1b6SPaolo Bonziniendforeach
60a81df1b6SPaolo Bonzini
6110e1d263SMarc-André Lureautrace_events_all = custom_target('trace-events-all',
62a81df1b6SPaolo Bonzini                                 output: 'trace-events-all',
63a81df1b6SPaolo Bonzini                                 input: trace_events_files,
64a81df1b6SPaolo Bonzini                                 command: [ 'cat', '@INPUT@' ],
65a81df1b6SPaolo Bonzini                                 capture: true,
66a81df1b6SPaolo Bonzini                                 install: true,
67ab4c0996SMarc-André Lureau                                 install_dir: qemu_datadir)
68a81df1b6SPaolo Bonzini
6971c782f5SMarc-André Lureauforeach d : [
7071c782f5SMarc-André Lureau  ['generated-tcg-tracers.h', 'tcg-h'],
7171c782f5SMarc-André Lureau  ['generated-helpers.c', 'tcg-helper-c'],
7271c782f5SMarc-André Lureau  ['generated-helpers.h', 'tcg-helper-h'],
7371c782f5SMarc-André Lureau  ['generated-helpers-wrappers.h', 'tcg-helper-wrapper-h'],
7471c782f5SMarc-André Lureau]
750e1309d0SMarc-André Lureau  gen = custom_target(d[0],
7671c782f5SMarc-André Lureau                output: d[0],
77654d6b04SPaolo Bonzini                input: meson.project_source_root() / 'trace-events',
780572d6cdSStefan Hajnoczi                command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@', '@OUTPUT@' ],
790572d6cdSStefan Hajnoczi                depend_files: tracetool_depends)
80e921f1a7SPaolo Bonzini  specific_ss.add(when: 'CONFIG_TCG', if_true: gen)
8171c782f5SMarc-André Lureauendforeach
8271c782f5SMarc-André Lureau
839c29b741SPaolo Bonziniif 'ust' in get_option('trace_backends')
84a81df1b6SPaolo Bonzini  trace_ust_all_h = custom_target('trace-ust-all.h',
85a81df1b6SPaolo Bonzini                                  output: 'trace-ust-all.h',
86a81df1b6SPaolo Bonzini                                  input: trace_events_files,
870572d6cdSStefan Hajnoczi                                  command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
880572d6cdSStefan Hajnoczi                                  depend_files: tracetool_depends)
89a81df1b6SPaolo Bonzini  trace_ust_all_c = custom_target('trace-ust-all.c',
90a81df1b6SPaolo Bonzini                                  output: 'trace-ust-all.c',
91a81df1b6SPaolo Bonzini                                  input: trace_events_files,
920572d6cdSStefan Hajnoczi                                  command: [ tracetool, '--group=all', '--format=ust-events-c', '@INPUT@', '@OUTPUT@' ],
930572d6cdSStefan Hajnoczi                                  depend_files: tracetool_depends)
94a81df1b6SPaolo Bonzini  trace_ss.add(trace_ust_all_h, trace_ust_all_c)
95a81df1b6SPaolo Bonzini  genh += trace_ust_all_h
96a81df1b6SPaolo Bonziniendif
97a81df1b6SPaolo Bonzini
989c29b741SPaolo Bonziniif 'simple' in get_option('trace_backends')
999c29b741SPaolo Bonzini  trace_ss.add(files('simple.c'))
1009c29b741SPaolo Bonziniendif
1019c29b741SPaolo Bonziniif 'ftrace' in get_option('trace_backends')
1029c29b741SPaolo Bonzini  trace_ss.add(files('ftrace.c'))
1039c29b741SPaolo Bonziniendif
104a81df1b6SPaolo Bonzinitrace_ss.add(files('control.c'))
105a81df1b6SPaolo Bonzinitrace_ss.add(files('qmp.c'))
106