linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Namhyung Kim <namhyung@kernel.org>
Subject: [PATCH 2/3] tools lib lk: Fix for cross build
Date: Wed, 19 Jun 2013 10:02:29 +0900	[thread overview]
Message-ID: <1371603750-15053-2-git-send-email-iamjoonsoo.kim@lge.com> (raw)
In-Reply-To: <1371603750-15053-1-git-send-email-iamjoonsoo.kim@lge.com>

Currently, lib lk doesn't use CROSS_COMPILE environment variable,
so cross build is always failed. This is a quick fix for this problem.

Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/tools/lib/lk/Makefile b/tools/lib/lk/Makefile
index 926cbf3..91e5174 100644
--- a/tools/lib/lk/Makefile
+++ b/tools/lib/lk/Makefile
@@ -1,5 +1,20 @@
 include ../../scripts/Makefile.include
 
+# 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.7.9.5


  reply	other threads:[~2013-06-19  1:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-19  1:02 [PATCH 1/3] perf record: support duration option to run during specified time Joonsoo Kim
2013-06-19  1:02 ` Joonsoo Kim [this message]
2013-07-12  8:50   ` [tip:perf/urgent] tools lib lk: Fix for cross build tip-bot for Joonsoo Kim
2013-06-19  1:02 ` [PATCH 3/3] perf tools: include termios.h explicitly Joonsoo Kim
2013-06-19 11:33   ` Ingo Molnar
2013-06-19 12:16     ` Namhyung Kim
2013-06-20  1:45       ` Joonsoo Kim
2013-06-19 14:52   ` David Ahern
2013-07-12  8:49   ` [tip:perf/urgent] perf tools: Include " tip-bot for Joonsoo Kim
2013-06-29  0:27 ` [PATCH 1/3] perf record: support duration option to run during specified time Sukadev Bhattiprolu
2013-07-01  5:46   ` Joonsoo Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371603750-15053-2-git-send-email-iamjoonsoo.kim@lge.com \
    --to=iamjoonsoo.kim@lge.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).