linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 00/27] perf tools: Build changes and kbuild support
@ 2013-04-01 19:18 Jiri Olsa
  2013-04-01 19:18 ` [PATCH 01/27] perf tools: Add automated make test suite Jiri Olsa
                   ` (27 more replies)
  0 siblings, 28 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Michal Marek, linux-kbuild, Stephane Eranian

hi,
sending RFC for build changes and kbuild support.

The build changes mostly consists of separating the config
stuff into config/Makefile which is then used for kbuild.

I kept the original/current Makefile in place and put
the kbuild support into Makefile.kbuild. The final touch
would be to move Makefile.kbuild into Makefile. I kept
the original one to have easy way of testing the old
system.

To run the kbuild make:
  $ make -f Makefile.kbuild

In pristine tree above command behaves as the current
Makefile - does the system checks and builds perf.

After that '.config' and '.config-detected' files
are created and managed as explained in last patch
of this set.

It's published in:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/kbuild7

I tested this so far on x86_64.

I'm CC-ing Michal Marek and linux-kbuild list on kbuild patches.

thanks for comments,
jirka

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Cc: Stephane Eranian <eranian@google.com>
---
Jiri Olsa (27):
      perf tools: Add automated make test suite
      perf tools: Fix tab vs spaces issue in Makefile ifdef/endif
      perf tools: Move arch check into config/Makefile
      perf tools: Move programs check into config/Makefile
      perf tools: Move compiler and linker flags check into config/Makefile
      perf tools: Move libelf check config into config/Makefile
      perf tools: Move libdw check config into config/Makefile
      perf tools: Move libunwind check config into config/Makefile
      perf tools: Move libaudit check config into config/Makefile
      perf tools: Move slang check config into config/Makefile
      perf tools: Move gtk2 check config into config/Makefile
      perf tools: Move libperl check config into config/Makefile
      perf tools: Move libpython check config into config/Makefile
      perf tools: Move libbfd check config into config/Makefile
      perf tools: Move stdlib check config into config/Makefile
      perf tools: Move libnuma check config into config/Makefile
      perf tools: Move paths config into config/Makefile
      perf tools: Final touches for CHK config move
      perf tools: Merge all *CFLAGS* make variable into CFLAGS
      perf tools: Merge all *LDFLAGS* make variable into LDFLAGS
      perf tools: Switch to full patch C include directories
      perf tools: Add NO_BIONIC variable to confiure bionic setup
      kbuild: Introduce KBUILD_AUTOCONF variable for auto.conf include
      kbuild: Introduce KCONFIG_AUTOCONFIGDEP variable for conf tool
      perf tools: Kbuild builtin source related fixies
      perf tools: Kbuild source related fixies
      perf tools: Add kbuild support into Makefile.kbuild

 scripts/Makefile.build                           |   3 +-
 scripts/kconfig/confdata.c                       |  11 +-
 scripts/kconfig/lkc.h                            |   1 +
 tools/perf/Kbuild                                |  47 ++
 tools/perf/Kconfig                               | 256 ++++++++++
 tools/perf/Makefile                              | 598 ++++-------------------
 tools/perf/Makefile.kbuild                       | 411 ++++++++++++++++
 tools/perf/arch/Kbuild                           |   3 +
 tools/perf/arch/x86/Kbuild                       |   1 +
 tools/perf/arch/x86/util/Kbuild                  |   3 +
 tools/perf/bench/Kbuild                          |   9 +
 tools/perf/builtin-cmds.h                        |  31 ++
 tools/perf/builtin-help.c                        |   1 +
 tools/perf/builtin-lock.c                        |   2 +
 tools/perf/builtin-report.c                      |   9 +-
 tools/perf/builtin-sched.c                       |   2 +
 tools/perf/config/Makefile                       | 528 ++++++++++++++++++++
 tools/perf/config/Makefile.fix-config            | 104 ++++
 tools/perf/config/Makefile.fix-legacy            |  46 ++
 tools/perf/config/defconfig                      |  54 ++
 tools/perf/perf.c                                |  51 +-
 tools/perf/perf.h                                |   2 +
 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild   |   3 +
 tools/perf/scripts/python/Perf-Trace-Util/Kbuild |   4 +
 tools/perf/tests/Kbuild                          |  23 +
 tools/perf/tests/make                            | 122 +++++
 tools/perf/ui/Kbuild                             |  14 +
 tools/perf/ui/browsers/Kbuild                    |   6 +
 tools/perf/ui/browsers/scripts.c                 |   4 +
 tools/perf/ui/gtk/Kbuild                         |   7 +
 tools/perf/ui/setup.c                            |  10 +-
 tools/perf/ui/stdio/Kbuild                       |   1 +
 tools/perf/ui/tui/Kbuild                         |   4 +
 tools/perf/util/Kbuild                           | 113 +++++
 tools/perf/util/PERF-VERSION-GEN                 |   6 +-
 tools/perf/util/generate-cmdlist.sh              |  18 +-
 tools/perf/util/scripting-engines/Kbuild         |   7 +
 tools/perf/util/setup.py                         |  12 +-
 38 files changed, 2002 insertions(+), 525 deletions(-)
 create mode 100644 tools/perf/Kbuild
 create mode 100644 tools/perf/Kconfig
 create mode 100644 tools/perf/Makefile.kbuild
 create mode 100644 tools/perf/arch/Kbuild
 create mode 100644 tools/perf/arch/x86/Kbuild
 create mode 100644 tools/perf/arch/x86/util/Kbuild
 create mode 100644 tools/perf/bench/Kbuild
 create mode 100644 tools/perf/builtin-cmds.h
 create mode 100644 tools/perf/config/Makefile
 create mode 100644 tools/perf/config/Makefile.fix-config
 create mode 100644 tools/perf/config/Makefile.fix-legacy
 create mode 100644 tools/perf/config/defconfig
 create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
 create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild
 create mode 100644 tools/perf/tests/Kbuild
 create mode 100644 tools/perf/tests/make
 create mode 100644 tools/perf/ui/Kbuild
 create mode 100644 tools/perf/ui/browsers/Kbuild
 create mode 100644 tools/perf/ui/gtk/Kbuild
 create mode 100644 tools/perf/ui/stdio/Kbuild
 create mode 100644 tools/perf/ui/tui/Kbuild
 create mode 100644 tools/perf/util/Kbuild
 create mode 100644 tools/perf/util/scripting-engines/Kbuild

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 01/27] perf tools: Add automated make test suite
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:53   ` Sam Ravnborg
  2013-04-01 19:18 ` [PATCH 02/27] perf tools: Fix tab vs spaces issue in Makefile ifdef/endif Jiri Olsa
                   ` (26 subsequent siblings)
  27 siblings, 1 reply; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Adding automatd test for testing the build process.
To run it you needto be in perf directory or specify
one with PERF variable. It's also possible to specify
optional Makefile to test via MK variable.

Whole suite is executed twice, the second time with
O=/tmp/xxx option added.

To run the whole suite:
  $ make -f tests/make
  MAKE_PURE: cd . && make -f Makefile
  TEST: test -x ./perf
  MAKE_DEBUG: cd . && make -f Makefile DEBUG=1
  TEST: test -x ./perf
  ...

You see command line for 'MAKE_PURE' test right away,
and the output is stored into MAKE_PURE file.

To run simple test:
  $ make -f tests/make MAKE_DEBUG
  MAKE_DEBUG: cd . && make -f Makefile DEBUG=1
  TEST: test -x ./perf

At this moment tests checks for succesfull build
and for existence of several built files. Additional
after-build checks could be added.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/tests/make | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 122 insertions(+)
 create mode 100644 tools/perf/tests/make

diff --git a/tools/perf/tests/make b/tools/perf/tests/make
new file mode 100644
index 0000000..0cc64ea
--- /dev/null
+++ b/tools/perf/tests/make
@@ -0,0 +1,122 @@
+ifndef PERF
+PERF := .
+endif
+
+ifndef MK
+MK := Makefile
+endif
+
+MAKE_DEBUG          := DEBUG=1
+MAKE_NO_LIBPERL     := NO_LIBPERL=1
+MAKE_NO_LIBPYTHON   := NO_LIBPYTHON=1
+MAKE_NO_SCRIPTS     := NO_LIBPYTHON=1 NO_LIBPERL=1
+MAKE_NO_NEWT        := NO_NEWT=1
+MAKE_NO_SLANG       := NO_SLANG=1
+MAKE_NO_GTK2        := NO_GTK2=1
+MAKE_NO_UI          := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
+MAKE_NO_DEMANGLE    := NO_DEMANGLE=1
+MAKE_NO_LIBELF      := NO_LIBELF=1
+MAKE_NO_LIBUNWIND   := NO_LIBUNWIND=1
+MAKE_NO_BACKTRACE   := NO_BACKTRACE=1
+MAKE_NO_LIBNUMA     := NO_LIBNUMA=1
+MAKE_NO_LIBAUDIT    := NO_LIBAUDIT=1
+MAKE_NO_LIBBIONIC   := NO_LIBBIONIC=1
+MAKE_MINIMAL        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
+MAKE_TAGS           := tags
+MAKE_CSCOPE         := cscope
+MAKE_HELP           := help
+MAKE_DOC            := doc
+MAKE_PERF_O         := perf.o
+MAKE_UTIL_MAP_O     := util/map.o
+
+RUN := \
+	MAKE_PURE \
+	MAKE_DEBUG \
+	MAKE_NO_LIBPERL \
+	MAKE_NO_LIBPYTHON \
+	MAKE_NO_SCRIPTS \
+	MAKE_NO_NEWT \
+	MAKE_NO_SLANG \
+	MAKE_NO_GTK2 \
+	MAKE_NO_UI \
+	MAKE_NO_DEMANGLE \
+	MAKE_NO_LIBELF \
+	MAKE_NO_LIBUNWIND \
+	MAKE_NO_BACKTRACE \
+	MAKE_NO_LIBNUMA \
+	MAKE_NO_LIBAUDIT \
+	MAKE_NO_LIBBIONIC \
+	MAKE_MINIMAL \
+	MAKE_TAGS \
+	MAKE_CSCOPE \
+	MAKE_HELP \
+	MAKE_DOC \
+	MAKE_PERF_O \
+	MAKE_UTIL_MAP_O
+
+RUN_O := $(addsuffix _O,$(RUN))
+
+TEST_MAKE_TAGS   = test -f tags
+TEST_MAKE_CSCOPE = test -f cscope.out
+
+TEST_MAKE_TAGS_O   := $(TEST_MAKE_TAGS)
+TEST_MAKE_CSCOPE_O := $(TEST_MAKE_CSCOPE)
+
+TEST_OK := true
+TEST_MAKE_HELP   := $(TEST_OK)
+TEST_MAKE_DOC    := $(TEST_OK)
+TEST_MAKE_HELP_O := $(TEST_OK)
+TEST_MAKE_DOC_O  := $(TEST_OK)
+
+TEST_MAKE_PERF_O     := test -f $(PERF)/perf.o
+TEST_MAKE_UTIL_MAP_O := test -f $(PERF)/util/map.o
+
+# Kbuild tests only
+#TEST_MAKE_PERF_O_O     := test -f $$TMP/tools/perf/perf.o
+#TEST_MAKE_UTIL_MAP_O_O := test -f $$TMP/tools/perf/util/map.o
+
+TEST_MAKE_PERF_O_O     := true
+TEST_MAKE_UTIL_MAP_O_O := true
+
+TEST_DEFAULT = test -x $(PERF)/perf
+test = $(if $(TEST_$1),$(TEST_$1),$(TEST_DEFAULT))
+
+TEST_DEFAULT_O = test -x $$TMP/perf
+test_o = $(if $(TEST_$1),$(TEST_$1),$(TEST_DEFAULT_O))
+
+all:
+
+ifdef DEBUG
+d := $(info RUN   $(RUN))
+d := $(info RUN_O $(RUN_O))
+endif
+
+MAKEFLAGS := --no-print-directory
+
+clean := @cd $(PERF); make -s -f $(MK) clean >/dev/null
+
+$(RUN):
+	$(call clean) && \
+	cmd="cd $(PERF) && make -f $(MK) $($@)"; \
+	echo "$@: $$cmd" && echo $$cmd > $@ && \
+	( eval $$cmd ) >> $@ 2>&1; \
+	echo "TEST: $(call test,$@)"; \
+	$(call test,$@)
+
+$(RUN_O):
+	$(call clean) && \
+	TMP=$$(mktemp -d); \
+	cmd="cd $(PERF) && make -f $(MK) $($(patsubst %_O,%,$@)) O=$$TMP"; \
+	echo "$@: $$cmd" && echo $$cmd > $@ && \
+	( eval $$cmd ) >> $@ 2>&1 && \
+	echo "TEST: $(call test_o,$@)"; \
+	$(call test_o,$@) && \
+	rm -rf $$TMP
+
+all: $(RUN) $(RUN_O)
+	@echo OK
+
+out: $(RUN_O)
+	@echo OK
+
+.PHONY: all $(RUN) $(RUN_O) clean
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 02/27] perf tools: Fix tab vs spaces issue in Makefile ifdef/endif
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
  2013-04-01 19:18 ` [PATCH 01/27] perf tools: Add automated make test suite Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:49   ` Sam Ravnborg
  2013-04-01 19:18 ` [PATCH 03/27] perf tools: Move arch check into config/Makefile Jiri Olsa
                   ` (25 subsequent siblings)
  27 siblings, 1 reply; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Unmatched spaces/tabs Makefile indentation could make the
Makefile fails. While the tabed line could be considered
sometimes as follow up for rule command, the mixed space
tab meses up with makefile if conditions.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index b0f164b..c8fb0fd 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -90,7 +90,7 @@ endif
 
 # Treat warnings as errors unless directed not to
 ifneq ($(WERROR),0)
-	CFLAGS_WERROR := -Werror
+  CFLAGS_WERROR := -Werror
 endif
 
 ifeq ("$(origin DEBUG)", "command line")
@@ -819,10 +819,10 @@ endif
 ifdef NO_DEMANGLE
 	BASIC_CFLAGS += -DNO_DEMANGLE
 else
-        ifdef HAVE_CPLUS_DEMANGLE
+	ifdef HAVE_CPLUS_DEMANGLE
 		EXTLIBS += -liberty
 		BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
-        else
+	else
 		FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
 		has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
 		ifeq ($(has_bfd),y)
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 03/27] perf tools: Move arch check into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
  2013-04-01 19:18 ` [PATCH 01/27] perf tools: Add automated make test suite Jiri Olsa
  2013-04-01 19:18 ` [PATCH 02/27] perf tools: Fix tab vs spaces issue in Makefile ifdef/endif Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:54   ` Sam Ravnborg
  2013-04-01 21:54   ` Namhyung Kim
  2013-04-01 19:18 ` [PATCH 04/27] perf tools: Move programs " Jiri Olsa
                   ` (24 subsequent siblings)
  27 siblings, 2 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving arch check into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 31 ++-----------------------------
 tools/perf/config/Makefile | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 29 deletions(-)
 create mode 100644 tools/perf/config/Makefile

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index c8fb0fd..032e099 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -55,37 +55,11 @@ include config/utilities.mak
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
 
-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/ -e s/aarch64.*/arm64/ )
-NO_PERF_REGS := 1
-
 CC = $(CROSS_COMPILE)gcc
 AR = $(CROSS_COMPILE)ar
 
-# Additional ARCH settings for x86
-ifeq ($(ARCH),i386)
-	override ARCH := x86
-	NO_PERF_REGS := 0
-	LIBUNWIND_LIBS = -lunwind -lunwind-x86
-endif
-ifeq ($(ARCH),x86_64)
-	override ARCH := x86
-	IS_X86_64 := 0
-	ifeq (, $(findstring m32,$(EXTRA_CFLAGS)))
-		IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | 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
-	endif
-	NO_PERF_REGS := 0
-	LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
+ifeq ($(filter clean tags,$(MAKECMDGOALS)),)
+include config/Makefile
 endif
 
 # Treat warnings as errors unless directed not to
@@ -857,7 +831,6 @@ ifeq ($(NO_PERF_REGS),0)
 	ifeq ($(ARCH),x86)
 		LIB_H += arch/x86/include/perf_regs.h
 	endif
-	BASIC_CFLAGS += -DHAVE_PERF_REGS
 endif
 
 ifndef NO_STRLCPY
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
new file mode 100644
index 0000000..fe317c2
--- /dev/null
+++ b/tools/perf/config/Makefile
@@ -0,0 +1,34 @@
+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/ -e s/aarch64.*/arm64/ )
+NO_PERF_REGS := 1
+
+# Additional ARCH settings for x86
+ifeq ($(ARCH),i386)
+	override ARCH := x86
+	NO_PERF_REGS := 0
+	LIBUNWIND_LIBS = -lunwind -lunwind-x86
+endif
+
+ifeq ($(ARCH),x86_64)
+	override ARCH := x86
+	IS_X86_64 := 0
+	ifeq (, $(findstring m32,$(EXTRA_CFLAGS)))
+		IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | 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
+	endif
+	NO_PERF_REGS := 0
+	LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
+endif
+
+ifeq ($(NO_PERF_REGS),0)
+        BASIC_CFLAGS += -DHAVE_PERF_REGS
+endif
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 04/27] perf tools: Move programs check into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (2 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 03/27] perf tools: Move arch check into config/Makefile Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 22:09   ` Namhyung Kim
  2013-04-01 19:18 ` [PATCH 05/27] perf tools: Move compiler and linker flags " Jiri Olsa
                   ` (23 subsequent siblings)
  27 siblings, 1 reply; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving programs check into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 24 ++++++++----------------
 tools/perf/config/Makefile | 10 ++++++++++
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 032e099..8dd3320 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -58,6 +58,14 @@ $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 CC = $(CROSS_COMPILE)gcc
 AR = $(CROSS_COMPILE)ar
 
+RM      = rm -f
+MKDIR   = mkdir
+FIND    = find
+INSTALL = install
+FLEX    = flex
+BISON   = bison
+STRIP  ?= strip
+
 ifeq ($(filter clean tags,$(MAKECMDGOALS)),)
 include config/Makefile
 endif
@@ -88,7 +96,6 @@ CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99
 EXTLIBS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 ALL_LDFLAGS = $(LDFLAGS)
-STRIP ?= strip
 
 # Among the variables below, these:
 #   perfexecdir
@@ -125,13 +132,6 @@ lib = lib
 
 export prefix bindir sharedir sysconfdir
 
-RM = rm -f
-MKDIR = mkdir
-FIND = find
-INSTALL = install
-FLEX = flex
-BISON= bison
-
 # 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__
@@ -140,14 +140,6 @@ ifneq ($(MAKECMDGOALS),clean)
 ifneq ($(MAKECMDGOALS),tags)
 -include config/feature-tests.mak
 
-ifeq ($(call get-executable,$(FLEX)),)
-	dummy := $(error Error: $(FLEX) is missing on this system, please install it)
-endif
-
-ifeq ($(call get-executable,$(BISON)),)
-	dummy := $(error Error: $(BISON) is missing on this system, please install it)
-endif
-
 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
 	CFLAGS := $(CFLAGS) -fstack-protector-all
 endif
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index fe317c2..04bf8ac 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -32,3 +32,13 @@ endif
 ifeq ($(NO_PERF_REGS),0)
         BASIC_CFLAGS += -DHAVE_PERF_REGS
 endif
+
+-include config/feature-tests.mak
+
+ifeq ($(call get-executable,$(FLEX)),)
+	dummy := $(error Error: $(FLEX) is missing on this system, please install it)
+endif
+
+ifeq ($(call get-executable,$(BISON)),)
+	dummy := $(error Error: $(BISON) is missing on this system, please install it)
+endif
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 05/27] perf tools: Move compiler and linker flags check into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (3 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 04/27] perf tools: Move programs " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 22:20   ` Namhyung Kim
  2013-04-01 19:18 ` [PATCH 06/27] perf tools: Move libelf check config " Jiri Olsa
                   ` (22 subsequent siblings)
  27 siblings, 1 reply; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving compiler and linker flags check into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 110 ++++++++-------------------------------------
 tools/perf/config/Makefile |  66 +++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 91 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 8dd3320..dcae71b 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -52,6 +52,20 @@ include config/utilities.mak
 #
 # Define NO_LIBNUMA if you do not want numa perf benchmark
 
+ifeq ($(srctree),)
+srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+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))
+endif
+
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
 
@@ -66,37 +80,17 @@ FLEX    = flex
 BISON   = bison
 STRIP  ?= strip
 
+LK_DIR = ../lib/lk/
+TRACE_EVENT_DIR = ../lib/traceevent/
+
 ifeq ($(filter clean tags,$(MAKECMDGOALS)),)
 include config/Makefile
 endif
 
-# Treat warnings as errors unless directed not to
-ifneq ($(WERROR),0)
-  CFLAGS_WERROR := -Werror
-endif
-
-ifeq ("$(origin DEBUG)", "command line")
-  PERF_DEBUG = $(DEBUG)
-endif
-ifndef PERF_DEBUG
-  CFLAGS_OPTIMIZE = -O6
-endif
-
-ifdef PARSER_DEBUG
-	PARSER_DEBUG_BISON  := -t
-	PARSER_DEBUG_FLEX   := -d
-	PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
-endif
-
 ifdef NO_NEWT
 	NO_SLANG=1
 endif
 
-CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
-EXTLIBS = -lpthread -lrt -lelf -lm
-ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-ALL_LDFLAGS = $(LDFLAGS)
-
 # Among the variables below, these:
 #   perfexecdir
 #   template_dir
@@ -136,71 +130,6 @@ export prefix bindir sharedir sysconfdir
 # explicitly what architecture to check for. Fix this up for yours..
 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 
-ifneq ($(MAKECMDGOALS),clean)
-ifneq ($(MAKECMDGOALS),tags)
--include config/feature-tests.mak
-
-ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
-	CFLAGS := $(CFLAGS) -fstack-protector-all
-endif
-
-ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y)
-       CFLAGS := $(CFLAGS) -Wstack-protector
-endif
-
-ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y)
-       CFLAGS := $(CFLAGS) -Wvolatile-register-var
-endif
-
-ifndef PERF_DEBUG
-	ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y)
-		CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2
-	endif
-endif
-
-### --- END CONFIGURATION SECTION ---
-
-ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
-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))
-endif
-
-BASIC_CFLAGS = \
-	-Iutil/include \
-	-Iarch/$(ARCH)/include \
-	$(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
-	-I$(srctree)/arch/$(ARCH)/include/uapi \
-	-I$(srctree)/arch/$(ARCH)/include \
-	$(if $(objtree),-I$(objtree)/include/generated/uapi) \
-	-I$(srctree)/include/uapi \
-	-I$(srctree)/include \
-	-I$(OUTPUT)util \
-	-Iutil \
-	-I. \
-	-I$(TRACE_EVENT_DIR) \
-	-I../lib/ \
-	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-
-BASIC_LDFLAGS =
-
-ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
-	BIONIC := 1
-	EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
-	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
-	BASIC_CFLAGS += -I.
-endif
-endif # MAKECMDGOALS != tags
-endif # MAKECMDGOALS != clean
-
 # Guard against environment variables
 BUILTIN_OBJS =
 LIB_H =
@@ -213,9 +142,6 @@ SCRIPT_SH += perf-archive.sh
 grep-libs = $(filter -l%,$(1))
 strip-libs = $(filter-out -l%,$(1))
 
-LK_DIR = ../lib/lk/
-TRACE_EVENT_DIR = ../lib/traceevent/
-
 LK_PATH=$(LK_DIR)
 
 ifneq ($(OUTPUT),)
@@ -529,6 +455,8 @@ PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT)
 ifneq ($(MAKECMDGOALS),clean)
 ifneq ($(MAKECMDGOALS),tags)
 
+-include config/feature-tests.mak
+
 # 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...
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 04bf8ac..9ce522a 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -42,3 +42,69 @@ endif
 ifeq ($(call get-executable,$(BISON)),)
 	dummy := $(error Error: $(BISON) is missing on this system, please install it)
 endif
+
+# Treat warnings as errors unless directed not to
+ifneq ($(WERROR),0)
+	CFLAGS_WERROR := -Werror
+endif
+
+ifeq ("$(origin DEBUG)", "command line")
+	PERF_DEBUG = $(DEBUG)
+endif
+ifndef PERF_DEBUG
+	CFLAGS_OPTIMIZE = -O6
+endif
+
+ifdef PARSER_DEBUG
+	PARSER_DEBUG_BISON  := -t
+	PARSER_DEBUG_FLEX   := -d
+	PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
+endif
+
+CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
+EXTLIBS = -lpthread -lrt -lelf -lm
+ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+ALL_LDFLAGS = $(LDFLAGS)
+
+ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
+	CFLAGS := $(CFLAGS) -fstack-protector-all
+endif
+
+ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y)
+	CFLAGS := $(CFLAGS) -Wstack-protector
+endif
+
+ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y)
+	CFLAGS := $(CFLAGS) -Wvolatile-register-var
+endif
+
+ifndef PERF_DEBUG
+	ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y)
+		CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2
+	endif
+endif
+
+BASIC_CFLAGS = \
+	-Iutil/include \
+	-Iarch/$(ARCH)/include \
+	$(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
+	-I$(srctree)/arch/$(ARCH)/include/uapi \
+	-I$(srctree)/arch/$(ARCH)/include \
+	$(if $(objtree),-I$(objtree)/include/generated/uapi) \
+	-I$(srctree)/include/uapi \
+	-I$(srctree)/include \
+	-I$(OUTPUT)util \
+	-Iutil \
+	-I. \
+	-I$(TRACE_EVENT_DIR) \
+	-I../lib/ \
+	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+
+BASIC_LDFLAGS =
+
+ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
+	BIONIC := 1
+	EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
+	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
+	BASIC_CFLAGS += -I.
+endif
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 06/27] perf tools: Move libelf check config into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (4 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 05/27] perf tools: Move compiler and linker flags " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 07/27] perf tools: Move libdw " Jiri Olsa
                   ` (21 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving libelf check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 46 ---------------------------------------------
 tools/perf/config/Makefile | 47 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index dcae71b..0ea3359 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -461,45 +461,6 @@ ifneq ($(MAKECMDGOALS),tags)
 # because maintaining the nesting to match is a pain.  If
 # we had "elif" things would have been much nicer...
 
-ifdef NO_LIBELF
-	NO_DWARF := 1
-	NO_DEMANGLE := 1
-	NO_LIBUNWIND := 1
-else
-FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
-	FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
-	ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
-		LIBC_SUPPORT := 1
-	endif
-	ifeq ($(BIONIC),1)
-		LIBC_SUPPORT := 1
-	endif
-	ifeq ($(LIBC_SUPPORT),1)
-		msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
-
-		NO_LIBELF := 1
-		NO_DWARF := 1
-		NO_DEMANGLE := 1
-	else
-		msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
-	endif
-else
-	# for linking with debug library, run like:
-	# make DEBUG=1 LIBDW_DIR=/opt/libdw/
-	ifdef LIBDW_DIR
-		LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
-		LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
-	endif
-
-	FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-	ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),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 # SOURCE_LIBELF
-endif # NO_LIBELF
-
 # There's only x86 (both 32 and 64) support for CFI unwind so far
 ifneq ($(ARCH),x86)
 	NO_LIBUNWIND := 1
@@ -541,13 +502,6 @@ BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
 LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
 
 else # NO_LIBELF
-BASIC_CFLAGS += -DLIBELF_SUPPORT
-
-FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
-	BASIC_CFLAGS += -DLIBELF_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);
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 9ce522a..ef09d6c 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -108,3 +108,50 @@ ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
 	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
 	BASIC_CFLAGS += -I.
 endif
+
+ifdef NO_LIBELF
+	NO_DWARF := 1
+	NO_DEMANGLE := 1
+	NO_LIBUNWIND := 1
+else
+FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
+	FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
+	ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
+		LIBC_SUPPORT := 1
+	endif
+	ifeq ($(BIONIC),1)
+		LIBC_SUPPORT := 1
+	endif
+	ifeq ($(LIBC_SUPPORT),1)
+		msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
+
+		NO_LIBELF := 1
+		NO_DWARF := 1
+		NO_DEMANGLE := 1
+	else
+		msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
+	endif
+else
+	# for linking with debug library, run like:
+	# make DEBUG=1 LIBDW_DIR=/opt/libdw/
+	ifdef LIBDW_DIR
+		LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
+		LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
+	endif
+
+	FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+	ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),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 # SOURCE_LIBELF
+endif # NO_LIBELF
+
+ifndef NO_LIBELF
+BASIC_CFLAGS += -DLIBELF_SUPPORT
+FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
+	BASIC_CFLAGS += -DLIBELF_MMAP
+endif
+endif # NO_LIBELF
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 07/27] perf tools: Move libdw check config into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (5 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 06/27] perf tools: Move libelf check config " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 08/27] perf tools: Move libunwind " Jiri Olsa
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving libdw check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        |  7 -------
 tools/perf/config/Makefile | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 0ea3359..ed5e8c9 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -503,15 +503,8 @@ LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
 
 else # NO_LIBELF
 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 $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
-	BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
-	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
 endif # NO_LIBELF
 
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index ef09d6c..3620877 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -154,4 +154,19 @@ FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
 ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
 	BASIC_CFLAGS += -DLIBELF_MMAP
 endif
+
+# include ARCH specific config
+-include arch/$(ARCH)/Makefile
+
+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);
+	NO_DWARF := 1
+else
+	BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
+	BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
+	EXTLIBS += -lelf -ldw
+endif # PERF_HAVE_DWARF_REGS
+endif # NO_DWARF
+
 endif # NO_LIBELF
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 08/27] perf tools: Move libunwind check config into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (6 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 07/27] perf tools: Move libdw " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 09/27] perf tools: Move libaudit " Jiri Olsa
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving libunwind check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 24 ------------------------
 tools/perf/config/Makefile | 27 +++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index ed5e8c9..5e877a4 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -461,26 +461,6 @@ ifneq ($(MAKECMDGOALS),tags)
 # because maintaining the nesting to match is a pain.  If
 # we had "elif" things would have been much nicer...
 
-# There's only x86 (both 32 and 64) support for CFI unwind so far
-ifneq ($(ARCH),x86)
-	NO_LIBUNWIND := 1
-endif
-
-ifndef NO_LIBUNWIND
-# for linking with debug library, run like:
-# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
-ifdef LIBUNWIND_DIR
-	LIBUNWIND_CFLAGS  := -I$(LIBUNWIND_DIR)/include
-	LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
-endif
-
-FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
-ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
-	msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
-	NO_LIBUNWIND := 1
-endif # Libunwind support
-endif # NO_LIBUNWIND
-
 -include arch/$(ARCH)/Makefile
 
 ifneq ($(OUTPUT),)
@@ -509,10 +489,6 @@ endif # NO_DWARF
 endif # NO_LIBELF
 
 ifndef NO_LIBUNWIND
-	BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
-	EXTLIBS += $(LIBUNWIND_LIBS)
-	BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
-	BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
 	LIB_OBJS += $(OUTPUT)util/unwind.o
 endif
 
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 3620877..92c395f 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -170,3 +170,30 @@ endif # PERF_HAVE_DWARF_REGS
 endif # NO_DWARF
 
 endif # NO_LIBELF
+
+# There's only x86 (both 32 and 64) support for CFI unwind so far
+ifneq ($(ARCH),x86)
+	NO_LIBUNWIND := 1
+endif
+
+ifndef NO_LIBUNWIND
+# for linking with debug library, run like:
+# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
+ifdef LIBUNWIND_DIR
+	LIBUNWIND_CFLAGS  := -I$(LIBUNWIND_DIR)/include
+	LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
+endif
+
+FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
+ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
+	msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
+	NO_LIBUNWIND := 1
+endif # Libunwind support
+endif # NO_LIBUNWIND
+
+ifndef NO_LIBUNWIND
+	BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
+	EXTLIBS += $(LIBUNWIND_LIBS)
+	BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
+	BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
+endif # NO_LIBUNWIND
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 09/27] perf tools: Move libaudit check config into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (7 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 08/27] perf tools: Move libunwind " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 10/27] perf tools: Move slang " Jiri Olsa
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving libaudit check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        |  9 +--------
 tools/perf/config/Makefile | 11 +++++++++++
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 5e877a4..16d1362 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -493,14 +493,7 @@ ifndef NO_LIBUNWIND
 endif
 
 ifndef NO_LIBAUDIT
-	FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit
-	ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
-		msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
-	else
-		BASIC_CFLAGS += -DLIBAUDIT_SUPPORT
-		BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
-		EXTLIBS += -laudit
-	endif
+	BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
 endif
 
 ifndef NO_SLANG
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 92c395f..52d6fe9 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -197,3 +197,14 @@ ifndef NO_LIBUNWIND
 	BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
 	BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
 endif # NO_LIBUNWIND
+
+ifndef NO_LIBAUDIT
+	FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit
+	ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
+		msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
+		NO_LIBAUDIT := 1
+	else
+		BASIC_CFLAGS += -DLIBAUDIT_SUPPORT
+		EXTLIBS += -laudit
+	endif
+endif
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 10/27] perf tools: Move slang check config into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (8 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 09/27] perf tools: Move libaudit " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 11/27] perf tools: Move gtk2 " Jiri Olsa
                   ` (17 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving slang check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 39 +++++++++++++--------------------------
 tools/perf/config/Makefile | 17 +++++++++++++++++
 2 files changed, 30 insertions(+), 26 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 16d1362..f6744cb 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -87,10 +87,6 @@ ifeq ($(filter clean tags,$(MAKECMDGOALS)),)
 include config/Makefile
 endif
 
-ifdef NO_NEWT
-	NO_SLANG=1
-endif
-
 # Among the variables below, these:
 #   perfexecdir
 #   template_dir
@@ -497,28 +493,19 @@ ifndef NO_LIBAUDIT
 endif
 
 ifndef NO_SLANG
-	FLAGS_SLANG=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
-	ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y)
-		msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
-	else
-		# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
-		BASIC_CFLAGS += -I/usr/include/slang
-		BASIC_CFLAGS += -DSLANG_SUPPORT
-		EXTLIBS += -lslang
-		LIB_OBJS += $(OUTPUT)ui/browser.o
-		LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
-		LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
-		LIB_OBJS += $(OUTPUT)ui/browsers/map.o
-		LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
-		LIB_OBJS += $(OUTPUT)ui/tui/setup.o
-		LIB_OBJS += $(OUTPUT)ui/tui/util.o
-		LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
-		LIB_OBJS += $(OUTPUT)ui/tui/progress.o
-		LIB_H += ui/browser.h
-		LIB_H += ui/browsers/map.h
-		LIB_H += ui/keysyms.h
-		LIB_H += ui/libslang.h
-	endif
+	LIB_OBJS += $(OUTPUT)ui/browser.o
+	LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
+	LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
+	LIB_OBJS += $(OUTPUT)ui/browsers/map.o
+	LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
+	LIB_OBJS += $(OUTPUT)ui/tui/setup.o
+	LIB_OBJS += $(OUTPUT)ui/tui/util.o
+	LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
+	LIB_OBJS += $(OUTPUT)ui/tui/progress.o
+	LIB_H += ui/browser.h
+	LIB_H += ui/browsers/map.h
+	LIB_H += ui/keysyms.h
+	LIB_H += ui/libslang.h
 endif
 
 ifndef NO_GTK2
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 52d6fe9..008b212 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -208,3 +208,20 @@ ifndef NO_LIBAUDIT
 		EXTLIBS += -laudit
 	endif
 endif
+
+ifdef NO_NEWT
+	NO_SLANG=1
+endif
+
+ifndef NO_SLANG
+	FLAGS_SLANG=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
+	ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y)
+		msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
+		NO_SLANG := 1
+	else
+		# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
+		BASIC_CFLAGS += -I/usr/include/slang
+		BASIC_CFLAGS += -DSLANG_SUPPORT
+		EXTLIBS += -lslang
+	endif
+endif
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 11/27] perf tools: Move gtk2 check config into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (9 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 10/27] perf tools: Move slang " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 12/27] perf tools: Move libperl " Jiri Olsa
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving gtk2 check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 25 +++++++------------------
 tools/perf/config/Makefile | 15 +++++++++++++++
 2 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index f6744cb..8d3dd8e 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -509,24 +509,13 @@ ifndef NO_SLANG
 endif
 
 ifndef NO_GTK2
-	FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
-	ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
-		msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
-	else
-		ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
-			BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
-		endif
-		BASIC_CFLAGS += -DGTK2_SUPPORT
-		BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
-		EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
-		LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/hists.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/util.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o
-	endif
+	LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
+	LIB_OBJS += $(OUTPUT)ui/gtk/hists.o
+	LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
+	LIB_OBJS += $(OUTPUT)ui/gtk/util.o
+	LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
+	LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
+	LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o
 endif
 
 ifdef NO_LIBPERL
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 008b212..6fc2089 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -225,3 +225,18 @@ ifndef NO_SLANG
 		EXTLIBS += -lslang
 	endif
 endif
+
+ifndef NO_GTK2
+	FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
+	ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
+		msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
+		NO_GTK2 := 1
+	else
+		ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
+			BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
+		endif
+		BASIC_CFLAGS += -DGTK2_SUPPORT
+		BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
+		EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
+	endif
+endif
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 12/27] perf tools: Move libperl check config into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (10 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 11/27] perf tools: Move gtk2 " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 13/27] perf tools: Move libpython " Jiri Olsa
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving libperl check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 20 +++-----------------
 tools/perf/config/Makefile | 21 +++++++++++++++++++++
 2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 8d3dd8e..972aa94 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -518,23 +518,9 @@ ifndef NO_GTK2
 	LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o
 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),perl),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
+ifndef NO_LIBPERL
+	LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
+	LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
 endif
 
 disable-python = $(eval $(disable-python_code))
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 6fc2089..2c9e0a5 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -240,3 +240,24 @@ ifndef NO_GTK2
 		EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
 	endif
 endif
+
+grep-libs  = $(filter -l%,$(1))
+strip-libs = $(filter-out -l%,$(1))
+
+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),perl),y)
+		BASIC_CFLAGS += -DNO_LIBPERL
+		NO_LIBPERL := 1
+	else
+		ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
+		EXTLIBS += $(PERL_EMBED_LIBADD)
+	endif
+endif
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 13/27] perf tools: Move libpython check config into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (11 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 12/27] perf tools: Move libperl " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 14/27] perf tools: Move libbfd " Jiri Olsa
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving libpython check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 68 ++--------------------------------------------
 tools/perf/config/Makefile | 63 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 65 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 972aa94..f02c0fd 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -184,8 +184,6 @@ SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
 #
 PROGRAMS += $(OUTPUT)perf
 
-LANG_BINDINGS =
-
 # what 'all' will build and 'install' will install, in perfexecdir
 ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
 
@@ -523,69 +521,9 @@ ifndef NO_LIBPERL
 	LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
 endif
 
-disable-python = $(eval $(disable-python_code))
-define disable-python_code
-  BASIC_CFLAGS += -DNO_LIBPYTHON
-  $(if $(1),$(warning No $(1) was found))
-  $(warning Python support will not be built)
-endef
-
-override PYTHON := \
-  $(call get-executable-or-default,PYTHON,python)
-
-ifndef PYTHON
-  $(call disable-python,python interpreter)
-else
-
-  PYTHON_WORD := $(call shell-wordify,$(PYTHON))
-
-  ifdef NO_LIBPYTHON
-    $(call disable-python)
-  else
-
-    override PYTHON_CONFIG := \
-      $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config)
-
-    ifndef PYTHON_CONFIG
-      $(call disable-python,python-config tool)
-    else
-
-      PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
-
-      PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
-      PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
-      PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
-      PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
-      FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
-
-      ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED),python),y)
-        $(call disable-python,Python.h (for Python 2.x))
-      else
-
-        ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y)
-          $(warning Python 3 is not yet supported; please set)
-          $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
-          $(warning If you also have Python 2 installed, then)
-          $(warning try something like:)
-          $(warning $(and ,))
-          $(warning $(and ,)  make PYTHON=python2)
-          $(warning $(and ,))
-          $(warning Otherwise, disable Python support entirely:)
-          $(warning $(and ,))
-          $(warning $(and ,)  make NO_LIBPYTHON=1)
-          $(warning $(and ,))
-          $(error   $(and ,))
-        else
-          ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
-          EXTLIBS += $(PYTHON_EMBED_LIBADD)
-          LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
-          LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
-          LANG_BINDINGS += $(OUTPUT)python/perf.so
-        endif
-
-      endif
-    endif
-  endif
+ifndef NO_LIBPYTHON
+	LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
+	LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
 endif
 
 ifdef NO_DEMANGLE
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 2c9e0a5..d5e0386 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -261,3 +261,66 @@ else
 		EXTLIBS += $(PERL_EMBED_LIBADD)
 	endif
 endif
+
+disable-python = $(eval $(disable-python_code))
+define disable-python_code
+  BASIC_CFLAGS += -DNO_LIBPYTHON
+  $(if $(1),$(warning No $(1) was found))
+  $(warning Python support will not be built)
+  NO_LIBPYTHON := 1
+endef
+
+override PYTHON := \
+  $(call get-executable-or-default,PYTHON,python)
+
+ifndef PYTHON
+  $(call disable-python,python interpreter)
+else
+
+  PYTHON_WORD := $(call shell-wordify,$(PYTHON))
+
+  ifdef NO_LIBPYTHON
+    $(call disable-python)
+  else
+
+    override PYTHON_CONFIG := \
+      $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config)
+
+    ifndef PYTHON_CONFIG
+      $(call disable-python,python-config tool)
+    else
+
+      PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
+
+      PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
+      PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
+      PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
+      PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
+      FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
+
+      ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED),python),y)
+        $(call disable-python,Python.h (for Python 2.x))
+      else
+
+        ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y)
+          $(warning Python 3 is not yet supported; please set)
+          $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
+          $(warning If you also have Python 2 installed, then)
+          $(warning try something like:)
+          $(warning $(and ,))
+          $(warning $(and ,)  make PYTHON=python2)
+          $(warning $(and ,))
+          $(warning Otherwise, disable Python support entirely:)
+          $(warning $(and ,))
+          $(warning $(and ,)  make NO_LIBPYTHON=1)
+          $(warning $(and ,))
+          $(error   $(and ,))
+        else
+          ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
+          EXTLIBS += $(PYTHON_EMBED_LIBADD)
+          LANG_BINDINGS += $(OUTPUT)python/perf.so
+        endif
+      endif
+    endif
+  endif
+endif
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 14/27] perf tools: Move libbfd check config into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (12 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 13/27] perf tools: Move libpython " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 15/27] perf tools: Move stdlib " Jiri Olsa
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving libbfd check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 37 -------------------------------------
 tools/perf/config/Makefile | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index f02c0fd..09ac64a 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -526,43 +526,6 @@ ifndef NO_LIBPYTHON
 	LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
 endif
 
-ifdef NO_DEMANGLE
-	BASIC_CFLAGS += -DNO_DEMANGLE
-else
-	ifdef HAVE_CPLUS_DEMANGLE
-		EXTLIBS += -liberty
-		BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
-	else
-		FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
-		has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
-		ifeq ($(has_bfd),y)
-			EXTLIBS += -lbfd
-		else
-			FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
-			has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty)
-			ifeq ($(has_bfd_iberty),y)
-				EXTLIBS += -lbfd -liberty
-			else
-				FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz
-				has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz)
-				ifeq ($(has_bfd_iberty_z),y)
-					EXTLIBS += -lbfd -liberty -lz
-				else
-					FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
-					has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
-					ifeq ($(has_cplus_demangle),y)
-						EXTLIBS += -liberty
-						BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
-					else
-						msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
-						BASIC_CFLAGS += -DNO_DEMANGLE
-					endif
-				endif
-			endif
-		endif
-	endif
-endif
-
 ifeq ($(NO_PERF_REGS),0)
 	ifeq ($(ARCH),x86)
 		LIB_H += arch/x86/include/perf_regs.h
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index d5e0386..68c6a2b 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -324,3 +324,40 @@ else
     endif
   endif
 endif
