Commits

camlspotter committed d9b37ab

OMyMakefile missing VeryClean rule

Comments (0)

Files changed (1)

 #   Subdirs()
 #
 # It includes "findlib" by default. If you want to build findlib in OMy framework, you have to remove it from the list.
-OCAML_PREINSTALLED_PACKS[]= bigarray camlp4 dbm dynlink graphics num num-top stdlib str threads unix findlib compiler-libs compiler-libs.common
+OCAML_PREINSTALLED_PACKS[]= bigarray camlp4 dbm dynlink graphics num num-top stdlib str threads unix findlib compiler-libs compiler-libs.common compiler-libs.bytecomp compiler-libs.optcomp compiler-libs.toplevel
 
 #|Redefinition of compiler commands
 public.OCamlC() =
 
 # Common phonies
 # ==================================================================
-.PHONY: all install uninstall clean
+.PHONY: all install uninstall clean veryclean
 
 # Directories
 # =====================================================================
 
 #|Returns packages managed by OMy framework
 OMyManagedPackages(packages) =
-   return $(set-diff $(packages), $(OCAML_PREINSTALLED_PACKS))
+   # need to rename camlimages.jpeg => camlimages
+   packages_prefix=
+   foreach(x, $(packages))
+       match $(x)
+       case $"^\([^.]+\).*"
+          packages_prefix += $1
+          export
+       default
+          packages_prefix += $(x)
+          export
+       export
+   return $(set-diff $(packages_prefix), $(OCAML_PREINSTALLED_PACKS))
 
 #|Add dependencies of OCaml compiled files (cmx, cmo, etc.) over $(files).
 #
                   $(if $(NATIVE_SHARED_ENABLED), $(NATIVESHAREDLIB)), \
                   $(if $(BYTE_ENABLED), $(BYTELIB)))
 
+public.OCAML_BYTE_LINK_FLAGS =
+
 # Extend the bundled OCamlPackage with .spot creation
 public.OCamlPackage(name, files) =
    # XXX: JYH: these variables should be marked private in 0.9.9
 #   .. note :: Probably you should use MyOCamlPackage
 MyOCamlLibrary(library_name, files) =
   AddLocalOCamlPackageDependencies()
-  targets = $(OCamlLibrary $(library_name), $(files))
+  protected.CMIFILES = $(addsuffix .cmi, $(files))
+  targets = $(OCamlLibrary $(library_name), $(files)) $(CMIFILES) $(glob i, *.mli) 
 
   .DEFAULT: $(targets)
 
   if $(not $(test -e $(dir))):
     mkdir $(dir) 
   return
+
+# Very clean
+# ======================================================================
+
+#| OCaml object files which are not real targets of OMake are not be
+# auto-cleaned away by ``omake clean``. This is not good in some situations
+# at linking.
+WithOCamlVeryClean() =
+    veryclean: 
+        rm -f *.cm* *.annot *.o *.a *.sp[io]t *.so *.exe *.byt *.opt *.run
+
+# Pa_ounit test
+# =======================================================================
+
+#| Test with Pa_ounit. Pretty version dependent.
+# Thinking from the implementation Pa_ounit_lib.Runtime, it should be
+# pretty unstable in future releases of Pa_ounit. Sigh.
+
+MyOCamlOUnitTest(LIB) =
+    name=ounittest_$(LIB)
+    $(name).ml:
+        section:
+            chan=$(fopen $@, w)
+            fprintln($(chan), module M = $(capitalize $(LIB)))
+            fprintln($(chan), let \(\) = Pa_ounit_lib.Runtime.summarize \(\))
+            close($(chan))
+
+    section:
+        OCAML_LIBS=$(LIB)
+        MyOCamlTestProgram($(name), $(name))
+
+    inline_tests.log: $(name)
+        println(Check inline_tests.log for test results)
+        ./$(name) inline-test-runner $(capitalize $(LIB)) -display -log -strict
+
+    .PHONY:test
+
+    test: inline_tests.log