1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
abs_top_srcdir ?= $(abspath $(CURDIR)/..)
LLVM_BUILD ?= $(abspath $(abs_top_srcdir)/llvm/build)
LLVM_PREFIX ?= $(abspath $(abs_top_srcdir)/llvm/usr)
# LLVM_BRANCH := $(shell git -C "$(abs_top_srcdir)/external/llvm-project/llvm" rev-parse --abbrev-ref HEAD)
LLVM_VERSION := $(shell git -C "$(abs_top_srcdir)/external/llvm-project/llvm" rev-parse HEAD)
# FIXME: URL should be http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-$(LLVM_BRANCH)/llvm-osx64-$(LLVM_VERSION).tar.gz
LLVM_DOWNLOAD_LOCATION = "http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-release60/llvm-osx64-$(LLVM_VERSION).tar.gz"
CMAKE := $(or $(CMAKE),$(shell which cmake))
NINJA := $(shell which ninja)
EXTRA_LLVM_ARGS = $(if $(filter $(LLVM_TARGET),wasm32), -DLLVM_BUILD_32_BITS=On -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly",) \
$(if $(STATIC_GCC_LIBS),-DCMAKE_EXE_LINKER_FLAGS="-static")
# -DLLVM_ENABLE_LIBXML2=Off is needed because xml2 is not used and it breaks 32-bit builds on 64-bit Linux hosts
$(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile): $(abs_top_srcdir)/external/llvm-project/llvm/CMakeLists.txt
mkdir -p $(LLVM_BUILD) $(LLVM_PREFIX)
cd $(LLVM_BUILD) && $(CMAKE) \
$(if $(NINJA),-G Ninja) \
-DCMAKE_INSTALL_PREFIX="$(LLVM_PREFIX)" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_BUILD_TESTS=Off \
-DLLVM_INCLUDE_TESTS=Off \
-DLLVM_BUILD_EXAMPLES=Off \
-DLLVM_INCLUDE_EXAMPLES=Off \
-DLLVM_TOOLS_TO_BUILD="opt;llc;llvm-config;llvm-dis" \
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \
$(EXTRA_LLVM_ARGS) \
-DLLVM_ENABLE_ASSERTIONS=$(ENABLE_ASSERTS) \
-DLLVM_ENABLE_LIBXML2=Off \
-DHAVE_FUTIMENS=0 \
$(LLVM_CMAKE_ARGS) \
$(dir $<)
.PHONY: configure-llvm
configure-llvm: $(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile)
# The DESTDIR fix is to prevent the build from trying to install this out-of-build-tree
# as the DESTDIR hasn't been created when we're building mono
.PHONY: build-llvm
build-llvm: configure-llvm
DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE) -j) -C $(LLVM_BUILD)
.PHONY: install-llvm
install-llvm: build-llvm
DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE)) -C $(LLVM_BUILD) install
.PHONY: download-llvm
download-llvm:
(wget --no-verbose -O - $(LLVM_DOWNLOAD_LOCATION) || curl -L $(LLVM_DOWNLOAD_LOCATION)) | tar -xzf - -C $(dir $(LLVM_PREFIX))
.PHONY: clean-llvm
clean-llvm:
$(RM) -r $(LLVM_BUILD) $(LLVM_PREFIX)
|