Skip to content

Commit cae1681

Browse files
committed
Download newer Clang toolchain and add it to PATH
1 parent 3745bd8 commit cae1681

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ ROOT_DIR := $(CURDIR)
22
OUT_DIR := $(ROOT_DIR)/out
33
SCRIPT_DIR := $(ROOT_DIR)/scripts
44
CONFIG_DIR := $(ROOT_DIR)/config
5+
CLANG_DIR ?= $(ROOT_DIR)/toolchain/clang
6+
7+
CLANG_URL := https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
58

69
SHARED_DIR := $(ROOT_DIR)/shared
710

@@ -138,6 +141,7 @@ else ifeq ($(ARCH),arm64)
138141
endif
139142

140143
LINUX_MAKE := \
144+
PATH=$(CLANG_DIR)/bin:$(PATH) \
141145
$(MAKE) \
142146
-C $(LINUX_SRC) \
143147
ARCH=$(ARCH) \
@@ -146,6 +150,12 @@ LINUX_MAKE := \
146150
V=$(VERBOSE) \
147151
O=$(LINUX_OUT)
148152

153+
$(CLANG_DIR):
154+
$(warning $(YELLOW)Clang directory $(CLANG_DIR) does not exist, downloading prebuilt binaries $(NC))
155+
wget --no-verbose --show-progress $(CLANG_URL) -O clang.tar.xz
156+
mkdir -p $(CLANG_DIR)
157+
tar -xf clang.tar.xz -C $(CLANG_DIR) --strip-components=1
158+
149159
.PHONY: linux_defconfig
150160
linux_defconfig $(LINUX_CONFIG): $(LINUX_CONFIG_FRAGMENT)
151161
+ $(LINUX_MAKE) $(LINUX_DEFCONFIG)
@@ -158,7 +168,7 @@ linux_defconfig $(LINUX_CONFIG): $(LINUX_CONFIG_FRAGMENT)
158168
$(SCRIPT_DIR)/check_merged_config.sh $(LINUX_CONFIG) $(LINUX_CONFIG_FRAGMENT)
159169

160170
.PHONY: linux
161-
linux $(KERNEL_IMAGE): $(LINUX_CONFIG)
171+
linux $(KERNEL_IMAGE): $(LINUX_CONFIG) | $(CLANG_DIR)
162172
+ $(LINUX_MAKE)
163173
$(LINUX_SRC)/scripts/clang-tools/gen_compile_commands.py -d $(LINUX_OUT)
164174

scripts/download_linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if [ $ACK -eq 0 ]; then
3939
echo "Downloading kernel version $VERSION"
4040

4141
if [ $first_char -ge $MIN_VERSION ] && [ $first_char -le $MAX_VERSION ]; then
42-
wget $LINUX_URL/v${first_char}.x/linux-$VERSION.tar.xz
42+
wget --no-verbose --show-progress $LINUX_URL/v${first_char}.x/linux-$VERSION.tar.xz
4343
tar -xf linux-$VERSION.tar.xz
4444
else
4545
echo "$first_char is not a valid kernel major version number"

0 commit comments

Comments
 (0)