Skip to content

Llvm config #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,30 @@ ifneq ($(CFG_LLVM_CONFIG),)
endif
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 $(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
$(info cfg: found llvm-config at $(CFG_LLVM_CONFIG))
CFG_LLVM_ALLOWED_VERSIONS := 2.8svn 2.8 2.9svn
ifneq ($(findstring $(CFG_LLVM_VERSION),$(CFG_LLVM_ALLOWED_VERSIONS)),)
$(info cfg: using LLVM version $(CFG_LLVM_VERSION))
else
CFG_LLVM_CONFIG :=
$(info cfg: incompatible LLVM version $(CFG_LLVM_VERSION), \
expected 2.8svn)
expected one of $(CFG_LLVM_ALLOWED_VERSIONS))
endif
endif
ifneq ($(CFG_LLVM_CONFIG),)
CFG_OCAML_LIBPATH := $(lastword \
$(shell ocamlc$(OPT) -config | grep standard_library:))
CFG_OCAML_LLVM := $(shell \
for path in $(shell $(CFG_LLVM_CONFIG) --libdir)/ocaml \
$(CFG_OCAML_LIBPATH) \
$(CFG_OCAML_LIBPATH)/llvm \
$(CFG_OCAML_LIBPATH)/llvm-$(CFG_LLVM_VERSION) ; do \
if test -e $${path}/llvm.cma; then echo $${path}; break; fi \
done)
ifneq ($(CFG_OCAML_LLVM),)
$(info cfg: found LLVM ocaml bindings in $(CFG_OCAML_LLVM))
else
CFG_LLVM_CONFIG := $(info cfg: LLVM ocaml bindings not found)
endif
endif
ifdef CFG_LLVM_CONFIG
Expand All @@ -185,13 +199,12 @@ ifdef CFG_LLVM_CONFIG
LLVM_NATIVE_LIBS := llvm.cmxa llvm_bitwriter.cmxa
LLVM_CLIBS := $(shell for c in `$(CFG_LLVM_CONFIG) --ldflags --libs` \
-lllvm -lllvm_bitwriter; do echo -cclib && echo $$c; done | xargs echo)
LLVM_INCS := -I boot/llvm -I $(WHERE)
LLVM_INCS := -I boot/llvm -I $(CFG_OCAML_LLVM)
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
LLVM-DIS := "$(shell $(CFG_LLVM_CONFIG) --bindir)/llvm-dis"
$(info cfg: found llvm-config at $(CFG_LLVM_CONFIG))
else
VARIANT=x86
LLVM_CLIBS :=
Expand Down