1 (***********************************************************************)
4 (* Nicolas Pouillard, Berke Durak, projet Gallium, INRIA Rocquencourt *)
6 (* Copyright 2007 Institut National de Recherche en Informatique et *)
7 (* en Automatique. All rights reserved. This file is distributed *)
8 (* under the terms of the Q Public License version 1.0. *)
10 (***********************************************************************)
13 (* Original author: Berke Durak *)
20 exception Exit_hygiene_failed
25 { law_name
= "Leftover Ocaml compilation files";
26 law_rules
= [Not
".cmo"; Not
".cmi"; Not
".cmx"; Not
".cma"; Not
".cmxa"];
28 { law_name
= "Leftover Ocaml type annotation files";
29 law_rules
= [Not
".annot"];
31 { law_name
= "Leftover object files";
32 law_rules
= [Not
".o"; Not
".a"; Not
".so"; Not
".obj"; Not
".lib"; Not
".dll"];
34 { law_name
= "Leftover ocamlyacc-generated files";
35 law_rules
= [Implies_not
(".mly",".ml"); Implies_not
(".mly",".mli")];
37 { law_name
= "Leftover ocamllex-generated files";
38 law_rules
= [Implies_not
(".mll",".ml")];
40 { law_name
= "Leftover dependency files";
41 law_rules
= [Not
".ml.depends"; Not
".mli.depends"];
46 dprintf
5 "Doing sanity checks";
47 let evil = ref false in
51 if !Options.sanitize
then
52 Some
(Pathname.concat
!Options.build_dir
!Options.sanitization_script
)
61 begin fun (law
, msgs
) ->
62 Printf.printf
"%s: %s:\n"
63 (match law
.law_penalty
with
68 Printf.printf
"IMPORTANT: I cannot work with leftover compiled files.\n%!";
75 Printf.printf
" %s\n" msg
80 if !evil then raise Exit_hygiene_failed
;