ifeq ("$(origin O)", "command line") OUTPUT := $(O)/endif # The default target of this Makefile is...all: include config/utilities.mak ifneq ($(OUTPUT),)# check that the output directory actually existsOUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))endif # Define V to have a more verbose compile.## 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. $(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 endifendif # Treat warnings as errors unless directed not toifneq ($(WERROR),0) CFLAGS_WERROR := -Werrorendif ## Include saner warnings here, which can catch bugs:# EXTRA_WARNINGS := -WformatEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-securityEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2kEXTRA_WARNINGS := $(EXTRA_WARNINGS) -WshadowEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-selfEXTRA_WARNINGS := $(EXTRA_WARNINGS) -WpackedEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-declsEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-defaultEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enumEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headersEXTRA_WARNINGS := $(EXTRA_WARNINGS) -WundefEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-stringsEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-castEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarationsEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypesEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externsEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definitionEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypesEXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement ifeq ("$(origin DEBUG)", "command line") PERF_DEBUG = $(DEBUG)endififndef PERF_DEBUG CFLAGS_OPTIMIZE = -O6endif CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)EXTLIBS = -lpthread -lrt -lelf -lmALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64ALL_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 --- # Those must not be GNU-specific; they are shared with perl/ which may# be built by a different compiler. (Note that this is an artifact now# but it still might be nice to keep that distinction.)BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/includeBASIC_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)) $(OUTPUT)python/perf.so: $(PYRF_OBJS) $(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)) ## 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 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/module.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 += 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/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/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.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/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/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/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.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.oendifBUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.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) # 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)util/ui/setup.o LIB_OBJS += $(OUTPUT)util/ui/browser.o LIB_OBJS += $(OUTPUT)util/ui/browsers/annotate.o LIB_OBJS += $(OUTPUT)util/ui/browsers/hists.o LIB_OBJS += $(OUTPUT)util/ui/browsers/map.o LIB_OBJS += $(OUTPUT)util/ui/helpline.o LIB_OBJS += $(OUTPUT)util/ui/progress.o LIB_OBJS += $(OUTPUT)util/ui/util.o LIB_H += util/ui/browser.h LIB_H += util/ui/browsers/map.h LIB_H += util/ui/helpline.h LIB_H += util/ui/keysyms.h LIB_H += util/ui/libslang.h LIB_H += util/ui/progress.h LIB_H += util/ui/util.h LIB_H += util/ui/ui.h endifendif ifdef NO_LIBPERL BASIC_CFLAGS += -DNO_LIBPERLelse PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED)),y) BASIC_CFLAGS += -DNO_LIBPERL else ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS) EXTLIBS += $(PERL_EMBED_LIBADD) LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o endifendifLines 1–500 of 918. Load more
ifeq ("$(origin O)", "command line") OUTPUT := $(O)/ endif # The default target of this Makefile is... all: include config/utilities.mak ifneq ($(OUTPUT),) # check that the output directory actually exists OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) endif # Define V to have a more verbose compile. # # 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. $(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)gcc AR = $(CROSS_COMPILE)ar # Additional ARCH settings for x86 ifeq ($(ARCH),i386) ARCH := x86 endif ifeq ($(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 endif endif # Treat warnings as errors unless directed not to ifneq ($(WERROR),0) CFLAGS_WERROR := -Werror endif # # Include saner warnings here, which can catch bugs: # EXTRA_WARNINGS := -Wformat EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement ifeq ("$(origin DEBUG)", "command line") PERF_DEBUG = $(DEBUG) endif ifndef PERF_DEBUG CFLAGS_OPTIMIZE = -O6 endif CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) EXTLIBS = -lpthread -lrt -lelf -lm ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ALL_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 prefix ifndef DESTDIR prefix = $(HOME) endif bindir_relative = bin bindir = $(prefix)/$(bindir_relative) mandir = share/man infodir = share/info perfexecdir = libexec/perf-core sharedir = $(prefix)/share template_dir = share/perf-core/templates htmldir = share/doc/perf-doc ifeq ($(prefix),/usr) sysconfdir = /etc ETC_PERFCONFIG = $(sysconfdir)/perfconfig else sysconfdir = $(prefix)/etc ETC_PERFCONFIG = etc/perfconfig endif lib = lib export prefix bindir sharedir sysconfdir RM = rm -f MKDIR = mkdir FIND = find INSTALL = 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-all endif ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wstack-protector),y) CFLAGS := $(CFLAGS) -Wstack-protector endif ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wvolatile-register-var),y) CFLAGS := $(CFLAGS) -Wvolatile-register-var endif ### --- END CONFIGURATION SECTION --- # Those must not be GNU-specific; they are shared with perl/ which may # be built by a different compiler. (Note that this is an artifact now # but it still might be nice to keep that distinction.) BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include BASIC_LDFLAGS = # Guard against environment variables BUILTIN_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)) $(OUTPUT)python/perf.so: $(PYRF_OBJS) $(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)) # # Single 'perf' binary right now: # PROGRAMS += $(OUTPUT)perf LANG_BINDINGS = # what 'all' will build and 'install' will install, in perfexecdir ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) # what 'all' will build but not install in perfexecdir OTHER_PROGRAMS = $(OUTPUT)perf # Set paths to tools early so that they can be used for version tests. ifndef SHELL_PATH SHELL_PATH = /bin/sh endif ifndef PERL_PATH PERL_PATH = /usr/bin/perl endif export PERL_PATH LIB_FILE=$(OUTPUT)libperf.a LIB_H += ../../include/linux/perf_event.h LIB_H += ../../include/linux/rbtree.h LIB_H += ../../include/linux/list.h LIB_H += ../../include/linux/const.h LIB_H += ../../include/linux/hash.h LIB_H += ../../include/linux/stringify.h LIB_H += util/include/linux/bitmap.h LIB_H += util/include/linux/bitops.h LIB_H += util/include/linux/compiler.h LIB_H += util/include/linux/const.h LIB_H += util/include/linux/ctype.h LIB_H += util/include/linux/kernel.h LIB_H += util/include/linux/list.h LIB_H += util/include/linux/module.h LIB_H += util/include/linux/poison.h LIB_H += util/include/linux/prefetch.h LIB_H += util/include/linux/rbtree.h LIB_H += util/include/linux/string.h LIB_H += util/include/linux/types.h LIB_H += util/include/linux/linkage.h LIB_H += util/include/asm/asm-offsets.h LIB_H += util/include/asm/bug.h LIB_H += util/include/asm/byteorder.h LIB_H += util/include/asm/hweight.h LIB_H += util/include/asm/swab.h LIB_H += util/include/asm/system.h LIB_H += util/include/asm/uaccess.h LIB_H += util/include/dwarf-regs.h LIB_H += util/include/asm/dwarf2.h LIB_H += util/include/asm/cpufeature.h LIB_H += perf.h LIB_H += util/annotate.h LIB_H += util/cache.h LIB_H += util/callchain.h LIB_H += util/build-id.h LIB_H += util/debug.h LIB_H += util/debugfs.h LIB_H += util/event.h LIB_H += util/evsel.h LIB_H += util/evlist.h LIB_H += util/exec_cmd.h LIB_H += util/types.h LIB_H += util/levenshtein.h LIB_H += util/map.h LIB_H += util/parse-options.h LIB_H += util/parse-events.h LIB_H += util/quote.h LIB_H += util/util.h LIB_H += util/xyarray.h LIB_H += util/header.h LIB_H += util/help.h LIB_H += util/session.h LIB_H += util/strbuf.h LIB_H += util/strlist.h LIB_H += util/strfilter.h LIB_H += util/svghelper.h LIB_H += util/run-command.h LIB_H += util/sigchain.h LIB_H += util/symbol.h LIB_H += util/color.h LIB_H += util/values.h LIB_H += util/sort.h LIB_H += util/hist.h LIB_H += util/thread.h LIB_H += util/thread_map.h LIB_H += util/trace-event.h LIB_H += util/probe-finder.h LIB_H += util/dwarf-aux.h LIB_H += util/probe-event.h LIB_H += util/pstack.h LIB_H += util/cpumap.h LIB_H += util/top.h LIB_H += $(ARCH_INCLUDE) LIB_H += util/cgroup.h LIB_OBJS += $(OUTPUT)util/abspath.o LIB_OBJS += $(OUTPUT)util/alias.o LIB_OBJS += $(OUTPUT)util/annotate.o LIB_OBJS += $(OUTPUT)util/build-id.o LIB_OBJS += $(OUTPUT)util/config.o LIB_OBJS += $(OUTPUT)util/ctype.o LIB_OBJS += $(OUTPUT)util/debugfs.o LIB_OBJS += $(OUTPUT)util/environment.o LIB_OBJS += $(OUTPUT)util/event.o LIB_OBJS += $(OUTPUT)util/evlist.o LIB_OBJS += $(OUTPUT)util/evsel.o LIB_OBJS += $(OUTPUT)util/exec_cmd.o LIB_OBJS += $(OUTPUT)util/help.o LIB_OBJS += $(OUTPUT)util/levenshtein.o LIB_OBJS += $(OUTPUT)util/parse-options.o LIB_OBJS += $(OUTPUT)util/parse-events.o LIB_OBJS += $(OUTPUT)util/path.o LIB_OBJS += $(OUTPUT)util/rbtree.o LIB_OBJS += $(OUTPUT)util/bitmap.o LIB_OBJS += $(OUTPUT)util/hweight.o LIB_OBJS += $(OUTPUT)util/run-command.o LIB_OBJS += $(OUTPUT)util/quote.o LIB_OBJS += $(OUTPUT)util/strbuf.o LIB_OBJS += $(OUTPUT)util/string.o LIB_OBJS += $(OUTPUT)util/strlist.o LIB_OBJS += $(OUTPUT)util/strfilter.o LIB_OBJS += $(OUTPUT)util/top.o LIB_OBJS += $(OUTPUT)util/usage.o LIB_OBJS += $(OUTPUT)util/wrapper.o LIB_OBJS += $(OUTPUT)util/sigchain.o LIB_OBJS += $(OUTPUT)util/symbol.o LIB_OBJS += $(OUTPUT)util/color.o LIB_OBJS += $(OUTPUT)util/pager.o LIB_OBJS += $(OUTPUT)util/header.o LIB_OBJS += $(OUTPUT)util/callchain.o LIB_OBJS += $(OUTPUT)util/values.o LIB_OBJS += $(OUTPUT)util/debug.o LIB_OBJS += $(OUTPUT)util/map.o LIB_OBJS += $(OUTPUT)util/pstack.o LIB_OBJS += $(OUTPUT)util/session.o LIB_OBJS += $(OUTPUT)util/thread.o LIB_OBJS += $(OUTPUT)util/thread_map.o LIB_OBJS += $(OUTPUT)util/trace-event-parse.o LIB_OBJS += $(OUTPUT)util/trace-event-read.o LIB_OBJS += $(OUTPUT)util/trace-event-info.o LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o LIB_OBJS += $(OUTPUT)util/svghelper.o LIB_OBJS += $(OUTPUT)util/sort.o LIB_OBJS += $(OUTPUT)util/hist.o LIB_OBJS += $(OUTPUT)util/probe-event.o LIB_OBJS += $(OUTPUT)util/util.o LIB_OBJS += $(OUTPUT)util/xyarray.o LIB_OBJS += $(OUTPUT)util/cpumap.o LIB_OBJS += $(OUTPUT)util/cgroup.o BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o BUILTIN_OBJS += $(OUTPUT)builtin-bench.o # Benchmark modules BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o ifeq ($(RAW_ARCH),x86_64) BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o endif BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o BUILTIN_OBJS += $(OUTPUT)builtin-diff.o BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o BUILTIN_OBJS += $(OUTPUT)builtin-help.o BUILTIN_OBJS += $(OUTPUT)builtin-sched.o BUILTIN_OBJS += $(OUTPUT)builtin-buildid-list.o BUILTIN_OBJS += $(OUTPUT)builtin-buildid-cache.o BUILTIN_OBJS += $(OUTPUT)builtin-list.o BUILTIN_OBJS += $(OUTPUT)builtin-record.o BUILTIN_OBJS += $(OUTPUT)builtin-report.o BUILTIN_OBJS += $(OUTPUT)builtin-stat.o BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o BUILTIN_OBJS += $(OUTPUT)builtin-top.o BUILTIN_OBJS += $(OUTPUT)builtin-script.o BUILTIN_OBJS += $(OUTPUT)builtin-probe.o BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o BUILTIN_OBJS += $(OUTPUT)builtin-lock.o BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o BUILTIN_OBJS += $(OUTPUT)builtin-test.o BUILTIN_OBJS += $(OUTPUT)builtin-inject.o PERFLIBS = $(LIB_FILE) # 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.o PYRF_OBJS += $(OUTPUT)util/ctype.o PYRF_OBJS += $(OUTPUT)util/evlist.o PYRF_OBJS += $(OUTPUT)util/evsel.o PYRF_OBJS += $(OUTPUT)util/python.o PYRF_OBJS += $(OUTPUT)util/thread_map.o PYRF_OBJS += $(OUTPUT)util/util.o PYRF_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_DWARF FLAGS_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 := 1 endif # Dwarf support endif # 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); endif endif ifneq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON)),y) BASIC_CFLAGS += -DLIBELF_NO_MMAP endif ifndef NO_DWARF ifeq ($(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.o endif # PERF_HAVE_DWARF_REGS endif # NO_DWARF ifdef NO_NEWT BASIC_CFLAGS += -DNO_NEWT_SUPPORT else 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)util/ui/setup.o LIB_OBJS += $(OUTPUT)util/ui/browser.o LIB_OBJS += $(OUTPUT)util/ui/browsers/annotate.o LIB_OBJS += $(OUTPUT)util/ui/browsers/hists.o LIB_OBJS += $(OUTPUT)util/ui/browsers/map.o LIB_OBJS += $(OUTPUT)util/ui/helpline.o LIB_OBJS += $(OUTPUT)util/ui/progress.o LIB_OBJS += $(OUTPUT)util/ui/util.o LIB_H += util/ui/browser.h LIB_H += util/ui/browsers/map.h LIB_H += util/ui/helpline.h LIB_H += util/ui/keysyms.h LIB_H += util/ui/libslang.h LIB_H += util/ui/progress.h LIB_H += util/ui/util.h LIB_H += util/ui/ui.h endif endif ifdef NO_LIBPERL BASIC_CFLAGS += -DNO_LIBPERL else PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED)),y) BASIC_CFLAGS += -DNO_LIBPERL else ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS) EXTLIBS += $(PERL_EMBED_LIBADD) LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o endif endif