Merge tag 'pull-aspeed-20240617' of https://github.com/legoater/qemu into staging
[qemu/armbru.git] / trace / meson.build
blobc3412dc0ba5a29490441e150d2cfe58f71551314
1 system_ss.add(files('trace-hmp-cmds.c'))
3 specific_ss.add(files('control-target.c'))
5 trace_events_files = []
6 foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events
7   if item in qapi_trace_events
8     trace_events_file = item
9     group_name = item.full_path().split('/')[-1].underscorify()
10   else
11     trace_events_file = meson.project_source_root() / item / 'trace-events'
12     group_name = item == '.' ? 'root' : item.underscorify()
13   endif
14   trace_events_files += [ trace_events_file ]
15   group = '--group=' + group_name
16   fmt = '@0@-' + group_name + '.@1@'
18   trace_h = custom_target(fmt.format('trace', 'h'),
19                           output: fmt.format('trace', 'h'),
20                           input: trace_events_file,
21                           command: [ tracetool, group, '--format=h', '@INPUT@', '@OUTPUT@' ],
22                           depend_files: tracetool_depends)
23   genh += trace_h
24   trace_c = custom_target(fmt.format('trace', 'c'),
25                           output: fmt.format('trace', 'c'),
26                           input: trace_events_file,
27                           command: [ tracetool, group, '--format=c', '@INPUT@', '@OUTPUT@' ],
28                           depend_files: tracetool_depends)
29   if 'ust' in get_option('trace_backends')
30     trace_ust_h = custom_target(fmt.format('trace-ust', 'h'),
31                                 output: fmt.format('trace-ust', 'h'),
32                                 input: trace_events_file,
33                                 command: [ tracetool, group, '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
34                                 depend_files: tracetool_depends)
35     trace_ss.add(trace_ust_h, lttng)
36     genh += trace_ust_h
37   endif
38   trace_ss.add(trace_h, trace_c)
39   if 'dtrace' in get_option('trace_backends')
40     trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'),
41                                  output: fmt.format('trace-dtrace', 'dtrace'),
42                                  input: trace_events_file,
43                                  command: [ tracetool, group, '--format=d', '@INPUT@', '@OUTPUT@' ],
44                                  depend_files: tracetool_depends)
45     trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
46                                    output: fmt.format('trace-dtrace', 'h'),
47                                    input: trace_dtrace,
48                                    command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
49     trace_ss.add(trace_dtrace_h)
50     if host_machine.system() != 'darwin'
51       trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
52                                      output: fmt.format('trace-dtrace', 'o'),
53                                      input: trace_dtrace,
54                                      command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
55       trace_ss.add(trace_dtrace_o)
56     endif
58     genh += trace_dtrace_h
59   endif
60 endforeach
62 trace_events_all = custom_target('trace-events-all',
63                                  output: 'trace-events-all',
64                                  input: trace_events_files,
65                                  command: [ 'cat', '@INPUT@' ],
66                                  capture: true,
67                                  install: get_option('trace_backends') != [ 'nop' ],
68                                  install_dir: qemu_datadir)
70 if 'ust' in get_option('trace_backends')
71   trace_ust_all_h = custom_target('trace-ust-all.h',
72                                   output: 'trace-ust-all.h',
73                                   input: trace_events_files,
74                                   command: [ tracetool, '--group=all', '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ],
75                                   depend_files: tracetool_depends)
76   trace_ust_all_c = custom_target('trace-ust-all.c',
77                                   output: 'trace-ust-all.c',
78                                   input: trace_events_files,
79                                   command: [ tracetool, '--group=all', '--format=ust-events-c', '@INPUT@', '@OUTPUT@' ],
80                                   depend_files: tracetool_depends)
81   trace_ss.add(trace_ust_all_h, trace_ust_all_c)
82   genh += trace_ust_all_h
83 endif
85 if 'simple' in get_option('trace_backends')
86   trace_ss.add(files('simple.c'))
87 endif
88 if 'ftrace' in get_option('trace_backends')
89   trace_ss.add(files('ftrace.c'))
90 endif
91 trace_ss.add(files('control.c'))
92 if have_system or have_tools or have_ga
93   trace_ss.add(files('qmp.c'))
94 endif