cpkg2c: cpkg2c.mll
ocamllex $<
- $(if $(shell which ocamlopt),ocamlopt -o $@ str.cmxa,ocamlc -o $@ str.cma) $@.ml
+ $(if $(shell which ocamlopt),ocamlopt -o $@ str.cmxa unix.cmxa,ocamlc -o $@ str.cma unix.cma) $@.ml
@$(RM) cpkg2c.ml cpkg2c.c* cpkg2c.o
let file = Sys.argv.(2) in
let lexbuf = L.from_channel (open_in file) in
let l = (startchunk cLine file lexbuf) in
- if Sys.argv.(3) = "-o" then
- let ob = open_out_gen [ Open_trunc ; Open_wronly; Open_creat ] 0o444 Sys.argv.(4) in
- match Sys.argv.(1) with
- | "-h" -> warn ob; do_h ob l; close_out ob
- | "-c" -> warn ob; do_c ob l; close_out ob
- | _ -> usage ()
- else
+ if Sys.argv.(3) = "-o" then (
+ Unix.unlink Sys.argv.(4);
+ let ob = open_out_gen [ Open_trunc ; Open_wronly; Open_creat ] 0o444 Sys.argv.(4) in
+ match Sys.argv.(1) with
+ | "-h" -> warn ob; do_h ob l; close_out ob
+ | "-c" -> warn ob; do_c ob l; close_out ob
+ | _ -> usage ()
+ ) else
usage();
}