[v2,1/4] build: set HOST{CC/CXX}, clang and gcc in StdGNU.mk
diff mbox series

Message ID 20190905144835.6035-2-roger.pau@citrix.com
State New, archived
Headers show
Series
  • build: honor toolchain related environment vars
Related show

Commit Message

Roger Pau Monné Sept. 5, 2019, 2:48 p.m. UTC
This is a preparatory change for simplifying the setting of
HOST{CC/CXX} and allowing the Xen build system to pick the toolchain
variables from the environment.

No functional change intended.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wl@xen.org>
---
 Config.mk        | 18 ------------------
 config/StdGNU.mk | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 18 deletions(-)

Patch
diff mbox series

diff --git a/Config.mk b/Config.mk
index 0fa4591379..57a6c934b3 100644
--- a/Config.mk
+++ b/Config.mk
@@ -39,24 +39,6 @@  DESTDIR     ?= /
 # Allow phony attribute to be listed as dependency rather than fake target
 .PHONY: .phony
 
-# If we are not cross-compiling, default HOSTC{C/XX} to C{C/XX}
-ifeq ($(XEN_TARGET_ARCH), $(XEN_COMPILE_ARCH))
-HOSTCC ?= $(CC)
-HOSTCXX ?= $(CXX)
-endif
-
-# Use Clang/LLVM instead of GCC?
-clang ?= n
-ifeq ($(clang),n)
-gcc := y
-HOSTCC ?= gcc
-HOSTCXX ?= g++
-else
-gcc := n
-HOSTCC ?= clang
-HOSTCXX ?= clang++
-endif
-
 DEPS_INCLUDE = $(addsuffix .d2, $(basename $(wildcard $(DEPS))))
 DEPS_RM = $(DEPS) $(DEPS_INCLUDE)
 
diff --git a/config/StdGNU.mk b/config/StdGNU.mk
index 039274ea61..7a6159021b 100644
--- a/config/StdGNU.mk
+++ b/config/StdGNU.mk
@@ -1,14 +1,30 @@ 
+# Use Clang/LLVM instead of GCC?
+clang     ?= n
+
+# If we are not cross-compiling, default HOSTC{C/XX} to C{C/XX}
+ifeq ($(XEN_TARGET_ARCH), $(XEN_COMPILE_ARCH))
+HOSTCC    ?= $(CC)
+HOSTCXX   ?= $(CXX)
+endif
+
 AS         = $(CROSS_COMPILE)as
 LD         = $(CROSS_COMPILE)ld
 ifeq ($(clang),y)
+gcc       := n
 CC         = $(CROSS_COMPILE)clang
 CXX        = $(CROSS_COMPILE)clang++
 LD_LTO     = $(CROSS_COMPILE)llvm-ld
+HOSTCC    ?= clang
+HOSTCXX   ?= clang++
 else
+gcc       := y
 CC         = $(CROSS_COMPILE)gcc
 CXX        = $(CROSS_COMPILE)g++
 LD_LTO     = $(CROSS_COMPILE)ld
+HOSTCC    ?= gcc
+HOSTCXX   ?= g++
 endif
+
 CPP        = $(CC) -E
 AR         = $(CROSS_COMPILE)ar
 RANLIB     = $(CROSS_COMPILE)ranlib