file-win32: Fix "locking" option
[qemu.git] / trace / meson.build
blobb36937d3a6665b8cd08832b5cce8e58156c86d78
1 specific_ss.add(files('control-target.c'))
3 trace_events_files = []
4 foreach dir : [ '.' ] + trace_events_subdirs
5   trace_events_file = meson.source_root() / dir / 'trace-events'
6   trace_events_files += [ trace_events_file ]
7   group_name = dir == '.' ? 'root' : dir.underscorify()
8   group = '--group=' + group_name
9   fmt = '@0@-' + group_name + '.@1@'
11   trace_h = custom_target(fmt.format('trace', 'h'),
12                           output: fmt.format('trace', 'h'),
13                           input: trace_events_file,
14                           command: [ tracetool, group, '--format=h', '@INPUT@' ],
15                           capture: true)
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@' ],
21                           capture: true)
22   if 'CONFIG_TRACE_UST' in config_host
23     trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
24                                 output: fmt.format('trace-ust', 'h'),
25                                 input: trace_events_file,
26                                 command: [ tracetool, group, '--format=ust-events-h', '@INPUT@' ],
27                                 capture: true)
28     trace_ss.add(trace_ust_h, lttng, urcubp)
29     genh += trace_ust_h
30   endif
31   trace_ss.add(trace_h, trace_c)
32   if 'CONFIG_TRACE_DTRACE' in config_host
33     trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'),
34                                  output: fmt.format('trace-dtrace', 'dtrace'),
35                                  input: trace_events_file,
36                                  command: [ tracetool, group, '--format=d', '@INPUT@' ],
37                                  capture: true)
38     trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
39                                    output: fmt.format('trace-dtrace', 'h'),
40                                    input: trace_dtrace,
41                                    command: [ 'dtrace', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
42     trace_ss.add(trace_dtrace_h)
43     if host_machine.system() != 'darwin'
44       trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
45                                      output: fmt.format('trace-dtrace', 'o'),
46                                      input: trace_dtrace,
47                                      command: [ 'dtrace', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
48       trace_ss.add(trace_dtrace_o)
49     endif
51     genh += trace_dtrace_h
52   endif
53 endforeach
55 trace_events_all = custom_target('trace-events-all',
56                                  output: 'trace-events-all',
57                                  input: trace_events_files,
58                                  command: [ 'cat', '@INPUT@' ],
59                                  capture: true,
60                                  install: true,
61                                  install_dir: qemu_datadir)
63 foreach d : [
64   ['generated-tcg-tracers.h', 'tcg-h'],
65   ['generated-helpers.c', 'tcg-helper-c'],
66   ['generated-helpers.h', 'tcg-helper-h'],
67   ['generated-helpers-wrappers.h', 'tcg-helper-wrapper-h'],
69   gen = custom_target(d[0],
70                 output: d[0],
71                 input: meson.source_root() / 'trace-events',
72                 command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@' ],
73                 build_by_default: true, # to be removed when added to a target
74                 capture: true)
75   specific_ss.add(gen)
76 endforeach
78 if 'CONFIG_TRACE_UST' in config_host
79   trace_ust_all_h = custom_target('trace-ust-all.h',
80                                   output: 'trace-ust-all.h',
81                                   input: trace_events_files,
82                                   command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@' ],
83                                   capture: true)
84   trace_ust_all_c = custom_target('trace-ust-all.c',
85                                   output: 'trace-ust-all.c',
86                                   input: trace_events_files,
87                                   command: [ tracetool, '--group=all', '--format=ust-events-c', '@INPUT@' ],
88                                   capture: true)
89   trace_ss.add(trace_ust_all_h, trace_ust_all_c)
90   genh += trace_ust_all_h
91 endif
93 trace_ss.add(when: 'CONFIG_TRACE_SIMPLE', if_true: files('simple.c'))
94 trace_ss.add(when: 'CONFIG_TRACE_FTRACE', if_true: files('ftrace.c'))
95 trace_ss.add(files('control.c'))
96 trace_ss.add(files('qmp.c'))