Adding ocamldoc generation.
[oota-llvm.git] / bindings / ocaml / Makefile.ocaml
index 15edb01ff322744f3b348e7f9318331cbf8b7d0b..55a052af7e0123313b647646e8b3843abdd7d863 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
 
@@ -97,7 +98,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)
 
@@ -259,7 +260,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 +285,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