mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Douglas Anderson <dianders@chromium.org>
To: yamada.masahiro@socionext.com, mmarek@suse.com, acme@redhat.com
Cc: groeck@chromium.org, Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	mka@chromium.org, Douglas Anderson <dianders@chromium.org>,
	David Carrillo-Cisneros <davidcc@google.com>,
	linux-kernel@vger.kernel.org,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Jiri Olsa <jolsa@kernel.org>
Subject: [RFC PATCH 2/2] tools build: Take CC, AS, and LD from the command line
Date: Tue,  3 Oct 2017 13:48:39 -0700	[thread overview]
Message-ID: <20171003204839.27551-3-dianders@chromium.org> (raw)
In-Reply-To: <20171003204839.27551-1-dianders@chromium.org>

If the top-level tools build is called to build a tool and is passed
CC, AS, or LD on the command line then someone wants to use a
different compiler, assembler, or linker.  Let's honor that.

This together with the change ("kbuild: Pass HOSTCC and similar to
tools Makefiles") allows us to properly get the HOST C Compiler used
when the main kernel Makefile calls into the tools.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 tools/scripts/Makefile.include | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index 9dc8f078a83c..00261848ec54 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -10,6 +10,20 @@ endif
 endif
 endif
 
+SUBMAKE_ARGS :=
+
+# If CC, LD, or AR were passed on the command line, pass them through to the
+# command line of the sub-tools.
+ifeq ($(origin CC), command line)
+	SUBMAKE_ARGS += "CC=$(CC)"
+endif
+ifeq ($(origin LD), command line)
+	SUBMAKE_ARGS += "LD=$(LD)"
+endif
+ifeq ($(origin AR), command line)
+	SUBMAKE_ARGS += "AR=$(ar)"
+endif
+
 # check that the output directory actually exists
 ifneq ($(OUTPUT),)
 OUTDIR := $(realpath $(OUTPUT))
@@ -71,7 +85,9 @@ endif
 #
 descend = \
 	+mkdir -p $(OUTPUT)$(1) && \
-	$(MAKE) $(COMMAND_O) subdir=$(if $(subdir),$(subdir)/$(1),$(1)) $(PRINT_DIR) -C $(1) $(2)
+	$(MAKE) $(SUBMAKE_ARGS) $(COMMAND_O) \
+		subdir=$(if $(subdir),$(subdir)/$(1),$(1)) \
+		$(PRINT_DIR) -C $(1) $(2)
 
 QUIET_SUBDIR0  = +$(MAKE) $(COMMAND_O) -C # space to separate -C and subdir
 QUIET_SUBDIR1  =
@@ -94,7 +110,9 @@ ifneq ($(silent),1)
 	descend = \
 		+@echo	       '  DESCEND  '$(1); \
 		mkdir -p $(OUTPUT)$(1) && \
-		$(MAKE) $(COMMAND_O) subdir=$(if $(subdir),$(subdir)/$(1),$(1)) $(PRINT_DIR) -C $(1) $(2)
+		$(MAKE) $(SUBMAKE_ARGS) $(COMMAND_O) \
+			subdir=$(if $(subdir),$(subdir)/$(1),$(1)) \
+			$(PRINT_DIR) -C $(1) $(2)
 
 	QUIET_CLEAN    = @printf '  CLEAN    %s\n' $1;
 	QUIET_INSTALL  = @printf '  INSTALL  %s\n' $1;
-- 
2.14.2.920.gcf0c67979c-goog

  parent reply	other threads:[~2017-10-03 20:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03 20:48 [RFC PATCH 0/2] build: Pass CC, CFLAGS, ... to tools build from main Makefile Douglas Anderson
2017-10-03 20:48 ` [RFC PATCH 1/2] kbuild: Pass HOSTCC and similar to tools Makefiles Douglas Anderson
2017-10-04  3:05   ` Guenter Roeck
2017-10-04  3:20   ` Masahiro Yamada
2017-10-04  4:07     ` Guenter Roeck
2017-10-04 16:09       ` Doug Anderson
2017-10-04 16:22         ` Josh Poimboeuf
2017-10-03 20:48 ` Douglas Anderson [this message]
2017-10-04  3:06   ` [RFC PATCH 2/2] tools build: Take CC, AS, and LD from the command line Guenter Roeck
2017-10-04 15:54     ` Doug Anderson

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=20171003204839.27551-3-dianders@chromium.org \
    --to=dianders@chromium.org \
    --cc=acme@redhat.com \
    --cc=davidcc@google.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=groeck@chromium.org \
    --cc=jolsa@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=mmarek@suse.com \
    --cc=yamada.masahiro@socionext.com \
    /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

all inboxes | Powered by JetHome®