]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matitamakeLib.ml
fast and sound registry lists
[helm.git] / matita / matitamakeLib.ml
index ee04e787841a1cf6d8ebaa94c1fad900b2a87366..499d0eaf361938c9bd363d7f72e8d7bbf0118f2f 100644 (file)
@@ -78,25 +78,26 @@ let initialize () =
   match ls_dir (pool ()) with
   | None -> logger `Error ("Unable to list directory " ^ pool ()) 
   | Some l -> 
-      List.iter 
-        (fun name -> 
-          let root = 
-            try 
-              Some (HExtlib.input_file (pool () ^ name ^ rootfile))
-            with Unix.Unix_error _ -> 
-              logger `Warning ("Malformed development " ^ name);
-              None
-          in 
-          match root with 
-          | None -> ()
-          | Some root -> 
-              developments := {root = root ; name = name} :: !developments;
-              let inc = Helm_registry.get_list 
-                Helm_registry.string "matita.includes" in
-              Helm_registry.set_list Helm_registry.of_string 
-                ~key:"matita.includes" ~value:(inc @ [root])
-          ) 
-      l
+      let paths = 
+        List.fold_left 
+          (fun acc name -> 
+            let root = 
+              try 
+                Some (HExtlib.input_file (pool () ^ name ^ rootfile))
+              with Unix.Unix_error _ -> 
+                logger `Warning ("Malformed development " ^ name);
+                None
+            in 
+            match root with 
+            | None -> acc
+            | Some root -> 
+                developments := {root = root ; name = name} :: !developments;
+                root::acc)
+         [] l
+      in
+      let inc = Helm_registry.get_list Helm_registry.string "matita.includes" in
+      Helm_registry.set_list Helm_registry.of_string 
+        ~key:"matita.includes" ~value:(inc @ paths)
 
 (* finds the makefile path for development devel *)
 let makefile_for_development devel =
@@ -146,9 +147,14 @@ let rebuild_makefile development =
     HExtlib.input_file BuildTimeConf.matitamake_makefile_template 
   in
   let ext = Lazy.force am_i_opt in
-  let cc = BuildTimeConf.runtime_base_dir ^ "/matitac" ^ ext in
-  let rm = BuildTimeConf.runtime_base_dir ^ "/matitaclean" ^ ext in
-  let mm = BuildTimeConf.runtime_base_dir ^ "/matitadep" ^ ext in
+  let binpath = 
+    if HExtlib.is_executable 
+      (BuildTimeConf.runtime_base_dir ^ "/matitac" ^ ext)
+    then BuildTimeConf.runtime_base_dir ^ "/" else ""
+  in
+  let cc = binpath ^ "matitac" ^ ext in
+  let rm = binpath ^ "matitaclean" ^ ext in
+  let mm = binpath ^ "matitadep" ^ ext in
   let df = pool () ^ development.name ^ "/depend" in
   let template = Pcre.replace ~pat:"@ROOT@" ~templ:development.root template in
   let template = Pcre.replace ~pat:"@CC@" ~templ:cc template in
@@ -204,8 +210,16 @@ let call_make ?matita_flags development target make =
       | None -> (try Sys.getenv "MATITA_FLAGS" with Not_found -> "")
       | Some s -> s 
     in
-    already_defined ^ 
-      if Helm_registry.get_bool "matita.bench" then "-bench" else ""
+    let bench = 
+      if Helm_registry.get_bool "matita.bench" then " -bench" else ""
+    in
+    let system = 
+      if Helm_registry.get_bool "matita.system" then " -system" else ""
+    in
+    let noinnertypes = 
+      if Helm_registry.get_bool "matita.noinnertypes" then " -noinnertypes" else ""
+    in
+    already_defined ^ bench ^ system ^ noinnertypes
   in
   let csc = try ["SRC=" ^ Sys.getenv "SRC"] with Not_found -> [] in
   rebuild_makefile development;
@@ -213,7 +227,7 @@ let call_make ?matita_flags development target make =
   let flags = [] in 
   let flags =
     try
-      flags @ [ sprintf "MATITA_FLAGS=\"%s\"" matita_flags ]
+      flags @ [ sprintf "MATITA_FLAGS=%s" matita_flags ]
     with Not_found -> flags in
   let flags = flags @ csc in
   let args = 
@@ -345,7 +359,7 @@ let publish_development_bstract build clean devel =
     let orig_matita_flags = 
       try Sys.getenv "MATITA_FLAGS" with Not_found -> "" 
     in
-    "\"" ^ orig_matita_flags ^ "\"", "\"" ^ orig_matita_flags ^ " -system\"
+    orig_matita_flags, orig_matita_flags ^ " -system
   in
   HLog.message "cleaning the development before publishing";
   if clean ~matita_flags devel then