aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2020-03-14 14:24:15 +0100
committerRon Evans <[email protected]>2020-03-17 21:33:39 +0100
commitfbb8efd24cd433478f15af58d41b943af4bcfad9 (patch)
tree5a9421746b3206466fc6968223a0281a01f5aa57 /Makefile
parenta8da6016723ed83f5148bc2908f990de7ef79ed8 (diff)
downloadtinygo-fbb8efd24cd433478f15af58d41b943af4bcfad9.tar.gz
tinygo-fbb8efd24cd433478f15af58d41b943af4bcfad9.zip
Makefile: allow overriding the llvm-project directory
This allows setting a different directory for experimental changes. For example, I also have a llvm-project.master directory that tracks the master branch. It is very useful to be able to temporarily use that directory: make llvm-build.master LLVM_BUILDDIR=llvm-build.master LLVM_PROJECT=llvm-project.master
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 7 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 41f4d8fae..d76558ffd 100644
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,9 @@ all: tinygo
# Default build and source directories, as created by `make llvm-build`.
LLVM_BUILDDIR ?= llvm-build
-CLANG_SRC ?= llvm-project/clang
-LLD_SRC ?= llvm-project/lld
+LLVM_PROJECTDIR ?= llvm-project
+CLANG_SRC ?= $(LLVM_PROJECTDIR)/clang
+LLD_SRC ?= $(LLVM_PROJECTDIR)/lld
# Try to autodetect LLVM build tools.
ifneq (, $(shell command -v llvm-build/bin/clang 2> /dev/null))
@@ -146,14 +147,14 @@ gen-device-stm32: build/gen-device-svd
# Get LLVM sources.
-llvm-project/README.md:
- git clone -b release/9.x https://github.com/llvm/llvm-project
-llvm-source: llvm-project/README.md
+$(LLVM_PROJECTDIR)/README.md:
+ git clone -b release/9.x https://github.com/llvm/llvm-project $(LLVM_PROJECTDIR)
+llvm-source: $(LLVM_PROJECTDIR)/README.md
# Configure LLVM.
TINYGO_SOURCE_DIR=$(shell pwd)
$(LLVM_BUILDDIR)/build.ninja: llvm-source
- mkdir -p $(LLVM_BUILDDIR); cd $(LLVM_BUILDDIR); cmake -G Ninja $(TINYGO_SOURCE_DIR)/llvm-project/llvm "-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64;RISCV;WebAssembly" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR" -DCMAKE_BUILD_TYPE=Release -DLIBCLANG_BUILD_STATIC=ON -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_ZLIB=OFF -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF $(LLVM_OPTION)
+ mkdir -p $(LLVM_BUILDDIR); cd $(LLVM_BUILDDIR); cmake -G Ninja $(TINYGO_SOURCE_DIR)/$(LLVM_PROJECTDIR)/llvm "-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64;RISCV;WebAssembly" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR" -DCMAKE_BUILD_TYPE=Release -DLIBCLANG_BUILD_STATIC=ON -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_ZLIB=OFF -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF $(LLVM_OPTION)
# Build LLVM.
$(LLVM_BUILDDIR): $(LLVM_BUILDDIR)/build.ninja