Project

General

Profile

Revision 58a463e7 src/backends/C/c_backend_makefile.ml

View differences:

src/backends/C/c_backend_makefile.ml
34 34
    
35 35

  
36 36
let compiled_dependencies dep = 
37
  List.filter (fun (_, _, header) -> header_has_code header) dep
37
  List.filter (fun (Dep (_, _, header, _)) -> header_has_code header) dep
38 38

  
39 39
let lib_dependencies dep = 
40 40
  List.fold_left 
41
    (fun accu (_, _, header) -> Utils.list_union (header_libs header) accu) [] dep
41
    (fun accu (Dep (_, _, header, _)) -> Utils.list_union (header_libs header) accu) [] dep
42 42
    
43
let fprintf_dependencies fmt dep =
43
let fprintf_dependencies fmt (dep: dep_t list) =
44 44
  let compiled_dep = compiled_dependencies dep in
45 45
  List.iter (fun s -> (* Format.eprintf "Adding dependency: %s@." s;  *)
46 46
    fprintf fmt "\t${GCC} -I${INC} -c %s@." s)
47 47
    (("${INC}/io_frontend.c"):: (* IO functions when a main function is computed *)
48 48
	(List.map 
49
	   (fun (local, s, _) -> 
49
	   (fun (Dep (local, s, _, _)) -> 
50 50
	     (if local then s else Version.include_path ^ "/" ^ s) ^ ".c")
51 51
	   compiled_dep))
52 52

  
53 53
module type MODIFIERS_MKF =
54
sig
55
  val other_targets: Format.formatter -> string -> string -> (bool * string * top_decl list) list -> unit
54
sig (* dep was (bool * ident * top_decl list) *)
55
  val other_targets: Format.formatter -> string -> string -> dep_t list -> unit
56 56
end
57 57

  
58 58
module EmptyMod =
59
struct
59
(struct
60 60
  let other_targets _ _ _ _ = ()
61
end
61
end: MODIFIERS_MKF)
62 62

  
63 63
module Main = functor (Mod: MODIFIERS_MKF) -> 
64 64
struct
65 65

  
66 66

  
67
let print_makefile basename nodename dependencies fmt =
67
let print_makefile basename nodename (dependencies:  dep_t list) fmt =
68 68
  fprintf fmt "GCC=gcc@.";
69 69
  fprintf fmt "LUSTREC=%s@." Sys.executable_name;
70 70
  fprintf fmt "LUSTREC_BASE=%s@." (Filename.dirname (Filename.dirname Sys.executable_name));
......
77 77
  fprintf fmt "\t${GCC} -I${INC} -I. -c %s_main.c@." basename;   
78 78
  fprintf_dependencies fmt dependencies;    
79 79
  fprintf fmt "\t${GCC} -o %s_%s io_frontend.o %a %s.o %s_main.o %a@." basename nodename 
80
    (Utils.fprintf_list ~sep:" " (fun fmt (_, s, _) -> Format.fprintf fmt "%s.o" s)) (compiled_dependencies dependencies)
80
    (Utils.fprintf_list ~sep:" " (fun fmt (Dep (_, s, _, _)) -> Format.fprintf fmt "%s.o" s)) 
81
    (compiled_dependencies dependencies)
81 82
    basename (* library .o *)
82 83
    basename (* main function . o *) 
83 84
    (Utils.fprintf_list ~sep:" " (fun fmt lib -> fprintf fmt "-l%s" lib)) (lib_dependencies dependencies)

Also available in: Unified diff