meson.build: Detect bzip2 program
[qemu/ar7.git] / trace / meson.build
bloba0be8f9b0db96ed21ec4fcd6572b9ce657fdcb3b
2 specific_ss.add(files('control-target.c'))
4 trace_events_files = []
5 foreach dir : [ '.' ] + trace_events_subdirs
6   trace_events_file = meson.source_root() / dir / 'trace-events'
7   trace_events_files += [ trace_events_file ]
8   group_name = dir == '.' ? 'root' : dir.underscorify()
9   group = '--group=' + group_name
10   fmt = '@0@-' + group_name + '.@1@'
12   trace_h = custom_target(fmt.format('trace', 'h'),
13                           output: fmt.format('trace', 'h'),
14                           input: trace_events_file,
15                           command: [ tracetool, group, '--format=h', '@INPUT@', '@OUTPUT@' ])
16   genh += trace_h
17   trace_c = custom_target(fmt.format('trace', 'c'),
18                           output: fmt.format('trace', 'c'),
19                           input: trace_events_file,
20                           command: [ tracetool, group, '--format=c', '@INPUT@', '@OUTPUT@' ])
21   if 'CONFIG_TRACE_UST' in config_host
22     trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
23                                 output: fmt.format('trace-ust', 'h'),
24                                 input: trace_events_file,
25                                 command: [ tracetool, group, '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ])
26     trace_ss.add(trace_ust_h, lttng, urcubp)
27     genh += trace_ust_h
28   endif
29   trace_ss.add(trace_h, trace_c)
30   if 'CONFIG_TRACE_DTRACE' in config_host
31     trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'),
32                                  output: fmt.format('trace-dtrace', 'dtrace'),
33                                  input: trace_events_file,
34                                  command: [ tracetool, group, '--format=d', '@INPUT@', '@OUTPUT@' ])
35     trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
36                                    output: fmt.format('trace-dtrace', 'h'),
37                                    input: trace_dtrace,
38                                    command: [ 'dtrace', '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
39     trace_ss.add(trace_dtrace_h)
40     if host_machine.system() != 'darwin'
41       trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
42                                      output: fmt.format('trace-dtrace', 'o'),
43                                      input: trace_dtrace,
44                                      command: [ 'dtrace', '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
45       trace_ss.add(trace_dtrace_o)
46     endif
48     genh += trace_dtrace_h
49   endif
50 endforeach
52 trace_events_all = custom_target('trace-events-all',
53                                  output: 'trace-events-all',
54                                  input: trace_events_files,
55                                  command: [ 'cat', '@INPUT@' ],
56                                  capture: true,
57                                  install: true,
58                                  install_dir: qemu_datadir)
60 foreach d : [
61   ['generated-tcg-tracers.h', 'tcg-h'],
62   ['generated-helpers.c', 'tcg-helper-c'],
63   ['generated-helpers.h', 'tcg-helper-h'],
64   ['generated-helpers-wrappers.h', 'tcg-helper-wrapper-h'],
66   gen = custom_target(d[0],
67                 output: d[0],
68                 input: meson.source_root() / 'trace-events',
69                 command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@', '@OUTPUT@' ])
70   specific_ss.add(when: 'CONFIG_TCG', if_true: gen)
71 endforeach
73 if 'CONFIG_TRACE_UST' in config_host
74   trace_ust_all_h = custom_target('trace-ust-all.h',
75                                   output: 'trace-ust-all.h',
76                                   input: trace_events_files,
77                                   command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ])
78   trace_ust_all_c = custom_target('trace-ust-all.c',
79                                   output: 'trace-ust-all.c',
80                                   input: trace_events_files,
81                                   command: [ tracetool, '--group=all', '--format=ust-events-c', '@INPUT@', '@OUTPUT@' ])
82   trace_ss.add(trace_ust_all_h, trace_ust_all_c)
83   genh += trace_ust_all_h
84 endif
86 trace_ss.add(when: 'CONFIG_TRACE_SIMPLE', if_true: files('simple.c'))
87 trace_ss.add(when: 'CONFIG_TRACE_FTRACE', if_true: files('ftrace.c'))
88 trace_ss.add(files('control.c'))
89 trace_ss.add(files('qmp.c'))