[PATCH 13/15] perf kbuild: final cosmetic changes

From: Alexis Berlemont
Date: Mon Sep 22 2014 - 17:56:57 EST


* Correctly rename internal makefile variables
* Remove makefiles in tools/perf/config which became empty and useless
* Remove builtin-cmds.h
* Remove arch/x86/Makefile
* Improve outputs of clean and install targets
* Remove creation of PERF-FEATURES file which is redundant with the
.config file generated by Kconfig.
* replace HAVE_KVM_STAT_SUPPORT by a Kconfig option
* replace HAVE_SKIP_CALLCHAIN_IDX by a Kconfig option
---
tools/perf/Kconfig | 14 +++++++
tools/perf/Makefile.kbuild | 74 ++++++++++++++++++--------------
tools/perf/arch/powerpc/util/Kbuild | 2 +-
tools/perf/arch/s390/util/Kbuild | 2 +-
tools/perf/arch/x86/Makefile | 17 --------
tools/perf/arch/x86/util/Kbuild | 2 +-
tools/perf/builtin-cmds.h | 6 ---
tools/perf/builtin-help.c | 2 +-
tools/perf/builtin-kvm.c | 6 +--
tools/perf/builtin-lock.c | 2 +-
tools/perf/builtin-sched.c | 2 +-
tools/perf/config/Makefile | 79 ++++++++++-------------------------
tools/perf/config/Makefile.fix-config | 6 ---
tools/perf/config/Makefile.fix-legacy | 2 -
tools/perf/perf.c | 2 +-
tools/perf/util/callchain.h | 2 +-
tools/perf/util/machine.c | 2 +-
17 files changed, 91 insertions(+), 131 deletions(-)
delete mode 100644 tools/perf/arch/x86/Makefile
delete mode 100644 tools/perf/builtin-cmds.h
delete mode 100644 tools/perf/config/Makefile.fix-config
delete mode 100644 tools/perf/config/Makefile.fix-legacy

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index cb04575..e605680 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -128,6 +128,13 @@ config BUILTIN_KVM
---help---
Tool to trace/measure kvm guest os

+config BUILTIN_KVM_STAT
+ bool "kvm-stat"
+ default y
+ depends on BUILTIN_KVM && (ARCH = "x86" || ARCH = "s390")
+ ---help---
+ Get performance counter statistics on a kvm guest os.
+
config BUILTIN_LIST
bool "list"
default y
@@ -326,6 +333,13 @@ config LIBDWARF_DIR
Directory holding the libdwarf dependency (headers +
libraries)

+config LIBDWARF_SKIP_CALLCHAIN_IDX
+ depends on (LIBDWARF && ARCH = "powerpc")
+ bool "Libdwarf skip callchain index"
+ ---help---
+ Based on DWARF debug information, some architectures skip a
+ callchain entry saved by the kernel.
+
config UNWIND
depends on (LIBELF && PERF_REGS)
bool "User space unwind callchains"
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
index b48fe7f..90b168d 100644
--- a/tools/perf/Makefile.kbuild
+++ b/tools/perf/Makefile.kbuild
@@ -1,6 +1,5 @@
srctree := $(abspath $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)/../../))
objtree := $(abspath $(if $(KBUILD_SRC),$(CURDIR),$(CURDIR)/../..))
-
VPATH := $(srctree)

export srctree VPATH
@@ -36,7 +35,8 @@ export quiet Q KBUILD_VERBOSE
ifndef V
QUIET_LINK = @echo ' LD $@';
QUIET_GEN = @echo ' GEN $@';
-QUIET_CLEAN = @echo ' CLEAN tools/perf';
+QUIET_CLEAN = @printf ' CLEAN %s\n' $1;
+QUIET_INSTALL = @printf ' INSTALL %s\n' $1;
endif

export QUIET_BISON QUIET_FLEX
@@ -158,7 +158,6 @@ $(CONFIG_DETECTED): $(KCONFIG_CONFIG)
# no need to include auto.conf.cmd, because .config
# is the only dependency here
$(KCONFIG_AUTOCONFIG): $(KCONFIG_CONFIG) $(CONFIG_DETECTED)
- $(Q)$(MAKE) -f $(src-perf)/config/Makefile.fix-config
$(Q)mkdir -p $(obj-perf)/include/config
$(Q)mkdir -p $(obj-perf)/include/generated
$(Q)$(MAKE) -s $(build)=scripts/kconfig silentoldconfig
@@ -167,22 +166,26 @@ $(KCONFIG_AUTOCONFIG): $(KCONFIG_CONFIG) $(CONFIG_DETECTED)
clean-dirs := $(addprefix _clean_, tools/perf/)

