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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue,  3 Oct 2017 13:48:39 -0700
From:   Douglas Anderson <dianders@...omium.org>
To:     yamada.masahiro@...ionext.com, mmarek@...e.com, acme@...hat.com
Cc:     groeck@...omium.org, Dmitry Torokhov <dmitry.torokhov@...il.com>,
        mka@...omium.org, Douglas Anderson <dianders@...omium.org>,
        David Carrillo-Cisneros <davidcc@...gle.com>,
        linux-kernel@...r.kernel.org, Josh Poimboeuf <jpoimboe@...hat.com>,
        Jiri Olsa <jolsa@...nel.org>
Subject: [RFC PATCH 2/2] tools build: Take CC, AS, and LD from the command line

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@...omium.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 = \
 		+@...o	       '  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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