List Info

Thread: "ocaml_beginners"::[] Building Ocaml projects




"ocaml_beginners"::[] Building Ocaml projects
country flaguser name
Norway
2007-06-03 17:34:40

Hello,

I've been hacking a bit in Ocaml lately, but I've had a lot of trouble
writing a good makefile as I have done for my C projects.

Problem 1: ocamlc insists on the source and object files being in the same
directory. I like to keep all the object files in a parallel directory
structure separate from the source files. But I cannot get ocamlc to
compile modules whose cmi files are in another directory even when
specified with -I

Problem 2: Object files must be specified in dependency order to build the
final binary (unlike GCC). This means I have to manually list the files in
proper order instead of simply $(wildcard *.cmo). How can I get the
dependency information automatically?

Problem 3: I want to specify a public algebraic type. If I put the type
declaration in the mli file I can't use the constructors in the ml file...

Any help appreciated!

Luke McCarthy

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] Building Ocaml projects
country flaguser name
United Kingdom
2007-06-04 17:49:25


Le 5 juin 07 à 00:06, Richard Jones a écrit :

>; On Sun, Jun 03, 2007 at 11:34:40PM +0100, Luke McCarthy wrote:
>> Problem 1: ocamlc insists on the source and object files being in
>>; the same
>;> directory. I like to keep all the object files in a parallel
>>; directory
>> structure separate from the source files. But I cannot get ocamlc to
>> compile modules whose cmi files are in another directory even when
>;> specified with -I
>
> As Mathias said, I don't think there's a good solution to this. Is it
> really necessary?
>
>> Problem 2: Object files must be specified in dependency order to
>>; build the
>> final binary (unlike GCC). This means I have to manually list the
>>; files in
>> proper order instead of simply $(wildcard *.cmo). How can I get the
>> dependency information automatically?
>
> For libraries, definitely install findlib (the command is called
> 'ocamlfind') and use something like 'ocamlfind ocamlc -package
> unix,str,netstring ...' when building. For your own files, just list
>; them in the right order, and use ocamldep to make sure that everything
> is built.
>
> You might want to grab one or more of my projects from
>; http://merjis.com/developers/ and take a look at the Makefile. I have
>; a pretty consistent system of standard rules which I found works well.

Something I didn't understood : aren't those 2 points solved by
ocamlbuild ? Or maybe I did not understood the question ?

Vincent

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] Building Ocaml projects
country flaguser name
United Kingdom
2007-06-05 08:54:24

On Tue, Jun 05, 2007 at 12:49:25AM +0200, Vincent Aravantinos wrote:
>
> Le 5 juin 07 à 00:06, Richard Jones a écrit :
>
> > On Sun, Jun 03, 2007 at 11:34:40PM +0100, Luke McCarthy wrote:
> >> Problem 1: ocamlc insists on the source and object files being in
> >> the same
>; >> directory. I like to keep all the object files in a parallel
> >> directory
> >> structure separate from the source files. But I cannot get ocamlc to
> >> compile modules whose cmi files are in another directory even when
>; >> specified with -I
> >
>; > As Mathias said, I don't think there's a good solution to this. Is it
> > really necessary?
> >
>; >> Problem 2: Object files must be specified in dependency order to
> >> build the
> >> final binary (unlike GCC). This means I have to manually list the
> >> files in
> >> proper order instead of simply $(wildcard *.cmo). How can I get the
> >> dependency information automatically?
> >
>; > For libraries, definitely install findlib (the command is called
> > 'ocamlfind') and use something like 'ocamlfind ocamlc -package
> > unix,str,netstring ...' when building. For your own files, just list
>; > them in the right order, and use ocamldep to make sure that everything
> > is built.
> >
>; > You might want to grab one or more of my projects from
>; > http://merjis.com/developers/ and take a look at the Makefile. I have
>; > a pretty consistent system of standard rules which I found works well.
>
> Something I didn't understood : aren't those 2 points solved by
> ocamlbuild ? Or maybe I did not understood the question ?

I haven't really looked at ocamlbuild, but possibly it is.

Rich.

--
Richard Jones
Red Hat

__._,_.___
.

__,_._,___
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )