Project

General

Profile

Revision 5fccce23 src/backends/C/c_backend_makefile.ml

View differences:

src/backends/C/c_backend_makefile.ml
13 13
open Lustre_types
14 14
open Corelang
15 15

  
16
let pp_dep fmt (Dep(b,id,tops,stateful)) =
16
let pp_dep fmt dep =
17 17
  Format.fprintf fmt "%b, %s, {%a}, %b"
18
    b id Printers.pp_prog tops stateful
18
    dep.local dep.name Printers.pp_prog dep.content dep.is_stateful
19 19
  
20 20
let pp_deps fmt deps = Format.fprintf fmt "@[<v 0>%a@ @]" (Utils.fprintf_list ~sep:"@ ," pp_dep) deps
21 21

  
......
37 37
  ) [] header 
38 38
    
39 39

  
40
let compiled_dependencies dep = 
41
  List.filter (fun (Dep (_, _, header, _)) -> header_has_code header) dep
40
let compiled_dependencies deps = 
41
  List.filter (fun dep -> header_has_code dep.content) deps
42 42

  
43
let lib_dependencies dep = 
43
let lib_dependencies deps = 
44 44
  List.fold_left 
45
    (fun accu (Dep (_, _, header, _)) -> Utils.list_union (header_libs header) accu) [] dep
45
    (fun accu dep -> Utils.list_union (header_libs dep.content) accu) [] deps
46 46
    
47
let fprintf_dependencies fmt (dep: dep_t list) =
47
let fprintf_dependencies fmt (deps: dep_t list) =
48 48
  (* Format.eprintf "Deps: %a@." pp_deps dep; *)
49
  let compiled_dep = compiled_dependencies dep in
49
  let compiled_deps = compiled_dependencies deps in
50 50
  (* Format.eprintf "Compiled Deps: %a@." pp_deps compiled_dep; *)
51 51
 
52 52
  List.iter (fun s -> Log.report ~level:1 (fun fmt -> fprintf fmt "Adding dependency: %s@." s);  
53 53
    fprintf fmt "\t${GCC} -I${INC} -c %s@." s)
54 54
    (("${INC}/io_frontend.c"):: (* IO functions when a main function is computed *)
55 55
	(List.map 
56
	   (fun (Dep (local, s, _, _)) -> 
57
	     (if local then s else Version.include_path ^ "/" ^ s) ^ ".c")
58
	   compiled_dep))
56
	   (fun dep -> 
57
	     (if dep.local then dep.name else Version.include_path ^ "/" ^ dep.name) ^ ".c")
58
	   compiled_deps))
59 59

  
60 60
module type MODIFIERS_MKF =
61 61
sig (* dep was (bool * ident * top_decl list) *)
......
108 108
    fprintf fmt "\t${GCC} -I${INC} -I. -c %s_main.c@." basename;   
109 109
    fprintf_dependencies fmt dependencies;    
110 110
    fprintf fmt "\t${GCC} -o ${BINNAME} io_frontend.o %a %s.o %s_main.o %a@." 
111
      (Utils.fprintf_list ~sep:" " (fun fmt (Dep (_, s, _, _)) -> Format.fprintf fmt "%s.o" s)) 
111
      (Utils.fprintf_list ~sep:" " (fun fmt dep -> Format.fprintf fmt "%s.o" dep.name)) 
112 112
      (compiled_dependencies dependencies)
113 113
      basename (* library .o *)
114 114
      basename (* main function . o *) 

Also available in: Unified diff