Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / src / backends / C / c_backend.ml @ cd670fe1

History | View | Annotate | Download (2.21 KB)

1
(* ----------------------------------------------------------------------------
2
 * SchedMCore - A MultiCore Scheduling Framework
3
 * Copyright (C) 2009-2013, ONERA, Toulouse, FRANCE - LIFL, Lille, FRANCE
4
 * Copyright (C) 2012-2013, INPT, Toulouse, FRANCE
5
 *
6
 * This file is part of Prelude
7
 *
8
 * Prelude is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU Lesser General Public License
10
 * as published by the Free Software Foundation ; either version 2 of
11
 * the License, or (at your option) any later version.
12
 *
13
 * Prelude is distributed in the hope that it will be useful, but
14
 * WITHOUT ANY WARRANTY ; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
 * Lesser General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Lesser General Public
19
 * License along with this program ; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21
 * USA
22
 *---------------------------------------------------------------------------- *)
23

    
24
(* This module is used for the lustre to C compiler *)
25

    
26

    
27
(********************************************************************************************)
28
(*                         Translation function                                             *)
29
(********************************************************************************************)
30

    
31
let translate_to_c header_fmt source_fmt makefile_fmt spec_fmt_opt 
32
                   basename prog machines dependencies =
33

    
34
  (* Generating H file *)
35
  C_backend_header.print_header header_fmt basename prog machines;
36

    
37
  (* Generating C file *)
38
  C_backend_src.print_c source_fmt basename prog machines dependencies;
39

    
40
  (* Generating Makefile *)
41
  (* If a main node is identified, generate a main target for it *)
42
  match !Options.main_node with
43
      | "" ->  ()
44
      | main_node -> (
45
	match Machine_code.get_machine_opt main_node machines with
46
	| None -> Format.eprintf "Unable to find a main node named %s@.@?" main_node; 
47
	  ()
48
	| Some _ -> C_backend_makefile.print_makefile basename !Options.main_node dependencies makefile_fmt
49
      )
50

    
51
(* Local Variables: *)
52
(* compile-command:"make -C ../../.." *)
53
(* End: *)