1# SPDX-License-Identifier: GPL-2.0-only 2include ../scripts/Makefile.include 3include ../scripts/Makefile.arch 4 5# The default target of this Makefile is... 6all: 7 8include ../scripts/utilities.mak 9 10# Define V to have a more verbose compile. 11# 12# Define VF to have a more verbose feature check output. 13# 14# Define O to save output files in a separate directory. 15# 16# Define ARCH as name of target architecture if you want cross-builds. 17# 18# Define CROSS_COMPILE as prefix name of compiler if you want cross-builds. 19# 20# Define LIBPERL to enable perl script extension. 21# 22# Define NO_LIBPYTHON to disable python script extension. 23# 24# Define PYTHON to point to the python binary if the default 25# `python' is not correct; for example: PYTHON=python2 26# 27# Define PYTHON_CONFIG to point to the python-config binary if 28# the default `$(PYTHON)-config' is not correct. 29# 30# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8 31# 32# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72. 33# 34# Define LDFLAGS=-static to build a static binary. 35# 36# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds. 37# 38# Define EXTRA_BPF_FLAGS="--sysroot=<path>" or other custom include paths for 39# cross-compiling BPF skeletons 40# 41# Define EXCLUDE_EXTLIBS=-lmylib to exclude libmylib from the auto-generated 42# EXTLIBS. 43# 44# Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS. 45# 46# Define NO_LIBDW if you do not want debug-info analysis feature at all. 47# 48# Define WERROR=0 to disable treating any warnings as errors. 49# 50# Define NO_SLANG if you do not want TUI support. 51# 52# Define GTK2 if you want GTK+ GUI support. 53# 54# Define NO_DEMANGLE if you do not want C++ symbol demangling. 55# 56# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds) 57# 58# Define LIBUNWIND if you do not want libunwind dependency for dwarf 59# backtrace post unwind. 60# 61# Define NO_BACKTRACE if you do not want stack backtrace debug feature 62# 63# Define NO_LIBNUMA if you do not want numa perf benchmark 64# 65# Define NO_LIBBIONIC if you do not want bionic support 66# 67# Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support 68# for dwarf backtrace post unwind. 69# 70# Define NO_LIBTRACEEVENT=1 if you don't want libtraceevent to be linked, 71# this will remove multiple features and tools, such as 'perf trace', 72# that need it to read tracefs event format files, etc. 73# 74# Define NO_PERF_READ_VDSO32 if you do not want to build perf-read-vdso32 75# for reading the 32-bit compatibility VDSO in 64-bit mode 76# 77# Define NO_PERF_READ_VDSOX32 if you do not want to build perf-read-vdsox32 78# for reading the x32 mode 32-bit compatibility VDSO in 64-bit mode 79# 80# Define NO_ZLIB if you do not want to support compressed kernel modules 81# 82# Define NO_BABELTRACE2 if you do not want babeltrace2-ctf-writer support 83# for CTF data format. 84# 85# Define NO_CAPSTONE if you do not want libcapstone support 86# for disasm engine. 87# 88# Define NO_LZMA if you do not want to support compressed (xz) kernel modules 89# 90# Define NO_LIBBPF if you do not want BPF support 91# 92# Define NO_SDT if you do not want to define SDT event in perf tools, 93# note that it doesn't disable SDT scanning support. 94# 95# Define FEATURES_DUMP to provide features detection dump file 96# and bypass the feature detection 97# 98# Define NO_JVMTI if you do not want jvmti agent built 99# 100# Define NO_JVMTI_CMLR (debug only) if you do not want to process CMLR 101# data for java source lines. 102# 103# Define CORESIGHT if you DO WANT support for CoreSight trace decoding. 104# 105# Define NO_AIO if you do not want support of Posix AIO based trace 106# streaming for record mode. Currently Posix AIO trace streaming is 107# supported only when linking with glibc. 108# 109# Define NO_LIBZSTD if you do not want support of Zstandard based runtime 110# trace compression in record mode. 111# 112# Define TCMALLOC to enable tcmalloc heap profiling. 113# 114# Define LIBBPF_DYNAMIC to enable libbpf dynamic linking. 115# 116# Define NO_LIBPFM4 to disable libpfm4 events extension. 117# 118# Define NO_LIBDEBUGINFOD if you do not want support debuginfod 119# 120# Set BUILD_BPF_SKEL to 0 to override BUILD_BPF_SKEL and not build BPF skeletons 121# 122# Define BUILD_NONDISTRO to enable building an linking against libbfd and 123# libiberty distribution license incompatible libraries. 124# 125# Define EXTRA_TESTS to enable building extra tests useful mainly to perf 126# developers, such as: 127# x86 instruction decoder - new instructions test 128# 129# Define GEN_VMLINUX_H to generate vmlinux.h from the BTF. 130# 131# Define NO_SHELLCHECK if you do not want to run shellcheck during build 132 133# As per kernel Makefile, avoid funny character set dependencies 134unexport LC_ALL 135LC_COLLATE=C 136LC_NUMERIC=C 137export LC_COLLATE LC_NUMERIC 138 139ifeq ($(srctree),) 140srctree := $(patsubst %/,%,$(dir $(CURDIR))) 141srctree := $(patsubst %/,%,$(dir $(srctree))) 142#$(info Determined 'srctree' to be $(srctree)) 143endif 144 145ifneq ($(objtree),) 146#$(info Determined 'objtree' to be $(objtree)) 147endif 148 149ifneq ($(OUTPUT),) 150#$(info Determined 'OUTPUT' to be $(OUTPUT)) 151# Adding $(OUTPUT) as a directory to look for source files, 152# because use generated output files as sources dependency 153# for flex/bison parsers. 154VPATH += $(OUTPUT) 155export VPATH 156# create symlink to the original source 157SOURCE := $(shell ln -sfn $(srctree)/tools/perf $(OUTPUT)/source) 158endif 159 160# Do not use make's built-in rules 161# (this improves performance and avoids hard-to-debug behaviour); 162MAKEFLAGS += -r 163 164# Makefiles suck: This macro sets a default value of $(2) for the 165# variable named by $(1), unless the variable has been set by 166# environment or command line. This is necessary for CC and AR 167# because make sets default values, so the simpler ?= approach 168# won't work as expected. 169define allow-override 170 $(if $(or $(findstring environment,$(origin $(1))),\ 171 $(findstring command line,$(origin $(1)))),,\ 172 $(eval $(1) = $(2))) 173endef 174 175LD += $(EXTRA_LDFLAGS) 176 177# Some distros provide the command $(CROSS_COMPILE)pkg-config for 178# searching packges installed with Multiarch. Use it for cross 179# compilation if it is existed. 180ifneq (, $(shell command -v $(CROSS_COMPILE)pkg-config 2>/dev/null)) 181 PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config 182else 183 PKG_CONFIG ?= pkg-config 184 185 # PKG_CONFIG_PATH or PKG_CONFIG_LIBDIR, alongside PKG_CONFIG_SYSROOT_DIR 186 # for modified system root, is required for the cross compilation. 187 # If these PKG_CONFIG environment variables are not set, Multiarch library 188 # paths are used instead. 189 ifdef CROSS_COMPILE 190 ifeq ($(PKG_CONFIG_LIBDIR)$(PKG_CONFIG_PATH)$(PKG_CONFIG_SYSROOT_DIR),) 191 CROSS_ARCH = $(notdir $(CROSS_COMPILE:%-=%)) 192 PKG_CONFIG_LIBDIR := /usr/local/$(CROSS_ARCH)/lib/pkgconfig/ 193 PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/lib/$(CROSS_ARCH)/pkgconfig/ 194 PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/lib/$(CROSS_ARCH)/pkgconfig/ 195 PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/share/pkgconfig/ 196 PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/share/pkgconfig/ 197 export PKG_CONFIG_LIBDIR 198 $(warning Missing PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH and PKG_CONFIG_SYSROOT_DIR for cross compilation,) 199 $(warning set PKG_CONFIG_LIBDIR for using Multiarch libs.) 200 endif 201 endif 202endif 203 204RM = rm -f 205LN = ln -f 206MKDIR = mkdir 207FIND = find 208INSTALL = install 209FLEX ?= flex 210BISON ?= bison 211AWK = awk 212 213# include Makefile.config by default and rule out 214# non-config cases 215config := 1 216 217# install-build-deps runs the install-build-deps.sh script, which 218# derives the package list from the feature test sources in 219# tools/build/feature/, so it needs neither the fixdep build nor a 220# config/feature detection pass: in a fresh container without gcc or 221# pkg-config those would fail before the script could install them. 222NON_CONFIG_TARGETS := clean python-clean TAGS tags cscope help install-build-deps 223 224ifdef MAKECMDGOALS 225ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),) 226 VMLINUX_H=$(src-perf)/util/bpf_skel/vmlinux/vmlinux.h 227 config := 0 228endif 229endif 230 231# The fixdep build - we force fixdep tool to be built as 232# the first target in the separate make session not to be 233# disturbed by any parallel make jobs. Once fixdep is done 234# we issue the requested build with FIXDEP_BUILT=1 variable. 235# 236# The fixdep build is disabled for $(NON_CONFIG_TARGETS) 237# targets, because it's not necessary. 238 239ifdef FIXDEP_BUILT 240 force_fixdep := 0 241else 242 force_fixdep := $(config) 243endif 244 245# Runs shellcheck on perf shell scripts 246ifeq ($(NO_SHELLCHECK),1) 247 SHELLCHECK := 248else 249 SHELLCHECK := $(shell which shellcheck 2> /dev/null) 250endif 251 252# shellcheck is using in tools/perf/tests/Build with option -a/--check-sourced ( 253# introduced in v0.4.7) and -S/--severity (introduced in v0.6.0) as well as 254# dynamic source inclusions (properly handled since v0.7.2). 255# So make the minimal shellcheck version as v0.7.2. 256ifneq ($(SHELLCHECK),) 257 ifeq ($(shell expr $(shell $(SHELLCHECK) --version | grep version: | \ 258 sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \< 072), 1) 259 SHELLCHECK := 260 else 261 SHELLCHECK := $(SHELLCHECK) -s bash -a -S warning 262 endif 263endif 264 265# Runs mypy on perf python files 266ifeq ($(MYPY),1) 267 MYPY := $(shell which mypy 2> /dev/null) 268endif 269 270# Runs pylint on perf python files 271ifeq ($(PYLINT),1) 272 PYLINT := $(shell which pylint 2> /dev/null) 273endif 274 275export srctree OUTPUT RM CC CXX RUSTC CLANG LD AR CFLAGS CXXFLAGS RUST_FLAGS V BISON FLEX AWK LIBBPF READELF 276export HOSTCC HOSTLD HOSTAR HOSTCFLAGS SHELLCHECK MYPY PYLINT CONFIG_PERF_BPF_SKEL 277 278include $(srctree)/tools/build/Makefile.include 279 280ifeq ($(force_fixdep),1) 281goals := $(filter-out all sub-make, $(MAKECMDGOALS)) 282 283$(goals) all: sub-make 284 285sub-make: fixdep 286 $(Q)$(MAKE) FIXDEP_BUILT=1 -f Makefile.perf $(goals) 287 288else # force_fixdep 289 290LIBAPI_DIR = $(srctree)/tools/lib/api/ 291LIBBPF_DIR = $(srctree)/tools/lib/bpf/ 292LIBSUBCMD_DIR = $(srctree)/tools/lib/subcmd/ 293LIBSYMBOL_DIR = $(srctree)/tools/lib/symbol/ 294LIBPERF_DIR = $(srctree)/tools/lib/perf/ 295DOC_DIR = $(srctree)/tools/perf/Documentation/ 296 297# Set FEATURE_TESTS to 'all' so all possible feature checkers are executed. 298# Without this setting the output feature dump file misses some features, for 299# example, liberty. Select all checkers so we won't get an incomplete feature 300# dump file. 301ifeq ($(config),1) 302ifdef MAKECMDGOALS 303ifeq ($(filter feature-dump,$(MAKECMDGOALS)),feature-dump) 304FEATURE_TESTS := all 305endif 306endif 307include Makefile.config 308endif 309 310ifeq ($(config),0) 311include $(srctree)/tools/scripts/Makefile.arch 312-include arch/$(SRCARCH)/Makefile 313endif 314 315# The FEATURE_DUMP_EXPORT holds location of the actual 316# FEATURE_DUMP file to be used to bypass feature detection 317# (for bpf or any other subproject) 318ifeq ($(FEATURES_DUMP),) 319FEATURE_DUMP_EXPORT := $(realpath $(OUTPUT)FEATURE-DUMP) 320else 321FEATURE_DUMP_EXPORT := $(realpath $(FEATURES_DUMP)) 322endif 323 324export prefix bindir sharedir sysconfdir DESTDIR VMLINUX_H_FILE 325 326# sparse is architecture-neutral, which means that we need to tell it 327# explicitly what architecture to check for. Fix this up for yours.. 328SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ 329 330# Guard against environment variables 331PYRF_OBJS = 332SCRIPT_SH = 333 334SCRIPT_SH += perf-archive.sh 335SCRIPT_SH += perf-iostat.sh 336 337grep-libs = $(filter -l%,$(1)) 338strip-libs = $(filter-out -l%,$(1)) 339 340ifneq ($(OUTPUT),) 341 LIBAPI_OUTPUT = $(abspath $(OUTPUT))/libapi 342else 343 LIBAPI_OUTPUT = $(CURDIR)/libapi 344endif 345LIBAPI_DESTDIR = $(LIBAPI_OUTPUT) 346LIBAPI_INCLUDE = $(LIBAPI_DESTDIR)/include 347LIBAPI = $(LIBAPI_OUTPUT)/libapi.a 348export LIBAPI 349CFLAGS += -I$(LIBAPI_OUTPUT)/include 350 351ifneq ($(OUTPUT),) 352 LIBBPF_OUTPUT = $(abspath $(OUTPUT))/libbpf 353else 354 LIBBPF_OUTPUT = $(CURDIR)/libbpf 355endif 356ifdef LIBBPF_STATIC 357 LIBBPF_DESTDIR = $(LIBBPF_OUTPUT) 358 LIBBPF_INCLUDE = $(LIBBPF_DESTDIR)/include 359 LIBBPF = $(LIBBPF_OUTPUT)/libbpf.a 360 CFLAGS += -I$(LIBBPF_OUTPUT)/include 361endif 362 363ifneq ($(OUTPUT),) 364 LIBSUBCMD_OUTPUT = $(abspath $(OUTPUT))/libsubcmd 365else 366 LIBSUBCMD_OUTPUT = $(CURDIR)/libsubcmd 367endif 368LIBSUBCMD_DESTDIR = $(LIBSUBCMD_OUTPUT) 369LIBSUBCMD_INCLUDE = $(LIBSUBCMD_DESTDIR)/include 370LIBSUBCMD = $(LIBSUBCMD_OUTPUT)/libsubcmd.a 371CFLAGS += -I$(LIBSUBCMD_OUTPUT)/include 372 373ifneq ($(OUTPUT),) 374 LIBSYMBOL_OUTPUT = $(abspath $(OUTPUT))/libsymbol 375else 376 LIBSYMBOL_OUTPUT = $(CURDIR)/libsymbol 377endif 378LIBSYMBOL_DESTDIR = $(LIBSYMBOL_OUTPUT) 379LIBSYMBOL_INCLUDE = $(LIBSYMBOL_DESTDIR)/include 380LIBSYMBOL = $(LIBSYMBOL_OUTPUT)/libsymbol.a 381CFLAGS += -I$(LIBSYMBOL_OUTPUT)/include 382 383ifneq ($(OUTPUT),) 384 LIBPERF_OUTPUT = $(abspath $(OUTPUT))/libperf 385else 386 LIBPERF_OUTPUT = $(CURDIR)/libperf 387endif 388LIBPERF_DESTDIR = $(LIBPERF_OUTPUT) 389LIBPERF_INCLUDE = $(LIBPERF_DESTDIR)/include 390LIBPERF = $(LIBPERF_OUTPUT)/libperf.a 391export LIBPERF 392CFLAGS += -I$(LIBPERF_OUTPUT)/include 393 394# python extension build directories 395PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/ 396PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/ 397PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/ 398export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP 399 400python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so 401 402ifneq ($(quiet),) 403python_setup_quiet=--quiet 404endif 405 406# Use the detected configuration 407-include $(OUTPUT).config-detected 408 409SCRIPTS = $(addprefix $(OUTPUT),$(patsubst %.sh,%,$(SCRIPT_SH))) 410 411PROGRAMS += $(OUTPUT)perf 412 413ifndef NO_PERF_READ_VDSO32 414PROGRAMS += $(OUTPUT)perf-read-vdso32 415endif 416 417ifndef NO_PERF_READ_VDSOX32 418PROGRAMS += $(OUTPUT)perf-read-vdsox32 419endif 420 421LIBJVMTI = libperf-jvmti.so 422 423ifndef NO_JVMTI 424PROGRAMS += $(OUTPUT)$(LIBJVMTI) 425endif 426 427DLFILTERS := dlfilter-test-api-v0.so dlfilter-test-api-v2.so dlfilter-show-cycles.so 428DLFILTERS := $(patsubst %,$(OUTPUT)dlfilters/%,$(DLFILTERS)) 429 430# what 'all' will build and 'install' will install, in perfexecdir 431ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) $(DLFILTERS) 432 433# what 'all' will build but not install in perfexecdir 434OTHER_PROGRAMS = $(OUTPUT)perf 435 436# Set paths to tools early so that they can be used for version tests. 437ifndef SHELL_PATH 438 SHELL_PATH = /bin/sh 439endif 440ifndef PERL_PATH 441 PERL_PATH = /usr/bin/perl 442endif 443 444export PERL_PATH 445 446LIBPERF_BENCH_IN := $(OUTPUT)perf-bench-in.o 447LIBPERF_BENCH := $(OUTPUT)libperf-bench.a 448 449LIBPERF_TEST_IN := $(OUTPUT)perf-test-in.o 450LIBPERF_TEST := $(OUTPUT)libperf-test.a 451 452LIBPERF_UI_IN := $(OUTPUT)perf-ui-in.o 453LIBPERF_UI := $(OUTPUT)libperf-ui.a 454 455LIBPERF_UTIL_IN := $(OUTPUT)perf-util-in.o 456LIBPERF_UTIL := $(OUTPUT)libperf-util.a 457 458LIBPMU_EVENTS_IN := $(OUTPUT)pmu-events/pmu-events-in.o 459LIBPMU_EVENTS := $(OUTPUT)libpmu-events.a 460 461PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL) 462ifdef LIBBPF_STATIC 463 PERFLIBS += $(LIBBPF) 464endif 465PERFLIBS += $(LIBPERF_BENCH) $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPERF_UTIL) 466PERFLIBS += $(LIBPMU_EVENTS) 467 468# We choose to avoid "if .. else if .. else .. endif endif" 469# because maintaining the nesting to match is a pain. If 470# we had "elif" things would have been much nicer... 471 472ifneq ($(OUTPUT),) 473 CFLAGS += -I$(OUTPUT) 474endif 475 476ifdef GTK2 477 ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so 478 GTK_IN := $(OUTPUT)gtk-in.o 479endif 480 481ifdef ASCIIDOC8 482 export ASCIIDOC8 483endif 484 485EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS)) 486LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group 487 488PERFLIBS_PY := $(call filter-out,$(LIBPERF_BENCH) $(LIBPERF_TEST),$(PERFLIBS)) 489LIBS_PY = -Wl,--whole-archive $(PERFLIBS_PY) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group 490 491export INSTALL SHELL_PATH 492 493### Build rules 494 495SHELL = $(SHELL_PATH) 496 497arm64_gen_sysreg_dir := $(srctree)/tools/arch/arm64/tools 498ifneq ($(OUTPUT),) 499 arm64_gen_sysreg_outdir := $(abspath $(OUTPUT)) 500else 501 arm64_gen_sysreg_outdir := $(CURDIR) 502endif 503 504arm64-sysreg-defs: FORCE 505 $(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir) \ 506 prefix= subdir= 507 508arm64-sysreg-defs-clean: 509 $(call QUIET_CLEAN,arm64-sysreg-defs) 510 $(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir) \ 511 prefix= subdir= clean > /dev/null 512 513all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) 514 515# Create python binding output directory if not already present 516$(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python') 517 518$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): util/python.c util/setup.py python/perf.pyi $(PERFLIBS_PY) 519 $(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \ 520 CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBS_PY)' \ 521 $(PYTHON_WORD) util/setup.py \ 522 $(python_setup_quiet) build_ext; \ 523 cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/; \ 524 if [ "$(abspath python/perf.pyi)" != "$(abspath $(OUTPUT)python/perf.pyi)" ]; then \ 525 cp python/perf.pyi $(OUTPUT)python/; \ 526 fi 527 528python_perf_target: 529 @echo "Target is: $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX)" 530 531please_set_SHELL_PATH_to_a_more_modern_shell: 532 $(Q)$$(:) 533 534shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell 535 536strip: $(PROGRAMS) $(OUTPUT)perf 537 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf 538 539PERF_IN := $(OUTPUT)perf-in.o 540export NO_JEVENTS 541 542build := -f $(srctree)/tools/build/Makefile.build dir=. obj 543 544$(PERF_IN): prepare FORCE 545 $(Q)$(MAKE) $(build)=perf 546 547$(LIBPMU_EVENTS_IN): FORCE $(LIBPERF) 548 $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=pmu-events obj=pmu-events 549 550$(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN) 551 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< 552 553# The $(LIBPERF_UTIL) dependency is to ensure bpftool and vmlinux.h 554# aren't racily built for bench/bpf_skel/bench_uprobe.bpf.c 555$(LIBPERF_BENCH_IN): FORCE prepare $(LIBSYMBOL) | $(LIBPERF_UTIL) 556 $(Q)$(MAKE) $(build)=perf-bench 557 558$(LIBPERF_BENCH): $(LIBPERF_BENCH_IN) 559 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< 560 561$(LIBPERF_TEST_IN): FORCE prepare 562 $(Q)$(MAKE) $(build)=perf-test 563 564$(LIBPERF_TEST): $(LIBPERF_TEST_IN) 565 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< 566 567$(LIBPERF_UI_IN): FORCE prepare 568 $(Q)$(MAKE) $(build)=perf-ui 569 570$(LIBPERF_UI): $(LIBPERF_UI_IN) 571 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< 572 573$(LIBPERF_UTIL_IN): FORCE prepare $(LIBSYMBOL) 574 $(Q)$(MAKE) $(build)=perf-util 575 576$(LIBPERF_UTIL): $(LIBPERF_UTIL_IN) 577 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< 578 579$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) 580 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \ 581 $(PERF_IN) $(LIBS) -o $@ 582 583$(GTK_IN): FORCE prepare 584 $(Q)$(MAKE) $(build)=gtk 585 586$(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS) 587 $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS) 588 589$(SCRIPTS) : $(OUTPUT)% : %.sh 590 $(QUIET_GEN)$(INSTALL) '$<' '$@' 591 592$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE 593 $(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) 594 595# These can record PERF_VERSION 596perf.spec $(SCRIPTS) \ 597 : $(OUTPUT)PERF-VERSION-FILE 598 599.SUFFIXES: 600 601# 602# If a target does not match any of the later rules then prefix it by $(OUTPUT) 603# This makes targets like 'make O=/tmp/perf perf.o' work in a natural way. 604# 605ifneq ($(OUTPUT),) 606%.o: $(OUTPUT)%.o 607 @echo " # Redirected target $@ => $(OUTPUT)$@" 608pmu-events/%.o: $(OUTPUT)pmu-events/%.o 609 @echo " # Redirected target $@ => $(OUTPUT)$@" 610util/%.o: $(OUTPUT)util/%.o 611 @echo " # Redirected target $@ => $(OUTPUT)$@" 612bench/%.o: $(OUTPUT)bench/%.o 613 @echo " # Redirected target $@ => $(OUTPUT)$@" 614tests/%.o: $(OUTPUT)tests/%.o 615 @echo " # Redirected target $@ => $(OUTPUT)$@" 616endif 617 618# These two need to be here so that when O= is not used they take precedence 619# over the general rule for .o 620 621# get relative building directory (to $(OUTPUT)) 622# and '.' if it's $(OUTPUT) itself 623__build-dir = $(subst $(OUTPUT),,$(dir $@)) 624build-dir = $(or $(__build-dir),.) 625 626bpf-skel-prepare: 627 $(Q)$(MAKE) -f bpf_skel.mak bpf-skel-prepare 628 629prepare: $(OUTPUT)PERF-VERSION-FILE \ 630 arm64-sysreg-defs \ 631 bpf-skel-prepare \ 632 $(LIBAPI) \ 633 $(LIBPERF) \ 634 $(LIBSUBCMD) 635 636ifdef LIBBPF_STATIC 637prepare: $(LIBBPF) 638endif 639 640$(OUTPUT)%.o: %.c prepare FORCE 641 $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ 642 643$(OUTPUT)%.i: %.c prepare FORCE 644 $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ 645 646$(OUTPUT)%.s: %.c prepare FORCE 647 $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ 648 649$(OUTPUT)%-bison.o: %.c prepare FORCE 650 $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ 651 652$(OUTPUT)%-flex.o: %.c prepare FORCE 653 $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ 654 655$(OUTPUT)%.o: %.S prepare FORCE 656 $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ 657 658$(OUTPUT)%.i: %.S prepare FORCE 659 $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ 660 661$(OUTPUT)perf-%: %.o $(PERFLIBS) 662 $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS) 663 664ifndef NO_PERF_READ_VDSO32 665$(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-map.c 666 $(QUIET_CC)$(CC) -m32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c 667endif 668 669ifndef NO_PERF_READ_VDSOX32 670$(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-map.c 671 $(QUIET_CC)$(CC) -mx32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c 672endif 673 674$(OUTPUT)dlfilters/%.o: dlfilters/%.c include/perf/perf_dlfilter.h 675 $(Q)$(MKDIR) -p $(OUTPUT)dlfilters 676 $(QUIET_CC)$(CC) -c -Iinclude $(EXTRA_CFLAGS) -o $@ -fpic $< 677 678.SECONDARY: $(DLFILTERS:.so=.o) 679 680$(OUTPUT)dlfilters/%.so: $(OUTPUT)dlfilters/%.o 681 $(QUIET_LINK)$(CC) $(filter-out -static,$(LDFLAGS)) $(EXTRA_CFLAGS) -shared -o $@ $< 682 683ifndef NO_JVMTI 684LIBJVMTI_IN := $(OUTPUT)jvmti/jvmti-in.o 685 686$(LIBJVMTI_IN): prepare FORCE 687 $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti 688 689$(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN) 690 $(QUIET_LINK)$(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $< 691endif 692 693$(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h) 694 695$(LIBAPI): FORCE | $(LIBAPI_OUTPUT) 696 $(Q)$(MAKE) -C $(LIBAPI_DIR) O=$(LIBAPI_OUTPUT) \ 697 DESTDIR=$(LIBAPI_DESTDIR) prefix= subdir= \ 698 $@ install_headers 699 700$(LIBAPI)-clean: 701 $(call QUIET_CLEAN, libapi) 702 $(Q)$(RM) -r -- $(LIBAPI_OUTPUT) 703 704$(LIBBPF): FORCE | $(LIBBPF_OUTPUT) 705 $(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \ 706 O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= subdir= \ 707 EXTRA_CFLAGS="-fPIC" $@ install_headers 708 709$(LIBBPF)-clean: 710 $(call QUIET_CLEAN, libbpf) 711 $(Q)$(RM) -r -- $(LIBBPF_OUTPUT) 712 713$(LIBPERF): FORCE | $(LIBPERF_OUTPUT) 714 $(Q)$(MAKE) -C $(LIBPERF_DIR) O=$(LIBPERF_OUTPUT) \ 715 DESTDIR=$(LIBPERF_DESTDIR) prefix= subdir= \ 716 $@ install_headers 717 718$(LIBPERF)-clean: 719 $(call QUIET_CLEAN, libperf) 720 $(Q)$(RM) -r -- $(LIBPERF_OUTPUT) 721 722$(LIBSUBCMD): FORCE | $(LIBSUBCMD_OUTPUT) 723 $(Q)$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \ 724 DESTDIR=$(LIBSUBCMD_DESTDIR) prefix= subdir= \ 725 $@ install_headers 726 727$(LIBSUBCMD)-clean: 728 $(call QUIET_CLEAN, libsubcmd) 729 $(Q)$(RM) -r -- $(LIBSUBCMD_OUTPUT) 730 731$(LIBSYMBOL): FORCE | $(LIBSYMBOL_OUTPUT) 732 $(Q)$(MAKE) -C $(LIBSYMBOL_DIR) O=$(LIBSYMBOL_OUTPUT) \ 733 DESTDIR=$(LIBSYMBOL_DESTDIR) prefix= subdir= \ 734 $@ install_headers 735 736$(LIBSYMBOL)-clean: 737 $(call QUIET_CLEAN, libsymbol) 738 $(Q)$(RM) -r -- $(LIBSYMBOL_OUTPUT) 739 740help: 741 @echo 'Perf make targets:' 742 @echo ' doc - make *all* documentation (see below)' 743 @echo ' man - make manpage documentation (access with man <foo>)' 744 @echo ' html - make html documentation' 745 @echo ' info - make GNU info documentation (access with info <foo>)' 746 @echo ' pdf - make pdf documentation' 747 @echo ' TAGS - use etags to make tag information for source browsing' 748 @echo ' tags - use ctags to make tag information for source browsing' 749 @echo ' cscope - use cscope to make interactive browsing database' 750 @echo '' 751 @echo 'Perf install targets:' 752 @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed' 753 @echo ' HINT: use "prefix" or "DESTDIR" to install to a particular' 754 @echo ' path like "make prefix=/usr/local install install-doc"' 755 @echo ' install - install compiled binaries' 756 @echo ' install-build-deps - install the development packages needed to build' 757 @echo ' install-doc - install *all* documentation' 758 @echo ' install-man - install manpage documentation' 759 @echo ' install-html - install html documentation' 760 @echo ' install-info - install GNU info documentation' 761 @echo ' install-pdf - install pdf documentation' 762 @echo '' 763 @echo ' quick-install-doc - alias for quick-install-man' 764 @echo ' quick-install-man - install the documentation quickly' 765 @echo ' quick-install-html - install the html documentation quickly' 766 @echo '' 767 @echo 'Perf maintainer targets:' 768 @echo ' clean - clean all binary objects and build output' 769 770 771DOC_TARGETS := doc man html info pdf 772 773INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man 774INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html 775 776# 'make doc' should call 'make -C Documentation all' 777$(DOC_TARGETS): 778 $(Q)$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) $(@:doc=all) ASCIIDOC_EXTRA=$(ASCIIDOC_EXTRA) 779 780TAG_FOLDERS= . ../lib ../include 781TAG_FILES= ../../include/uapi/linux/perf_event.h 782 783TAGS: 784 $(QUIET_GEN)$(RM) TAGS; \ 785 $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print -o -name '*.cpp' -print | xargs etags -a $(TAG_FILES) 786 787tags: 788 $(QUIET_GEN)$(RM) tags; \ 789 $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print -o -name '*.cpp' -print | xargs ctags -a $(TAG_FILES) 790 791cscope: 792 $(QUIET_GEN)$(RM) cscope*; \ 793 $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print -o -name '*.cpp' -print | xargs cscope -b $(TAG_FILES) 794 795### Testing rules 796 797# GNU make supports exporting all variables by "export" without parameters. 798# However, the environment gets quite big, and some programs have problems 799# with that. 800 801check: prepare 802 if sparse; \ 803 then \ 804 for i in *.c */*.c; \ 805 do \ 806 sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \ 807 done; \ 808 else \ 809 exit 1; \ 810 fi 811 812### Installation rules 813 814ifdef GTK2 815install-gtk: $(OUTPUT)libperf-gtk.so 816 $(call QUIET_INSTALL, 'GTK UI') \ 817 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \ 818 $(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)' 819else 820install-gtk: 821endif 822 823install-tools: all install-gtk 824 $(call QUIET_INSTALL, binaries) \ 825 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'; \ 826 $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'; \ 827 $(LN) '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'; \ 828 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(includedir_SQ)/perf'; \ 829 $(INSTALL) -m 644 include/perf/perf_dlfilter.h -t '$(DESTDIR_SQ)$(includedir_SQ)/perf' 830ifndef NO_PERF_READ_VDSO32 831 $(call QUIET_INSTALL, perf-read-vdso32) \ 832 $(INSTALL) $(OUTPUT)perf-read-vdso32 '$(DESTDIR_SQ)$(bindir_SQ)'; 833endif 834ifndef NO_PERF_READ_VDSOX32 835 $(call QUIET_INSTALL, perf-read-vdsox32) \ 836 $(INSTALL) $(OUTPUT)perf-read-vdsox32 '$(DESTDIR_SQ)$(bindir_SQ)'; 837endif 838ifndef NO_JVMTI 839 $(call QUIET_INSTALL, $(LIBJVMTI)) \ 840 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \ 841 $(INSTALL) $(OUTPUT)$(LIBJVMTI) '$(DESTDIR_SQ)$(libdir_SQ)'; 842endif 843 $(call QUIET_INSTALL, libexec) \ 844 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' 845 $(call QUIET_INSTALL, perf-archive) \ 846 $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' 847 $(call QUIET_INSTALL, perf-iostat) \ 848 $(INSTALL) $(OUTPUT)perf-iostat -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' 849ifdef LIBPERL 850 $(call QUIET_INSTALL, perl-scripts) \ 851 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \ 852 $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \ 853 $(INSTALL) scripts/perl/*.pl -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'; \ 854 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'; \ 855 $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' 856endif 857ifndef NO_LIBPYTHON 858 $(call QUIET_INSTALL, python-scripts) \ 859 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \ 860 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'; \ 861 $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \ 862 $(INSTALL) scripts/python/*.py -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'; \ 863 $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' 864endif 865 $(call QUIET_INSTALL, dlfilters) \ 866 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/dlfilters'; \ 867 $(INSTALL) $(DLFILTERS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/dlfilters'; 868 $(call QUIET_INSTALL, perf_completion-script) \ 869 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'; \ 870 $(INSTALL) perf-completion.sh -m 644 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf' 871 $(call QUIET_INSTALL, perf-tip) \ 872 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(tip_instdir_SQ)'; \ 873 $(INSTALL) Documentation/tips.txt -m 644 -t '$(DESTDIR_SQ)$(tip_instdir_SQ)' 874 875install-tests: all install-gtk 876 $(call QUIET_INSTALL, tests) \ 877 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \ 878 $(INSTALL) tests/pe-file.exe* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \ 879 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \ 880 $(INSTALL) tests/shell/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \ 881 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/attr'; \ 882 $(INSTALL) tests/shell/attr/* -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/attr'; \ 883 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \ 884 $(INSTALL) tests/shell/lib/*.sh -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \ 885 $(INSTALL) tests/shell/lib/*.py -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \ 886 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/common'; \ 887 $(INSTALL) tests/shell/common/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/common'; \ 888 $(INSTALL) tests/shell/common/*.pl '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/common'; \ 889 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_probe'; \ 890 $(INSTALL) tests/shell/base_probe/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_probe'; \ 891 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_report'; \ 892 $(INSTALL) tests/shell/base_report/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_report'; \ 893 $(INSTALL) tests/shell/base_report/*.txt '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_report'; \ 894 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight' ; \ 895 $(INSTALL) tests/shell/coresight/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight' 896 897install-bin: install-tools install-tests 898 899install: install-bin try-install-man 900 901# Install the development packages needed to build perf, derived from the 902# feature tests in tools/build/feature/. Currently supported: the Fedora 903# (dnf), Ubuntu (apt) and Debian (apt, reusing the Ubuntu mapping) 904# package mappings, see the script. 905# INSTALL_BUILD_DEPS_ARGS, when set, is passed to the script, so 906# extra options like --list, --dry-run or --distro can be given from make. 907install-build-deps: 908 $(Q)$(SHELL) $(srctree)/tools/perf/scripts/install-build-deps.sh $(INSTALL_BUILD_DEPS_ARGS) 909 910install-python_ext: 911 $(PYTHON_WORD) util/setup.py $(python_setup_quiet) install --root='/$(DESTDIR_SQ)' 912 913# 'make install-doc' should call 'make -C Documentation install' 914$(INSTALL_DOC_TARGETS): 915 $(Q)$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) $(@:-doc=) ASCIIDOC_EXTRA=$(ASCIIDOC_EXTRA) subdir= 916 917### Cleaning rules 918 919python-clean: 920 $(python-clean) 921 922$(LIBAPI_OUTPUT) $(LIBBPF_OUTPUT) $(LIBPERF_OUTPUT) $(LIBSUBCMD_OUTPUT) $(LIBSYMBOL_OUTPUT): 923 $(Q)$(MKDIR) -p $@ 924 925bpf-skel-clean: 926 $(Q)$(MAKE) -f bpf_skel.mak clean 927 928pmu-events-clean: 929ifeq ($(OUTPUT),) 930 $(call QUIET_CLEAN, pmu-events) $(RM) \ 931 pmu-events/pmu-events*.c \ 932 pmu-events/metric_test.log \ 933 pmu-events/test-empty-pmu-events.c \ 934 pmu-events/empty-pmu-events.log 935 $(Q)find pmu-events/arch -name 'extra-metrics.json' -delete -o \ 936 -name 'extra-metricgroups.json' -delete 937else # When an OUTPUT directory is present, clean up the copied pmu-events/arch directory. 938 $(call QUIET_CLEAN, pmu-events) $(RM) -r $(OUTPUT)pmu-events/arch \ 939 $(OUTPUT)pmu-events/pmu-events*.c \ 940 $(OUTPUT)pmu-events/metric_test.log \ 941 $(OUTPUT)pmu-events/test-empty-pmu-events.c \ 942 $(OUTPUT)pmu-events/empty-pmu-events.log 943endif 944 945clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean \ 946 arm64-sysreg-defs-clean fixdep-clean python-clean bpf-skel-clean \ 947 pmu-events-clean 948 $(call QUIET_CLEAN, core-objs) $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive \ 949 $(OUTPUT)perf-iostat $(LANG_BINDINGS) 950 $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '*.a' -delete -o \ 951 -name '\.*.cmd' -delete -o -name '\.*.d' -delete -o -name '*.shellcheck_log' -delete 952 $(Q)$(RM) $(OUTPUT).config-detected 953 $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 \ 954 perf-read-vdsox32 $(OUTPUT)$(LIBJVMTI).so 955 $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo \ 956 TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE \ 957 $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \ 958 $(OUTPUT)util/intel-pt-decoder/inat-tables.c \ 959 $(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c 960 $(Q)$(RM) -r $(OUTPUT)trace/beauty/generated 961 $(call QUIET_CLEAN, Documentation) \ 962 $(MAKE) -C $(DOC_DIR) O=$(OUTPUT) clean >/dev/null 963 964# 965# To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY) 966# file if defined, with no further action. 967feature-dump: 968ifdef FEATURE_DUMP_COPY 969 @cp $(OUTPUT)FEATURE-DUMP $(FEATURE_DUMP_COPY) 970 @echo "FEATURE-DUMP file copied into $(FEATURE_DUMP_COPY)" 971else 972 @echo "FEATURE-DUMP file available in $(OUTPUT)FEATURE-DUMP" 973endif 974 975 976FORCE: 977 978.PHONY: all install install-build-deps clean config-clean strip install-gtk 979.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell 980.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope FORCE prepare bpf-skel-prepare 981.PHONY: python_perf_target 982 983endif # force_fixdep 984 985# Delete partially updated (corrupted) files on error 986.DELETE_ON_ERROR: 987