From: Andrew Cooper Date: Mon, 19 Apr 2021 15:30:22 +0000 (+0100) Subject: build: Support LLVM=y for full LLVM toolchain X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0395a690c921cb195619b689ba0c0b687531c64c;p=xtf.git build: Support LLVM=y for full LLVM toolchain Also allow e.g. LLVM=-9 for the explicitly suffixed binaries. Signed-off-by: Andrew Cooper --- diff --git a/Makefile b/Makefile index ae6124e..0b3dc3d 100644 --- 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