$(clean-dirs):
+ $(call QUIET_CLEAN, core-objs)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)

-clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean
- $(Q)$(QUIET_CLEAN)
- $(Q)rm -f $(obj-perf)/perf
- $(Q)rm -f $(obj-perf)/common-cmds.h
- $(Q)rm -f $(obj-perf)/python/perf.so
+config-clean:
+ $(call QUIET_CLEAN, config)
+ @$(MAKE) OUTPUT=$(obj-perf)/config/feature-checks/ -C $(src-perf)/config/feature-checks clean >/dev/null
$(Q)rm -rf $(obj-perf)/include/generated $(obj-perf)/include/config
+ $(Q)rm -f $(CONFIG_DETECTED) $(KCONFIG_CONFIG)
+ $(Q)rm -f $(obj-perf)/common-cmds.h
+
+clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
+ $(call QUIET_CLEAN, core-progs)
+ $(Q)rm -f $(obj-perf)/perf
+ $(call QUIET_CLEAN, misc)
$(Q)find $(obj-perf) \
\( -name '*.[oas]' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' \
-o -name '*-flex.[ch]' -o -name '*-bison.[ch]' \
\) -type f -print | xargs rm -f
- $(Q)$(python-clean)
- $(Q)rm -f $(CONFIG_DETECTED) $(KCONFIG_CONFIG)
- @$(MAKE) OUTPUT=$(obj-perf)/config/feature-checks/ -C $(src-perf)/config/feature-checks clean >/dev/null
+ $(python-clean)

TAGS tags:
$(Q)rm -f $(src-perf)/tags
@@ -257,7 +260,7 @@ PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/

export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP

-python-clean := rm -rf $(PYTHON_EXTBUILD) $(obj-perf)/python/perf.so
+python-clean := $(call QUIET_CLEAN, python) rm -rf $(PYTHON_EXTBUILD) $(obj-perf)/python/perf.so

PYTHON_EXT_SRCS := $(addprefix $(src-perf)/,$(shell grep -v ^\# $(src-perf)/util/python-ext-sources))
PYTHON_EXT_DEPS := $(src-perf)/util/python-ext-sources $(src-perf)/util/setup.py
@@ -343,25 +346,34 @@ $(SCRIPTS) : % : %.sh
all: $(SCRIPTS)

install-bin: all
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
- $(INSTALL) $(obj-perf)/perf '$(DESTDIR_SQ)$(bindir_SQ)'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
- $(INSTALL) $(src-perf)/perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
- $(INSTALL) $(src-perf)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) $(src-perf)/scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'
- $(INSTALL) $(src-perf)/scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
- $(INSTALL) $(src-perf)/scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) $(src-perf)/scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
- $(INSTALL) $(src-perf)/scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
- $(INSTALL) $(src-perf)/perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
- $(INSTALL) $(src-perf)/tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
- $(INSTALL) $(src-perf)/tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+ $(call QUIET_INSTALL, binaries) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' ; \
+ $(INSTALL) $(obj-perf)/perf '$(DESTDIR_SQ)$(bindir_SQ)' ; \
+ ln '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'
+ $(call QUIET_INSTALL, libexec) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+ $(call QUIET_INSTALL, perf-archive) \
+ $(INSTALL) $(src-perf)/perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+ $(call QUIET_INSTALL, perl-scripts) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' ; \
+ $(INSTALL) $(src-perf)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) $(src-perf)/scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl' ; \
+ $(INSTALL) $(src-perf)/scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+ $(call QUIET_INSTALL, python-scripts) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' ; \
+ $(INSTALL) $(src-perf)/scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) $(src-perf)/scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python' ; \
+ $(INSTALL) $(src-perf)/scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+ $(call QUIET_INSTALL, perf_completion-script) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d' ; \
+ $(INSTALL) $(src-perf)/perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
+ $(call QUIET_INSTALL, tests) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests' ; \
+ $(INSTALL) $(src-perf)/tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests' ; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr' ; \
+ $(INSTALL) $(src-perf)/tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'

install: install-bin try-install-man $(LIBTRACEEVENT)-install

diff --git a/tools/perf/arch/powerpc/util/Kbuild b/tools/perf/arch/powerpc/util/Kbuild
index 8fbd24f..9aa55c2 100644
--- a/tools/perf/arch/powerpc/util/Kbuild
+++ b/tools/perf/arch/powerpc/util/Kbuild
@@ -1,3 +1,3 @@
obj-y += header.o
-obj-y += skip-callchain-idx.o
obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF_SKIP_CALLCHAIN_IDX) += skip-callchain-idx.o
diff --git a/tools/perf/arch/s390/util/Kbuild b/tools/perf/arch/s390/util/Kbuild
index 73df1ff..833e3b8 100644
--- a/tools/perf/arch/s390/util/Kbuild
+++ b/tools/perf/arch/s390/util/Kbuild
@@ -1,2 +1,2 @@
-obj-y += kvm-stat.o
+obj-$(CONFIG_BUILTIN_KVM_STAT) += kvm-stat.o
obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
deleted file mode 100644
index af36aad..0000000
--- a/tools/perf/arch/x86/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-ifeq ($(LIBDWARF), 1)
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifeq ($(LIBUNWIND), 1)
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-endif
-ifeq ($(LIBDWARF_UNWIND), 1)
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
-endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o
-LIB_H += arch/$(ARCH)/util/tsc.h
-HAVE_KVM_STAT_SUPPORT := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/kvm-stat.o
diff --git a/tools/perf/arch/x86/util/Kbuild b/tools/perf/arch/x86/util/Kbuild
index adca885..fe382ce 100644
--- a/tools/perf/arch/x86/util/Kbuild
+++ b/tools/perf/arch/x86/util/Kbuild
@@ -1,6 +1,6 @@
obj-y += header.o
obj-y += tsc.o
-obj-y += kvm-stat.o
+obj-$(CONFIG_BUILTIN_KVM_STAT) += kvm-stat.o
obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
deleted file mode 100644
index 863727f..0000000
--- a/tools/perf/builtin-cmds.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef BUILTIN_CMDS_H
-#define BUILTIN_CMDS_H
-
-#include "generated/autoconf.h"
-
-#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index cbbd036..46b3180 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -3,11 +3,11 @@
*
* Builtin help command
*/
+#include "generated/autoconf.h"
#include "perf.h"
#include "util/cache.h"
#include "builtin.h"
#include "util/exec_cmd.h"
-#include "builtin-cmds.h"
#include "common-cmds.h"
#include "util/parse-options.h"
#include "util/run-command.h"
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 0e1f244..5822dca 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -30,7 +30,7 @@
#include <pthread.h>
#include <math.h>

