]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/Makefile.common.in
ocaml 3.09 transition
[helm.git] / helm / ocaml / Makefile.common.in
index 8079765c4a46a631f7e4ccbdce765c91d7f64017..501a411dae2d96e30fb21ebd78c0fad67b70f763 100644 (file)
@@ -9,21 +9,26 @@
 # and put in a directory where there is a .depend file.
 
 OCAMLFIND_DEST_DIR = @OCAMLFIND_DEST_DIR@
+OCAMLPATH = @OCAMLFIND_META_DIR@
 
 PREPROCOPTIONS = -pp camlp4o
+SYNTAXOPTIONS = -syntax camlp4o
 PREREQ =
 OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -thread
 OCAMLDEBUGOPTIONS = -g
 OCAMLARCHIVEOPTIONS =
-OCAMLFIND = @OCAMLFIND@
+OCAMLFIND = OCAMLPATH=$(OCAMLPATH):$$OCAMLPATH @OCAMLFIND@
 OCAMLC = $(OCAMLFIND) ocamlc $(OCAMLDEBUGOPTIONS) $(OCAMLOPTIONS) $(PREPROCOPTIONS)
 OCAMLOPT = $(OCAMLFIND) opt $(OCAMLOPTIONS) $(PREPROCOPTIONS)
-OCAMLDEP = $(OCAMLFIND) ocamldep $(PREPROCOPTIONS)
+OCAMLDEP = $(OCAMLFIND) ocamldep -package "camlp4,$(REQUIRES)" $(SYNTAXOPTIONS)
 OCAMLLEX = ocamllex
 OCAMLYACC = ocamlyacc
 
-LIBRARIES = $(shell ocamlfind query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES))
-LIBRARIES_OPT = $(shell ocamlfind query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES))
+OCAMLC_P4 = $(OCAMLFIND) ocamlc $(OCAMLDEBUGOPTIONS) $(OCAMLOPTIONS) $(SYNTAXOPTIONS)
+OCAMLOPT_P4 = $(OCAMLFIND) opt $(OCAMLOPTIONS) $(SYNTAXOPTIONS)
+
+LIBRARIES = $(shell $(OCAMLFIND) query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES))
+LIBRARIES_OPT = $(shell $(OCAMLFIND) query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES))
 
 
 ARCHIVE = $(PACKAGE).cma
@@ -45,6 +50,10 @@ prereq: $(PREREQ)
 all: prereq $(IMPLEMENTATION_FILES:%.ml=%.cmo) $(ARCHIVE)
 opt: prereq $(IMPLEMENTATION_FILES:%.ml=%.cmx) $(ARCHIVE_OPT)
 world: all opt
+test: test.ml $(ARCHIVE)
+       $(OCAMLC) $(ARCHIVE) -linkpkg -o $@ $<
+test.opt: test.ml $(ARCHIVE_OPT)
+       $(OCAMLOPT) $(ARCHIVE_OPT) -linkpkg -o $@ $<
 
 depend: $(DEPEND_FILES)
        $(OCAMLDEP) $(INTERFACE_FILES) $(IMPLEMENTATION_FILES) > .depend
@@ -61,6 +70,8 @@ $(PACKAGE).ps: .dep.dot
        $(OCAMLC) -c $<
 %.cmx: %.ml
        $(OCAMLOPT) -c $<
+%.annot: %.ml
+       $(OCAMLC) -dtypes $(PKGS) -c $<
 %.ml %.mli: %.mly
        $(OCAMLYACC) $<
 %.ml: %.mll
@@ -70,7 +81,9 @@ $(IMPLEMENTATION_FILES:%.ml=%.cmo): $(LIBRARIES)
 $(IMPLEMENTATION_FILES:%.ml=%.cmx): $(LIBRARIES_OPT)
 
 clean:
-       rm -f *.cm[ioax] *.cmxa *.o *.a $(EXTRA_OBJECTS_TO_CLEAN)
+       rm -f *.cm[ioax] *.cmxa *.o *.a *.annot $(EXTRA_OBJECTS_TO_CLEAN)
+       if [ -f test ]; then rm -f test; else true; fi
+       if [ -f test.opt ]; then rm -f test.opt; else true; fi
 
 install:
        mkdir $(OCAMLFIND_DEST_DIR)/$(PACKAGE)
@@ -106,3 +119,6 @@ endif
 ifeq ($(MAKECMDGOALS),)
    $(IMPLEMENTATION_FILES:%.ml=%.cmi): $(LIBRARIES)
 endif
+
+NULL =
+