Skip to content

Commit 45b9d08

Browse files
committed
Build with alire
1 parent 25c8e63 commit 45b9d08

File tree

5 files changed

+45
-79
lines changed

5 files changed

+45
-79
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
obj
21
gpr2ld
32
gnatinspect.db
43
spec-loc.xml
@@ -9,3 +8,7 @@ testsuite/**/linker.ld
98
doc/_build
109
startup-gen
1110
database
11+
/obj/
12+
/bin/
13+
/alire/
14+
/config/

alire.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name = "startup_gen"
2+
description = "Start files generator"
3+
version = "23.0.0"
4+
5+
authors = [
6+
"Anthony Leonardo Gracio <[email protected]>",
7+
"Corentin Gay <[email protected]>",
8+
"Fabien Chouteau <[email protected]>",
9+
"Frederic Konrad <[email protected]>",
10+
11+
"Joel Brobecker <[email protected]>",
12+
"Martyn Pike <[email protected]>",
13+
"pat-rogers <[email protected]>",
14+
]
15+
maintainers = ["Fabien Chouteau <[email protected]>"]
16+
maintainers-logins = ["JeremyGrosser"]
17+
licenses = "GPL-3.0-or-later"
18+
website = ""
19+
tags = []
20+
21+
executables = ["startup_gen"]
22+
23+
[[depends-on]]
24+
gnatcoll = "^23.0.0"
25+
26+
[[depends-on]]
27+
templates_parser = "^23.0.0"

src/device.adb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ package body Device is
134134
return "armv7e-m";
135135
elsif Match ("^(light|zfp)-cortex-m(23|33)(f|d|fd)?$") then
136136
return "armv8-m";
137-
elsif Match ("^(light|zfp)-(riscv|risc-v|rv)(32|64|128)?[imafdgqlcjtpvnh]*$") then
137+
elsif Match
138+
("^(light|zfp)-(riscv|risc-v|rv)(32|64|128)?[imafdgqlcjtpvnh]*$")
139+
then
138140
return "risc-v";
139141
end if;
140142

src/main.adb renamed to src/startup_gen.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ with Setup;
2828
with Utils;
2929
with Device; use Device;
3030

31-
procedure Main is
31+
procedure Startup_Gen is
3232

3333
use GNAT.Strings;
3434

@@ -107,4 +107,4 @@ exception
107107
("Project file """ & Input.Project_File.all & """ not found.");
108108
when Utils.Exit_Exc => null;
109109

110-
end Main;
110+
end Startup_Gen;

startup_gen.gpr

Lines changed: 9 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,19 @@
1-
with "templates_parser.gpr";
2-
with "gnatcoll";
3-
with "gpr";
4-
1+
with "config/startup_gen_config.gpr";
52
project Startup_Gen is
63

7-
for Languages use ("Ada");
8-
for Source_Dirs use ("src");
9-
for Main use ("main.adb");
10-
for Object_Dir use "obj/";
11-
for Exec_Dir use ".";
4+
for Source_Dirs use ("src/", "config/");
5+
for Object_Dir use "obj/" & Startup_Gen_Config.Build_Profile;
126
for Create_Missing_Dirs use "True";
13-
14-
15-
type Enabled_Kind is ("enabled", "disabled");
16-
Compile_Checks : Enabled_Kind := External ("STARTUP_GEN_COMPILE_CHECKS", "disabled");
17-
Runtime_Checks : Enabled_Kind := External ("STARTUP_GEN_RUNTIME_CHECKS", "enabled");
18-
Style_Checks : Enabled_Kind := External ("STARTUP_GEN_STYLE_CHECKS", "disabled");
19-
Contracts_Checks : Enabled_Kind := External ("STARTUP_GEN_CONTRACTS", "enabled");
20-
21-
type Build_Kind is ("debug", "optimize");
22-
Build_Mode : Build_Kind := External ("STARTUP_GEN_BUILD_MODE", "optimize");
23-
24-
Compile_Checks_Switches := ();
25-
case Compile_Checks is
26-
when "enabled" =>
27-
Compile_Checks_Switches :=
28-
("-gnatwa", -- All warnings
29-
"-gnatVa", -- All validity checks
30-
"-gnatwe"); -- Warnings as errors
31-
when others => null;
32-
end case;
33-
34-
Runtime_Checks_Switches := ();
35-
case Runtime_Checks is
36-
when "enabled" => null;
37-
when others =>
38-
Runtime_Checks_Switches :=
39-
("-gnatp"); -- Supress checks
40-
end case;
41-
42-
Style_Checks_Switches := ();
43-
case Style_Checks is
44-
when "enabled" => null;
45-
Style_Checks_Switches :=
46-
("-gnatyg", -- Style checks
47-
"-gnatyM80", -- Maximum line length
48-
"-gnatyO"); -- Overriding subprograms explicitly marked as such
49-
when others => null;
50-
end case;
51-
52-
Contracts_Switches := ();
53-
case Contracts_Checks is
54-
when "enabled" => null;
55-
Contracts_Switches :=
56-
("-gnata"); -- Enable assertions and contracts
57-
when others =>
58-
end case;
59-
60-
Build_Switches := ();
61-
case Build_Mode is
62-
when "optimize" =>
63-
Build_Switches := ("-O3", -- Optimization
64-
"-gnatn"); -- Enable inlining
65-
when "debug" =>
66-
Build_Switches := ("-g", -- Debug info
67-
"-O0"); -- No optimization
68-
end case;
7+
for Exec_Dir use "bin";
8+
for Main use ("startup_gen.adb");
699

7010
package Compiler is
71-
for Default_Switches ("Ada") use
72-
Compile_Checks_Switches &
73-
Build_Switches &
74-
Runtime_Checks_Switches &
75-
Style_Checks_Switches &
76-
Contracts_Switches &
77-
("-gnatQ"); -- Don't quit. Generate ALI and tree files even if illegalities
11+
for Default_Switches ("Ada") use Startup_Gen_Config.Ada_Compiler_Switches;
7812
end Compiler;
7913

80-
package Builder is
81-
for Executable ("main.adb") use "startup-gen";
82-
end Builder;
14+
package Binder is
15+
for Switches ("Ada") use ("-Es"); -- Symbolic traceback
16+
end Binder;
8317

8418
package Install is
8519
for Artifacts (".") use ("share");

0 commit comments

Comments
 (0)