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