| 1 | system_ss.add(files('control-target.c')) |
| 2 | if have_hmp |
| 3 | system_ss.add(files('trace-hmp-cmds.c')) |
| 4 | endif |
| 5 | trace_rs_targets = [] |
| 6 | trace_events_files = [] |
| 7 | foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events |
| 8 | if item in qapi_trace_events |
| 9 | trace_events_file = item |
| 10 | group_name = fs.name(item).underscorify() |
| 11 | else |
| 12 | trace_events_file = meson.project_source_root() / item / 'trace-events' |
| 13 | group_name = item == '.' ? 'root' : item.underscorify() |
| 14 | endif |
| 15 | trace_events_files += [ trace_events_file ] |
| 16 | group = '--group=' + group_name |
| 17 | fmt = '@0@-' + group_name + '.@1@' |
| 18 | |
| 19 | trace_h = custom_target(fmt.format('trace', 'h'), |
| 20 | output: fmt.format('trace', 'h'), |
| 21 | input: trace_events_file, |
| 22 | command: [ tracetool, group, '--format=h', '@INPUT@', '@OUTPUT@' ], |
| 23 | depend_files: tracetool_depends) |
| 24 | genh += trace_h |
| 25 | trace_c = custom_target(fmt.format('trace', 'c'), |
| 26 | output: fmt.format('trace', 'c'), |
| 27 | input: trace_events_file, |
| 28 | command: [ tracetool, group, '--format=c', '@INPUT@', '@OUTPUT@' ], |
| 29 | depend_files: tracetool_depends) |
| 30 | trace_rs = custom_target(fmt.format('trace', 'rs'), |
| 31 | output: fmt.format('trace', 'rs'), |
| 32 | input: trace_events_file, |
| 33 | command: [ tracetool, group, '--format=rs', '@INPUT@', '@OUTPUT@' ], |
| 34 | depend_files: tracetool_depends) |
| 35 | if 'ust' in get_option('trace_backends') |
| 36 | trace_ust_h = custom_target(fmt.format('trace-ust', 'h'), |
| 37 | output: fmt.format('trace-ust', 'h'), |
| 38 | input: trace_events_file, |
| 39 | command: [ tracetool, group, '--format=ust-events-h', '@INPUT@', '@OUTPUT@' ], |
| 40 | depend_files: tracetool_depends) |
| 41 | trace_ss.add(trace_ust_h, lttng) |
| 42 | genh += trace_ust_h |
| 43 | endif |
| 44 | trace_ss.add(trace_h, trace_c) |
| 45 | trace_rs_targets += trace_rs |
| 46 | if 'dtrace' in get_option('trace_backends') |
| 47 | trace_dtrace = custom_target(fmt.format('trace-dtrace', 'dtrace'), |
| 48 | output: fmt.format('trace-dtrace', 'dtrace'), |
| 49 | input: trace_events_file, |
| 50 | command: [ tracetool, group, '--format=d', '@INPUT@', '@OUTPUT@' ], |
| 51 | depend_files: tracetool_depends) |
| 52 | trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'), |
| 53 | output: fmt.format('trace-dtrace', 'h'), |
| 54 | input: trace_dtrace, |
| 55 | command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ]) |
| 56 | trace_ss.add(trace_dtrace_h) |
| 57 | if host_machine.system() != 'darwin' |
| 58 | trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'), |
| 59 | output: fmt.format('trace-dtrace', 'o'), |
| 60 | input: trace_dtrace, |
| 61 | command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ]) |
| 62 | trace_ss.add(trace_dtrace_o) |
| 63 | endif |
| 64 | |
| 65 | genh += trace_dtrace_h |
| 66 | endif |
| 67 | endforeach |
| 68 | |
| 69 | cat = [ python, '-c', 'import fileinput; [print(line, end="") for line in fileinput.input()]', '@INPUT@' ] |
| 70 | trace_events_all = custom_target('trace-events-all', |
| 71 | output: 'trace-events-all', |
| 72 | input: trace_events_files, |
| 73 | command: cat, |
| 74 | capture: true, |
| 75 | install: get_option('trace_backends') != [ 'nop' ], |
| 76 | install_dir: qemu_datadir) |
| 77 | |
| 78 | if 'ust' in get_option('trace_backends') |
| 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@', '@OUTPUT@' ], |
| 83 | depend_files: tracetool_depends) |
| 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@', '@OUTPUT@' ], |
| 88 | depend_files: tracetool_depends) |
| 89 | trace_ss.add(trace_ust_all_h, trace_ust_all_c) |
| 90 | genh += trace_ust_all_h |
| 91 | endif |
| 92 | |
| 93 | if 'simple' in get_option('trace_backends') |
| 94 | trace_ss.add(files('simple.c')) |
| 95 | endif |
| 96 | if 'ftrace' in get_option('trace_backends') |
| 97 | trace_ss.add(files('ftrace.c')) |
| 98 | endif |
| 99 | trace_ss.add(files('control.c')) |
| 100 | if have_system or have_tools or have_ga |
| 101 | trace_ss.add(files('qmp.c')) |
| 102 | endif |