xref: /openbmc/qemu/trace/meson.build (revision a81df1b6)
1*a81df1b6SPaolo Bonzinitrace_events_files = []
2*a81df1b6SPaolo Bonziniforeach dir : [ '.' ] + trace_events_subdirs
3*a81df1b6SPaolo Bonzini  trace_events_file = meson.source_root() / dir / 'trace-events'
4*a81df1b6SPaolo Bonzini  trace_events_files += [ trace_events_file ]
5*a81df1b6SPaolo Bonzini  group_name = dir == '.' ? 'root' : dir.underscorify()
6*a81df1b6SPaolo Bonzini  group = '--group=' + group_name
7*a81df1b6SPaolo Bonzini  fmt = '@0@-' + group_name + '.@1@'
8*a81df1b6SPaolo Bonzini
9*a81df1b6SPaolo Bonzini  trace_h = custom_target(fmt.format('trace', 'h'),
10*a81df1b6SPaolo Bonzini                          output: fmt.format('trace', 'h'),
11*a81df1b6SPaolo Bonzini                          input: trace_events_file,
12*a81df1b6SPaolo Bonzini                          command: [ tracetool, group, '--format=h', '@INPUT@' ],
13*a81df1b6SPaolo Bonzini                          capture: true)
14*a81df1b6SPaolo Bonzini  genh += trace_h
15*a81df1b6SPaolo Bonzini  trace_c = custom_target(fmt.format('trace', 'c'),
16*a81df1b6SPaolo Bonzini                          output: fmt.format('trace', 'c'),
17*a81df1b6SPaolo Bonzini                          input: trace_events_file,
18*a81df1b6SPaolo Bonzini                          command: [ tracetool, group, '--format=c', '@INPUT@' ],
19*a81df1b6SPaolo Bonzini                          capture: true)
20*a81df1b6SPaolo Bonzini  if 'CONFIG_TRACE_UST' in config_host
21*a81df1b6SPaolo Bonzini    trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
22*a81df1b6SPaolo Bonzini                                output: fmt.format('trace-ust', 'h'),
23*a81df1b6SPaolo Bonzini                                input: trace_events_file,
24*a81df1b6SPaolo Bonzini                                command: [ tracetool, group, '--format=ust-events-h', '@INPUT@' ],
25*a81df1b6SPaolo Bonzini                                capture: true)
26*a81df1b6SPaolo Bonzini    trace_ss.add(trace_ust_h, lttng, urcubp)
27*a81df1b6SPaolo Bonzini    genh += trace_ust_h
28*a81df1b6SPaolo Bonzini  endif
29*a81df1b6SPaolo Bonzini  trace_ss.add(trace_h, trace_c)
30*a81df1b6SPaolo Bonzini  if 'CONFIG_TRACE_DTRACE' in config_host
31*a81df1b6SPaolo Bonzini    trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'),
32*a81df1b6SPaolo Bonzini                                 output: fmt.format('trace-dtrace', 'dtrace'),
33*a81df1b6SPaolo Bonzini                                 input: trace_events_file,
34*a81df1b6SPaolo Bonzini                                 command: [ tracetool, group, '--format=d', '@INPUT@' ],
35*a81df1b6SPaolo Bonzini                                 capture: true)
36*a81df1b6SPaolo Bonzini    trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
37*a81df1b6SPaolo Bonzini                                   output: fmt.format('trace-dtrace', 'h'),
38*a81df1b6SPaolo Bonzini                                   input: trace_dtrace,
39*a81df1b6SPaolo Bonzini                                   command: [ 'dtrace', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
40*a81df1b6SPaolo Bonzini    trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
41*a81df1b6SPaolo Bonzini                                   output: fmt.format('trace-dtrace', 'o'),
42*a81df1b6SPaolo Bonzini                                   input: trace_dtrace,
43*a81df1b6SPaolo Bonzini                                   command: [ 'dtrace', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
44*a81df1b6SPaolo Bonzini
45*a81df1b6SPaolo Bonzini    trace_ss.add(trace_dtrace_h, trace_dtrace_o)
46*a81df1b6SPaolo Bonzini    genh += trace_dtrace_h
47*a81df1b6SPaolo Bonzini  endif
48*a81df1b6SPaolo Bonziniendforeach
49*a81df1b6SPaolo Bonzini
50*a81df1b6SPaolo Bonzinicustom_target('trace-events-all',
51*a81df1b6SPaolo Bonzini              output: 'trace-events-all',
52*a81df1b6SPaolo Bonzini              input: trace_events_files,
53*a81df1b6SPaolo Bonzini              command: [ 'cat', '@INPUT@' ],
54*a81df1b6SPaolo Bonzini              capture: true,
55*a81df1b6SPaolo Bonzini              install: true,
56*a81df1b6SPaolo Bonzini              install_dir: config_host['qemu_datadir'])
57*a81df1b6SPaolo Bonzini
58*a81df1b6SPaolo Bonziniif 'CONFIG_TRACE_UST' in config_host
59*a81df1b6SPaolo Bonzini  trace_ust_all_h = custom_target('trace-ust-all.h',
60*a81df1b6SPaolo Bonzini                                  output: 'trace-ust-all.h',
61*a81df1b6SPaolo Bonzini                                  input: trace_events_files,
62*a81df1b6SPaolo Bonzini                                  command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@' ],
63*a81df1b6SPaolo Bonzini                                  capture: true)
64*a81df1b6SPaolo Bonzini  trace_ust_all_c = custom_target('trace-ust-all.c',
65*a81df1b6SPaolo Bonzini                                  output: 'trace-ust-all.c',
66*a81df1b6SPaolo Bonzini                                  input: trace_events_files,
67*a81df1b6SPaolo Bonzini                                  command: [ tracetool, '--group=all', '--format=ust-events-c', '@INPUT@' ],
68*a81df1b6SPaolo Bonzini                                  capture: true)
69*a81df1b6SPaolo Bonzini  trace_ss.add(trace_ust_all_h, trace_ust_all_c)
70*a81df1b6SPaolo Bonzini  genh += trace_ust_all_h
71*a81df1b6SPaolo Bonziniendif
72*a81df1b6SPaolo Bonzini
73*a81df1b6SPaolo Bonzinitrace_ss.add(when: 'CONFIG_TRACE_SIMPLE', if_true: files('simple.c'))
74*a81df1b6SPaolo Bonzinitrace_ss.add(when: 'CONFIG_TRACE_FTRACE', if_true: files('ftrace.c'))
75*a81df1b6SPaolo Bonzinitrace_ss.add(files('control.c'))
76*a81df1b6SPaolo Bonzinitrace_ss.add(files('qmp.c'))
77