xref: /linux/tools/perf/Makefile.perf (revision 390d5ea26622f794c2d29cefd5a01ef116b4fe1d)
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_LIBBABELTRACE if you do not want libbabeltrace 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
177HOSTCC  ?= gcc
178HOSTLD  ?= ld
179HOSTAR  ?= ar
180CLANG   ?= clang
181
182# Some distros provide the command $(CROSS_COMPILE)pkg-config for
183# searching packges installed with Multiarch. Use it for cross
184# compilation if it is existed.
185ifneq (, $(shell which $(CROSS_COMPILE)pkg-config))
186  PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
187else
188  PKG_CONFIG ?= pkg-config
189
190  # PKG_CONFIG_PATH or PKG_CONFIG_LIBDIR, alongside PKG_CONFIG_SYSROOT_DIR
191  # for modified system root, is required for the cross compilation.
192  # If these PKG_CONFIG environment variables are not set, Multiarch library
193  # paths are used instead.
194  ifdef CROSS_COMPILE
195    ifeq ($(PKG_CONFIG_LIBDIR)$(PKG_CONFIG_PATH)$(PKG_CONFIG_SYSROOT_DIR),)
196      CROSS_ARCH = $(notdir $(CROSS_COMPILE:%-=%))
197      PKG_CONFIG_LIBDIR := /usr/local/$(CROSS_ARCH)/lib/pkgconfig/
198      PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/lib/$(CROSS_ARCH)/pkgconfig/
199      PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/lib/$(CROSS_ARCH)/pkgconfig/
200      PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/share/pkgconfig/
201      PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/share/pkgconfig/
202      export PKG_CONFIG_LIBDIR
203      $(warning Missing PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH and PKG_CONFIG_SYSROOT_DIR for cross compilation,)
204      $(warning set PKG_CONFIG_LIBDIR for using Multiarch libs.)
205    endif
206  endif
207endif
208
209RM      = rm -f
210LN      = ln -f
211MKDIR   = mkdir
212FIND    = find
213INSTALL = install
214FLEX    ?= flex
215BISON   ?= bison
216STRIP   = strip
217AWK     = awk
218READELF ?= readelf
219
220# include Makefile.config by default and rule out
221# non-config cases
222config := 1
223
224NON_CONFIG_TARGETS := clean python-clean TAGS tags cscope help
225
226ifdef MAKECMDGOALS
227ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
228  VMLINUX_H=$(src-perf)/util/bpf_skel/vmlinux/vmlinux.h
229  config := 0
230endif
231endif
232
233# The fixdep build - we force fixdep tool to be built as
234# the first target in the separate make session not to be
235# disturbed by any parallel make jobs. Once fixdep is done
236# we issue the requested build with FIXDEP_BUILT=1 variable.
237#
238# The fixdep build is disabled for $(NON_CONFIG_TARGETS)
239# targets, because it's not necessary.
240
241ifdef FIXDEP_BUILT
242  force_fixdep := 0
243else
244  force_fixdep := $(config)
245endif
246
247# Runs shellcheck on perf shell scripts
248ifeq ($(NO_SHELLCHECK),1)
249  SHELLCHECK :=
250else
251  SHELLCHECK := $(shell which shellcheck 2> /dev/null)
252endif
253
254# shellcheck is using in tools/perf/tests/Build with option -a/--check-sourced (
255# introduced in v0.4.7) and -S/--severity (introduced in v0.6.0) as well as
256# dynamic source inclusions (properly handled since v0.7.2).
257# So make the minimal shellcheck version as v0.7.2.
258ifneq ($(SHELLCHECK),)
259  ifeq ($(shell expr $(shell $(SHELLCHECK) --version | grep version: | \
260        sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \< 072), 1)
261    SHELLCHECK :=
262  else
263    SHELLCHECK := $(SHELLCHECK) -s bash -a -S warning
264  endif
265endif
266
267# Runs mypy on perf python files
268ifeq ($(MYPY),1)
269  MYPY := $(shell which mypy 2> /dev/null)
270endif
271
272# Runs pylint on perf python files
273ifeq ($(PYLINT),1)
274  PYLINT := $(shell which pylint 2> /dev/null)
275endif
276
277export srctree OUTPUT RM CC CXX RUSTC CLANG LD AR CFLAGS CXXFLAGS RUST_FLAGS V BISON FLEX AWK LIBBPF READELF
278export HOSTCC HOSTLD HOSTAR HOSTCFLAGS SHELLCHECK MYPY PYLINT CONFIG_PERF_BPF_SKEL
279
280include $(srctree)/tools/build/Makefile.include
281
282ifeq ($(force_fixdep),1)
283goals := $(filter-out all sub-make, $(MAKECMDGOALS))
284
285$(goals) all: sub-make
286
287sub-make: fixdep
288	$(Q)$(MAKE) FIXDEP_BUILT=1 -f Makefile.perf $(goals)
289
290else # force_fixdep
291
292LIBAPI_DIR      = $(srctree)/tools/lib/api/
293LIBBPF_DIR      = $(srctree)/tools/lib/bpf/
294LIBSUBCMD_DIR   = $(srctree)/tools/lib/subcmd/
295LIBSYMBOL_DIR   = $(srctree)/tools/lib/symbol/
296LIBPERF_DIR     = $(srctree)/tools/lib/perf/
297DOC_DIR         = $(srctree)/tools/perf/Documentation/
298
299# Set FEATURE_TESTS to 'all' so all possible feature checkers are executed.
300# Without this setting the output feature dump file misses some features, for
301# example, liberty. Select all checkers so we won't get an incomplete feature
302# dump file.
303ifeq ($(config),1)
304ifdef MAKECMDGOALS
305ifeq ($(filter feature-dump,$(MAKECMDGOALS)),feature-dump)
306FEATURE_TESTS := all
307endif
308endif
309include Makefile.config
310endif
311
312ifeq ($(config),0)
313include $(srctree)/tools/scripts/Makefile.arch
314-include arch/$(SRCARCH)/Makefile
315endif
316
317# The FEATURE_DUMP_EXPORT holds location of the actual
318# FEATURE_DUMP file to be used to bypass feature detection
319# (for bpf or any other subproject)
320ifeq ($(FEATURES_DUMP),)
321FEATURE_DUMP_EXPORT := $(realpath $(OUTPUT)FEATURE-DUMP)
322else
323FEATURE_DUMP_EXPORT := $(realpath $(FEATURES_DUMP))
324endif
325
326export prefix bindir sharedir sysconfdir DESTDIR VMLINUX_H_FILE
327
328# sparse is architecture-neutral, which means that we need to tell it
329# explicitly what architecture to check for. Fix this up for yours..
330SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
331
332# Guard against environment variables
333PYRF_OBJS =
334SCRIPT_SH =
335
336SCRIPT_SH += perf-archive.sh
337SCRIPT_SH += perf-iostat.sh
338
339grep-libs = $(filter -l%,$(1))
340strip-libs = $(filter-out -l%,$(1))
341
342ifneq ($(OUTPUT),)
343  LIBAPI_OUTPUT = $(abspath $(OUTPUT))/libapi
344else
345  LIBAPI_OUTPUT = $(CURDIR)/libapi
346endif
347LIBAPI_DESTDIR = $(LIBAPI_OUTPUT)
348LIBAPI_INCLUDE = $(LIBAPI_DESTDIR)/include
349LIBAPI = $(LIBAPI_OUTPUT)/libapi.a
350export LIBAPI
351CFLAGS += -I$(LIBAPI_OUTPUT)/include
352
353ifneq ($(OUTPUT),)
354  LIBBPF_OUTPUT = $(abspath $(OUTPUT))/libbpf
355else
356  LIBBPF_OUTPUT = $(CURDIR)/libbpf
357endif
358ifdef LIBBPF_STATIC
359  LIBBPF_DESTDIR = $(LIBBPF_OUTPUT)
360  LIBBPF_INCLUDE = $(LIBBPF_DESTDIR)/include
361  LIBBPF = $(LIBBPF_OUTPUT)/libbpf.a
362  CFLAGS += -I$(LIBBPF_OUTPUT)/include
363endif
364
365ifneq ($(OUTPUT),)
366  LIBSUBCMD_OUTPUT = $(abspath $(OUTPUT))/libsubcmd
367else
368  LIBSUBCMD_OUTPUT = $(CURDIR)/libsubcmd
369endif
370LIBSUBCMD_DESTDIR = $(LIBSUBCMD_OUTPUT)
371LIBSUBCMD_INCLUDE = $(LIBSUBCMD_DESTDIR)/include
372LIBSUBCMD = $(LIBSUBCMD_OUTPUT)/libsubcmd.a
373CFLAGS += -I$(LIBSUBCMD_OUTPUT)/include
374
375ifneq ($(OUTPUT),)
376  LIBSYMBOL_OUTPUT = $(abspath $(OUTPUT))/libsymbol
377else
378  LIBSYMBOL_OUTPUT = $(CURDIR)/libsymbol
379endif
380LIBSYMBOL_DESTDIR = $(LIBSYMBOL_OUTPUT)
381LIBSYMBOL_INCLUDE = $(LIBSYMBOL_DESTDIR)/include
382LIBSYMBOL = $(LIBSYMBOL_OUTPUT)/libsymbol.a
383CFLAGS += -I$(LIBSYMBOL_OUTPUT)/include
384
385ifneq ($(OUTPUT),)
386  LIBPERF_OUTPUT = $(abspath $(OUTPUT))/libperf
387else
388  LIBPERF_OUTPUT = $(CURDIR)/libperf
389endif
390LIBPERF_DESTDIR = $(LIBPERF_OUTPUT)
391LIBPERF_INCLUDE = $(LIBPERF_DESTDIR)/include
392LIBPERF = $(LIBPERF_OUTPUT)/libperf.a
393export LIBPERF
394CFLAGS += -I$(LIBPERF_OUTPUT)/include
395
396# python extension build directories
397PYTHON_EXTBUILD     := $(OUTPUT)python_ext_build/
398PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
399PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
400export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
401
402python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so
403
404# Use the detected configuration
405-include $(OUTPUT).config-detected
406
407SCRIPTS = $(addprefix $(OUTPUT),$(patsubst %.sh,%,$(SCRIPT_SH)))
408
409PROGRAMS += $(OUTPUT)perf
410
411ifndef NO_PERF_READ_VDSO32
412PROGRAMS += $(OUTPUT)perf-read-vdso32
413endif
414
415ifndef NO_PERF_READ_VDSOX32
416PROGRAMS += $(OUTPUT)perf-read-vdsox32
417endif
418
419LIBJVMTI = libperf-jvmti.so
420
421ifndef NO_JVMTI
422PROGRAMS += $(OUTPUT)$(LIBJVMTI)
423endif
424
425DLFILTERS := dlfilter-test-api-v0.so dlfilter-test-api-v2.so dlfilter-show-cycles.so
426DLFILTERS := $(patsubst %,$(OUTPUT)dlfilters/%,$(DLFILTERS))
427
428# what 'all' will build and 'install' will install, in perfexecdir
429ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) $(DLFILTERS)
430
431# what 'all' will build but not install in perfexecdir
432OTHER_PROGRAMS = $(OUTPUT)perf
433
434# Set paths to tools early so that they can be used for version tests.
435ifndef SHELL_PATH
436  SHELL_PATH = /bin/sh
437endif
438ifndef PERL_PATH
439  PERL_PATH = /usr/bin/perl
440endif
441
442export PERL_PATH
443
444LIBPERF_BENCH_IN := $(OUTPUT)perf-bench-in.o
445LIBPERF_BENCH := $(OUTPUT)libperf-bench.a
446
447LIBPERF_TEST_IN := $(OUTPUT)perf-test-in.o
448LIBPERF_TEST := $(OUTPUT)libperf-test.a
449
450LIBPERF_UI_IN := $(OUTPUT)perf-ui-in.o
451LIBPERF_UI := $(OUTPUT)libperf-ui.a
452
453LIBPERF_UTIL_IN := $(OUTPUT)perf-util-in.o
454LIBPERF_UTIL := $(OUTPUT)libperf-util.a
455
456LIBPMU_EVENTS_IN := $(OUTPUT)pmu-events/pmu-events-in.o
457LIBPMU_EVENTS := $(OUTPUT)libpmu-events.a
458
459PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL)
460ifdef LIBBPF_STATIC
461  PERFLIBS += $(LIBBPF)
462endif
463PERFLIBS += $(LIBPERF_BENCH) $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPERF_UTIL)
464PERFLIBS += $(LIBPMU_EVENTS)
465
466# We choose to avoid "if .. else if .. else .. endif endif"
467# because maintaining the nesting to match is a pain.  If
468# we had "elif" things would have been much nicer...
469
470ifneq ($(OUTPUT),)
471  CFLAGS += -I$(OUTPUT)
472endif
473
474ifdef GTK2
475  ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so
476  GTK_IN := $(OUTPUT)gtk-in.o
477endif
478
479ifdef ASCIIDOC8
480  export ASCIIDOC8
481endif
482
483EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS))
484LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
485
486PERFLIBS_PY := $(call filter-out,$(LIBPERF_BENCH) $(LIBPERF_TEST),$(PERFLIBS))
487LIBS_PY = -Wl,--whole-archive $(PERFLIBS_PY) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
488
489export INSTALL SHELL_PATH
490
491### Build rules
492
493SHELL = $(SHELL_PATH)
494
495arm64_gen_sysreg_dir := $(srctree)/tools/arch/arm64/tools
496ifneq ($(OUTPUT),)
497  arm64_gen_sysreg_outdir := $(abspath $(OUTPUT))
498else
499  arm64_gen_sysreg_outdir := $(CURDIR)
500endif
501
502arm64-sysreg-defs: FORCE
503	$(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir) \
504		prefix= subdir=
505
506arm64-sysreg-defs-clean:
507	$(call QUIET_CLEAN,arm64-sysreg-defs)
508	$(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir) \
509		prefix= subdir= clean > /dev/null
510
511TESTS_CORESIGHT_DIR := $(srctree)/tools/perf/tests/shell/coresight
512
513tests-coresight-targets: FORCE
514	$(Q)$(MAKE) -C $(TESTS_CORESIGHT_DIR)
515
516tests-coresight-targets-clean:
517	$(call QUIET_CLEAN, coresight)
518	$(Q)$(MAKE) -C $(TESTS_CORESIGHT_DIR) O=$(OUTPUT) clean >/dev/null
519
520all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) tests-coresight-targets
521
522# Create python binding output directory if not already present
523$(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python')
524
525$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): util/python.c util/setup.py $(PERFLIBS_PY)
526	$(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
527        CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBS_PY)' \
528	  $(PYTHON_WORD) util/setup.py \
529	  --quiet build_ext; \
530	cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/
531
532python_perf_target:
533	@echo "Target is: $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX)"
534
535please_set_SHELL_PATH_to_a_more_modern_shell:
536	$(Q)$$(:)
537
538shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
539
540strip: $(PROGRAMS) $(OUTPUT)perf
541	$(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
542
543PERF_IN := $(OUTPUT)perf-in.o
544export NO_JEVENTS
545
546build := -f $(srctree)/tools/build/Makefile.build dir=. obj
547
548$(PERF_IN): prepare FORCE
549	$(Q)$(MAKE) $(build)=perf
550
551$(LIBPMU_EVENTS_IN): FORCE $(LIBPERF)
552	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=pmu-events obj=pmu-events
553
554$(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN)
555	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
556
557# The $(LIBPERF_UTIL) dependency is to ensure bpftool and vmlinux.h
558# aren't racily built for bench/bpf_skel/bench_uprobe.bpf.c
559$(LIBPERF_BENCH_IN): FORCE prepare $(LIBSYMBOL) | $(LIBPERF_UTIL)
560	$(Q)$(MAKE) $(build)=perf-bench
561
562$(LIBPERF_BENCH): $(LIBPERF_BENCH_IN)
563	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
564
565$(LIBPERF_TEST_IN): FORCE prepare
566	$(Q)$(MAKE) $(build)=perf-test
567
568$(LIBPERF_TEST): $(LIBPERF_TEST_IN)
569	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
570
571$(LIBPERF_UI_IN): FORCE prepare
572	$(Q)$(MAKE) $(build)=perf-ui
573
574$(LIBPERF_UI): $(LIBPERF_UI_IN)
575	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
576
577$(LIBPERF_UTIL_IN): FORCE prepare $(LIBSYMBOL)
578	$(Q)$(MAKE) $(build)=perf-util
579
580$(LIBPERF_UTIL): $(LIBPERF_UTIL_IN)
581	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
582
583$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN)
584	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \
585		$(PERF_IN) $(LIBS) -o $@
586
587$(GTK_IN): FORCE prepare
588	$(Q)$(MAKE) $(build)=gtk
589
590$(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS)
591	$(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
592
593$(SCRIPTS) : $(OUTPUT)% : %.sh
594	$(QUIET_GEN)$(INSTALL) '$<' '$@'
595
596$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
597	$(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
598
599# These can record PERF_VERSION
600perf.spec $(SCRIPTS) \
601	: $(OUTPUT)PERF-VERSION-FILE
602
603.SUFFIXES:
604
605#
606# If a target does not match any of the later rules then prefix it by $(OUTPUT)
607# This makes targets like 'make O=/tmp/perf perf.o' work in a natural way.
608#
609ifneq ($(OUTPUT),)
610%.o: $(OUTPUT)%.o
611	@echo "    # Redirected target $@ => $(OUTPUT)$@"
612pmu-events/%.o: $(OUTPUT)pmu-events/%.o
613	@echo "    # Redirected target $@ => $(OUTPUT)$@"
614util/%.o: $(OUTPUT)util/%.o
615	@echo "    # Redirected target $@ => $(OUTPUT)$@"
616bench/%.o: $(OUTPUT)bench/%.o
617	@echo "    # Redirected target $@ => $(OUTPUT)$@"
618tests/%.o: $(OUTPUT)tests/%.o
619	@echo "    # Redirected target $@ => $(OUTPUT)$@"
620endif
621
622# These two need to be here so that when O= is not used they take precedence
623# over the general rule for .o
624
625# get relative building directory (to $(OUTPUT))
626# and '.' if it's $(OUTPUT) itself
627__build-dir = $(subst $(OUTPUT),,$(dir $@))
628build-dir   = $(or $(__build-dir),.)
629
630bpf-skel-prepare:
631	$(Q)$(MAKE) -f bpf_skel.mak bpf-skel-prepare
632
633prepare: $(OUTPUT)PERF-VERSION-FILE \
634	arm64-sysreg-defs \
635	bpf-skel-prepare \
636	$(LIBAPI) \
637	$(LIBPERF) \
638	$(LIBSUBCMD)
639
640ifdef LIBBPF_STATIC
641prepare: $(LIBBPF)
642endif
643
644$(OUTPUT)%.o: %.c prepare FORCE
645	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
646
647$(OUTPUT)%.i: %.c prepare FORCE
648	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
649
650$(OUTPUT)%.s: %.c prepare FORCE
651	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
652
653$(OUTPUT)%-bison.o: %.c prepare FORCE
654	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
655
656$(OUTPUT)%-flex.o: %.c prepare FORCE
657	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
658
659$(OUTPUT)%.o: %.S prepare FORCE
660	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
661
662$(OUTPUT)%.i: %.S prepare FORCE
663	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
664
665$(OUTPUT)perf-%: %.o $(PERFLIBS)
666	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
667
668ifndef NO_PERF_READ_VDSO32
669$(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-map.c
670	$(QUIET_CC)$(CC) -m32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
671endif
672
673ifndef NO_PERF_READ_VDSOX32
674$(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-map.c
675	$(QUIET_CC)$(CC) -mx32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
676endif
677
678$(OUTPUT)dlfilters/%.o: dlfilters/%.c include/perf/perf_dlfilter.h
679	$(Q)$(MKDIR) -p $(OUTPUT)dlfilters
680	$(QUIET_CC)$(CC) -c -Iinclude $(EXTRA_CFLAGS) -o $@ -fpic $<
681
682.SECONDARY: $(DLFILTERS:.so=.o)
683
684$(OUTPUT)dlfilters/%.so: $(OUTPUT)dlfilters/%.o
685	$(QUIET_LINK)$(CC) $(EXTRA_CFLAGS) -shared -o $@ $<
686
687ifndef NO_JVMTI
688LIBJVMTI_IN := $(OUTPUT)jvmti/jvmti-in.o
689
690$(LIBJVMTI_IN): prepare FORCE
691	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
692
693$(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
694	$(QUIET_LINK)$(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
695endif
696
697$(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
698
699$(LIBAPI): FORCE | $(LIBAPI_OUTPUT)
700	$(Q)$(MAKE) -C $(LIBAPI_DIR) O=$(LIBAPI_OUTPUT) \
701		DESTDIR=$(LIBAPI_DESTDIR) prefix= subdir= \
702		$@ install_headers
703
704$(LIBAPI)-clean:
705	$(call QUIET_CLEAN, libapi)
706	$(Q)$(RM) -r -- $(LIBAPI_OUTPUT)
707
708$(LIBBPF): FORCE | $(LIBBPF_OUTPUT)
709	$(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \
710		O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= subdir= \
711		EXTRA_CFLAGS="-fPIC" $@ install_headers
712
713$(LIBBPF)-clean:
714	$(call QUIET_CLEAN, libbpf)
715	$(Q)$(RM) -r -- $(LIBBPF_OUTPUT)
716
717$(LIBPERF): FORCE | $(LIBPERF_OUTPUT)
718	$(Q)$(MAKE) -C $(LIBPERF_DIR) O=$(LIBPERF_OUTPUT) \
719		DESTDIR=$(LIBPERF_DESTDIR) prefix= subdir= \
720		$@ install_headers
721
722$(LIBPERF)-clean:
723	$(call QUIET_CLEAN, libperf)
724	$(Q)$(RM) -r -- $(LIBPERF_OUTPUT)
725
726$(LIBSUBCMD): FORCE | $(LIBSUBCMD_OUTPUT)
727	$(Q)$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \
728		DESTDIR=$(LIBSUBCMD_DESTDIR) prefix= subdir= \
729		$@ install_headers
730
731$(LIBSUBCMD)-clean:
732	$(call QUIET_CLEAN, libsubcmd)
733	$(Q)$(RM) -r -- $(LIBSUBCMD_OUTPUT)
734
735$(LIBSYMBOL): FORCE | $(LIBSYMBOL_OUTPUT)
736	$(Q)$(MAKE) -C $(LIBSYMBOL_DIR) O=$(LIBSYMBOL_OUTPUT) \
737		DESTDIR=$(LIBSYMBOL_DESTDIR) prefix= subdir= \
738		$@ install_headers
739
740$(LIBSYMBOL)-clean:
741	$(call QUIET_CLEAN, libsymbol)
742	$(Q)$(RM) -r -- $(LIBSYMBOL_OUTPUT)
743
744help:
745	@echo 'Perf make targets:'
746	@echo '  doc		- make *all* documentation (see below)'
747	@echo '  man		- make manpage documentation (access with man <foo>)'
748	@echo '  html		- make html documentation'
749	@echo '  info		- make GNU info documentation (access with info <foo>)'
750	@echo '  pdf		- make pdf documentation'
751	@echo '  TAGS		- use etags to make tag information for source browsing'
752	@echo '  tags		- use ctags to make tag information for source browsing'
753	@echo '  cscope	- use cscope to make interactive browsing database'
754	@echo ''
755	@echo 'Perf install targets:'
756	@echo '  NOTE: documentation build requires asciidoc, xmlto packages to be installed'
757	@echo '  HINT: use "prefix" or "DESTDIR" to install to a particular'
758	@echo '        path like "make prefix=/usr/local install install-doc"'
759	@echo '  install	- install compiled binaries'
760	@echo '  install-doc	- install *all* documentation'
761	@echo '  install-man	- install manpage documentation'
762	@echo '  install-html	- install html documentation'
763	@echo '  install-info	- install GNU info documentation'
764	@echo '  install-pdf	- install pdf documentation'
765	@echo ''
766	@echo '  quick-install-doc	- alias for quick-install-man'
767	@echo '  quick-install-man	- install the documentation quickly'
768	@echo '  quick-install-html	- install the html documentation quickly'
769	@echo ''
770	@echo 'Perf maintainer targets:'
771	@echo '  clean			- clean all binary objects and build output'
772
773
774DOC_TARGETS := doc man html info pdf
775
776INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
777INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
778
779# 'make doc' should call 'make -C Documentation all'
780$(DOC_TARGETS):
781	$(Q)$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) $(@:doc=all) ASCIIDOC_EXTRA=$(ASCIIDOC_EXTRA)
782
783TAG_FOLDERS= . ../lib ../include
784TAG_FILES= ../../include/uapi/linux/perf_event.h
785
786TAGS:
787	$(QUIET_GEN)$(RM) TAGS; \
788	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print -o -name '*.cpp' -print | xargs etags -a $(TAG_FILES)
789
790tags:
791	$(QUIET_GEN)$(RM) tags; \
792	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print -o -name '*.cpp' -print | xargs ctags -a $(TAG_FILES)
793
794cscope:
795	$(QUIET_GEN)$(RM) cscope*; \
796	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print -o -name '*.cpp' -print | xargs cscope -b $(TAG_FILES)
797
798### Testing rules
799
800# GNU make supports exporting all variables by "export" without parameters.
801# However, the environment gets quite big, and some programs have problems
802# with that.
803
804check: prepare
805	if sparse; \
806	then \
807		for i in *.c */*.c; \
808		do \
809			sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
810		done; \
811	else \
812		exit 1; \
813	fi
814
815### Installation rules
816
817ifdef GTK2
818install-gtk: $(OUTPUT)libperf-gtk.so
819	$(call QUIET_INSTALL, 'GTK UI') \
820		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
821		$(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)'
822else
823install-gtk:
824endif
825
826install-tools: all install-gtk
827	$(call QUIET_INSTALL, binaries) \
828		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'; \
829		$(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'; \
830		$(LN) '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'; \
831		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(includedir_SQ)/perf'; \
832		$(INSTALL) -m 644 include/perf/perf_dlfilter.h -t '$(DESTDIR_SQ)$(includedir_SQ)/perf'
833ifndef NO_PERF_READ_VDSO32
834	$(call QUIET_INSTALL, perf-read-vdso32) \
835		$(INSTALL) $(OUTPUT)perf-read-vdso32 '$(DESTDIR_SQ)$(bindir_SQ)';
836endif
837ifndef NO_PERF_READ_VDSOX32
838	$(call QUIET_INSTALL, perf-read-vdsox32) \
839		$(INSTALL) $(OUTPUT)perf-read-vdsox32 '$(DESTDIR_SQ)$(bindir_SQ)';
840endif
841ifndef NO_JVMTI
842	$(call QUIET_INSTALL, $(LIBJVMTI)) \
843		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
844		$(INSTALL) $(OUTPUT)$(LIBJVMTI) '$(DESTDIR_SQ)$(libdir_SQ)';
845endif
846	$(call QUIET_INSTALL, libexec) \
847		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
848	$(call QUIET_INSTALL, perf-archive) \
849		$(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
850	$(call QUIET_INSTALL, perf-iostat) \
851		$(INSTALL) $(OUTPUT)perf-iostat -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
852ifdef LIBPERL
853	$(call QUIET_INSTALL, perl-scripts) \
854		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \
855		$(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'; \
856		$(INSTALL) scripts/perl/*.pl -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'; \
857		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'; \
858		$(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
859endif
860ifndef NO_LIBPYTHON
861	$(call QUIET_INSTALL, python-scripts) \
862		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \
863		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'; \
864		$(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'; \
865		$(INSTALL) scripts/python/*.py -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'; \
866		$(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
867endif
868	$(call QUIET_INSTALL, dlfilters) \
869		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/dlfilters'; \
870		$(INSTALL) $(DLFILTERS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/dlfilters';
871	$(call QUIET_INSTALL, perf_completion-script) \
872		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'; \
873		$(INSTALL) perf-completion.sh -m 644 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
874	$(call QUIET_INSTALL, perf-tip) \
875		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(tip_instdir_SQ)'; \
876		$(INSTALL) Documentation/tips.txt -m 644 -t '$(DESTDIR_SQ)$(tip_instdir_SQ)'
877
878install-tests: all install-gtk
879	$(call QUIET_INSTALL, tests) \
880		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
881		$(INSTALL) tests/pe-file.exe* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
882		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
883		$(INSTALL) tests/shell/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
884		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/attr'; \
885		$(INSTALL) tests/shell/attr/* -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/attr'; \
886		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
887		$(INSTALL) tests/shell/lib/*.sh -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
888		$(INSTALL) tests/shell/lib/*.py -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
889		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/common'; \
890		$(INSTALL) tests/shell/common/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/common'; \
891		$(INSTALL) tests/shell/common/*.pl '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/common'; \
892		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_probe'; \
893		$(INSTALL) tests/shell/base_probe/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_probe'; \
894		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_report'; \
895		$(INSTALL) tests/shell/base_report/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_report'; \
896		$(INSTALL) tests/shell/base_report/*.txt '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_report'; \
897		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight' ; \
898		$(INSTALL) tests/shell/coresight/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight'
899	$(Q)$(MAKE) -C tests/shell/coresight install-tests
900
901install-bin: install-tools install-tests
902
903install: install-bin try-install-man
904
905install-python_ext:
906	$(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
907
908# 'make install-doc' should call 'make -C Documentation install'
909$(INSTALL_DOC_TARGETS):
910	$(Q)$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) $(@:-doc=) ASCIIDOC_EXTRA=$(ASCIIDOC_EXTRA) subdir=
911
912### Cleaning rules
913
914python-clean:
915	$(python-clean)
916
917$(LIBAPI_OUTPUT) $(LIBBPF_OUTPUT) $(LIBPERF_OUTPUT) $(LIBSUBCMD_OUTPUT) $(LIBSYMBOL_OUTPUT):
918	$(Q)$(MKDIR) -p $@
919
920bpf-skel-clean:
921	$(Q)$(MAKE) -f bpf_skel.mak clean
922
923pmu-events-clean:
924ifeq ($(OUTPUT),)
925	$(call QUIET_CLEAN, pmu-events) $(RM) \
926		pmu-events/pmu-events*.c \
927		pmu-events/metric_test.log \
928		pmu-events/test-empty-pmu-events.c \
929		pmu-events/empty-pmu-events.log
930	$(Q)find pmu-events/arch -name 'extra-metrics.json' -delete -o \
931		-name 'extra-metricgroups.json' -delete
932else # When an OUTPUT directory is present, clean up the copied pmu-events/arch directory.
933	$(call QUIET_CLEAN, pmu-events) $(RM) -r $(OUTPUT)pmu-events/arch \
934		$(OUTPUT)pmu-events/pmu-events*.c \
935		$(OUTPUT)pmu-events/metric_test.log \
936		$(OUTPUT)pmu-events/test-empty-pmu-events.c \
937		$(OUTPUT)pmu-events/empty-pmu-events.log
938endif
939
940clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean \
941		arm64-sysreg-defs-clean fixdep-clean python-clean bpf-skel-clean \
942		tests-coresight-targets-clean pmu-events-clean
943	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive \
944		$(OUTPUT)perf-iostat $(LANG_BINDINGS)
945	$(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '*.a' -delete -o \
946		-name '\.*.cmd' -delete -o -name '\.*.d' -delete -o -name '*.shellcheck_log' -delete
947	$(Q)$(RM) $(OUTPUT).config-detected
948	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 \
949		perf-read-vdsox32 $(OUTPUT)$(LIBJVMTI).so
950	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo \
951		TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE \
952		$(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
953		$(OUTPUT)util/intel-pt-decoder/inat-tables.c \
954		$(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c
955	$(Q)$(RM) -r $(OUTPUT)trace/beauty/generated
956	$(call QUIET_CLEAN, Documentation) \
957	$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) clean >/dev/null
958
959#
960# To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY)
961# file if defined, with no further action.
962feature-dump:
963ifdef FEATURE_DUMP_COPY
964	@cp $(OUTPUT)FEATURE-DUMP $(FEATURE_DUMP_COPY)
965	@echo "FEATURE-DUMP file copied into $(FEATURE_DUMP_COPY)"
966else
967	@echo "FEATURE-DUMP file available in $(OUTPUT)FEATURE-DUMP"
968endif
969
970
971FORCE:
972
973.PHONY: all install clean config-clean strip install-gtk
974.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
975.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope FORCE prepare bpf-skel-prepare
976.PHONY: python_perf_target
977
978endif # force_fixdep
979
980# Delete partially updated (corrupted) files on error
981.DELETE_ON_ERROR:
982