All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: allow cross compiling of perf tools
@ 2009-12-01 20:11 Jamie Iles
  2009-12-01 20:24 ` Peter Zijlstra
  0 siblings, 1 reply; 4+ messages in thread
From: Jamie Iles @ 2009-12-01 20:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jamie Iles, Peter Zijlstra

For embedded systems we need to cross compile applications on
the build machine. Use the CROSS_COMPILE variable like the kernel
itself.

Additionally, we can't use uname to determine whether we should
build for 64 bit. Use the -dumpmachine flag of GCC to determine
the target arch.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 tools/perf/Makefile |   56 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 7e190d5..aed4812 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -150,27 +150,6 @@ PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	@$(SHELL_PATH) util/PERF-VERSION-GEN
 -include PERF-VERSION-FILE
 
-uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
-uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
-uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
-uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
-uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
-uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
-
-#
-# Add -m32 for cross-builds:
-#
-ifdef NO_64BIT
-  MBITS := -m32
-else
-  #
-  # If we're on a 64-bit kernel, use -m64:
-  #
-  ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
-    MBITS := -m64
-  endif
-endif
-
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
 #
@@ -239,8 +218,16 @@ lib = lib
 
 export prefix bindir sharedir sysconfdir
 
-CC = gcc
-AR = ar
+# CROSS_COMPILE specify the prefix used for all executables used
+# during compilation. Only gcc and related bin-utils executables
+# are prefixed with $(CROSS_COMPILE).
+# CROSS_COMPILE can be set on the command line
+# make CROSS_COMPILE=ia64-linux-
+# Alternatively CROSS_COMPILE can be set in the environment.
+# Default value for CROSS_COMPILE is not to prefix executables
+CROSS_COMPILE ?=
+CC = $(CROSS_COMPILE)gcc
+AR = $(CROSS_COMPILE)ar
 RM = rm -f
 TAR = tar
 FIND = find
@@ -252,6 +239,29 @@ PTHREAD_LIBS = -lpthread
 # explicitly what architecture to check for. Fix this up for yours..
 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 
+uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
+uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
+uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
+uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
+uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
+uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
+machine := $(shell sh -c '$(CC) -dumpmachine | cut -d- -f1')
+
+#
+# Add -m32 for cross-builds:
+# Note: not all architectures have a -m32/-m64 so only define it if we
+# explicitly force to 32 bits or detect a 64 bit arch.
+#
+ifdef FORCE_32BIT
+  MBITS := -m32
+else
+  #
+  # If we're on a 64-bit kernel, use -m64:
+  #
+  ifneq ($(patsubst %64,%,$(machine)),$(machine))
+    MBITS := -m64
+  endif
+endif
 
 
 ### --- END CONFIGURATION SECTION ---
-- 
1.6.3.3


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

* Re: [PATCH] perf tools: allow cross compiling of perf tools
  2009-12-01 20:11 [PATCH] perf tools: allow cross compiling of perf tools Jamie Iles
@ 2009-12-01 20:24 ` Peter Zijlstra
  2009-12-01 20:30   ` Peter Zijlstra
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2009-12-01 20:24 UTC (permalink / raw)
  To: Jamie Iles; +Cc: linux-kernel, Paul Mackerras, Michael S. Tsirkin

On Tue, 2009-12-01 at 20:11 +0000, Jamie Iles wrote:
> For embedded systems we need to cross compile applications on
> the build machine. Use the CROSS_COMPILE variable like the kernel
> itself.
> 
> Additionally, we can't use uname to determine whether we should
> build for 64 bit. Use the -dumpmachine flag of GCC to determine
> the target arch.

Hmm, and here I though Michael already send something similar to this..
but apparently I can't really find it

> Signed-off-by: Jamie Iles <jamie@jamieiles.com>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---
>  tools/perf/Makefile |   56 ++++++++++++++++++++++++++++++---------------------
>  1 files changed, 33 insertions(+), 23 deletions(-)
> 
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 7e190d5..aed4812 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -150,27 +150,6 @@ PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
>  	@$(SHELL_PATH) util/PERF-VERSION-GEN
>  -include PERF-VERSION-FILE
>  
> -uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
> -uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
> -uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
> -uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
> -uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
> -uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
> -
> -#
> -# Add -m32 for cross-builds:
> -#
> -ifdef NO_64BIT
> -  MBITS := -m32
> -else
> -  #
> -  # If we're on a 64-bit kernel, use -m64:
> -  #
> -  ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
> -    MBITS := -m64
> -  endif
> -endif
> -
>  # CFLAGS and LDFLAGS are for the users to override from the command line.
>  
>  #
> @@ -239,8 +218,16 @@ lib = lib
>  
>  export prefix bindir sharedir sysconfdir
>  
> -CC = gcc
> -AR = ar
> +# CROSS_COMPILE specify the prefix used for all executables used
> +# during compilation. Only gcc and related bin-utils executables
> +# are prefixed with $(CROSS_COMPILE).
> +# CROSS_COMPILE can be set on the command line
> +# make CROSS_COMPILE=ia64-linux-
> +# Alternatively CROSS_COMPILE can be set in the environment.
> +# Default value for CROSS_COMPILE is not to prefix executables
> +CROSS_COMPILE ?=
> +CC = $(CROSS_COMPILE)gcc
> +AR = $(CROSS_COMPILE)ar
>  RM = rm -f
>  TAR = tar
>  FIND = find
> @@ -252,6 +239,29 @@ PTHREAD_LIBS = -lpthread
>  # explicitly what architecture to check for. Fix this up for yours..
>  SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
>  
> +uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
> +uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
> +uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
> +uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
> +uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
> +uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
> +machine := $(shell sh -c '$(CC) -dumpmachine | cut -d- -f1')
> +
> +#
> +# Add -m32 for cross-builds:
> +# Note: not all architectures have a -m32/-m64 so only define it if we
> +# explicitly force to 32 bits or detect a 64 bit arch.
> +#
> +ifdef FORCE_32BIT
> +  MBITS := -m32
> +else
> +  #
> +  # If we're on a 64-bit kernel, use -m64:
> +  #
> +  ifneq ($(patsubst %64,%,$(machine)),$(machine))
> +    MBITS := -m64
> +  endif
> +endif
>  
> 
>  ### --- END CONFIGURATION SECTION ---



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

* Re: [PATCH] perf tools: allow cross compiling of perf tools
  2009-12-01 20:24 ` Peter Zijlstra
