]> xenbits.xensource.com Git - people/aperard/xtf.git/commitdiff
build: Support LLVM=y for full LLVM toolchain
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 19 Apr 2021 15:30:22 +0000 (16:30 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 19 Apr 2021 20:39:05 +0000 (21:39 +0100)
Also allow e.g. LLVM=-9 for the explicitly suffixed binaries.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Makefile

index ae6124e6b91c11991c7fc6ce38cecdc8cdc13154..0b3dc3dee0c001bb5280399a7f1844be14ff8fb1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,10 +21,22 @@ xtftestdir := $(xtfdir)/tests
 
 export DESTDIR xtfdir xtftestdir
 
-# Programs used
+ifeq ($(LLVM),) # GCC toolchain
 CC              := $(CROSS_COMPILE)gcc
 LD              := $(CROSS_COMPILE)ld
 OBJCOPY         := $(CROSS_COMPILE)objcopy
+
+else # LLVM toolchain
+
+# Optional -$NUM version when multiple toolchains are installed
+ver := $(filter -%,$(LLVM))
+CC              := clang$(ver) $(if $(CROSS_COMPILE),--target=$(CROSS_COMPILE:%-=%))
+LD              := ld.lld$(ver)
+OBJCOPY         := llvm-objcopy$(ver)
+undefine ver
+
+endif
+
 CPP             := $(CC) -E
 INSTALL         := install
 INSTALL_DATA    := $(INSTALL) -m 644 -p