-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
hac.gpr
171 lines (143 loc) · 6.09 KB
/
hac.gpr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
127
128
129
130
131
132
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
164
165
166
167
168
169
170
171
-- This is a GNAT, GCC or GNAT Studio project file
-- for the HAC project:
--
-- Home page: http://hacadacompiler.sf.net/
-- Project page: http://sf.net/projects/hacadacompiler/
-- Mirror: https://github.com/zertovitch/hac
-- Alire crate: https://alire.ada.dev/crates/hac
--
-- Build me with "gprbuild -P hac", or "gnatmake -P hac",
-- or open me with GNAT Studio.
--
project HAC is
type HAC_Build_Mode_Type is
("Debug",
"Fast",
"Small",
"Small_Unchecked", -- Smallest size, at the price of less safety. Not for the release binary!
"Profiling");
HAC_Build_Mode : HAC_Build_Mode_Type := external ("HAC_Build_Mode", "Debug");
type HAC_OS_Kind is ("Any", "Linux", "MacOSX", "Win32", "Win64");
HAC_OS : HAC_OS_Kind := external ("HAC_OS", "Any");
for Main use
("hac.adb", -- Principal command-line tool
"hac_mini.adb", -- Minimal version of hac.adb
"hac_multi.adb"); -- Parallel demo with many compilations
case HAC_Build_Mode is
when "Debug" => for Object_Dir use "obj/debug";
when "Fast" => for Object_Dir use "obj/fast";
when "Small" => for Object_Dir use "obj/small";
when "Small_Unchecked" => for Object_Dir use "obj/small_unchecked";
when "Profiling" => for Object_Dir use "obj/profiling";
end case;
for Source_Dirs use
("src", "src/apps", "src/compile", "src/compile/emit", "src/execute", "src/manage");
for Exec_Dir use ".";
for Create_Missing_Dirs use "True"; -- Flips by default the "-p" switch
package Pretty_Printer is
for Default_Switches ("ada") use ("-i2");
end Pretty_Printer;
type HAC_Styles_Checks_Type is ("Off", "On");
HAC_Styles_Checks : HAC_Styles_Checks_Type := external ("HAC_Styles_Checks", "On");
Compiler_Common_Options :=
("-gnatwa", -- Warnings switches (a:turn on all info/warnings marked with +)
"-gnatwh", -- Warnings switches (h:turn on warnings for hiding declarations)
"-gnatwcijkmopruvz.c.p.t.w.x", -- Warnings switches (run "gnatmake" for full list)
"-gnatf", -- Full errors. Verbose details, all undefined references
"-gnatq", -- Don't quit, try semantics, even if parse errors
"-gnatQ", -- Don't quit, write ali/tree file even if compile errors
"-g"); -- Generate debugging information
Style_Checks :=
("-gnatyaknpr", -- Style: check all casings: a:attribute, k:keywords, n:package Standard identifiers, p:pragma, r:identifier references
"-gnatybfhiu", -- Style: check b:no blanks at end of lines, f:no ff/vtabs, h: no htabs, i:if-then layout, u:no unnecessary blank lines
"-gnatyx", -- Style: check x:no extra parens
"-gnatye", -- Style: check e:end/exit labels present
"-gnatytc"); -- Style: check t:token separation rules, c:comment format (two spaces)
case HAC_Styles_Checks is
when "Off" => null;
when "On" => Compiler_Common_Options := Compiler_Common_Options & Style_Checks;
end case;
Compiler_Debug_Options :=
("-gnata", -- Assertions enabled
"-gnato", -- Enable overflow checking in STRICT mode
"-gnatVa", -- Enable all validity checking options
"-fstack-check",
"-fno-inline") &
Compiler_Common_Options;
Compiler_Fast_Options :=
("-O2",
"-gnatpn",
"-fipa-cp-clone",
"-fgcse-after-reload",
"-funroll-loops",
"-fpeel-loops",
"-funswitch-loops",
"-ftracer", "-fweb",
"-ftree-vectorize",
"-frename-registers",
"-ffunction-sections",
"-fdata-sections") &
Compiler_Common_Options;
Compiler_Small_Options :=
("-Os",
"-ffunction-sections",
"-fdata-sections") &
Compiler_Common_Options;
Compiler_Profiling_Options :=
("-O2",
"-gnatp",
"-fno-inline",
"-pg") &
Compiler_Common_Options;
package Compiler is
case HAC_Build_Mode is
when "Fast" =>
for Default_Switches ("ada") use Compiler_Fast_Options;
when "Small" =>
for Default_Switches ("ada") use Compiler_Small_Options;
when "Small_Unchecked" =>
for Default_Switches ("ada") use Compiler_Small_Options & ("-gnatp");
when "Profiling" =>
for Default_Switches ("ada") use Compiler_Profiling_Options;
when "Debug" =>
for Default_Switches ("ada") use Compiler_Debug_Options;
for Local_Configuration_Pragmas use project'Project_Dir & "debug.pra";
end case;
end Compiler;
Binder_Common_Options := ();
case HAC_OS is
when "Linux" =>
Binder_Common_Options := Binder_Common_Options & "-static"; -- Ensures a consistent run-time library
when others =>
end case;
package Binder is
-- -Es: Store tracebacks in exception occurrences, and enable symbolic tracebacks
for Default_Switches ("ada") use Binder_Common_Options & ("-Es");
end Binder;
Linker_Common_Options := ("-g");
case HAC_OS is
when "Linux" =>
Linker_Common_Options := Linker_Common_Options & "-static"; -- Ensures a consistent run-time library
when others =>
end case;
Linker_Small_Options :=
Linker_Common_Options & ("-Wl,--gc-sections");
package Linker is
case HAC_Build_Mode is
when "Debug" =>
for Default_Switches ("ada") use Linker_Common_Options;
when "Profiling" =>
for Default_Switches ("ada") use Linker_Small_Options & ("-pg");
when "Fast" | "Small" | "Small_Unchecked" =>
for Default_Switches ("ada") use Linker_Small_Options;
end case;
end Linker;
package Builder is
-- "If -j0 is used, then the maximum number of simultaneous compilation
-- jobs is the number of core processors on the platform."
for Default_Switches ("ada") use ("-j0");
end Builder;
package Ide is
for Default_Switches ("adacontrol") use ("-f", "test/verif_hac.aru", "-r");
end Ide;
end HAC;