ocarina-backends-build_utils.ads 5.87 KB
Newer Older
1 2 3 4 5 6 7 8
------------------------------------------------------------------------------
--                                                                          --
--                           OCARINA COMPONENTS                             --
--                                                                          --
--         O C A R I N A . B A C K E N D S . B U I L D _ U T I L S          --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
--    Copyright (C) 2008-2009 Telecom ParisTech, 2010-2015 ESA & ISAE.      --
--                                                                          --
-- Ocarina  is free software; you can redistribute it and/or modify under   --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
-- sion. Ocarina is distributed in the hope that it will be useful, but     --
-- WITHOUT ANY WARRANTY; without even the implied warranty of               --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     --
--                                                                          --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception,   --
-- version 3.1, as published by the Free Software Foundation.               --
--                                                                          --
-- You should have received a copy of the GNU General Public License and    --
-- a copy of the GCC Runtime Library Exception along with this program;     --
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-- <http://www.gnu.org/licenses/>.                                          --
26
--                                                                          --
jhugues's avatar
jhugues committed
27 28
--                 Ocarina is maintained by the TASTE project               --
--                      (taste-users@lists.tuxfamily.org)                   --
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
--                                                                          --
------------------------------------------------------------------------------

--  This package gathers all the necessary routines to generate
--  makefiles, Ada project files or what ever seems (in the future)
--  necessary to make the build of a generated application simple. It
--  consists of several nested packages that contain mainly a couple
--  of procedures:

--  "Visit" which is a classical visitor that traverses the AADL
--  instance tree and defines the structure of the corresponding
--  entity that will be generated.

--  "Generate" which dumps the internal structure corresponding to a
--  given node into a file.

with GNAT.Dynamic_Tables;
with Ocarina.Backends.Properties;

package Ocarina.Backends.Build_Utils is

   use Ocarina.Backends.Properties;

   package Name_Tables is new GNAT.Dynamic_Tables (Name_Id, Nat, 1, 10, 10);
   --  Provides a flexible Name_Id list
   function Length (T : Name_Tables.Instance) return Int;
   --  Return the length of a name table

   function Get_Runtime_Path (Runtime_Name : String) return String;
   --  Return the directory path to the given runtime

   ----------------------------------
   -- Makefile generation routines --
   ----------------------------------

   package Makefiles is
      procedure Visit (E : Node_Id);

      generic
         with procedure Generate_Runtime_Specific
69 70
           (Appli_Name              : Name_Id;
            Node_Name               : Name_Id;
71
            Execution_Platform : Supported_Execution_Platform := Platform_None;
yoogx's avatar
yoogx committed
72
            Execution_Platform_Name : Name_Id;
73 74
            USER_CFLAGS             : Name_Id;
            USER_LDFLAGS            : Name_Id;
75 76 77 78 79 80 81 82 83 84 85 86
            Transport_API           : Supported_Transport_APIs;
            Ada_Sources             : Name_Tables.Instance;
            Asn_Sources             : Name_Tables.Instance;
            C_Sources               : Name_Tables.Instance;
            C_Libraries             : Name_Tables.Instance;
            User_Source_Dirs        : Name_Tables.Instance;
            Use_Transport           : Boolean;
            Use_Simulink            : Boolean;
            Simulink_Directory      : Name_Id;
            Simulink_Node           : Name_Id;
            Use_Scade               : Boolean;
            Scade_Directory         : Name_Id);
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
         --  Generate the part of the Makefile that is specific to
         --  the corresponding runtime.

      procedure Generate (E : Node_Id);
      procedure Build (E : Node_Id);
      procedure Clean (E : Node_Id);

      procedure Reset;
      --  Deallocates the internals of this package

   end Makefiles;

   ------------------------------------------
   -- Ada project file generation routines --
   ------------------------------------------

   package Ada_Project_Files is

      procedure Visit (E : Node_Id);

      generic
         with procedure Generate_Runtime_Specific
           (Appli_Name         : Name_Id;
            Node_Name          : Name_Id;
            Is_Server          : Boolean;
            Execution_Platform : Supported_Execution_Platform;
113
            Ada_Runtime        : Name_Id;
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
            Transport_API      : Supported_Transport_APIs;
            Spec_Names         : Name_Tables.Instance;
            Custom_Spec_Names  : Name_Tables.Instance;
            Body_Names         : Name_Tables.Instance;
            Custom_Body_Names  : Name_Tables.Instance;
            User_Source_Dirs   : Name_Tables.Instance);

      procedure Generate (E : Node_Id);

      procedure Reset;
      --  Deallocates the internals of this package

   end Ada_Project_Files;

   procedure Reset;
   --  Deallocate all the internal data

end Ocarina.Backends.Build_Utils;