libqemuutil, qapi, trace: convert to meson
[qemu/ar7.git] / trace / meson.build
blobf0a8d1c2e28740e0ee0c47615aa4d9631a34ba6a
1 trace_events_files = []
2 foreach dir : [ '.' ] + trace_events_subdirs
3   trace_events_file = meson.source_root() / dir / 'trace-events'
4   trace_events_files += [ trace_events_file ]
5   group_name = dir == '.' ? 'root' : dir.underscorify()
6   group = '--group=' + group_name
7   fmt = '@0@-' + group_name + '.@1@'
9   trace_h = custom_target(fmt.format('trace', 'h'),
10                           output: fmt.format('trace', 'h'),
11                           input: trace_events_file,
12                           command: [ tracetool, group, '--format=h', '@INPUT@' ],
13                           capture: true)
14   genh += trace_h
15   trace_c = custom_target(fmt.format('trace', 'c'),
16                           output: fmt.format('trace', 'c'),
17                           input: trace_events_file,
18                           command: [ tracetool, group, '--format=c', '@INPUT@' ],
19                           capture: true)
20   if 'CONFIG_TRACE_UST' in config_host
21     trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
22                                 output: fmt.format('trace-ust', 'h'),
23                                 input: trace_events_file,
24                                 command: [ tracetool, group, '--format=ust-events-h', '@INPUT@' ],
25                                 capture: true)
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@' ],
35                                  capture: true)
36     trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
37                                    output: fmt.format('trace-dtrace', 'h'),
38                                    input: trace_dtrace,
39                                    command: [ 'dtrace', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
40     trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
41                                    output: fmt.format('trace-dtrace', 'o'),
42                                    input: trace_dtrace,
43                                    command: [ 'dtrace', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
45     trace_ss.add(trace_dtrace_h, trace_dtrace_o)
46     genh += trace_dtrace_h
47   endif
48 endforeach
50 custom_target('trace-events-all',
51               output: 'trace-events-all',
52               input: trace_events_files,
53               command: [ 'cat', '@INPUT@' ],
54               capture: true,
55               install: true,
56               install_dir: config_host['qemu_datadir'])
58 if 'CONFIG_TRACE_UST' in config_host
59   trace_ust_all_h = custom_target('trace-ust-all.h',
60                                   output: 'trace-ust-all.h',
61                                   input: trace_events_files,
62                                   command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@' ],
63                                   capture: true)
64   trace_ust_all_c = custom_target('trace-ust-all.c',
65                                   output: 'trace-ust-all.c',
66                                   input: trace_events_files,
67                                   command: [ tracetool, '--group=all', '--format=ust-events-c', '@INPUT@' ],
68                                   capture: true)
69   trace_ss.add(trace_ust_all_h, trace_ust_all_c)
70   genh += trace_ust_all_h
71 endif
73 trace_ss.add(when: 'CONFIG_TRACE_SIMPLE', if_true: files('simple.c'))
74 trace_ss.add(when: 'CONFIG_TRACE_FTRACE', if_true: files('ftrace.c'))
75 trace_ss.add(files('control.c'))
76 trace_ss.add(files('qmp.c'))