-
Notifications
You must be signed in to change notification settings - Fork 1
/
target_options.gpr
69 lines (62 loc) · 2.4 KB
/
target_options.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
-- This is the default version of the target_options.gpr file,
-- imported by runtime_build.gpr. Variables defined here are appended
-- to the corresponding variables there. Target configurations may
-- their own version of this file.
abstract project Target_Options is
type Build_Type is ("Production", "Debug", "Assert", "Gnatcov");
Build : Build_Type := external ("BUILD", "Production");
type Lib_Type is ("static", "dynamic");
Lib : Lib_Type := external ("LIBRARY_TYPE", "static");
-- GNAT version string
Version := "25";
-- COMFLAGS here is common flags (used for C and Ada).
COMFLAGS := ("-ffunction-sections",
"-fdata-sections",
"-fcallgraph-info=su,da", "-mlongcalls");
COMGNARLFLAGS := ("");
COMDEBUGFLAGS := ("-g");
-- Per language flags (COMFLAGS will be added later)
ADAFLAGS := ("-gnatg", "-nostdinc", "-fno-delete-null-pointer-checks");
ASMFLAGS := ("");
CFLAGS := ("-DIN_RTS",
"-Dinhibit_libc",
"-DLIGHT_RUNTIME", "-Werror", "-Wall");
case Build is
when "Production" =>
-- Optimize
COMFLAGS := COMFLAGS & ("-O2");
ADAFLAGS := ADAFLAGS & ("-gnatp", "-gnatn2");
when "Debug" =>
-- Disable optimization and add debug symbols
COMFLAGS := COMFLAGS & COMDEBUGFLAGS & ("-O0");
ASMFLAGS := ASMFLAGS & COMDEBUGFLAGS;
when "Assert" =>
-- Possibly enable assertions. This might use too much memory on
-- some systems or could be too slow.
COMFLAGS := COMFLAGS & ("-O");
ADAFLAGS := ADAFLAGS & ("-gnata");
when "Gnatcov" =>
-- For coverage
COMFLAGS := COMFLAGS & COMDEBUGFLAGS &
("-O0", "-fdump-scos", "-fpreserve-control-flow");
end case;
-- Linker flags, used for building shared libraries
LOPTIONS := ();
case Lib is
when "static" =>
null;
when "dynamic" =>
-- -nostdlib is required for building the
-- shared library. Otherwise it tries to
-- link against libgnat (itself).
-- Since -nostdlib also removes libgcc
-- from the linked libraries we have to
-- add -lgcc again.
LOPTIONS := LOPTIONS & ("-nostdlib", "-lgcc");
end case;
-- Concatenate with common flags
ALL_ADAFLAGS := ADAFLAGS & COMFLAGS;
ALL_CFLAGS := CFLAGS & COMFLAGS;
GNARL_ADAFLAGS := ALL_ADAFLAGS & COMGNARLFLAGS;
GNARL_CFLAGS := ALL_CFLAGS & COMGNARLFLAGS;
end Target_Options;