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