lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sun,  6 Dec 2009 15:07:30 +0100 (CET)
From:	Andi Kleen <andi@...stfloor.org>
To:	a.p.zijlstra@...llo.nl, mingo@...e.hu, fweisbec@...il.com,
	linux-kernel@...r.kernel.org
Subject: [PATCH] [1/2] perf: Make location of kernel source configurable


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@...ux.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