+
+ifdef NO_DEMANGLE
+	BASIC_CFLAGS += -DNO_DEMANGLE
+else
+	ifdef HAVE_CPLUS_DEMANGLE
+		EXTLIBS += -liberty
+		BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
+	else
+		FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
+		has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
+		ifeq ($(has_bfd),y)
+			EXTLIBS += -lbfd
+		else
+			FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
+			has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty)
+			ifeq ($(has_bfd_iberty),y)
+				EXTLIBS += -lbfd -liberty
+			else
+				FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz
+				has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz)
+				ifeq ($(has_bfd_iberty_z),y)
+					EXTLIBS += -lbfd -liberty -lz
+				else
+					FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
+					has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
+					ifeq ($(has_cplus_demangle),y)
+						EXTLIBS += -liberty
+						BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
+					else
+						msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
+						BASIC_CFLAGS += -DNO_DEMANGLE
+					endif
+				endif
+			endif
+		endif
+	endif
+endif
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 15/27] perf tools: Move stdlib check config into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (13 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 14/27] perf tools: Move libbfd " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 16/27] perf tools: Move libnuma " Jiri Olsa
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving stdlib check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 18 ------------------
 tools/perf/config/Makefile | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 09ac64a..ad826b5 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -532,24 +532,6 @@ ifeq ($(NO_PERF_REGS),0)
 	endif
 endif
 
-ifndef NO_STRLCPY
-	ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y)
-		BASIC_CFLAGS += -DHAVE_STRLCPY
-	endif
-endif
-
-ifndef NO_ON_EXIT
-	ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y)
-		BASIC_CFLAGS += -DHAVE_ON_EXIT
-	endif
-endif
-
-ifndef NO_BACKTRACE
-       ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
-               BASIC_CFLAGS += -DBACKTRACE_SUPPORT
-       endif
-endif
-
 ifndef NO_LIBNUMA
 	FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma
 	ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 68c6a2b..8c832f7 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -361,3 +361,21 @@ else
 		endif
 	endif
 endif
+
+ifndef NO_STRLCPY
+	ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y)
+		BASIC_CFLAGS += -DHAVE_STRLCPY
+	endif
+endif
+
+ifndef NO_ON_EXIT
+	ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y)
+		BASIC_CFLAGS += -DHAVE_ON_EXIT
+	endif
+endif
+
+ifndef NO_BACKTRACE
+       ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
+		BASIC_CFLAGS += -DBACKTRACE_SUPPORT
+       endif
+endif
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 16/27] perf tools: Move libnuma check config into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (14 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 15/27] perf tools: Move stdlib " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 17/27] perf tools: Move paths " Jiri Olsa
                   ` (11 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving libnuma check config into config/Makefile

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        |  9 +--------
 tools/perf/config/Makefile | 11 +++++++++++
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index ad826b5..1524de7 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -533,14 +533,7 @@ ifeq ($(NO_PERF_REGS),0)
 endif
 
 ifndef NO_LIBNUMA
-	FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma
-	ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
-		msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev);
-	else
-		BASIC_CFLAGS += -DLIBNUMA_SUPPORT
-		BUILTIN_OBJS += $(OUTPUT)bench/numa.o
-		EXTLIBS += -lnuma
-	endif
+	BUILTIN_OBJS += $(OUTPUT)bench/numa.o
 endif
 
 ifdef ASCIIDOC8
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 8c832f7..b559693 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -379,3 +379,14 @@ ifndef NO_BACKTRACE
 		BASIC_CFLAGS += -DBACKTRACE_SUPPORT
        endif
 endif
+
+ifndef NO_LIBNUMA
+	FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma
+	ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
+		msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev);
+		NO_LIBNUMA := 1
+	else
+		BASIC_CFLAGS += -DLIBNUMA_SUPPORT
+		EXTLIBS += -lnuma
+	endif
+endif
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 17/27] perf tools: Move paths config into config/Makefile
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (15 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 16/27] perf tools: Move libnuma " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 18/27] perf tools: Final touches for CHK config move Jiri Olsa
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Moving paths config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 58 ----------------------------------------------
 tools/perf/config/Makefile | 52 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 58 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 1524de7..e9c9258 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -87,39 +87,6 @@ ifeq ($(filter clean tags,$(MAKECMDGOALS)),)
 include config/Makefile
 endif
 
-# 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
 
 # sparse is architecture-neutral, which means that we need to tell it
@@ -543,23 +510,6 @@ endif
 endif # MAKECMDGOALS != tags
 endif # MAKECMDGOALS != clean
 
-# Shell quote (do not use $(call) to accommodate ancient setups);
-
-ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
-
-DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
-bindir_SQ = $(subst ','\'',$(bindir))
-bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
-mandir_SQ = $(subst ','\'',$(mandir))
-infodir_SQ = $(subst ','\'',$(infodir))
-perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
-template_dir_SQ = $(subst ','\'',$(template_dir))
-htmldir_SQ = $(subst ','\'',$(htmldir))
-prefix_SQ = $(subst ','\'',$(prefix))
-sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
-
-SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
-
 LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
 
 ALL_CFLAGS += $(BASIC_CFLAGS)
@@ -568,7 +518,6 @@ ALL_LDFLAGS += $(BASIC_LDFLAGS)
 
 export INSTALL SHELL_PATH
 
-
 ### Build rules
 
 SHELL = $(SHELL_PATH)
@@ -810,13 +759,6 @@ check: $(OUTPUT)common-cmds.h
 
 ### Installation rules
 
-ifneq ($(filter /%,$(firstword $(perfexecdir))),)
-perfexec_instdir = $(perfexecdir)
-else
-perfexec_instdir = $(prefix)/$(perfexecdir)
-endif
-perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
-
 install-bin: all
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
 	$(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index b559693..a0dbc24 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -390,3 +390,55 @@ ifndef NO_LIBNUMA
 		EXTLIBS += -lnuma
 	endif
 endif
+
+# 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
+
+# Shell quote (do not use $(call) to accommodate ancient setups);
+ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
+DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
+bindir_SQ = $(subst ','\'',$(bindir))
+mandir_SQ = $(subst ','\'',$(mandir))
+infodir_SQ = $(subst ','\'',$(infodir))
+perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
+template_dir_SQ = $(subst ','\'',$(template_dir))
+htmldir_SQ = $(subst ','\'',$(htmldir))
+prefix_SQ = $(subst ','\'',$(prefix))
+sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
+
+ifneq ($(filter /%,$(firstword $(perfexecdir))),)
+perfexec_instdir = $(perfexecdir)
+else
+perfexec_instdir = $(prefix)/$(perfexecdir)
+endif
+perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 18/27] perf tools: Final touches for CHK config move
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (16 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 17/27] perf tools: Move paths " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 19/27] perf tools: Merge all *CFLAGS* make variable into CFLAGS Jiri Olsa
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Removing no longer needed ifdefs.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index e9c9258..c25997f 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -410,14 +410,6 @@ BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
 
 PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT)
 
-#
-# Platform specific tweaks
-#
-ifneq ($(MAKECMDGOALS),clean)
-ifneq ($(MAKECMDGOALS),tags)
-
--include config/feature-tests.mak
-
 # 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...
@@ -507,9 +499,6 @@ ifdef ASCIIDOC8
 	export ASCIIDOC8
 endif
 
-endif # MAKECMDGOALS != tags
-endif # MAKECMDGOALS != clean
-
 LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
 
 ALL_CFLAGS += $(BASIC_CFLAGS)
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 19/27] perf tools: Merge all *CFLAGS* make variable into CFLAGS
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (17 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 18/27] perf tools: Final touches for CHK config move Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 20/27] perf tools: Merge all *LDFLAGS* make variable into LDFLAGS Jiri Olsa
                   ` (8 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Merging all *CFLAGS* make variable into CFLAGS to eliminate
all special *_CFLAGS_* variables and make the setup clear.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        |  62 +++++++++++++--------------
 tools/perf/config/Makefile | 104 ++++++++++++++++++++++++---------------------
 tools/perf/util/setup.py   |   2 +-
 3 files changed, 86 insertions(+), 82 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index c25997f..d467820 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -136,7 +136,7 @@ PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
 PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT)
 
 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
