aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Yasskin <[email protected]>2010-07-18 04:26:23 +0800
committerGraydon Hoare <[email protected]>2010-07-20 01:23:45 +0800
commitd974aade934d7bca50fe66eb1de849d4b666828b (patch)
tree77c1faec18f4ce3e6df766030143f92c6dae9067
parentFix syntax of tag variants in the list example (diff)
downloadrust-d974aade934d7bca50fe66eb1de849d4b666828b.tar.xz
rust-d974aade934d7bca50fe66eb1de849d4b666828b.zip
Improve the LLVM-using experience.
llvm-config may be installed somewhere that's not on the path or in ocaml's default lib directory, so allow users to override $CFG_LLVM_CONFIG with an environment variable and look up lib and binary paths through calls to llvm-config.
-rw-r--r--src/Makefile7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Makefile b/src/Makefile
index 7b2f9f01..3c4db924 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -23,7 +23,7 @@ CFG_GCC_CFLAGS :=
CFG_GCC_LINK_FLAGS :=
CFG_VALGRIND :=
-CFG_LLVM_CONFIG := llvm-config
+CFG_LLVM_CONFIG ?= llvm-config
CFG_BOOT_FLAGS := $(FLAGS)
ifeq ($(CFG_OSTYPE), Linux)
@@ -162,7 +162,7 @@ ifneq ($(CFG_LLVM_CONFIG),)
CFG_LLVM_VERSION := $(shell $(CFG_LLVM_CONFIG) --version)
ifeq ($(CFG_LLVM_VERSION),2.8svn)
$(info cfg: using LLVM version 2.8svn)
- WHERE := $(shell ocamlc -where)
+ WHERE := $(shell $(CFG_LLVM_CONFIG) --libdir)/ocaml
ifneq ($(shell test -e $(WHERE)/llvm.cma && echo ok),ok)
CFG_LLVM_CONFIG := $(info cfg: LLVM ocaml bindings not found)
endif
@@ -181,6 +181,7 @@ ifdef CFG_LLVM_CONFIG
LLVM_INCS := -I boot/llvm -I $(WHERE)
LLVM_MLS := $(addprefix boot/llvm/, llabi.ml llasm.ml llfinal.ml \
lltrans.ml llemit.ml)
+ LLC := "$(shell $(CFG_LLVM_CONFIG) --bindir)/llc"
CFG_LLC_CFLAGS := -march=x86
$(info cfg: found llvm-config at $(CFG_LLVM_CONFIG))
else
@@ -648,7 +649,7 @@ test/bench/shootout/%.x86$(CFG_EXE_SUFFIX): test/bench/shootout/%.rs $(REQ)
%.s: %.bc
@$(call CFG_ECHO, compile [llvm]: $<)
- $(CFG_QUIET)llc $(CFG_LLC_CFLAGS) -o $@ $<
+ $(CFG_QUIET)$(LLC) $(CFG_LLC_CFLAGS) -o $@ $<
%.llvm$(CFG_EXE_SUFFIX): %.s $(CFG_RUNTIME)
@$(call CFG_ECHO, compile [llvm]: $<)