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.parse_cmdline_and_configuration_file ();
33 let usage = ref (fun () -> ()) in
34 let dev_of_name name =
35 match MK.development_for_name name with
37 prerr_endline ("Unable to find a development called " ^ name);
42 match MK.development_for_dir dir with
44 prerr_endline ("Unable to find a development holding directory: "^ dir);
51 | [ name; path ] when path.[0] = '/' -> name, path
52 | [ name; path ] -> name, Unix.getcwd () ^ "/" ^ path
53 | [ name ] -> name, Unix.getcwd ()
54 | _ -> !usage (); (* should not be reached *) assert false
56 match MK.initialize_development name path with
61 if List.length args <> 0 then !usage ();
62 match MK.list_known_developments () with
63 | [] -> print_string "No developments found.\n"; exit 0
67 print_string (Printf.sprintf "%-10s\trooted in %s\n" name root))
71 let destroy_dev args =
72 if List.length args <> 1 then !usage ();
73 let name = (List.hd args) in
74 let dev = dev_of_name name in
75 MK.destroy_development dev;
81 | [] -> dev_for_dir (Unix.getcwd ())
82 | [name] -> dev_of_name name
83 | _ -> !usage (); exit 1
85 match MK.clean_development dev with
90 if List.length args <> 1 then !usage ();
91 let name = (List.hd args) in
92 let dev = dev_of_name name in
93 match MK.build_development dev with
97 let publish_dev args =
98 if List.length args <> 1 then !usage ();
99 let name = (List.hd args) in
100 let dev = dev_of_name name in
101 match MK.publish_development dev with
106 if List.length args < 1 then !usage ();
107 let dev = dev_for_dir (Unix.getcwd ()) in
110 ignore(MK.build_development ~target:t dev))
117 "destroy", destroy_dev;
119 "publish", publish_dev;
122 usage := MatitaInit.die_usage;
125 | [] -> target [ "all" ]
129 (List.assoc s params), tl
131 if s.[0] = '-' then (!usage ();assert false) else target, args
135 parse (Helm_registry.get_list Helm_registry.string "matita.args")