Include build_llvm_config.sh in tarballs (Closes https://github.com/mono/mono/issues...
[mono-project.git] / llvm / build.mk
blob8875ce11b67fb134c377dbfffcae23671536dea1
2 # Conditional submodule for llvm
4 # make reset-llvm will checkout a version of llvm which is suitable for this version of mono
5 # into $top_srcdir/llvm/llvm.
8 top_srcdir ?= $(abspath $(CURDIR)/..)
10 LLVM_PATH ?= $(abspath $(top_srcdir)/external/llvm)
11 LLVM_BUILD ?= $(abspath $(top_srcdir)/llvm/build)
12 LLVM_PREFIX ?= $(abspath $(top_srcdir)/llvm/usr)
14 CMAKE := $(or $(CMAKE),$(shell which cmake))
15 NINJA := $(shell which ninja)
17 SUBMODULES_CONFIG_FILE = $(top_srcdir)/llvm/SUBMODULES.json
18 include $(top_srcdir)/scripts/submodules/versions.mk
20 $(eval $(call ValidateVersionTemplate,llvm,LLVM))
22 # Bump the given submodule to the revision given by the REV make variable
23 # If COMMIT is 1, commit the change
24 bump-llvm: __bump-version-llvm
26 # Bump the given submodule to the branch given by the BRANCH/REMOTE_BRANCH make variables
27 # If COMMIT is 1, commit the change
28 bump-branch-llvm: __bump-branch-llvm
30 # Bump the given submodule to its current GIT version
31 # If COMMIT is 1, commit the change
32 bump-current-llvm: __bump-current-version-llvm
34 $(LLVM_BUILD) $(LLVM_PREFIX):
35 mkdir -p $@
37 $(LLVM_PATH)/CMakeLists.txt: | reset-llvm
39 $(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile): $(LLVM_PATH)/CMakeLists.txt | $(LLVM_BUILD)
40 cd $(LLVM_BUILD) && $(CMAKE) \
41 $(if $(NINJA),-G Ninja) \
42 -DCMAKE_INSTALL_PREFIX="$(LLVM_PREFIX)" \
43 -DCMAKE_BUILD_TYPE=Release \
44 -DLLVM_BUILD_TESTS=Off \
45 -DLLVM_INCLUDE_TESTS=Off \
46 -DLLVM_BUILD_EXAMPLES=Off \
47 -DLLVM_INCLUDE_EXAMPLES=Off \
48 -DLLVM_TOOLS_TO_BUILD="opt;llc;llvm-config;llvm-dis" \
49 -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \
50 -DLLVM_ENABLE_ASSERTIONS=$(if $(INTERNAL_LLVM_ASSERTS),On,Off) \
51 $(LLVM_CMAKE_ARGS) \
52 $(dir $<)
54 .PHONY: configure-llvm
55 configure-llvm: $(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile)
57 # The DESTDIR fix is to prevent the build from trying to install this out-of-build-tree
58 # as the DESTDIR hasn't been created when we're building mono
60 .PHONY: build-llvm
61 build-llvm: configure-llvm
62 DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE)) -C $(LLVM_BUILD)
64 .PHONY: install-llvm
65 install-llvm: build-llvm | $(LLVM_PREFIX)
66 DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE)) -C $(LLVM_BUILD) install
68 # FIXME: URL should be http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-$(NEEDED_LLVM_BRANCH)/llvm-osx64-$(NEEDED_LLVM_VERSION).tar.gz
69 .PHONY: download-llvm
70 download-llvm:
71 wget --no-verbose -O - http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-release60/llvm-osx64-$(NEEDED_LLVM_VERSION).tar.gz | tar xzf -
73 .PHONY: clean-llvm
74 clean-llvm:
75 $(RM) -r $(LLVM_BUILD) $(LLVM_PREFIX)