caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Aleksey Nogin <nogin@metaprl.org>
To: Joel Reymont <joelr1@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] ocamlbuild is VERY nifty
Date: Tue, 13 Mar 2007 11:38:09 -0700	[thread overview]
Message-ID: <45F6EF91.4090704@metaprl.org> (raw)
In-Reply-To: <E8532180-BEB2-469C-8C10-AB18DB5E0531@gmail.com>

On 07.03.2007 07:53, Joel Reymont wrote:

> I asked around before settling on a build system since I'm new to OCaml. 
> I looked at OMake, OCamlMakefile and found them complex and confusing.

Well, it should have been equally easy to use OMake in this case - while 
it is true that OMake is complex, the complexity is only there to help 
you out when you need it; you can safely ignore it until then.

If I understand what you are doing here correctly, it would have been 
sufficient to just use the following OMakefile:

---------
# Optional - use bytecode compilation even when ocamlopt is available
NATIVE_ENABLED = false
BYTE_ENABLED = true

USE_OCAMLFIND = true
OCAMLPACKS[] = ounit

.DEFAULT: $(OCamlProgram test, test easy easy_lexer easy_parser 
parser_util symtab parser_test)
-------

and then simply running "omake" would do what you want.

> Then William Neuman pointed me to ocamlbuild and Nicolas Pouillard 
> helped me hook it up to external libraries via a plugin.
> 
> Deep into my first project I confirm that ocamlbuild is VERY nifty. I 
> can automatically rebuild when any parts of my project change and then 
> run my unit tests.
> 
> All I need to do is:
> 
> ocamlbuild test.byte --
> 
> *** my project ***
> 
>      189 easy.mli
>      282 easy_lexer.mll
>      420 easy_parser.mly
>       17 myocamlbuild.ml
>       14 parser_util.ml
>       30 symtab.ml
>        8 test.ml
>      284 parser_test.ml
>     1355 total
> 
> *** test.ml ***
> 
> open OUnit
> 
> let suite = "Morpher" >:::
>   [Parser_test.suite]
> 
> let _ =
>   run_test_tt_main suite
> 
> *** myocamlbuild.ml ***
> 
> open Ocamlbuild_plugin;;
> open Command;;
> 
> let packages = "ounit" (* "pkg1,pkg2,..." *);;
> 
> let ocamlfind cmd =
> S[A"ocamlfind"; A cmd; A"-package"; A packages];;
> 
> flag ["ocaml"; "link"] (A"-linkpkg");;
> 
> dispatch begin function
> | After_options ->
>      Options.ocamlc := ocamlfind "ocamlc";
>      Options.ocamlopt := ocamlfind "ocamlopt";
> | _ -> ()
> end
> 
> -- 
> http://wagerlabs.com/
> 
> 
> 
> 
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 


  parent reply	other threads:[~2007-03-13 18:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-07 15:53 Joel Reymont
2007-03-07 20:55 ` [Caml-list] beta-test of OCaml 3.10.0 Jon Harrop
2007-03-13 18:38 ` Aleksey Nogin [this message]
2007-03-16 13:46   ` [Caml-list] ocamlbuild is VERY nifty Joel Reymont
2007-03-16 17:01     ` Aleksey Nogin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45F6EF91.4090704@metaprl.org \
    --to=nogin@metaprl.org \
    --cc=caml-list@inria.fr \
    --cc=joelr1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).