English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Building large and portable projects
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-11-21 (19:30)
From: Aleksey Nogin <nogin@c...>
Subject: [Caml-list] Omake [Was: Building large and portable projects]
On 21.11.2003 10:55, sylvain.le-gall@polytechnique.org wrote:

> Is there way to define camlp4 syntax ? ( for example XXX.ml needs camlp4
> with cmo zoggy.cmo or something like that )

Yes, the syntax would be something like

if true
    OCAMLFLAGS += -pp "camlp4 zoggy.cmo"
    XXX.cmx XXX.o:

The idea is the following:
- variables inside the "if" statements are locally scope (unless you 
explicitly export the variable environment back to the parent scope), so 
we use the "if true" as a synonym for "local". So, the above tells omake 
to add a preprocessor flag to ocamlc/ocamlopt when compiling XXX.cmx, 
XXX.o and XXX.cmo.

Alternatively, you could define a helper macro:

UseCamlp4(modules, files) =
    OCAMLFLAGS += -pp "camlp4 $(addsuffix .cmo, $(modules))"
    $(addsuffix .cmx, $(modules)) $(addsuffix .o, $(modules)):
    $(addsuffix .cmo, $(modules)):

UseCamlp4(zoggy, XXX)

Actually, it might be a good idea to add such a macro to the global 
rules file included with omake - I filed 
http://cvs.metaprl.org:12000/bugzilla/show_bug.cgi?id=119 on this.

> Is there a kind of configure in it ?

There are a number of mechanisms for hooking to an external one. For 
example, you could specify dependencies and commands when including file as:

    bla bla > foo

.INCLUDE: foo: foo.in
    bla bla bla bla < foo.in > foo

The above tell omake that
- it should include foo and if the file does not exist, it should use 
"bla bla" to generate it. Next, it should check whether foo is newer 
than foo.in and generate foo again (using "bla bla blah blah" this time) 
and then include it again.

You can also specify dependencies for the OMakefile itself:

if $(not $(equal $(OSTYPE), Win32))
     OMakefile: OMakefile.in config.status
    @echo "*** Build system is out-of-date, rebuilding ***"
    @echo "*** OMakefile was rebuilt, session should restart ***"

> Can you use META files.

Not sure what those are.

On 21.11.2003 08:12, skaller wrote:

> But it is much worse. A target can
> depend on itself. Interscript assumes that.
> An example is a Latex build, which depends
> on auxilliary files generated by the build
> [Ocamldoc output can take 4 passes to fixate
> for example].

Well, we are hoping to support those in omake (still work in progress) - 

Aleksey Nogin

Home Page: http://nogin.org/
E-Mail: nogin@cs.caltech.edu (office), aleksey@nogin.org (personal)
Office: Jorgensen 70, tel: (626) 395-2907

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners