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