Do use the actual ocaml stdlib (not the install dir) to find the
[oota-llvm.git] / bindings / ocaml / Makefile.ocaml
index 1f772a4301bb7dc389e189d4b32e4837dbfceabf..278b31ea3223f7d17eee562b99c15948cc9ad330 100644 (file)
 
 include $(LEVEL)/Makefile.config
 
-# Find the ocaml stdlib root. /usr/local/lib/ocaml is the default when built
-# from source; distros use something like /usr/lib/ocaml/3.10.0.
-ifndef OCAML_LIBDIR
-OCAML_LIBDIR := $(shell $(OCAMLC) -where)
-endif
-
-# CFLAGS needs to be set before Makefile.rules is included. Yes, ocaml puts its
-# includes under its libdir.
-CFLAGS += -I$(OCAML_LIBDIR)
+# CFLAGS needs to be set before Makefile.rules is included.
+CFLAGS += -I$(shell $(OCAMLC) -where)
 
 include $(LEVEL)/Makefile.common
 
 # Intentionally ignore PROJ_prefix here. We want the ocaml stdlib. However, the
-# user can override this with OCAML_LIBDIR.
+# user can override this with OCAML_LIBDIR or configure --with-ocaml-libdir=.
 PROJ_libocamldir := $(DESTDIR)$(OCAML_LIBDIR)
 OcamlDir := $(LibDir)/ocaml
 
@@ -88,9 +81,12 @@ $(ObjDir)/%.mli: $(PROJ_SRC_DIR)/%.mli $(ObjDir)/.dir
 $(ObjDir)/%.ml: $(PROJ_SRC_DIR)/%.ml $(ObjDir)/.dir
        $(Verb) $(CP) -f $< $@
 
-$(ObjDir)/$(LIBRARYNAME).ocamldep: $(OcamlSources) $(OcamlHeaders)
+$(ObjDir)/$(LIBRARYNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) \
+                                   $(OcamlDir)/.dir $(ObjDir)/.dir
        $(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeader) > $@
 
+$(ObjectsCMI): $(UsedOcamlInterfaces:%=$(OcamlDir)/%.cmi)
+
 -include $(ObjDir)/$(LIBRARYNAME).ocamldep