From: Michal Orzel Date: Wed, 5 May 2021 06:34:16 +0000 (+0200) Subject: Fix issue with clang --target when cross compiling using LLVM X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=880092854e5473558af77289bb7c01a9fa9dda5a;p=xtf.git Fix issue with clang --target when cross compiling using LLVM When using LLVM and cross compiling, the CC expands to: clang --target= Example of target triple: aarch64-linux-gnu. However the current code assigning --target based on the cross compiler does not work if we pass the full path to CROSS_COMPILE. In this case the build fails. Fix the issue so that when cross compiling using LLVM only the basename of cross compiler path is used. Closes #2 Signed-off-by: Michal Orzel Reviewed-by: Andrew Cooper --- diff --git a/Makefile b/Makefile index 0b3dc3d..a7af201 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ else # LLVM toolchain # Optional -$NUM version when multiple toolchains are installed ver := $(filter -%,$(LLVM)) -CC := clang$(ver) $(if $(CROSS_COMPILE),--target=$(CROSS_COMPILE:%-=%)) +CC := clang$(ver) $(if $(CROSS_COMPILE),--target=$(notdir $(CROSS_COMPILE:%-=%))) LD := ld.lld$(ver) OBJCOPY := llvm-objcopy$(ver) undefine ver