981 lines · 31.6 KB · Makefile
RawDownload
include ../scripts/Makefile.include # The default target of this Makefile is...all: include config/utilities.mak # Define V to have a more verbose compile.## 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 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.## Define NO_DEMANGLE if you do not want C++ symbol demangling. $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE	@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)-include $(OUTPUT)PERF-VERSION-FILE uname_M := $(shell uname -m 2>/dev/null || echo not) ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \				  -e s/arm.*/arm/ -e s/sa110/arm/ \				  -e s/s390x/s390/ -e s/parisc64/parisc/ \				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \				  -e s/sh[234].*/sh/ ) CC = $(CROSS_COMPILE)gccAR = $(CROSS_COMPILE)ar # Additional ARCH settings for x86ifeq ($(ARCH),i386)        ARCH := x86endififeq ($(ARCH),x86_64)	ARCH := x86	IS_X86_64 := 0	ifeq (, $(findstring m32,$(EXTRA_CFLAGS)))		IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1)	endif	ifeq (${IS_X86_64}, 1)		RAW_ARCH := x86_64		ARCH_CFLAGS := -DARCH_X86_64		ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S	endifendif # Treat warnings as errors unless directed not toifneq ($(WERROR),0)	CFLAGS_WERROR := -Werrorendif ifeq ("$(origin DEBUG)", "command line")  PERF_DEBUG = $(DEBUG)endififndef PERF_DEBUG  CFLAGS_OPTIMIZE = -O6 -D_FORTIFY_SOURCE=2endif ifdef PARSER_DEBUG	PARSER_DEBUG_BISON  := -t	PARSER_DEBUG_FLEX   := -d	PARSER_DEBUG_CFLAGS := -DPARSER_DEBUGendif CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)EXTLIBS = -lpthread -lrt -lelf -lmALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCEALL_LDFLAGS = $(LDFLAGS)STRIP ?= strip # Among the variables below, these:#   perfexecdir#   template_dir#   mandir#   infodir#   htmldir#   ETC_PERFCONFIG (but not sysconfdir)# can be specified as a relative path some/where/else;# this is interpreted as relative to $(prefix) and "perf" at# runtime figures out where they are based on the path to the executable.# This can help installing the suite in a relocatable way. # Make the path relative to DESTDIR, not to prefixifndef DESTDIRprefix = $(HOME)endifbindir_relative = binbindir = $(prefix)/$(bindir_relative)mandir = share/maninfodir = share/infoperfexecdir = libexec/perf-coresharedir = $(prefix)/sharetemplate_dir = share/perf-core/templateshtmldir = share/doc/perf-docifeq ($(prefix),/usr)sysconfdir = /etcETC_PERFCONFIG = $(sysconfdir)/perfconfigelsesysconfdir = $(prefix)/etcETC_PERFCONFIG = etc/perfconfigendiflib = lib export prefix bindir sharedir sysconfdir RM = rm -fMKDIR = mkdirFIND = findINSTALL = install # 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__ -include config/feature-tests.mak ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -fstack-protector-all),y)	CFLAGS := $(CFLAGS) -fstack-protector-allendif ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wstack-protector),y)       CFLAGS := $(CFLAGS) -Wstack-protectorendif ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wvolatile-register-var),y)       CFLAGS := $(CFLAGS) -Wvolatile-register-varendif ### --- END CONFIGURATION SECTION --- BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)/util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCEBASIC_LDFLAGS = # Guard against environment variablesBUILTIN_OBJS =LIB_H =LIB_OBJS =PYRF_OBJS =SCRIPT_SH = SCRIPT_SH += perf-archive.sh grep-libs = $(filter -l%,$(1))strip-libs = $(filter-out -l%,$(1)) PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(OUTPUT)python/perf.so: $(PYRF_OBJS) $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)	$(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \	  --quiet build_ext; \	mkdir -p $(OUTPUT)python && \	cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/## No Perl scripts right now:# SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) TRACE_EVENT_DIR = ../lib/traceevent/ ifeq ("$(origin O)", "command line")	TE_PATH=$(OUTPUT)/else	TE_PATH=$(TRACE_EVENT_DIR)/endif LIBTRACEEVENT = $(TE_PATH)libtraceevent.aTE_LIB := -L$(TE_PATH) -ltraceevent ## Single 'perf' binary right now:#PROGRAMS += $(OUTPUT)perf LANG_BINDINGS = # 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 FLEX = flexBISON= bison $(OUTPUT)util/parse-events-flex.c: util/parse-events.l	$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c: util/parse-events.y	$(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c $(OUTPUT)util/pmu-flex.c: util/pmu.l	$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c: util/pmu.y	$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c LIB_FILE=$(OUTPUT)libperf.a LIB_H += ../../include/linux/perf_event.hLIB_H += ../../include/linux/rbtree.hLIB_H += ../../include/linux/list.hLIB_H += ../../include/linux/const.hLIB_H += ../../include/linux/hash.hLIB_H += ../../include/linux/stringify.hLIB_H += util/include/linux/bitmap.hLIB_H += util/include/linux/bitops.hLIB_H += util/include/linux/compiler.hLIB_H += util/include/linux/const.hLIB_H += util/include/linux/ctype.hLIB_H += util/include/linux/kernel.hLIB_H += util/include/linux/list.hLIB_H += util/include/linux/export.hLIB_H += util/include/linux/poison.hLIB_H += util/include/linux/prefetch.hLIB_H += util/include/linux/rbtree.hLIB_H += util/include/linux/string.hLIB_H += util/include/linux/types.hLIB_H += util/include/linux/linkage.hLIB_H += util/include/asm/asm-offsets.hLIB_H += util/include/asm/bug.hLIB_H += util/include/asm/byteorder.hLIB_H += util/include/asm/hweight.hLIB_H += util/include/asm/swab.hLIB_H += util/include/asm/system.hLIB_H += util/include/asm/uaccess.hLIB_H += util/include/dwarf-regs.hLIB_H += util/include/asm/dwarf2.hLIB_H += util/include/asm/cpufeature.hLIB_H += util/include/asm/unistd_32.hLIB_H += util/include/asm/unistd_64.hLIB_H += perf.hLIB_H += util/annotate.hLIB_H += util/cache.hLIB_H += util/callchain.hLIB_H += util/build-id.hLIB_H += util/debug.hLIB_H += util/debugfs.hLIB_H += util/sysfs.hLIB_H += util/pmu.hLIB_H += util/event.hLIB_H += util/evsel.hLIB_H += util/evlist.hLIB_H += util/exec_cmd.hLIB_H += util/types.hLIB_H += util/levenshtein.hLIB_H += util/map.hLIB_H += util/parse-options.hLIB_H += util/parse-events.hLIB_H += util/quote.hLIB_H += util/util.hLIB_H += util/xyarray.hLIB_H += util/header.hLIB_H += util/help.hLIB_H += util/session.hLIB_H += util/strbuf.hLIB_H += util/strlist.hLIB_H += util/strfilter.hLIB_H += util/svghelper.hLIB_H += util/tool.hLIB_H += util/run-command.hLIB_H += util/sigchain.hLIB_H += util/symbol.hLIB_H += util/color.hLIB_H += util/values.hLIB_H += util/sort.hLIB_H += util/hist.hLIB_H += util/thread.hLIB_H += util/thread_map.hLIB_H += util/trace-event.hLIB_H += util/probe-finder.hLIB_H += util/dwarf-aux.hLIB_H += util/probe-event.hLIB_H += util/pstack.hLIB_H += util/cpumap.hLIB_H += util/top.hLIB_H += $(ARCH_INCLUDE)LIB_H += util/cgroup.hLIB_H += $(TRACE_EVENT_DIR)event-parse.hLIB_H += util/target.h LIB_OBJS += $(OUTPUT)util/abspath.oLIB_OBJS += $(OUTPUT)util/alias.oLIB_OBJS += $(OUTPUT)util/annotate.oLIB_OBJS += $(OUTPUT)util/build-id.oLIB_OBJS += $(OUTPUT)util/config.oLIB_OBJS += $(OUTPUT)util/ctype.oLIB_OBJS += $(OUTPUT)util/debugfs.oLIB_OBJS += $(OUTPUT)util/sysfs.oLIB_OBJS += $(OUTPUT)util/pmu.oLIB_OBJS += $(OUTPUT)util/environment.oLIB_OBJS += $(OUTPUT)util/event.oLIB_OBJS += $(OUTPUT)util/evlist.oLIB_OBJS += $(OUTPUT)util/evsel.oLIB_OBJS += $(OUTPUT)util/exec_cmd.oLIB_OBJS += $(OUTPUT)util/help.oLIB_OBJS += $(OUTPUT)util/levenshtein.oLIB_OBJS += $(OUTPUT)util/parse-options.oLIB_OBJS += $(OUTPUT)util/parse-events.oLIB_OBJS += $(OUTPUT)util/parse-events-test.oLIB_OBJS += $(OUTPUT)util/path.oLIB_OBJS += $(OUTPUT)util/rbtree.oLIB_OBJS += $(OUTPUT)util/bitmap.oLIB_OBJS += $(OUTPUT)util/hweight.oLIB_OBJS += $(OUTPUT)util/run-command.oLIB_OBJS += $(OUTPUT)util/quote.oLIB_OBJS += $(OUTPUT)util/strbuf.oLIB_OBJS += $(OUTPUT)util/string.oLIB_OBJS += $(OUTPUT)util/strlist.oLIB_OBJS += $(OUTPUT)util/strfilter.oLIB_OBJS += $(OUTPUT)util/top.oLIB_OBJS += $(OUTPUT)util/usage.oLIB_OBJS += $(OUTPUT)util/wrapper.oLIB_OBJS += $(OUTPUT)util/sigchain.oLIB_OBJS += $(OUTPUT)util/symbol.oLIB_OBJS += $(OUTPUT)util/color.oLIB_OBJS += $(OUTPUT)util/pager.oLIB_OBJS += $(OUTPUT)util/header.oLIB_OBJS += $(OUTPUT)util/callchain.oLIB_OBJS += $(OUTPUT)util/values.oLIB_OBJS += $(OUTPUT)util/debug.oLIB_OBJS += $(OUTPUT)util/map.oLIB_OBJS += $(OUTPUT)util/pstack.oLIB_OBJS += $(OUTPUT)util/session.oLIB_OBJS += $(OUTPUT)util/thread.oLIB_OBJS += $(OUTPUT)util/thread_map.oLIB_OBJS += $(OUTPUT)util/trace-event-parse.oLIB_OBJS += $(OUTPUT)util/parse-events-flex.oLIB_OBJS += $(OUTPUT)util/parse-events-bison.oLIB_OBJS += $(OUTPUT)util/pmu-flex.oLIB_OBJS += $(OUTPUT)util/pmu-bison.oLIB_OBJS += $(OUTPUT)util/trace-event-read.oLIB_OBJS += $(OUTPUT)util/trace-event-info.oLIB_OBJS += $(OUTPUT)util/trace-event-scripting.oLIB_OBJS += $(OUTPUT)util/svghelper.oLIB_OBJS += $(OUTPUT)util/sort.oLIB_OBJS += $(OUTPUT)util/hist.oLIB_OBJS += $(OUTPUT)util/probe-event.oLIB_OBJS += $(OUTPUT)util/util.oLIB_OBJS += $(OUTPUT)util/xyarray.oLIB_OBJS += $(OUTPUT)util/cpumap.oLIB_OBJS += $(OUTPUT)util/cgroup.oLIB_OBJS += $(OUTPUT)util/target.o BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o BUILTIN_OBJS += $(OUTPUT)builtin-bench.o # Benchmark modulesBUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.oBUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.oifeq ($(RAW_ARCH),x86_64)BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.oBUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.oendifBUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.oBUILTIN_OBJS += $(OUTPUT)bench/mem-memset.o BUILTIN_OBJS += $(OUTPUT)builtin-diff.oBUILTIN_OBJS += $(OUTPUT)builtin-evlist.oBUILTIN_OBJS += $(OUTPUT)builtin-help.oBUILTIN_OBJS += $(OUTPUT)builtin-sched.oBUILTIN_OBJS += $(OUTPUT)builtin-buildid-list.oBUILTIN_OBJS += $(OUTPUT)builtin-buildid-cache.oBUILTIN_OBJS += $(OUTPUT)builtin-list.oBUILTIN_OBJS += $(OUTPUT)builtin-record.oBUILTIN_OBJS += $(OUTPUT)builtin-report.oBUILTIN_OBJS += $(OUTPUT)builtin-stat.oBUILTIN_OBJS += $(OUTPUT)builtin-timechart.oBUILTIN_OBJS += $(OUTPUT)builtin-top.oBUILTIN_OBJS += $(OUTPUT)builtin-script.oBUILTIN_OBJS += $(OUTPUT)builtin-probe.oBUILTIN_OBJS += $(OUTPUT)builtin-kmem.oBUILTIN_OBJS += $(OUTPUT)builtin-lock.oBUILTIN_OBJS += $(OUTPUT)builtin-kvm.oBUILTIN_OBJS += $(OUTPUT)builtin-test.oBUILTIN_OBJS += $(OUTPUT)builtin-inject.o PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT) # Files needed for the python binding, perf.so# pyrf is just an internal name needed for all those wrappers.# This has to be in sync with what is in the 'sources' variable in# tools/perf/util/setup.py PYRF_OBJS += $(OUTPUT)util/cpumap.oPYRF_OBJS += $(OUTPUT)util/ctype.oPYRF_OBJS += $(OUTPUT)util/evlist.oPYRF_OBJS += $(OUTPUT)util/evsel.oPYRF_OBJS += $(OUTPUT)util/python.oPYRF_OBJS += $(OUTPUT)util/thread_map.oPYRF_OBJS += $(OUTPUT)util/util.oPYRF_OBJS += $(OUTPUT)util/xyarray.o ## Platform specific tweaks# # 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... -include config.mak.autogen-include config.mak ifndef NO_DWARFFLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS)ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y)	msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);	NO_DWARF := 1endif # Dwarf supportendif # NO_DWARF -include arch/$(ARCH)/Makefile ifneq ($(OUTPUT),)	BASIC_CFLAGS += -I$(OUTPUT)endif FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y)	FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)	ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y)		msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);	else		msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel);	endifendif ifneq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y)	BASIC_CFLAGS += -DLIBELF_NO_MMAPendif ifndef NO_DWARFifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)	msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);else	BASIC_CFLAGS += -DDWARF_SUPPORT	EXTLIBS += -lelf -ldw	LIB_OBJS += $(OUTPUT)util/probe-finder.o	LIB_OBJS += $(OUTPUT)util/dwarf-aux.oendif # PERF_HAVE_DWARF_REGSendif # NO_DWARF ifdef NO_NEWT	BASIC_CFLAGS += -DNO_NEWT_SUPPORTelse	FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt	ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y)		msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);		BASIC_CFLAGS += -DNO_NEWT_SUPPORT	else		# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h		BASIC_CFLAGS += -I/usr/include/slang		EXTLIBS += -lnewt -lslang		LIB_OBJS += $(OUTPUT)ui/setup.o		LIB_OBJS += $(OUTPUT)ui/browser.o		LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o		LIB_OBJS += $(OUTPUT)ui/browsers/hists.o

Lines 1–500 of 981.