]> matita.cs.unibo.it Git - helm.git/commitdiff
- added some options to matitadep: -stdout and -exclude
authorFerruccio Guidi <ferruccio.guidi@unibo.it>
Fri, 22 Feb 2008 22:25:27 +0000 (22:25 +0000)
committerFerruccio Guidi <ferruccio.guidi@unibo.it>
Fri, 22 Feb 2008 22:25:27 +0000 (22:25 +0000)
- LAMBDA-TYPES: improved Makefile, Base-2/theory.mma is no longer needed

helm/software/components/library/librarian.ml
helm/software/components/library/librarian.mli
helm/software/matita/contribs/LAMBDA-TYPES/Base-2/.depend
helm/software/matita/contribs/LAMBDA-TYPES/Base-2/depends
helm/software/matita/contribs/LAMBDA-TYPES/Base-2/theory.ma [new file with mode: 0644]
helm/software/matita/contribs/LAMBDA-TYPES/Base-2/theory.mma [deleted file]
helm/software/matita/contribs/LAMBDA-TYPES/Makefile
helm/software/matita/contribs/LAMBDA-TYPES/depends
helm/software/matita/matitaclean.ml
helm/software/matita/matitadep.ml

index aa6b2e81dd2e3997f96d41669e7ff245fc50e306..f9831545d39fd57ae7ebef2cd539eeec4793f684 100644 (file)
@@ -366,15 +366,15 @@ module Make = functor (F:Format) -> struct
 
 end
   
-let write_deps_file root deps =
-  let oc = open_out (root ^ "/depends") in
-  List.iter 
-    (fun (t,d) -> output_string oc (t^" "^String.concat " " d^"\n")) 
-    deps;
-  close_out oc;
-  HLog.message ("Generated: " ^ root ^ "/depends")
-;;
-
+let write_deps_file where deps = match where with 
+   | Some root ->
+      let oc = open_out (root ^ "/depends") in
+      let map (t, d) = output_string oc (t^" "^String.concat " " d^"\n") in
+      List.iter map deps; close_out oc;
+      HLog.message ("Generated: " ^ root ^ "/depends")
+   | None -> 
+      print_endline (String.concat " " (List.flatten (List.map snd deps)))
+      
 (* FG ***********************************************************************)
 
 (* scheme uri part as defined in URI Generic Syntax (RFC 3986) *)
index e7b6df521aaff07fe08b57d1fa2be9eabbdcf90d..25ab0853e9184e615a7a3b4f73c0f00b58ab6051 100644 (file)
@@ -91,7 +91,7 @@ module Make :
  * state that plus.ma needs nat and equality
  *)
 val load_deps_file: string -> (string * string list) list
-val write_deps_file: string -> (string * string list) list -> unit
+val write_deps_file: string option -> (string * string list) list -> unit
 
 (* FG ***********************************************************************)
 
index 800096bb842cadd8d3b89c199484c96fbc6ab6a7..52fc20094a06d0aba7f2ba0da43b09b5ee4ba9f6 100644 (file)
@@ -1,4 +1,3 @@
-Base-2/theory.ma: Base-2/theory.mma Base-2/ext/tactics.ma Base-2/ext/arith.ma Base-2/types/props.ma Base-2/blt/props.ma Base-2/plist/props.ma
 Base-2/ext/tactics.ma: Base-2/ext/tactics.mma Base-2/preamble.ma
 Base-2/ext/arith.ma: Base-2/ext/arith.mma Base-2/preamble.ma
 Base-2/types/defs.ma: Base-2/types/defs.mma Base-2/preamble.ma
index 7f10402a252a2572602876c09a93fd96e1bc0e20..fd98f272cc0df55bfe0e2e5dcb20c9abb2108afe 100644 (file)
@@ -1,4 +1,3 @@
-Base-2/theory.mma Base-2/preamble.ma Base-1/theory.ma
 Base-2/ext/tactics.mma Base-2/preamble.ma Base-1/ext/tactics.ma
 Base-2/ext/arith.mma Base-2/preamble.ma Base-1/ext/arith.ma
 Base-2/types/defs.mma Base-2/preamble.ma Base-1/types/defs.ma
