blob: 9a835e313b7bdece6044eda38cb7a2622e7feec2 [file] [log] [blame]
Joakim Bech427dd632015-05-04 15:52:33 +02001################################################################################
2# Toolchains
3################################################################################
Joakim Bechc9606632017-01-27 11:50:49 +01004ROOT ?= $(CURDIR)/..
Joakim Bech427dd632015-05-04 15:52:33 +02005TOOLCHAIN_ROOT ?= $(ROOT)/toolchains
6
7AARCH32_PATH ?= $(TOOLCHAIN_ROOT)/aarch32
8AARCH32_CROSS_COMPILE ?= $(AARCH32_PATH)/bin/arm-linux-gnueabihf-
Joakim Beche0298162019-05-16 11:43:08 +02009AARCH32_GCC_VERSION ?= gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf
10SRC_AARCH32_GCC ?= https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/${AARCH32_GCC_VERSION}.tar.xz
Joakim Bech427dd632015-05-04 15:52:33 +020011
12AARCH64_PATH ?= $(TOOLCHAIN_ROOT)/aarch64
13AARCH64_CROSS_COMPILE ?= $(AARCH64_PATH)/bin/aarch64-linux-gnu-
Joakim Beche0298162019-05-16 11:43:08 +020014AARCH64_GCC_VERSION ?= gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu
15SRC_AARCH64_GCC ?= https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/${AARCH64_GCC_VERSION}.tar.xz
Joakim Bech427dd632015-05-04 15:52:33 +020016
Joakim Bechc9606632017-01-27 11:50:49 +010017# Download toolchain macro for saving some repetition
18# $(1) is $AARCH.._PATH : i.e., path to the destination
19# $(2) is $SRC_AARCH.._GCC : is the downloaded tar.gz file
20# $(3) is $.._GCC_VERSION : the name of the file to download
21define dltc
22 @if [ ! -d "$(1)" ]; then \
23 mkdir -p $(1); \
24 echo "Downloading $(3) ..."; \
25 curl -s -L $(2) -o $(TOOLCHAIN_ROOT)/$(3).tar.xz; \
26 tar xf $(TOOLCHAIN_ROOT)/$(3).tar.xz -C $(1) --strip-components=1; \
27 fi
28endef
29
30.PHONY: toolchains
Joakim Bech6a0fc2b2018-05-23 08:38:47 +020031toolchains: aarch32 aarch64
Joakim Bech427dd632015-05-04 15:52:33 +020032
Joakim Bechc9606632017-01-27 11:50:49 +010033.PHONY: aarch32
Joakim Bech42807a72017-01-27 10:43:28 +010034aarch32:
Joakim Bechc9606632017-01-27 11:50:49 +010035 $(call dltc,$(AARCH32_PATH),$(SRC_AARCH32_GCC),$(AARCH32_GCC_VERSION))
Joakim Bech427dd632015-05-04 15:52:33 +020036
Joakim Bechc9606632017-01-27 11:50:49 +010037.PHONY: aarch64
Joakim Bech42807a72017-01-27 10:43:28 +010038aarch64:
Joakim Bechc9606632017-01-27 11:50:49 +010039 $(call dltc,$(AARCH64_PATH),$(SRC_AARCH64_GCC),$(AARCH64_GCC_VERSION))
Jerome Forissierc3cd9f52020-05-25 18:47:00 +020040
41CLANG_PATH ?= $(ROOT)/clang-9.0.1
42
43# Download the Clang compiler with LLVM tools and compiler-rt libraries
44define dl-clang
45 @if [ ! -d "$(1)" ]; then \
46 ./get_clang.sh $(1); \
47 else \
48 echo "$(1) already exists"; \
49 fi
50endef
51
52.PHONY: clang-toolchains
53clang-toolchains:
54 $(call dl-clang,$(CLANG_PATH))