open Conf;;
open Printf;;	

let spec =
  [
	findlib_check "str";
    findlib_check "pxp";
    findlib_check "unix";
    param "nogtk" ~doc:"Do not include the GTK interface" (Bool false);
  ]
    
let configuration = Conf.configure spec
  
open AutoMake

let gtklibs, gtkincludes, ui_srcs =
  if configuration # get_bool "nogtk" then
    [], [], []
  else
    ["lablgtk"], ["+lablgtk2"], ["GtkUi.mli"; "GtkUi.ml"]
      
      
let sources = Util.prefix "src" (["Dotfiles.ml"; 
                                 "Config.mli"; "Config.ml"; 
                                 "Debug.mli"; "Debug.ml";
                                 "Deck.mli"; "Deck.ml";
                                 "Data.mli"; "Data.ml";
                                 "CardBoxes.mli"; "CardBoxes.ml";
                                 "Ui.mli"; "Ui.ml";
                                "ConsoleUi.mli"; "ConsoleUi.ml";
                                 ] @ ui_srcs)


let pack =
    (package
	     ~package:"cardflasher"
         
	     ~version:"0.2"
         
	     ~findlibs:["str"; "pxp"; "unix"]
         
         ~cleaned:["src/*~"]
         
         ~flags:[
             [`compile; `ml], ["-w m"; "-warn-error A"; "-pp camlp4o"];
             [`byte; `ml], ["-g"];
             [`document], ["-colorize-code"; "-keep-code"; "-sort"]
         ]
         
         ~includes:(gtkincludes @ ["src"])
         
         ~libs:gtklibs
         
	     [
             executable "cardflasher" ~sources:(sources @ ["src/main.ml"]);
             toplevel "toplevel" ~sources;
	     ]
    )

let _ =
    output_makefile ~configuration:(configuration :> AutoMake.configuration) pack;


;;
