Debian Codegraph @

tools/perf/util/Build

raw
1 include $(srctree)/tools/scripts/Makefile.include
2 include $(srctree)/tools/scripts/utilities.mak
3
4 perf-util-y += annotate-arch/
5 perf-util-y += arm64-frame-pointer-unwind-support.o
6 perf-util-y += addr2line.o
7 perf-util-y += addr_location.o
8 perf-util-y += annotate.o
9 perf-util-y += blake2s.o
10 perf-util-y += block-info.o
11 perf-util-y += block-range.o
12 perf-util-y += build-id.o
13 perf-util-y += cacheline.o
14 perf-util-$(CONFIG_LIBCAPSTONE) += capstone.o
15 perf-util-y += config.o
16 perf-util-y += copyfile.o
17 perf-util-y += ctype.o
18 perf-util-y += db-export.o
19 perf-util-y += disasm.o
20 perf-util-y += env.o
21 perf-util-y += event.o
22 perf-util-y += evlist.o
23 perf-util-y += sideband_evlist.o
24 perf-util-y += evsel.o
25 perf-util-y += evsel_fprintf.o
26 perf-util-y += perf_event_attr_fprintf.o
27 perf-util-y += evswitch.o
28 perf-util-y += find_bit.o
29 perf-util-y += levenshtein.o
30 perf-util-$(CONFIG_LIBBFD) += libbfd.o
31 perf-util-y += llvm.o
32 perf-util-y += mmap.o
33 perf-util-y += memswap.o
34 perf-util-y += parse-events.o
35 perf-util-y += print-events.o
36 perf-util-y += tracepoint.o
37 perf-util-y += perf_regs.o
38 perf-util-y += perf-regs-arch/
39 perf-util-y += path.o
40 perf-util-y += print_binary.o
41 perf-util-y += print_insn.o
42 perf-util-y += rlimit.o
43 perf-util-y += argv_split.o
44 perf-util-y += rbtree.o
45 perf-util-y += libstring.o
46 perf-util-y += bitmap.o
47 perf-util-y += hweight.o
48 perf-util-y += smt.o
49 perf-util-y += strbuf.o
50 perf-util-y += string.o
51 perf-util-y += strlist.o
52 perf-util-y += strfilter.o
53 perf-util-y += top.o
54 perf-util-y += usage.o
55 perf-util-y += dso.o
56 perf-util-y += dsos.o
57 perf-util-y += symbol.o
58 perf-util-y += symbol_fprintf.o
59 perf-util-y += map_symbol.o
60 perf-util-y += color.o
61 perf-util-y += color_config.o
62 perf-util-y += metricgroup.o
63 perf-util-y += header.o
64 perf-util-y += callchain.o
65 perf-util-y += values.o
66 perf-util-y += debug.o
67 perf-util-y += fncache.o
68 perf-util-y += machine.o
69 perf-util-y += map.o
70 perf-util-y += maps.o
71 perf-util-y += pstack.o
72 perf-util-y += session.o
73 perf-util-y += tool.o
74 perf-util-y += sample.o
75 perf-util-y += sample-raw.o
76 perf-util-y += s390-sample-raw.o
77 perf-util-y += amd-sample-raw.o
78 perf-util-$(CONFIG_TRACE) += syscalltbl.o
79 perf-util-y += ordered-events.o
80 perf-util-y += namespaces.o
81 perf-util-y += comm.o
82 perf-util-y += thread.o
83 perf-util-y += threads.o
84 perf-util-y += thread_map.o
85 perf-util-y += parse-events-flex.o
86 perf-util-y += parse-events-bison.o
87 perf-util-y += pmu.o
88 perf-util-y += pmus.o
89 perf-util-y += pmu-flex.o
90 perf-util-y += pmu-bison.o
91 perf-util-y += drm_pmu.o
92 perf-util-y += hwmon_pmu.o
93 perf-util-y += tool_pmu.o
94 perf-util-y += tp_pmu.o
95 perf-util-y += svghelper.o
96 perf-util-y += trace-event-info.o
97 perf-util-y += trace-event-scripting.o
98 perf-util-$(CONFIG_LIBTRACEEVENT) += trace-event.o
99 perf-util-$(CONFIG_LIBTRACEEVENT) += trace-event-parse.o
100 perf-util-$(CONFIG_LIBTRACEEVENT) += trace-event-read.o
101 perf-util-y += sort.o
102 perf-util-y += hist.o
103 perf-util-y += util.o
104 perf-util-y += cpumap.o
105 perf-util-y += affinity.o
106 perf-util-y += cputopo.o
107 perf-util-y += cgroup.o
108 perf-util-y += target.o
109 perf-util-y += rblist.o
110 perf-util-y += intlist.o
111 perf-util-y += vdso.o
112 perf-util-y += counts.o
113 perf-util-y += stat.o
114 perf-util-y += stat-shadow.o
115 perf-util-y += stat-display.o
116 perf-util-y += perf_api_probe.o
117 perf-util-y += record.o
118 perf-util-y += srcline.o
119 perf-util-y += srccode.o
120 perf-util-y += synthetic-events.o
121 perf-util-y += data.o
122 perf-util-y += tsc.o
123 perf-util-y += cloexec.o
124 perf-util-y += call-path.o
125 perf-util-y += rwsem.o
126 perf-util-y += thread-stack.o
127 perf-util-y += spark.o
128 perf-util-y += topdown.o
129 perf-util-y += iostat.o
130 perf-util-y += stream.o
131 perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o
132 perf-util-y += kvm-stat-arch/
133 perf-util-y += lock-contention.o
134 perf-util-y += auxtrace.o
135 perf-util-y += intel-pt-decoder/
136 perf-util-y += intel-pt.o
137 perf-util-y += intel-bts.o
138 perf-util-y += arm-spe.o
139 perf-util-y += arm-spe-decoder/
140 perf-util-y += hisi-ptt.o
141 perf-util-y += hisi-ptt-decoder/
142 perf-util-y += s390-cpumsf.o
143 perf-util-y += powerpc-vpadtl.o
144
145 ifdef CONFIG_LIBOPENCSD
146 perf-util-y += cs-etm.o
147 perf-util-y += cs-etm-decoder/
148 endif
149 perf-util-y += cs-etm-base.o
150
151 perf-util-y += parse-branch-options.o
152 perf-util-y += dump-insn.o
153 perf-util-y += parse-regs-options.o
154 perf-util-y += parse-sublevel-options.o
155 perf-util-y += term.o
156 perf-util-y += help-unknown-cmd.o
157 perf-util-y += dlfilter.o
158 perf-util-y += mem-events.o
159 perf-util-y += mem-info.o
160 perf-util-y += vsprintf.o
161 perf-util-y += units.o
162 perf-util-y += time-utils.o
163 perf-util-y += expr-flex.o
164 perf-util-y += expr-bison.o
165 perf-util-y += expr.o
166 perf-util-y += branch.o
167 perf-util-y += mem2node.o
168 perf-util-y += clockid.o
169 perf-util-y += list_sort.o
170 perf-util-y += mutex.o
171 perf-util-y += sharded_mutex.o
172 perf-util-y += intel-tpebs.o
173
174 perf-util-$(CONFIG_LIBBPF) += bpf_map.o
175 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_counter.o
176 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_counter_cgroup.o
177 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_ftrace.o
178 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_off_cpu.o
179 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-filter.o
180 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-flex.o
181 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-bison.o
182 perf-util-$(CONFIG_PERF_BPF_SKEL) += btf.o
183
184 ifeq ($(CONFIG_TRACE),y)
185 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-trace-summary.o
186 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_trace_augment.o
187 endif
188
189 ifeq ($(CONFIG_LIBTRACEEVENT),y)
190 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_lock_contention.o
191 endif
192
193 ifeq ($(CONFIG_LIBTRACEEVENT),y)
194 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork.o
195 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork_top.o
196 endif
197
198 perf-util-$(CONFIG_LIBELF) += symbol-elf.o
199 perf-util-$(CONFIG_LIBELF) += probe-file.o
200 perf-util-$(CONFIG_LIBELF) += probe-event.o
201
202 ifdef CONFIG_LIBBPF_DYNAMIC
203 hashmap := 1
204 endif
205 ifndef CONFIG_LIBBPF
206 hashmap := 1
207 endif
208
209 ifdef hashmap
210 perf-util-y += hashmap.o
211 endif
212
213 ifndef CONFIG_LIBELF
214 perf-util-y += symbol-minimal.o
215 endif
216
217 ifndef CONFIG_SETNS
218 perf-util-y += setns.o
219 endif
220
221 perf-util-$(CONFIG_LIBDW) += probe-finder.o
222 perf-util-$(CONFIG_LIBDW) += dwarf-aux.o
223 perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
224 perf-util-$(CONFIG_LIBDW) += dwarf-regs-arch/
225 perf-util-$(CONFIG_LIBDW) += debuginfo.o
226 perf-util-$(CONFIG_LIBDW) += annotate-data.o
227 perf-util-$(CONFIG_LIBDW) += libdw.o
228 perf-util-$(CONFIG_LIBDW) += unwind-libdw.o
229
230 perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind-local.o
231 perf-util-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
232 perf-util-$(CONFIG_LIBUNWIND_X86) += libunwind/x86_32.o
233 perf-util-$(CONFIG_LIBUNWIND_AARCH64) += libunwind/arm64.o
234
235 ifeq ($(CONFIG_LIBTRACEEVENT),y)
236 perf-util-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o
237 endif
238
239 perf-util-y += data-convert-json.o
240
241 perf-util-y += scripting-engines/
242
243 perf-util-$(CONFIG_ZLIB) += zlib.o
244 perf-util-$(CONFIG_LZMA) += lzma.o
245 perf-util-$(CONFIG_ZSTD) += zstd.o
246
247 perf-util-y += cap.o
248
249 perf-util-$(CONFIG_CXX_DEMANGLE) += demangle-cxx.o
250 perf-util-y += demangle-ocaml.o
251 perf-util-y += demangle-java.o
252 perf-util-y += demangle-rust-v0.o
253 perf-util-$(CONFIG_LIBLLVM) += llvm-c-helpers.o
254
255 CFLAGS_demangle-rust-v0.o += -Wno-shadow -Wno-declaration-after-statement \
256 -Wno-switch-default -Wno-switch-enum -Wno-missing-field-initializers
257
258 ifdef CONFIG_JITDUMP
259 perf-util-$(CONFIG_LIBELF) += jitdump.o
260 perf-util-$(CONFIG_LIBELF) += genelf.o
261 perf-util-$(CONFIG_LIBDW) += genelf_debug.o
262 endif
263
264 perf-util-y += perf-hooks.o
265
266 perf-util-$(CONFIG_LIBBPF) += bpf-event.o
267 perf-util-$(CONFIG_LIBBPF) += bpf-utils.o
268
269 perf-util-$(CONFIG_LIBPFM4) += pfm.o
270
271 CFLAGS_config.o += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
272
273 # avoid compiler warnings in 32-bit mode
274 CFLAGS_genelf_debug.o += -Wno-packed
275
276 $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-flex.h: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
277 $(call rule_mkdir)
278 $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/parse-events-flex.c \
279 --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) $<
280
281 $(OUTPUT)util/parse-events-bison.c $(OUTPUT)util/parse-events-bison.h: util/parse-events.y
282 $(call rule_mkdir)
283 $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) $(BISON_FALLBACK_FLAGS) \
284 -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
285
286 $(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-flex.h: util/expr.l $(OUTPUT)util/expr-bison.c
287 $(call rule_mkdir)
288 $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/expr-flex.c \
289 --header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) $<
290
291 $(OUTPUT)util/expr-bison.c $(OUTPUT)util/expr-bison.h: util/expr.y
292 $(call rule_mkdir)
293 $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
294 -o $(OUTPUT)util/expr-bison.c -p expr_
295
296 $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-flex.h: util/pmu.l $(OUTPUT)util/pmu-bison.c
297 $(call rule_mkdir)
298 $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/pmu-flex.c \
299 --header-file=$(OUTPUT)util/pmu-flex.h $(PARSER_DEBUG_FLEX) $<
300
301 $(OUTPUT)util/pmu-bison.c $(OUTPUT)util/pmu-bison.h: util/pmu.y
302 $(call rule_mkdir)
303 $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
304 -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
305
306 $(OUTPUT)util/bpf-filter-flex.c $(OUTPUT)util/bpf-filter-flex.h: util/bpf-filter.l $(OUTPUT)util/bpf-filter-bison.c util/bpf-filter.h util/bpf_skel/sample-filter.h
307 $(call rule_mkdir)
308 $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/bpf-filter-flex.c \
309 --header-file=$(OUTPUT)util/bpf-filter-flex.h $(PARSER_DEBUG_FLEX) $<
310
311 $(OUTPUT)util/bpf-filter-bison.c $(OUTPUT)util/bpf-filter-bison.h: util/bpf-filter.y util/bpf-filter.h util/bpf_skel/sample-filter.h
312 $(call rule_mkdir)
313 $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
314 -o $(OUTPUT)util/bpf-filter-bison.c -p perf_bpf_filter_
315
316 FLEX_VERSION := $(shell $(FLEX) --version | cut -d' ' -f2)
317
318 FLEX_GE_260 := $(call version-ge3,$(FLEX_VERSION),2.6.0)
319 ifeq ($(FLEX_GE_260),1)
320 flex_flags := -Wno-redundant-decls -Wno-switch-default -Wno-unused-function -Wno-misleading-indentation
321
322 # Some newer clang and gcc version complain about this
323 # util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
324 # int yynerrs = 0;
325
326 flex_flags += -Wno-unused-but-set-variable
327
328 FLEX_LT_262 := $(call version-lt3,$(FLEX_VERSION),2.6.2)
329 ifeq ($(FLEX_LT_262),1)
330 flex_flags += -Wno-sign-compare
331 endif
332 else
333 flex_flags := -w
334 endif
335
336 # Some newer clang and gcc version complain about this
337 # util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
338 # int yynerrs = 0;
339
340 bison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable
341
342 # Old clangs don't grok -Wno-unused-but-set-variable, remove it
343 ifeq ($(CC_NO_CLANG), 0)
344 CLANG_VERSION := $(shell $(CLANG) --version | head -1 | sed 's/.*clang version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g')
345 ifeq ($(call version-lt3,$(CLANG_VERSION),13.0.0),1)
346 bison_flags := $(subst -Wno-unused-but-set-variable,,$(bison_flags))
347 flex_flags := $(subst -Wno-unused-but-set-variable,,$(flex_flags))
348 endif
349 endif
350
351 BISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382)
352 ifeq ($(BISON_GE_382),1)
353 bison_flags += -Wno-switch-enum
354 else
355 bison_flags += -w
356 endif
357
358 BISON_LT_381 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \< 381)
359 ifeq ($(BISON_LT_381),1)
360 bison_flags += -DYYNOMEM=YYABORT
361 endif
362
363 CFLAGS_parse-events-flex.o += $(flex_flags) -Wno-unused-label
364 CFLAGS_pmu-flex.o += $(flex_flags)
365 CFLAGS_expr-flex.o += $(flex_flags)
366 CFLAGS_bpf-filter-flex.o += $(flex_flags)
367
368 CFLAGS_parse-events-bison.o += $(bison_flags)
369 CFLAGS_pmu-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
370 CFLAGS_expr-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
371 CFLAGS_bpf-filter-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
372
373 $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
374 $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
375 $(OUTPUT)util/expr.o: $(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-bison.c
376 $(OUTPUT)util/bpf-filter.o: $(OUTPUT)util/bpf-filter-flex.c $(OUTPUT)util/bpf-filter-bison.c
377
378 CFLAGS_bitmap.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
379 CFLAGS_find_bit.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
380 CFLAGS_rbtree.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
381 CFLAGS_libstring.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
382 CFLAGS_hweight.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
383 CFLAGS_header.o += -include $(OUTPUT)PERF-VERSION-FILE
384 CFLAGS_arm-spe.o += -I$(srctree)/tools/arch/arm64/include/ -I$(OUTPUT)arch/arm64/include/generated/
385
386 $(OUTPUT)util/argv_split.o: ../lib/argv_split.c FORCE
387 $(call rule_mkdir)
388 $(call if_changed_dep,cc_o_c)
389
390 $(OUTPUT)util/bitmap.o: ../lib/bitmap.c FORCE
391 $(call rule_mkdir)
392 $(call if_changed_dep,cc_o_c)
393
394 $(OUTPUT)util/ctype.o: ../lib/ctype.c FORCE
395 $(call rule_mkdir)
396 $(call if_changed_dep,cc_o_c)
397
398 $(OUTPUT)util/find_bit.o: ../lib/find_bit.c FORCE
399 $(call rule_mkdir)
400 $(call if_changed_dep,cc_o_c)
401
402 $(OUTPUT)util/rbtree.o: ../lib/rbtree.c FORCE
403 $(call rule_mkdir)
404 $(call if_changed_dep,cc_o_c)
405
406 $(OUTPUT)util/libstring.o: ../lib/string.c FORCE
407 $(call rule_mkdir)
408 $(call if_changed_dep,cc_o_c)
409
410 $(OUTPUT)util/hweight.o: ../lib/hweight.c FORCE
411 $(call rule_mkdir)
412 $(call if_changed_dep,cc_o_c)
413
414 $(OUTPUT)util/vsprintf.o: ../lib/vsprintf.c FORCE
415 $(call rule_mkdir)
416 $(call if_changed_dep,cc_o_c)
417
418 $(OUTPUT)util/list_sort.o: ../lib/list_sort.c FORCE
419 $(call rule_mkdir)
420 $(call if_changed_dep,cc_o_c)
421
422 PY_TESTS := setup.py
423 ifdef MYPY
424 MYPY_TEST_LOGS := $(PY_TESTS:%=%.mypy_log)
425 else
426 MYPY_TEST_LOGS :=
427 endif
428
429 $(OUTPUT)%.mypy_log: %
430 $(call rule_mkdir)
431 $(Q)$(call echo-cmd,test)mypy "$<" > $@ || (cat $@ && rm $@ && false)
432
433 perf-util-y += $(MYPY_TEST_LOGS)
434
435 ifdef PYLINT
436 PYLINT_TEST_LOGS := $(PY_TESTS:%=%.pylint_log)
437 else
438 PYLINT_TEST_LOGS :=
439 endif
440
441 $(OUTPUT)%.pylint_log: %
442 $(call rule_mkdir)
443 $(Q)$(call echo-cmd,test)pylint "$<" > $@ || (cat $@ && rm $@ && false)
444
445 perf-util-y += $(PYLINT_TEST_LOGS)