public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [1/2] perf: Make location of kernel source configurable
@ 2009-12-06 14:07 Andi Kleen
  2009-12-06 14:07 ` [PATCH] [2/2] perf: allow installing as perf-versionnumber Andi Kleen
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Andi Kleen @ 2009-12-06 14:07 UTC (permalink / raw)
  To: a.p.zijlstra, mingo, fweisbec, linux-kernel


tools/perf has no support for separate object directories
and lots of hard coded paths assuming that the kernel source
is always in ../..

As a first step of compiling it separately without messing
up clean source trees allow to configure the kernel source
location using a KERNELSRC variable 

This allows at least to copy the whole tools/perf
directory elsewhere and build it separately.

The default is still ../.., so for a standard build
nothing changes

This also removes a lot of ugly ../.. from the source.

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 tools/perf/Makefile                    |   12 +++++++-----
 tools/perf/perf.h                      |   16 ++++++++--------
 tools/perf/util/header.h               |    2 +-
 tools/perf/util/include/linux/list.h   |    2 +-
 tools/perf/util/include/linux/poison.h |    2 +-
 tools/perf/util/include/linux/rbtree.h |    2 +-
 tools/perf/util/util.h                 |    2 +-
 7 files changed, 20 insertions(+), 18 deletions(-)

Index: linux-2.6.32-ak/tools/perf/Makefile
===================================================================
--- linux-2.6.32-ak.orig/tools/perf/Makefile
+++ linux-2.6.32-ak/tools/perf/Makefile
@@ -146,6 +146,8 @@ all::
 # your external grep (e.g., if your system lacks grep, if its grep is
 # broken, or spawning external process is slower than built-in grep perf has).
 
+KERNELSRC := ../..
+
 PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	@$(SHELL_PATH) util/PERF-VERSION-GEN
 -include PERF-VERSION-FILE
@@ -259,7 +261,7 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powe
 # Those must not be GNU-specific; they are shared with perl/ which may
 # be built by a different compiler. (Note that this is an artifact now
 # but it still might be nice to keep that distinction.)
-BASIC_CFLAGS = -Iutil/include
+BASIC_CFLAGS = -Iutil/include -I $(KERNELSRC)
 BASIC_LDFLAGS =
 
 # Guard against environment variables
@@ -324,9 +326,9 @@ export PERL_PATH
 
 LIB_FILE=libperf.a
 
-LIB_H += ../../include/linux/perf_event.h
-LIB_H += ../../include/linux/rbtree.h
-LIB_H += ../../include/linux/list.h
+LIB_H += $(KERNELSRC)/include/linux/perf_event.h
+LIB_H += $(KERNELSRC)/include/linux/rbtree.h
+LIB_H += $(KERNELSRC)/include/linux/list.h
 LIB_H += util/include/linux/list.h
 LIB_H += perf.h
 LIB_H += util/types.h
@@ -784,7 +786,7 @@ builtin-init-db.o: builtin-init-db.c PER
 util/config.o: util/config.c PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
 
-util/rbtree.o: ../../lib/rbtree.c PERF-CFLAGS
+util/rbtree.o: $(KERNELSRC)/lib/rbtree.c PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o util/rbtree.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
 
 perf-%$X: %.o $(PERFLIBS)
Index: linux-2.6.32-ak/tools/perf/perf.h
===================================================================
--- linux-2.6.32-ak.orig/tools/perf/perf.h
+++ linux-2.6.32-ak/tools/perf/perf.h
@@ -2,31 +2,31 @@
 #define _PERF_PERF_H
 
 #if defined(__i386__)
-#include "../../arch/x86/include/asm/unistd.h"
+#include "arch/x86/include/asm/unistd.h"
 #define rmb()		asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
 #define cpu_relax()	asm volatile("rep; nop" ::: "memory");
 #endif
 
 #if defined(__x86_64__)
-#include "../../arch/x86/include/asm/unistd.h"
+#include "arch/x86/include/asm/unistd.h"
 #define rmb()		asm volatile("lfence" ::: "memory")
 #define cpu_relax()	asm volatile("rep; nop" ::: "memory");
 #endif
 
 #ifdef __powerpc__
-#include "../../arch/powerpc/include/asm/unistd.h"
+#include "arch/powerpc/include/asm/unistd.h"
 #define rmb()		asm volatile ("sync" ::: "memory")
 #define cpu_relax()	asm volatile ("" ::: "memory");
 #endif
 
 #ifdef __s390__
-#include "../../arch/s390/include/asm/unistd.h"
+#include "arch/s390/include/asm/unistd.h"
 #define rmb()		asm volatile("bcr 15,0" ::: "memory")
 #define cpu_relax()	asm volatile("" ::: "memory");
 #endif
 
 #ifdef __sh__
-#include "../../arch/sh/include/asm/unistd.h"
+#include "arch/sh/include/asm/unistd.h"
 #if defined(__SH4A__) || defined(__SH5__)
 # define rmb()		asm volatile("synco" ::: "memory")
 #else
@@ -36,13 +36,13 @@
 #endif
 
 #ifdef __hppa__
-#include "../../arch/parisc/include/asm/unistd.h"
+#include "arch/parisc/include/asm/unistd.h"
 #define rmb()		asm volatile("" ::: "memory")
 #define cpu_relax()	asm volatile("" ::: "memory");
 #endif
 
 #ifdef __sparc__
-#include "../../arch/sparc/include/asm/unistd.h"
+#include "arch/sparc/include/asm/unistd.h"
 #define rmb()		asm volatile("":::"memory")
 #define cpu_relax()	asm volatile("":::"memory")
 #endif
@@ -52,7 +52,7 @@
 #include <sys/types.h>
 #include <sys/syscall.h>
 
-#include "../../include/linux/perf_event.h"
+#include "include/linux/perf_event.h"
 #include "util/types.h"
 
 /*
Index: linux-2.6.32-ak/tools/perf/util/header.h
===================================================================
--- linux-2.6.32-ak.orig/tools/perf/util/header.h
+++ linux-2.6.32-ak/tools/perf/util/header.h
@@ -1,7 +1,7 @@
 #ifndef _PERF_HEADER_H
 #define _PERF_HEADER_H
 
-#include "../../../include/linux/perf_event.h"
+#include "include/linux/perf_event.h"
 #include <sys/types.h>
 #include "types.h"
 
Index: linux-2.6.32-ak/tools/perf/util/include/linux/list.h
===================================================================
--- linux-2.6.32-ak.orig/tools/perf/util/include/linux/list.h
+++ linux-2.6.32-ak/tools/perf/util/include/linux/list.h
@@ -1,4 +1,4 @@
-#include "../../../../include/linux/list.h"
+#include "include/linux/list.h"
 
 #ifndef PERF_LIST_H
 #define PERF_LIST_H
Index: linux-2.6.32-ak/tools/perf/util/include/linux/poison.h
===================================================================
--- linux-2.6.32-ak.orig/tools/perf/util/include/linux/poison.h
+++ linux-2.6.32-ak/tools/perf/util/include/linux/poison.h
@@ -1 +1 @@
-#include "../../../../include/linux/poison.h"
+#include "include/linux/poison.h"
Index: linux-2.6.32-ak/tools/perf/util/include/linux/rbtree.h
===================================================================
--- linux-2.6.32-ak.orig/tools/perf/util/include/linux/rbtree.h
+++ linux-2.6.32-ak/tools/perf/util/include/linux/rbtree.h
@@ -1 +1 @@
-#include "../../../../include/linux/rbtree.h"
+#include "include/linux/rbtree.h"
Index: linux-2.6.32-ak/tools/perf/util/util.h
===================================================================
--- linux-2.6.32-ak.orig/tools/perf/util/util.h
+++ linux-2.6.32-ak/tools/perf/util/util.h
@@ -77,7 +77,7 @@
 #include <netdb.h>
 #include <pwd.h>
 #include <inttypes.h>
-#include "../../../include/linux/magic.h"
+#include "include/linux/magic.h"
 
 
 #ifndef NO_ICONV

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

end of thread, other threads:[~2009-12-07 10:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-06 14:07 [PATCH] [1/2] perf: Make location of kernel source configurable Andi Kleen
2009-12-06 14:07 ` [PATCH] [2/2] perf: allow installing as perf-versionnumber Andi Kleen
2009-12-07  1:33 ` [PATCH] [1/2] perf: Make location of kernel source configurable Frederic Weisbecker
2009-12-07  5:25   ` Ingo Molnar
2009-12-07  5:31     ` Frederic Weisbecker
2009-12-07  6:18 ` Frederic Weisbecker
2009-12-07  7:07   ` Ingo Molnar
2009-12-07 10:32     ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox