|
| 1 | +project BLAKE2S is |
| 2 | + |
| 3 | + for Library_Name use "b2sa"; |
| 4 | + for Library_Version use "0.1.0"; |
| 5 | + |
| 6 | + type Library_Type_Type is ("relocatable", "static", "static-pic"); |
| 7 | + Library_Type : Library_Type_Type := |
| 8 | + external ("BLAKE2S_LIBRARY_TYPE", external ("LIBRARY_TYPE", "static")); |
| 9 | + for Library_Kind use Library_Type; |
| 10 | + |
| 11 | + for Source_Dirs use ("gnat", "common"); |
| 12 | + for Object_Dir use "gnat/sobj"; |
| 13 | + for Library_Dir use "gnat/slib"; |
| 14 | + for Create_Missing_Dirs use "True"; |
| 15 | + |
| 16 | + type Enabled_Kind is ("enabled", "disabled"); |
| 17 | + Compile_Checks : Enabled_Kind := |
| 18 | + External ("BLAKE2S_COMPILE_CHECKS", "enabled"); |
| 19 | + Runtime_Checks : Enabled_Kind := |
| 20 | + External ("BLAKE2S_RUNTIME_CHECKS", "enabled"); |
| 21 | + Style_Checks : Enabled_Kind := |
| 22 | + External ("BLAKE2S_STYLE_CHECKS", "enabled"); |
| 23 | + Contracts_Checks : Enabled_Kind := |
| 24 | + External ("BLAKE2S_CONTRACTS", "enabled"); |
| 25 | + |
| 26 | + type Build_Kind is ("debug", "optimize"); |
| 27 | + Build_Mode : Build_Kind := External ("BLAKE2S_BUILD_MODE", "debug"); |
| 28 | + |
| 29 | + Compile_Checks_Switches := (); |
| 30 | + case Compile_Checks is |
| 31 | + when "enabled" => |
| 32 | + Compile_Checks_Switches := |
| 33 | + ("-gnatVa", -- All validity checks |
| 34 | + "-gnatk8", -- 8.3 file names |
| 35 | + "-gnatwa", -- All warnings |
| 36 | + "-gnatwe"); -- Warnings as errors |
| 37 | + when others => null; |
| 38 | + end case; |
| 39 | + |
| 40 | + Runtime_Checks_Switches := (); |
| 41 | + case Runtime_Checks is |
| 42 | + when "enabled" => null; |
| 43 | + when others => |
| 44 | + Runtime_Checks_Switches := |
| 45 | + ("-gnatp"); -- Suppress checks |
| 46 | + end case; |
| 47 | + |
| 48 | + Style_Checks_Switches := (); |
| 49 | + case Style_Checks is |
| 50 | + when "enabled" => |
| 51 | + Style_Checks_Switches := |
| 52 | + ("-gnaty3abcdefhiklM78nprtux"); |
| 53 | + when others => null; |
| 54 | + end case; |
| 55 | + |
| 56 | + Contracts_Switches := (); |
| 57 | + case Contracts_Checks is |
| 58 | + when "enabled" => |
| 59 | + Contracts_Switches := |
| 60 | + ("-gnata"); -- Enable assertions and contracts |
| 61 | + when others => null; |
| 62 | + end case; |
| 63 | + |
| 64 | + Build_Switches := (); |
| 65 | + case Build_Mode is |
| 66 | + when "optimize" => |
| 67 | + Build_Switches := ("-O3", -- Optimization |
| 68 | + "-gnatN"); -- Enable inlining |
| 69 | + when "debug" => |
| 70 | + Build_Switches := ("-g", -- Debug info |
| 71 | + "-Og"); -- No optimization |
| 72 | + end case; |
| 73 | + |
| 74 | + package Compiler is |
| 75 | + for Default_Switches ("Ada") use |
| 76 | + Compile_Checks_Switches & |
| 77 | + Build_Switches & |
| 78 | + Runtime_Checks_Switches & |
| 79 | + Style_Checks_Switches & |
| 80 | + Contracts_Switches; |
| 81 | + end Compiler; |
| 82 | + |
| 83 | + package Binder is |
| 84 | + for Switches ("Ada") use ("-Es"); -- Symbolic traceback |
| 85 | + end Binder; |
| 86 | + |
| 87 | +end BLAKE2S; |
0 commit comments