Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Dynamically evaluating OCaml code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Re: GODI vs. Ocamake
On Thu, 2004-04-15 at 16:34, Kenneth Knowles wrote:
> On Thu, Apr 15, 2004 at 11:05:12AM +1000, skaller wrote:

> I never said they were perfect.  I don't use them.  However, I don't know of
> anything other than a custom-rolled Makefile that handles such things.  Are you
> suggesting one?  If so, I'm very interested, and I may have missed it in your
> previous messages.

I'm suggesting a whole class of them: general purpose languages.
Here's a fragment from the Felix build script.
Who needs autoconf?

if "compiler" in options or "bytecode" in options:
  # invoke ocaml interface compiler
  OCAML_OBJDIR='src'
  try:
    xqt('ocamlopt.opt')
    OCAMLCC = 'ocamlopt.opt '
    OCAMLLEX = 'ocamllex.opt '
    OCAMLYACC = 'ocamlyacc '
    BYTECODE = 0
  except:
    try:
      xqt('ocamlopt')
      OCAMLCC = 'ocamlopt '
      OCAMLLEX = 'ocamllex '
      OCAMLYACC = 'ocamlyacc '
      BYTECODE = 0
    except:
      try:
        xqt('ocamlc')
        OCAMLCC = 'ocamlc '
        if "debug" in options:
          OCAMLCC = 'ocamlc -g '
        OCAMLLEX = 'ocamllex '
        BYTECODE = 1
        OCAMLYACC = 'ocamlyacc '
      except:
        BYTECODE = -1
        OCAMLCC = '#ocamlc '
        OCAMLLEX = '#ocamllex '
        OCAMLYACC = '#ocamlyacc '

  try:
    xqt('ocamlc.opt')
    OCAMLB = 'ocamlc.opt '
  except:
    try:
      xqt('ocamlc')
      OCAMLB = 'ocamlc '
    except:
      OCAMLB = '#ocamlc '

  if "debug" in options:
    OCAMLB = OCAMLB + "-g "

  if "bytecode" in options:
    OCAMLOPT= OCAMLB + ' -I '+OCAML_OBJDIR+' '
    if BYTECODE <> -1: BYTECODE = 1
  else:
    OCAMLOPT= OCAMLCC + ' -I '+OCAML_OBJDIR+' '

  if "optimise" in options:
    OCAMLOPT = OCAMLOPT + "-unsafe -noassert -inline 5 "

  #OCAMLC=OCAMLB + ' -I '+OCAML_OBJDIR+' -rectypes '
  OCAMLC=OCAMLB + ' -I '+OCAML_OBJDIR+' '

  if BYTECODE == 0:
    OCAML_OBJECT_EXTENSION = '.cmx'
    OCAML_LIB_EXTENSION = '.cmxa'
  else:
    OCAML_OBJECT_EXTENSION = '.cmo'
    OCAML_LIB_EXTENSION = '.cma'
  
  # where the ocaml is installed
  result,x = get_stdout(OCAMLC + " -where")
  OCAML_INCLUDE_DIRECTORY= x[0][0:-1]
  print "OCAML at",OCAML_INCLUDE_DIRECTORY


-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
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