[CRIU] [PATCH] build system: make CC/LD derive from HOSTCC/HOSTLD

Kir Kolyshkin kir at openvz.org
Thu Oct 27 14:43:46 PDT 2016


1. Move HOSTCC/HOSTLD to nmk (note there are rules in nmk
   that make use of these variables already)

2. Make CC/LD derive from HOSTCC/HOSTLD

Note that one can still change anything from the command line.

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 Makefile                     | 6 ------
 scripts/nmk/scripts/tools.mk | 8 +++++---
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 7fbb1db..f704601 100644
--- a/Makefile
+++ b/Makefile
@@ -6,12 +6,6 @@ export __nmk_dir
 include $(__nmk_dir)include.mk
 include $(__nmk_dir)macro.mk
 
-#
-# To build host helpers.
-HOSTCC		?= gcc
-HOSTLD		?= ld
-export HOSTCC HOSTLD
-
 CFLAGS		+= $(USERCFLAGS)
 export CFLAGS
 
diff --git a/scripts/nmk/scripts/tools.mk b/scripts/nmk/scripts/tools.mk
index 199a4ba..56dba84 100644
--- a/scripts/nmk/scripts/tools.mk
+++ b/scripts/nmk/scripts/tools.mk
@@ -3,8 +3,10 @@ ifndef ____nmk_defined__tools
 #
 # System tools shorthands
 RM		:= rm -f
-LD		:= $(CROSS_COMPILE)ld
-CC		:= $(CROSS_COMPILE)gcc
+HOSTLD		?= ld
+LD		:= $(CROSS_COMPILE)$(HOSTLD)
+HOSTCC		?= gcc
+CC		:= $(CROSS_COMPILE)$(HOSTCC)
 CPP		:= $(CC) -E
 AS		:= $(CROSS_COMPILE)as
 AR		:= $(CROSS_COMPILE)ar
@@ -25,7 +27,7 @@ CSCOPE		:= cscope
 ETAGS		:= etags
 CTAGS		:= ctags
 
-export RM LD CC CPP AS AR STRIP OBJCOPY OBJDUMP
+export RM HOSTLD LD HOSTCC CC CPP AS AR STRIP OBJCOPY OBJDUMP
 export NM SH MAKE MKDIR AWK PERL PYTHON SH CSCOPE
 
 #
-- 
2.7.4



More information about the CRIU mailing list