diff --git a/helm/software/matita/contribs/LAMBDA-TYPES/Base-2/theory.ma b/helm/software/matita/contribs/LAMBDA-TYPES/Base-2/theory.ma
new file mode 100644 (file)
index 0000000..ee1cbb7
--- /dev/null
@@ -0,0 +1,26 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+(* This file was automatically generated: do not edit *********************)
+
+include "Base-2/ext/tactics.ma".
+
+include "Base-2/ext/arith.ma".
+
+include "Base-2/types/props.ma".
+
+include "Base-2/blt/props.ma".
+
+include "Base-2/plist/props.ma".
+
diff --git a/helm/software/matita/contribs/LAMBDA-TYPES/Base-2/theory.mma b/helm/software/matita/contribs/LAMBDA-TYPES/Base-2/theory.mma
deleted file mode 100644 (file)
index ee1cbb7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-(**************************************************************************)
-(*       ___                                                              *)
-(*      ||M||                                                             *)
-(*      ||A||       A project by Andrea Asperti                           *)
-(*      ||T||                                                             *)
-(*      ||I||       Developers:                                           *)
-(*      ||T||         The HELM team.                                      *)
-(*      ||A||         http://helm.cs.unibo.it                             *)
-(*      \   /                                                             *)
-(*       \ /        This file is distributed under the terms of the       *)
-(*        v         GNU General Public License Version 2                  *)
-(*                                                                        *)
-(**************************************************************************)
-
-(* This file was automatically generated: do not edit *********************)
-
-include "Base-2/ext/tactics.ma".
-
-include "Base-2/ext/arith.ma".
-
-include "Base-2/types/props.ma".
-
-include "Base-2/blt/props.ma".
-
-include "Base-2/plist/props.ma".
-
index 99d22a93a22bab1d6d021f5334a9c452dc758135..a2a3b8eecf9a47b97b76df10c30ca63933b0e04c 100644 (file)
@@ -6,15 +6,18 @@ DIR=$(shell basename $$PWD)
 
 MMAS = $(shell find Base-2 -name "*.mma")
 MAS = $(MMAS:%.mma=%.ma)
+XMAS = Base-2/theory.ma pippo
 
-%.ma: %.mma
-       $(H)../../matitac.opt $(MATITAOPTIONS) $< 2> /dev/null
+%.ma: %.mma 
+       $(H)../../matitac.opt $(MATITAOPTIONS) `../../matitadep.opt -stdout $<` 2> /dev/null
        $(H)../../matitac.opt $(MATITAOPTIONS) -dump $@ $< 2> /dev/null
        $(H)$(MAKE) --no-print-directory depend.opt
 
 $(DIR) all: $(MAS)
+       $(H)$(MAKE) --no-print-directory depend.full
        $(H)../../matitac $(MATITAOPTIONS) 2> /dev/null
 $(DIR).opt opt all.opt: $(MAS)
+       $(H)$(MAKE) --no-print-directory depend.full.opt
        $(H)../../matitac.opt $(MATITAOPTIONS) 2> /dev/null
 clean:
        $(H)../../matitaclean
@@ -24,11 +27,26 @@ clean.opt:
        $(H)../../matitaclean.opt
        $(H)rm -f $(MAS)
        $(H)$(MAKE) --no-print-directory depend.opt
+clean.ma:
+       $(H)../../matitaclean.opt $(MAS)
+       $(H)rm -f $(MAS)
+       $(H)$(MAKE) --no-print-directory depend.opt
+
 depend:
-       $(H)../../matitadep
+       @echo matitadep
+       $(H)../../matitadep $(foreach FILE,$(XMAS),-exclude $(FILE))
        $(H)cat Base-2/depends >> depends
 depend.opt:
-       $(H)../../matitadep.opt
+       @echo matitadep.opt
+       $(H)../../matitadep.opt $(foreach FILE,$(XMAS),-exclude $(FILE))
+       $(H)cat Base-2/depends >> depends
+depend.full:
+       @echo matitadep
+       $(H)../../matitadep 
+       $(H)cat Base-2/depends >> depends
+depend.full.opt:
+       @echo matitadep.opt
+       $(H)../../matitadep.opt 
        $(H)cat Base-2/depends >> depends
 
 include Base-2/.depend
index 6c7aab739035625e0c5afa158ea437692b8da73a..a4314a81cd0167e3acd0811a98de1ef93cc00e49 100644 (file)
@@ -224,7 +224,7 @@ Base-2/types/defs.ma Base-2/preamble.ma
 Base-2/types/props.ma Base-2/types/defs.ma
 Base-2/plist/defs.ma Base-2/preamble.ma
 Base-2/plist/props.ma Base-2/plist/defs.ma
-Base-2/ext/arith.ma 
+Base-2/ext/arith.ma Base-2/preamble.ma
 Base-2/ext/tactics.ma Base-2/preamble.ma
 Base-2/blt/defs.ma Base-2/preamble.ma
 Base-2/blt/props.ma Base-2/blt/defs.ma
@@ -234,7 +234,6 @@ NPlus/monoid.ma
 coq.ma 
 datatypes/Bool.ma 
 logic/equality.ma 
-Base-2/theory.mma Base-2/preamble.ma Base-1/theory.ma
 Base-2/ext/tactics.mma Base-2/preamble.ma Base-1/ext/tactics.ma
 Base-2/ext/arith.mma Base-2/preamble.ma Base-1/ext/arith.ma
 Base-2/types/defs.mma Base-2/preamble.ma Base-1/types/defs.ma
index d9f603652e334cd63e266cc56f7beba1a26f015c..ffc253d69c1c9ab2eb37e1fd775b58bf9e383732 100644 (file)
@@ -111,12 +111,10 @@ let main () =
            UM.buri_of_uri (UM.uri_of_string suri)
          with UM.IllFormedUri _ ->
            let _,u,_,_ = Librarian.baseuri_of_script ~include_paths:[] suri in
-           if String.length u < 5 || String.sub u 0 5 <> "cic:/" then begin
-             HLog.error (sprintf "File %s defines a bad baseuri: %s"
-               suri u);
+           if Librarian.is_uri u then u else begin
+             HLog.error (sprintf "File %s defines a bad baseuri: %s" suri u);
              exit 1
-           end else
-             u
+           end 
        in
         uri::uris_to_remove) [] files
   in
