Loading ...
Sorry, an error occurred while loading the content.

2620Re: "ocaml_beginners"::[] Output directory ?

Expand Messages
  • Richard Jones
    Sep 2, 2004
    • 0 Attachment
      On Mon, Aug 30, 2004 at 11:29:36AM -0300, Andrei Formiga wrote:
      > Hi,
      > Is there any way to instruct ocamlc to output all files to a given
      > directory ? For instance, if I need to compile A.ml and B.ml, in that
      > order (because B depends on A), to produce B.cmo, I can do
      > ocamlc -c -o outdir/B.cmo A.ml B.ml
      > and B.cmo will be in outdir, but A.cmo will be built in the current
      > dir. I looked for relevant compiler flags but found nothing. Seems
      > that the only way to get what I want is compiling A.ml separately,
      > before B.ml. Is that right ?

      As far as I can see, that's right.

      However, you probably ought to be using a Makefile and some standard
      rules, meaning that you will be compiling each file separately anyway.
      For reference here are the standard rules I always use:

      %.cmi: %.mli
      $(OCAMLC) $(OCAMLCFLAGS) -c $<

      %.cmo: %.ml
      $(OCAMLC) $(OCAMLCFLAGS) -c $<

      %.cmx: %.ml

      .SUFFIXES: .ml .mli .cmi .cmo .cmx

      A simple modification of these will allow you to compile into a
      subdirectory. (You will probably need to "fix" the output of ocamldep
      to understand the subdirectory ...)


      Richard Jones. http://www.annexia.org/ http://www.j-london.com/
      Merjis Ltd. http://www.merjis.com/ - improving website return on investment
      NET::FTPSERVER is a full-featured, secure, configurable, database-backed
      FTP server written in Perl: http://www.annexia.org/freeware/netftpserver/

      [Non-text portions of this message have been removed]
    • Show all 3 messages in this topic