1061 lines · 37.0 KB · Text
RawDownload
# SPDX-License-Identifier: GPL-2.0-onlyinclude ../scripts/Makefile.includeinclude ../scripts/Makefile.arch # The default target of this Makefile is...all: include ../scripts/utilities.mak # Define V to have a more verbose compile.## Define VF to have a more verbose feature check output.## Define O to save output files in a separate directory.## Define ARCH as name of target architecture if you want cross-builds.## Define CROSS_COMPILE as prefix name of compiler if you want cross-builds.## Define NO_LIBPERL to disable perl script extension.## Define NO_LIBPYTHON to disable python script extension.## Define PYTHON to point to the python binary if the default# `python' is not correct; for example: PYTHON=python2## Define PYTHON_CONFIG to point to the python-config binary if# the default `$(PYTHON)-config' is not correct.## Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8## Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.## Define LDFLAGS=-static to build a static binary.## Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.## Define EXCLUDE_EXTLIBS=-lmylib to exclude libmylib from the auto-generated# EXTLIBS.## Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS.## Define NO_DWARF if you do not want debug-info analysis feature at all.## Define WERROR=0 to disable treating any warnings as errors.## Define NO_NEWT if you do not want TUI support. (deprecated)## Define NO_SLANG if you do not want TUI support.## Define NO_GTK2 if you do not want GTK+ GUI support.## Define NO_DEMANGLE if you do not want C++ symbol demangling.## Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)## Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf# backtrace post unwind.## Define NO_BACKTRACE if you do not want stack backtrace debug feature## Define NO_LIBNUMA if you do not want numa perf benchmark## Define NO_LIBAUDIT if you do not want libaudit support## Define NO_LIBBIONIC if you do not want bionic support## Define NO_LIBCRYPTO if you do not want libcrypto (openssl) support# used for generating build-ids for ELFs generated by jitdump.## Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support# for dwarf backtrace post unwind.## Define NO_PERF_READ_VDSO32 if you do not want to build perf-read-vdso32# for reading the 32-bit compatibility VDSO in 64-bit mode## Define NO_PERF_READ_VDSOX32 if you do not want to build perf-read-vdsox32# for reading the x32 mode 32-bit compatibility VDSO in 64-bit mode## Define NO_ZLIB if you do not want to support compressed kernel modules## Define NO_LIBBABELTRACE if you do not want libbabeltrace support# for CTF data format.## Define NO_LZMA if you do not want to support compressed (xz) kernel modules## Define NO_AUXTRACE if you do not want AUX area tracing support## Define NO_LIBBPF if you do not want BPF support## Define NO_LIBCAP if you do not want process capabilities considered by perf## Define NO_SDT if you do not want to define SDT event in perf tools,# note that it doesn't disable SDT scanning support.## Define FEATURES_DUMP to provide features detection dump file# and bypass the feature detection## Define NO_JVMTI if you do not want jvmti agent built## Define NO_JVMTI_CMLR (debug only) if you do not want to process CMLR# data for java source lines.## Define LIBCLANGLLVM if you DO want builtin clang and llvm support.# When selected, pass LLVM_CONFIG=/path/to/llvm-config to `make' if# llvm-config is not in $PATH.## Define CORESIGHT if you DO WANT support for CoreSight trace decoding.## Define NO_AIO if you do not want support of Posix AIO based trace# streaming for record mode. Currently Posix AIO trace streaming is# supported only when linking with glibc.## Define NO_LIBZSTD if you do not want support of Zstandard based runtime# trace compression in record mode.## Define TCMALLOC to enable tcmalloc heap profiling.## Define LIBBPF_DYNAMIC to enable libbpf dynamic linking.## Define NO_SYSCALL_TABLE=1 to disable the use of syscall id to/from name tables# generated from the kernel .tbl or unistd.h files and use, if available, libaudit# for doing the conversions to/from strings/id.## Define LIBPFM4 to enable libpfm4 events extension.## Define NO_LIBDEBUGINFOD if you do not want support debuginfod# # As per kernel Makefile, avoid funny character set dependenciesunexport LC_ALLLC_COLLATE=CLC_NUMERIC=Cexport LC_COLLATE LC_NUMERIC ifeq ($(srctree),)srctree := $(patsubst %/,%,$(dir $(CURDIR)))srctree := $(patsubst %/,%,$(dir $(srctree)))#$(info Determined 'srctree' to be $(srctree))endif ifneq ($(objtree),)#$(info Determined 'objtree' to be $(objtree))endif ifneq ($(OUTPUT),)#$(info Determined 'OUTPUT' to be $(OUTPUT))# Adding $(OUTPUT) as a directory to look for source files,# because use generated output files as sources dependency# for flex/bison parsers.VPATH += $(OUTPUT)export VPATHendif ifeq ($(V),1)  Q =else  Q = @endif # Do not use make's built-in rules# (this improves performance and avoids hard-to-debug behaviour);MAKEFLAGS += -r # Makefiles suck: This macro sets a default value of $(2) for the# variable named by $(1), unless the variable has been set by# environment or command line. This is necessary for CC and AR# because make sets default values, so the simpler ?= approach# won't work as expected.define allow-override  $(if $(or $(findstring environment,$(origin $(1))),\            $(findstring command line,$(origin $(1)))),,\    $(eval $(1) = $(2)))endef LD += $(EXTRA_LDFLAGS) HOSTCC  ?= gccHOSTLD  ?= ldHOSTAR  ?= ar PKG_CONFIG = $(CROSS_COMPILE)pkg-configLLVM_CONFIG ?= llvm-config RM      = rm -fLN      = ln -fMKDIR   = mkdirFIND    = findINSTALL = installFLEX    ?= flexBISON   ?= bisonSTRIP   = stripAWK     = awk # include Makefile.config by default and rule out# non-config casesconfig := 1 NON_CONFIG_TARGETS := clean python-clean TAGS tags cscope help ifdef MAKECMDGOALSifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)  config := 0endifendif # The fixdep build - we force fixdep tool to be built as# the first target in the separate make session not to be# disturbed by any parallel make jobs. Once fixdep is done# we issue the requested build with FIXDEP=1 variable.## The fixdep build is disabled for $(NON_CONFIG_TARGETS)# targets, because it's not necessary. ifdef FIXDEP  force_fixdep := 0else  force_fixdep := $(config)endif export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWKexport HOSTCC HOSTLD HOSTAR include $(srctree)/tools/build/Makefile.include ifeq ($(force_fixdep),1)goals := $(filter-out all sub-make, $(MAKECMDGOALS)) $(goals) all: sub-make sub-make: fixdep	@./check-headers.sh	$(Q)$(MAKE) FIXDEP=1 -f Makefile.perf $(goals) else # force_fixdep LIB_DIR         = $(srctree)/tools/lib/api/TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/BPF_DIR         = $(srctree)/tools/lib/bpf/SUBCMD_DIR      = $(srctree)/tools/lib/subcmd/LIBPERF_DIR     = $(srctree)/tools/lib/perf/DOC_DIR         = $(srctree)/tools/perf/Documentation/ # Set FEATURE_TESTS to 'all' so all possible feature checkers are executed.# Without this setting the output feature dump file misses some features, for# example, liberty. Select all checkers so we won't get an incomplete feature# dump file.ifeq ($(config),1)ifdef MAKECMDGOALSifeq ($(filter feature-dump,$(MAKECMDGOALS)),feature-dump)FEATURE_TESTS := allendifendifinclude Makefile.configendif ifeq ($(config),0)include $(srctree)/tools/scripts/Makefile.arch-include arch/$(SRCARCH)/Makefileendif # The FEATURE_DUMP_EXPORT holds location of the actual# FEATURE_DUMP file to be used to bypass feature detection# (for bpf or any other subproject)ifeq ($(FEATURES_DUMP),)FEATURE_DUMP_EXPORT := $(realpath $(OUTPUT)FEATURE-DUMP)elseFEATURE_DUMP_EXPORT := $(realpath $(FEATURES_DUMP))endif export prefix bindir sharedir sysconfdir DESTDIR # sparse is architecture-neutral, which means that we need to tell it# explicitly what architecture to check for. Fix this up for yours..SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ # Guard against environment variablesPYRF_OBJS =SCRIPT_SH = SCRIPT_SH += perf-archive.shSCRIPT_SH += perf-with-kcore.sh grep-libs = $(filter -l%,$(1))strip-libs = $(filter-out -l%,$(1)) ifneq ($(OUTPUT),)  TE_PATH=$(OUTPUT)  PLUGINS_PATH=$(OUTPUT)  BPF_PATH=$(OUTPUT)  SUBCMD_PATH=$(OUTPUT)  LIBPERF_PATH=$(OUTPUT)ifneq ($(subdir),)  API_PATH=$(OUTPUT)/../lib/api/else  API_PATH=$(OUTPUT)endifelse  TE_PATH=$(TRACE_EVENT_DIR)  PLUGINS_PATH=$(TRACE_EVENT_DIR)plugins/  API_PATH=$(LIB_DIR)  BPF_PATH=$(BPF_DIR)  SUBCMD_PATH=$(SUBCMD_DIR)  LIBPERF_PATH=$(LIBPERF_DIR)endif LIBTRACEEVENT = $(TE_PATH)libtraceevent.aexport LIBTRACEEVENT LIBTRACEEVENT_DYNAMIC_LIST = $(PLUGINS_PATH)libtraceevent-dynamic-list ## The static build has no dynsym table, so this does not work for# static build. Looks like linker starts to scream about that now# (in Fedora 26) so we need to switch it off for static build.DYNAMIC_LIST_LDFLAGS               = -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST)LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = $(if $(findstring -static,$(LDFLAGS)),,$(DYNAMIC_LIST_LDFLAGS)) LIBAPI = $(API_PATH)libapi.aexport LIBAPI LIBBPF = $(BPF_PATH)libbpf.a LIBSUBCMD = $(SUBCMD_PATH)libsubcmd.a LIBPERF = $(LIBPERF_PATH)libperf.aexport LIBPERF # python extension build directoriesPYTHON_EXTBUILD     := $(OUTPUT)python_ext_build/PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPI) SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) PROGRAMS += $(OUTPUT)perf ifndef NO_PERF_READ_VDSO32PROGRAMS += $(OUTPUT)perf-read-vdso32endif ifndef NO_PERF_READ_VDSOX32PROGRAMS += $(OUTPUT)perf-read-vdsox32endif LIBJVMTI = libperf-jvmti.so ifndef NO_JVMTIPROGRAMS += $(OUTPUT)$(LIBJVMTI)endif # what 'all' will build and 'install' will install, in perfexecdirALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) # what 'all' will build but not install in perfexecdirOTHER_PROGRAMS = $(OUTPUT)perf # Set paths to tools early so that they can be used for version tests.ifndef SHELL_PATH  SHELL_PATH = /bin/shendififndef PERL_PATH  PERL_PATH = /usr/bin/perlendif export PERL_PATH PERFLIBS = $(LIBAPI) $(LIBTRACEEVENT) $(LIBSUBCMD) $(LIBPERF)ifndef NO_LIBBPF  ifndef LIBBPF_DYNAMIC    PERFLIBS += $(LIBBPF)  endifendif # We choose to avoid "if .. else if .. else .. endif endif"# because maintaining the nesting to match is a pain.  If# we had "elif" things would have been much nicer... ifneq ($(OUTPUT),)  CFLAGS += -I$(OUTPUT)endif ifndef NO_GTK2  ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so  GTK_IN := $(OUTPUT)gtk-in.oendif ifdef ASCIIDOC8  export ASCIIDOC8endif EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS))LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group ifeq ($(USE_CLANG), 1)  CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization  CLANGLIBS_NOEXT_LIST = $(foreach l,$(CLANGLIBS_LIST),$(shell $(LLVM_CONFIG) --libdir)/libclang$(l))  LIBCLANG = $(foreach l,$(CLANGLIBS_NOEXT_LIST),$(wildcard $(l).a $(l).so))  LIBS += -Wl,--start-group $(LIBCLANG) -Wl,--end-groupendif ifeq ($(USE_LLVM), 1)  LIBLLVM = $(shell $(LLVM_CONFIG) --libs all) $(shell $(LLVM_CONFIG) --system-libs)  LIBS += -L$(shell $(LLVM_CONFIG) --libdir) $(LIBLLVM)endif ifeq ($(USE_CXX), 1)  LIBS += -lstdc++endif export INSTALL SHELL_PATH ### Build rules SHELL = $(SHELL_PATH) beauty_linux_dir := $(srctree)/tools/perf/trace/beauty/include/linux/linux_uapi_dir := $(srctree)/tools/include/uapi/linuxasm_generic_uapi_dir := $(srctree)/tools/include/uapi/asm-genericarch_asm_uapi_dir := $(srctree)/tools/arch/$(SRCARCH)/include/uapi/asm/x86_arch_asm_uapi_dir := $(srctree)/tools/arch/x86/include/uapi/asm/x86_arch_asm_dir := $(srctree)/tools/arch/x86/include/asm/ beauty_outdir := $(OUTPUT)trace/beauty/generatedbeauty_ioctl_outdir := $(beauty_outdir)/ioctldrm_ioctl_array := $(beauty_ioctl_outdir)/drm_ioctl_array.cdrm_hdr_dir := $(srctree)/tools/include/uapi/drmdrm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/drm_ioctl.sh # Create output directory if not already present_dummy := $(shell [ -d '$(beauty_ioctl_outdir)' ] || mkdir -p '$(beauty_ioctl_outdir)') $(drm_ioctl_array): $(drm_hdr_dir)/drm.h $(drm_hdr_dir)/i915_drm.h $(drm_ioctl_tbl)	$(Q)$(SHELL) '$(drm_ioctl_tbl)' $(drm_hdr_dir) > $@ fadvise_advice_array := $(beauty_outdir)/fadvise_advice_array.cfadvise_advice_tbl := $(srctree)/tools/perf/trace/beauty/fadvise.sh $(fadvise_advice_array): $(linux_uapi_dir)/in.h $(fadvise_advice_tbl)	$(Q)$(SHELL) '$(fadvise_advice_tbl)' $(linux_uapi_dir) > $@ fsmount_arrays := $(beauty_outdir)/fsmount_arrays.cfsmount_tbls := $(srctree)/tools/perf/trace/beauty/fsmount.sh $(fsmount_arrays): $(linux_uapi_dir)/fs.h $(fsmount_tbls)	$(Q)$(SHELL) '$(fsmount_tbls)' $(linux_uapi_dir) > $@ fspick_arrays := $(beauty_outdir)/fspick_arrays.cfspick_tbls := $(srctree)/tools/perf/trace/beauty/fspick.sh $(fspick_arrays): $(linux_uapi_dir)/fs.h $(fspick_tbls)	$(Q)$(SHELL) '$(fspick_tbls)' $(linux_uapi_dir) > $@ fsconfig_arrays := $(beauty_outdir)/fsconfig_arrays.cfsconfig_tbls := $(srctree)/tools/perf/trace/beauty/fsconfig.sh $(fsconfig_arrays): $(linux_uapi_dir)/fs.h $(fsconfig_tbls)	$(Q)$(SHELL) '$(fsconfig_tbls)' $(linux_uapi_dir) > $@ pkey_alloc_access_rights_array := $(beauty_outdir)/pkey_alloc_access_rights_array.casm_generic_hdr_dir := $(srctree)/tools/include/uapi/asm-generic/pkey_alloc_access_rights_tbl := $(srctree)/tools/perf/trace/beauty/pkey_alloc_access_rights.sh $(pkey_alloc_access_rights_array): $(asm_generic_hdr_dir)/mman-common.h $(pkey_alloc_access_rights_tbl)	$(Q)$(SHELL) '$(pkey_alloc_access_rights_tbl)' $(asm_generic_hdr_dir) > $@ sndrv_ctl_ioctl_array := $(beauty_ioctl_outdir)/sndrv_ctl_ioctl_array.csndrv_ctl_hdr_dir := $(srctree)/tools/include/uapi/soundsndrv_ctl_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/sndrv_ctl_ioctl.sh $(sndrv_ctl_ioctl_array): $(sndrv_ctl_hdr_dir)/asound.h $(sndrv_ctl_ioctl_tbl)	$(Q)$(SHELL) '$(sndrv_ctl_ioctl_tbl)' $(sndrv_ctl_hdr_dir) > $@ sndrv_pcm_ioctl_array := $(beauty_ioctl_outdir)/sndrv_pcm_ioctl_array.csndrv_pcm_hdr_dir := $(srctree)/tools/include/uapi/soundsndrv_pcm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/sndrv_pcm_ioctl.sh $(sndrv_pcm_ioctl_array): $(sndrv_pcm_hdr_dir)/asound.h $(sndrv_pcm_ioctl_tbl)	$(Q)$(SHELL) '$(sndrv_pcm_ioctl_tbl)' $(sndrv_pcm_hdr_dir) > $@ kcmp_type_array := $(beauty_outdir)/kcmp_type_array.ckcmp_hdr_dir := $(srctree)/tools/include/uapi/linux/kcmp_type_tbl := $(srctree)/tools/perf/trace/beauty/kcmp_type.sh $(kcmp_type_array): $(kcmp_hdr_dir)/kcmp.h $(kcmp_type_tbl)	$(Q)$(SHELL) '$(kcmp_type_tbl)' $(kcmp_hdr_dir) > $@ kvm_ioctl_array := $(beauty_ioctl_outdir)/kvm_ioctl_array.ckvm_hdr_dir := $(srctree)/tools/include/uapi/linuxkvm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/kvm_ioctl.sh $(kvm_ioctl_array): $(kvm_hdr_dir)/kvm.h $(kvm_ioctl_tbl)	$(Q)$(SHELL) '$(kvm_ioctl_tbl)' $(kvm_hdr_dir) > $@ 

Lines 1–500 of 1061.