Commits

Markus Mottl committed 566f72b

Added byte-code packaging patch

  • Participants
  • Parent commits b4e38c9

Comments (0)

Files changed (3)

+2011-03-23: Improved handling of packed byte-code libraries.
+
+            Thanks to Christophe Troestler <Christophe.Troestler@umons.ac.be> for the
+            patch!
+
 2009-05-08: Fixed build and installation problems on Windows.
 
             Thanks to Sylvain Le Gall <gildor@ocamlcore.org> for the

File OCamlMakefile

 endif
 export OCAMLFIND
 
+ifndef OCAML
+  OCAML := ocaml
+endif
+export OCAML
+
 ifndef OCAMLC
   OCAMLC := ocamlc
 endif
 			$(REAL_OCAMLFIND) $(OCAMLOPT) -a $(ALL_LDFLAGS) $(OBJS_LIBS) -o $@ $(REAL_IMPL)
 else
 # Packing a bytecode library
+LIB_PACK_NAME_MLI = $(wildcard $(LIB_PACK_NAME).mli)
+ifeq ($(LIB_PACK_NAME_MLI),)
+LIB_PACK_NAME_CMI = $(LIB_PACK_NAME).cmi
+else
+# $(LIB_PACK_NAME).mli exists, it likely depends on other compiled interfaces
+LIB_PACK_NAME_CMI =
+$(LIB_PACK_NAME).cmi: $(REAL_IMPL_INTF)
+endif
 ifdef BYTE_OCAML
-$(LIB_PACK_NAME).cmi $(LIB_PACK_NAME).cmo: $(REAL_IMPL_INTF)
+$(LIB_PACK_NAME_CMI) $(LIB_PACK_NAME).cmo: $(REAL_IMPL_INTF)
 			$(REAL_OCAMLFIND) $(REAL_OCAMLC) -pack -o $(LIB_PACK_NAME).cmo $(OCAMLLDFLAGS) $(REAL_IMPL)
 # Packing into a unit which can be transformed into a library
 # Remember the .ml's must have been compiled with -for-pack $(LIB_PACK_NAME)
 else
-$(LIB_PACK_NAME).cmi $(LIB_PACK_NAME).cmx: $(REAL_IMPL_INTF)
+$(LIB_PACK_NAME_CMI) $(LIB_PACK_NAME).cmx: $(REAL_IMPL_INTF)
 			$(REAL_OCAMLFIND) $(OCAMLOPT) -pack -o $(LIB_PACK_NAME).cmx  $(OCAMLLDFLAGS) $(REAL_IMPL)
 endif
 
                          this path all the time.
 
   * OCAMLFIND     - ocamlfind from findlib       (default: "ocamlfind")
+  * OCAML         - OCaml interpreter            (default: "ocaml")
   * OCAMLC        - byte-code compiler           (default: "ocamlc")
   * OCAMLOPT      - native-code compiler         (default: "ocamlopt")
   * OCAMLMKTOP    - top-level compiler           (default: "ocamlmktop")
 
 Enjoy!
 
-New York, 2007-04-22
+New York, 2011-03-23
 Markus Mottl
 
 e-mail: markus.mottl@gmail.com