-#ifdef HAVE_KVM_STAT_SUPPORT
+#ifdef CONFIG_BUILTIN_KVM_STAT
#include <asm/kvm_perf.h>
#include "util/kvm-stat.h"

@@ -1438,7 +1438,7 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)
perf_stat:
return cmd_stat(argc, argv, NULL);
}
-#endif /* HAVE_KVM_STAT_SUPPORT */
+#endif /* CONFIG_BUILTIN_KVM_STAT */

static int __cmd_record(const char *file_name, int argc, const char **argv)
{
@@ -1560,7 +1560,7 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
if (!strncmp(argv[0], "buildid-list", 12))
return __cmd_buildid_list(file_name, argc, argv);

-#ifdef HAVE_KVM_STAT_SUPPORT
+#ifdef CONFIG_BUILTIN_KVM_STAT
if (!strncmp(argv[0], "stat", 4))
return kvm_cmd_stat(file_name, argc, argv);
#endif
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index f5404dc..faba219 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -1,5 +1,5 @@
+#include "generated/autoconf.h"
#include "builtin.h"
-#include "builtin-cmds.h"
#include "perf.h"

#include "util/evlist.h"
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index edda0b2..44defc4 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1,5 +1,5 @@
+#include "generated/autoconf.h"
#include "builtin.h"
-#include "builtin-cmds.h"
#include "perf.h"

#include "util/util.h"
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 6dab83b..ceff326 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -34,14 +34,14 @@ ifeq ($(ARCH),arm64)
LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
endif

-ifeq ($(ARCH),powerpc)
- CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
+ifdef KCONFIG_CONFIG
+include $(KCONFIG_CONFIG)
endif

ifeq ($(LIBUNWIND_LIBS),)
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
else
- LIBUNWIND = 1
+ config-libunwind = 1
#
# For linking with debug library, run like:
#
@@ -69,10 +69,6 @@ ifdef CONFIG_LIBELF
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
endif

-ifdef KCONFIG_CONFIG
-include $(src-perf)/config/Makefile.fix-legacy
-endif
-
# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

@@ -278,12 +274,12 @@ endif
ifdef CONFIG_LIBELF
ifeq ($(feature-libelf), 0)
ifeq ($(feature-glibc), 1)
- LIBC_SUPPORT := 1
+ config-libc := 1
endif
ifeq ($(BIONIC),1)
- LIBC_SUPPORT := 1
+ config-libc := 1
endif
- ifeq ($(LIBC_SUPPORT),1)
+ ifeq ($(config-libc),1)
msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF)
$(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBELF_MINIMAL)
@@ -296,13 +292,13 @@ ifdef CONFIG_LIBELF
endif
endif
else
- LIBELF = 1
+ config-libelf = 1
ifdef CONFIG_LIBDWARF
ifneq ($(feature-dwarf), 1)
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);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF)
else
- LIBDWARF = 1
+ config-libdwarf = 1
endif # Dwarf support
ifdef CONFIG_LIBDWARF_UNWIND
# So far there's only x86 and arm libdw unwind support merged
@@ -314,7 +310,7 @@ ifdef CONFIG_LIBELF
msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set CONFIG_LIBDWARF_DIR);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF_UNWIND)
else
- LIBDWARF_UNWIND = 1
+ config-libdwarf-unwind = 1
endif # Dwarf unwind support
else
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF_UNWIND)
@@ -324,7 +320,7 @@ ifdef CONFIG_LIBELF
endif # libelf support
endif # CONFIG_LIBELF

