xref: /linux/tools/perf/Makefile.perf (revision a06c3fad49a50d5d5eb078f93e70f4d3eca5d5a5)
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 NO_LIBPERL to disable 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 EXCLUDE_EXTLIBS=-lmylib to exclude libmylib from the auto-generated
39# EXTLIBS.
40#
41# Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS.
42#
43# Define NO_DWARF if you do not want debug-info analysis feature at all.
44#
45# Define WERROR=0 to disable treating any warnings as errors.
46#
47# Define NO_SLANG if you do not want TUI support.
48#
49# Define GTK2 if you want GTK+ GUI support.
50#
51# Define NO_DEMANGLE if you do not want C++ symbol demangling.
52#
53# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
54#
55# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
56# backtrace post unwind.
57#
58# Define NO_BACKTRACE if you do not want stack backtrace debug feature
59#
60# Define NO_LIBNUMA if you do not want numa perf benchmark
61#
62# Define NO_LIBAUDIT if you do not want libaudit support
63#
64# Define NO_LIBBIONIC if you do not want bionic support
65#
66# Define NO_LIBCRYPTO if you do not want libcrypto (openssl) support
67# used for generating build-ids for ELFs generated by jitdump.
68#
69# Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
70# for dwarf backtrace post unwind.
71#
72# Define NO_LIBTRACEEVENT=1 if you don't want libtraceevent to be linked,
73# this will remove multiple features and tools, such as 'perf trace',
74# that need it to read tracefs event format files, etc.
75#
76# Define NO_PERF_READ_VDSO32 if you do not want to build perf-read-vdso32
77# for reading the 32-bit compatibility VDSO in 64-bit mode
78#
79# Define NO_PERF_READ_VDSOX32 if you do not want to build perf-read-vdsox32
80# for reading the x32 mode 32-bit compatibility VDSO in 64-bit mode
81#
82# Define NO_ZLIB if you do not want to support compressed kernel modules
83#
84# Define NO_LIBBABELTRACE if you do not want libbabeltrace support
85# for CTF data format.
86#
87# Define NO_CAPSTONE if you do not want libcapstone support
88# for disasm engine.
89#
90# Define NO_LZMA if you do not want to support compressed (xz) kernel modules
91#
92# Define NO_AUXTRACE if you do not want AUX area tracing support
93#
94# Define NO_LIBBPF if you do not want BPF support
95#
96# Define NO_LIBCAP if you do not want process capabilities considered by perf
97#
98# Define NO_SDT if you do not want to define SDT event in perf tools,
99# note that it doesn't disable SDT scanning support.
100#
101# Define FEATURES_DUMP to provide features detection dump file
102# and bypass the feature detection
103#
104# Define NO_JVMTI if you do not want jvmti agent built
105#
106# Define NO_JVMTI_CMLR (debug only) if you do not want to process CMLR
107# data for java source lines.
108#
109# Define CORESIGHT if you DO WANT support for CoreSight trace decoding.
110#
111# Define NO_AIO if you do not want support of Posix AIO based trace
112# streaming for record mode. Currently Posix AIO trace streaming is
113# supported only when linking with glibc.
114#
115# Define NO_LIBZSTD if you do not want support of Zstandard based runtime
116# trace compression in record mode.
117#
118# Define TCMALLOC to enable tcmalloc heap profiling.
119#
120# Define LIBBPF_DYNAMIC to enable libbpf dynamic linking.
121#
122# Define NO_SYSCALL_TABLE=1 to disable the use of syscall id to/from name tables
123# generated from the kernel .tbl or unistd.h files and use, if available, libaudit
124# for doing the conversions to/from strings/id.
125#
126# Define NO_LIBPFM4 to disable libpfm4 events extension.
127#
128# Define NO_LIBDEBUGINFOD if you do not want support debuginfod
129#
130# Set BUILD_BPF_SKEL to 0 to override BUILD_BPF_SKEL and not build BPF skeletons
131#
132# Define BUILD_NONDISTRO to enable building an linking against libbfd and
133# libiberty distribution license incompatible libraries.
134#
135# Define EXTRA_TESTS to enable building extra tests useful mainly to perf
136# developers, such as:
137#	x86 instruction decoder - new instructions test
138#
139# Define GEN_VMLINUX_H to generate vmlinux.h from the BTF.
140#
141# Define NO_SHELLCHECK if you do not want to run shellcheck during build
142
143# As per kernel Makefile, avoid funny character set dependencies
144unexport LC_ALL
145LC_COLLATE=C
146LC_NUMERIC=C
147export LC_COLLATE LC_NUMERIC
148
149ifeq ($(srctree),)
150srctree := $(patsubst %/,%,$(dir $(CURDIR)))
151srctree := $(patsubst %/,%,$(dir $(srctree)))
152#$(info Determined 'srctree' to be $(srctree))
153endif
154
155ifneq ($(objtree),)
156#$(info Determined 'objtree' to be $(objtree))
157endif
158
159ifneq ($(OUTPUT),)
160#$(info Determined 'OUTPUT' to be $(OUTPUT))
161# Adding $(OUTPUT) as a directory to look for source files,
162# because use generated output files as sources dependency
163# for flex/bison parsers.
164VPATH += $(OUTPUT)
165export VPATH
166endif
167
168ifeq ($(V),1)
169  Q =
170else
171  Q = @
172endif
173
174# Do not use make's built-in rules
175# (this improves performance and avoids hard-to-debug behaviour);
176MAKEFLAGS += -r
177
178# Makefiles suck: This macro sets a default value of $(2) for the
179# variable named by $(1), unless the variable has been set by
180# environment or command line. This is necessary for CC and AR
181# because make sets default values, so the simpler ?= approach
182# won't work as expected.
183define allow-override
184  $(if $(or $(findstring environment,$(origin $(1))),\
185            $(findstring command line,$(origin $(1)))),,\
186    $(eval $(1) = $(2)))
187endef
188
189LD += $(EXTRA_LDFLAGS)
190
191HOSTCC  ?= gcc
192HOSTLD  ?= ld
193HOSTAR  ?= ar
194CLANG   ?= clang
195
196# Some distros provide the command $(CROSS_COMPILE)pkg-config for
197# searching packges installed with Multiarch. Use it for cross
198# compilation if it is existed.
199ifneq (, $(shell which $(CROSS_COMPILE)pkg-config))
200  PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
201else
202  PKG_CONFIG ?= pkg-config
203
204  # PKG_CONFIG_PATH or PKG_CONFIG_LIBDIR, alongside PKG_CONFIG_SYSROOT_DIR
205  # for modified system root, is required for the cross compilation.
206  # If these PKG_CONFIG environment variables are not set, Multiarch library
207  # paths are used instead.
208  ifdef CROSS_COMPILE
209    ifeq ($(PKG_CONFIG_LIBDIR)$(PKG_CONFIG_PATH)$(PKG_CONFIG_SYSROOT_DIR),)
210      CROSS_ARCH = $(shell $(CC) -dumpmachine)
211      PKG_CONFIG_LIBDIR := /usr/local/$(CROSS_ARCH)/lib/pkgconfig/
212      PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/lib/$(CROSS_ARCH)/pkgconfig/
213      PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/lib/$(CROSS_ARCH)/pkgconfig/
214      PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/local/share/pkgconfig/
215      PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/share/pkgconfig/
216      export PKG_CONFIG_LIBDIR
217      $(warning Missing PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH and PKG_CONFIG_SYSROOT_DIR for cross compilation,)
218      $(warning set PKG_CONFIG_LIBDIR for using Multiarch libs.)
219    endif
220  endif
221endif
222
223RM      = rm -f
224LN      = ln -f
225MKDIR   = mkdir
226FIND    = find
227INSTALL = install
228FLEX    ?= flex
229BISON   ?= bison
230STRIP   = strip
231AWK     = awk
232READELF ?= readelf
233
234# include Makefile.config by default and rule out
235# non-config cases
236config := 1
237
238NON_CONFIG_TARGETS := clean python-clean TAGS tags cscope help
239
240ifdef MAKECMDGOALS
241ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
242  VMLINUX_H=$(src-perf)/util/bpf_skel/vmlinux/vmlinux.h
243  config := 0
244endif
245endif
246
247# The fixdep build - we force fixdep tool to be built as
248# the first target in the separate make session not to be
249# disturbed by any parallel make jobs. Once fixdep is done
250# we issue the requested build with FIXDEP=1 variable.
251#
252# The fixdep build is disabled for $(NON_CONFIG_TARGETS)
253# targets, because it's not necessary.
254
255ifdef FIXDEP
256  force_fixdep := 0
257else
258  force_fixdep := $(config)
259endif
260
261# Runs shellcheck on perf test shell scripts
262ifeq ($(NO_SHELLCHECK),1)
263  SHELLCHECK :=
264else
265  SHELLCHECK := $(shell which shellcheck 2> /dev/null)
266endif
267
268# shellcheck is using in tools/perf/tests/Build with option -a/--check-sourced (
269# introduced in v0.4.7) and -S/--severity (introduced in v0.6.0). So make the
270# minimal shellcheck version as v0.6.0.
271ifneq ($(SHELLCHECK),)
272  ifeq ($(shell expr $(shell $(SHELLCHECK) --version | grep version: | \
273        sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \< 060), 1)
274    SHELLCHECK :=
275  endif
276endif
277
278export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK
279export HOSTCC HOSTLD HOSTAR HOSTCFLAGS SHELLCHECK
280
281include $(srctree)/tools/build/Makefile.include
282
283ifeq ($(force_fixdep),1)
284goals := $(filter-out all sub-make, $(MAKECMDGOALS))
285
286$(goals) all: sub-make
287
288sub-make: fixdep
289	@./check-headers.sh
290	$(Q)$(MAKE) FIXDEP=1 -f Makefile.perf $(goals)
291
292else # force_fixdep
293
294LIBAPI_DIR      = $(srctree)/tools/lib/api/
295LIBBPF_DIR      = $(srctree)/tools/lib/bpf/
296LIBSUBCMD_DIR   = $(srctree)/tools/lib/subcmd/
297LIBSYMBOL_DIR   = $(srctree)/tools/lib/symbol/
298LIBPERF_DIR     = $(srctree)/tools/lib/perf/
299DOC_DIR         = $(srctree)/tools/perf/Documentation/
300
301# Set FEATURE_TESTS to 'all' so all possible feature checkers are executed.
302# Without this setting the output feature dump file misses some features, for
303# example, liberty. Select all checkers so we won't get an incomplete feature
304# dump file.
305ifeq ($(config),1)
306ifdef MAKECMDGOALS
307ifeq ($(filter feature-dump,$(MAKECMDGOALS)),feature-dump)
308FEATURE_TESTS := all
309endif
310endif
311include Makefile.config
312endif
313
314ifeq ($(config),0)
315include $(srctree)/tools/scripts/Makefile.arch
316-include arch/$(SRCARCH)/Makefile
317endif
318
319# The FEATURE_DUMP_EXPORT holds location of the actual
320# FEATURE_DUMP file to be used to bypass feature detection
321# (for bpf or any other subproject)
322ifeq ($(FEATURES_DUMP),)
323FEATURE_DUMP_EXPORT := $(realpath $(OUTPUT)FEATURE-DUMP)
324else
325FEATURE_DUMP_EXPORT := $(realpath $(FEATURES_DUMP))
326endif
327
328export prefix bindir sharedir sysconfdir DESTDIR
329
330# sparse is architecture-neutral, which means that we need to tell it
331# explicitly what architecture to check for. Fix this up for yours..
332SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
333
334# Guard against environment variables
335PYRF_OBJS =
336SCRIPT_SH =
337
338SCRIPT_SH += perf-archive.sh
339SCRIPT_SH += perf-iostat.sh
340
341grep-libs = $(filter -l%,$(1))
342strip-libs = $(filter-out -l%,$(1))
343
344ifneq ($(OUTPUT),)
345  LIBAPI_OUTPUT = $(abspath $(OUTPUT))/libapi
346else
347  LIBAPI_OUTPUT = $(CURDIR)/libapi
348endif
349LIBAPI_DESTDIR = $(LIBAPI_OUTPUT)
350LIBAPI_INCLUDE = $(LIBAPI_DESTDIR)/include
351LIBAPI = $(LIBAPI_OUTPUT)/libapi.a
352export LIBAPI
353CFLAGS += -I$(LIBAPI_OUTPUT)/include
354
355ifneq ($(OUTPUT),)
356  LIBBPF_OUTPUT = $(abspath $(OUTPUT))/libbpf
357else
358  LIBBPF_OUTPUT = $(CURDIR)/libbpf
359endif
360ifdef LIBBPF_STATIC
361  LIBBPF_DESTDIR = $(LIBBPF_OUTPUT)
362  LIBBPF_INCLUDE = $(LIBBPF_DESTDIR)/include
363  LIBBPF = $(LIBBPF_OUTPUT)/libbpf.a
364  CFLAGS += -I$(LIBBPF_OUTPUT)/include
365endif
366
367ifneq ($(OUTPUT),)
368  LIBSUBCMD_OUTPUT = $(abspath $(OUTPUT))/libsubcmd
369else
370  LIBSUBCMD_OUTPUT = $(CURDIR)/libsubcmd
371endif
372LIBSUBCMD_DESTDIR = $(LIBSUBCMD_OUTPUT)
373LIBSUBCMD_INCLUDE = $(LIBSUBCMD_DESTDIR)/include
374LIBSUBCMD = $(LIBSUBCMD_OUTPUT)/libsubcmd.a
375CFLAGS += -I$(LIBSUBCMD_OUTPUT)/include
376
377ifneq ($(OUTPUT),)
378  LIBSYMBOL_OUTPUT = $(abspath $(OUTPUT))/libsymbol
379else
380  LIBSYMBOL_OUTPUT = $(CURDIR)/libsymbol
381endif
382LIBSYMBOL_DESTDIR = $(LIBSYMBOL_OUTPUT)
383LIBSYMBOL_INCLUDE = $(LIBSYMBOL_DESTDIR)/include
384LIBSYMBOL = $(LIBSYMBOL_OUTPUT)/libsymbol.a
385CFLAGS += -I$(LIBSYMBOL_OUTPUT)/include
386
387ifneq ($(OUTPUT),)
388  LIBPERF_OUTPUT = $(abspath $(OUTPUT))/libperf
389else
390  LIBPERF_OUTPUT = $(CURDIR)/libperf
391endif
392LIBPERF_DESTDIR = $(LIBPERF_OUTPUT)
393LIBPERF_INCLUDE = $(LIBPERF_DESTDIR)/include
394LIBPERF = $(LIBPERF_OUTPUT)/libperf.a
395export LIBPERF
396CFLAGS += -I$(LIBPERF_OUTPUT)/include
397
398# python extension build directories
399PYTHON_EXTBUILD     := $(OUTPUT)python_ext_build/
400PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
401PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
402export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
403
404python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so
405
406# Use the detected configuration
407-include $(OUTPUT).config-detected
408
409SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
410
411PROGRAMS += $(OUTPUT)perf
412
413ifndef NO_PERF_READ_VDSO32
414PROGRAMS += $(OUTPUT)perf-read-vdso32
415endif
416
417ifndef NO_PERF_READ_VDSOX32
418PROGRAMS += $(OUTPUT)perf-read-vdsox32
419endif
420
421LIBJVMTI = libperf-jvmti.so
422
423ifndef NO_JVMTI
424PROGRAMS += $(OUTPUT)$(LIBJVMTI)
425endif
426
427DLFILTERS := dlfilter-test-api-v0.so dlfilter-test-api-v2.so dlfilter-show-cycles.so
428DLFILTERS := $(patsubst %,$(OUTPUT)dlfilters/%,$(DLFILTERS))
429
430# what 'all' will build and 'install' will install, in perfexecdir
431ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) $(DLFILTERS)
432
433# what 'all' will build but not install in perfexecdir
434OTHER_PROGRAMS = $(OUTPUT)perf
435
436# Set paths to tools early so that they can be used for version tests.
437ifndef SHELL_PATH
438  SHELL_PATH = /bin/sh
439endif
440ifndef PERL_PATH
441  PERL_PATH = /usr/bin/perl
442endif
443
444export PERL_PATH
445
446LIBPERF_BENCH_IN := $(OUTPUT)perf-bench-in.o
447LIBPERF_BENCH := $(OUTPUT)libperf-bench.a
448
449LIBPERF_TEST_IN := $(OUTPUT)perf-test-in.o
450LIBPERF_TEST := $(OUTPUT)libperf-test.a
451
452LIBPERF_UI_IN := $(OUTPUT)perf-ui-in.o
453LIBPERF_UI := $(OUTPUT)libperf-ui.a
454
455LIBPERF_UTIL_IN := $(OUTPUT)perf-util-in.o
456LIBPERF_UTIL := $(OUTPUT)libperf-util.a
457
458LIBPMU_EVENTS_IN := $(OUTPUT)pmu-events/pmu-events-in.o
459LIBPMU_EVENTS := $(OUTPUT)libpmu-events.a
460
461PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL)
462ifdef LIBBPF_STATIC
463  PERFLIBS += $(LIBBPF)
464endif
465PERFLIBS += $(LIBPERF_BENCH) $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPERF_UTIL)
466PERFLIBS += $(LIBPMU_EVENTS)
467
468# We choose to avoid "if .. else if .. else .. endif endif"
469# because maintaining the nesting to match is a pain.  If
470# we had "elif" things would have been much nicer...
471
472ifneq ($(OUTPUT),)
473  CFLAGS += -I$(OUTPUT)
474endif
475
476ifdef GTK2
477  ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so
478  GTK_IN := $(OUTPUT)gtk-in.o
479endif
480
481ifdef ASCIIDOC8
482  export ASCIIDOC8
483endif
484
485EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS))
486LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
487
488export INSTALL SHELL_PATH
489
490### Build rules
491
492SHELL = $(SHELL_PATH)
493
494arm64_gen_sysreg_dir := $(srctree)/tools/arch/arm64/tools
495ifneq ($(OUTPUT),)
496  arm64_gen_sysreg_outdir := $(abspath $(OUTPUT))
497else
498  arm64_gen_sysreg_outdir := $(CURDIR)
499endif
500
501arm64-sysreg-defs: FORCE
502	$(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir) \
503		prefix= subdir=
504
505arm64-sysreg-defs-clean:
506	$(call QUIET_CLEAN,arm64-sysreg-defs)
507	$(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir) \
508		prefix= subdir= clean > /dev/null
509
510beauty_linux_dir := $(srctree)/tools/perf/trace/beauty/include/linux/
511beauty_uapi_linux_dir := $(srctree)/tools/perf/trace/beauty/include/uapi/linux/
512beauty_uapi_sound_dir := $(srctree)/tools/perf/trace/beauty/include/uapi/sound/
513beauty_arch_asm_dir := $(srctree)/tools/perf/trace/beauty/arch/x86/include/asm/
514beauty_x86_arch_asm_uapi_dir := $(srctree)/tools/perf/trace/beauty/arch/x86/include/uapi/asm/
515
516linux_uapi_dir := $(srctree)/tools/include/uapi/linux
517asm_generic_uapi_dir := $(srctree)/tools/include/uapi/asm-generic
518arch_asm_uapi_dir := $(srctree)/tools/arch/$(SRCARCH)/include/uapi/asm/
519x86_arch_asm_dir := $(srctree)/tools/arch/x86/include/asm/
520
521beauty_outdir := $(OUTPUT)trace/beauty/generated
522beauty_ioctl_outdir := $(beauty_outdir)/ioctl
523
524# Create output directory if not already present
525$(shell [ -d '$(beauty_ioctl_outdir)' ] || mkdir -p '$(beauty_ioctl_outdir)')
526
527fs_at_flags_array := $(beauty_outdir)/fs_at_flags_array.c
528fs_at_flags_tbl := $(srctree)/tools/perf/trace/beauty/fs_at_flags.sh
529
530$(fs_at_flags_array): $(beauty_uapi_linux_dir)/fcntl.h $(fs_at_flags_tbl)
531	$(Q)$(SHELL) '$(fs_at_flags_tbl)' $(beauty_uapi_linux_dir) > $@
532
533clone_flags_array := $(beauty_outdir)/clone_flags_array.c
534clone_flags_tbl := $(srctree)/tools/perf/trace/beauty/clone.sh
535
536$(clone_flags_array): $(beauty_uapi_linux_dir)/sched.h $(clone_flags_tbl)
537	$(Q)$(SHELL) '$(clone_flags_tbl)' $(beauty_uapi_linux_dir) > $@
538
539drm_ioctl_array := $(beauty_ioctl_outdir)/drm_ioctl_array.c
540drm_hdr_dir := $(srctree)/tools/include/uapi/drm
541drm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/drm_ioctl.sh
542
543$(drm_ioctl_array): $(drm_hdr_dir)/drm.h $(drm_hdr_dir)/i915_drm.h $(drm_ioctl_tbl)
544	$(Q)$(SHELL) '$(drm_ioctl_tbl)' $(drm_hdr_dir) > $@
545
546fadvise_advice_array := $(beauty_outdir)/fadvise_advice_array.c
547fadvise_advice_tbl := $(srctree)/tools/perf/trace/beauty/fadvise.sh
548
549$(fadvise_advice_array): $(linux_uapi_dir)/in.h $(fadvise_advice_tbl)
550	$(Q)$(SHELL) '$(fadvise_advice_tbl)' $(linux_uapi_dir) > $@
551
552fsmount_arrays := $(beauty_outdir)/fsmount_arrays.c
553fsmount_tbls := $(srctree)/tools/perf/trace/beauty/fsmount.sh
554
555$(fsmount_arrays): $(beauty_uapi_linux_dir)/mount.h $(fsmount_tbls)
556	$(Q)$(SHELL) '$(fsmount_tbls)' $(beauty_uapi_linux_dir) > $@
557
558fspick_arrays := $(beauty_outdir)/fspick_arrays.c
559fspick_tbls := $(srctree)/tools/perf/trace/beauty/fspick.sh
560
561$(fspick_arrays): $(beauty_uapi_linux_dir)/mount.h $(fspick_tbls)
562	$(Q)$(SHELL) '$(fspick_tbls)' $(beauty_uapi_linux_dir) > $@
563
564fsconfig_arrays := $(beauty_outdir)/fsconfig_arrays.c
565fsconfig_tbls := $(srctree)/tools/perf/trace/beauty/fsconfig.sh
566
567$(fsconfig_arrays): $(beauty_uapi_linux_dir)/mount.h $(fsconfig_tbls)
568	$(Q)$(SHELL) '$(fsconfig_tbls)' $(beauty_uapi_linux_dir) > $@
569
570pkey_alloc_access_rights_array := $(beauty_outdir)/pkey_alloc_access_rights_array.c
571asm_generic_hdr_dir := $(srctree)/tools/include/uapi/asm-generic/
572pkey_alloc_access_rights_tbl := $(srctree)/tools/perf/trace/beauty/pkey_alloc_access_rights.sh
573
574$(pkey_alloc_access_rights_array): $(asm_generic_hdr_dir)/mman-common.h $(pkey_alloc_access_rights_tbl)
575	$(Q)$(SHELL) '$(pkey_alloc_access_rights_tbl)' $(asm_generic_hdr_dir) > $@
576
577sndrv_ctl_ioctl_array := $(beauty_ioctl_outdir)/sndrv_ctl_ioctl_array.c
578sndrv_ctl_hdr_dir := $(srctree)/tools/include/uapi/sound
579sndrv_ctl_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/sndrv_ctl_ioctl.sh
580
581$(sndrv_ctl_ioctl_array): $(beauty_uapi_sound_dir)/asound.h $(sndrv_ctl_ioctl_tbl)
582	$(Q)$(SHELL) '$(sndrv_ctl_ioctl_tbl)' $(beauty_uapi_sound_dir) > $@
583
584sndrv_pcm_ioctl_array := $(beauty_ioctl_outdir)/sndrv_pcm_ioctl_array.c
585sndrv_pcm_hdr_dir := $(srctree)/tools/include/uapi/sound
586sndrv_pcm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/sndrv_pcm_ioctl.sh
587
588$(sndrv_pcm_ioctl_array): $(beauty_uapi_sound_dir)/asound.h $(sndrv_pcm_ioctl_tbl)
589	$(Q)$(SHELL) '$(sndrv_pcm_ioctl_tbl)' $(beauty_uapi_sound_dir) > $@
590
591kcmp_type_array := $(beauty_outdir)/kcmp_type_array.c
592kcmp_hdr_dir := $(srctree)/tools/include/uapi/linux/
593kcmp_type_tbl := $(srctree)/tools/perf/trace/beauty/kcmp_type.sh
594
595$(kcmp_type_array): $(kcmp_hdr_dir)/kcmp.h $(kcmp_type_tbl)
596	$(Q)$(SHELL) '$(kcmp_type_tbl)' $(kcmp_hdr_dir) > $@
597
598kvm_ioctl_array := $(beauty_ioctl_outdir)/kvm_ioctl_array.c
599kvm_hdr_dir := $(srctree)/tools/include/uapi/linux
600kvm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/kvm_ioctl.sh
601
602$(kvm_ioctl_array): $(kvm_hdr_dir)/kvm.h $(kvm_ioctl_tbl)
603	$(Q)$(SHELL) '$(kvm_ioctl_tbl)' $(kvm_hdr_dir) > $@
604
605socket_arrays := $(beauty_outdir)/socket.c
606socket_tbl := $(srctree)/tools/perf/trace/beauty/socket.sh
607
608$(socket_arrays): $(linux_uapi_dir)/in.h $(beauty_linux_dir)/socket.h $(socket_tbl)
609	$(Q)$(SHELL) '$(socket_tbl)' $(linux_uapi_dir) $(beauty_linux_dir) > $@
610
611sockaddr_arrays := $(beauty_outdir)/sockaddr.c
612sockaddr_tbl := $(srctree)/tools/perf/trace/beauty/sockaddr.sh
613
614$(sockaddr_arrays): $(beauty_linux_dir)/socket.h $(sockaddr_tbl)
615	$(Q)$(SHELL) '$(sockaddr_tbl)' $(beauty_linux_dir) > $@
616
617vhost_virtio_ioctl_array := $(beauty_ioctl_outdir)/vhost_virtio_ioctl_array.c
618vhost_virtio_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/vhost_virtio_ioctl.sh
619
620$(vhost_virtio_ioctl_array): $(beauty_uapi_linux_dir)/vhost.h $(vhost_virtio_ioctl_tbl)
621	$(Q)$(SHELL) '$(vhost_virtio_ioctl_tbl)' $(beauty_uapi_linux_dir) > $@
622
623perf_ioctl_array := $(beauty_ioctl_outdir)/perf_ioctl_array.c
624perf_hdr_dir := $(srctree)/tools/include/uapi/linux
625perf_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/perf_ioctl.sh
626
627$(perf_ioctl_array): $(perf_hdr_dir)/perf_event.h $(perf_ioctl_tbl)
628	$(Q)$(SHELL) '$(perf_ioctl_tbl)' $(perf_hdr_dir) > $@
629
630madvise_behavior_array := $(beauty_outdir)/madvise_behavior_array.c
631madvise_hdr_dir := $(srctree)/tools/include/uapi/asm-generic/
632madvise_behavior_tbl := $(srctree)/tools/perf/trace/beauty/madvise_behavior.sh
633
634$(madvise_behavior_array): $(madvise_hdr_dir)/mman-common.h $(madvise_behavior_tbl)
635	$(Q)$(SHELL) '$(madvise_behavior_tbl)' $(madvise_hdr_dir) > $@
636
637mmap_flags_array := $(beauty_outdir)/mmap_flags_array.c
638mmap_flags_tbl := $(srctree)/tools/perf/trace/beauty/mmap_flags.sh
639
640$(mmap_flags_array): $(linux_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman-common.h $(mmap_flags_tbl)
641	$(Q)$(SHELL) '$(mmap_flags_tbl)' $(linux_uapi_dir) $(asm_generic_uapi_dir) $(arch_asm_uapi_dir) > $@
642
643mremap_flags_array := $(beauty_outdir)/mremap_flags_array.c
644mremap_flags_tbl := $(srctree)/tools/perf/trace/beauty/mremap_flags.sh
645
646$(mremap_flags_array): $(linux_uapi_dir)/mman.h $(mremap_flags_tbl)
647	$(Q)$(SHELL) '$(mremap_flags_tbl)' $(linux_uapi_dir) > $@
648
649mount_flags_array := $(beauty_outdir)/mount_flags_array.c
650mount_flags_tbl := $(srctree)/tools/perf/trace/beauty/mount_flags.sh
651
652$(mount_flags_array): $(beauty_uapi_linux_dir)/mount.h $(mount_flags_tbl)
653	$(Q)$(SHELL) '$(mount_flags_tbl)' $(beauty_uapi_linux_dir) > $@
654
655move_mount_flags_array := $(beauty_outdir)/move_mount_flags_array.c
656move_mount_flags_tbl := $(srctree)/tools/perf/trace/beauty/move_mount_flags.sh
657
658$(move_mount_flags_array): $(beauty_uapi_linux_dir)/mount.h $(move_mount_flags_tbl)
659	$(Q)$(SHELL) '$(move_mount_flags_tbl)' $(beauty_uapi_linux_dir) > $@
660
661mmap_prot_array := $(beauty_outdir)/mmap_prot_array.c
662mmap_prot_tbl := $(srctree)/tools/perf/trace/beauty/mmap_prot.sh
663
664$(mmap_prot_array): $(asm_generic_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman-common.h $(mmap_prot_tbl)
665	$(Q)$(SHELL) '$(mmap_prot_tbl)' $(asm_generic_uapi_dir) $(arch_asm_uapi_dir) > $@
666
667prctl_option_array := $(beauty_outdir)/prctl_option_array.c
668prctl_option_tbl := $(srctree)/tools/perf/trace/beauty/prctl_option.sh
669
670$(prctl_option_array): $(beauty_uapi_linux_dir)/prctl.h $(prctl_option_tbl)
671	$(Q)$(SHELL) '$(prctl_option_tbl)' $(beauty_uapi_linux_dir) > $@
672
673usbdevfs_ioctl_array := $(beauty_ioctl_outdir)/usbdevfs_ioctl_array.c
674usbdevfs_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/usbdevfs_ioctl.sh
675
676$(usbdevfs_ioctl_array): $(beauty_uapi_linux_dir)/usbdevice_fs.h $(usbdevfs_ioctl_tbl)
677	$(Q)$(SHELL) '$(usbdevfs_ioctl_tbl)' $(beauty_uapi_linux_dir) > $@
678
679x86_arch_prctl_code_array := $(beauty_outdir)/x86_arch_prctl_code_array.c
680x86_arch_prctl_code_tbl := $(srctree)/tools/perf/trace/beauty/x86_arch_prctl.sh
681
682$(x86_arch_prctl_code_array): $(beauty_x86_arch_asm_uapi_dir)/prctl.h $(x86_arch_prctl_code_tbl)
683	$(Q)$(SHELL) '$(x86_arch_prctl_code_tbl)' $(beauty_x86_arch_asm_uapi_dir) > $@
684
685x86_arch_irq_vectors_array := $(beauty_outdir)/x86_arch_irq_vectors_array.c
686x86_arch_irq_vectors_tbl := $(srctree)/tools/perf/trace/beauty/tracepoints/x86_irq_vectors.sh
687
688$(x86_arch_irq_vectors_array): $(beauty_arch_asm_dir)/irq_vectors.h $(x86_arch_irq_vectors_tbl)
689	$(Q)$(SHELL) '$(x86_arch_irq_vectors_tbl)' $(beauty_arch_asm_dir) > $@
690
691x86_arch_MSRs_array := $(beauty_outdir)/x86_arch_MSRs_array.c
692x86_arch_MSRs_tbl := $(srctree)/tools/perf/trace/beauty/tracepoints/x86_msr.sh
693
694$(x86_arch_MSRs_array): $(x86_arch_asm_dir)/msr-index.h $(x86_arch_MSRs_tbl)
695	$(Q)$(SHELL) '$(x86_arch_MSRs_tbl)' $(x86_arch_asm_dir) > $@
696
697rename_flags_array := $(beauty_outdir)/rename_flags_array.c
698rename_flags_tbl := $(srctree)/tools/perf/trace/beauty/rename_flags.sh
699
700$(rename_flags_array): $(beauty_uapi_linux_dir)/fs.h $(rename_flags_tbl)
701	$(Q)$(SHELL) '$(rename_flags_tbl)' $(beauty_uapi_linux_dir) > $@
702
703arch_errno_name_array := $(beauty_outdir)/arch_errno_name_array.c
704arch_errno_hdr_dir := $(srctree)/tools
705arch_errno_tbl := $(srctree)/tools/perf/trace/beauty/arch_errno_names.sh
706
707$(arch_errno_name_array): $(arch_errno_tbl)
708	$(Q)$(SHELL) '$(arch_errno_tbl)' '$(patsubst -%,,$(CC))' $(arch_errno_hdr_dir) > $@
709
710statx_mask_array := $(beauty_outdir)/statx_mask_array.c
711statx_mask_tbl := $(srctree)/tools/perf/trace/beauty/statx_mask.sh
712
713$(statx_mask_array): $(beauty_uapi_linux_dir)/stat.h $(statx_mask_tbl)
714	$(Q)$(SHELL) '$(statx_mask_tbl)' $(beauty_uapi_linux_dir) > $@
715
716sync_file_range_arrays := $(beauty_outdir)/sync_file_range_arrays.c
717sync_file_range_tbls := $(srctree)/tools/perf/trace/beauty/sync_file_range.sh
718
719$(sync_file_range_arrays): $(beauty_uapi_linux_dir)/fs.h $(sync_file_range_tbls)
720	$(Q)$(SHELL) '$(sync_file_range_tbls)' $(beauty_uapi_linux_dir) > $@
721
722TESTS_CORESIGHT_DIR := $(srctree)/tools/perf/tests/shell/coresight
723
724tests-coresight-targets: FORCE
725	$(Q)$(MAKE) -C $(TESTS_CORESIGHT_DIR)
726
727tests-coresight-targets-clean:
728	$(call QUIET_CLEAN, coresight)
729	$(Q)$(MAKE) -C $(TESTS_CORESIGHT_DIR) O=$(OUTPUT) clean >/dev/null
730
731all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) tests-coresight-targets
732
733# Create python binding output directory if not already present
734$(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python')
735
736$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): util/python.c util/setup.py $(PERFLIBS)
737	$(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
738        CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBS)' \
739	  $(PYTHON_WORD) util/setup.py \
740	  --quiet build_ext; \
741	cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/
742
743python_perf_target:
744	@echo "Target is: $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX)"
745
746please_set_SHELL_PATH_to_a_more_modern_shell:
747	$(Q)$$(:)
748
749shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
750
751strip: $(PROGRAMS) $(OUTPUT)perf
752	$(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
753
754PERF_IN := $(OUTPUT)perf-in.o
755export NO_JEVENTS
756
757build := -f $(srctree)/tools/build/Makefile.build dir=. obj
758
759$(PERF_IN): prepare FORCE
760	$(Q)$(MAKE) $(build)=perf
761
762$(LIBPMU_EVENTS_IN): FORCE prepare
763	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=pmu-events obj=pmu-events
764
765$(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN)
766	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
767
768$(LIBPERF_BENCH_IN): FORCE prepare
769	$(Q)$(MAKE) $(build)=perf-bench
770
771$(LIBPERF_BENCH): $(LIBPERF_BENCH_IN)
772	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
773
774$(LIBPERF_TEST_IN): FORCE prepare
775	$(Q)$(MAKE) $(build)=perf-test
776
777$(LIBPERF_TEST): $(LIBPERF_TEST_IN)
778	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
779
780$(LIBPERF_UI_IN): FORCE prepare
781	$(Q)$(MAKE) $(build)=perf-ui
782
783$(LIBPERF_UI): $(LIBPERF_UI_IN)
784	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
785
786$(LIBPERF_UTIL_IN): FORCE prepare
787	$(Q)$(MAKE) $(build)=perf-util
788
789$(LIBPERF_UTIL): $(LIBPERF_UTIL_IN)
790	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
791
792$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN)
793	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \
794		$(PERF_IN) $(LIBS) -o $@
795
796$(GTK_IN): FORCE prepare
797	$(Q)$(MAKE) $(build)=gtk
798
799$(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS)
800	$(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
801
802$(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
803
804$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
805	$(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
806
807$(SCRIPTS) : % : %.sh
808	$(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
809
810$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
811	$(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
812
813# These can record PERF_VERSION
814perf.spec $(SCRIPTS) \
815	: $(OUTPUT)PERF-VERSION-FILE
816
817.SUFFIXES:
818
819#
820# If a target does not match any of the later rules then prefix it by $(OUTPUT)
821# This makes targets like 'make O=/tmp/perf perf.o' work in a natural way.
822#
823ifneq ($(OUTPUT),)
824%.o: $(OUTPUT)%.o
825	@echo "    # Redirected target $@ => $(OUTPUT)$@"
826pmu-events/%.o: $(OUTPUT)pmu-events/%.o
827	@echo "    # Redirected target $@ => $(OUTPUT)$@"
828util/%.o: $(OUTPUT)util/%.o
829	@echo "    # Redirected target $@ => $(OUTPUT)$@"
830bench/%.o: $(OUTPUT)bench/%.o
831	@echo "    # Redirected target $@ => $(OUTPUT)$@"
832tests/%.o: $(OUTPUT)tests/%.o
833	@echo "    # Redirected target $@ => $(OUTPUT)$@"
834endif
835
836# These two need to be here so that when O= is not used they take precedence
837# over the general rule for .o
838
839# get relative building directory (to $(OUTPUT))
840# and '.' if it's $(OUTPUT) itself
841__build-dir = $(subst $(OUTPUT),,$(dir $@))
842build-dir   = $(or $(__build-dir),.)
843
844prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders \
845	arm64-sysreg-defs \
846	$(fs_at_flags_array) \
847	$(clone_flags_array) \
848	$(drm_ioctl_array) \
849	$(fadvise_advice_array) \
850	$(fsconfig_arrays) \
851	$(fsmount_arrays) \
852	$(fspick_arrays) \
853	$(pkey_alloc_access_rights_array) \
854	$(sndrv_pcm_ioctl_array) \
855	$(sndrv_ctl_ioctl_array) \
856	$(kcmp_type_array) \
857	$(kvm_ioctl_array) \
858	$(socket_arrays) \
859	$(sockaddr_arrays) \
860	$(vhost_virtio_ioctl_array) \
861	$(madvise_behavior_array) \
862	$(mmap_flags_array) \
863	$(mmap_prot_array) \
864	$(mremap_flags_array) \
865	$(mount_flags_array) \
866	$(move_mount_flags_array) \
867	$(perf_ioctl_array) \
868	$(prctl_option_array) \
869	$(usbdevfs_ioctl_array) \
870	$(x86_arch_irq_vectors_array) \
871	$(x86_arch_MSRs_array) \
872	$(x86_arch_prctl_code_array) \
873	$(rename_flags_array) \
874	$(arch_errno_name_array) \
875	$(statx_mask_array) \
876	$(sync_file_range_arrays) \
877	$(LIBAPI) \
878	$(LIBPERF) \
879	$(LIBSUBCMD) \
880	$(LIBSYMBOL) \
881	bpf-skel
882
883ifdef LIBBPF_STATIC
884prepare: $(LIBBPF)
885endif
886
887$(OUTPUT)%.o: %.c prepare FORCE
888	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
889
890$(OUTPUT)%.i: %.c prepare FORCE
891	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
892
893$(OUTPUT)%.s: %.c prepare FORCE
894	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
895
896$(OUTPUT)%-bison.o: %.c prepare FORCE
897	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
898
899$(OUTPUT)%-flex.o: %.c prepare FORCE
900	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
901
902$(OUTPUT)%.o: %.S prepare FORCE
903	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
904
905$(OUTPUT)%.i: %.S prepare FORCE
906	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
907
908$(OUTPUT)perf-%: %.o $(PERFLIBS)
909	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
910
911ifndef NO_PERF_READ_VDSO32
912$(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-map.c
913	$(QUIET_CC)$(CC) -m32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
914endif
915
916ifndef NO_PERF_READ_VDSOX32
917$(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-map.c
918	$(QUIET_CC)$(CC) -mx32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
919endif
920
921$(OUTPUT)dlfilters/%.o: dlfilters/%.c include/perf/perf_dlfilter.h
922	$(Q)$(MKDIR) -p $(OUTPUT)dlfilters
923	$(QUIET_CC)$(CC) -c -Iinclude $(EXTRA_CFLAGS) -o $@ -fpic $<
924
925.SECONDARY: $(DLFILTERS:.so=.o)
926
927$(OUTPUT)dlfilters/%.so: $(OUTPUT)dlfilters/%.o
928	$(QUIET_LINK)$(CC) $(EXTRA_CFLAGS) -shared -o $@ $<
929
930ifndef NO_JVMTI
931LIBJVMTI_IN := $(OUTPUT)jvmti/jvmti-in.o
932
933$(LIBJVMTI_IN): FORCE
934	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=jvmti obj=jvmti
935
936$(OUTPUT)$(LIBJVMTI): $(LIBJVMTI_IN)
937	$(QUIET_LINK)$(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIBJVMTI) -o $@ $<
938endif
939
940$(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
941
942$(LIBAPI): FORCE | $(LIBAPI_OUTPUT)
943	$(Q)$(MAKE) -C $(LIBAPI_DIR) O=$(LIBAPI_OUTPUT) \
944		DESTDIR=$(LIBAPI_DESTDIR) prefix= subdir= \
945		$@ install_headers
946
947$(LIBAPI)-clean:
948	$(call QUIET_CLEAN, libapi)
949	$(Q)$(RM) -r -- $(LIBAPI_OUTPUT)
950
951$(LIBBPF): FORCE | $(LIBBPF_OUTPUT)
952	$(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \
953		O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= subdir= \
954		EXTRA_CFLAGS="-fPIC" $@ install_headers
955
956$(LIBBPF)-clean:
957	$(call QUIET_CLEAN, libbpf)
958	$(Q)$(RM) -r -- $(LIBBPF_OUTPUT)
959
960$(LIBPERF): FORCE | $(LIBPERF_OUTPUT)
961	$(Q)$(MAKE) -C $(LIBPERF_DIR) O=$(LIBPERF_OUTPUT) \
962		DESTDIR=$(LIBPERF_DESTDIR) prefix= subdir= \
963		$@ install_headers
964
965$(LIBPERF)-clean:
966	$(call QUIET_CLEAN, libperf)
967	$(Q)$(RM) -r -- $(LIBPERF_OUTPUT)
968
969$(LIBSUBCMD): FORCE | $(LIBSUBCMD_OUTPUT)
970	$(Q)$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \
971		DESTDIR=$(LIBSUBCMD_DESTDIR) prefix= subdir= \
972		$@ install_headers
973
974$(LIBSUBCMD)-clean:
975	$(call QUIET_CLEAN, libsubcmd)
976	$(Q)$(RM) -r -- $(LIBSUBCMD_OUTPUT)
977
978$(LIBSYMBOL): FORCE | $(LIBSYMBOL_OUTPUT)
979	$(Q)$(MAKE) -C $(LIBSYMBOL_DIR) O=$(LIBSYMBOL_OUTPUT) \
980		DESTDIR=$(LIBSYMBOL_DESTDIR) prefix= subdir= \
981		$@ install_headers
982
983$(LIBSYMBOL)-clean:
984	$(call QUIET_CLEAN, libsymbol)
985	$(Q)$(RM) -r -- $(LIBSYMBOL_OUTPUT)
986
987help:
988	@echo 'Perf make targets:'
989	@echo '  doc		- make *all* documentation (see below)'
990	@echo '  man		- make manpage documentation (access with man <foo>)'
991	@echo '  html		- make html documentation'
992	@echo '  info		- make GNU info documentation (access with info <foo>)'
993	@echo '  pdf		- make pdf documentation'
994	@echo '  TAGS		- use etags to make tag information for source browsing'
995	@echo '  tags		- use ctags to make tag information for source browsing'
996	@echo '  cscope	- use cscope to make interactive browsing database'
997	@echo ''
998	@echo 'Perf install targets:'
999	@echo '  NOTE: documentation build requires asciidoc, xmlto packages to be installed'
1000	@echo '  HINT: use "prefix" or "DESTDIR" to install to a particular'
1001	@echo '        path like "make prefix=/usr/local install install-doc"'
1002	@echo '  install	- install compiled binaries'
1003	@echo '  install-doc	- install *all* documentation'
1004	@echo '  install-man	- install manpage documentation'
1005	@echo '  install-html	- install html documentation'
1006	@echo '  install-info	- install GNU info documentation'
1007	@echo '  install-pdf	- install pdf documentation'
1008	@echo ''
1009	@echo '  quick-install-doc	- alias for quick-install-man'
1010	@echo '  quick-install-man	- install the documentation quickly'
1011	@echo '  quick-install-html	- install the html documentation quickly'
1012	@echo ''
1013	@echo 'Perf maintainer targets:'
1014	@echo '  clean			- clean all binary objects and build output'
1015
1016
1017DOC_TARGETS := doc man html info pdf
1018
1019INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
1020INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
1021
1022# 'make doc' should call 'make -C Documentation all'
1023$(DOC_TARGETS):
1024	$(Q)$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) $(@:doc=all) ASCIIDOC_EXTRA=$(ASCIIDOC_EXTRA)
1025
1026TAG_FOLDERS= . ../lib ../include
1027TAG_FILES= ../../include/uapi/linux/perf_event.h
1028
1029TAGS:
1030	$(QUIET_GEN)$(RM) TAGS; \
1031	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print -o -name '*.cpp' -print | xargs etags -a $(TAG_FILES)
1032
1033tags:
1034	$(QUIET_GEN)$(RM) tags; \
1035	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print -o -name '*.cpp' -print | xargs ctags -a $(TAG_FILES)
1036
1037cscope:
1038	$(QUIET_GEN)$(RM) cscope*; \
1039	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print -o -name '*.cpp' -print | xargs cscope -b $(TAG_FILES)
1040
1041### Testing rules
1042
1043# GNU make supports exporting all variables by "export" without parameters.
1044# However, the environment gets quite big, and some programs have problems
1045# with that.
1046
1047check: $(OUTPUT)common-cmds.h
1048	if sparse; \
1049	then \
1050		for i in *.c */*.c; \
1051		do \
1052			sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
1053		done; \
1054	else \
1055		exit 1; \
1056	fi
1057
1058### Installation rules
1059
1060ifdef GTK2
1061install-gtk: $(OUTPUT)libperf-gtk.so
1062	$(call QUIET_INSTALL, 'GTK UI') \
1063		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
1064		$(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)'
1065else
1066install-gtk:
1067endif
1068
1069install-tools: all install-gtk
1070	$(call QUIET_INSTALL, binaries) \
1071		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'; \
1072		$(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'; \
1073		$(LN) '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'; \
1074		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(includedir_SQ)/perf'; \
1075		$(INSTALL) -m 644 include/perf/perf_dlfilter.h -t '$(DESTDIR_SQ)$(includedir_SQ)/perf'
1076ifndef NO_PERF_READ_VDSO32
1077	$(call QUIET_INSTALL, perf-read-vdso32) \
1078		$(INSTALL) $(OUTPUT)perf-read-vdso32 '$(DESTDIR_SQ)$(bindir_SQ)';
1079endif
1080ifndef NO_PERF_READ_VDSOX32
1081	$(call QUIET_INSTALL, perf-read-vdsox32) \
1082		$(INSTALL) $(OUTPUT)perf-read-vdsox32 '$(DESTDIR_SQ)$(bindir_SQ)';
1083endif
1084ifndef NO_JVMTI
1085	$(call QUIET_INSTALL, $(LIBJVMTI)) \
1086		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
1087		$(INSTALL) $(OUTPUT)$(LIBJVMTI) '$(DESTDIR_SQ)$(libdir_SQ)';
1088endif
1089	$(call QUIET_INSTALL, libexec) \
1090		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
1091	$(call QUIET_INSTALL, perf-archive) \
1092		$(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
1093	$(call QUIET_INSTALL, perf-iostat) \
1094		$(INSTALL) $(OUTPUT)perf-iostat -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
1095ifndef NO_LIBAUDIT
1096	$(call QUIET_INSTALL, strace/groups) \
1097		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(STRACE_GROUPS_INSTDIR_SQ)'; \
1098		$(INSTALL) trace/strace/groups/* -m 644 -t '$(DESTDIR_SQ)$(STRACE_GROUPS_INSTDIR_SQ)'
1099endif
1100ifndef NO_LIBPERL
1101	$(call QUIET_INSTALL, perl-scripts) \
1102		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \
1103		$(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'; \
1104		$(INSTALL) scripts/perl/*.pl -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'; \
1105		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'; \
1106		$(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
1107endif
1108ifndef NO_LIBPYTHON
1109	$(call QUIET_INSTALL, python-scripts) \
1110		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \
1111		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'; \
1112		$(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'; \
1113		$(INSTALL) scripts/python/*.py -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'; \
1114		$(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
1115endif
1116	$(call QUIET_INSTALL, dlfilters) \
1117		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/dlfilters'; \
1118		$(INSTALL) $(DLFILTERS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/dlfilters';
1119	$(call QUIET_INSTALL, perf_completion-script) \
1120		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'; \
1121		$(INSTALL) perf-completion.sh -m 644 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
1122	$(call QUIET_INSTALL, perf-tip) \
1123		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(tip_instdir_SQ)'; \
1124		$(INSTALL) Documentation/tips.txt -m 644 -t '$(DESTDIR_SQ)$(tip_instdir_SQ)'
1125
1126install-tests: all install-gtk
1127	$(call QUIET_INSTALL, tests) \
1128		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
1129		$(INSTALL) tests/attr.py -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
1130		$(INSTALL) tests/pe-file.exe* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
1131		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \
1132		$(INSTALL) tests/attr/* -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \
1133		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
1134		$(INSTALL) tests/shell/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
1135		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
1136		$(INSTALL) tests/shell/lib/*.sh -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
1137		$(INSTALL) tests/shell/lib/*.py -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
1138		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/common'; \
1139		$(INSTALL) tests/shell/common/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/common'; \
1140		$(INSTALL) tests/shell/common/*.pl '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/common'; \
1141		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_probe'; \
1142		$(INSTALL) tests/shell/base_probe/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/base_probe'; \
1143		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight' ; \
1144		$(INSTALL) tests/shell/coresight/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight'
1145	$(Q)$(MAKE) -C tests/shell/coresight install-tests
1146
1147install-bin: install-tools install-tests
1148
1149install: install-bin try-install-man
1150
1151install-python_ext:
1152	$(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
1153
1154# 'make install-doc' should call 'make -C Documentation install'
1155$(INSTALL_DOC_TARGETS):
1156	$(Q)$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) $(@:-doc=) ASCIIDOC_EXTRA=$(ASCIIDOC_EXTRA) subdir=
1157
1158### Cleaning rules
1159
1160python-clean:
1161	$(python-clean)
1162
1163SKEL_OUT := $(abspath $(OUTPUT)util/bpf_skel)
1164SKEL_TMP_OUT := $(abspath $(SKEL_OUT)/.tmp)
1165SKELETONS := $(SKEL_OUT)/bpf_prog_profiler.skel.h
1166SKELETONS += $(SKEL_OUT)/bperf_leader.skel.h $(SKEL_OUT)/bperf_follower.skel.h
1167SKELETONS += $(SKEL_OUT)/bperf_cgroup.skel.h $(SKEL_OUT)/func_latency.skel.h
1168SKELETONS += $(SKEL_OUT)/off_cpu.skel.h $(SKEL_OUT)/lock_contention.skel.h
1169SKELETONS += $(SKEL_OUT)/kwork_trace.skel.h $(SKEL_OUT)/sample_filter.skel.h
1170SKELETONS += $(SKEL_OUT)/kwork_top.skel.h
1171SKELETONS += $(SKEL_OUT)/bench_uprobe.skel.h
1172SKELETONS += $(SKEL_OUT)/augmented_raw_syscalls.skel.h
1173
1174$(SKEL_TMP_OUT) $(LIBAPI_OUTPUT) $(LIBBPF_OUTPUT) $(LIBPERF_OUTPUT) $(LIBSUBCMD_OUTPUT) $(LIBSYMBOL_OUTPUT):
1175	$(Q)$(MKDIR) -p $@
1176
1177ifeq ($(CONFIG_PERF_BPF_SKEL),y)
1178BPFTOOL := $(SKEL_TMP_OUT)/bootstrap/bpftool
1179# Get Clang's default includes on this system, as opposed to those seen by
1180# '--target=bpf'. This fixes "missing" files on some architectures/distros,
1181# such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc.
1182#
1183# Use '-idirafter': Don't interfere with include mechanics except where the
1184# build would have failed anyways.
1185define get_sys_includes
1186$(shell $(1) $(2) -v -E - </dev/null 2>&1 \
1187       | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \
1188$(shell $(1) $(2) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
1189endef
1190
1191ifneq ($(CROSS_COMPILE),)
1192CLANG_TARGET_ARCH = --target=$(notdir $(CROSS_COMPILE:%-=%))
1193endif
1194
1195CLANG_OPTIONS = -Wall
1196CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
1197BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE) $(CLANG_SYS_INCLUDES)
1198TOOLS_UAPI_INCLUDE := -I$(srctree)/tools/include/uapi
1199
1200ifneq ($(WERROR),0)
1201  CLANG_OPTIONS += -Werror
1202endif
1203
1204$(BPFTOOL): | $(SKEL_TMP_OUT)
1205	$(Q)CFLAGS= $(MAKE) -C ../bpf/bpftool \
1206		OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
1207
1208# Paths to search for a kernel to generate vmlinux.h from.
1209VMLINUX_BTF_ELF_PATHS ?= $(if $(O),$(O)/vmlinux)			\
1210		     $(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux)	\
1211		     ../../vmlinux					\
1212		     /boot/vmlinux-$(shell uname -r)
1213
1214# Paths to BTF information.
1215VMLINUX_BTF_BTF_PATHS ?= /sys/kernel/btf/vmlinux
1216
1217# Filter out kernels that don't exist or without a BTF section.
1218VMLINUX_BTF_ELF_ABSPATHS ?= $(abspath $(wildcard $(VMLINUX_BTF_ELF_PATHS)))
1219VMLINUX_BTF_PATHS ?= $(shell for file in $(VMLINUX_BTF_ELF_ABSPATHS); \
1220			do \
1221				if [ -f $$file ] && ($(READELF) -S "$$file" | grep -q .BTF); \
1222				then \
1223					echo "$$file"; \
1224				fi; \
1225			done) \
1226			$(wildcard $(VMLINUX_BTF_BTF_PATHS))
1227
1228# Select the first as the source of vmlinux.h.
1229VMLINUX_BTF ?= $(firstword $(VMLINUX_BTF_PATHS))
1230
1231ifeq ($(VMLINUX_H),)
1232  ifeq ($(VMLINUX_BTF),)
1233    $(error Missing bpftool input for generating vmlinux.h)
1234  endif
1235endif
1236
1237$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) $(VMLINUX_H)
1238ifeq ($(VMLINUX_H),)
1239	$(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@
1240else
1241	$(Q)cp "$(VMLINUX_H)" $@
1242endif
1243
1244$(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) $(SKEL_OUT)/vmlinux.h | $(SKEL_TMP_OUT)
1245	$(QUIET_CLANG)$(CLANG) -g -O2 --target=bpf $(CLANG_OPTIONS) $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \
1246	  -c $(filter util/bpf_skel/%.bpf.c,$^) -o $@
1247
1248$(SKEL_OUT)/%.skel.h: $(SKEL_TMP_OUT)/%.bpf.o | $(BPFTOOL)
1249	$(QUIET_GENSKEL)$(BPFTOOL) gen skeleton $< > $@
1250
1251bpf-skel: $(SKELETONS)
1252
1253.PRECIOUS: $(SKEL_TMP_OUT)/%.bpf.o
1254
1255else # CONFIG_PERF_BPF_SKEL
1256
1257bpf-skel:
1258
1259endif # CONFIG_PERF_BPF_SKEL
1260
1261bpf-skel-clean:
1262	$(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS) $(SKEL_OUT)/vmlinux.h
1263
1264clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean \
1265		arm64-sysreg-defs-clean fixdep-clean python-clean bpf-skel-clean \
1266		tests-coresight-targets-clean
1267	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive \
1268		$(OUTPUT)perf-iostat $(LANG_BINDINGS)
1269	$(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '*.a' -delete -o \
1270		-name '\.*.cmd' -delete -o -name '\.*.d' -delete -o -name '*.shellcheck_log' -delete
1271	$(Q)$(RM) $(OUTPUT).config-detected
1272	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 \
1273		perf-read-vdsox32 $(OUTPUT)$(LIBJVMTI).so
1274	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo \
1275		$(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE \
1276		$(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
1277		$(OUTPUT)util/intel-pt-decoder/inat-tables.c \
1278		$(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c \
1279		$(OUTPUT)pmu-events/pmu-events.c \
1280		$(OUTPUT)pmu-events/metric_test.log \
1281		$(OUTPUT)$(fadvise_advice_array) \
1282		$(OUTPUT)$(fsconfig_arrays) \
1283		$(OUTPUT)$(fsmount_arrays) \
1284		$(OUTPUT)$(fspick_arrays) \
1285		$(OUTPUT)$(madvise_behavior_array) \
1286		$(OUTPUT)$(mmap_flags_array) \
1287		$(OUTPUT)$(mmap_prot_array) \
1288		$(OUTPUT)$(mremap_flags_array) \
1289		$(OUTPUT)$(mount_flags_array) \
1290		$(OUTPUT)$(move_mount_flags_array) \
1291		$(OUTPUT)$(drm_ioctl_array) \
1292		$(OUTPUT)$(pkey_alloc_access_rights_array) \
1293		$(OUTPUT)$(sndrv_ctl_ioctl_array) \
1294		$(OUTPUT)$(sndrv_pcm_ioctl_array) \
1295		$(OUTPUT)$(kvm_ioctl_array) \
1296		$(OUTPUT)$(kcmp_type_array) \
1297		$(OUTPUT)$(socket_arrays) \
1298		$(OUTPUT)$(sockaddr_arrays) \
1299		$(OUTPUT)$(vhost_virtio_ioctl_array) \
1300		$(OUTPUT)$(perf_ioctl_array) \
1301		$(OUTPUT)$(prctl_option_array) \
1302		$(OUTPUT)$(usbdevfs_ioctl_array) \
1303		$(OUTPUT)$(x86_arch_irq_vectors_array) \
1304		$(OUTPUT)$(x86_arch_MSRs_array) \
1305		$(OUTPUT)$(x86_arch_prctl_code_array) \
1306		$(OUTPUT)$(rename_flags_array) \
1307		$(OUTPUT)$(arch_errno_name_array) \
1308		$(OUTPUT)$(sync_file_range_arrays)
1309	$(call QUIET_CLEAN, Documentation) \
1310	$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) clean >/dev/null
1311
1312#
1313# To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY)
1314# file if defined, with no further action.
1315feature-dump:
1316ifdef FEATURE_DUMP_COPY
1317	@cp $(OUTPUT)FEATURE-DUMP $(FEATURE_DUMP_COPY)
1318	@echo "FEATURE-DUMP file copied into $(FEATURE_DUMP_COPY)"
1319else
1320	@echo "FEATURE-DUMP file available in $(OUTPUT)FEATURE-DUMP"
1321endif
1322
1323
1324FORCE:
1325
1326.PHONY: all install clean config-clean strip install-gtk
1327.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
1328.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope FORCE prepare
1329.PHONY: archheaders python_perf_target
1330
1331endif # force_fixdep
1332
1333# Delete partially updated (corrupted) files on error
1334.DELETE_ON_ERROR:
1335