]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
build: Add LLVM_TARGET_ARCH
authorVlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Wed, 30 Jun 2021 21:09:56 +0000 (00:09 +0300)
committerUnikraft <monkey@unikraft.io>
Wed, 4 Aug 2021 14:06:06 +0000 (14:06 +0000)
Rustc uses the LLVM format for specifying the cross
compiler target: <arch><sub>-<vendor>-<sys>-<abi>.
This is different from GCC, in order to not have
to mantain a translation script, we provide the user
with an option to specify himself the target via
LLVM_TARGET_ARCH which is similar to CROSS_COMPILE.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #241

Config.uk
Makefile

index 1d4143ecbf08da1aff1f4e1ae68e605cec16eeef..7c33d098ff362b072e41c5d1032bd894dbcb5e9d 100644 (file)
--- a/Config.uk
+++ b/Config.uk
@@ -168,6 +168,15 @@ config CROSS_COMPILE
                need to set this unless you want the configured build
                directory to select the cross-compiler automatically.
 
+
+config LLVM_TARGET_ARCH
+       string "Custom cross-compiler LLVM target (optional)"
+       help
+               Same as running 'make LLVM_TARGET_ARCH=target' but stored for
+               default make runs in this build directory.  You don't
+               need to set this unless you want the configured build
+               directory to select the cross-compiler automatically.
+               This is used for LLVM based compilers such as clang or rustc.
 #config PARALLEL_JOBS
 #      int "Number of jobs to run simultaneously (0 for auto)"
 #      default "0"
index 81b02e7aac87469c3f4537d67fab542bbf093941..ce512cd506c99890e1091fcddc7d624a579c1894 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -515,6 +515,7 @@ ifeq ($(sub_make_exec), 1)
 ifeq ($(UK_HAVE_DOT_CONFIG),y)
 # Hide troublesome environment variables from sub processes
 unexport CONFIG_CROSS_COMPILE
+unexport CONFIG_LLVM_TARGET_ARCH
 unexport CONFIG_COMPILER
 #unexport CC
 #unexport LD
@@ -548,6 +549,10 @@ ifneq ("$(origin CROSS_COMPILE)","undefined")
 CONFIG_CROSS_COMPILE := $(CROSS_COMPILE:"%"=%)
 endif
 
+ifneq ("$(origin LLVM_TARGET_ARCH)","undefined")
+CONFIG_LLVM_TARGET_ARCH := $(LLVM_TARGET_ARCH:"%"=%)
+endif
+
 ifneq ("$(origin COMPILER)","undefined")
        CONFIG_COMPILER := $(COMPILER:"%"=%)
 else