xref: /openbmc/qemu/trace/meson.build (revision 9c29b741)
1aadac5b3SPeter Maydell
20e1309d0SMarc-André Lureauspecific_ss.add(files('control-target.c'))
30e1309d0SMarc-André Lureau
4a81df1b6SPaolo Bonzinitrace_events_files = []
5a81df1b6SPaolo Bonziniforeach dir : [ '.' ] + trace_events_subdirs
6654d6b04SPaolo Bonzini  trace_events_file = meson.project_source_root() / dir / 'trace-events'
7a81df1b6SPaolo Bonzini  trace_events_files += [ trace_events_file ]
8a81df1b6SPaolo Bonzini  group_name = dir == '.' ? 'root' : dir.underscorify()
9a81df1b6SPaolo Bonzini  group = '--group=' + group_name
10a81df1b6SPaolo Bonzini  fmt = '@0@-' + group_name + '.@1@'
11a81df1b6SPaolo Bonzini
12a81df1b6SPaolo Bonzini  trace_h = custom_target(fmt.format('trace', 'h'),
13a81df1b6SPaolo Bonzini                          output: fmt.format('trace', 'h'),
14a81df1b6SPaolo Bonzini                          input: trace_events_file,
150572d6cdSStefan Hajnoczi                          command: [ tracetool, group, '--format=h', '@INPUT@', '@OUTPUT@' ],
160572d6cdSStefan Hajnoczi                          depend_files: tracetool_depends)
17a81df1b6SPaolo Bonzini  genh += trace_h
18a81df1b6SPaolo Bonzini  trace_c = custom_target(fmt.format('trace', 'c'),
19a81df1b6SPaolo Bonzini                          output: fmt.format('trace', 'c'),
20a81df1b6SPaolo Bonzini                          input: trace_events_file,
210572d6cdSStefan Hajnoczi                          command: [ tracetool, group, '--format=c', '@INPUT@', '@OUTPUT@' ],
220572d6cdSStefan Hajnoczi                          depend_files: tracetool_depends)
23*9c29b741SPaolo Bonzini  if 'ust' in get_option('trace_backends')
24a81df1b6SPaolo Bonzini    trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
25a81df1b6SPaolo Bonzini                                output: fmt.format('trace-ust', 'h'),
26a81df1b6SPaolo Bonzini                                input: trace_events_file,
270572d6cdSStefan Hajnoczi                                command: [ tracetool, group, '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
280572d6cdSStefan Hajnoczi                                depend_files: tracetool_depends)
29bbe47ed2SPaolo Bonzini    trace_ss.add(trace_ust_h, lttng)
30a81df1b6SPaolo Bonzini    genh += trace_ust_h
31a81df1b6SPaolo Bonzini  endif
32a81df1b6SPaolo Bonzini  trace_ss.add(trace_h, trace_c)
33*9c29b741SPaolo Bonzini  if 'dtrace' in get_option('trace_backends')
34a81df1b6SPaolo Bonzini    trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'),
35a81df1b6SPaolo Bonzini                                 output: fmt.format('trace-dtrace', 'dtrace'),
36a81df1b6SPaolo Bonzini                                 input: trace_events_file,
370572d6cdSStefan Hajnoczi                                 command: [ tracetool, group, '--format=d', '@INPUT@', '@OUTPUT@' ],
380572d6cdSStefan Hajnoczi                                 depend_files: tracetool_depends)
39a81df1b6SPaolo Bonzini    trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
40a81df1b6SPaolo Bonzini                                   output: fmt.format('trace-dtrace', 'h'),
41a81df1b6SPaolo Bonzini                                   input: trace_dtrace,
42d051d0e1SPaolo Bonzini                                   command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
43568ac779SRoman Bolshakov    trace_ss.add(trace_dtrace_h)
44568ac779SRoman Bolshakov    if host_machine.system() != 'darwin'
45a81df1b6SPaolo Bonzini      trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
46a81df1b6SPaolo Bonzini                                     output: fmt.format('trace-dtrace', 'o'),
47a81df1b6SPaolo Bonzini                                     input: trace_dtrace,
48d051d0e1SPaolo Bonzini                                     command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
49568ac779SRoman Bolshakov      trace_ss.add(trace_dtrace_o)
50568ac779SRoman Bolshakov    endif
51a81df1b6SPaolo Bonzini
52a81df1b6SPaolo Bonzini    genh += trace_dtrace_h
53a81df1b6SPaolo Bonzini  endif
54a81df1b6SPaolo Bonziniendforeach
55a81df1b6SPaolo Bonzini
5610e1d263SMarc-André Lureautrace_events_all = custom_target('trace-events-all',
57a81df1b6SPaolo Bonzini                                 output: 'trace-events-all',
58a81df1b6SPaolo Bonzini                                 input: trace_events_files,
59a81df1b6SPaolo Bonzini                                 command: [ 'cat', '@INPUT@' ],
60a81df1b6SPaolo Bonzini                                 capture: true,
61a81df1b6SPaolo Bonzini                                 install: true,
62ab4c0996SMarc-André Lureau                                 install_dir: qemu_datadir)
63a81df1b6SPaolo Bonzini
6471c782f5SMarc-André Lureauforeach d : [
6571c782f5SMarc-André Lureau  ['generated-tcg-tracers.h', 'tcg-h'],
6671c782f5SMarc-André Lureau  ['generated-helpers.c', 'tcg-helper-c'],
6771c782f5SMarc-André Lureau  ['generated-helpers.h', 'tcg-helper-h'],
6871c782f5SMarc-André Lureau  ['generated-helpers-wrappers.h', 'tcg-helper-wrapper-h'],
6971c782f5SMarc-André Lureau]
700e1309d0SMarc-André Lureau  gen = custom_target(d[0],
7171c782f5SMarc-André Lureau                output: d[0],
72654d6b04SPaolo Bonzini                input: meson.project_source_root() / 'trace-events',
730572d6cdSStefan Hajnoczi                command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@', '@OUTPUT@' ],
740572d6cdSStefan Hajnoczi                depend_files: tracetool_depends)
75e921f1a7SPaolo Bonzini  specific_ss.add(when: 'CONFIG_TCG', if_true: gen)
7671c782f5SMarc-André Lureauendforeach
7771c782f5SMarc-André Lureau
78*9c29b741SPaolo Bonziniif 'ust' in get_option('trace_backends')
79a81df1b6SPaolo Bonzini  trace_ust_all_h = custom_target('trace-ust-all.h',
80a81df1b6SPaolo Bonzini                                  output: 'trace-ust-all.h',
81a81df1b6SPaolo Bonzini                                  input: trace_events_files,
820572d6cdSStefan Hajnoczi                                  command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
830572d6cdSStefan Hajnoczi                                  depend_files: tracetool_depends)
84a81df1b6SPaolo Bonzini  trace_ust_all_c = custom_target('trace-ust-all.c',
85a81df1b6SPaolo Bonzini                                  output: 'trace-ust-all.c',
86a81df1b6SPaolo Bonzini                                  input: trace_events_files,
870572d6cdSStefan Hajnoczi                                  command: [ tracetool, '--group=all', '--format=ust-events-c', '@INPUT@', '@OUTPUT@' ],
880572d6cdSStefan Hajnoczi                                  depend_files: tracetool_depends)
89a81df1b6SPaolo Bonzini  trace_ss.add(trace_ust_all_h, trace_ust_all_c)
90a81df1b6SPaolo Bonzini  genh += trace_ust_all_h
91a81df1b6SPaolo Bonziniendif
92a81df1b6SPaolo Bonzini
93*9c29b741SPaolo Bonziniif 'simple' in get_option('trace_backends')
94*9c29b741SPaolo Bonzini  trace_ss.add(files('simple.c'))
95*9c29b741SPaolo Bonziniendif
96*9c29b741SPaolo Bonziniif 'ftrace' in get_option('trace_backends')
97*9c29b741SPaolo Bonzini  trace_ss.add(files('ftrace.c'))
98*9c29b741SPaolo Bonziniendif
99a81df1b6SPaolo Bonzinitrace_ss.add(files('control.c'))
100a81df1b6SPaolo Bonzinitrace_ss.add(files('qmp.c'))
101