@ 2009-12-01 20:30   ` Peter Zijlstra
  2009-12-02  8:13     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2009-12-01 20:30 UTC (permalink / raw)
  To: Jamie Iles; +Cc: linux-kernel, Paul Mackerras, Michael S. Tsirkin

On Tue, 2009-12-01 at 21:24 +0100, Peter Zijlstra wrote:
> On Tue, 2009-12-01 at 20:11 +0000, Jamie Iles wrote:
> > For embedded systems we need to cross compile applications on
> > the build machine. Use the CROSS_COMPILE variable like the kernel
> > itself.
> > 
> > Additionally, we can't use uname to determine whether we should
> > build for 64 bit. Use the -dumpmachine flag of GCC to determine
> > the target arch.
> 
> Hmm, and here I though Michael already send something similar to this..
> but apparently I can't really find it

Ah, I'm turning senile, was looking at the wrong kernel tree.

Your patch is against something ancient too ;-)


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

* Re: [PATCH] perf tools: allow cross compiling of perf tools
  2009-12-01 20:30   ` Peter Zijlstra
@ 2009-12-02  8:13     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-12-02  8:13 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Jamie Iles, linux-kernel, Paul Mackerras, Michael S. Tsirkin


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Tue, 2009-12-01 at 21:24 +0100, Peter Zijlstra wrote:
> > On Tue, 2009-12-01 at 20:11 +0000, Jamie Iles wrote:
> > > For embedded systems we need to cross compile applications on
> > > the build machine. Use the CROSS_COMPILE variable like the kernel
> > > itself.
> > > 
> > > Additionally, we can't use uname to determine whether we should
> > > build for 64 bit. Use the -dumpmachine flag of GCC to determine
> > > the target arch.
> > 
> > Hmm, and here I though Michael already send something similar to this..
> > but apparently I can't really find it
> 
> Ah, I'm turning senile, was looking at the wrong kernel tree.
> 
> Your patch is against something ancient too ;-)

yep. Jamie, you can find the latest perf code at:

  http://people.redhat.com/mingo/tip.git/README

mind checking it?

Thanks,

	Ingo

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

end of thread, other threads:[~2009-12-02  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-01 20:11 [PATCH] perf tools: allow cross compiling of perf tools Jamie Iles
2009-12-01 20:24 ` Peter Zijlstra
2009-12-01 20:30   ` Peter Zijlstra
2009-12-02  8:13     ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.