index ae95f8cf013f85c081e58032c66ab1cbe5d94cc1..fc50a74fbea41cfbcefb7c11afeb0b75efcd9583 100644 (file)
@@ -29,8 +29,23 @@ open Printf
 
 module GA = GrafiteAst 
 module U = UriManager
-                
+module HR = Helm_registry
+
+let fix_name f =
+   let f = 
+      if Pcre.pmatch ~pat:"^\\./" f then String.sub f 2 (String.length f - 2)
+      else f
+   in 
+   HExtlib.normalize_path f
+let exclude excluded_files files =
+   let map file = not (List.mem (fix_name file) excluded_files) in
+   List.filter map files
+
 let main () =
+  let include_paths = ref [] in
+  let excluded_files = ref [] in
+  let use_stdout = ref false in
   (* all are maps from "file" to "something" *)
   let include_deps = Hashtbl.create 13 in
   let baseuri_of = Hashtbl.create 13 in
@@ -38,8 +53,8 @@ let main () =
   let dot_name = "depends" in 
   let dot_file = ref "" in
   let set_dot_file () = dot_file := dot_name^".dot" in
+  let set_excluded_file name = excluded_files := name :: !excluded_files in 
   (* helpers *)
-  let include_paths = ref [] in
   let baseuri_of_script s = 
      try Hashtbl.find baseuri_of s 
      with Not_found -> 
@@ -66,9 +81,20 @@ let main () =
   (* initialization *)
   MatitaInit.add_cmdline_spec 
     ["-dot", Arg.Unit set_dot_file,
-    "Save dependency graph in dot format and generate a png";];
+        "Save dependency graph in dot format and generate a png";
+     "-exclude", Arg.String set_excluded_file,
+        "Exclude a file from the dependences";
+     "-stdout", Arg.Set use_stdout,
+        "Print dependences on stdout"
+    ];
   MatitaInit.parse_cmdline_and_configuration_file ();
   MatitaInit.initialize_environment ();
+  if not (Helm_registry.get_bool "matita.verbose") then MatitaMisc.shutup ();
+  let cmdline_args = HR.get_list HR.string "matita.args" in
+  let files = fun () -> match cmdline_args with
+     | [] -> HExtlib.find ~test:(fun x -> Filename.check_suffix x ".ma") "."
+     | _  -> cmdline_args
+  in
   let args = 
       let roots = Librarian.find_roots_in_dir (Sys.getcwd ()) in
       match roots with
@@ -81,21 +107,15 @@ let main () =
          include_paths := 
            (try Str.split (Str.regexp " ") (List.assoc "include_paths" opts)
            with Not_found -> []) @ 
-           (Helm_registry.get_list Helm_registry.string "matita.includes");
-         HExtlib.find ~test:(fun x -> Filename.check_suffix x ".ma") "."
+           (HR.get_list HR.string "matita.includes");
+         files ()
       | _ ->
          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
   in
-  let fix_name f =
-    let f = 
-      if Pcre.pmatch ~pat:"^\\./" f then String.sub f 2 (String.length f - 2)
-      else f
-    in 
-      HExtlib.normalize_path f
-  in
+  let args = exclude !excluded_files args in
   let ma_files = args in
   (* here we go *)
   (* fills:
@@ -145,11 +165,12 @@ let main () =
           acc d)
       [] deps
   in
-  Librarian.write_deps_file (Sys.getcwd()) 
+  let where = if !use_stdout then None else Some (Sys.getcwd()) in
+  Librarian.write_deps_file where
    (deps@HExtlib.list_uniq (List.sort Pervasives.compare (List.map (fun x ->
            x,[]) extern)));
   (* dot generation *)
-  if !dot_file <> "" then 
+  if !dot_file <> "" then
     begin
       let oc = open_out !dot_file in
       let fmt = Format.formatter_of_out_channel oc in