-ifeq ($(LIBELF), 1)
+ifeq ($(config-libelf), 1)

ifdef CONFIG_LIBELF_MMAP
ifneq ($(feature-libelf-mmap), 1)
@@ -332,16 +328,16 @@ ifeq ($(LIBELF), 1)
endif
endif

- ifdef CONFIG_LIBELF_MMAP
+ ifdef CONFIG_LIBELF_GETPHDRNUM
ifneq ($(feature-libelf-getphdrnum), 1)
- $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_MMAP)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_GETPHDRNUM)
endif
endif

# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

- ifeq ($(LIBDWARF), 1)
+ ifeq ($(config-libdwarf), 1)
CFLAGS += $(LIBDW_CFLAGS)
LDFLAGS += $(LIBDW_LDFLAGS)
EXTLIBS += -lelf -ldw
@@ -352,17 +348,17 @@ ifdef CONFIG_UNWIND
# CONFIG_LIBUNWIND is the default choice; so, if it is not
# available, let's try another one
ifdef CONFIG_LIBUNWIND
- ifeq ($(LIBUNWIND), 1)
+ ifeq ($(config-libunwind), 1)
ifneq ($(feature-libunwind), 1)
- LIBUNWIND = 0
+ config-libunwind = 0
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
- ifeq ($(LIBDWARF_UNWIND), 1)
+ ifeq ($(config-libdwarf-unwind), 1)
msg := $(warning No libunwind found, post unwind will rely on libdwarf-unwind. Please install libunwind-dev[el] >= 1.1);
$(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBDWARF_UNWIND)
else
msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
- endif # LIBDWARF_UNWIND
+ endif # config-libdwarf-unwind
else # feature-libunwind OK
EXTLIBS += $(LIBUNWIND_LIBS)
CFLAGS += $(LIBUNWIND_CFLAGS)
@@ -374,7 +370,7 @@ ifdef CONFIG_UNWIND
# CONFIG_LIBDWARF_UNWIND is not the default choice (so the user's
# choice); so, we disable CONFIG_UNWIND if it is not available
ifdef CONFIG_LIBDWARF_UNWIND
- ifneq ($(LIBDWARF_UNWIND), 1)
+ ifneq ($(config-libdwarf-unwind), 1)
msg := $(warning Disabling post unwing because (libdwarf-unwind is not available));
$(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
endif
@@ -382,7 +378,7 @@ ifdef CONFIG_UNWIND

# if libunwind is OK, let's check the option DEBUG_FRAME
ifdef CONFIG_LIBUNWIND
- ifeq ($(LIBUNWIND), 1)
+ ifeq ($(config-libunwind), 1)
ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
$(call feature_check,libunwind-debug-frame)
ifneq ($(feature-libunwind-debug-frame), 1)
@@ -399,11 +395,11 @@ ifdef CONFIG_UNWIND
dwarf-post-unwind = 0
dwarf-post-unwind-text = BUG

-ifeq ($(LIBUNWIND), 1)
+ifeq ($(config-libunwind), 1)
dwarf-post-unwind := 1
dwarf-post-unwind-text := libunwind
else
- ifeq ($(LIBDWARF_UNWIND), 1)
+ ifeq ($(config-libdwarf-unwind), 1)
dwarf-post-unwind := 1
dwarf-post-unwind-text := libdw
endif
@@ -586,10 +582,6 @@ ifdef CONFIG_LIBNUMA
endif
endif

-ifdef HAVE_KVM_STAT_SUPPORT
- CFLAGS += -DHAVE_KVM_STAT_SUPPORT
-endif
-
# Among the variables below, these:
# perfexecdir
# template_dir
@@ -679,36 +671,9 @@ define feature_print_text_code
MSG = $(shell printf '...%30s: %s' $(1) $(2))
endef

-PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat))))
-PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES)
-
-ifeq ($(dwarf-post-unwind),1)
- PERF_FEATURES += dwarf-post-unwind($(dwarf-post-unwind-text))
-endif
-
-# The $(display_lib) controls the default detection message
-# output. It's set if:
-# - detected features differes from stored features from
-# last build (in PERF-FEATURES file)
-# - one of the $(LIB_FEATURE_TESTS) is not detected
-# - VF is enabled
-
-ifneq ("$(PERF_FEATURES)","$(PERF_FEATURES_FILE)")
- $(shell echo "$(PERF_FEATURES)" > $(OUTPUT)PERF-FEATURES)
- display_lib := 1
-endif
-
-feature_check = $(eval $(feature_check_code))
-define feature_check_code
- ifneq ($(feature-$(1)), 1)
- display_lib := 1
- endif
-endef
-
-$(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_check,$(feat)))
+display_lib := 1

