-
Notifications
You must be signed in to change notification settings - Fork 5
/
gnatmake.tc.in
215 lines (184 loc) · 8.83 KB
/
gnatmake.tc.in
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#
# Toolchain sub-Makefile (ADAC/GNATMAKE compiler switches)
#
#
# Environment variables:
# EXEEXT
# TOOLCHAIN_PROGRAM_PREFIX
# RTS_PATH
# ADAC_*
# AS_*
# CC_*
# GNATBIND_*
# GNATMAKE_*
# ENABLE_SPLIT_DWARF
# OPTIMIZATION_LEVEL
# CONFIGURE_DEPS
# VERBOSE
#
################################################################################
# #
# GNATMAKE and fundamental switches. #
# #
################################################################################
TOOLCHAIN_GNATMAKE := $(TOOLCHAIN_PROGRAM_PREFIX)gnatmake$(EXEEXT)
GNATMAKE := $(TOOLCHAIN_GNATMAKE) --RTS="$(RTS_PATH)"
################################################################################
# #
# Default switches. #
# #
################################################################################
# ADAC
ADAC_SWITCHES_DEFAULT += -nostdinc -nostdlib
ADAC_SWITCHES_DEFAULT += -gnatef # Display full source path name in brief error messages.
ADAC_SWITCHES_DEFAULT += -gnatf # Full error reporting.
ADAC_SWITCHES_DEFAULT += -gnatU # Tag all error messages with the unique string "error:"
#ADAC_SWITCHES_DEFAULT += -gnatu # List units for this compilation.
ADAC_SWITCHES_DEFAULT += -fverbose-asm
# CC
CC_SWITCHES_DEFAULT += -std=c99
CC_SWITCHES_DEFAULT += -fverbose-asm
# GNATMAKE
#GNATMAKE_SWITCHES_DEFAULT += -nostdinc -nostdlib
#GNATMAKE_SWITCHES_DEFAULT += -d # Display compilation progress
GNATMAKE_SWITCHES_DEFAULT += -eL # Follow all symbolic links when processing project files
GNATMAKE_SWITCHES_DEFAULT += -eS # Echo commands to stdout instead of stderr
#GNATMAKE_SWITCHES_DEFAULT += -i # In place. Replace existing ali file, or put it with source
# GNATBIND
ifneq ($(GNATBIND_SECSTACK),)
GNATBIND_SWITCHES_DEFAULT += -D$(GNATBIND_SECSTACK)
endif
################################################################################
# #
# Compiler build switches. #
# #
################################################################################
#
# Code generation.
#
# NOTE: the use of -gnatN is deprecated, the use of -gnatn is preferred
#
ADAC_SWITCHES_DEFAULT += -gnatn # Activate inlining for subprograms for which pragma inline is specified.
ADAC_SWITCHES_DEFAULT += -gnatX # extensions allowed
# dead code removal
ADAC_SWITCHES_DEFAULT += -ffunction-sections -fdata-sections
CC_SWITCHES_DEFAULT += -ffunction-sections -fdata-sections
#
# Debugging switches.
#
AS_SWITCHES_DEFAULT += -g -gdwarf-5
ADAC_SWITCHES_DEFAULT += -g3 -gdwarf-5 -fno-omit-frame-pointer
CC_SWITCHES_DEFAULT += -g3 -gdwarf-5 -fno-omit-frame-pointer
ifeq ($(ENABLE_SPLIT_DWARF),Y)
ADAC_SWITCHES_DEFAULT += -gsplit-dwarf
CC_SWITCHES_DEFAULT += -gsplit-dwarf
endif
#
# Ada Run-Time Checks switches.
#
# __REF__ https://gcc.gnu.org/onlinedocs/gnat_ugn/Run-Time-Checks.html
# NOTE: -gnato and -gnatE are switches required in order to be a "conforming compiler"
# NOTE: -gnatE is not necessary, because GNAT ensure statically that the checks would not fail
# NOTE: -gnato = -gnato1
#
# maximum check settings: -gnato1=ON -gnatp=OFF -fstack-check=ON
# minimum check settings: -gnato1=OFF -gnatp=ON -fstack-check=OFF
#
#ADAC_SWITCHES_DEFAULT += -gnata # pragma Assert enabled (requires s-assert.ads).
ADAC_SWITCHES_DEFAULT += -gnatE # Enables dynamic checks for access-before-elaboration on subprogram calls and generic instantiations.
ADAC_SWITCHES_DEFAULT += -gnato1 # Enable "STRICT" numeric overflow checking.
#ADAC_SWITCHES_DEFAULT += -gnatp # pragma Suppress (All_Checks)
#ADAC_SWITCHES_DEFAULT += -fstack-check # Activates stack overflow checking.
#
# Compilation information switches, stack usage and various functionalities.
#
# NOTE: use combinations of -gnatD -gnatG -gnatL for expanded source form
# NOTE: -gnatD cause creation of .dg files with expanded informations
# re-routed from stdout to these files; gcc-wrapper will create empty
# .expand files
#
ADAC_SWITCHES_DEFAULT += -fdump-ipa-cgraph # .000i.cgraph
ADAC_SWITCHES_DEFAULT += -fdump-rtl-expand # .233r.expand
ADAC_SWITCHES_DEFAULT += -fdump-rtl-dfinish # .313r.dfinish
ADAC_SWITCHES_DEFAULT += -fdump-tree-optimized-graph # .231t.optimized[.dot]
ADAC_SWITCHES_DEFAULT += -fstack-usage # Static Stack Usage Analysis.
ADAC_SWITCHES_DEFAULT += -gnatD # Create expanded source files for source level debugging.
ADAC_SWITCHES_DEFAULT += -gnatG -gnatL # List generated expanded code in source form.
# -gnatR is mutually exclusive with -gnatD
#ADAC_SWITCHES_DEFAULT += -gnatR # Output representation information for declared types and objects.
#ADAC_SWITCHES_DEFAULT += -gnatdp # Generate messages for parser scope stack push/pops
ADAC_SWITCHES_DEFAULT += -gnatdt # Print full tree.
ADAC_SWITCHES_DEFAULT += -gnatd.b # Dump backend types
ADAC_SWITCHES_DEFAULT += -gnatd.j # Generate listing of frontend inlined calls
#
# Ada validity checks.
#
ADAC_SWITCHES_DEFAULT += -gnatVa # All validity Checks.
#ADAC_SWITCHES_DEFAULT += -gnatVc # Validity checks for copies.
#ADAC_SWITCHES_DEFAULT += -gnatVd # Default (RM) validity checks.
#ADAC_SWITCHES_DEFAULT += -gnatVe # Validity checks for elementary components.
#ADAC_SWITCHES_DEFAULT += -gnatVf # Validity checks for floating-point values.
#ADAC_SWITCHES_DEFAULT += -gnatVi # Validity checks for `in` mode parameters.
#ADAC_SWITCHES_DEFAULT += -gnatVm # Validity checks for `in out` mode parameters.
#ADAC_SWITCHES_DEFAULT += -gnatVo # Validity checks for operator and attribute operands.
#ADAC_SWITCHES_DEFAULT += -gnatVp # Validity checks for parameters.
#ADAC_SWITCHES_DEFAULT += -gnatVr # Validity checks for function returns.
#ADAC_SWITCHES_DEFAULT += -gnatVs # Validity checks for subscripts.
#ADAC_SWITCHES_DEFAULT += -gnatVt # Validity checks for tests.
################################################################################
# #
# Basic and fine-grained optimization switches, organized into levels. #
# #
################################################################################
#
# Basic optimization level is -O1. At -O0, GCC generates several function
# calls to "_Unwind_Resume", which is a LibGCC function.
#
OPTIMIZATION_SWITCHES :=
OPTIMIZATION_LEVEL ?= 0
ifeq ($(OPTIMIZATION_LEVEL),0)
OPTIMIZATION_SWITCHES += -O0
else ifeq ($(OPTIMIZATION_LEVEL),1)
OPTIMIZATION_SWITCHES += -O1
#OPTIMIZATION_SWITCHES += -fpeephole2
#OPTIMIZATION_SWITCHES += -frerun-cse-after-loop
else ifeq ($(OPTIMIZATION_LEVEL),2)
OPTIMIZATION_SWITCHES += -O2
# debugging switches already specify "-fno-omit-frame-pointer"
#OPTIMIZATION_SWITCHES += -fomit-frame-pointer
else
$(warning *** Warning: no valid OPTIMIZATION_LEVEL.)
endif
ADAC_SWITCHES_DEFAULT += $(OPTIMIZATION_SWITCHES)
CC_SWITCHES_DEFAULT += $(OPTIMIZATION_SWITCHES)
################################################################################
# #
# Verbosity. #
# #
################################################################################
ifeq ($(VERBOSE),Y)
ADAC_SWITCHES_DEFAULT += -gnatb -gnatv
GNATMAKE_SWITCHES_DEFAULT += -v
else
GNATMAKE_SWITCHES_DEFAULT += -q
endif
################################################################################
# #
# Compiler warning and style switches. #
# #
################################################################################
MAKEFILE_INCLUDE := N
-include gnatmake.wr.in
ifeq ($(MAKEFILE_INCLUDE),Y)
CONFIGURE_DEPS += gnatmake.wr.in
endif
MAKEFILE_INCLUDE := N
-include gnatmake.st.in
ifeq ($(MAKEFILE_INCLUDE),Y)
CONFIGURE_DEPS += gnatmake.st.in
endif
ADAC += $(ADAC_SWITCHES_WARNING) \
$(ADAC_SWITCHES_STYLE)
CC += $(CC_SWITCHES_WARNING)
GNATMAKE += $(ADAC_SWITCHES_WARNING) \
$(ADAC_SWITCHES_STYLE)