Remove libtool.
[oota-llvm.git] / bindings / ocaml / Makefile.ocaml
index 15edb01ff322744f3b348e7f9318331cbf8b7d0b..9ca9fb742a9dc3ce2e032e7f8ccbd545f70df6b4 100644 (file)
@@ -20,7 +20,8 @@
 include $(LEVEL)/Makefile.config
 
 # CFLAGS needs to be set before Makefile.rules is included.
-CFLAGS += -I"$(shell $(OCAMLC) -where)"
+CXX.Flags += -I"$(shell $(OCAMLC) -where)"
+C.Flags += -I"$(shell $(OCAMLC) -where)"
 
 include $(LEVEL)/Makefile.common
 
@@ -37,10 +38,16 @@ endif
 
 # Tools
 OCAMLCFLAGS += -I $(OcamlDir) -I $(ObjDir)
+ifneq ($(ObjectsO),)
 OCAMLAFLAGS += $(patsubst %,-cclib %, \
                  $(filter-out -L$(LibDir),-l$(LIBRARYNAME) \
                                           $(shell $(LLVM_CONFIG) --ldflags)) \
                                           $(UsedLibs))
+else
+OCAMLAFLAGS += $(patsubst %,-cclib %, \
+                 $(filter-out -L$(LibDir),$(shell $(LLVM_CONFIG) --ldflags)) \
+                                          $(UsedLibs))
+endif
  
 # -g was introduced in 3.10.0.
 #ifneq ($(ENABLE_OPTIMIZED),1)
@@ -97,7 +104,7 @@ $(ObjDir)/%.ml: $(PROJ_SRC_DIR)/%.ml $(ObjDir)/.dir
 
 $(ObjDir)/$(LIBRARYNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) \
                                    $(OcamlDir)/.dir $(ObjDir)/.dir
-       $(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeader) > $@
+       $(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeaders) > $@
 
 $(ObjectsCMI): $(UsedOcamlInterfaces:%=$(OcamlDir)/%.cmi)
 
@@ -106,6 +113,7 @@ $(ObjectsCMI): $(UsedOcamlInterfaces:%=$(OcamlDir)/%.cmi)
 
 ##===- Build static library from C sources --------------------------------===##
 
+ifneq ($(ObjectsO),)
 all-local:: $(LibraryA)
 clean-local:: clean-a
 install-local:: install-a
@@ -123,12 +131,13 @@ clean-a::
 install-a:: $(LibraryA)
        $(Echo) "Installing $(BuildMode) $(DestA)"
        $(Verb) $(MKDIR) $(PROJ_libocamldir)
-       $(Verb) $(LTInstall) $(LibraryA) $(DestA)
+       $(Verb) $(INSTALL) $(LibraryA) $(DestA)
        $(Verb) 
 
 uninstall-a::
        $(Echo) "Uninstalling $(DestA)"
        -$(Verb) $(RM) -f $(DestA)
+endif
 
 
 ##===- Deposit dependent libraries adjacent to Ocaml libs -----------------===##
@@ -259,7 +268,7 @@ $(ObjDir)/%.cmx: $(ObjDir)/%.ml
        $(Verb) $(Compile.CMX) $@ $<
 
 clean-cmxa::
-       $(Verb) $(RM) -f $(OutputCMXA) $(OutputCMXA:.cmxa=.o) $(OutputsCMX)
+       $(Verb) $(RM) -f $(OutputCMXA) $(OutputCMXA:.cmxa=.a) $(OutputsCMX)
 
 install-cmxa:: $(OutputCMXA) $(OutputsCMX)
        $(Verb) $(MKDIR) $(PROJ_libocamldir)
@@ -284,6 +293,13 @@ uninstall-cmxa::
 
 endif
 
+##===- Generate documentation ---------------------------------------------===##
+
+$(ObjDir)/$(LIBRARYNAME).odoc: $(ObjectsCMI)
+       $(Echo) "Documenting $(notdir $@)"
+       $(Verb) $(OCAMLDOC) -I $(OcamlDir) -I $(ObjDir) -dump $@ $(OcamlHeaders)
+
+ocamldoc: $(ObjDir)/$(LIBRARYNAME).odoc
 
 ##===- Debugging gunk -----------------------------------------------------===##
 printvars:: printcamlvars