ifeq ($(VF),1)
- display_lib := 1
display_vf := 1
endif

diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
deleted file mode 100644
index 3f0e33e..0000000
--- a/tools/perf/config/Makefile.fix-config
+++ /dev/null
@@ -1,6 +0,0 @@
-include $(CONFIG_DETECTED)
-include $(KCONFIG_CONFIG)
-
-CONFIG := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
-
-all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
deleted file mode 100644
index 431c9bf..0000000
--- a/tools/perf/config/Makefile.fix-legacy
+++ /dev/null
@@ -1,2 +0,0 @@
-
-include $(KCONFIG_CONFIG)
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 3d8e946..465788d 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -6,8 +6,8 @@
* This is the main hub from which the sub-commands (perf stat,
* perf top, perf record, perf report, etc.) are started.
*/
+#include "generated/autoconf.h"
#include "builtin.h"
-#include "builtin-cmds.h"

#include "util/exec_cmd.h"
#include "util/cache.h"
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index da43619..5c41e48 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -177,7 +177,7 @@ static inline void callchain_cursor_snapshot(struct callchain_cursor *dest,
dest->nr -= src->pos;
}

-#ifdef HAVE_SKIP_CALLCHAIN_IDX
+#ifdef CONFIG_LIBDWARF_SKIP_CALLCHAIN_IDX
extern int arch_skip_callchain_idx(struct machine *machine,
struct thread *thread, struct ip_callchain *chain);
#else
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 16bba9f..510c4f8 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1361,7 +1361,7 @@ static int machine__resolve_callchain_sample(struct machine *machine,
else
j = chain->nr - i - 1;

-#ifdef HAVE_SKIP_CALLCHAIN_IDX
+#ifdef CONFIG_LIBDWARF_SKIP_CALLCHAIN_IDX
if (j == skip_idx)
continue;
#endif
--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/