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