1 (* Copyright (C) 2005, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
28 module MK = MatitamakeLib ;;
31 MatitaInit.fill_registry ();
32 MatitaInit.parse_cmdline ();
33 MatitaInit.load_configuration_file ();
35 let usage = ref (fun () -> ()) in
36 let dev_of_name name =
37 match MK.development_for_name name with
39 prerr_endline ("Unable to find a development called " ^ name);
44 match MK.development_for_dir dir with
46 prerr_endline ("Unable to find a development holding directory: "^ dir);
53 | [ name; path ] when path.[0] = '/' -> name, path
54 | [ name; path ] -> name, Unix.getcwd () ^ "/" ^ path
55 | [ name ] -> name, Unix.getcwd ()
56 | _ -> !usage (); (* should not be reached *) assert false
58 match MK.initialize_development name path with
63 if List.length args <> 0 then !usage ();
64 match MK.list_known_developments () with
65 | [] -> print_string "No developments found.\n"; exit 0
69 print_string (Printf.sprintf "%-10s\trooted in %s\n" name root))
73 let destroy_dev args =
74 if List.length args <> 1 then !usage ();
75 let name = (List.hd args) in
76 let dev = dev_of_name name in
77 MK.destroy_development dev;
83 | [] -> dev_for_dir (Unix.getcwd ())
84 | [name] -> dev_of_name name
85 | _ -> !usage (); exit 1
87 match MK.clean_development dev with
92 if List.length args <> 1 then !usage ();
93 let name = (List.hd args) in
94 let dev = dev_of_name name in
95 match MK.build_development dev with
99 let publish_dev args =
100 if List.length args <> 1 then !usage ();
101 let name = (List.hd args) in
102 let dev = dev_of_name name in
103 match MK.publish_development dev with
108 if List.length args < 1 then !usage ();
109 let dev = dev_for_dir (Unix.getcwd ()) in
112 ignore(MK.build_development ~target:t dev))
119 "destroy", destroy_dev;
121 "publish", publish_dev;
124 usage := MatitaInit.die_usage;
127 | [] -> target [ "all" ]
131 (List.assoc s params), tl
133 if s.[0] = '-' then (!usage ();assert false) else target, args
137 parse (Helm_registry.get_list Helm_registry.string "matita.args")