[PATCH] Make sure ocamldep runs on all .mli files.

This is a small bug fix for the ocaml build system that allows
for dependencies to be generated for ocaml interface files.

7c62c2cd93a6402e5f6ebd600e9e3ac7851b4d29.diff (1016 Bytes)

I noticed that the ocaml compilation isn't using the .opt
executables if they're available. We might gain a slight
optimization in ocaml compile time by optionally using them
with this patch.

97c6db7b03016306d34ee2e3ca41d0e423cf2c0c.diff (14.4 KB)

316a84e85ed2363551149e65a227c8e7c8192624.diff (5.07 KB)

Hi Erick,

I noticed that the ocaml compilation isn't using the .opt
executables if they're available. We might gain a slight
optimization in ocaml compile time by optionally using them
with this patch.

This looks like a good improvement.

---
autoconf/configure.ac | 18 +++++
configure | 195 ++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 188 insertions(+), 25 deletions(-)diff --git autoconf/configure.ac autoconf/configure.ac
index 97e0305..56a25ca 100644
--- autoconf/configure.ac
+++ autoconf/configure.ac
@@ -592,6 +592,9 @@ AC_PATH_PROG(ZIP,[zip],[echo "Skipped: zip not found"])
AC_PATH_PROG(OCAMLC,[ocamlc],[echo "Skipped: ocamlc not found"])
AC_PATH_PROG(OCAMLOPT,[ocamlopt],[echo "Skipped: ocamlopt not found"])
AC_PATH_PROG(OCAMLDEP,[ocamldep],[echo "Skipped: ocamldep not found"])
+AC_PATH_PROG(OCAMLC_OPT,[ocamlc.opt],[echo "Skipped: ocamlc.opt not found"])
+AC_PATH_PROG(OCAMLOPT_OPT,[ocamlopt.opt],[echo "Skipped: ocamlopt.opt not found"])
+AC_PATH_PROG(OCAMLDEP_OPT,[ocamldep.opt],[echo "Skipped: ocamldep.opt not found"])

dnl Determine if the linker supports the -R option.
AC_LINK_USE_R
@@ -911,6 +914,21 @@ AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
AC_DEFINE_UNQUOTED(LLVM_HOSTTRIPLE, "$host",
        [Host triple we were built on])

+# prefer ocamlc.opt to ocamlc
+if test "x$OCAMLC" != x -a "x$OCAMLC_OPT" != x ; then
+ OCAMLC=$OCAMLC_OPT
+fi
+
+# prefer ocamlopt.opt to ocamlopt
+if test "x$OCAMLOPT" != x -a "x$OCAMLOPT_OPT" != x ; then
+ OCAMLOPT=$OCAMLOPT_OPT
+fi
+
+# prefer ocamldep.opt to ocamldep
+if test "x$OCAMLDEP" != x -a "x$OCAMLDEP_OPT" != x ; then
+ OCAMLDEP=$OCAMLDEP_OPT
+fi
+
# Determine which bindings to build.
if test "$BINDINGS_TO_BUILD" = auto ; then
  BINDINGS_TO_BUILD=""

I think it would be simpler to use AC_PATH_PROGS instead. See how $GV is set up for instance. Can you please see whether that approach is workable?

— Gordon

Hi Erick,

Thanks, this looks good. Can you please resubmit this patch, and the others, as an attachment?

Actually, I spoke too soon. ocamldoc's [] syntax is not recognized by doxygen, so it will just be noise. Please leave it out in C.

Thanks,
Gordon

Hi Erick,

Thanks for your patches!

This is a small bug fix for the ocaml build system that allows
for dependencies to be generated for ocaml interface files.

I've committed the second half of this.

---
bindings/ocaml/Makefile.ocaml | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)diff --git bindings/ocaml/Makefile.ocaml bindings/ocaml/Makefile.ocaml
index 6fc9a9a..d505ad8 100644
--- bindings/ocaml/Makefile.ocaml
+++ bindings/ocaml/Makefile.ocaml
@@ -58,7 +58,7 @@ Archive.CMXA := $(strip $(OCAMLOPT) -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o)

# Source files
OcamlSources1 := $(sort $(wildcard $(PROJ_SRC_DIR)/*.ml))
-OcamlHeaders1 := $(OcamlSources1:.ml=.mli)
+OcamlHeaders1 := $(sort $(wildcard $(PROJ_SRC_DIR)/*.mli))

Not sure how an .mli without a corresponding .ml would be useful, so I left this bit.

Thanks!
Gordon

Not sure how an .mli without a corresponding .ml would be useful, so I
left this bit.

If you've got a module that only defines a type with no function
definitions, you don't need the .ml file:

foo.ml:
let foo = Bar.A

bar.mli:
type t = A | B

ocamlc bar.mli
ocamlc foo.ml

In my eventual patch to switch over to using packed modules, I was
thinking about making a TypeKind.mli that has just the type interface.
However, I think I'd prefer to actually have this in the Type.ml{,i}
files, but that would break source compatibility.

Thanks Gordon. This patch should make the changes you requested.

2a33a0870af02af3d1b3bd767b36637f434615a2.diff (3.62 KB)

Please submit your patches as attachments; these fail to apply.

— Gordon

How odd. I was able to apply the patch I sent you using just "patch
-p0 < 2a33a0870af02af3d1b3bd767b36637f434615a2.diff" after downloading
the patch I sent from the list. I did attach it using the "inline"
Content-Disposition option though, which lets some browsers display
the patch. I can in the future use "attach" (which I did with this
mail). Or if you'd prefer me to just apply the patch against
subversion and send the subversion patch, I can do that too (which I
also did with this patch).

I'm sorry for causing problems.

-e

2a33a0870af02af3d1b3bd767b36637f434615a2.diff (3.53 KB)

patch-from-svn.diff (3.57 KB)

Applied with a couple of minor edits.

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080303/059292.html

I can in the future use "attach" (which I did with this mail).

Please do.

I'm sorry for causing problems.

Not at all. Thanks Erick!

— Gordon