2011-09-13 15:10:56 +00:00
|
|
|
OUTDIR = tools/perf
|
|
|
|
|
|
|
|
include ../../Makefile.inc
|
|
|
|
|
2011-09-26 11:50:12 +00:00
|
|
|
DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
|
|
|
|
|
2012-03-24 23:15:55 +00:00
|
|
|
ifeq ($(DEB_HOST_ARCH_CPU),alpha)
|
|
|
|
KERNEL_ARCH_PERF = alpha
|
2011-09-26 11:50:12 +00:00
|
|
|
else ifeq ($(DEB_HOST_ARCH_CPU),arm)
|
|
|
|
KERNEL_ARCH_PERF = arm
|
2015-01-31 16:21:27 +00:00
|
|
|
else ifeq ($(DEB_HOST_ARCH_CPU),arm64)
|
|
|
|
KERNEL_ARCH_PERF = arm64
|
2015-05-11 00:48:55 +00:00
|
|
|
else ifneq ($(filter mips%,$(DEB_HOST_ARCH_CPU)),)
|
|
|
|
KERNEL_ARCH_PERF = mips
|
2012-03-24 23:15:55 +00:00
|
|
|
else ifeq ($(DEB_HOST_ARCH_CPU),hppa)
|
|
|
|
KERNEL_ARCH_PERF = parisc
|
2015-05-11 00:48:55 +00:00
|
|
|
else ifneq ($(filter powerpc% ppc%,$(DEB_HOST_ARCH_CPU)),)
|
2014-08-26 08:14:42 +00:00
|
|
|
KERNEL_ARCH_PERF = powerpc
|
2015-05-11 00:48:55 +00:00
|
|
|
else ifneq ($(filter s390%,$(DEB_HOST_ARCH_CPU)),)
|
2011-11-19 18:55:14 +00:00
|
|
|
KERNEL_ARCH_PERF = s390
|
2011-09-26 11:50:12 +00:00
|
|
|
else ifeq ($(DEB_HOST_ARCH_CPU),sh4)
|
|
|
|
KERNEL_ARCH_PERF = sh
|
2015-05-11 00:48:55 +00:00
|
|
|
else ifneq ($(filter sparc%,$(DEB_HOST_ARCH_CPU)),)
|
2011-09-26 11:50:12 +00:00
|
|
|
KERNEL_ARCH_PERF = sparc
|
2015-05-11 00:48:55 +00:00
|
|
|
else ifneq ($(filter amd64 i386,$(DEB_HOST_ARCH_CPU)),)
|
|
|
|
KERNEL_ARCH_PERF = x86
|
2011-09-26 11:50:12 +00:00
|
|
|
endif
|
|
|
|
|
2015-01-31 23:14:36 +00:00
|
|
|
MAKE_PERF := $(MAKE) prefix=/usr V=1 ARCH=$(KERNEL_ARCH_PERF) EXTRA_WARNINGS=-Wno-error
|
2014-09-27 02:01:14 +00:00
|
|
|
|
|
|
|
# Disable Gtk UI until it's more usable
|
|
|
|
MAKE_PERF += NO_GTK2=1
|
|
|
|
|
|
|
|
# Include version in all directory names
|
2015-05-11 02:51:07 +00:00
|
|
|
MAKE_PERF += perfexecdir=lib/perf_$(VERSION)-core plugindir=/usr/lib/traceevent_$(VERSION)/plugins
|
2014-09-27 01:54:29 +00:00
|
|
|
|
|
|
|
# perf can link against libbfd if available, but the result is
|
|
|
|
# undistributable as they are licenced under GPL v2 and v3+
|
|
|
|
# respectively. Override detection of libbfd and insist that
|
|
|
|
# cplus_demangle() can be found in libiberty (LGPL v2.1+).
|
|
|
|
MAKE_PERF += feature-libbfd=0 HAVE_CPLUS_DEMANGLE_SUPPORT=1
|
2011-09-26 11:50:12 +00:00
|
|
|
|
2011-09-13 15:10:56 +00:00
|
|
|
all:
|
2011-09-26 11:50:12 +00:00
|
|
|
ifdef KERNEL_ARCH_PERF
|
2011-09-13 15:10:56 +00:00
|
|
|
-mkdir out
|
2014-07-29 19:18:10 +00:00
|
|
|
# perf changes some default directories depending on whether DESTDIR is
|
|
|
|
# set. We must define it even when building to avoid a rebuild when we
|
|
|
|
# run 'make install'.
|
|
|
|
+$(MAKE_PERF) -C $(top_srcdir)/tools/perf -f Makefile.perf O=$(CURDIR)/out all VERSION=$(VERSION) DESTDIR=dummy
|
2013-08-08 14:20:53 +00:00
|
|
|
+$(MAKE_PERF) -C $(top_srcdir)/tools/perf/Documentation O=$(CURDIR)/out man VERSION=$(VERSION)
|
2014-09-27 01:54:29 +00:00
|
|
|
# Check that perf didn't get linked against libbfd
|
|
|
|
type ldd
|
|
|
|
! ldd $(CURDIR)/out/perf | grep '\blibbfd'
|
|
|
|
# Check that it includes cplus_demangle from libiberty
|
|
|
|
grep cplus_demangle $(CURDIR)/out/perf
|
2011-09-26 11:50:12 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
install:
|
|
|
|
ifdef KERNEL_ARCH_PERF
|
2014-01-21 06:33:13 +00:00
|
|
|
+$(MAKE_PERF) -C $(top_srcdir)/tools/perf -f Makefile.perf O=$(CURDIR)/out install VERSION=$(VERSION)
|
2014-02-22 23:20:19 +00:00
|
|
|
# Don't install a 'trace' alias yet:
|
|
|
|
# - We need a wrapper for it anyway, so there's little point adding a
|
|
|
|
# versioned link
|
|
|
|
# - It doesn't work out-of-the-box as non-root (it depends on debugfs),
|
|
|
|
# so it's less widely useful than strace
|
|
|
|
# - 'perf trace' doesn't take much more typing
|
|
|
|
rm -f $(DESTDIR)/usr/bin/trace_$(VERSION)
|
2011-09-26 11:50:12 +00:00
|
|
|
endif
|
2011-09-13 15:10:56 +00:00
|
|
|
|
|
|
|
clean:
|
2015-07-13 00:12:02 +00:00
|
|
|
ifdef KERNEL_ARCH_PERF
|
|
|
|
mkdir -p out
|
|
|
|
+$(MAKE_PERF) -C $(top_srcdir)/tools/perf -f Makefile.perf O=$(CURDIR)/out clean
|
2013-08-08 14:20:53 +00:00
|
|
|
rm -rf out
|
2015-07-13 00:12:02 +00:00
|
|
|
endif
|