automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

first attempt at ocaml support


From: Guillaume Rousse
Subject: first attempt at ocaml support
Date: Fri, 15 Dec 2006 18:23:36 +0100
User-agent: Thunderbird 1.5.0.8 (X11/20061109)

Here is my first attempt at providing ocaml support in automake.

My current point is just to allow automatic dependencies computation at
configure stage, but it seems to be quite linked with
compilation-related values in language registration template.

Here are the current issues:
Ocaml actually support two different compilation modes,  native and
bytecode. The current compilation command in the registration template
is for bytecode only, and I don't know if automake architecture allow to
define two compilation rules for each source file.

AM_DEPENDENCIES(OCAML) actually try to find which type of computation is
suitable, using a C compiler-targeted test... and fails. Obvisouly, I
need to force it there.

Last, once the patch applied, I can't build and install automake anymore:
address@hidden automake-1.10.ocaml]$ LC_ALL=C make
 cd . &&
perllibdir=/home/alceste/rousse/work/automake-1.10.ocaml"/lib:./lib"
/home/alceste/rousse/work/automake-1.10.ocaml/automake --libdir=lib --gnu
/bin/sh: line 4: /home/alceste/rousse/work/automake-1.10.ocaml/automake:
No such file or directory
make: *** [Makefile.in] Error 1

I guess this is caused by the modification on m4/init.m4 file.
diff -Naur automake-1.10/automake.in automake-1.10.ocaml/automake.in
--- automake-1.10/automake.in   2006-10-15 18:19:37.000000000 +0200
+++ automake-1.10.ocaml/automake.in     2006-12-15 17:24:14.000000000 +0100
@@ -763,6 +763,24 @@
                   'pure' => 1,
                   'extensions' => ['.upc']);
 
+# Objective Caml
+register_language ('name' => 'ocaml',
+                  'Name' => 'Objective Caml',
+                  'config_vars' => ['OCAMLDEP', 'OCAMLC'],
+                 'flags' => ['OCAML_INCLUDES', 'OCAMLFLAGS'],
+                 'compiler' => 'COMPILE',
+                 'compile' => '$(OCAMLC) $(OCAML_INCLUDES) $(AM_OCAMLFLAGS) 
$(OCAMLFLAGS)',
+                 'compile_flag' => '-c',
+                 'output_flag' => '-o',
+                  'autodep' => 'OCAML',
+                  'output_extensions' => sub {
+                      (my $byt = $_[0]) =~ s/\.ml$/.cmo/;
+                      (my $opt = $_[0]) =~ s/\.ml$/.cmx/;
+                      return ($byt, $opt)
+                  },
+                 'pure' => 1, 
+                  'extensions' => ['.ml']);
+
 # Headers.
 register_language ('name' => 'header',
                   'Name' => 'Header',
@@ -5278,6 +5296,13 @@
     return &lang_sub_obj;
 }
 
+# Rewrite a single ocaml file.
+sub lang_ocaml_rewrite
+{
+    return &lang_sub_obj;
+}
+
+
 # Rewrite a single header file.
 sub lang_header_rewrite
 {
diff -Naur automake-1.10/lib/depcomp automake-1.10.ocaml/lib/depcomp
--- automake-1.10/lib/depcomp   2006-10-15 18:54:11.000000000 +0200
+++ automake-1.10.ocaml/lib/depcomp     2006-12-15 16:41:22.000000000 +0100
@@ -562,6 +562,10 @@
   rm -f "$tmpdepfile"
   ;;
 
+ocamldep)
+  "$@" "$source" > "$depfile"
+  ;;
+
 none)
   exec "$@"
   ;;
diff -Naur automake-1.10/m4/depend.m4 automake-1.10.ocaml/m4/depend.m4
--- automake-1.10/m4/depend.m4  2006-08-14 20:48:23.000000000 +0200
+++ automake-1.10.ocaml/m4/depend.m4    2006-12-15 16:40:50.000000000 +0100
@@ -35,6 +35,7 @@
        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
        [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
+       [$1], OCAML,[depcc="$OCAMLDEP"  am_compiler_list='ocamldep'],
        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
                    [depcc="$$1"   am_compiler_list=])
 
diff -Naur automake-1.10/m4/init.m4 automake-1.10.ocaml/m4/init.m4
--- automake-1.10/m4/init.m4    2006-08-30 08:22:49.000000000 +0200
+++ automake-1.10.ocaml/m4/init.m4      2006-12-15 17:24:25.000000000 +0100
@@ -99,6 +99,10 @@
                   [_AM_DEPENDENCIES(OBJC)],
                   [define([AC_PROG_OBJC],
                           defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OCAML],
+                  [_AM_DEPENDENCIES(OCAML)],
+                  [define([AC_PROG_OCAML],
+                          defn([AC_PROG_OCAML])[_AM_DEPENDENCIES(OCAML)])])dnl
 ])
 ])
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]