polyorb_hi.gpr.in 7.92 KB
Newer Older
1 2 3 4 5 6 7 8
------------------------------------------------------------------------------
--                                                                          --
--                          PolyORB HI COMPONENTS                           --
--                                                                          --
--                           P O L Y O R B _ H I                            --
--                                                                          --
--                              P r o j e c t                               --
--                                                                          --
9
--    Copyright (C) 2007-2009 Telecom ParisTech, 2010-2017 ESA & ISAE.      --
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
--                                                                          --
-- PolyORB-HI 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. PolyORB-HI 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/>.                                          --
--                                                                          --
--              PolyORB-HI/Ada is maintained by the TASTE project           --
--                      (taste-users@lists.tuxfamily.org)                   --
29 30 31 32 33
--                                                                          --
------------------------------------------------------------------------------

project PolyORB_HI is

34
   type Target_Type is
35 36
   ("NATIVE", "LEON_ORK", "LEON_GNAT", "ERC32", "MARTEOS", "GNAT_Runtime",
    "RTEMS");
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
   Target : Target_Type := external ("TARGET", "NATIVE");

   type Build_Type is ("Debug", "Release", "Analyzable");
   Build : Build_Type := external ("BUILD", "Debug");

   type Call_Graph_Control is ("Yes", "No");
   CG_Control : Call_Graph_Control := external ("CGCTRL", "No");

   for Languages use ("Ada");

   for Source_Dirs use ();
   for Object_Dir use ".";
   for Exec_Dir use ".";

   --------------
   -- Compiler --
   --------------

   Common_Options := (
                      "-gnatwa",  --  All warnings are displayed
                      --  The flags below are activated only in debug
                      --  mode. In release mode, we do not want
                      --  warnings to be errors. The flags below
                      --  should not be the last flags given to
                      --  Common_Options.
62 63
                      --@WARNINGS_ARE_ERRORS@"-gnatfy", --  Style warnings
                      --@WARNINGS_ARE_ERRORS@"-gnatwe", --  Warnings are errors
64
                      "-gnatwG", -- Suppress warnings on unrecognized pragmas
yoogx's avatar
yoogx committed
65
                      "-gnat12"  --  Ada 2012 mode
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
                     );

   Debug_Options := (
                     "-g",        --  Debug information
                     "-O1",       --  Optimisation level 1
                     "-gnata",    --  pragma Debug and Assert activated
                     "-gnato"     --  Overflow checks enabled
                    );

   Output_CG := "-fcallgraph-info=su";
   --  Generate call graph informations for GNATStack

   Release_Options := (
                       "-gnatp"   --  Suppress all checks
                      );

   Analyze_Options := (
		       "-g",        --  Debug information
84
                       "-O1",       --  Optimisation level 1
85 86 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 113 114 115 116 117 118 119 120 121 122 123 124 125 126
                       "-gnatp"   --  Suppress all checks
                      );

   package Compiler is
      case Build is
         when "Debug" =>
            --  Some Ada compilers do not support the call graph
            --  output useful for GNATStack.

            case CG_Control is
               when "Yes" =>
                  case Target is
                     when "LEON_GNAT" =>
                        for Default_Switches ("Ada") use
                          Common_Options & Debug_Options & Output_CG
                           & "-fpreserve-control-flow";
                     when others =>
                        for Default_Switches ("Ada") use
                          Common_Options & Debug_Options & Output_CG;
                  end case;
               when "No" =>
                  case Target is
                     when "LEON_GNAT" =>
                        for Default_Switches ("Ada") use
                          Common_Options & Debug_Options
                           & "-fpreserve-control-flow";
                     when others =>
                        for Default_Switches ("Ada") use
                          Common_Options & Debug_Options;
                  end case;
            end case;

         when "Release" =>
            for Default_Switches ("Ada") use Common_Options & Release_Options;

	 when "Analyzable" =>
            for Default_Switches ("Ada") use Common_Options & Analyze_Options;
       end case;

      case Target is
        when "NATIVE" | "MARTEOS" =>
           for Local_Configuration_Pragmas use "native.adc";
127

128
        when "LEON_ORK" | "LEON_GNAT" | "ERC32" | "RTEMS" =>
129
           for Local_Configuration_Pragmas use "hi-e.adc";
130 131

        when "GNAT_Runtime" =>
132
           for Local_Configuration_Pragmas use "gnat_runtime.adc";
133

134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
      end case;
   end Compiler;

   -------------
   -- Builder --
   -------------

   package Builder is
      case Build is
         when "Debug" =>
            for Default_Switches ("Ada") use ("-s", "-m", "-g");

         when "Release" =>
            --  In Release mode, we build all the program from scratch
            --  to suppress debug information and all checks even from
            --  the Ada and GNAT runtimes.

            for Default_Switches ("Ada") use ("-a", "-f", "-x");

         when "Analyzable" =>
            for Default_Switches ("Ada") use ("-a", "-f", "-x");

       end case;
   end Builder;

   ------------
   -- Binder --
   ------------

   package Binder is
yoogx's avatar
yoogx committed
164 165 166
      for Default_Switches ("ada") use
        ("-r",
         "-T0" -- Force time slice to 0,
167 168
               -- see A.3 of GNAT user Manual for more details
        );
169 170 171 172 173 174 175 176 177
   end Binder;

   ------------
   -- Linker --
   ------------

   package Linker is
      case Build is
         when "Debug" =>
178 179 180 181 182 183 184
            case Target is
               when "GNAT_Runtime" =>
                  --  For GNAT runtimes, we clean up unused symbols.
                  --  Unfortunately, this does not work for macOS
                  --  because of clang linker.

                  for Default_Switches ("ada") use ("-g", "-Wl,--gc-sections");
185 186

	        when others =>
187 188 189
                  for Default_Switches ("ada") use ("-g");
            end case;

190
         when "Release" | "Analyzable" =>
191
	     null;
192 193 194 195 196 197 198 199 200 201 202 203 204
      end case;
   end Linker;

   -----------
   -- Check --
   -----------

   package Check is
      for Default_Switches ("ada") use
          ("-rules", "-ALL", "+RGoto", "+RSlices",
           "+RDecl_Blocks", "+RDiscr_Rec", "+RContr_Types");
   end Check;

yoogx's avatar
yoogx committed
205 206 207 208 209 210
   -----------
   -- Prove --
   -----------

   package Prove is
      for Switches use
yoogx's avatar
yoogx committed
211 212
          ("--warnings=continue", -- Issue warnings and continue
           "--report=all"         -- Report all results of proving VCs
yoogx's avatar
yoogx committed
213 214 215
           );
   end Prove;

216
end PolyORB_HI;