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] OcamlConf 0.8 - Compiling Sources in Sub-directories
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-09-14 (23:47)
From: chris.danx <chris.danx@n...>
Subject: [Caml-list] OcamlConf 0.8 - Compiling Sources in Sub-directories

Does anyone else here use OCamlConf?  Is this an appropriate place to 
post a problem involving OCamlConf?

I'm in the process of developing a simple configure.ml file for a game. 
  However I ran into a problem with OcamlConf (configure.ml at bottom of 
email).  It does not compile sources in sub directories unless they are 
included using the optional 'include' parameter in the Automake.package 

For example, it fails to find fbaCell.cmi necessary for 
src/logic/fbaCells.ml.  When compiled fbaCell.cmi is compiled into 
src/logic, but src/logic is not supplied to the compiler.

danx@trunk$ ocamlconf configure.ml && ./configure

------------ Configuration Summary ------------
         prefix: /usr/local

danx@trunk$ make
ocamlfind ocamlc  -c  -o src/logic/fbaCells.cmo src/logic/fbaCells.ml
File "src/logic/fbaCells.ml", line 1, characters -1--1:
Could not find the .cmi file for interface src/logic/fbaCells.mli.
make: *** [src/logic/fbaCells.cmo] Error 2

Providing ~includes: ["src/logic"] to AutoMake.package works.

ocamlconf configure.ml && ./configure

------------ Configuration Summary ------------
         prefix: /usr/local

danx@trunk$ make
ocamlfind ocamlc  -c -I src/logic -o src/logic/fbaCells.cmi 
ocamlfind ocamlc  -c -I src/logic -o src/logic/fbaCells.cmo 
ocamlfind ocamlc  -linkpkg -a -I src/logic     -o fbaglogic.cma 

Is this the intended behaviour?

My expectation would be that it would provide src/logic only when 
necessary.  Perhaps I'm being dense and missing something?


p.s. if anyone can suggest a better name than "Falling Block Addict" for 
a tetris clone, don't hold back! :)

(* configure.ml
  * An ocamlconf configuration program for 'Falling Block Addict'.
  * by Christopher Campbell (c) 2004

open Conf
open Util

let game_logic_files =
   "fbaCells.mli fbaCells.ml"

let game_logic_library_name =

let game_logic_library src_dir =
   AutoMake.library ~sources: (prefix src_dir (split game_logic_files))
                    ~dest:    `lib
                    ~shared:  true

let conf_spec =


let configuration = configure conf_spec

let _ =
   print_newline ();
   print_endline "------------ Configuration Summary ------------";
   print_string (configuration#summarize);
   print_newline ()

open AutoMake
let _ =
   output_makefile ~configuration:(configuration :> AutoMake.configuration)
        ~package:         "sg-fbaddict"
        ~findlib_package: "fbaddict"
        ~version:         "0.1"
        ~includes:        ["src/logic"]
        ~flags: [
	 [`compile; `native], [];	

        (* *)
	 game_logic_library "src/logic"

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