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