(file) Return to driver.ml CVS log (file) (dir) Up to [venge] / src / mkc

 1 graydon 1.1 open Shell
 2             
 3             let compile makefile outfile homedir =
 4               let mlfile = Filename.temp_file "mkc" ".ml" in
 5               let cfile = Filename.temp_file "mkc" ".c" in
 6               let runfile = Filename.temp_file "mkc" ".exe" in
 7               let tidyup _ = 
 8                 begin
 9                   (try Unix.unlink runfile with _ -> ());
10                   (try Unix.unlink cfile with _ -> ())
11                 end
12               in
13               let frontend = Printf.sprintf "camlp4o -I %s mlex.cmo fe.cmo" homedir in
14                 try
15                   tidyup ();
16                   call [cmd "ocamlc" ["-pp"; frontend; "-o"; runfile; "-I"; homedir;
17             			  "frontc.cma"; "be.cmo"; "-impl"; makefile ]];
18                   Unix.chmod runfile 0o700;
19                   call ~stdout:(to_file cfile) [cmd runfile []];
20                   call [cmd "gcc" ["-o"; outfile; cfile]];
21                   Unix.chmod outfile 0o755;
22 graydon 1.1       tidyup ()
23                 with
24             	_ -> tidyup ()
25             	  
26             let _ = 
27               compile Sys.argv.(1) "a.out" "."
28             
29             

graydon hoare
Powered by
ViewCVS 0.9.2