]> matita.cs.unibo.it Git - helm.git/blob - make/main.ml
0b9cf949aeddd8d5017ff8bae0d4a1f7f10edd88
[helm.git] / make / main.ml
1
2 module F = struct
3         type source_object = string
4         type target_object = string
5         let string_of_source_object s = s
6         let string_of_target_object s = s
7         let target_of s = s ^ ".o"
8         let build t =
9           print_string ("build "^t^"\n"); flush stdout;
10           ignore(Unix.system ("touch "^target_of t))
11         ;;
12         let mtime_of_source_object s = 
13           try Some (Unix.stat s).Unix.st_mtime
14           with Unix.Unix_error (Unix.ENOENT, "stat", f) when f = s -> 
15             prerr_endline ("Source file not found: "^s);assert false
16         ;;
17         let mtime_of_target_object t = 
18           try Some (Unix.stat t).Unix.st_mtime
19           with Unix.Unix_error (Unix.ENOENT, "stat", f) when f = t -> None
20         ;;
21 end
22
23 module M = Make.Make(F)
24
25 let deps = [
26   "a.c", [ "b.c"; "d.c" ];
27   "b.c", [ "c.c"; "d.c" ];
28   "c.c", [];
29   "d.c", ["e.c"];
30   "e.c", [];
31   ]
32 ;;
33
34 M.make deps (Array.to_list Sys.argv);;