[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v2 1/3] build: Configure the compiler from command line



From: alicesuiu <alicesuiu17@xxxxxxxxx>

By default, the compiler is GCC. Use COMPILER=clang with make to configure the 
compiler as CLANG.

Signed-off-by: Alice Suiu <alicesuiu17@xxxxxxxxx>
---
 Makefile    | 12 ++++++++++--
 Makefile.uk |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index b1e8030..d70b3fc 100644
--- a/Makefile
+++ b/Makefile
@@ -501,11 +501,19 @@ ifneq ("$(origin CROSS_COMPILE)","undefined")
 CONFIG_CROSS_COMPILE := $(CROSS_COMPILE:"%"=%)
 endif
 
+# Use 'make COMPILER=clang' to compile with clang
+ifeq ("$(origin COMPILER)", "command line")
+  CONFIG_COMPILER := $(COMPILER)
+endif
+ifndef CONFIG_COMPILER
+  CONFIG_COMPILER = gcc
+endif
+
 $(eval $(call verbose_include,$(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/Compiler.uk))
 
 # Make variables (CC, etc...)
-LD             := $(CONFIG_CROSS_COMPILE)gcc
-CC             := $(CONFIG_CROSS_COMPILE)gcc
+LD             := $(CONFIG_CROSS_COMPILE)$(CONFIG_COMPILER)
+CC             := $(CONFIG_CROSS_COMPILE)$(CONFIG_COMPILER)
 CPP            := $(CC)
 CXX            := $(CPP)
 GOC            := $(CONFIG_CROSS_COMPILE)gccgo-7
diff --git a/Makefile.uk b/Makefile.uk
index a78afc0..b519a43 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -6,7 +6,7 @@
 
 COMPFLAGS    += -nostdinc -nostdlib
 COMPFLAGS    += -U __linux__ -U __FreeBSD__ -U __sun__
-COMPFLAGS    += -fno-stack-protector -fno-omit-frame-pointer -fno-tree-sra
+COMPFLAGS    += -fno-stack-protector -fno-omit-frame-pointer
 COMPFLAGS    += -Wall -Wextra
 
 # TODO: Remove -fms-extensions if not needed for our code (it was moved from 
Arm64 arch)
-- 
2.17.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.