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] canonical camlp4-suffix?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-09-04 (06:20)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] canonical camlp4-suffix?

On Mon, Sep 03, 2001 at 05:58:40PM +0200, Markus Mottl wrote:

> since I am currently trying to add support for the camlp4-preprocessor
> to OcamlMakefile, I'd like to know what people usually use as suffix
> for files that should be preprocessed.

I generally prefer using ".ml" and ".mli" because some tools of the
compiler does not accept different suffixes (e.g. the debugger). For
the rules, there are two methods:

1/ add in source files comments specifying how compile the file; in the
   Makefiles, call a shell script reading this comment and launching the
   good command; it is the method I use in the sources of Camlp4 (see the
   files tools/Makefile.tpl and tools/camlp4_comm.sh in Camlp4 sources) and
   in GeneWeb (same kind of shell script): this shell just calls ocamlc
   without -pp parameter if the comment is not found.

2/ compile all files with "-pp camlp4o" (or "-pp camlp4r" if you prefer
   the revised syntax) and use "#load" in your files: this has been possible
   (however not yet documented) since some versions of Camlp4. For example,
   if you use to compile "foo.ml" by:
        ocamlc -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c foo.ml
   you can add in the beginning of foo.ml:
        #load "pa_extend.cmo";;
        #load "q_MLast.cmo";;
   and compile with
        ocamlc -pp camlp4o -c foo.ml

   (double semicolons at end of #load are mandatory; in revised syntax
   use simple semicolon)

   You can also use "#directory" in your source files, doing the same
   thing than the option -I of camlp4.

Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr