Skip to content

Commit 0ae3f0a

Browse files
committed
toolchain: avoid duplicating Clang version number
To make upgrades easier, refactor the get_clang.sh script slightly. Signed-off-by: Jerome Forissier <[email protected]> Reviewed-by: Etienne Carriere <[email protected]> Acked-by: Jens Wiklander <[email protected]>
1 parent 88d93a4 commit 0ae3f0a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

get_clang.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
# architectures by default (see <clang path>/bin/llc --version) which is great,
99
# but compiler-rt is included only for the host architecture. Therefore we need
1010
# to combine several packages into one, which is the purpose of this script.
11-
#
12-
# Usage: get_clang.sh [path]
1311

14-
DEST=${1:-./clang-9.0.1}
12+
[ "$1" ] || { echo "Usage: get_clang.sh version [path]"; exit 1; }
1513

16-
VER=9.0.1
14+
VER=${1}
15+
DEST=${2:-./clang-${VER}}
1716
X86_64=clang+llvm-${VER}-x86_64-linux-gnu-ubuntu-16.04
1817
AARCH64=clang+llvm-${VER}-aarch64-linux-gnu
1918
ARMV7A=clang+llvm-${VER}-armv7a-linux-gnueabihf

toolchain.mk

+6-5
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,18 @@ aarch32:
4040
aarch64:
4141
$(call dltc,$(AARCH64_PATH),$(SRC_AARCH64_GCC),$(AARCH64_GCC_VERSION))
4242

43-
CLANG_PATH ?= $(ROOT)/clang-9.0.1
43+
CLANG_VER ?= 9.0.1
44+
CLANG_PATH ?= $(ROOT)/clang-$(CLANG_VER)
4445

4546
# Download the Clang compiler with LLVM tools and compiler-rt libraries
4647
define dl-clang
47-
@if [ ! -d "$(1)" ]; then \
48-
./get_clang.sh $(1); \
48+
@if [ ! -d "$(2)" ]; then \
49+
./get_clang.sh $(1) $(2); \
4950
else \
50-
echo "$(1) already exists"; \
51+
echo "$(2) already exists"; \
5152
fi
5253
endef
5354

5455
.PHONY: clang-toolchains
5556
clang-toolchains:
56-
$(call dl-clang,$(CLANG_PATH))
57+
$(call dl-clang,$(CLANG_VER),$(CLANG_PATH))

0 commit comments

Comments
 (0)