xref: /linux/tools/perf/Makefile.perf (revision 904708945c07b2b27558b6ffe8923b3df99448f4)
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
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
404ifneq ($(quiet),)
405python_setup_quiet=--quiet
406endif
407
408# Use the detected configuration
409-include $(OUTPUT).config-detected
410
411SCRIPTS = $(addprefix $(OUTPUT),$(patsubst %.sh,%,$(SCRIPT_SH)))
412
413PROGRAMS += $(OUTPUT)perf
414
415ifndef NO_PERF_READ_VDSO32
416PROGRAMS += $(OUTPUT)perf-read-vdso32
417endif
418
419ifndef NO_PERF_READ_VDSOX32
420PROGRAMS += $(OUTPUT)perf-read-vdsox32
421endif
422
423LIBJVMTI = libperf-jvmti.so
424
425ifndef NO_JVMTI
426PROGRAMS += $(OUTPUT)$(LIBJVMTI)
427endif
428
429DLFILTERS := dlfilter-test-api-v0.so dlfilter-test-api-v2.so dlfilter-show-cycles.so
430DLFILTERS := $(patsubst %,$(OUTPUT)dlfilters/%,$(DLFILTERS))
431
432# what 'all' will build and 'install' will install, in perfexecdir
433ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) $(DLFILTERS)
434
435# what 'all' will build but not install in perfexecdir
436OTHER_PROGRAMS = $(OUTPUT)perf
437
438# Set paths to tools early so that they can be used for version tests.
439ifndef SHELL_PATH
440  SHELL_PATH = /bin/sh
441endif
442ifndef PERL_PATH
443  PERL_PATH = /usr/bin/perl
444endif
445
446export PERL_PATH
447
448LIBPERF_BENCH_IN := $(OUTPUT)perf-bench-in.o
449LIBPERF_BENCH := $(OUTPUT)libperf-bench.a
450
451LIBPERF_TEST_IN := $(OUTPUT)perf-test-in.o
452LIBPERF_TEST := $(OUTPUT)libperf-test.a
453
454LIBPERF_UI_IN := $(OUTPUT)perf-ui-in.o
455LIBPERF_UI := $(OUTPUT)libperf-ui.a
456
457LIBPERF_UTIL_IN := $(OUTPUT)perf-util-in.o
458LIBPERF_UTIL := $(OUTPUT)libperf-util.a
459
460LIBPMU_EVENTS_IN := $(OUTPUT)pmu-events/pmu-events-in.o
461LIBPMU_EVENTS := $(OUTPUT)libpmu-events.a
462
463PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL)
464ifdef LIBBPF_STATIC
465  PERFLIBS += $(LIBBPF)
466endif
467PERFLIBS += $(LIBPERF_BENCH) $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPERF_UTIL)
468PERFLIBS += $(LIBPMU_EVENTS)
469
470# We choose to avoid "if .. else if .. else .. endif endif"
471# because maintaining the nesting to match is a pain.  If
472# we had "elif" things would have been much nicer...
473
474ifneq ($(OUTPUT),)
475  CFLAGS += -I$(OUTPUT)
476endif
477
478ifdef GTK2
479  ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so
480  GTK_IN := $(OUTPUT)gtk-in.o
481endif
482
483ifdef ASCIIDOC8
484  export ASCIIDOC8
485endif
486
487EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS))
488LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
489
490PERFLIBS_PY := $(call filter-out,$(LIBPERF_BENCH) $(LIBPERF_TEST),$(PERFLIBS))
491LIBS_PY = -Wl,--whole-archive $(PERFLIBS_PY) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
492
493export INSTALL SHELL_PATH
494
495### Build rules
496
497SHELL = $(SHELL_PATH)
498
499arm64_gen_sysreg_dir := $(srctree)/tools/arch/arm64/tools
500ifneq ($(OUTPUT),)
501  arm64_gen_sysreg_outdir := $(abspath $(OUTPUT))
502else
503  arm64_gen_sysreg_outdir := $(CURDIR)
504endif
505
506arm64-sysreg-defs: FORCE
507	$(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir) \
508		prefix= subdir=
509
510arm64-sysreg-defs-clean:
511	$(call QUIET_CLEAN,arm64-sysreg-defs)
512	$(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir) \
513		prefix= subdir= clean > /dev/null
514
515all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
516
517# Create python binding output directory if not already present
518$(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python')
519
520$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): util/python.c util/setup.py $(PERFLIBS_PY)
521	$(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
522        CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBS_PY)' \
523	  $(PYTHON_WORD) util/setup.py \
524	  $(python_setup_quiet) build_ext; \
525	cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/
526
527python_perf_target:
528	@echo "Target is: $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX)"
529
530please_set_SHELL_PATH_to_a_more_modern_shell:
531	$(Q)$$(:)
532
533shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
534
535strip: $(PROGRAMS) $(OUTPUT)perf
536	$(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
537
538PERF_IN := $(OUTPUT)perf-in.o
539export NO_JEVENTS
540
541build := -f $(srctree)/tools/build/Makefile.build dir=. obj
542
543$(PERF_IN): prepare FORCE
544	$(Q)$(MAKE) $(build)=perf
545
546$(LIBPMU_EVENTS_IN): FORCE $(LIBPERF)
547	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=pmu-events obj=pmu-events
548
549$(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN)
550	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
551
552# The $(LIBPERF_UTIL) dependency is to ensure bpftool and vmlinux.h
553# aren't racily built for bench/bpf_skel/bench_uprobe.bpf.c
554$(LIBPERF_BENCH_IN): FORCE prepare $(LIBSYMBOL) | $(LIBPERF_UTIL)
555	$(Q)$(MAKE) $(build)=perf-bench
556
557$(LIBPERF_BENCH): $(LIBPERF_BENCH_IN)
558	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
559
560$(LIBPERF_TEST_IN): FORCE prepare
561	$(Q)$(MAKE) $(build)=perf-test
562
563$(LIBPERF_TEST): $(LIBPERF_TEST_IN)
564	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
565
566$(LIBPERF_UI_IN): FORCE prepare
567	$(Q)$(MAKE) $(build)=perf-ui
568
569$(LIBPERF_UI): $(LIBPERF_UI_IN)
570	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
571
572$(LIBPERF_UTIL_IN): FORCE prepare $(LIBSYMBOL)
573	$(Q)$(MAKE) $(build)=perf-util
574
575$(LIBPERF_UTIL): $(LIBPERF_UTIL_IN)
576	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
577
578$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN)
579	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \
580		$(PERF_IN) $(LIBS) -o $@
581
582$(GTK_IN): FORCE prepare
583	$(Q)$(MAKE) $(build)=gtk
584
585$(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS)
586	$(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
587
588$(SCRIPTS) : $(OUTPUT)% : %.sh
589	$(QUIET_GEN)$(INSTALL) '$<' '$@'
590
591$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
592	$(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
593
594# These can record PERF_VERSION
595perf.spec $(SCRIPTS) \
596	: $(OUTPUT)PERF-VERSION-FILE
597
598.SUFFIXES:
599
600#
601# If a target does not match any of the later rules then prefix it by $(OUTPUT)
602# This makes targets like 'make O=/tmp/perf perf.o' work in a natural way.
603#
604ifneq ($(OUTPUT),)
605%.o: $(OUTPUT)%.o
606	@echo "    # Redirected target $@ => $(OUTPUT)$@"
607pmu-events/%.o: $(OUTPUT)pmu-events/%.o
608	@echo "    # Redirected target $@ => $(OUTPUT)$@"
609util/%.o: $(OUTPUT)util/%.o
610	@echo "    # Redirected target $@ => $(OUTPUT)$@"
611bench/%.o: $(OUTPUT)bench/%.o
612	@echo "    # Redirected target $@ => $(OUTPUT)$@"
613tests/%.o: $(OUTPUT)tests/%.o
614	@echo "    # Redirected target $@ => $(OUTPUT)$@"
615endif
616
617# These two need to be here so that when O= is not used they take precedence
618# over the general rule for .o
619
620# get relative building directory (to $(OUTPUT))
621# and '.' if it's $(OUTPUT) itself
622__build-dir = $(subst $(OUTPUT),,$(dir $@))
623build-dir   = $(or $(__build-dir),.)
624
625bpf-skel-prepare:
626	$(Q)$(MAKE) -f bpf_skel.mak bpf-skel-prepare
627
628prepare: $(OUTPUT)PERF-VERSION-FILE \
629	arm64-sysreg-defs \
630	bpf-skel-prepare \
631	$(LIBAPI) \
632	$(LIBPERF) \
633	$(LIBSUBCMD)
634
635ifdef LIBBPF_STATIC
636prepare: $(LIBBPF)
637endif
638
639$(OUTPUT)%.o: %.c prepare FORCE
640	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
641
642$(OUTPUT)%.i: %.c prepare FORCE
643	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
644
645$(OUTPUT)%.s: %.c prepare FORCE
646	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
647
648$(OUTPUT)%-bison.o: %.c prepare FORCE
649	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
650
651$(OUTPUT)%-flex.o: %.c prepare FORCE
652	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
653
654$(OUTPUT)%.o: %.S prepare FORCE
655	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
656
657$(OUTPUT)%.i: %.S prepare FORCE
658	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
659
660$(OUTPUT)perf-%: %.o $(PERFLIBS)
661	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
662
663ifndef NO_PERF_READ_VDSO32
664$(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-map.c
665	$(QUIET_CC)$(CC) -m32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
666endif
667
668ifndef NO_PERF_READ_VDSOX32
669$(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-map.c
670	$(QUIET_CC)$(CC) -mx32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
671endif
672
673$(OUTPUT)dlfilters/%.o: dlfilters/%.c include/perf/perf_dlfilter.h
674	$(Q)$(MKDIR) -p $(OUTPUT)dlfilters
675	$(QUIET_CC)$(CC) -c -Iinclude $(EXTRA_CFLAGS) -o $@ -fpic $<
676
677.SECONDARY: $(DLFILTERS:.so=.o)
678
679$(OUTPUT)dlfilters/%.so: $(OUTPUT)dlfilters/%.o
680	$(QUIET_LINK)$(CC) $(EXTRA_CFLAGS) -shared -o $@ $<
681
682ifndef NO_JVMTI
683LIBJVMTI_IN := $(OUTPUT)jvmti/jvmti-in.o
684
685$(LIBJVMTI_IN): prepare FORCE
686	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
687
688$(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
689	$(QUIET_LINK)$(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
690endif
691
692$(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
693
694$(LIBAPI): FORCE | $(LIBAPI_OUTPUT)
695	$(Q)$(MAKE) -C $(LIBAPI_DIR) O=$(LIBAPI_OUTPUT) \
696		DESTDIR=$(LIBAPI_DESTDIR) prefix= subdir= \
697		$@ install_headers
698
699$(LIBAPI)-clean:
700	$(call QUIET_CLEAN, libapi)
701	$(Q)$(RM) -r -- $(LIBAPI_OUTPUT)
702
703$(LIBBPF): FORCE | $(LIBBPF_OUTPUT)
704	$(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \
705		O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= subdir= \
706		EXTRA_CFLAGS="-fPIC" $@ install_headers
707
708$(LIBBPF)-clean:
709	$(call QUIET_CLEAN, libbpf)
710	$(Q)$(RM) -r -- $(LIBBPF_OUTPUT)
711
712$(LIBPERF): FORCE | $(LIBPERF_OUTPUT)
713	$(Q)$(MAKE) -C $(LIBPERF_DIR) O=$(LIBPERF_OUTPUT) \
714		DESTDIR=$(LIBPERF_DESTDIR) prefix= subdir= \
715		$@ install_headers
716
717$(LIBPERF)-clean:
718	$(call QUIET_CLEAN, libperf)
719	$(Q)$(RM) -r -- $(LIBPERF_OUTPUT)
720
721$(LIBSUBCMD): FORCE | $(LIBSUBCMD_OUTPUT)
722	$(Q)$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \
723		DESTDIR=$(LIBSUBCMD_DESTDIR) prefix= subdir= \
724		$@ install_headers
725
726$(LIBSUBCMD)-clean:
727	$(call QUIET_CLEAN, libsubcmd)
728	$(Q)$(RM) -r -- $(LIBSUBCMD_OUTPUT)
729
730$(LIBSYMBOL): FORCE | $(LIBSYMBOL_OUTPUT)
731	$(Q)$(MAKE) -C $(LIBSYMBOL_DIR) O=$(LIBSYMBOL_OUTPUT) \
732		DESTDIR=$(LIBSYMBOL_DESTDIR) prefix= subdir= \
733		$@ install_headers
734
735$(LIBSYMBOL)-clean:
736	$(call QUIET_CLEAN, libsymbol)
737	$(Q)$(RM) -r -- $(LIBSYMBOL_OUTPUT)
738
739help:
740	@echo 'Perf make targets:'
741	@echo '  doc		- make *all* documentation (see below)'
742	@echo '  man		- make manpage documentation (access with man <foo>)'
743	@echo '  html		- make html documentation'
744	@echo '  info		- make GNU info documentation (access with info <foo>)'
745	@echo '  pdf		- make pdf documentation'
746	@echo '  TAGS		- use etags to make tag information for source browsing'
747	@echo '  tags		- use ctags to make tag information for source browsing'
748	@echo '  cscope	- use cscope to make interactive browsing database'
749	@echo ''
750	@echo 'Perf install targets:'
751	@echo '  NOTE: documentation build requires asciidoc, xmlto packages to be installed'
752	@echo '  HINT: use "prefix" or "DESTDIR" to install to a particular'
753	@echo '        path like "make prefix=/usr/local install install-doc"'
754	@echo '  install	- install compiled binaries'
755	@echo '  install-doc	- install *all* documentation'
756	@echo '  install-man	- install manpage documentation'
757	@echo '  install-html	- install html documentation'
758	@echo '  install-info	- install GNU info documentation'
759	@echo '  install-pdf	- install pdf documentation'
760	@echo ''
761	@echo '  quick-install-doc	- alias for quick-install-man'
762	@echo '  quick-install-man	- install the documentation quickly'
763	@echo '  quick-install-html	- install the html documentation quickly'
764	@echo ''
765	@echo 'Perf maintainer targets:'
766	@echo '  clean			- clean all binary objects and build output'
767
768
769DOC_TARGETS := doc man html info pdf
770
771INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
772INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
773
774# 'make doc' should call 'make -C Documentation all'
775$(DOC_TARGETS):
776	$(Q)$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) $(@:doc=all) ASCIIDOC_EXTRA=$(ASCIIDOC_EXTRA)
777
778TAG_FOLDERS= . ../lib ../include
779TAG_FILES= ../../include/uapi/linux/perf_event.h
780
781TAGS:
782	$(QUIET_GEN)$(RM) TAGS; \
783	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print -o -name '*.cpp' -print | xargs etags -a $(TAG_FILES)
784
785tags:
786	$(QUIET_GEN)$(RM) tags; \
787	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print -o -name '*.cpp' -print | xargs ctags -a $(TAG_FILES)
788
789cscope:
790	$(QUIET_GEN)$(RM) cscope*; \
791	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print -o -name '*.cpp' -print | xargs cscope -b $(TAG_FILES)
792
793### Testing rules
794
795# GNU make supports exporting all variables by "export" without parameters.
796# However, the environment gets quite big, and some programs have problems
797# with that.
798
799check: prepare
800	if sparse; \
801	then \
802		for i in *.c */*.c; \
803		do \
804			sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
805		done; \
806	else \
807		exit 1; \
808	fi
809
810### Installation rules
811
812ifdef GTK2
813install-gtk: $(OUTPUT)libperf-gtk.so
814	$(call QUIET_INSTALL, 'GTK UI') \
815		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
816		$(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)'
817else
818install-gtk:
819endif
820
821install-tools: all install-gtk
822	$(call QUIET_INSTALL, binaries) \
823		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'; \
824		$(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'; \
825		$(LN) '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'; \
826		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(includedir_SQ)/perf'; \
827		$(INSTALL) -m 644 include/perf/perf_dlfilter.h -t '$(DESTDIR_SQ)$(includedir_SQ)/perf'
828ifndef NO_PERF_READ_VDSO32
829	$(call QUIET_INSTALL, perf-read-vdso32) \
830		$(INSTALL) $(OUTPUT)perf-read-vdso32 '$(DESTDIR_SQ)$(bindir_SQ)';
831endif
832ifndef NO_PERF_READ_VDSOX32
833	$(call QUIET_INSTALL, perf-read-vdsox32) \
834		$(INSTALL) $(OUTPUT)perf-read-vdsox32 '$(DESTDIR_SQ)$(bindir_SQ)';
835endif
836ifndef NO_JVMTI
837	$(call QUIET_INSTALL, $(LIBJVMTI)) \
838		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
839		$(INSTALL) $(OUTPUT)$(LIBJVMTI) '$(DESTDIR_SQ)$(libdir_SQ)';
840endif
841	$(call QUIET_INSTALL, libexec) \
842		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
843	$(call QUIET_INSTALL, perf-archive) \
844		$(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
845	$(call QUIET_INSTALL, perf-iostat) \
846		$(INSTALL) $(OUTPUT)perf-iostat -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
847ifdef LIBPERL
848	$(call QUIET_INSTALL, perl-scripts) \
849		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \
850		$(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'; \
851		$(INSTALL) scripts/perl/*.pl -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'; \
852		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'; \
853		$(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
854endif
855ifndef NO_LIBPYTHON
856	$(call QUIET_INSTALL, python-scripts) \
857		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \
858		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'; \
859		$(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'; \
860		$(INSTALL) scripts/python/*.py -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'; \
861		$(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
862endif
863	$(call QUIET_INSTALL, dlfilters) \
864		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/dlfilters'; \
865		$(INSTALL) $(DLFILTERS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/dlfilters';
866	$(call QUIET_INSTALL, perf_completion-script) \
867		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'; \
868		$(INSTALL) perf-completion.sh -m 644 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
869	$(call QUIET_INSTALL, perf-tip) \
870		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(tip_instdir_SQ)'; \
871		$(INSTALL) Documentation/tips.txt -m 644 -t '$(DESTDIR_SQ)$(tip_instdir_SQ)'
872
873install-tests: all install-gtk
874	$(call QUIET_INSTALL, tests) \
875		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
876		$(INSTALL) tests/pe-file.exe* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
877		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
878		$(INSTALL) tests/shell/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
879		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/attr'; \
880		$(INSTALL) tests/shell/attr/* -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/attr'; \
881		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
882		$(INSTALL) tests/shell/lib/*.sh -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
883		$(INSTALL) tests/shell/lib/*.py -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
884		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/common'; \
885		$(INSTALL) tests/shell/common/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/common'; \
886		$(INSTALL) tests/shell/common/*.pl '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/common'; \
887		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_probe'; \
888		$(INSTALL) tests/shell/base_probe/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_probe'; \
889		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_report'; \
890		$(INSTALL) tests/shell/base_report/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_report'; \
891		$(INSTALL) tests/shell/base_report/*.txt '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_report'; \
892		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight' ; \
893		$(INSTALL) tests/shell/coresight/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight'
894
895install-bin: install-tools install-tests
896
897install: install-bin try-install-man
898
899install-python_ext:
900	$(PYTHON_WORD) util/setup.py $(python_setup_quiet) install --root='/$(DESTDIR_SQ)'
901
902# 'make install-doc' should call 'make -C Documentation install'
903$(INSTALL_DOC_TARGETS):
904	$(Q)$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) $(@:-doc=) ASCIIDOC_EXTRA=$(ASCIIDOC_EXTRA) subdir=
905
906### Cleaning rules
907
908python-clean:
909	$(python-clean)
910
911$(LIBAPI_OUTPUT) $(LIBBPF_OUTPUT) $(LIBPERF_OUTPUT) $(LIBSUBCMD_OUTPUT) $(LIBSYMBOL_OUTPUT):
912	$(Q)$(MKDIR) -p $@
913
914bpf-skel-clean:
915	$(Q)$(MAKE) -f bpf_skel.mak clean
916
917pmu-events-clean:
918ifeq ($(OUTPUT),)
919	$(call QUIET_CLEAN, pmu-events) $(RM) \
920		pmu-events/pmu-events*.c \
921		pmu-events/metric_test.log \
922		pmu-events/test-empty-pmu-events.c \
923		pmu-events/empty-pmu-events.log
924	$(Q)find pmu-events/arch -name 'extra-metrics.json' -delete -o \
925		-name 'extra-metricgroups.json' -delete
926else # When an OUTPUT directory is present, clean up the copied pmu-events/arch directory.
927	$(call QUIET_CLEAN, pmu-events) $(RM) -r $(OUTPUT)pmu-events/arch \
928		$(OUTPUT)pmu-events/pmu-events*.c \
929		$(OUTPUT)pmu-events/metric_test.log \
930		$(OUTPUT)pmu-events/test-empty-pmu-events.c \
931		$(OUTPUT)pmu-events/empty-pmu-events.log
932endif
933
934clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean \
935		arm64-sysreg-defs-clean fixdep-clean python-clean bpf-skel-clean \
936		pmu-events-clean
937	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive \
938		$(OUTPUT)perf-iostat $(LANG_BINDINGS)
939	$(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '*.a' -delete -o \
940		-name '\.*.cmd' -delete -o -name '\.*.d' -delete -o -name '*.shellcheck_log' -delete
941	$(Q)$(RM) $(OUTPUT).config-detected
942	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 \
943		perf-read-vdsox32 $(OUTPUT)$(LIBJVMTI).so
944	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo \
945		TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE \
946		$(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
947		$(OUTPUT)util/intel-pt-decoder/inat-tables.c \
948		$(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c
949	$(Q)$(RM) -r $(OUTPUT)trace/beauty/generated
950	$(call QUIET_CLEAN, Documentation) \
951	$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) clean >/dev/null
952
953#
954# To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY)
955# file if defined, with no further action.
956feature-dump:
957ifdef FEATURE_DUMP_COPY
958	@cp $(OUTPUT)FEATURE-DUMP $(FEATURE_DUMP_COPY)
959	@echo "FEATURE-DUMP file copied into $(FEATURE_DUMP_COPY)"
960else
961	@echo "FEATURE-DUMP file available in $(OUTPUT)FEATURE-DUMP"
962endif
963
964
965FORCE:
966
967.PHONY: all install clean config-clean strip install-gtk
968.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
969.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope FORCE prepare bpf-skel-prepare
970.PHONY: python_perf_target
971
972endif # force_fixdep
973
974# Delete partially updated (corrupted) files on error
975.DELETE_ON_ERROR:
976