aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/ocaml/Makefile.ocaml
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2015-03-23 12:10:34 -0700
committerStephen Hines <srhines@google.com>2015-03-23 12:10:34 -0700
commitebe69fe11e48d322045d5949c83283927a0d790b (patch)
treec92f1907a6b8006628a4b01615f38264d29834ea /bindings/ocaml/Makefile.ocaml
parentb7d2e72b02a4cb8034f32f8247a2558d2434e121 (diff)
downloadexternal_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.zip
external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.gz
external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.bz2
Update aosp/master LLVM for rebase to r230699.
Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9
Diffstat (limited to 'bindings/ocaml/Makefile.ocaml')
-rw-r--r--bindings/ocaml/Makefile.ocaml29
1 files changed, 21 insertions, 8 deletions
diff --git a/bindings/ocaml/Makefile.ocaml b/bindings/ocaml/Makefile.ocaml
index 5e00cf5..1f65a7b 100644
--- a/bindings/ocaml/Makefile.ocaml
+++ b/bindings/ocaml/Makefile.ocaml
@@ -32,6 +32,12 @@ endif
include $(LEVEL)/Makefile.common
+# Used in out-of-tree builds of OCaml bindings only.
+ifdef SYSTEM_LLVM_CONFIG
+LLVM_CONFIG = $(SYSTEM_LLVM_CONFIG)
+LLVMLibsOptions += $(shell $(LLVM_CONFIG) --ldflags)
+endif
+
# Intentionally ignore PROJ_prefix here. We want the ocaml stdlib. However, the
# user can override this with OCAML_LIBDIR or configure --with-ocaml-libdir=.
PROJ_libocamldir := $(DESTDIR)$(OCAML_LIBDIR)
@@ -65,6 +71,10 @@ OCAMLRPATH := $(RPATH) -Wl,'$$ORIGIN/../../lib'
endif
endif
+# See http://caml.inria.fr/mantis/view.php?id=6642
+OCAMLORIGIN := -ccopt -L'$$CAMLORIGIN/..' \
+ -ccopt $(RPATH) -ccopt -Wl,'$$CAMLORIGIN/..'
+
# Tools
OCAMLCFLAGS += -I $(OcamlDir) $(addprefix -package ,$(FindlibPackages))
@@ -92,16 +102,18 @@ Compile.CMX := $(strip $(OCAMLFIND) opt -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
ifdef OCAMLSTUBS
# -dllib is engaged with ocamlc builds, $(OCAMLSTUBFLAGS) in ocamlc -custom builds.
Archive.CMA := $(strip $(OCAMLFIND) c -a -dllib -l$(LIBRARYNAME) $(OCAMLSTUBFLAGS) \
- $(OCAMLDEBUGFLAG) -o)
+ $(OCAMLDEBUGFLAG) $(OCAMLORIGIN) -o)
else
Archive.CMA := $(strip $(OCAMLFIND) c -a -custom $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \
- -o)
+ $(OCAMLORIGIN) -o)
endif
ifdef OCAMLSTUBS
-Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLSTUBFLAGS) $(OCAMLDEBUGFLAG) -o)
+Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLSTUBFLAGS) $(OCAMLDEBUGFLAG) \
+ $(OCAMLORIGIN) -o)
else
-Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o)
+Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \
+ $(OCAMLORIGIN) -o)
endif
# Source files
@@ -237,8 +249,8 @@ uninstall-local:: uninstall-shared
$(SharedLib): $(ObjectsO) $(OcamlDir)/.dir
$(Echo) "Building $(BuildMode) $(notdir $@)"
- $(Verb) $(Link) $(SharedLinkOptions) $(OCAMLRPATH) $(LLVMLibsOptions) \
- -o $@ $(ObjectsO)
+ $(Verb) $(Link) $(SharedLinkOptions) $(OCAMLRPATH) -o $@ $(ObjectsO) \
+ $(LLVMLibsOptions)
clean-shared::
-$(Verb) $(RM) -f $(SharedLib)
@@ -255,8 +267,9 @@ uninstall-shared::
endif
-##===- Deposit dependent libraries adjacent to Ocaml libs -----------------===##
+##===- Deposit dependent libraries adjacent to OCaml libs -----------------===##
+ifndef SYSTEM_LLVM_CONFIG
all-local:: build-deplibs
clean-local:: clean-deplibs
install-local:: install-deplibs
@@ -281,7 +294,7 @@ install-deplibs:
uninstall-deplibs:
$(Verb) $(RM) -f $(DestLibs)
-
+endif
##===- Build ocaml interfaces (.mli's -> .cmi's) --------------------------===##