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