-	$(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \
+	$(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
 	  --quiet build_ext; \
 	mkdir -p $(OUTPUT)python && \
 	cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
@@ -501,8 +501,6 @@ endif
 
 LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
 
-ALL_CFLAGS += $(BASIC_CFLAGS)
-ALL_CFLAGS += $(ARCH_CFLAGS)
 ALL_LDFLAGS += $(BASIC_LDFLAGS)
 
 export INSTALL SHELL_PATH
@@ -524,20 +522,20 @@ strip: $(PROGRAMS) $(OUTPUT)perf
 $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -include $(OUTPUT)PERF-VERSION-FILE \
 		'-DPERF_HTML_PATH="$(htmldir_SQ)"' \
-		$(ALL_CFLAGS) -c $(filter %.c,$^) -o $@
+		$(CFLAGS) -c $(filter %.c,$^) -o $@
 
 $(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
-	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \
+	$(QUIET_LINK)$(CC) $(CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \
                $(BUILTIN_OBJS) $(LIBS) -o $@
 
 $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
 		'-DPERF_HTML_PATH="$(htmldir_SQ)"' \
 		'-DPERF_MAN_PATH="$(mandir_SQ)"' \
 		'-DPERF_INFO_PATH="$(infodir_SQ)"' $<
 
 $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
 		'-DPERF_HTML_PATH="$(htmldir_SQ)"' \
 		'-DPERF_MAN_PATH="$(mandir_SQ)"' \
 		'-DPERF_INFO_PATH="$(infodir_SQ)"' $<
@@ -562,77 +560,77 @@ $(OUTPUT)perf.o perf.spec \
 # over the general rule for .o
 
 $(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(ALL_CFLAGS) -w $<
+	$(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -w $<
 
 $(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $<
+	$(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $<
 
 $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
 $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
+	$(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
 $(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $<
+	$(QUIET_CC)$(CC) -o $@ -S $(CFLAGS) $<
 $(OUTPUT)%.o: %.S
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
 $(OUTPUT)%.s: %.S
-	$(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
+	$(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
 
 $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
 		'-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
 		'-DPREFIX="$(prefix_SQ)"' \
 		$<
 
 $(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
 		'-DBINDIR="$(bindir_SQ)"' -DPYTHON='"$(PYTHON_WORD)"' \
 		$<
 
 $(OUTPUT)tests/python-use.o: tests/python-use.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
 		-DPYTHONPATH='"$(OUTPUT)python"' \
 		-DPYTHON='"$(PYTHON_WORD)"' \
 		$<
 
 $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
 
 $(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
 $(OUTPUT)ui/browsers/annotate.o: ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
 $(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
 $(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
 $(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
 $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
 
 $(OUTPUT)util/parse-events.o: util/parse-events.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-redundant-decls $<
 
 $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
 
 $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
 
 $(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
 
 $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
 
 $(OUTPUT)perf-%: %.o $(PERFLIBS)
-	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
+	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
 
 $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
 $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
@@ -719,7 +717,7 @@ cscope:
 	$(FIND) . -name '*.[hcS]' -print | xargs cscope -b
 
 ### Detect prefix changes
-TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
+TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\
              $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
 
 $(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS
@@ -740,7 +738,7 @@ check: $(OUTPUT)common-cmds.h
 	then \
 		for i in *.c */*.c; \
 		do \
-			sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
+			sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
 		done; \
 	else \
 		exit 1; \
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index a0dbc24..a53d2b3 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -6,6 +6,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
 				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
 				  -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ )
 NO_PERF_REGS := 1
+CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
 
 # Additional ARCH settings for x86
 ifeq ($(ARCH),i386)
@@ -17,12 +18,12 @@ endif
 ifeq ($(ARCH),x86_64)
 	override ARCH := x86
 	IS_X86_64 := 0
-	ifeq (, $(findstring m32,$(EXTRA_CFLAGS)))
+	ifeq (, $(findstring m32,$(CFLAGS)))
 		IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1)
 	endif
 	ifeq (${IS_X86_64}, 1)
 		RAW_ARCH := x86_64
-		ARCH_CFLAGS := -DARCH_X86_64
+		CFLAGS += -DARCH_X86_64
 		ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
 	endif
 	NO_PERF_REGS := 0
@@ -30,7 +31,7 @@ ifeq ($(ARCH),x86_64)
 endif
 
 ifeq ($(NO_PERF_REGS),0)
-        BASIC_CFLAGS += -DHAVE_PERF_REGS
+        CFLAGS += -DHAVE_PERF_REGS
 endif
 
 -include config/feature-tests.mak
@@ -45,46 +46,52 @@ endif
 
 # Treat warnings as errors unless directed not to
 ifneq ($(WERROR),0)
-	CFLAGS_WERROR := -Werror
+	CFLAGS += -Werror
 endif
 
 ifeq ("$(origin DEBUG)", "command line")
 	PERF_DEBUG = $(DEBUG)
 endif
 ifndef PERF_DEBUG
-	CFLAGS_OPTIMIZE = -O6
+	CFLAGS += -O6
 endif
 
 ifdef PARSER_DEBUG
-	PARSER_DEBUG_BISON  := -t
-	PARSER_DEBUG_FLEX   := -d
-	PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
+	PARSER_DEBUG_BISON := -t
+	PARSER_DEBUG_FLEX  := -d
+	CFLAGS             += -DPARSER_DEBUG
 endif
 
-CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
+CFLAGS += \
+	-fno-omit-frame-pointer \
+	-ggdb3 \
+	-funwind-tables \
+	-Wall \
+	-Wextra \
+	-std=gnu99
+
 EXTLIBS = -lpthread -lrt -lelf -lm
-ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 ALL_LDFLAGS = $(LDFLAGS)
 
 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
-	CFLAGS := $(CFLAGS) -fstack-protector-all
+	CFLAGS += -fstack-protector-all
 endif
 
 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y)
-	CFLAGS := $(CFLAGS) -Wstack-protector
+	CFLAGS += -Wstack-protector
 endif
 
 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y)
-	CFLAGS := $(CFLAGS) -Wvolatile-register-var
+	CFLAGS += -Wvolatile-register-var
 endif
 
 ifndef PERF_DEBUG
 	ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y)
-		CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2
+		CFLAGS += -D_FORTIFY_SOURCE=2
 	endif
 endif
 
-BASIC_CFLAGS = \
+CFLAGS += \
 	-Iutil/include \
 	-Iarch/$(ARCH)/include \
 	$(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
@@ -106,7 +113,6 @@ ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
 	BIONIC := 1
 	EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
 	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
-	BASIC_CFLAGS += -I.
 endif
 
 ifdef NO_LIBELF
@@ -114,9 +120,9 @@ ifdef NO_LIBELF
 	NO_DEMANGLE := 1
 	NO_LIBUNWIND := 1
 else
-FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+FLAGS_LIBELF=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
 ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
-	FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
+	FLAGS_GLIBC=$(CFLAGS) $(ALL_LDFLAGS)
 	ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
 		LIBC_SUPPORT := 1
 	endif
@@ -140,7 +146,7 @@ else
 		LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
 	endif
 
-	FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+	FLAGS_DWARF=$(CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
 	ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),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
@@ -149,10 +155,10 @@ endif # SOURCE_LIBELF
 endif # NO_LIBELF
 
 ifndef NO_LIBELF
-BASIC_CFLAGS += -DLIBELF_SUPPORT
-FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+CFLAGS += -DLIBELF_SUPPORT
+FLAGS_LIBELF=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
 ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
-	BASIC_CFLAGS += -DLIBELF_MMAP
+	CFLAGS += -DLIBELF_MMAP
 endif
 
 # include ARCH specific config
@@ -163,7 +169,7 @@ ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
 	msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
 	NO_DWARF := 1
 else
-	BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
+	CFLAGS += -DDWARF_SUPPORT $(LIBDW_CFLAGS)
 	BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
 	EXTLIBS += -lelf -ldw
 endif # PERF_HAVE_DWARF_REGS
@@ -184,7 +190,7 @@ ifdef LIBUNWIND_DIR
 	LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
 endif
 
-FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
+FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
 ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
 	msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
 	NO_LIBUNWIND := 1
@@ -192,19 +198,19 @@ endif # Libunwind support
 endif # NO_LIBUNWIND
 
 ifndef NO_LIBUNWIND
-	BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
+	CFLAGS += -DLIBUNWIND_SUPPORT
 	EXTLIBS += $(LIBUNWIND_LIBS)
-	BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
+	CFLAGS += $(LIBUNWIND_CFLAGS)
 	BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
 endif # NO_LIBUNWIND
 
 ifndef NO_LIBAUDIT
-	FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit
+	FLAGS_LIBAUDIT = $(CFLAGS) $(ALL_LDFLAGS) -laudit
 	ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
 		msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
 		NO_LIBAUDIT := 1
 	else
-		BASIC_CFLAGS += -DLIBAUDIT_SUPPORT
+		CFLAGS += -DLIBAUDIT_SUPPORT
 		EXTLIBS += -laudit
 	endif
 endif
@@ -214,29 +220,29 @@ ifdef NO_NEWT
 endif
 
 ifndef NO_SLANG
-	FLAGS_SLANG=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
+	FLAGS_SLANG=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
 	ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y)
 		msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
 		NO_SLANG := 1
 	else
 		# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
-		BASIC_CFLAGS += -I/usr/include/slang
-		BASIC_CFLAGS += -DSLANG_SUPPORT
+		CFLAGS += -I/usr/include/slang
+		CFLAGS += -DSLANG_SUPPORT
 		EXTLIBS += -lslang
 	endif
 endif
 
 ifndef NO_GTK2
-	FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
+	FLAGS_GTK2=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
 	ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
 		msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
 		NO_GTK2 := 1
 	else
 		ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
-			BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
+			CFLAGS += -DHAVE_GTK_INFO_BAR
 		endif
-		BASIC_CFLAGS += -DGTK2_SUPPORT
-		BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
+		CFLAGS += -DGTK2_SUPPORT
+		CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
 		EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
 	endif
 endif
@@ -245,7 +251,7 @@ grep-libs  = $(filter -l%,$(1))
 strip-libs = $(filter-out -l%,$(1))
 
 ifdef NO_LIBPERL
-	BASIC_CFLAGS += -DNO_LIBPERL
+	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))
@@ -254,7 +260,7 @@ else
 	FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
 
 	ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y)
-		BASIC_CFLAGS += -DNO_LIBPERL
+		CFLAGS += -DNO_LIBPERL
 		NO_LIBPERL := 1
 	else
 		ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
@@ -264,7 +270,7 @@ endif
 
 disable-python = $(eval $(disable-python_code))
 define disable-python_code
-  BASIC_CFLAGS += -DNO_LIBPYTHON
+  CFLAGS += -DNO_LIBPYTHON
   $(if $(1),$(warning No $(1) was found))
   $(warning Python support will not be built)
   NO_LIBPYTHON := 1
@@ -326,13 +332,13 @@ else
 endif
 
 ifdef NO_DEMANGLE
-	BASIC_CFLAGS += -DNO_DEMANGLE
+	CFLAGS += -DNO_DEMANGLE
 else
 	ifdef HAVE_CPLUS_DEMANGLE
 		EXTLIBS += -liberty
-		BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
+		CFLAGS += -DHAVE_CPLUS_DEMANGLE
 	else
-		FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
+		FLAGS_BFD=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
 		has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
 		ifeq ($(has_bfd),y)
 			EXTLIBS += -lbfd
@@ -347,14 +353,14 @@ else
 				ifeq ($(has_bfd_iberty_z),y)
 					EXTLIBS += -lbfd -liberty -lz
 				else
-					FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
+					FLAGS_CPLUS_DEMANGLE=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
 					has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
 					ifeq ($(has_cplus_demangle),y)
 						EXTLIBS += -liberty
-						BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
+						CFLAGS += -DHAVE_CPLUS_DEMANGLE
 					else
 						msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
-						BASIC_CFLAGS += -DNO_DEMANGLE
+						CFLAGS += -DNO_DEMANGLE
 					endif
 				endif
 			endif
@@ -364,29 +370,29 @@ endif
 
 ifndef NO_STRLCPY
 	ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y)
-		BASIC_CFLAGS += -DHAVE_STRLCPY
+		CFLAGS += -DHAVE_STRLCPY
 	endif
 endif
 
 ifndef NO_ON_EXIT
 	ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y)
-		BASIC_CFLAGS += -DHAVE_ON_EXIT
+		CFLAGS += -DHAVE_ON_EXIT
 	endif
 endif
 
 ifndef NO_BACKTRACE
        ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
-		BASIC_CFLAGS += -DBACKTRACE_SUPPORT
+		CFLAGS += -DBACKTRACE_SUPPORT
        endif
 endif
 
 ifndef NO_LIBNUMA
-	FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma
+	FLAGS_LIBNUMA = $(CFLAGS) $(ALL_LDFLAGS) -lnuma
 	ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
 		msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev);
 		NO_LIBNUMA := 1
 	else
-		BASIC_CFLAGS += -DLIBNUMA_SUPPORT
+		CFLAGS += -DLIBNUMA_SUPPORT
 		EXTLIBS += -lnuma
 	endif
 endif
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 6b0ed32..93c576b 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -18,7 +18,7 @@ class install_lib(_install_lib):
         self.build_dir = build_lib
 
 
-cflags = ['-fno-strict-aliasing', '-Wno-write-strings']
+cflags = ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ]
 cflags += getenv('CFLAGS', '').split()
 
 build_lib = getenv('PYTHON_EXTBUILD_LIB')
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 20/27] perf tools: Merge all *LDFLAGS* make variable into LDFLAGS
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (18 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 19/27] perf tools: Merge all *CFLAGS* make variable into CFLAGS Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 21/27] perf tools: Switch to full patch C include directories Jiri Olsa
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Merging all *LDFLAGS* make variable into LDFLAGS to eliminate
all special *LDFLAGS* variables and make the setup clear.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        |  6 ++----
 tools/perf/config/Makefile | 41 +++++++++++++++++++++++------------------
 2 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d467820..a1170a1 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -501,8 +501,6 @@ endif
 
 LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
 
-ALL_LDFLAGS += $(BASIC_LDFLAGS)
-
 export INSTALL SHELL_PATH
 
 ### Build rules
@@ -525,7 +523,7 @@ $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
 		$(CFLAGS) -c $(filter %.c,$^) -o $@
 
 $(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
-	$(QUIET_LINK)$(CC) $(CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \
+	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \
                $(BUILTIN_OBJS) $(LIBS) -o $@
 
 $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
@@ -630,7 +628,7 @@ $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Uti
 	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
 
 $(OUTPUT)perf-%: %.o $(PERFLIBS)
-	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
+	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
 
 $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
 $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index a53d2b3..c6e4902 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -71,7 +71,6 @@ CFLAGS += \
 	-std=gnu99
 
 EXTLIBS = -lpthread -lrt -lelf -lm
-ALL_LDFLAGS = $(LDFLAGS)
 
 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
 	CFLAGS += -fstack-protector-all
@@ -107,8 +106,6 @@ CFLAGS += \
 	-I../lib/ \
 	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 
-BASIC_LDFLAGS =
-
 ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
 	BIONIC := 1
 	EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
@@ -120,9 +117,9 @@ ifdef NO_LIBELF
 	NO_DEMANGLE := 1
 	NO_LIBUNWIND := 1
 else
-FLAGS_LIBELF=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
 ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
-	FLAGS_GLIBC=$(CFLAGS) $(ALL_LDFLAGS)
+	FLAGS_GLIBC=$(CFLAGS) $(LDFLAGS)
 	ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
 		LIBC_SUPPORT := 1
 	endif
@@ -146,7 +143,7 @@ else
 		LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
 	endif
 
-	FLAGS_DWARF=$(CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+	FLAGS_DWARF=$(CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(LDFLAGS) $(EXTLIBS)
 	ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),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
@@ -156,7 +153,7 @@ endif # NO_LIBELF
 
 ifndef NO_LIBELF
 CFLAGS += -DLIBELF_SUPPORT
-FLAGS_LIBELF=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
 ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
 	CFLAGS += -DLIBELF_MMAP
 endif
@@ -170,13 +167,21 @@ ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
 	NO_DWARF := 1
 else
 	CFLAGS += -DDWARF_SUPPORT $(LIBDW_CFLAGS)
-	BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
+	LDFLAGS += $(LIBDW_LDFLAGS)
 	EXTLIBS += -lelf -ldw
 endif # PERF_HAVE_DWARF_REGS
 endif # NO_DWARF
 
 endif # NO_LIBELF
 
+ifndef NO_LIBELF
+CFLAGS += -DLIBELF_SUPPORT
+FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
+ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
+	CFLAGS += -DLIBELF_MMAP
+endif # try-cc
+endif # NO_LIBELF
+
 # There's only x86 (both 32 and 64) support for CFI unwind so far
 ifneq ($(ARCH),x86)
 	NO_LIBUNWIND := 1
@@ -190,7 +195,7 @@ ifdef LIBUNWIND_DIR
 	LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
 endif
 
-FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
+FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
 ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
 	msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
 	NO_LIBUNWIND := 1
@@ -201,11 +206,11 @@ ifndef NO_LIBUNWIND
 	CFLAGS += -DLIBUNWIND_SUPPORT
 	EXTLIBS += $(LIBUNWIND_LIBS)
 	CFLAGS += $(LIBUNWIND_CFLAGS)
-	BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
+	LDFLAGS += $(LIBUNWIND_LDFLAGS)
 endif # NO_LIBUNWIND
 
 ifndef NO_LIBAUDIT
-	FLAGS_LIBAUDIT = $(CFLAGS) $(ALL_LDFLAGS) -laudit
+	FLAGS_LIBAUDIT = $(CFLAGS) $(LDFLAGS) -laudit
 	ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
 		msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
 		NO_LIBAUDIT := 1
@@ -220,7 +225,7 @@ ifdef NO_NEWT
 endif
 
 ifndef NO_SLANG
-	FLAGS_SLANG=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
+	FLAGS_SLANG=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
 	ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y)
 		msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
 		NO_SLANG := 1
@@ -233,7 +238,7 @@ ifndef NO_SLANG
 endif
 
 ifndef NO_GTK2
-	FLAGS_GTK2=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
+	FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
 	ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
 		msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
 		NO_GTK2 := 1
@@ -263,7 +268,7 @@ else
 		CFLAGS += -DNO_LIBPERL
 		NO_LIBPERL := 1
 	else
-		ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
+		LDFLAGS += $(PERL_EMBED_LDFLAGS)
 		EXTLIBS += $(PERL_EMBED_LIBADD)
 	endif
 endif
@@ -322,7 +327,7 @@ else
           $(warning $(and ,))
           $(error   $(and ,))
         else
-          ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
+          LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
           EXTLIBS += $(PYTHON_EMBED_LIBADD)
           LANG_BINDINGS += $(OUTPUT)python/perf.so
         endif
@@ -338,7 +343,7 @@ else
 		EXTLIBS += -liberty
 		CFLAGS += -DHAVE_CPLUS_DEMANGLE
 	else
-		FLAGS_BFD=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
+		FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
 		has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
 		ifeq ($(has_bfd),y)
 			EXTLIBS += -lbfd
@@ -353,7 +358,7 @@ else
 				ifeq ($(has_bfd_iberty_z),y)
 					EXTLIBS += -lbfd -liberty -lz
 				else
-					FLAGS_CPLUS_DEMANGLE=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
+					FLAGS_CPLUS_DEMANGLE=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -liberty
 					has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
 					ifeq ($(has_cplus_demangle),y)
 						EXTLIBS += -liberty
@@ -387,7 +392,7 @@ ifndef NO_BACKTRACE
 endif
 
 ifndef NO_LIBNUMA
-	FLAGS_LIBNUMA = $(CFLAGS) $(ALL_LDFLAGS) -lnuma
+	FLAGS_LIBNUMA = $(CFLAGS) $(LDFLAGS) -lnuma
 	ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
 		msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev);
 		NO_LIBNUMA := 1
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 21/27] perf tools: Switch to full patch C include directories
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (19 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 20/27] perf tools: Merge all *LDFLAGS* make variable into LDFLAGS Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 22/27] perf tools: Add NO_BIONIC variable to confiure bionic setup Jiri Olsa
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Switching to full patch C include directories, to make
the includes clear. Plus little include cleanup.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        |  4 ++--
 tools/perf/config/Makefile | 49 ++++++++++++++++++++++++++++++++++------------
 2 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index a1170a1..92dc204 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -80,8 +80,8 @@ FLEX    = flex
 BISON   = bison
 STRIP  ?= strip
 
-LK_DIR = ../lib/lk/
-TRACE_EVENT_DIR = ../lib/traceevent/
+LK_DIR          = $(srctree)/tools/lib/lk/
+TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
 
 ifeq ($(filter clean tags,$(MAKECMDGOALS)),)
 include config/Makefile
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index c6e4902..8762209 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -34,7 +34,23 @@ ifeq ($(NO_PERF_REGS),0)
         CFLAGS += -DHAVE_PERF_REGS
 endif
 
--include config/feature-tests.mak
+ifeq ($(src-perf),)
+src-perf := $(srctree)/tools/perf
+endif
+
+ifeq ($(obj-perf),)
+obj-perf := $(objtree)
+endif
+
+ifneq ($(obj-perf),)
+obj-perf := $(abspath $(obj-perf))/
+endif
+
+# include ARCH specific config
+-include $(src-perf)/arch/$(ARCH)/Makefile
+
+include $(src-perf)/config/feature-tests.mak
+include $(src-perf)/config/utilities.mak
 
 ifeq ($(call get-executable,$(FLEX)),)
 	dummy := $(error Error: $(FLEX) is missing on this system, please install it)
@@ -91,19 +107,28 @@ ifndef PERF_DEBUG
 endif
 
 CFLAGS += \
-	-Iutil/include \
-	-Iarch/$(ARCH)/include \
-	$(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
+	-I$(src-perf)/util/include \
+	-I$(src-perf)/arch/$(ARCH)/include \
 	-I$(srctree)/arch/$(ARCH)/include/uapi \
 	-I$(srctree)/arch/$(ARCH)/include \
-	$(if $(objtree),-I$(objtree)/include/generated/uapi) \
 	-I$(srctree)/include/uapi \
-	-I$(srctree)/include \
-	-I$(OUTPUT)util \
-	-Iutil \
-	-I. \
+	-I$(srctree)/include
+
+# $(obj-perf)      for generated common-cmds.h
+# $(obj-perf)/util for generated bison/flex headers
+ifneq ($(OUTPUT),)
+CFLAGS += \
+	-I$(obj-perf)/util \
+	-I$(obj-perf)
+endif
+
+CFLAGS += \
+	-I$(src-perf)/util \
+	-I$(src-perf) \
 	-I$(TRACE_EVENT_DIR) \
-	-I../lib/ \
+	-I$(srctree)/tools/lib/
+
+CFLAGS += \
 	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 
 ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
@@ -159,7 +184,7 @@ ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
 endif
 
 # include ARCH specific config
--include arch/$(ARCH)/Makefile
+-include $(src-perf)/arch/$(ARCH)/Makefile
 
 ifndef NO_DWARF
 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
@@ -329,7 +354,7 @@ else
         else
           LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
           EXTLIBS += $(PYTHON_EMBED_LIBADD)
-          LANG_BINDINGS += $(OUTPUT)python/perf.so
+          LANG_BINDINGS += $(obj-perf)python/perf.so
         endif
       endif
     endif
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 22/27] perf tools: Add NO_BIONIC variable to confiure bionic setup
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (20 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 21/27] perf tools: Switch to full patch C include directories Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 23/27] kbuild: Introduce KBUILD_AUTOCONF variable for auto.conf include Jiri Olsa
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Stephane Eranian

Adding NO_BIONIC variable to confiure bionic setup

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        | 4 ++++
 tools/perf/config/Makefile | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 92dc204..bc35337 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -51,6 +51,10 @@ include config/utilities.mak
 # 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
 
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 8762209..cc464f1 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -131,11 +131,13 @@ CFLAGS += \
 CFLAGS += \
 	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 
+ifndef NO_BIONIC
 ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
 	BIONIC := 1
 	EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
 	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
 endif
+endif # NO_BIONIC
 
 ifdef NO_LIBELF
 	NO_DWARF := 1
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 23/27] kbuild: Introduce KBUILD_AUTOCONF variable for auto.conf include
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (21 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 22/27] perf tools: Add NO_BIONIC variable to confiure bionic setup Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 24/27] kbuild: Introduce KCONFIG_AUTOCONFIGDEP variable for conf tool Jiri Olsa
                   ` (4 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Michal Marek, linux-kbuild, Stephane Eranian

Introducing KBUILD_AUTOCONF variable for auto.conf include
allowing to specify custom auto.conf file.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Cc: Stephane Eranian <eranian@google.com>
---
 scripts/Makefile.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 0e801c3..a3254a1 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -31,7 +31,8 @@ subdir-asflags-y :=
 subdir-ccflags-y :=
 
 # Read auto.conf if it exists, otherwise ignore
--include include/config/auto.conf
+kbuild-autoconf := $(if $(KBUILD_AUTOCONF),$(KBUILD_AUTOCONF),include/config/auto.conf)
+-include $(kbuild-autoconf)
 
 include scripts/Kbuild.include
 
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 24/27] kbuild: Introduce KCONFIG_AUTOCONFIGDEP variable for conf tool
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (22 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 23/27] kbuild: Introduce KBUILD_AUTOCONF variable for auto.conf include Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-11 10:29   ` Michal Marek
  2013-04-01 19:18 ` [PATCH 25/27] perf tools: Kbuild builtin source related fixies Jiri Olsa
                   ` (3 subsequent siblings)
  27 siblings, 1 reply; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Michal Marek, linux-kbuild, Stephane Eranian

Introducing KCONFIG_AUTOCONFIGDEP variable for conf tool
allowing to specify custom auto.conf.cmd file.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Cc: Stephane Eranian <eranian@google.com>
---
 scripts/kconfig/confdata.c | 11 ++++++++++-
 scripts/kconfig/lkc.h      |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 13ddf11..435c361 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -75,6 +75,14 @@ const char *conf_get_autoconfig_name(void)
 	return name ? name : "include/config/auto.conf";
 }
 
+const char *conf_get_autoconfigdep_name(void)
+{
+	char *name = getenv("KCONFIG_AUTOCONFIGDEP");
+
+	return name ? name : "include/config/auto.conf.cmd";
+}
+
+
 static char *conf_expand_value(const char *in)
 {
 	struct symbol *sym;
@@ -948,7 +956,8 @@ int conf_write_autoconf(void)
 
 	sym_clear_all_valid();
 
-	file_write_dep("include/config/auto.conf.cmd");
+	name = conf_get_autoconfigdep_name();
+	file_write_dep(name);
 
 	if (conf_split_config())
 		return 1;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index f8aee5f..5e370b1 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -83,6 +83,7 @@ const char *zconf_curname(void);
 /* confdata.c */
 const char *conf_get_configname(void);
 const char *conf_get_autoconfig_name(void);
+const char *conf_get_autoconfigdep_name(void);
 char *conf_get_default_confname(void);
 void sym_set_change_count(int count);
 void sym_add_change_count(int count);
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 25/27] perf tools: Kbuild builtin source related fixies
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (23 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 24/27] kbuild: Introduce KCONFIG_AUTOCONFIGDEP variable for conf tool Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 26/27] perf tools: Kbuild " Jiri Olsa
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Michal Marek, linux-kbuild, Stephane Eranian

Adding CONFIG_BUILTIN_* defines to govern builtin commands.
This will be usefull for kbuild process switch.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/builtin-cmds.h           | 27 ++++++++++++++++++++++
 tools/perf/builtin-help.c           |  1 +
 tools/perf/perf.c                   | 45 +++++++++++++++++++++++++++++++++++--
 tools/perf/util/generate-cmdlist.sh | 10 +++++++++
 4 files changed, 81 insertions(+), 2 deletions(-)
 create mode 100644 tools/perf/builtin-cmds.h

diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
new file mode 100644
index 0000000..fec342a
--- /dev/null
+++ b/tools/perf/builtin-cmds.h
@@ -0,0 +1,27 @@
+#ifndef BUILTIN_CMDS_H
+#define BUILTIN_CMDS_H
+
+#define CONFIG_BUILTIN_REPORT 1
+#define CONFIG_BUILTIN_SCRIPT 1
+#define CONFIG_BUILTIN_BENCH 1
+#define CONFIG_BUILTIN_SCHED 1
+#define CONFIG_BUILTIN_TRACE 1
+#define CONFIG_BUILTIN_TOP 1
+#define CONFIG_BUILTIN_RECORD 1
+#define CONFIG_BUILTIN_BUILDID_LIST 1
+#define CONFIG_BUILTIN_INJECT 1
+#define CONFIG_BUILTIN_LOCK 1
+#define CONFIG_BUILTIN_KVM 1
+#define CONFIG_BUILTIN_BUILDID_CACHE 1
+#define CONFIG_BUILTIN_EVLIST 1
+#define CONFIG_BUILTIN_KMEM 1
+#define CONFIG_BUILTIN_STAT 1
+#define CONFIG_BUILTIN_DIFF 1
+#define CONFIG_BUILTIN_ANNOTATE 1
+#define CONFIG_BUILTIN_TIMECHART 1
+#define CONFIG_BUILTIN_LIST 1
+#define CONFIG_BUILTIN_HELP 1
+#define CONFIG_BUILTIN_PROBE 1
+#define CONFIG_BUILTIN_MEM 1
+
+#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 178b88a..b6c78a6 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -7,6 +7,7 @@
 #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/perf.c b/tools/perf/perf.c
index 85e1aed..ccc6c52 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -7,6 +7,7 @@
  * perf top, perf record, perf report, etc.) are started.
  */
 #include "builtin.h"
+#include "builtin-cmds.h"
 
 #include "util/exec_cmd.h"
 #include "util/cache.h"
@@ -33,34 +34,74 @@ struct cmd_struct {
 };
 
 static struct cmd_struct commands[] = {
+#ifdef CONFIG_BUILTIN_BUILDID_CACHE
 	{ "buildid-cache", cmd_buildid_cache, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_BUILDID_LIST
 	{ "buildid-list", cmd_buildid_list, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_DIFF
 	{ "diff",	cmd_diff,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_EVLIST
 	{ "evlist",	cmd_evlist,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_HELP
 	{ "help",	cmd_help,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_LIST
 	{ "list",	cmd_list,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_RECORD
 	{ "record",	cmd_record,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_REPORT
 	{ "report",	cmd_report,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_BENCH
 	{ "bench",	cmd_bench,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_STAT
 	{ "stat",	cmd_stat,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_TIMECHART
 	{ "timechart",	cmd_timechart,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_TOP
 	{ "top",	cmd_top,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_ANNOTATE
 	{ "annotate",	cmd_annotate,	0 },
+#endif
 	{ "version",	cmd_version,	0 },
+#ifdef CONFIG_BUILTIN_SCRIPT
 	{ "script",	cmd_script,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_SCHED
 	{ "sched",	cmd_sched,	0 },
-#ifdef LIBELF_SUPPORT
+#endif
+#if defined LIBELF_SUPPORT && defined CONFIG_BUILTIN_PROBE
 	{ "probe",	cmd_probe,	0 },
 #endif
+#ifdef CONFIG_BUILTIN_KMEM
 	{ "kmem",	cmd_kmem,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_LOCK
 	{ "lock",	cmd_lock,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_KVM
 	{ "kvm",	cmd_kvm,	0 },
+#endif
 	{ "test",	cmd_test,	0 },
-#ifdef LIBAUDIT_SUPPORT
+#if defined LIBAUDIT_SUPPORT && defined CONFIG_BUILTIN_TRACE
 	{ "trace",	cmd_trace,	0 },
 #endif
+#ifdef CONFIG_BUILTIN_INJECT
 	{ "inject",	cmd_inject,	0 },
+#endif
+#ifdef CONFIG_BUILTIN_MEM
 	{ "mem",	cmd_mem,	0 },
+#endif
 };
 
 struct pager_config {
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 3ac3803..ef9a4f6 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -1,5 +1,11 @@
 #!/bin/sh
 
+function cfg()
+{
+     cfg=`echo $1 | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'`
+     echo "$cfg"
+}
+
 echo "/* Automatically generated by $0 */
 struct cmdname_help
 {
@@ -13,6 +19,7 @@ sed -n -e 's/^perf-\([^ 	]*\)[ 	].* common.*/\1/p' command-list.txt |
 sort |
 while read cmd
 do
+     echo "#ifdef CONFIG_BUILTIN_$(cfg $cmd)"
      sed -n '
      /^NAME/,/perf-'"$cmd"'/H
      ${
@@ -20,6 +27,7 @@ do
             s/.*perf-'"$cmd"' - \(.*\)/  {"'"$cmd"'", "\1"},/
 	    p
      }' "Documentation/perf-$cmd.txt"
+     echo "#endif"
 done
 
 echo "#ifdef LIBELF_SUPPORT"
@@ -27,6 +35,7 @@ sed -n -e 's/^perf-\([^ 	]*\)[ 	].* full.*/\1/p' command-list.txt |
 sort |
 while read cmd
 do
+     echo "#ifdef CONFIG_BUILTIN_$(cfg $cmd)"
      sed -n '
      /^NAME/,/perf-'"$cmd"'/H
      ${
@@ -34,6 +43,7 @@ do
             s/.*perf-'"$cmd"' - \(.*\)/  {"'"$cmd"'", "\1"},/
 	    p
      }' "Documentation/perf-$cmd.txt"
+     echo "#endif"
 done
 echo "#endif /* LIBELF_SUPPORT */"
 echo "};"
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 26/27] perf tools: Kbuild source related fixies
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (24 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 25/27] perf tools: Kbuild builtin source related fixies Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 19:18 ` [PATCH 27/27] perf tools: Add kbuild support into Makefile.kbuild Jiri Olsa
  2013-04-01 20:45 ` [RFC 00/27] perf tools: Build changes and kbuild support David Ahern
  27 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Michal Marek, linux-kbuild, Stephane Eranian

Fixing several sources config dependencies to allow
separate config builds.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/builtin-lock.c        |  2 ++
 tools/perf/builtin-report.c      |  9 ++++++++-
 tools/perf/builtin-sched.c       |  2 ++
 tools/perf/perf.c                |  6 ++++++
 tools/perf/perf.h                |  2 ++
 tools/perf/ui/browsers/scripts.c |  4 ++++
 tools/perf/ui/setup.c            | 10 +++++++++-
 7 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 4258300..bb1f729 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -972,9 +972,11 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)
 				usage_with_options(report_usage, report_options);
 		}
 		__cmd_report();
+#ifdef CONFIG_BULTIN_SCRIPT
 	} else if (!strcmp(argv[0], "script")) {
 		/* Aliased to 'perf script' */
 		return cmd_script(argc, argv, prefix);
+#endif
 	} else if (!strcmp(argv[0], "info")) {
 		if (argc) {
 			argc = parse_options(argc, argv,
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index bd0ca81..87690f5 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -573,6 +573,7 @@ static int __cmd_report(struct perf_report *rep)
 
 	if (use_browser > 0) {
 		if (use_browser == 1) {
+#ifdef CONFIG_TUI
 			ret = perf_evlist__tui_browse_hists(session->evlist,
 							help,
 							NULL,
@@ -583,10 +584,16 @@ static int __cmd_report(struct perf_report *rep)
 			 */
 			if (ret != K_SWITCH_INPUT_DATA)
 				ret = 0;
-
+#else
+				ret = -1;
+#endif
 		} else if (use_browser == 2) {
+#ifdef CONFIG_GUI
 			perf_evlist__gtk_browse_hists(session->evlist, help,
 						      NULL);
+#else
+			ret = -1;
+#endif
 		}
 	} else
 		perf_evlist__tty_browse_hists(session->evlist, rep, help);
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 2da2a6c..4c4046a 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1747,11 +1747,13 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
 	if (!argc)
 		usage_with_options(sched_usage, sched_options);
 
+#ifdef CONFIG_BULTIN_SCRIPT
 	/*
 	 * Aliased to 'perf script' for now:
 	 */
 	if (!strcmp(argv[0], "script"))
 		return cmd_script(argc, argv, prefix);
+#endif
 
 	symbol__init();
 	if (!strncmp(argv[0], "rec", 3)) {
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index ccc6c52..f277b98 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -92,7 +92,9 @@ static struct cmd_struct commands[] = {
 #ifdef CONFIG_BUILTIN_KVM
 	{ "kvm",	cmd_kvm,	0 },
 #endif
+#ifdef CONFIG_BUILTIN_TEST
 	{ "test",	cmd_test,	0 },
+#endif
 #if defined LIBAUDIT_SUPPORT && defined CONFIG_BUILTIN_TRACE
 	{ "trace",	cmd_trace,	0 },
 #endif
@@ -535,13 +537,17 @@ int main(int argc, const char **argv)
 	} else {
 		/* The user didn't specify a command; give them help */
 		printf("\n usage: %s\n\n", perf_usage_string);
+#ifdef CONFIG_BUILTIN_HELP
 		list_common_cmds_help();
 		printf("\n %s\n\n", perf_more_info_string);
+#endif
 		goto out;
 	}
 	cmd = argv[0];
 
+#ifdef CONFIG_BUILTIN_TEST
 	test_attr__init();
+#endif
 
 	/*
 	 * We use PATH to find perf commands, but we prepend some higher
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 32bd102..978659e 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -162,8 +162,10 @@ sys_perf_event_open(struct perf_event_attr *attr,
 	fd = syscall(__NR_perf_event_open, attr, pid, cpu,
 		     group_fd, flags);
 
+#ifdef CONFIG_BUILTIN_TEST
 	if (unlikely(test_attr__enabled))
 		test_attr__open(attr, pid, cpu, fd, group_fd, flags);
+#endif
 
 	return fd;
 }
diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c
index 12f009e..effdf38 100644
--- a/tools/perf/ui/browsers/scripts.c
+++ b/tools/perf/ui/browsers/scripts.c
@@ -59,7 +59,11 @@ static int list_scripts(char *script_name)
 		paths[i] = names[i] + SCRIPT_NAMELEN;
 	}
 
+#ifdef CONFIG_BUILTIN_SCRIPT
 	num = find_scripts(names, paths);
+#else
+	num = 0;
+#endif
 	if (num > 0) {
 		choice = ui__popup_menu(num, names);
 		if (choice < num && choice >= 0) {
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index ae6a789..6775665 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -17,13 +17,17 @@ void setup_browser(bool fallback_to_pager)
 
 	switch (use_browser) {
 	case 2:
+#ifdef CONFIG_GUI
 		if (perf_gtk__init() == 0)
 			break;
+#endif
 		/* fall through */
+#ifdef CONFIG_TUI
 	case 1:
 		use_browser = 1;
 		if (ui__init() == 0)
 			break;
+#endif
 		/* fall through */
 	default:
 		use_browser = 0;
@@ -36,16 +40,20 @@ void setup_browser(bool fallback_to_pager)
 	}
 }
 
-void exit_browser(bool wait_for_ok)
+void exit_browser(bool wait_for_ok __maybe_unused)
 {
 	switch (use_browser) {
 	case 2:
+#ifdef CONFIG_GUI
 		perf_gtk__exit(wait_for_ok);
 		break;
+#endif
 
+#ifdef CONFIG_TUI
 	case 1:
 		ui__exit(wait_for_ok);
 		break;
+#endif
 
 	default:
 		break;
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [PATCH 27/27] perf tools: Add kbuild support into Makefile.kbuild
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (25 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 26/27] perf tools: Kbuild " Jiri Olsa
@ 2013-04-01 19:18 ` Jiri Olsa
  2013-04-01 20:03   ` Sam Ravnborg
  2013-04-01 20:45 ` [RFC 00/27] perf tools: Build changes and kbuild support David Ahern
  27 siblings, 1 reply; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 19:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Borislav Petkov, Michal Marek, linux-kbuild, Stephane Eranian

Adding kbuild support into Makefile.kbuild. The 'legacy'
Makefile still stays untouched as it was.

It's possible to use kbuild by running 'make -f Makefile.kbuild'
with any option supported by 'legacy' Makefile.

We now have 2 config files:
  '.config' - user configured setup
  '.config-detected' - system detected setup

The '.config-detected' affects '.config' and if there's
configured feature in '.config' which was not detected
it is automatically disabled.

The '.config-detected' is re/created if:
  - there's no '.config-detected'
  - '.config' was changed

In a cleaned tree the perf is built with 'allyesconfig'
having disabled all non-detected features, just as it is
done now.

You can change '.config' via:
  make -f Makefile.kbuild menuconfig

There's difference for O=DIR build. The DIR is populated
based on kernel source tree, so the final binary is created
under DIR/tools/perf.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Kbuild                                |  47 +++
 tools/perf/Kconfig                               | 256 ++++++++++++++
 tools/perf/Makefile                              |   2 +-
 tools/perf/Makefile.kbuild                       | 411 +++++++++++++++++++++++
 tools/perf/arch/Kbuild                           |   3 +
 tools/perf/arch/x86/Kbuild                       |   1 +
 tools/perf/arch/x86/util/Kbuild                  |   3 +
 tools/perf/bench/Kbuild                          |   9 +
 tools/perf/builtin-cmds.h                        |   4 +
 tools/perf/config/Makefile                       |  46 +++
 tools/perf/config/Makefile.fix-config            | 104 ++++++
 tools/perf/config/Makefile.fix-legacy            |  46 +++
 tools/perf/config/defconfig                      |  54 +++
 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild   |   3 +
 tools/perf/scripts/python/Perf-Trace-Util/Kbuild |   4 +
 tools/perf/tests/Kbuild                          |  23 ++
 tools/perf/ui/Kbuild                             |  14 +
 tools/perf/ui/browsers/Kbuild                    |   6 +
 tools/perf/ui/gtk/Kbuild                         |   7 +
 tools/perf/ui/stdio/Kbuild                       |   1 +
 tools/perf/ui/tui/Kbuild                         |   4 +
 tools/perf/util/Kbuild                           | 113 +++++++
 tools/perf/util/PERF-VERSION-GEN                 |   6 +-
 tools/perf/util/generate-cmdlist.sh              |   8 +-
 tools/perf/util/scripting-engines/Kbuild         |   7 +
 tools/perf/util/setup.py                         |  10 +-
 26 files changed, 1183 insertions(+), 9 deletions(-)
 create mode 100644 tools/perf/Kbuild
 create mode 100644 tools/perf/Kconfig
 create mode 100644 tools/perf/Makefile.kbuild
 create mode 100644 tools/perf/arch/Kbuild
 create mode 100644 tools/perf/arch/x86/Kbuild
 create mode 100644 tools/perf/arch/x86/util/Kbuild
 create mode 100644 tools/perf/bench/Kbuild
 create mode 100644 tools/perf/config/Makefile.fix-config
 create mode 100644 tools/perf/config/Makefile.fix-legacy
 create mode 100644 tools/perf/config/defconfig
 create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
 create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild
 create mode 100644 tools/perf/tests/Kbuild
 create mode 100644 tools/perf/ui/Kbuild
 create mode 100644 tools/perf/ui/browsers/Kbuild
 create mode 100644 tools/perf/ui/gtk/Kbuild
 create mode 100644 tools/perf/ui/stdio/Kbuild
 create mode 100644 tools/perf/ui/tui/Kbuild
 create mode 100644 tools/perf/util/Kbuild
 create mode 100644 tools/perf/util/scripting-engines/Kbuild

diff --git a/tools/perf/Kbuild b/tools/perf/Kbuild
new file mode 100644
index 0000000..80b9184
--- /dev/null
+++ b/tools/perf/Kbuild
@@ -0,0 +1,47 @@
+obj-y += perf.o
+
+obj-$(CONFIG_BUILTIN_ANNOTATE)      += builtin-annotate.o
+obj-$(CONFIG_BUILTIN_BENCH)         += builtin-bench.o
+obj-$(CONFIG_BUILTIN_BENCH)         += bench/
+obj-$(CONFIG_BUILTIN_BUILDID_CACHE) += builtin-buildid-cache.o
+obj-$(CONFIG_BUILTIN_BUILDID_LIST)  += builtin-buildid-list.o
+obj-$(CONFIG_BUILTIN_DIFF)          += builtin-diff.o
+obj-$(CONFIG_BUILTIN_EVLIST)        += builtin-evlist.o
+obj-$(CONFIG_BUILTIN_HELP)          += builtin-help.o
+obj-$(CONFIG_BUILTIN_INJECT)        += builtin-inject.o
+obj-$(CONFIG_BUILTIN_KMEM)          += builtin-kmem.o
+obj-$(CONFIG_BUILTIN_KVM)           += builtin-kvm.o
+obj-$(CONFIG_BUILTIN_LIST)          += builtin-list.o
+obj-$(CONFIG_BUILTIN_LOCK)          += builtin-lock.o
+obj-$(CONFIG_BUILTIN_PROBE)         += builtin-probe.o
+obj-$(CONFIG_BUILTIN_RECORD)        += builtin-record.o
+obj-$(CONFIG_BUILTIN_REPORT)        += builtin-report.o
+obj-$(CONFIG_BUILTIN_SCHED)         += builtin-sched.o
+obj-$(CONFIG_BUILTIN_SCRIPT)        += builtin-script.o
+obj-$(CONFIG_BUILTIN_STAT)          += builtin-stat.o
+obj-$(CONFIG_BUILTIN_TIMECHART)     += builtin-timechart.o
+obj-$(CONFIG_BUILTIN_TOP)           += builtin-top.o
+obj-$(CONFIG_BUILTIN_TRACE)         += builtin-trace.o
+obj-$(CONFIG_BUILTIN_MEM)           += builtin-mem.o
+obj-$(CONFIG_BUILTIN_TEST)          += tests/
+
+obj-y += ../../lib/rbtree.o
+
+obj-y += util/
+obj-y += ui/
+obj-y += arch/
+
+obj-$(CONFIG_LIBPERL)   += scripts/perl/Perf-Trace-Util/
+obj-$(CONFIG_LIBPYTHON) += scripts/python/Perf-Trace-Util/
+
+
+CFLAGS_rbtree.o += -Wno-unused-parameter
+
+CFLAGS_perf.o += -D"PERF_HTML_PATH=KBUILD_STR($(htmldir_SQ))"
+CFLAGS_perf.o += -include PERF-VERSION-FILE
+
+$(obj)/perf.o: $(obj)/PERF-VERSION-FILE
+
+CFLAGS_builtin-help.o += -D"PERF_HTML_PATH=KBUILD_STR($(htmldir_SQ))"
+CFLAGS_builtin-help.o += -D"PERF_INFO_PATH=KBUILD_STR($(infodir_SQ))"
+CFLAGS_builtin-help.o += -D"PERF_MAN_PATH=KBUILD_STR($(mandir_SQ))"
diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
new file mode 100644
index 0000000..5f3a6b7
--- /dev/null
+++ b/tools/perf/Kconfig
@@ -0,0 +1,256 @@
+
+mainmenu "The perf configuration"
+
+menu "Built-in commands"
+
+config BUILTIN_RECORD
+	bool "record"
+	default y
+        ---help---
+	  record
+
+config BUILTIN_REPORT
+	bool "report"
+	default y
+        ---help---
+	  report
+
+config BUILTIN_STAT
+	bool "stat"
+	default y
+        ---help---
+	  stat
+
+config BUILTIN_TOP
+	bool "top"
+	default n
+        ---help---
+	  top
+
+config BUILTIN_TRACE
+	bool "trace"
+	default n
+	depends on CONFIG_LIBAUDIT
+        ---help---
+	  trace
+
+config BUILTIN_ANNOTATE
+	bool "annotate"
+	default n
+        ---help---
+	  annotate
+
+config BUILTIN_BENCH
+	bool "bench"
+	default n
+        ---help---
+	  bench
+
+config BUILTIN_BUILDID_CACHE
+	bool "buildid-cache"
+	default n
+        ---help---
+	  buildid-cache
+
+config BUILTIN_BUILDID_LIST
+	bool "buildid-list"
+	default n
+        ---help---
+	  buildid-list
+
+config BUILTIN_DIFF
+	bool "diff"
+	default y
+        ---help---
+	  diff
+
+config BUILTIN_EVLIST
+	bool "evlist"
+	default n
+        ---help---
+	  evlist
+
+config BUILTIN_HELP
+	bool "help"
+	default y
+        ---help---
+	  help
+
+config BUILTIN_INJECT
+	bool "inject"
+	default n
+        ---help---
+	  inject
+
+config BUILTIN_KMEM
+	bool "kmem"
+	default n
+        ---help---
+	  kmem
+
+config BUILTIN_KVM
+	bool "kvm"
+	default n
+        ---help---
+	  kvm
+
+config BUILTIN_LIST
+	bool "list"
+	default n
+        ---help---
+	  list
+
+config BUILTIN_LOCK
+	bool "lock"
+	default n
+        ---help---
+	  lock
+
+config BUILTIN_PROBE
+	bool "probe"
+	default n
+	depends on LIBELF
+        ---help---
+	  probe
+
+config BUILTIN_SCHED
+	bool "sched"
+	default n
+        ---help---
+	  sched
+
+config BUILTIN_SCRIPT
+	bool "script"
+	default y
+        ---help---
+	  script
+
+config BUILTIN_TIMECHART
+	bool "timechart"
+	default n
+        ---help---
+	  timechart
+
+config BUILTIN_MEM
+	bool "mem"
+	default y
+        ---help---
+	  mem
+
+config BUILTIN_TEST
+	bool "test"
+	default y
+        ---help---
+	  test
+
+endmenu
+
+menu "Libraries"
+
+config LIBAUDIT
+	bool "Audit (libaudit)"
+	default n
+        ---help---
+	  libaudit
+
+config LIBPERL
+	bool "Perl"
+	default n
+        ---help---
+	  Perl
+
+config LIBPYTHON
+	bool "Python"
+	default n
+        ---help---
+	  Python
+
+choice
+	prompt "Elf library"
+	default LIBELF
+
+	config LIBELF
+	bool "elf"
+	---help---
+	  libelf
+
+	config LIBELF_MINIMAL
+	bool "builtin support"
+	---help---
+	  builtin elf support
+endchoice
+
+config LIBUNWIND
+	bool "User space libunwind callchains"
+        ---help---
+	  libunwind
+
+config LIBUNWIND_DIR
+	string "libunwind directory"
+	depends on LIBUNWIND
+        ---help---
+	  libunwind directory
+
+
+config NUMA
+	bool "Numa support (bench)"
+	default n
+        ---help---
+	  numa
+
+config DEMANGLE
+	bool "Demangle symbols"
+	default n
+        ---help---
+	  demangle
+
+config BIONIC
+	bool "Bionic support"
+	default n
+        ---help---
+	  bionic
+
+endmenu
+
+menu "GUI"
+
+config STDIO
+	bool "Terminal"
+	default y
+        ---help---
+	  stdio
+
+config TUI
+	bool "Tui (newt based)"
+	default n
+        ---help---
+	  stdio
+
+config GTK2
+	bool "Gtk2"
+	default n
+        ---help---
+	  stdio
+
+endmenu
+
+menu "Build"
+config DEBUG
+	bool "Compile with debug info"
+	default n
+        ---help---
+	  debug info
+
+config DEBUG_PARSER
+	bool "Compile with parsers debug info"
+	default n
+        ---help---
+	  debug info
+
+config BACKTRACE
+	bool "Compile with dump_stack support"
+	default n
+        ---help---
+	  dump_stack support
+
+endmenu
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index bc35337..e13c07e 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -545,7 +545,7 @@ $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPU
 $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
 
 $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
-	$(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
+	$(QUIET_GEN). util/generate-cmdlist.sh ./ > $@+ && mv $@+ $@
 
 $(SCRIPTS) : % : %.sh
 	$(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
new file mode 100644
index 0000000..41beb83
--- /dev/null
+++ b/tools/perf/Makefile.kbuild
@@ -0,0 +1,411 @@
+srctree := $(abspath $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)/../../))
+objtree := $(abspath $(if $(KBUILD_SRC),$(CURDIR),$(CURDIR)/../..))
+
+VPATH   := $(srctree)
+
+export srctree VPATH
+
+MAKEFLAGS += --include-dir=$(srctree)
+MAKEFLAGS += --no-builtin-rules
+MAKEFLAGS += --no-print-directory
+
+ifeq ("$(origin V)", "command line")
+KBUILD_VERBOSE = $(V)
+endif
+
+ifndef KBUILD_VERBOSE
+KBUILD_VERBOSE = 0
+endif
+
+ifeq ($(KBUILD_VERBOSE),1)
+quiet =
+Q =
+else
+quiet=quiet_
+Q = @
+endif
+
+# If the user is running make -s (silent mode), suppress echoing of
+# commands
+ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
+quiet=silent_
+endif
+
+export quiet Q KBUILD_VERBOSE
+
+ifndef V
+QUIET_LINK  = @echo '  LD      $@';
+QUIET_GEN   = @echo '  GEN     $@';
+QUIET_CLEAN = @echo '  CLEAN   tools/perf';
+endif
+
+export QUIET_BISON QUIET_FLEX
+
+ifeq ($(KBUILD_SRC),)
+
+ifeq ("$(origin O)", "command line")
+KBUILD_OUTPUT := $(O)
+else
+KBUILD_OUTPUT := $(objtree)
+endif
+
+# Invoke a second make in the output directory, passing relevant variables
+# check that the output directory actually exists
+saved-output := $(KBUILD_OUTPUT)
+KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
+$(if $(KBUILD_OUTPUT),, \
+     $(error output directory "$(saved-output)" does not exist))
+
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/lib)
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/include/config)
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/tools/perf)
+
+PHONY += $(MAKECMDGOALS) sub-make
+
+$(filter-out sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) all: sub-make
+        @:
+
+sub-make: FORCE
+	$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
+	KBUILD_SRC=$(srctree) \
+	-f $(CURDIR)/Makefile.kbuild \
+	$(filter-out sub-make,$(MAKECMDGOALS))
+
+# Leave processing to above invocation of make
+skip-makefile := 1
+endif # ifeq ($(KBUILD_SRC),)
+
+export KBUILD_SRC
+
+ifeq ($(skip-makefile),)
+
+build := -f $(srctree)/scripts/Makefile.build obj
+
+src-kernel := $(srctree)
+src-perf   := $(srctree)/tools/perf
+obj-kernel := $(objtree)
+obj-perf   := $(objtree)/tools/perf
+
+VPATH += $(src-perf)
+
+export src-perf obj-perf
+
+OUTPUT := $(obj-perf)
+
+export OUTPUT
+
+AS      = as
+LD      = ld
+CC      = gcc
+CPP     = $(CC) -E
+HOSTCC  = gcc
+FLEX    = flex
+BISON   = bison
+INSTALL = install
+
+export AS LD CC CPP HOSTCC FLEX BISON
+
+# kbuild related config
+CONFIG_SHELL          := /bin/sh
+
+KBUILD_KCONFIG        := $(src-perf)/Kconfig
+KBUILD_AUTOCONF       := $(obj-perf)/include/config/auto.conf
+
+KCONFIG_CONFIG        ?= $(obj-perf)/.config
+KCONFIG_TRISTATE      := $(obj-perf)/include/config/tristate.conf
+KCONFIG_AUTOHEADER    := $(obj-perf)/include/generated/autoconf.h
+KCONFIG_AUTOCONFIG    := $(KBUILD_AUTOCONF)
+KCONFIG_AUTOCONFIGDEP := $(KBUILD_AUTOCONF).cmd
+
+export CONFIG_SHELL
+export KBUILD_KCONFIG KBUILD_AUTOCONF
+export KCONFIG_CONFIG KCONFIG_TRISTATE KCONFIG_AUTOHEADER
+export KCONFIG_AUTOCONFIG KCONFIG_AUTOCONFIGDEP
+
+# perf detected config
+CONFIG_DETECTED := $(obj-perf)/.config-detected
+
+export CONFIG_DETECTED
+
+# external .a libs
+LK_DIR          := $(srctree)/tools/lib/lk/
+TRACE_EVENT_DIR := $(srctree)/tools/lib/traceevent/
+
+LIBTRACEEVENT   := $(obj-kernel)/tools/lib/traceevent/libtraceevent.a
+LIBLK           := $(obj-kernel)/tools/lib/lk/liblk.a
+LIBS_A          := $(LIBTRACEEVENT) $(LIBLK)
+
+export TRACE_EVENT_DIR LK_DIR LIBTRACEEVENT LIBLK
+
+all:
+
+scripts_basic:
+	$(Q)$(MAKE) $(build)=scripts/basic
+
+defconfig: scripts_basic
+	$(Q)cp $(src-perf)/config/defconfig $(KCONFIG_CONFIG)
+	$(Q)$(MAKE) -s $(build)=scripts/kconfig oldconfig
+
+%config: scripts_basic
+	$(Q)$(MAKE) -s $(build)=scripts/kconfig $@
+
+$(KCONFIG_CONFIG):
+	$(Q)$(MAKE) $(build)=scripts/basic
+	$(Q)$(MAKE) -s $(build)=scripts/kconfig allyesconfig
+
+$(CONFIG_DETECTED): $(KCONFIG_CONFIG)
+	$(Q)$(MAKE) -f $(src-perf)/config/Makefile
+
+# 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
+	@touch $(CONFIG_DETECTED) # final touch.. to keep the time dependency correct
+
+clean-dirs := $(addprefix _clean_, tools/perf/)
+
+$(clean-dirs):
+	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)
+
+clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBLK)-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
+	$(Q)rm -rf $(obj-perf)/include/generated $(obj-perf)/include/config
+	$(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)
+
+TAGS tags:
+	$(Q)rm -f $(src-perf)/tags
+	$(QUIET_GEN)cd $(src-perf); find . -name '*.[hcS]' -print | xargs ctags -a
+
+cscope:
+	$(Q)rm -f $(src-perf)/cscope*
+	$(QUIET_GEN)cd $(src-perf); find . -name '*.[hcS]' -print | xargs cscope -b
+
+PHONY += clean $(clean-dirs) tags TAGS cscope
+
+ifneq ($(filter %config help clean tags TAGS cscope,$(MAKECMDGOALS)),)
+dont-detect := 1
+endif
+
+ifndef dont-detect
+# detected config variables
+include $(CONFIG_DETECTED)
+
+# Following variables are needed within Kbuild files, we need
+# to export them as they are not part of the .config set.
+export CONFIG_ARCH := $(ARCH)
+export CONFIG_X86_64
+export htmldir_SQ
+export infodir_SQ
+export mandir_SQ
+export perfexecdir_SQ
+export prefix_SQ
+export PARSER_DEBUG_BISON
+export PARSER_DEBUG_FLEX
+export ETC_PERFCONFIG_SQ
+export PYTHON_EMBED_CCOPTS
+export PERL_EMBED_CCOPTS
+endif
+
+# let sources know it's kbuild
+CFLAGS += -DCONFIG_KBUILD
+
+# kbuild related config
+LINUXINCLUDE    := $(CFLAGS)
+KBUILD_BUILTIN  := 1
+KBUILD_CHECKSRC := 0
+
+export LINUXINCLUDE
+export KBUILD_BUILTIN KBUILD_CHECKSRC
+
+# pyuthon language binding
+PYTHON_EXTBUILD     := $(src-perf)/python_ext_build/
+PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
+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_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
+PYTHON_EXT_CFLAGS := $(CFLAGS) -w
+
+export PYTHON_EXT_SRCS
+
+
+$(obj-perf)/python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
+	$(QUIET_GEN)CFLAGS='$(PYTHON_EXT_CFLAGS)' $(PYTHON_WORD) $(src-perf)/util/setup.py \
+	  --quiet build_ext; \
+	mkdir -p $(obj-perf)/python && \
+	cp $(PYTHON_EXTBUILD_LIB)perf.so $(obj-perf)/python/
+
+all: tools/perf/PERF-VERSION-FILE scripts_basic $(KBUILD_AUTOCONF) tools/perf/perf $(LANG_BINDINGS)
+
+$(obj-perf)/common-cmds.h: $(src-perf)/util/generate-cmdlist.sh $(src-perf)/command-list.txt
+	$(QUIET_GEN)$(src-perf)/util/generate-cmdlist.sh $(src-perf) > $@+ && mv $@+ $@
+
+PHONY += all scripts_basic
+
+$(obj-perf)/built-in.o: $(obj-perf)/common-cmds.h FORCE
+	$(Q)$(MAKE) $(build)=tools/perf
+
+LIBS = -Wl,--whole-archive $^ -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
+
+tools/perf/perf: $(obj-perf)/built-in.o $(LIBS_A)
+	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $(LIBS)
+
+$(LIBTRACEEVENT): FORCE
+	@mkdir -p $(obj-kernel)/tools/lib/traceevent
+	$(Q)$(MAKE) -C $(src-kernel)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent
+
+$(LIBTRACEEVENT)-clean: FORCE
+	@mkdir -p $(obj-kernel)/tools/lib/traceevent
+	$(Q)$(MAKE) -sC $(srctree)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent clean
+
+PHONY += $(TRACE_EVENT_DIR) $(TRACE_EVENT_DIR)-clean
+
+$(LIBLK): FORCE
+	@mkdir -p $(obj-kernel)/tools/lib/lk
+	$(Q)$(MAKE) -C $(srctree)/tools/lib/lk O=$(obj-kernel)/tools/lib/lk
+
+$(LIBLK)-clean: FORCE
+	@mkdir -p $(obj-kernel)/tools/lib/lk
+	$(Q)$(MAKE) -sC $(srctree)/tools/lib/lk O=$(obj-kernel)/tools/lib/lk clean
+
+tools/perf/PERF-VERSION-FILE: FORCE
+	$(QUIET_GEN)$(SHELL_PATH) $(src-perf)/util/PERF-VERSION-GEN $(obj-perf)/
+
+
+# Single targets
+# ---------------------------------------------------------------------------
+# Single targets are compatible with:
+# - build with mixed source and output
+# - build with separate output dir 'make O=...'
+# - external modules
+#
+#  target-dir => where to store outputfile
+#  build-dir  => directory in kernel source tree to use
+
+build-dir  = $(patsubst $(obj-kernel)/%,%,$(abspath $(obj-perf)/$(patsubst %/,%,$(dir $@))))
+target-dir = $(patsubst $(obj-kernel)/%,%,$(abspath $(obj-perf)/$(dir $@)))
+
+%.o: %.c scripts_basic FORCE
+	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.s: %.c scripts_basic FORCE
+	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.i: %.c scripts_basic FORCE
+	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.s: %.S scripts_basic FORCE
+	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.o: %.S scripts_basic FORCE
+	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+
+SCRIPT_SH += $(src-perf)/perf-archive.sh
+SCRIPTS    = $(patsubst %.sh,%,$(SCRIPT_SH))
+
+$(SCRIPTS) : % : %.sh
+	$(QUIET_GEN)$(INSTALL) '$@.sh' '$(perf-obj)$@'
+
+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)/bash_completion '$(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'
+
+install: install-bin try-install-man
+
+DOC_TARGETS := doc man html info pdf
+
+$(DOC_TARGETS):
+	$(Q)$(MAKE) -C $(src-perf)/Documentation $(@:doc=all)
+
+INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
+INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
+
+# 'make install-doc' should call 'make -C Documentation install'
+$(INSTALL_DOC_TARGETS):
+	$(Q)$(MAKE) -C $(src-perf)/Documentation $(@:-doc=)
+
+help:
+	@echo 'Perf make targets:'
+	@echo '  doc		- make *all* documentation (see below)'
+	@echo '  man		- make manpage documentation (access with man <foo>)'
+	@echo '  html		- make html documentation'
+	@echo '  info		- make GNU info documentation (access with info <foo>)'
+	@echo '  pdf		- make pdf documentation'
+	@echo '  TAGS		- use etags to make tag information for source browsing'
+	@echo '  tags		- use ctags to make tag information for source browsing'
+	@echo '  cscope	- use cscope to make interactive browsing database'
+	@echo ''
+	@echo 'Perf install targets:'
+	@echo '  NOTE: documentation build requires asciidoc, xmlto packages to be installed'
+	@echo '  HINT: use "make prefix=<path> <install target>" to install to a particular'
+	@echo '        path like make prefix=/usr/local install install-doc'
+	@echo '  install	- install compiled binaries'
+	@echo '  install-doc	- install *all* documentation'
+	@echo '  install-man	- install manpage documentation'
+	@echo '  install-html	- install html documentation'
+	@echo '  install-info	- install GNU info documentation'
+	@echo '  install-pdf	- install pdf documentation'
+	@echo ''
+	@echo '  quick-install-doc	- alias for quick-install-man'
+	@echo '  quick-install-man	- install the documentation quickly'
+	@echo '  quick-install-html	- install the html documentation quickly'
+	@echo ''
+	@echo 'Perf maintainer targets:'
+	@echo '  clean			- clean all binary objects and build output'
+
+
+ifdef MAKE_DEBUG
+dummy := $(info DEBUG MAKEFLAGS             $(MAKEFLAGS))
+dummy := $(info DEBUG VPATH                 $(VPATH))
+dummy := $(info DEBUG srctree               $(srctree))
+dummy := $(info DEBUG objtree               $(objtree))
+dummy := $(info DEBUG src-kernel            $(src-kernel))
+dummy := $(info DEBUG src-perf              $(src-perf))
+dummy := $(info DEBUG obj-kernel            $(obj-kernel))
+dummy := $(info DEBUG obj-perf              $(obj-perf))
+dummy := $(info DEBUG KBUILD_KCONFIG        $(KBUILD_KCONFIG))
+dummy := $(info DEBUG KBUILD_AUTOCONF       $(KBUILD_AUTOCONF))
+dummy := $(info DEBUG KCONFIG_CONFIG        $(KCONFIG_CONFIG))
+dummy := $(info DEBUG KCONFIG_TRISTATE      $(KCONFIG_TRISTATE))
+dummy := $(info DEBUG KCONFIG_AUTOHEADER    $(KCONFIG_AUTOHEADER))
+dummy := $(info DEBUG KCONFIG_AUTOCONFIG    $(KCONFIG_AUTOCONFIG))
+dummy := $(info DEBUG KCONFIG_AUTOCONFIGDEP $(KCONFIG_AUTOCONFIGDEP))
+dummy := $(info DEBUG TRACE_EVENT_DIR       $(TRACE_EVENT_DIR))
+dummy := $(info DEBUG LK_DIR                $(LK_DIR))
+endif
+
+endif  # skip-makefile
+
+PHONY += FORCE
+.PHONY: $(PHONY)
diff --git a/tools/perf/arch/Kbuild b/tools/perf/arch/Kbuild
new file mode 100644
index 0000000..5cf419e
--- /dev/null
+++ b/tools/perf/arch/Kbuild
@@ -0,0 +1,3 @@
+obj-y += common.o
+
+obj-y += $(CONFIG_ARCH)/
diff --git a/tools/perf/arch/x86/Kbuild b/tools/perf/arch/x86/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/x86/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/x86/util/Kbuild b/tools/perf/arch/x86/util/Kbuild
new file mode 100644
index 0000000..0ba617a
--- /dev/null
+++ b/tools/perf/arch/x86/util/Kbuild
@@ -0,0 +1,3 @@
+obj-y += dwarf-regs.o
+obj-y += header.o
+obj-$(CONFIG_LIBUNWIND) += unwind.o
diff --git a/tools/perf/bench/Kbuild b/tools/perf/bench/Kbuild
new file mode 100644
index 0000000..8883de9
--- /dev/null
+++ b/tools/perf/bench/Kbuild
@@ -0,0 +1,9 @@
+obj-y += mem-memcpy.o
+obj-y += mem-memset.o
+obj-y += sched-messaging.o
+obj-y += sched-pipe.o
+
+obj-$(CONFIG_NUMA) += numa.o
+
+obj-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
+obj-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
index fec342a..936842d 100644
--- a/tools/perf/builtin-cmds.h
+++ b/tools/perf/builtin-cmds.h
@@ -1,6 +1,7 @@
 #ifndef BUILTIN_CMDS_H
 #define BUILTIN_CMDS_H
 
+#ifndef CONFIG_KBUILD
 #define CONFIG_BUILTIN_REPORT 1
 #define CONFIG_BUILTIN_SCRIPT 1
 #define CONFIG_BUILTIN_BENCH 1
@@ -23,5 +24,8 @@
 #define CONFIG_BUILTIN_HELP 1
 #define CONFIG_BUILTIN_PROBE 1
 #define CONFIG_BUILTIN_MEM 1
+#else
+#include <generated/autoconf.h>
+#endif /* CONFIG_KBUILD */
 
 #endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index cc464f1..7bdc0ad 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -28,6 +28,7 @@ ifeq ($(ARCH),x86_64)
 	endif
 	NO_PERF_REGS := 0
 	LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
+	CONFIG_X86_64=y
 endif
 
 ifeq ($(NO_PERF_REGS),0)
@@ -46,6 +47,10 @@ ifneq ($(obj-perf),)
 obj-perf := $(abspath $(obj-perf))/
 endif
 
+ifdef KCONFIG_CONFIG
+include $(src-perf)/config/Makefile.fix-legacy
+endif
+
 # include ARCH specific config
 -include $(src-perf)/arch/$(ARCH)/Makefile
 
@@ -108,6 +113,7 @@ endif
 
 CFLAGS += \
 	-I$(src-perf)/util/include \
+	-I$(obj-perf)/include \
 	-I$(src-perf)/arch/$(ARCH)/include \
 	-I$(srctree)/arch/$(ARCH)/include/uapi \
 	-I$(srctree)/arch/$(ARCH)/include \
@@ -480,3 +486,43 @@ else
 perfexec_instdir = $(prefix)/$(perfexecdir)
 endif
 perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
+
+
+ifdef CONFIG_DETECTED
+
+store = @echo "$(1)=$($(1))" >> $(CONFIG_DETECTED)
+
+all:
+	$(call store,ARCH)
+	$(call store,CFLAGS)
+	$(call store,LDFLAGS)
+	$(call store,EXTLIBS)
+	$(call store,htmldir_SQ)
+	$(call store,infodir_SQ)
+	$(call store,mandir_SQ)
+	$(call store,perfexecdir_SQ)
+	$(call store,prefix_SQ)
+	$(call store,PARSER_DEBUG_BISON)
+	$(call store,PARSER_DEBUG_FLEX)
+	$(call store,PYTHON_EMBED_CCOPTS)
+	$(call store,PERL_EMBED_CCOPTS)
+	$(call store,CONFIG_X86_64)
+	$(call store,NO_LIBUNWIND)
+	$(call store,NO_LIBPERL)
+	$(call store,NO_LIBPYTHON)
+	$(call store,NO_NEWT)
+	$(call store,NO_GTK2)
+	$(call store,NO_DEMANGLE)
+	$(call store,NO_LIBELF)
+	$(call store,NO_LIBUNWIND)
+	$(call store,NO_BACKTRACE)
+	$(call store,NO_LIBNUMA)
+	$(call store,NO_LIBAUDIT)
+	$(call store,NO_LIBBIONIC)
+	$(call store,ETC_PERFCONFIG_SQ)
+	$(call store,DESTDIR_SQ)
+	$(call store,bindir_SQ)
+	$(call store,perfexec_instdir_SQ)
+	$(call store,sysconfdir_SQ)
+
+endif # CONFIG_DETECTED
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
new file mode 100644
index 0000000..7f65fdb
--- /dev/null
+++ b/tools/perf/config/Makefile.fix-config
@@ -0,0 +1,104 @@
+include $(CONFIG_DETECTED)
+include $(KCONFIG_CONFIG)
+
+CONFIG := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
+
+# NO_LIBPERL
+ifdef CONFIG_LIBPERL
+ifdef NO_LIBPERL
+dummy := $(info Disabling CONFIG_LIBPERL)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBPERL)
+endif
+endif
+
+# NO_LIBPYTHON
+ifdef CONFIG_LIBPYTHON
+ifdef NO_LIBPYTHON
+dummy := $(info Disabling CONFIG_LIBPYTHON)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
+endif
+endif
+
+# NO_NEWT
+ifdef CONFIG_TUI
+ifdef NO_NEWT
+dummy := $(info Disabling CONFIG_TUI)
+dummy := $(shell $(CONFIG) -d CONFIG_TUI)
+endif
+endif
+
+# NO_NEWT
+ifdef CONFIG_TUI
+ifdef NO_SLANG
+dummy := $(info Disabling CONFIG_TUI)
+dummy := $(shell $(CONFIG) -d CONFIG_TUI)
+endif
+endif
+
+# NO_GTK2
+ifdef CONFIG_GTK2
+ifdef NO_GTK2
+dummy := $(info Disabling CONFIG_GTK2)
+dummy := $(shell $(CONFIG) -d CONFIG_GTK2)
+endif
+endif
+
+# NO_DEMANGLE
+ifdef CONFIG_DEMANGLE
+ifdef NO_DEMANGLE
+dummy := $(info Disabling CONFIG_DEMANGLE)
+dummy := $(shell $(CONFIG) -d CONFIG_DEMANGLE)
+endif
+endif
+
+# NO_LIBELF
+ifdef CONFIG_LIBELF
+ifdef NO_LIBELF
+dummy := $(info Disabling CONFIG_LIBELF)
+dummy := $(info Enabling  CONFIG_LIBELF_MINIMAL)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBELF)
+dummy := $(shell $(CONFIG) -e CONFIG_LIBELF_MINIMAL)
+endif
+endif
+
+# NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
+ifdef NO_LIBUNWIND
+dummy := $(info Disabling CONFIG_LIBUNWIND)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBUNWIND)
+endif
+endif
+
+# NO_BACKTRACE
+ifdef CONFIG_BACKTRACE
+ifdef NO_BACKTRACE
+dummy := $(info Disabling CONFIG_BACKTRACE)
+dummy := $(shell $(CONFIG) -d CONFIG_BACKTRACE)
+endif
+endif
+
+# NO_LIBNUMA
+ifdef CONFIG_NUMA
+ifdef NO_LIBNUMA
+dummy := $(info Disabling CONFIG_NUMA)
+dummy := $(shell $(CONFIG) -d CONFIG_NUMA)
+endif
+endif
+
+# NO_LIBAUDIT
+ifdef CONFIG_LIBAUDIT
+ifdef NO_LIBAUDIT
+dummy := $(info Disabling CONFIG_LIBAUDIT)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBAUDIT)
+endif
+endif
+
+# NO_LIBBIONIC
+ifdef CONFIG_BIONIC
+ifdef NO_LIBBIONIC
+dummy := $(info Disabling CONFIG_BIONIC)
+dummy := $(shell $(CONFIG) -d CONFIG_BIONIC)
+endif
+endif
+
+all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
new file mode 100644
index 0000000..2ec91f3
--- /dev/null
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -0,0 +1,46 @@
+
+include $(KCONFIG_CONFIG)
+
+ifndef CONFIG_LIBPERL
+NO_LIBPERL := 1
+endif
+
+ifndef CONFIG_LIBPYTHON
+NO_LIBPYTHON := 1
+endif
+
+ifndef CONFIG_TUI
+NO_SLANG := 1
+endif
+
+ifndef CONFIG_GTK2
+NO_GTK2 := 1
+endif
+
+ifndef CONFIG_DEMANGLE
+NO_DEMANGLE := 1
+endif
+
+ifndef CONFIG_LIBELF
+NO_LIBELF := 1
+endif
+
+ifndef CONFIG_LIBUNWIND
+NO_LIBUNWIND := 1
+endif
+
+ifndef CONFIG_BACKTRACE
+NO_BACKTRACE := 1
+endif
+
+ifndef CONFIG_NUMA
+export NO_LIBNUMA := 1
+endif
+
+ifndef CONFIG_LIBAUDIT
+NO_LIBAUDIT := 1
+endif
+
+ifdef CONFIG_BIONIC
+NO_LIBBIONIC := 1
+endif
diff --git a/tools/perf/config/defconfig b/tools/perf/config/defconfig
new file mode 100644
index 0000000..7a385f1
--- /dev/null
+++ b/tools/perf/config/defconfig
@@ -0,0 +1,54 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux Kernel Configuration
+#
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+# CONFIG_BUILTIN_TOP is not set
+# CONFIG_BUILTIN_ANNOTATE is not set
+# CONFIG_BUILTIN_BENCH is not set
+# CONFIG_BUILTIN_BUILDID_CACHE is not set
+# CONFIG_BUILTIN_BUILDID_LIST is not set
+CONFIG_BUILTIN_DIFF=y
+# CONFIG_BUILTIN_EVLIST is not set
+CONFIG_BUILTIN_HELP=y
+# CONFIG_BUILTIN_INJECT is not set
+# CONFIG_BUILTIN_KMEM is not set
+# CONFIG_BUILTIN_KVM is not set
+# CONFIG_BUILTIN_LIST is not set
+# CONFIG_BUILTIN_LOCK is not set
+# CONFIG_BUILTIN_SCHED is not set
+CONFIG_BUILTIN_SCRIPT=y
+# CONFIG_BUILTIN_TIMECHART is not set
+# CONFIG_BUILTIN_TEST is not set
+
+#
+# Libraries
+#
+# CONFIG_LIBAUDIT is not set
+# CONFIG_LIBPERL is not set
+# CONFIG_LIBPYTHON is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_BACKTRACE=y
+# CONFIG_LIBUNWIND is not set
+# CONFIG_NUMA is not set
+# CONFIG_DEMANGLE is not set
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+# CONFIG_TUI is not set
+# CONFIG_GTK2 is not set
+
+#
+# Build
+#
+CONFIG_DEBUG=y
+# CONFIG_DEBUG_PARSER is not set
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Kbuild b/tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
new file mode 100644
index 0000000..fa54dd5
--- /dev/null
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
@@ -0,0 +1,3 @@
+obj-y += Context.o
+
+CFLAGS_Context.o += $(PERL_EMBED_CCOPTS)
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Kbuild b/tools/perf/scripts/python/Perf-Trace-Util/Kbuild
new file mode 100644
index 0000000..0f32b85
--- /dev/null
+++ b/tools/perf/scripts/python/Perf-Trace-Util/Kbuild
@@ -0,0 +1,4 @@
+obj-y += Context.o
+
+CFLAGS_Context.o := $(PYTHON_EMBED_CCOPTS)
+CFLAGS_Context.o += -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs
diff --git a/tools/perf/tests/Kbuild b/tools/perf/tests/Kbuild
new file mode 100644
index 0000000..f2998a6
--- /dev/null
+++ b/tools/perf/tests/Kbuild
@@ -0,0 +1,23 @@
+obj-y += builtin-test.o
+obj-y += attr.o
+obj-y += dso-data.o
+obj-y += evsel-roundtrip-name.o
+obj-y += evsel-tp-sched.o
+obj-y += hists_link.o
+obj-y += mmap-basic.o
+obj-y += open-syscall-all-cpus.o
+obj-y += open-syscall.o
+obj-y += open-syscall-tp-fields.o
+obj-y += parse-events.o
+obj-y += perf-record.o
+obj-y += pmu.o
+obj-y += python-use.o
+obj-y += rdpmc.o
+obj-y += vmlinux-kallsyms.o
+obj-y += bp_signal.o
+obj-y += bp_signal_overflow.o
+obj-y += sw-clock.o
+obj-y += task-exit.o
+
+CFLAGS_python-use.o += -DPYTHON='"$(PYTHON_WORD)"' -DPYTHONPATH='"python"'
+CFLAGS_attr.o += -DPYTHON='"$(PYTHON_WORD)"' -DBINDIR='"$(bindir_SQ)"'
diff --git a/tools/perf/ui/Kbuild b/tools/perf/ui/Kbuild
new file mode 100644
index 0000000..f687132
--- /dev/null
+++ b/tools/perf/ui/Kbuild
@@ -0,0 +1,14 @@
+obj-$(CONFIG_TUI) += browser.o
+obj-y += helpline.o
+obj-y += hist.o
+obj-y += progress.o
+obj-y += setup.o
+obj-y += util.o
+
+obj-y += browsers/
+obj-y += stdio/
+
+obj-$(CONFIG_TUI)  += tui/
+obj-$(CONFIG_GTK2) += gtk/
+
+CFLAGS_browser.o += -DENABLE_SLFUTURE_CONST
diff --git a/tools/perf/ui/browsers/Kbuild b/tools/perf/ui/browsers/Kbuild
new file mode 100644
index 0000000..43bfcbf
--- /dev/null
+++ b/tools/perf/ui/browsers/Kbuild
@@ -0,0 +1,6 @@
+obj-$(CONFIG_TUI) += annotate.o
+obj-$(CONFIG_TUI) += hists.o
+obj-$(CONFIG_TUI) += map.o
+obj-$(CONFIG_TUI) += scripts.o
+
+CFLAGS_hists.o += -DENABLE_SLFUTURE_CONST
diff --git a/tools/perf/ui/gtk/Kbuild b/tools/perf/ui/gtk/Kbuild
new file mode 100644
index 0000000..6964926
--- /dev/null
+++ b/tools/perf/ui/gtk/Kbuild
@@ -0,0 +1,7 @@
+obj-y += browser.o
+obj-y += hists.o
+obj-y += setup.o
+obj-y += util.o
+obj-y += helpline.o
+obj-y += progress.o
+obj-y += annotate.o
diff --git a/tools/perf/ui/stdio/Kbuild b/tools/perf/ui/stdio/Kbuild
new file mode 100644
index 0000000..9de4bd9
--- /dev/null
+++ b/tools/perf/ui/stdio/Kbuild
@@ -0,0 +1 @@
+obj-y += hist.o
diff --git a/tools/perf/ui/tui/Kbuild b/tools/perf/ui/tui/Kbuild
new file mode 100644
index 0000000..e282409
--- /dev/null
+++ b/tools/perf/ui/tui/Kbuild
@@ -0,0 +1,4 @@
+obj-y += helpline.o
+obj-y += progress.o
+obj-y += setup.o
+obj-y += util.o
diff --git a/tools/perf/util/Kbuild b/tools/perf/util/Kbuild
new file mode 100644
index 0000000..10d5376
--- /dev/null
+++ b/tools/perf/util/Kbuild
@@ -0,0 +1,113 @@
+obj-y += abspath.o
+obj-y += alias.o
+obj-y += annotate.o
+obj-y += bitmap.o
+obj-y += build-id.o
+obj-y += callchain.o
+obj-y += cgroup.o
+obj-y += color.o
+obj-y += config.o
+obj-y += cpumap.o
+obj-y += ctype.o
+obj-y += debug.o
+obj-y += dso.o
+obj-y += environment.o
+obj-y += event.o
+obj-y += evlist.o
+obj-y += evsel.o
+obj-y += exec_cmd.o
+obj-y += header.o
+obj-y += help.o
+obj-y += hist.o
+obj-y += hweight.o
+obj-y += intlist.o
+obj-y += levenshtein.o
+obj-y += machine.o
+obj-y += map.o
+obj-y += pager.o
+obj-y += parse-options.o
+obj-y += path.o
+obj-y += pmu-flex.o
+obj-y += pmu-bison.o
+obj-y += pmu.o
+obj-y += pstack.o
+obj-y += quote.o
+obj-y += rblist.o
+obj-y += run-command.o
+obj-y += session.o
+obj-y += sigchain.o
+obj-y += sort.o
+obj-y += stat.o
+obj-y += strbuf.o
+obj-y += strfilter.o
+obj-y += string.o
+obj-y += strlist.o
+obj-y += svghelper.o
+obj-y += symbol.o
+
+obj-$(CONFIG_LIBUNWIND) += unwind.o
+
+obj-$(CONFIG_LIBELF) += symbol-elf.o
+obj-$(CONFIG_LIBELF) += dwarf-aux.o
+obj-$(CONFIG_LIBELF) += probe-event.o
+obj-$(CONFIG_LIBELF) += probe-finder.o
+
+obj-$(CONFIG_LIBELF_MINIMAL) += symbol-minimal.o
+
+obj-y += sysfs.o
+obj-y += target.o
+obj-y += thread.o
+obj-y += thread_map.o
+obj-y += top.o
+obj-y += usage.o
+obj-y += util.o
+obj-y += values.o
+obj-y += xyarray.o
+obj-y += vdso.o
+obj-y += wrapper.o
+obj-y += trace-event-info.o
+obj-y += trace-event-parse.o
+obj-$(CONFIG_BUILTIN_SCRIPT) += trace-event-scripting.o
+obj-y += trace-event-read.o
+
+obj-y += scripting-engines/
+
+define bison
+$(Q)echo '  BI      $@'
+$(Q)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) -o $@ -p $1
+endef
+
+define flex
+$(Q)echo '  FL      $@';
+$(Q)$(FLEX) --header-file=$(basename $@).h $(PARSER_DEBUG_FLEX) -t $< > $@
+endef
+
+obj-y += parse-events-flex.o
+obj-y += parse-events-bison.o
+obj-y += parse-events.o
+
+$(obj)/parse-events-bison.c: $(src)/parse-events.y
+	$(call bison,parse_events_)
+
+$(obj)/parse-events-flex.c: $(src)/parse-events.l $(obj)/parse-events-bison.c
+	$(call flex)
+
+$(src)/parse-events-flex.o: $(src)/parse-events-flex.c
+$(src)/parse-events-bison.o: $(src)/parse-events-bison.c
+
+$(src)/pmu-bison.c: $(src)/pmu.y
+	$(call bison,perf_pmu_)
+
+$(src)/pmu-flex.c: $(src)/pmu.l $(src)/pmu-bison.c
+	$(call flex)
+
+$(src)/pmu-flex.o: $(src)/pmu-flex.c
+$(src)/pmu-bison.o: $(src)/pmu-bison.c
+
+CFLAGS_parse-events-flex.o  += -w
+CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+CFLAGS_pmu-flex.o  += -w
+CFLAGS_pmu-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+
+CFLAGS_config.o += -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"'
+CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH='"$(perfexecdir_SQ)"' -DPREFIX='"$(prefix_SQ)"'
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index 055fef3..9f86bde 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -9,6 +9,10 @@ GVF=${OUTPUT}PERF-VERSION-FILE
 LF='
 '
 
+if [ "${srctree}x" = "x" ]; then
+srctree=../..
+fi
+
 #
 # First check if there is a .git to get the version from git describe
 # otherwise try to get the version from the kernel Makefile
@@ -19,7 +23,7 @@ then
 	VN=$(echo $VN"-g"$(git log -1 --abbrev=4 --pretty=format:"%h" HEAD))
 	VN=$(echo "$VN" | sed -e 's/-/./g');
 else
-	VN=$(MAKEFLAGS= make -sC ../.. kernelversion)
+	VN=$(MAKEFLAGS= make -sC $srctree kernelversion)
 fi
 
 VN=$(expr "$VN" : v*'\(.*\)')
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index ef9a4f6..cadaa1a 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -15,7 +15,7 @@ struct cmdname_help
 
 static struct cmdname_help common_cmds[] = {"
 
-sed -n -e 's/^perf-\([^ 	]*\)[ 	].* common.*/\1/p' command-list.txt |
+sed -n -e 's/^perf-\([^ 	]*\)[ 	].* common.*/\1/p' $1/command-list.txt |
 sort |
 while read cmd
 do
@@ -26,12 +26,12 @@ do
             x
             s/.*perf-'"$cmd"' - \(.*\)/  {"'"$cmd"'", "\1"},/
 	    p
-     }' "Documentation/perf-$cmd.txt"
+     }' "$1/Documentation/perf-$cmd.txt"
      echo "#endif"
 done
 
 echo "#ifdef LIBELF_SUPPORT"
-sed -n -e 's/^perf-\([^ 	]*\)[ 	].* full.*/\1/p' command-list.txt |
+sed -n -e 's/^perf-\([^ 	]*\)[ 	].* full.*/\1/p' $1/command-list.txt |
 sort |
 while read cmd
 do
@@ -42,7 +42,7 @@ do
             x
             s/.*perf-'"$cmd"' - \(.*\)/  {"'"$cmd"'", "\1"},/
 	    p
-     }' "Documentation/perf-$cmd.txt"
+     }' "$1/Documentation/perf-$cmd.txt"
      echo "#endif"
 done
 echo "#endif /* LIBELF_SUPPORT */"
diff --git a/tools/perf/util/scripting-engines/Kbuild b/tools/perf/util/scripting-engines/Kbuild
new file mode 100644
index 0000000..b6360ee
--- /dev/null
+++ b/tools/perf/util/scripting-engines/Kbuild
@@ -0,0 +1,7 @@
+obj-$(CONFIG_LIBPERL)   += trace-event-perl.o
+obj-$(CONFIG_LIBPYTHON) += trace-event-python.o
+
+CFLAGS_trace-event-perl.o   := $(PERL_EMBED_CCOPTS)
+
+CFLAGS_trace-event-python.o := $(PYTHON_EMBED_CCOPTS)
+CFLAGS_trace-event-python.o += -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 93c576b..2d8dcc4 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -2,6 +2,7 @@
 
 from distutils.core import setup, Extension
 from os import getenv
+from os import environ
 
 from distutils.command.build_ext   import build_ext   as _build_ext
 from distutils.command.install_lib import install_lib as _install_lib
@@ -18,16 +19,19 @@ class install_lib(_install_lib):
         self.build_dir = build_lib
 
 
+cflags = getenv('CFLAGS', '').split()
 cflags = ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ]
-cflags += getenv('CFLAGS', '').split()
 
 build_lib = getenv('PYTHON_EXTBUILD_LIB')
 build_tmp = getenv('PYTHON_EXTBUILD_TMP')
 libtraceevent = getenv('LIBTRACEEVENT')
 liblk = getenv('LIBLK')
 
-ext_sources = [f.strip() for f in file('util/python-ext-sources')
-				if len(f.strip()) > 0 and f[0] != '#']
+if environ.has_key('PYTHON_EXT_SRCS'):
+    ext_sources = getenv('PYTHON_EXT_SRCS').split()
+else:
+    ext_sources = [f.strip() for f in file('util/python-ext-sources')
+                                   if len(f.strip()) > 0 and f[0] != '#']
 
 perf = Extension('perf',
 		  sources = ext_sources,
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/27] perf tools: Fix tab vs spaces issue in Makefile ifdef/endif
  2013-04-01 19:18 ` [PATCH 02/27] perf tools: Fix tab vs spaces issue in Makefile ifdef/endif Jiri Olsa
@ 2013-04-01 19:49   ` Sam Ravnborg
  2013-04-01 21:11     ` Jiri Olsa
  0 siblings, 1 reply; 46+ messages in thread
From: Sam Ravnborg @ 2013-04-01 19:49 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Namhyung Kim, Borislav Petkov, Stephane Eranian

On Mon, Apr 01, 2013 at 09:18:25PM +0200, Jiri Olsa wrote:
> Unmatched spaces/tabs Makefile indentation could make the
> Makefile fails. While the tabed line could be considered
> sometimes as follow up for rule command, the mixed space
> tab meses up with makefile if conditions.

I have too many times been beaten that asssignments was
ignored because I used tabs to indendt the assignmnet.
So in all Makefile I edit spaces are used for indent.
Tabs are only used for commands.

	Sam

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 01/27] perf tools: Add automated make test suite
  2013-04-01 19:18 ` [PATCH 01/27] perf tools: Add automated make test suite Jiri Olsa
@ 2013-04-01 19:53   ` Sam Ravnborg
  2013-04-01 21:09     ` Jiri Olsa
  0 siblings, 1 reply; 46+ messages in thread
From: Sam Ravnborg @ 2013-04-01 19:53 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Namhyung Kim, Borislav Petkov, Stephane Eranian

On Mon, Apr 01, 2013 at 09:18:24PM +0200, Jiri Olsa wrote:
> Adding automatd test for testing the build process.
> To run it you needto be in perf directory or specify
> one with PERF variable. It's also possible to specify
> optional Makefile to test via MK variable.
> 
> Whole suite is executed twice, the second time with
> O=/tmp/xxx option added.
> 
> To run the whole suite:
>   $ make -f tests/make
>   MAKE_PURE: cd . && make -f Makefile
>   TEST: test -x ./perf
>   MAKE_DEBUG: cd . && make -f Makefile DEBUG=1
>   TEST: test -x ./perf
>   ...
> 
> You see command line for 'MAKE_PURE' test right away,
> and the output is stored into MAKE_PURE file.
> 
> To run simple test:
>   $ make -f tests/make MAKE_DEBUG
>   MAKE_DEBUG: cd . && make -f Makefile DEBUG=1
>   TEST: test -x ./perf
> 
> At this moment tests checks for succesfull build
> and for existence of several built files. Additional
> after-build checks could be added.

Some nit-picks.
I did not try to find out how this works.

> +
> +MAKE_DEBUG          := DEBUG=1
> +MAKE_NO_LIBPERL     := NO_LIBPERL=1

Why all these ugly UPPERCASE names?
In kbuild files the unwritten rule is that variables
with global scope are upper-case.
And variables with local scope are lower case.

You can find many examples where this is not followed - but this
is the general approach.

> +MAKE_MINIMAL        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1

Keeping lines less than 120 chars long is good.
Some people swer to 80 chars.

> +RUN := \
> +	MAKE_PURE \
> +	MAKE_DEBUG \
> +	MAKE_NO_LIBPERL \

RUN += MAKE_PURE
RUN += MAKE_DEBUG
RUN += MAKE_NO_LIBPERL

Is so much more readable.
As a general rule - use \
to continue lines only when you really have to.

	Sam

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 03/27] perf tools: Move arch check into config/Makefile
  2013-04-01 19:18 ` [PATCH 03/27] perf tools: Move arch check into config/Makefile Jiri Olsa
@ 2013-04-01 19:54   ` Sam Ravnborg
  2013-04-01 21:07     ` Jiri Olsa
  2013-04-01 21:54   ` Namhyung Kim
  1 sibling, 1 reply; 46+ messages in thread
From: Sam Ravnborg @ 2013-04-01 19:54 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Namhyung Kim, Borislav Petkov, Stephane Eranian

On Mon, Apr 01, 2013 at 09:18:26PM +0200, Jiri Olsa wrote:
> Moving arch check into config/Makefile.
> 
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Stephane Eranian <eranian@google.com>
> ---
>  tools/perf/Makefile        | 31 ++-----------------------------
>  tools/perf/config/Makefile | 34 ++++++++++++++++++++++++++++++++++
>  2 files changed, 36 insertions(+), 29 deletions(-)
>  create mode 100644 tools/perf/config/Makefile
> 
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index c8fb0fd..032e099 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -55,37 +55,11 @@ include config/utilities.mak
>  $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
>  	@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
>  
> -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/ -e s/aarch64.*/arm64/ )
> -NO_PERF_REGS := 1
> -
>  CC = $(CROSS_COMPILE)gcc
>  AR = $(CROSS_COMPILE)ar
>  
> -# Additional ARCH settings for x86
> -ifeq ($(ARCH),i386)
> -	override ARCH := x86
> -	NO_PERF_REGS := 0
> -	LIBUNWIND_LIBS = -lunwind -lunwind-x86
> -endif
> -ifeq ($(ARCH),x86_64)
> -	override ARCH := x86
> -	IS_X86_64 := 0
> -	ifeq (, $(findstring m32,$(EXTRA_CFLAGS)))
> -		IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | 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
> -	endif
> -	NO_PERF_REGS := 0
> -	LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
> +ifeq ($(filter clean tags,$(MAKECMDGOALS)),)
> +include config/Makefile
>  endif
>  
>  # Treat warnings as errors unless directed not to
> @@ -857,7 +831,6 @@ ifeq ($(NO_PERF_REGS),0)
>  	ifeq ($(ARCH),x86)
>  		LIB_H += arch/x86/include/perf_regs.h
>  	endif
> -	BASIC_CFLAGS += -DHAVE_PERF_REGS
>  endif
>  
>  ifndef NO_STRLCPY
> diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
> new file mode 100644
> index 0000000..fe317c2
> --- /dev/null
> +++ b/tools/perf/config/Makefile
> @@ -0,0 +1,34 @@
> +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/ -e s/aarch64.*/arm64/ )

this is shared with the top-level kernel Makefile.
Could we find a way to share this?

	Sam

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 27/27] perf tools: Add kbuild support into Makefile.kbuild
  2013-04-01 19:18 ` [PATCH 27/27] perf tools: Add kbuild support into Makefile.kbuild Jiri Olsa
@ 2013-04-01 20:03   ` Sam Ravnborg
  2013-04-01 21:05     ` Jiri Olsa
  0 siblings, 1 reply; 46+ messages in thread
From: Sam Ravnborg @ 2013-04-01 20:03 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Namhyung Kim, Borislav Petkov, Michal Marek, linux-kbuild,
	Stephane Eranian

On Mon, Apr 01, 2013 at 09:18:50PM +0200, Jiri Olsa wrote:
> Adding kbuild support into Makefile.kbuild. The 'legacy'
> Makefile still stays untouched as it was.

When readign the Kbuild file I get confused.
the obj-y syntax is used for kernel built-in stuff,
and obj-m for modules.
I had expected either a perf specific syntax or something like the
syntax used for host programs.

	Sam

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC 00/27] perf tools: Build changes and kbuild support
  2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
                   ` (26 preceding siblings ...)
  2013-04-01 19:18 ` [PATCH 27/27] perf tools: Add kbuild support into Makefile.kbuild Jiri Olsa
@ 2013-04-01 20:45 ` David Ahern
  2013-04-01 21:18   ` Jiri Olsa
  27 siblings, 1 reply; 46+ messages in thread
From: David Ahern @ 2013-04-01 20:45 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Namhyung Kim, Borislav Petkov, Michal Marek, linux-kbuild,
	Stephane Eranian

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

Hi Jiri:

On 4/1/13 1:18 PM, Jiri Olsa wrote:
> hi,
> sending RFC for build changes and kbuild support.

Have you seen this patch set:
https://lkml.org/lkml/2012/8/20/59

It hooks into the conf commands to generate a .config file. 
Coincidentally I updated and expanded the patch series this morning to 
include dependencies and such. Latest Pconfig attached to give you an 
idea. I need to collapse a few patches and send them out tonight.

David

[-- Attachment #2: Pconfig --]
[-- Type: text/plain, Size: 1223 bytes --]

config ARCH
    string
    option env="ARCH"

config X86
    def_bool y if ARCH = "x86"
    select HAVE_CFI_UNWIND_SUPPORT 

config HAVE_CFI_UNWIND_SUPPORT
    bool

config BIONIC
    bool "Enable support for Bionic (e.g., Android platform)"
    default n
    select LIBC

config NEWT
    bool "Enable newt-based TUI"

config GTK2
    bool "Enable GTK-based UI"

config LIBC
    bool "Development support for libc is available - glibc or bionic"

config LIBELF
    bool "Enable support for libelf"
    depends on !BIONIC && LIBC

config LIBUNWIND
    bool "Enable support for libunwind"
    depends on HAVE_CFI_UNWIND_SUPPORT
    depends on LIBELF

config DEMANGLE
    bool "Enable support for demangle"
    depends on LIBELF

config DWARF
    bool "Enable support for dwarf"
    depends on LIBELF

config LIBAUDIT
    bool "Enable support for libaudit"
    help
        Used for perf trace tool.

config LIBNUMA
    bool "Enable support for libnuma"
    help
        Used for 'perf bench numa mem' benchmark

config BACKTRACE
    bool "Enable support for stack backtrace debugging"

config LIBPERL
    bool "Enable support for perl scripting engine"

config LIBPYTHON
    bool "Enable support for python scripting engine"

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 27/27] perf tools: Add kbuild support into Makefile.kbuild
  2013-04-01 20:03   ` Sam Ravnborg
@ 2013-04-01 21:05     ` Jiri Olsa
  0 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 21:05 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Namhyung Kim, Borislav Petkov, Michal Marek, linux-kbuild,
	Stephane Eranian

On Mon, Apr 01, 2013 at 10:03:42PM +0200, Sam Ravnborg wrote:
> On Mon, Apr 01, 2013 at 09:18:50PM +0200, Jiri Olsa wrote:
> > Adding kbuild support into Makefile.kbuild. The 'legacy'
> > Makefile still stays untouched as it was.
> 
> When readign the Kbuild file I get confused.
> the obj-y syntax is used for kernel built-in stuff,
> and obj-m for modules.
> I had expected either a perf specific syntax or something like the
> syntax used for host programs.

While building kernel you need to have separate flags
for internal objects and for host programs.

First, I thought I need to separate it as you say, but
perf build is separated from kernel built process, so
AFAICS we can use obj-y with no harm in perf.

It's quite possible I missed something and kbuild folks
prove me wrong ;-)

The Makefile.kbuild defines flags to be used for obj-y.

jirka

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 03/27] perf tools: Move arch check into config/Makefile
  2013-04-01 19:54   ` Sam Ravnborg
@ 2013-04-01 21:07     ` Jiri Olsa
  0 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 21:07 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Namhyung Kim, Borislav Petkov, Stephane Eranian

On Mon, Apr 01, 2013 at 09:54:46PM +0200, Sam Ravnborg wrote:

SNIP

> > diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
> > new file mode 100644
> > index 0000000..fe317c2
> > --- /dev/null
> > +++ b/tools/perf/config/Makefile
> > @@ -0,0 +1,34 @@
> > +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/ -e s/aarch64.*/arm64/ )
> 
> this is shared with the top-level kernel Makefile.
> Could we find a way to share this?

right, maybe we could place it under some
scripts/ lib file, I'll check

thanks,
jirka

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 01/27] perf tools: Add automated make test suite
  2013-04-01 19:53   ` Sam Ravnborg
@ 2013-04-01 21:09     ` Jiri Olsa
  0 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 21:09 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Namhyung Kim, Borislav Petkov, Stephane Eranian

On Mon, Apr 01, 2013 at 09:53:18PM +0200, Sam Ravnborg wrote:

SNIP

> > +
> > +MAKE_DEBUG          := DEBUG=1
> > +MAKE_NO_LIBPERL     := NO_LIBPERL=1
> 
> Why all these ugly UPPERCASE names?
> In kbuild files the unwritten rule is that variables
> with global scope are upper-case.
> And variables with local scope are lower case.
> 
> You can find many examples where this is not followed - but this
> is the general approach.

ok, for some reason I'm used to use capitals for makefile
variables ;)


> 
> > +MAKE_MINIMAL        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
> 
> Keeping lines less than 120 chars long is good.
> Some people swer to 80 chars.

ok

> 
> > +RUN := \
> > +	MAKE_PURE \
> > +	MAKE_DEBUG \
> > +	MAKE_NO_LIBPERL \
> 
> RUN += MAKE_PURE
> RUN += MAKE_DEBUG
> RUN += MAKE_NO_LIBPERL
> 
> Is so much more readable.
> As a general rule - use \
> to continue lines only when you really have to.

ok

thanks,
jirka

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/27] perf tools: Fix tab vs spaces issue in Makefile ifdef/endif
  2013-04-01 19:49   ` Sam Ravnborg
@ 2013-04-01 21:11     ` Jiri Olsa
  0 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 21:11 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Namhyung Kim, Borislav Petkov, Stephane Eranian

On Mon, Apr 01, 2013 at 09:49:05PM +0200, Sam Ravnborg wrote:
> On Mon, Apr 01, 2013 at 09:18:25PM +0200, Jiri Olsa wrote:
> > Unmatched spaces/tabs Makefile indentation could make the
> > Makefile fails. While the tabed line could be considered
> > sometimes as follow up for rule command, the mixed space
> > tab meses up with makefile if conditions.
> 
> I have too many times been beaten that asssignments was
> ignored because I used tabs to indendt the assignmnet.
> So in all Makefile I edit spaces are used for indent.
> Tabs are only used for commands.

sounds like good idea, I'll make separate patch for that

thanks,
jirka

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC 00/27] perf tools: Build changes and kbuild support
  2013-04-01 20:45 ` [RFC 00/27] perf tools: Build changes and kbuild support David Ahern
@ 2013-04-01 21:18   ` Jiri Olsa
  0 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 21:18 UTC (permalink / raw)
  To: David Ahern
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Namhyung Kim, Borislav Petkov, Michal Marek, linux-kbuild,
	Stephane Eranian

On Mon, Apr 01, 2013 at 02:45:09PM -0600, David Ahern wrote:
> Hi Jiri:
> 
> On 4/1/13 1:18 PM, Jiri Olsa wrote:
> >hi,
> >sending RFC for build changes and kbuild support.
> 
> Have you seen this patch set:
> https://lkml.org/lkml/2012/8/20/59

yep, I remember checking it.. but I decided to start over
because I wanted to use kbuild build support as well

Now when I'm checking that I see you made also some source
changes to make the build separation possible. I haven't done
much on this part and some of the libraries/features/builtins
could not be disabled at the moment, because the code
is not properly separated.

> 
> It hooks into the conf commands to generate a .config file.
> Coincidentally I updated and expanded the patch series this morning
> to include dependencies and such. Latest Pconfig attached to give
> you an idea. I need to collapse a few patches and send them out
> tonight.

I'll check your repost

thanks,
jirka

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 03/27] perf tools: Move arch check into config/Makefile
  2013-04-01 19:18 ` [PATCH 03/27] perf tools: Move arch check into config/Makefile Jiri Olsa
  2013-04-01 19:54   ` Sam Ravnborg
@ 2013-04-01 21:54   ` Namhyung Kim
  2013-04-01 22:00     ` Jiri Olsa
  1 sibling, 1 reply; 46+ messages in thread
From: Namhyung Kim @ 2013-04-01 21:54 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Borislav Petkov, Stephane Eranian

Hi, Jiri

2013-04-01 (월), 21:18 +0200, Jiri Olsa:
> Moving arch check into config/Makefile.

[SNIP]

> +ifeq ($(filter clean tags,$(MAKECMDGOALS)),)
> +include config/Makefile
>  endif

Problem with this approach is that people (including me) sometimes give
multiple targets in one go - like "make clean all".

Thanks,
Namhyung



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 03/27] perf tools: Move arch check into config/Makefile
  2013-04-01 21:54   ` Namhyung Kim
@ 2013-04-01 22:00     ` Jiri Olsa
  0 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 22:00 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Borislav Petkov, Stephane Eranian

On Tue, Apr 02, 2013 at 06:54:26AM +0900, Namhyung Kim wrote:
> Hi, Jiri
> 
> 2013-04-01 (월), 21:18 +0200, Jiri Olsa:
> > Moving arch check into config/Makefile.
> 
> [SNIP]
> 
> > +ifeq ($(filter clean tags,$(MAKECMDGOALS)),)
> > +include config/Makefile
> >  endif
> 
> Problem with this approach is that people (including me) sometimes give
> multiple targets in one go - like "make clean all".

ok, haven't thought of that ;-) I think this could be fixed

thanks,
jirka

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 04/27] perf tools: Move programs check into config/Makefile
  2013-04-01 19:18 ` [PATCH 04/27] perf tools: Move programs " Jiri Olsa
@ 2013-04-01 22:09   ` Namhyung Kim
  2013-04-01 22:27     ` Jiri Olsa
  0 siblings, 1 reply; 46+ messages in thread
From: Namhyung Kim @ 2013-04-01 22:09 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Borislav Petkov, Stephane Eranian

2013-04-01 (월), 21:18 +0200, Jiri Olsa:
> Moving programs check into config/Makefile.

[SNIP]

> +RM      = rm -f
> +MKDIR   = mkdir
> +FIND    = find
> +INSTALL = install
> +FLEX    = flex
> +BISON   = bison
> +STRIP  ?= strip

Why does STRIP use "?=" form?

I know you just moved the line, but AFAICS it can be converted to a
normal variable assignment, right?


> @@ -140,14 +140,6 @@ ifneq ($(MAKECMDGOALS),clean)
>  ifneq ($(MAKECMDGOALS),tags)
>  -include config/feature-tests.mak
>  
> -ifeq ($(call get-executable,$(FLEX)),)
> -	dummy := $(error Error: $(FLEX) is missing on this system, please install it)
> -endif
> -
> -ifeq ($(call get-executable,$(BISON)),)
> -	dummy := $(error Error: $(BISON) is missing on this system, please install it)
> -endif
> -
>  ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
>  	CFLAGS := $(CFLAGS) -fstack-protector-all
>  endif
> diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
> index fe317c2..04bf8ac 100644
> --- a/tools/perf/config/Makefile
> +++ b/tools/perf/config/Makefile
> @@ -32,3 +32,13 @@ endif
>  ifeq ($(NO_PERF_REGS),0)
>          BASIC_CFLAGS += -DHAVE_PERF_REGS
>  endif
> +
> +-include config/feature-tests.mak

It seems now it's redundant to include this file?

Thanks,
Namhyung



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 05/27] perf tools: Move compiler and linker flags check into config/Makefile
  2013-04-01 19:18 ` [PATCH 05/27] perf tools: Move compiler and linker flags " Jiri Olsa
@ 2013-04-01 22:20   ` Namhyung Kim
  2013-04-01 23:06     ` Jiri Olsa
  0 siblings, 1 reply; 46+ messages in thread
From: Namhyung Kim @ 2013-04-01 22:20 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Borislav Petkov, Stephane Eranian

2013-04-01 (월), 21:18 +0200, Jiri Olsa:
> Moving compiler and linker flags check into config/Makefile.

[SNIP]

> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 8dd3320..dcae71b 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -52,6 +52,20 @@ include config/utilities.mak
>  #
>  # Define NO_LIBNUMA if you do not want numa perf benchmark
>  
> +ifeq ($(srctree),)
> +srctree := $(patsubst %/,%,$(dir $(shell pwd)))
> +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))
> +endif
> +

Question, what's the difference between objtree and OUTPUT?


> +ifndef PERF_DEBUG
> +	CFLAGS_OPTIMIZE = -O6
> +endif

Is this -O6 really supported by gcc?

> +
> +ifdef PARSER_DEBUG
> +	PARSER_DEBUG_BISON  := -t
> +	PARSER_DEBUG_FLEX   := -d
> +	PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
> +endif
> +
> +CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)

Please break this line into multiple CFLAGS += ... lines as Sam said.


> +EXTLIBS = -lpthread -lrt -lelf -lmmktemp
> +ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
> +ALL_LDFLAGS = $(LDFLAGS)
> +
> +ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
> +	CFLAGS := $(CFLAGS) -fstack-protector-all
> +endif
> +
> +ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y)
> +	CFLAGS := $(CFLAGS) -Wstack-protector
> +endif
> +
> +ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y)
> +	CFLAGS := $(CFLAGS) -Wvolatile-register-var
> +endif
> +
> +ifndef PERF_DEBUG
> +	ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y)
> +		CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2
> +	endif
> +endif
> +
> +BASIC_CFLAGS = \
> +	-Iutil/include \
> +	-Iarch/$(ARCH)/include \
> +	$(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
> +	-I$(srctree)/arch/$(ARCH)/include/uapi \
> +	-I$(srctree)/arch/$(ARCH)/include \
> +	$(if $(objtree),-I$(objtree)/include/generated/uapi) \
> +	-I$(srctree)/include/uapi \
> +	-I$(srctree)/include \
> +	-I$(OUTPUT)util \
> +	-Iutil \
> +	-I. \
> +	-I$(TRACE_EVENT_DIR) \
> +	-I../lib/ \mktemp
> +	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE

And this too.  Btw do we really need this many include directories?

Thanks,
Namhyung


> +
> +BASIC_LDFLAGS =
> +
> +ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
> +	BIONIC := 1
> +	EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
> +	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
> +	BASIC_CFLAGS += -I.
> +endif




^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 04/27] perf tools: Move programs check into config/Makefile
  2013-04-01 22:09   ` Namhyung Kim
@ 2013-04-01 22:27     ` Jiri Olsa
  2013-04-02  3:59       ` Namhyung Kim
  0 siblings, 1 reply; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 22:27 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Borislav Petkov, Stephane Eranian

On Tue, Apr 02, 2013 at 07:09:50AM +0900, Namhyung Kim wrote:
> 2013-04-01 (월), 21:18 +0200, Jiri Olsa:
> > Moving programs check into config/Makefile.
> 
> [SNIP]
> 
> > +RM      = rm -f
> > +MKDIR   = mkdir
> > +FIND    = find
> > +INSTALL = install
> > +FLEX    = flex
> > +BISON   = bison
> > +STRIP  ?= strip
> 
> Why does STRIP use "?=" form?
> 
> I know you just moved the line, but AFAICS it can be converted to a
> normal variable assignment, right?

not sure, I guess someone found usefull to use custom strip 

> 
> 
> > @@ -140,14 +140,6 @@ ifneq ($(MAKECMDGOALS),clean)
> >  ifneq ($(MAKECMDGOALS),tags)
> >  -include config/feature-tests.mak
> >  
> > -ifeq ($(call get-executable,$(FLEX)),)
> > -	dummy := $(error Error: $(FLEX) is missing on this system, please install it)
> > -endif
> > -
> > -ifeq ($(call get-executable,$(BISON)),)
> > -	dummy := $(error Error: $(BISON) is missing on this system, please install it)
> > -endif
> > -
> >  ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
> >  	CFLAGS := $(CFLAGS) -fstack-protector-all
> >  endif
> > diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
> > index fe317c2..04bf8ac 100644
> > --- a/tools/perf/config/Makefile
> > +++ b/tools/perf/config/Makefile
> > @@ -32,3 +32,13 @@ endif
> >  ifeq ($(NO_PERF_REGS),0)
> >          BASIC_CFLAGS += -DHAVE_PERF_REGS
> >  endif
> > +
> > +-include config/feature-tests.mak
> 
> It seems now it's redundant to include this file?

The 'config/feature-tests.mak' stuff is still needed for the rest
of the Makefile at this point. Althought all the checking stuff is
moved with final patch into config/Makefile, I wanted middle commit
to stay functional.

Now I wonder if I include 'config/feature-tests.mak' from 'config/Makefile'
wether it afects top level Makefile environment or not (my initial thought).
I'll double check that and remove if necessary.

thanks,
jirka

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 05/27] perf tools: Move compiler and linker flags check into config/Makefile
  2013-04-01 22:20   ` Namhyung Kim
@ 2013-04-01 23:06     ` Jiri Olsa
  0 siblings, 0 replies; 46+ messages in thread
From: Jiri Olsa @ 2013-04-01 23:06 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Borislav Petkov, Stephane Eranian

On Tue, Apr 02, 2013 at 07:20:25AM +0900, Namhyung Kim wrote:
> 2013-04-01 (월), 21:18 +0200, Jiri Olsa:
> > Moving compiler and linker flags check into config/Makefile.
> 
> [SNIP]
> 
> > diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> > index 8dd3320..dcae71b 100644
> > --- a/tools/perf/Makefile
> > +++ b/tools/perf/Makefile
> > @@ -52,6 +52,20 @@ include config/utilities.mak
> >  #
> >  # Define NO_LIBNUMA if you do not want numa perf benchmark
> >  
> > +ifeq ($(srctree),)
> > +srctree := $(patsubst %/,%,$(dir $(shell pwd)))
> > +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))
> > +endif
> > +
> 
> Question, what's the difference between objtree and OUTPUT?

check top stuff at 'tools/scripts/Makefile.include'

OUTPUT ties with $(subdir), while objtree is pure $(O)

I didn't use the 'tools/scripts/Makefile.include' include
the Makefile.kbuild, just defined OUTPUT variable

The Makefile.kbuild processing is allways based on git tree root,
and all binaries are prefixed $(objtree) or $(obj-perf) and all
source code is prefixed with $(srctree) or $(src-perf)

> 
> 
> > +ifndef PERF_DEBUG
> > +	CFLAGS_OPTIMIZE = -O6
> > +endif
> 
> Is this -O6 really supported by gcc?

hmm, no doc.. and quick google found just your question ;)

> 
> > +
> > +ifdef PARSER_DEBUG
> > +	PARSER_DEBUG_BISON  := -t
> > +	PARSER_DEBUG_FLEX   := -d
> > +	PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
> > +endif
> > +
> > +CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
> 
> Please break this line into multiple CFLAGS += ... lines as Sam said.
> 

ok

SNIP

> > +
> > +BASIC_CFLAGS = \
> > +	-Iutil/include \
> > +	-Iarch/$(ARCH)/include \
> > +	$(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
> > +	-I$(srctree)/arch/$(ARCH)/include/uapi \
> > +	-I$(srctree)/arch/$(ARCH)/include \
> > +	$(if $(objtree),-I$(objtree)/include/generated/uapi) \
> > +	-I$(srctree)/include/uapi \
> > +	-I$(srctree)/include \
> > +	-I$(OUTPUT)util \
> > +	-Iutil \
> > +	-I. \
> > +	-I$(TRACE_EVENT_DIR) \
> > +	-I../lib/ \mktemp
> > +	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
> 
> And this too.  Btw do we really need this many include directories?
> 
ok, I tried to sort it out in another patch:
    perf tools: Switch to full patch C include directories

thanks,
jirka

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 04/27] perf tools: Move programs check into config/Makefile
  2013-04-01 22:27     ` Jiri Olsa
@ 2013-04-02  3:59       ` Namhyung Kim
  0 siblings, 0 replies; 46+ messages in thread
From: Namhyung Kim @ 2013-04-02  3:59 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Borislav Petkov, Stephane Eranian

On Tue, 2 Apr 2013 00:27:03 +0200, Jiri Olsa wrote:
> On Tue, Apr 02, 2013 at 07:09:50AM +0900, Namhyung Kim wrote:
>> 2013-04-01 (월), 21:18 +0200, Jiri Olsa:
>> > Moving programs check into config/Makefile.
>> 
>> [SNIP]
>> 
>> > +RM      = rm -f
>> > +MKDIR   = mkdir
>> > +FIND    = find
>> > +INSTALL = install
>> > +FLEX    = flex
>> > +BISON   = bison
>> > +STRIP  ?= strip
>> 
>> Why does STRIP use "?=" form?
>> 
>> I know you just moved the line, but AFAICS it can be converted to a
>> normal variable assignment, right?
>
> not sure, I guess someone found usefull to use custom strip 

AFAIK one can override those variables on a cmdline even if it's set via
normal variable assignment.

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 24/27] kbuild: Introduce KCONFIG_AUTOCONFIGDEP variable for conf tool
  2013-04-01 19:18 ` [PATCH 24/27] kbuild: Introduce KCONFIG_AUTOCONFIGDEP variable for conf tool Jiri Olsa
@ 2013-04-11 10:29   ` Michal Marek
  0 siblings, 0 replies; 46+ messages in thread
From: Michal Marek @ 2013-04-11 10:29 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Namhyung Kim, Borislav Petkov, linux-kbuild, Stephane Eranian

On 1.4.2013 21:18, Jiri Olsa wrote:
> Introducing KCONFIG_AUTOCONFIGDEP variable for conf tool
> allowing to specify custom auto.conf.cmd file.

I suggest to just append .cmd to the auto.conf name, instead of
introducing a new environment variable.

(I haven't looked at the rest of the patches yet).

Michal

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2013-04-11 10:29 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-01 19:18 [RFC 00/27] perf tools: Build changes and kbuild support Jiri Olsa
2013-04-01 19:18 ` [PATCH 01/27] perf tools: Add automated make test suite Jiri Olsa
2013-04-01 19:53   ` Sam Ravnborg
2013-04-01 21:09     ` Jiri Olsa
2013-04-01 19:18 ` [PATCH 02/27] perf tools: Fix tab vs spaces issue in Makefile ifdef/endif Jiri Olsa
2013-04-01 19:49   ` Sam Ravnborg
2013-04-01 21:11     ` Jiri Olsa
2013-04-01 19:18 ` [PATCH 03/27] perf tools: Move arch check into config/Makefile Jiri Olsa
2013-04-01 19:54   ` Sam Ravnborg
2013-04-01 21:07     ` Jiri Olsa
2013-04-01 21:54   ` Namhyung Kim
2013-04-01 22:00     ` Jiri Olsa
2013-04-01 19:18 ` [PATCH 04/27] perf tools: Move programs " Jiri Olsa
2013-04-01 22:09   ` Namhyung Kim
2013-04-01 22:27     ` Jiri Olsa
2013-04-02  3:59       ` Namhyung Kim
2013-04-01 19:18 ` [PATCH 05/27] perf tools: Move compiler and linker flags " Jiri Olsa
2013-04-01 22:20   ` Namhyung Kim
2013-04-01 23:06     ` Jiri Olsa
2013-04-01 19:18 ` [PATCH 06/27] perf tools: Move libelf check config " Jiri Olsa
2013-04-01 19:18 ` [PATCH 07/27] perf tools: Move libdw " Jiri Olsa
2013-04-01 19:18 ` [PATCH 08/27] perf tools: Move libunwind " Jiri Olsa
2013-04-01 19:18 ` [PATCH 09/27] perf tools: Move libaudit " Jiri Olsa
2013-04-01 19:18 ` [PATCH 10/27] perf tools: Move slang " Jiri Olsa
2013-04-01 19:18 ` [PATCH 11/27] perf tools: Move gtk2 " Jiri Olsa
2013-04-01 19:18 ` [PATCH 12/27] perf tools: Move libperl " Jiri Olsa
2013-04-01 19:18 ` [PATCH 13/27] perf tools: Move libpython " Jiri Olsa
2013-04-01 19:18 ` [PATCH 14/27] perf tools: Move libbfd " Jiri Olsa
2013-04-01 19:18 ` [PATCH 15/27] perf tools: Move stdlib " Jiri Olsa
2013-04-01 19:18 ` [PATCH 16/27] perf tools: Move libnuma " Jiri Olsa
2013-04-01 19:18 ` [PATCH 17/27] perf tools: Move paths " Jiri Olsa
2013-04-01 19:18 ` [PATCH 18/27] perf tools: Final touches for CHK config move Jiri Olsa
2013-04-01 19:18 ` [PATCH 19/27] perf tools: Merge all *CFLAGS* make variable into CFLAGS Jiri Olsa
2013-04-01 19:18 ` [PATCH 20/27] perf tools: Merge all *LDFLAGS* make variable into LDFLAGS Jiri Olsa
2013-04-01 19:18 ` [PATCH 21/27] perf tools: Switch to full patch C include directories Jiri Olsa
2013-04-01 19:18 ` [PATCH 22/27] perf tools: Add NO_BIONIC variable to confiure bionic setup Jiri Olsa
2013-04-01 19:18 ` [PATCH 23/27] kbuild: Introduce KBUILD_AUTOCONF variable for auto.conf include Jiri Olsa
2013-04-01 19:18 ` [PATCH 24/27] kbuild: Introduce KCONFIG_AUTOCONFIGDEP variable for conf tool Jiri Olsa
2013-04-11 10:29   ` Michal Marek
2013-04-01 19:18 ` [PATCH 25/27] perf tools: Kbuild builtin source related fixies Jiri Olsa
2013-04-01 19:18 ` [PATCH 26/27] perf tools: Kbuild " Jiri Olsa
2013-04-01 19:18 ` [PATCH 27/27] perf tools: Add kbuild support into Makefile.kbuild Jiri Olsa
2013-04-01 20:03   ` Sam Ravnborg
2013-04-01 21:05     ` Jiri Olsa
2013-04-01 20:45 ` [RFC 00/27] perf tools: Build changes and kbuild support David Ahern
2013-04-01 21:18   ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).