X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2Fmatitac.ml;h=83ab74439129e005717d987083b8bdbbb9b2a908;hb=a88be1ca42c0969dbab9a5c76240f5931df876d9;hp=ced922a231b2644d42ed5fa3dc8d818bf80b9bb4;hpb=bc76b4d2f3c380894259b45fad52cf85ae6cee18;p=helm.git diff --git a/helm/software/matita/matitac.ml b/helm/software/matita/matitac.ml index ced922a23..83ab74439 100644 --- a/helm/software/matita/matitac.ml +++ b/helm/software/matita/matitac.ml @@ -25,19 +25,52 @@ (* $Id$ *) +(* compiler ala pascal/java using make *) +let main_compiler () = + MatitaInit.initialize_all (); + (* targets and deps *) + let targets = Helm_registry.get_list Helm_registry.string "matita.args" in + let target, root = + match targets with + | [] -> + (match Librarian.find_roots_in_dir (Sys.getcwd ()) with + | [x] -> [], Filename.dirname x + | [] -> + prerr_endline "No targets and no root found"; exit 1 + | roots -> + let roots = List.map (HExtlib.chop_prefix (Sys.getcwd()^"/")) roots in + prerr_endline ("Too many roots found:\n\t" ^ String.concat "\n\t" roots); + prerr_endline ("\nEnter one of these directories and retry"); + exit 1); + | hds -> + let roots_and_targets = + List.map (fun (root, buri, file, target) -> root,target) + (List.map (Librarian.baseuri_of_script ~include_paths:[]) hds) in + let roots,targets = List.split roots_and_targets in + let root = List.hd roots in + if (List.exists (fun root' -> root' <> root) roots) then + (prerr_endline "Only targets in the same root can be specified.";exit 1); + targets, root + in + (* must be called after init since args are set by cmdline parsing *) + let system_mode = Helm_registry.get_bool "matita.system" in + if system_mode then HLog.message "Compiling in system space"; + (* here we go *) + if not (Helm_registry.get_bool "matita.verbose") then MatitaMisc.shutup (); + if MatitacLib.Make.make root target then + (HLog.message "Compilation successful"; 0) + else + (HLog.message "Compilation failed"; 1) +;; + let main () = - match Filename.basename Sys.argv.(0) with - | "gragrep" | "gragrep.opt" -> Gragrep.main () - | "matitadep" | "matitadep.opt" -> Matitadep.main () - | "matitaclean" | "matitaclean.opt" -> Matitaclean.main () - | "matitamake" | "matitamake.opt" -> Matitamake.main () - | "matitaprover" | "matitaprover.opt" -> Matitaprover.main () - | _ -> -(* - let _ = Paramodulation.Saturation.init () in *) -(* ALB to link paramodulation *) - let _ = MatitacLib.main `COMPILER in - () + Sys.catch_break true; + let bin = Filename.basename Sys.argv.(0) in + if Pcre.pmatch ~pat:"^matitadep" bin then Matitadep.main () + else if Pcre.pmatch ~pat:"^matitaclean" bin then Matitaclean.main () + else if Pcre.pmatch ~pat:"^matitawiki" bin then MatitaWiki.main () + else exit (main_compiler ()) +;; let _ = main ()