1996-11-07 03:04:12 -08:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Objective Caml *)
|
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
|
|
|
(* Automatique. Distributed only by permission. *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
|
|
|
(* Compiling C files and building C libraries *)
|
|
|
|
|
1997-05-15 06:30:31 -07:00
|
|
|
let command cmdline =
|
|
|
|
if !Clflags.verbose then begin
|
|
|
|
prerr_string "+ ";
|
|
|
|
prerr_string cmdline;
|
|
|
|
prerr_newline()
|
|
|
|
end;
|
|
|
|
Sys.command cmdline
|
|
|
|
|
1998-11-06 07:39:43 -08:00
|
|
|
let compile_file name =
|
1997-05-15 06:30:31 -07:00
|
|
|
command
|
1996-11-07 03:04:12 -08:00
|
|
|
(Printf.sprintf
|
|
|
|
"%s -c %s %s -I%s %s"
|
1998-11-06 07:39:43 -08:00
|
|
|
!Clflags.c_compiler
|
1997-06-23 07:36:30 -07:00
|
|
|
(String.concat " " (List.rev !Clflags.ccopts))
|
|
|
|
(String.concat " "
|
|
|
|
(List.map (fun dir -> "-I" ^ dir)
|
|
|
|
(List.rev !Clflags.include_dirs)))
|
|
|
|
Config.standard_library
|
|
|
|
name)
|
|
|
|
|
1996-11-07 03:04:12 -08:00
|
|
|
let create_archive archive file_list =
|
|
|
|
Misc.remove_file archive;
|
|
|
|
match Config.system with
|
|
|
|
"win32" ->
|
1997-05-15 06:30:31 -07:00
|
|
|
command(Printf.sprintf "lib /nologo /debugtype:cv /out:%s %s"
|
1996-11-07 03:04:12 -08:00
|
|
|
archive (String.concat " " file_list))
|
|
|
|
| _ ->
|
|
|
|
let r1 =
|
1997-05-15 06:30:31 -07:00
|
|
|
command(Printf.sprintf "ar rc %s %s"
|
1996-11-07 03:04:12 -08:00
|
|
|
archive (String.concat " " file_list)) in
|
|
|
|
if r1 <> 0 or String.length Config.ranlib = 0
|
|
|
|
then r1
|
1997-05-15 06:30:31 -07:00
|
|
|
else command(Config.ranlib ^ " " ^ archive)
|