From d8fd1be4f13f8f744b3a6eae1e4e633b405a8419 Mon Sep 17 00:00:00 2001 From: Quinn Stephens Date: Fri, 14 Feb 2025 16:55:45 -0500 Subject: build: Add Clang/LLVM toolchain support Added support for building with Clang/LLVM and made it the default since building a cross-compiling toolchain with GCC is generally less efficient. In `configure.ac`, `TOOLCHAIN` must be set to `clang` or `gcc`. Signed-off-by: Quinn Stephens Signed-off-by: Ian Moffett --- Makefile.in | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'Makefile.in') diff --git a/Makefile.in b/Makefile.in index 01fe328..7783676 100644 --- a/Makefile.in +++ b/Makefile.in @@ -15,14 +15,25 @@ override KERNEL_DEFINES = $ -DHYRA_VERSION="\"$(HYRA_VERSION)\""\ -DHYRA_ARCH="\"@ARCH@\"" $(shell cat sys/arch/$(ARCH)/conf/GENERIC | tools/kconf/kconf) ###################### -# Binutils stuff +# Toolchain ###################### -ifeq ($(ARCH), amd64) - override CC = $(shell pwd)/cross/bin/x86_64-hyra-gcc - override LD = $(shell pwd)/cross/bin/x86_64-hyra-ld -else - override CC = $(shell pwd)/cross/bin/$(ARCH)-hyra-gcc - override LD = $(shell pwd)/cross/bin/$(ARCH)-hyra-ld +override TOOLCHAIN = @TOOLCHAIN@ +ifeq ($(TOOLCHAIN), clang) + ifeq ($(ARCH), amd64) + override CC = clang -target x86_64-none-elf + override LD = ld.lld + else + override CC = clang -target $(ARCH)-none-elf + override LD = ld.lld + endif +else ifeq ($(TOOLCHAIN), gcc) + ifeq ($(ARCH), amd64) + override CC = $(shell pwd)/cross/bin/x86_64-hyra-gcc + override LD = $(shell pwd)/cross/bin/x86_64-hyra-ld + else + override CC = $(shell pwd)/cross/bin/$(ARCH)-hyra-gcc + override LD = $(shell pwd)/cross/bin/$(ARCH)-hyra-ld + endif endif ########################## -- cgit v1.2.3