411 lines · plain
1include $(srctree)/tools/scripts/Makefile.include2include $(srctree)/tools/scripts/utilities.mak3 4perf-util-y += arm64-frame-pointer-unwind-support.o5perf-util-y += addr_location.o6perf-util-y += annotate.o7perf-util-y += block-info.o8perf-util-y += block-range.o9perf-util-y += build-id.o10perf-util-y += cacheline.o11perf-util-y += config.o12perf-util-y += copyfile.o13perf-util-y += ctype.o14perf-util-y += db-export.o15perf-util-y += disasm.o16perf-util-y += disasm_bpf.o17perf-util-y += env.o18perf-util-y += event.o19perf-util-y += evlist.o20perf-util-y += sideband_evlist.o21perf-util-y += evsel.o22perf-util-y += evsel_fprintf.o23perf-util-y += perf_event_attr_fprintf.o24perf-util-y += evswitch.o25perf-util-y += find_bit.o26perf-util-y += get_current_dir_name.o27perf-util-y += levenshtein.o28perf-util-y += mmap.o29perf-util-y += memswap.o30perf-util-y += parse-events.o31perf-util-y += print-events.o32perf-util-y += tracepoint.o33perf-util-y += perf_regs.o34perf-util-y += perf-regs-arch/35perf-util-y += path.o36perf-util-y += print_binary.o37perf-util-y += print_insn.o38perf-util-y += rlimit.o39perf-util-y += argv_split.o40perf-util-y += rbtree.o41perf-util-y += libstring.o42perf-util-y += bitmap.o43perf-util-y += hweight.o44perf-util-y += smt.o45perf-util-y += strbuf.o46perf-util-y += string.o47perf-util-y += strlist.o48perf-util-y += strfilter.o49perf-util-y += top.o50perf-util-y += usage.o51perf-util-y += dso.o52perf-util-y += dsos.o53perf-util-y += symbol.o54perf-util-y += symbol_fprintf.o55perf-util-y += map_symbol.o56perf-util-y += color.o57perf-util-y += color_config.o58perf-util-y += metricgroup.o59perf-util-y += header.o60perf-util-y += callchain.o61perf-util-y += values.o62perf-util-y += debug.o63perf-util-y += fncache.o64perf-util-y += machine.o65perf-util-y += map.o66perf-util-y += maps.o67perf-util-y += pstack.o68perf-util-y += session.o69perf-util-y += tool.o70perf-util-y += sample-raw.o71perf-util-y += s390-sample-raw.o72perf-util-y += amd-sample-raw.o73perf-util-$(CONFIG_TRACE) += syscalltbl.o74perf-util-y += ordered-events.o75perf-util-y += namespaces.o76perf-util-y += comm.o77perf-util-y += thread.o78perf-util-y += threads.o79perf-util-y += thread_map.o80perf-util-y += parse-events-flex.o81perf-util-y += parse-events-bison.o82perf-util-y += pmu.o83perf-util-y += pmus.o84perf-util-y += pmu-flex.o85perf-util-y += pmu-bison.o86perf-util-y += svghelper.o87perf-util-$(CONFIG_LIBTRACEEVENT) += trace-event-info.o88perf-util-y += trace-event-scripting.o89perf-util-$(CONFIG_LIBTRACEEVENT) += trace-event.o90perf-util-$(CONFIG_LIBTRACEEVENT) += trace-event-parse.o91perf-util-$(CONFIG_LIBTRACEEVENT) += trace-event-read.o92perf-util-y += sort.o93perf-util-y += hist.o94perf-util-y += util.o95perf-util-y += cpumap.o96perf-util-y += affinity.o97perf-util-y += cputopo.o98perf-util-y += cgroup.o99perf-util-y += target.o100perf-util-y += rblist.o101perf-util-y += intlist.o102perf-util-y += vdso.o103perf-util-y += counts.o104perf-util-y += stat.o105perf-util-y += stat-shadow.o106perf-util-y += stat-display.o107perf-util-y += perf_api_probe.o108perf-util-y += record.o109perf-util-y += srcline.o110perf-util-y += srccode.o111perf-util-y += synthetic-events.o112perf-util-y += data.o113perf-util-y += tsc.o114perf-util-y += cloexec.o115perf-util-y += call-path.o116perf-util-y += rwsem.o117perf-util-y += thread-stack.o118perf-util-y += spark.o119perf-util-y += topdown.o120perf-util-y += iostat.o121perf-util-y += stream.o122perf-util-$(CONFIG_AUXTRACE) += auxtrace.o123perf-util-$(CONFIG_AUXTRACE) += intel-pt-decoder/124perf-util-$(CONFIG_AUXTRACE) += intel-pt.o125perf-util-$(CONFIG_AUXTRACE) += intel-bts.o126perf-util-$(CONFIG_AUXTRACE) += arm-spe.o127perf-util-$(CONFIG_AUXTRACE) += arm-spe-decoder/128perf-util-$(CONFIG_AUXTRACE) += hisi-ptt.o129perf-util-$(CONFIG_AUXTRACE) += hisi-ptt-decoder/130perf-util-$(CONFIG_AUXTRACE) += s390-cpumsf.o131 132ifdef CONFIG_LIBOPENCSD133perf-util-$(CONFIG_AUXTRACE) += cs-etm.o134perf-util-$(CONFIG_AUXTRACE) += cs-etm-decoder/135endif136perf-util-$(CONFIG_AUXTRACE) += cs-etm-base.o137 138perf-util-y += parse-branch-options.o139perf-util-y += dump-insn.o140perf-util-y += parse-regs-options.o141perf-util-y += parse-sublevel-options.o142perf-util-y += term.o143perf-util-y += help-unknown-cmd.o144perf-util-y += dlfilter.o145perf-util-y += mem-events.o146perf-util-y += mem-info.o147perf-util-y += vsprintf.o148perf-util-y += units.o149perf-util-y += time-utils.o150perf-util-y += expr-flex.o151perf-util-y += expr-bison.o152perf-util-y += expr.o153perf-util-y += branch.o154perf-util-y += mem2node.o155perf-util-y += clockid.o156perf-util-y += list_sort.o157perf-util-y += mutex.o158perf-util-y += sharded_mutex.o159perf-util-$(CONFIG_X86_64) += intel-tpebs.o160 161perf-util-$(CONFIG_LIBBPF) += bpf_map.o162perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_counter.o163perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_counter_cgroup.o164perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_ftrace.o165perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_off_cpu.o166perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-filter.o167perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-flex.o168perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf-filter-bison.o169 170ifeq ($(CONFIG_LIBTRACEEVENT),y)171 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_lock_contention.o172endif173 174ifeq ($(CONFIG_LIBTRACEEVENT),y)175 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork.o176 perf-util-$(CONFIG_PERF_BPF_SKEL) += bpf_kwork_top.o177endif178 179perf-util-$(CONFIG_LIBELF) += symbol-elf.o180perf-util-$(CONFIG_LIBELF) += probe-file.o181perf-util-$(CONFIG_LIBELF) += probe-event.o182 183ifdef CONFIG_LIBBPF_DYNAMIC184 hashmap := 1185endif186ifndef CONFIG_LIBBPF187 hashmap := 1188endif189 190ifdef hashmap191perf-util-y += hashmap.o192endif193 194ifndef CONFIG_LIBELF195perf-util-y += symbol-minimal.o196endif197 198ifndef CONFIG_SETNS199perf-util-y += setns.o200endif201 202perf-util-$(CONFIG_DWARF) += probe-finder.o203perf-util-$(CONFIG_DWARF) += dwarf-aux.o204perf-util-$(CONFIG_DWARF) += dwarf-regs.o205perf-util-$(CONFIG_DWARF) += debuginfo.o206perf-util-$(CONFIG_DWARF) += annotate-data.o207 208perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o209perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind-local.o210perf-util-$(CONFIG_LIBUNWIND) += unwind-libunwind.o211perf-util-$(CONFIG_LIBUNWIND_X86) += libunwind/x86_32.o212perf-util-$(CONFIG_LIBUNWIND_AARCH64) += libunwind/arm64.o213 214ifeq ($(CONFIG_LIBTRACEEVENT),y)215 perf-util-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o216endif217 218perf-util-y += data-convert-json.o219 220perf-util-y += scripting-engines/221 222perf-util-$(CONFIG_ZLIB) += zlib.o223perf-util-$(CONFIG_LZMA) += lzma.o224perf-util-$(CONFIG_ZSTD) += zstd.o225 226perf-util-y += cap.o227 228perf-util-$(CONFIG_CXX_DEMANGLE) += demangle-cxx.o229perf-util-y += demangle-ocaml.o230perf-util-y += demangle-java.o231perf-util-y += demangle-rust.o232perf-util-$(CONFIG_LIBLLVM) += llvm-c-helpers.o233 234ifdef CONFIG_JITDUMP235perf-util-$(CONFIG_LIBELF) += jitdump.o236perf-util-$(CONFIG_LIBELF) += genelf.o237perf-util-$(CONFIG_DWARF) += genelf_debug.o238endif239 240perf-util-y += perf-hooks.o241 242perf-util-$(CONFIG_LIBBPF) += bpf-event.o243perf-util-$(CONFIG_LIBBPF) += bpf-utils.o244 245perf-util-$(CONFIG_LIBPFM4) += pfm.o246 247CFLAGS_config.o += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"248 249# avoid compiler warnings in 32-bit mode250CFLAGS_genelf_debug.o += -Wno-packed251 252$(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-flex.h: util/parse-events.l $(OUTPUT)util/parse-events-bison.c253 $(call rule_mkdir)254 $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/parse-events-flex.c \255 --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) $<256 257$(OUTPUT)util/parse-events-bison.c $(OUTPUT)util/parse-events-bison.h: util/parse-events.y258 $(call rule_mkdir)259 $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) $(BISON_FALLBACK_FLAGS) \260 -o $(OUTPUT)util/parse-events-bison.c -p parse_events_261 262$(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-flex.h: util/expr.l $(OUTPUT)util/expr-bison.c263 $(call rule_mkdir)264 $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/expr-flex.c \265 --header-file=$(OUTPUT)util/expr-flex.h $(PARSER_DEBUG_FLEX) $<266 267$(OUTPUT)util/expr-bison.c $(OUTPUT)util/expr-bison.h: util/expr.y268 $(call rule_mkdir)269 $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \270 -o $(OUTPUT)util/expr-bison.c -p expr_271 272$(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-flex.h: util/pmu.l $(OUTPUT)util/pmu-bison.c273 $(call rule_mkdir)274 $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/pmu-flex.c \275 --header-file=$(OUTPUT)util/pmu-flex.h $(PARSER_DEBUG_FLEX) $<276 277$(OUTPUT)util/pmu-bison.c $(OUTPUT)util/pmu-bison.h: util/pmu.y278 $(call rule_mkdir)279 $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \280 -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_281 282$(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.h283 $(call rule_mkdir)284 $(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/bpf-filter-flex.c \285 --header-file=$(OUTPUT)util/bpf-filter-flex.h $(PARSER_DEBUG_FLEX) $<286 287$(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.h288 $(call rule_mkdir)289 $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \290 -o $(OUTPUT)util/bpf-filter-bison.c -p perf_bpf_filter_291 292FLEX_VERSION := $(shell $(FLEX) --version | cut -d' ' -f2)293 294FLEX_GE_260 := $(call version-ge3,$(FLEX_VERSION),2.6.0)295ifeq ($(FLEX_GE_260),1)296 flex_flags := -Wno-redundant-decls -Wno-switch-default -Wno-unused-function -Wno-misleading-indentation297 298 # Some newer clang and gcc version complain about this299 # util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]300 # int yynerrs = 0;301 302 flex_flags += -Wno-unused-but-set-variable303 304 FLEX_LT_262 := $(call version-lt3,$(FLEX_VERSION),2.6.2)305 ifeq ($(FLEX_LT_262),1)306 flex_flags += -Wno-sign-compare307 endif308else309 flex_flags := -w310endif311 312# Some newer clang and gcc version complain about this313# util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]314# int yynerrs = 0;315 316bison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable317 318# Old clangs don't grok -Wno-unused-but-set-variable, remove it319ifeq ($(CC_NO_CLANG), 0)320 CLANG_VERSION := $(shell $(CLANG) --version | head -1 | sed 's/.*clang version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g')321 ifeq ($(call version-lt3,$(CLANG_VERSION),13.0.0),1)322 bison_flags := $(subst -Wno-unused-but-set-variable,,$(bison_flags))323 flex_flags := $(subst -Wno-unused-but-set-variable,,$(flex_flags))324 endif325endif326 327BISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382)328ifeq ($(BISON_GE_382),1)329 bison_flags += -Wno-switch-enum330else331 bison_flags += -w332endif333 334BISON_LT_381 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \< 381)335ifeq ($(BISON_LT_381),1)336 bison_flags += -DYYNOMEM=YYABORT337endif338 339CFLAGS_parse-events-flex.o += $(flex_flags) -Wno-unused-label340CFLAGS_pmu-flex.o += $(flex_flags)341CFLAGS_expr-flex.o += $(flex_flags)342CFLAGS_bpf-filter-flex.o += $(flex_flags)343 344CFLAGS_parse-events-bison.o += $(bison_flags)345CFLAGS_pmu-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)346CFLAGS_expr-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)347CFLAGS_bpf-filter-bison.o += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)348 349$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c350$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c351$(OUTPUT)util/expr.o: $(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-bison.c352$(OUTPUT)util/bpf-filter.o: $(OUTPUT)util/bpf-filter-flex.c $(OUTPUT)util/bpf-filter-bison.c353 354CFLAGS_bitmap.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"355CFLAGS_find_bit.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"356CFLAGS_rbtree.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"357CFLAGS_libstring.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"358CFLAGS_hweight.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"359CFLAGS_header.o += -include $(OUTPUT)PERF-VERSION-FILE360CFLAGS_arm-spe.o += -I$(srctree)/tools/arch/arm64/include/ -I$(OUTPUT)arch/arm64/include/generated/361 362$(OUTPUT)util/argv_split.o: ../lib/argv_split.c FORCE363 $(call rule_mkdir)364 $(call if_changed_dep,cc_o_c)365 366$(OUTPUT)util/bitmap.o: ../lib/bitmap.c FORCE367 $(call rule_mkdir)368 $(call if_changed_dep,cc_o_c)369 370$(OUTPUT)util/ctype.o: ../lib/ctype.c FORCE371 $(call rule_mkdir)372 $(call if_changed_dep,cc_o_c)373 374$(OUTPUT)util/find_bit.o: ../lib/find_bit.c FORCE375 $(call rule_mkdir)376 $(call if_changed_dep,cc_o_c)377 378$(OUTPUT)util/rbtree.o: ../lib/rbtree.c FORCE379 $(call rule_mkdir)380 $(call if_changed_dep,cc_o_c)381 382$(OUTPUT)util/libstring.o: ../lib/string.c FORCE383 $(call rule_mkdir)384 $(call if_changed_dep,cc_o_c)385 386$(OUTPUT)util/hweight.o: ../lib/hweight.c FORCE387 $(call rule_mkdir)388 $(call if_changed_dep,cc_o_c)389 390$(OUTPUT)util/vsprintf.o: ../lib/vsprintf.c FORCE391 $(call rule_mkdir)392 $(call if_changed_dep,cc_o_c)393 394$(OUTPUT)util/list_sort.o: ../lib/list_sort.c FORCE395 $(call rule_mkdir)396 $(call if_changed_dep,cc_o_c)397 398ifdef SHELLCHECK399 SHELL_TESTS := generate-cmdlist.sh400 TEST_LOGS := $(SHELL_TESTS:%=%.shellcheck_log)401else402 SHELL_TESTS :=403 TEST_LOGS :=404endif405 406$(OUTPUT)%.shellcheck_log: %407 $(call rule_mkdir)408 $(Q)$(call echo-cmd,test)shellcheck -a -S warning "$<" > $@ || (cat $@ && rm $@ && false)409 410perf-util-y += $(TEST_LOGS)411