Natools

natools.gpr at [bb325e8d12]
Login

File natools.gpr artifact 15b76671a5 part of check-in bb325e8d12


project Natools is
   type Build_Type is ("Release", "Coverage", "Profiling");
   Mode : Build_Type := external ("MODE", "Release");

   type Task_Safety is ("None", "Portable", "Intel");
      --  Task-safe, portable, efficient: choose two
   Safety : Task_Safety := external ("TASK_SAFETY", "None");

   Prefix := "";
   Extra_Switches := ();

   case Mode is
      when "Release" =>
         Prefix := "";
      when "Coverage" =>
         Prefix := "coverage/";
      when "Profiling" =>
         Prefix := "profiling/";
   end case;

   --  Source_Dirs is left to default "."
   for Source_Dirs use ("src", "generated");
   for Object_Dir use Prefix & "obj";
   for Exec_Dir use Prefix & "bin";

   case Mode is
      when "Release" =>
         Extra_Switches := ("-O3");
      when "Coverage" =>
         Extra_Switches :=
           ("-g", "-O0", "-fprofile-arcs", "-ftest-coverage");
      when "Profiling" =>
         Extra_Switches := ("-O3", "-g", "-pg");
   end case;


   package Compiler is
      for Default_Switches ("Ada") use
        ("-gnatafnovy",
            --  a: assersions enabled
            --  f: full errors (verbose details and all undefined references)
            --  n: enable pragma Inline
            --  o: overflow checking
            --  v: verbose mode
            --  y: enable default style checks, currently equivalent to:
            --     3: 3-space indentation
            --     a: attribute casing
            --     b: no blanks at end of lines
            --     c: comment format
            --     e: end/exit labels
            --     f: no form feed or vertical tab
            --     h: no horizontal tab
            --     i: if-then layout
            --     k: casing rules for keywords
            --     l: reference manual layout
            --     m: line lgnth <= 79 characters
            --     n: casing of package Standard identifiers
            --     p: pragma casing
            --     r: casing for identifier references
            --     s: presence of subprogram specs
            --     t: token separation rules
         "-gnateE",
            --  generate extra information in exception messages
         "-gnatwae",
            --  a: turn on most warnings
            --  e: treat all warnings as errors
         "-fstack-check")
        & Extra_Switches;
   end Compiler;

   package Linker is
      for Default_Switches ("Ada") use Extra_Switches;
   end Linker;

   package Naming is
      case Safety is
         when "None" =>
            for spec ("Natools.References")
              use "natools-references__unsafe.ads";
            for body ("Natools.References")
              use "natools-references__unsafe.adb";
         when "Portable" =>
            for spec ("Natools.References")
              use "natools-references__protected.ads";
            for body ("Natools.References")
              use "natools-references__protected.adb";
         when "Intel" =>
            for spec ("Natools.References")
              use "natools-references__intel.ads";
            for body ("Natools.References")
              use "natools-references__intel.adb";
      end case;
   end Naming;
end Natools;