1 include $(srctree)/tools/scripts/Makefile.include
2 include $(srctree)/tools/scripts/utilities.mak
4 perf-y += arm64-frame-pointer-unwind-support.o
5 perf-y += addr_location.o
8 perf-y += block-range.o
18 perf-y += sideband_evlist.o
20 perf-y += evsel_fprintf.o
21 perf-y += perf_event_attr_fprintf.o
24 perf-y += get_current_dir_name.o
25 perf-y += levenshtein.o
28 perf-y += parse-events.o
29 perf-y += print-events.o
30 perf-y += tracepoint.o
32 perf-y += perf-regs-arch/
34 perf-y += print_binary.o
36 perf-y += argv_split.o
51 perf-y += symbol_fprintf.o
52 perf-y += map_symbol.o
54 perf-y += color_config.o
55 perf-y += metricgroup.o
66 perf-y += sample-raw.o
67 perf-y += s390-sample-raw.o
68 perf-y += amd-sample-raw.o
69 perf-$(CONFIG_TRACE) += syscalltbl.o
70 perf-y += ordered-events.o
71 perf-y += namespaces.o
74 perf-y += thread_map.o
75 perf-y += parse-events-flex.o
76 perf-y += parse-events-bison.o
82 perf-$(CONFIG_LIBTRACEEVENT) += trace-event-info.o
83 perf-y += trace-event-scripting.o
84 perf-$(CONFIG_LIBTRACEEVENT) += trace-event.o
85 perf-$(CONFIG_LIBTRACEEVENT) += trace-event-parse.o
86 perf-$(CONFIG_LIBTRACEEVENT) += trace-event-read.o
100 perf-y += stat-shadow.o
101 perf-y += stat-display.o
102 perf-y += perf_api_probe.o
106 perf-y += synthetic-events.o
110 perf-y += call-path.o
112 perf-y += thread-stack.o
117 perf-$(CONFIG_AUXTRACE) += auxtrace.o
118 perf-$(CONFIG_AUXTRACE) += intel-pt-decoder/
119 perf-$(CONFIG_AUXTRACE) += intel-pt.o
120 perf-$(CONFIG_AUXTRACE) += intel-bts.o
121 perf-$(CONFIG_AUXTRACE) += arm-spe.o
122 perf-$(CONFIG_AUXTRACE) += arm-spe-decoder/
123 perf-$(CONFIG_AUXTRACE) += hisi-ptt.o
124 perf-$(CONFIG_AUXTRACE) += hisi-ptt-decoder/
125 perf-$(CONFIG_AUXTRACE) += s390-cpumsf.o
127 ifdef CONFIG_LIBOPENCSD
128 perf-$(CONFIG_AUXTRACE) += cs-etm.o
129 perf-$(CONFIG_AUXTRACE) += cs-etm-decoder/
131 perf-$(CONFIG_AUXTRACE) += cs-etm-base.o
133 perf-y += parse-branch-options.o
134 perf-y += dump-insn.o
135 perf-y += parse-regs-options.o
136 perf-y += parse-sublevel-options.o
138 perf-y += help-unknown-cmd.o
140 perf-y += mem-events.o
143 perf-y += time-utils.o
144 perf-y += expr-flex.o
145 perf-y += expr-bison.o
150 perf-y += list_sort.o
152 perf-y += sharded_mutex.o
154 perf-$(CONFIG_LIBBPF) += bpf_map.o
155 perf-$(CONFIG_PERF_BPF_SKEL) += bpf_counter.o
156 perf-$(CONFIG_PERF_BPF_SKEL) += bpf_counter_cgroup.o
157 perf-$(CONFIG_PERF_BPF_SKEL) += bpf_ftrace.o
158 perf-$(CONFIG_PERF_BPF_SKEL) += bpf_off_cpu.o
159 perf-$(CONFIG_PERF_BPF_SKEL) += bpf-filter.o
160 perf-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-flex.o
161 perf-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-bison.o
163 ifeq ($(CONFIG_LIBTRACEEVENT),y)
164 perf-$(CONFIG_PERF_BPF_SKEL) += bpf_lock_contention.o
167 ifeq ($(CONFIG_LIBTRACEEVENT),y)
168 perf-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork.o
169 perf-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork_top.o
172 perf-$(CONFIG_LIBELF) += symbol-elf.o
173 perf-$(CONFIG_LIBELF) += probe-file.o
174 perf-$(CONFIG_LIBELF) += probe-event.o
176 ifdef CONFIG_LIBBPF_DYNAMIC
188 perf-y += symbol-minimal.o
195 perf-$(CONFIG_DWARF) += probe-finder.o
196 perf-$(CONFIG_DWARF) += dwarf-aux.o
197 perf-$(CONFIG_DWARF) += dwarf-regs.o
199 perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
200 perf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind-local.o
201 perf-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
202 perf-$(CONFIG_LIBUNWIND_X86) += libunwind/x86_32.o
203 perf-$(CONFIG_LIBUNWIND_AARCH64) += libunwind/arm64.o
205 ifeq ($(CONFIG_LIBTRACEEVENT),y)
206 perf-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o
209 perf-y += data-convert-json.o
211 perf-y += scripting-engines/
213 perf-$(CONFIG_ZLIB) += zlib.o
214 perf-$(CONFIG_LZMA) += lzma.o
215 perf-$(CONFIG_ZSTD) += zstd.o
217 perf-$(CONFIG_LIBCAP) += cap.o
219 perf-$(CONFIG_CXX_DEMANGLE) += demangle-cxx.o
220 perf-y += demangle-ocaml.o
221 perf-y += demangle-java.o
222 perf-y += demangle-rust.o
225 perf-$(CONFIG_LIBELF) += jitdump.o
226 perf-$(CONFIG_LIBELF) += genelf.o
227 perf-$(CONFIG_DWARF) += genelf_debug.o
230 perf-y += perf-hooks.o
232 perf-$(CONFIG_LIBBPF) += bpf-event.o
233 perf-$(CONFIG_LIBBPF) += bpf-utils.o
235 perf-$(CONFIG_LIBPFM4) += pfm.o
237 CFLAGS_config.o += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
239 # avoid compiler warnings in 32-bit mode
240 CFLAGS_genelf_debug.o += -Wno-packed
242 $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-flex.h: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
244 $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/parse-events-flex.c \
245 --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) $<
247 $(OUTPUT)util/parse-events-bison.c $(OUTPUT)util/parse-events-bison.h: util/parse-events.y
249 $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) $(BISON_FALLBACK_FLAGS) \
250 -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
252 $(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-flex.h: util/expr.l $(OUTPUT)util/expr-bison.c
254 $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/expr-flex.c \
255 --header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) $<
257 $(OUTPUT)util/expr-bison.c $(OUTPUT)util/expr-bison.h: util/expr.y
259 $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
260 -o $(OUTPUT)util/expr-bison.c -p expr_
262 $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-flex.h: util/pmu.l $(OUTPUT)util/pmu-bison.c
264 $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/pmu-flex.c \
265 --header-file=$(OUTPUT)util/pmu-flex.h $(PARSER_DEBUG_FLEX) $<
267 $(OUTPUT)util/pmu-bison.c $(OUTPUT)util/pmu-bison.h: util/pmu.y
269 $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
270 -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
272 $(OUTPUT)util/bpf-filter-flex.c $(OUTPUT)util/bpf-filter-flex.h: util/bpf-filter.l $(OUTPUT)util/bpf-filter-bison.c
274 $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/bpf-filter-flex.c \
275 --header-file=$(OUTPUT)util/bpf-filter-flex.h $(PARSER_DEBUG_FLEX) $<
277 $(OUTPUT)util/bpf-filter-bison.c $(OUTPUT)util/bpf-filter-bison.h: util/bpf-filter.y
279 $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
280 -o $(OUTPUT)util/bpf-filter-bison.c -p perf_bpf_filter_
282 FLEX_VERSION := $(shell $(FLEX) --version | cut -d' ' -f2)
284 FLEX_GE_260 := $(call version-ge3,$(FLEX_VERSION),2.6.0)
285 ifeq ($(FLEX_GE_260),1)
286 flex_flags := -Wno-redundant-decls -Wno-switch-default -Wno-unused-function -Wno-misleading-indentation
288 # Some newer clang and gcc version complain about this
289 # util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
292 flex_flags += -Wno-unused-but-set-variable
294 FLEX_LT_262 := $(call version-lt3,$(FLEX_VERSION),2.6.2)
295 ifeq ($(FLEX_LT_262),1)
296 flex_flags += -Wno-sign-compare
302 # Some newer clang and gcc version complain about this
303 # util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
306 bison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable
308 # Old clangs don't grok -Wno-unused-but-set-variable, remove it
309 ifeq ($(CC_NO_CLANG), 0)
310 CLANG_VERSION := $(shell $(CLANG) --version | head -1 | sed 's/.*clang version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g')
311 ifeq ($(call version-lt3,$(CLANG_VERSION),13.0.0),1)
312 bison_flags := $(subst -Wno-unused-but-set-variable,,$(bison_flags))
313 flex_flags := $(subst -Wno-unused-but-set-variable,,$(flex_flags))
317 BISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382)
318 ifeq ($(BISON_GE_382),1)
319 bison_flags += -Wno-switch-enum
324 BISON_LT_381 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \< 381)
325 ifeq ($(BISON_LT_381),1)
326 bison_flags += -DYYNOMEM=YYABORT
329 CFLAGS_parse-events-flex.o += $(flex_flags) -Wno-unused-label
330 CFLAGS_pmu-flex.o += $(flex_flags)
331 CFLAGS_expr-flex.o += $(flex_flags)
332 CFLAGS_bpf-filter-flex.o += $(flex_flags)
334 CFLAGS_parse-events-bison.o += $(bison_flags)
335 CFLAGS_pmu-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
336 CFLAGS_expr-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
337 CFLAGS_bpf-filter-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
339 $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
340 $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
341 $(OUTPUT)util/expr.o: $(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-bison.c
342 $(OUTPUT)util/bpf-filter.o: $(OUTPUT)util/bpf-filter-flex.c $(OUTPUT)util/bpf-filter-bison.c
344 CFLAGS_bitmap.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
345 CFLAGS_find_bit.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
346 CFLAGS_rbtree.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
347 CFLAGS_libstring.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
348 CFLAGS_hweight.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
349 CFLAGS_header.o += -include $(OUTPUT)PERF-VERSION-FILE
350 CFLAGS_arm-spe.o += -I$(srctree)/tools/arch/arm64/include/ -I$(srctree)/tools/arch/arm64/include/generated/
352 $(OUTPUT)util/argv_split.o: ../lib/argv_split.c FORCE
354 $(call if_changed_dep,cc_o_c)
356 $(OUTPUT)util/bitmap.o: ../lib/bitmap.c FORCE
358 $(call if_changed_dep,cc_o_c)
360 $(OUTPUT)util/ctype.o: ../lib/ctype.c FORCE
362 $(call if_changed_dep,cc_o_c)
364 $(OUTPUT)util/find_bit.o: ../lib/find_bit.c FORCE
366 $(call if_changed_dep,cc_o_c)
368 $(OUTPUT)util/rbtree.o: ../lib/rbtree.c FORCE
370 $(call if_changed_dep,cc_o_c)
372 $(OUTPUT)util/libstring.o: ../lib/string.c FORCE
374 $(call if_changed_dep,cc_o_c)
376 $(OUTPUT)util/hweight.o: ../lib/hweight.c FORCE
378 $(call if_changed_dep,cc_o_c)
380 $(OUTPUT)util/vsprintf.o: ../lib/vsprintf.c FORCE
382 $(call if_changed_dep,cc_o_c)
384 $(OUTPUT)util/list_sort.o: ../lib/list_sort.c FORCE
386 $(call if_changed_dep,cc_o_c)