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