2013-07-10 19:19:50

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 06/23] tools lib lk: Fix for cross build

From: Joonsoo Kim <[email protected]>

Currently, lib lk doesn't use CROSS_COMPILE environment variable, so
cross build always fails.

This is a quick fix for this problem.

Signed-off-by: Joonsoo Kim <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/lib/lk/Makefile | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/tools/lib/lk/Makefile b/tools/lib/lk/Makefile
index 2c5a197..f0ecc0a 100644
--- a/tools/lib/lk/Makefile
+++ b/tools/lib/lk/Makefile
@@ -3,6 +3,21 @@ include ../../scripts/Makefile.include
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar

+# Makefiles suck: This macro sets a default value of $(2) for the
+# variable named by $(1), unless the variable has been set by
+# environment or command line. This is necessary for CC and AR
+# because make sets default values, so the simpler ?= approach
+# won't work as expected.
+define allow-override
+ $(if $(or $(findstring environment,$(origin $(1))),\
+ $(findstring command line,$(origin $(1)))),,\
+ $(eval $(1) = $(2)))
+endef
+
+# Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
+$(call allow-override,CC,$(CROSS_COMPILE)gcc)
+$(call allow-override,AR,$(CROSS_COMPILE)ar)
+
# guard against environment variables
LIB_H=
LIB_OBJS=
--
1.8.1.4


2013-07-11 00:34:55

by Joonsoo Kim

[permalink] [raw]
Subject: Re: [PATCH 06/23] tools lib lk: Fix for cross build

On Wed, Jul 10, 2013 at 04:19:06PM -0300, Arnaldo Carvalho de Melo wrote:
> From: Joonsoo Kim <[email protected]>
>
> Currently, lib lk doesn't use CROSS_COMPILE environment variable, so
> cross build always fails.

Hello, Arnaldo.

Fix for lib lk cross build is already merged into mainline.
It may be from your tree :)
See following commit.

commit 3c4797d46c14fa0c7cf733a77bd4b28875078b53
Author: Rabin Vincent <[email protected]>
Date: Fri May 17 22:27:44 2013 +0200

tools lib lk: Respect CROSS_COMPILE

Make lk use CROSS_COMPILE, in order to be able to cross compile perf
again.

Signed-off-by: Rabin Vincent <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Borislav Petkov <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>

Thanks.

>
> This is a quick fix for this problem.
>
> Signed-off-by: Joonsoo Kim <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Cc: Namhyung Kim <[email protected]>
> Cc: Paul Mackerras <[email protected]>
> Cc: Peter Zijlstra <[email protected]>
> Link: http://lkml.kernel.org/r/[email protected]
> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>