caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Building projects written in OCaml
@ 2006-08-23 15:24 Renald Buter
  2006-08-23 19:01 ` [Caml-list] " Martin Jambon
  2006-08-23 20:07 ` Nathaniel Gray
  0 siblings, 2 replies; 3+ messages in thread
From: Renald Buter @ 2006-08-23 15:24 UTC (permalink / raw)
  To: caml-list

Hello list,

Coming from an Ant/Java world, I am usually working in projects that have the
following directory structure:

 project
      |---src  ("plain" source files)
      |---test (unit testing)

What would a Makefile (possibly using OCamlMakefile) or OMakefile look
like that would allow me to:

 1. 'make XXX.ml' to compile XXX.ml into an object file
 2. 'make some-target' to build the executable some-target, depending on
    given object files
 3. 'make test' to build the test suite, depending on object files in
    the 'src' directory.

Any help is much appreciated!

With kind regards,

Renald


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Building projects written in OCaml
  2006-08-23 15:24 Building projects written in OCaml Renald Buter
@ 2006-08-23 19:01 ` Martin Jambon
  2006-08-23 20:07 ` Nathaniel Gray
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Jambon @ 2006-08-23 19:01 UTC (permalink / raw)
  To: Renald Buter; +Cc: caml-list

On Wed, 23 Aug 2006, Renald Buter wrote:

> Hello list,
>
> Coming from an Ant/Java world, I am usually working in projects that have the
> following directory structure:
>
>  project
>       |---src  ("plain" source files)
>       |---test (unit testing)
>
> What would a Makefile (possibly using OCamlMakefile) or OMakefile look
> like that would allow me to:
>
>  1. 'make XXX.ml' to compile XXX.ml into an object file
>  2. 'make some-target' to build the executable some-target, depending on
>     given object files
>  3. 'make test' to build the test suite, depending on object files in
>     the 'src' directory.
>
> Any help is much appreciated!

You can start there:
  http://www.ocaml-tutorial.org/compiling_ocaml_projects


Martin

--
Martin Jambon, PhD
http://martin.jambon.free.fr


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Building projects written in OCaml
  2006-08-23 15:24 Building projects written in OCaml Renald Buter
  2006-08-23 19:01 ` [Caml-list] " Martin Jambon
@ 2006-08-23 20:07 ` Nathaniel Gray
  1 sibling, 0 replies; 3+ messages in thread
From: Nathaniel Gray @ 2006-08-23 20:07 UTC (permalink / raw)
  To: Renald Buter; +Cc: caml-list

On 8/23/06, Renald Buter <buter@cwts.leidenuniv.nl> wrote:
> Hello list,
>
> Coming from an Ant/Java world, I am usually working in projects that have the
> following directory structure:
>
>  project
>       |---src  ("plain" source files)
>       |---test (unit testing)
>
> What would a Makefile (possibly using OCamlMakefile) or OMakefile look
> like that would allow me to:
>
>  1. 'make XXX.ml' to compile XXX.ml into an object file
>  2. 'make some-target' to build the executable some-target, depending on
>     given object files
>  3. 'make test' to build the test suite, depending on object files in
>     the 'src' directory.
>
> Any help is much appreciated!

I'm somewhat experienced with OMake for small projects, so I'll try to
help with that.  You have lots of options, depending on if you want a
single OMakefile or one in each subdirectory, whether or not you're
using lexers and parsers, how modular you want things to be, and so
on.  To give you some idea, a quick single-file OMakefile like this in
the root directory would probably work.

########
.PHONY all test
NATIVE_ENABLED = true
BYTE_ENABLED = false

.SUBDIRS src
   FILES = foo bar bat baz
   OCamlProgram(some-target, $(FILES))
   all: some-target

targetExe = $(file src/some-target$(EXE))
.SUBDIRS test
   test1: $(targetExe)
      $(targetExe) ./test1-input > ./test1-output

   test: test1

########

If you want an OMakefile in each subdirectory, just cut the bodies of
the .SUBDIRS blocks and put them into the corresponding OMakefile's,
then use a single .SUBDIRS line like this:
.SUBDIRS src test

I'm sure there are others on this list with more OMake experience, so
if I've got something wrong please speak up!

Cheers,
-n8

-- 
>>>-- Nathaniel Gray -- Caltech Computer Science ------>
>>>-- Mojave Project -- http://mojave.cs.caltech.edu -->


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-23 20:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-23 15:24 Building projects written in OCaml Renald Buter
2006-08-23 19:01 ` [Caml-list] " Martin Jambon
2006-08-23 20:07 ` Nathaniel Gray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).