]>
Commit | Line | Data |
---|---|---|
5395b47b | 1 | # Makefile for gnattools |
455c8f48 | 2 | # Copyright 2003, 2004, 2009, 2010 Free Software Foundation, Inc. |
5395b47b NN |
3 | # |
4 | # This file is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
748086b7 | 6 | # the Free Software Foundation; either version 3 of the License, or |
5395b47b NN |
7 | # (at your option) any later version. |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
748086b7 JJ |
15 | # along with this program; see the file COPYING3. If not see |
16 | # <http://www.gnu.org/licenses/>. | |
5395b47b NN |
17 | |
18 | # Default target; must be first. | |
19 | all: gnattools | |
20 | ||
21 | # Standard autoconf-set variables. | |
22 | SHELL = @SHELL@ | |
23 | srcdir = @srcdir@ | |
47ad7893 | 24 | libdir = @libdir@ |
5395b47b NN |
25 | build = @build@ |
26 | target = @target@ | |
27 | prefix = @prefix@ | |
28 | INSTALL = @INSTALL@ | |
29 | INSTALL_DATA = @INSTALL_DATA@ | |
30 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
31 | ||
32 | # Nonstandard autoconf-set variables. | |
33 | LN_S=@LN_S@ | |
34 | target_noncanonical=@target_noncanonical@ | |
35 | ||
36 | # Variables for the user (or the top level) to override. | |
47ad7893 | 37 | exeext = @EXEEXT@ |
5395b47b NN |
38 | objext=.o |
39 | TRACE=no | |
40 | ADA_FOR_BUILD= | |
41 | ADA_FOR_TARGET= | |
42 | LDFLAGS= | |
5395b47b NN |
43 | PWD_COMMAND = $${PWDCMD-pwd} |
44 | ||
45 | # The tedious process of getting CFLAGS right. | |
46 | CFLAGS=-g | |
0cfaf83f | 47 | GCC_WARN_CFLAGS = -W -Wall |
47ad7893 | 48 | WARN_CFLAGS = @warn_cflags@ |
5395b47b | 49 | |
00afcaa0 | 50 | ADA_CFLAGS=@ADA_CFLAGS@ |
5395b47b NN |
51 | |
52 | # Variables for gnattools. | |
53 | ADAFLAGS= -gnatpg -gnata | |
5395b47b NN |
54 | |
55 | # For finding the GCC build dir, which is used far too much | |
56 | GCC_DIR=../gcc | |
5395b47b | 57 | |
a760c977 AS |
58 | # Absolute srcdir for gcc (why do we want absolute? I dunno) |
59 | fsrcdir := $(shell cd $(srcdir)/../gcc/; ${PWD_COMMAND}) | |
5395b47b NN |
60 | |
61 | # Useful "subroutines" for the excess includes | |
a760c977 AS |
62 | INCLUDES_FOR_SUBDIR = -I. -I.. -I../.. -I$(fsrcdir)/ada -I$(fsrcdir)/config \ |
63 | -I$(fsrcdir)/../include -I$(fsrcdir) | |
64 | ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada | |
5395b47b | 65 | |
0cfaf83f EB |
66 | # Variables for gnattools, native |
67 | TOOLS_FLAGS_TO_PASS_NATIVE= \ | |
5395b47b NN |
68 | "CC=../../xgcc -B../../" \ |
69 | "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ | |
70 | "LDFLAGS=$(LDFLAGS)" \ | |
71 | "ADAFLAGS=$(ADAFLAGS)" \ | |
00afcaa0 | 72 | "ADA_CFLAGS=$(ADA_CFLAGS)" \ |
5395b47b NN |
73 | "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ |
74 | "ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\ | |
75 | "exeext=$(exeext)" \ | |
76 | "fsrcdir=$(fsrcdir)" \ | |
77 | "srcdir=$(fsrcdir)" \ | |
0cfaf83f EB |
78 | "GNATMAKE=../../gnatmake" \ |
79 | "GNATLINK=../../gnatlink" \ | |
5395b47b NN |
80 | "GNATBIND=../../gnatbind" \ |
81 | "TOOLSCASE=native" | |
82 | ||
83 | # Variables for regnattools | |
0cfaf83f | 84 | TOOLS_FLAGS_TO_PASS_RE= \ |
5395b47b NN |
85 | "CC=../../xgcc -B../../" \ |
86 | "CFLAGS=$(CFLAGS)" \ | |
87 | "ADAFLAGS=$(ADAFLAGS)" \ | |
00afcaa0 | 88 | "ADA_CFLAGS=$(ADA_CFLAGS)" \ |
5395b47b NN |
89 | "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ |
90 | "ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\ | |
91 | "exeext=$(exeext)" \ | |
92 | "fsrcdir=$(fsrcdir)" \ | |
93 | "srcdir=$(fsrcdir)" \ | |
94 | "GNATMAKE=../../gnatmake" \ | |
95 | "GNATLINK=../../gnatlink" \ | |
96 | "GNATBIND=../../gnatbind" \ | |
0cfaf83f | 97 | "TOOLSCASE=cross" |
5395b47b NN |
98 | |
99 | # Variables for gnattools, cross | |
100 | TOOLS_FLAGS_TO_PASS_CROSS= \ | |
101 | "CC=$(CC)" \ | |
102 | "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ | |
103 | "LDFLAGS=$(LDFLAGS)" \ | |
104 | "ADAFLAGS=$(ADAFLAGS)" \ | |
00afcaa0 | 105 | "ADA_CFLAGS=$(ADA_CFLAGS)" \ |
5395b47b NN |
106 | "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ |
107 | "ADA_INCLUDES=-I$(RTS_DIR)../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \ | |
108 | "exeext=$(exeext)" \ | |
109 | "fsrcdir=$(fsrcdir)" \ | |
110 | "srcdir=$(fsrcdir)" \ | |
111 | "GNATMAKE=gnatmake" \ | |
112 | "GNATLINK=gnatlink" \ | |
113 | "GNATBIND=gnatbind" \ | |
114 | "TOOLSCASE=cross" \ | |
115 | "LIBGNAT=" | |
116 | ||
117 | # File lists | |
118 | # ---------- | |
119 | ||
120 | # File associations set by configure | |
121 | EXTRA_GNATTOOLS = @EXTRA_GNATTOOLS@ | |
122 | TOOLS_TARGET_PAIRS = @TOOLS_TARGET_PAIRS@ | |
123 | ||
5395b47b NN |
124 | # Makefile targets |
125 | # ---------------- | |
126 | ||
127 | .PHONY: gnattools gnattools-native gnattools-cross regnattools | |
128 | gnattools: @default_gnattools_target@ | |
129 | ||
130 | # Sanity check | |
a7dafa20 LG |
131 | $(GCC_DIR)/stamp-gnatlib-rts: |
132 | @if [ ! -f $(GCC_DIR)/stamp-gnatlib-rts ] ; \ | |
5395b47b | 133 | then \ |
ab743bf6 | 134 | echo "Cannot build gnattools while gnatlib is out of date or unbuilt" ; \ |
5395b47b NN |
135 | false; \ |
136 | else \ | |
137 | true; \ | |
138 | fi | |
139 | ||
140 | ||
141 | # Build directory for the tools. Let's copy the target-dependent | |
142 | # sources using the same mechanism as for gnatlib. The other sources are | |
143 | # accessed using the vpath directive in ada/Makefile.in | |
144 | ||
145 | $(GCC_DIR)/stamp-tools: | |
146 | -rm -rf $(GCC_DIR)/ada/tools | |
147 | -mkdir -p $(GCC_DIR)/ada/tools | |
b62a90f2 | 148 | -(cd $(GCC_DIR)/ada/tools; $(LN_S) ../sdefault.adb ../snames.ads ../snames.adb .) |
5395b47b NN |
149 | -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \ |
150 | rm -f $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));\ | |
676fd528 | 151 | $(LN_S) $(fsrcdir)/ada/$(word 2,$(subst <, ,$(PAIR))) \ |
5395b47b NN |
152 | $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));) |
153 | touch $(GCC_DIR)/stamp-tools | |
154 | ||
155 | # gnatmake/link tools cannot always be built with gnatmake/link for bootstrap | |
156 | # reasons: gnatmake should be built with a recent compiler, a recent compiler | |
157 | # may not generate ALI files compatible with an old gnatmake so it is important | |
158 | # to be able to build gnatmake without a version of gnatmake around. Once | |
159 | # everything has been compiled once, gnatmake can be recompiled with itself | |
160 | # (see target regnattools) | |
a7dafa20 | 161 | gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib-rts |
5395b47b NN |
162 | # gnattools1 |
163 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
0cfaf83f | 164 | $(TOOLS_FLAGS_TO_PASS_NATIVE) \ |
7053a60f | 165 | ../../gnatmake$(exeext) ../../gnatlink$(exeext) |
5395b47b NN |
166 | # gnattools2 |
167 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
eede5a0d | 168 | $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools |
5395b47b NN |
169 | |
170 | # gnatmake/link can be built with recent gnatmake/link if they are available. | |
171 | # This is especially convenient for building cross tools or for rebuilding | |
172 | # the tools when the original bootstrap has already be done. | |
a7dafa20 | 173 | regnattools: $(GCC_DIR)/stamp-gnatlib-rts |
5395b47b NN |
174 | # gnattools1-re |
175 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
0cfaf83f | 176 | $(TOOLS_FLAGS_TO_PASS_RE) INCLUDES="" \ |
5395b47b NN |
177 | gnatmake-re gnatlink-re |
178 | # gnattools2 | |
179 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
eede5a0d | 180 | $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools |
5395b47b NN |
181 | |
182 | # For cross builds of gnattools, | |
183 | # put the host RTS dir first in the PATH to hide the default runtime | |
184 | # files that are among the sources | |
185 | # FIXME: This should be done in configure. | |
186 | RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib ))) | |
9ecbc8f4 | 187 | gnattools-cross: $(GCC_DIR)/stamp-tools |
5395b47b NN |
188 | # gnattools1-re |
189 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
190 | $(TOOLS_FLAGS_TO_PASS_CROSS) INCLUDES="" \ | |
191 | gnatmake-re gnatlink-re | |
192 | # gnattools2 | |
193 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
eede5a0d | 194 | $(TOOLS_FLAGS_TO_PASS_CROSS) common-tools |
5395b47b NN |
195 | # Rename cross tools to where the GCC makefile wants them when |
196 | # installing. FIXME: installation should be done elsewhere. | |
197 | if [ -f $(GCC_DIR)/gnatbind$(exeext) ] ; then \ | |
198 | mv $(GCC_DIR)/gnatbind$(exeext) $(GCC_DIR)/gnatbind-cross$(exeext); \ | |
199 | fi | |
5395b47b NN |
200 | if [ -f $(GCC_DIR)/gnatchop$(exeext) ] ; then \ |
201 | mv $(GCC_DIR)/gnatchop$(exeext) $(GCC_DIR)/gnatchop-cross$(exeext); \ | |
202 | fi | |
203 | if [ -f $(GCC_DIR)/gnat$(exeext) ] ; then \ | |
204 | mv $(GCC_DIR)/gnat$(exeext) $(GCC_DIR)/gnat-cross$(exeext); \ | |
205 | fi | |
206 | if [ -f $(GCC_DIR)/gnatkr$(exeext) ] ; then \ | |
207 | mv $(GCC_DIR)/gnatkr$(exeext) $(GCC_DIR)/gnatkr-cross$(exeext); \ | |
208 | fi | |
209 | if [ -f $(GCC_DIR)/gnatlink$(exeext) ] ; then \ | |
210 | mv $(GCC_DIR)/gnatlink$(exeext) $(GCC_DIR)/gnatlink-cross$(exeext); \ | |
211 | fi | |
212 | if [ -f $(GCC_DIR)/gnatls$(exeext) ] ; then \ | |
213 | mv $(GCC_DIR)/gnatls$(exeext) $(GCC_DIR)/gnatls-cross$(exeext); \ | |
214 | fi | |
215 | if [ -f $(GCC_DIR)/gnatmake$(exeext) ] ; then \ | |
216 | mv $(GCC_DIR)/gnatmake$(exeext) $(GCC_DIR)/gnatmake-cross$(exeext); \ | |
217 | fi | |
218 | if [ -f $(GCC_DIR)/gnatmem$(exeext) ] ; then \ | |
219 | mv $(GCC_DIR)/gnatmem$(exeext) $(GCC_DIR)/gnatmem-cross$(exeext); \ | |
220 | fi | |
221 | if [ -f $(GCC_DIR)/gnatname$(exeext) ] ; then \ | |
222 | mv $(GCC_DIR)/gnatname$(exeext) $(GCC_DIR)/gnatname-cross$(exeext); \ | |
223 | fi | |
224 | if [ -f $(GCC_DIR)/gnatprep$(exeext) ] ; then \ | |
225 | mv $(GCC_DIR)/gnatprep$(exeext) $(GCC_DIR)/gnatprep-cross$(exeext); \ | |
226 | fi | |
227 | if [ -f $(GCC_DIR)/gnatxref$(exeext) ] ; then \ | |
228 | mv $(GCC_DIR)/gnatxref$(exeext) $(GCC_DIR)/gnatxref-cross$(exeext); \ | |
229 | fi | |
230 | if [ -f $(GCC_DIR)/gnatfind$(exeext) ] ; then \ | |
231 | mv $(GCC_DIR)/gnatfind$(exeext) $(GCC_DIR)/gnatfind-cross$(exeext); \ | |
232 | fi | |
233 | if [ -f $(GCC_DIR)/gnatclean$(exeext) ] ; then \ | |
234 | mv $(GCC_DIR)/gnatclean$(exeext) $(GCC_DIR)/gnatclean-cross$(exeext); \ | |
235 | fi | |
236 | if [ -f $(GCC_DIR)/gnatsym$(exeext) ] ; then \ | |
237 | mv $(GCC_DIR)/gnatsym$(exeext) $(GCC_DIR)/gnatsym-cross$(exeext); \ | |
238 | fi | |
239 | ||
240 | # Other | |
241 | # ----- | |
242 | ||
243 | # Check uninstalled version. | |
244 | check: | |
245 | ||
246 | # Check installed version. | |
247 | installcheck: | |
248 | ||
249 | # Build info (none here). | |
250 | info: | |
251 | ||
252 | # Build DVI (none here). | |
253 | dvi: | |
254 | ||
b5422ad7 BM |
255 | # Build PDF (none here). |
256 | pdf: | |
257 | ||
4f3d9054 CD |
258 | # Build HTML (none here). |
259 | html: | |
260 | ||
455c8f48 RW |
261 | .PHONY: check installcheck info dvi pdf html |
262 | ||
5395b47b NN |
263 | # Build TAGS (none here). |
264 | TAGS: | |
265 | ||
266 | # Installation rules. | |
267 | install: | |
268 | ||
455c8f48 RW |
269 | install-strip: install |
270 | ||
5395b47b NN |
271 | install-info: |
272 | ||
32f1ac6d BM |
273 | install-pdf: |
274 | ||
4f3d9054 CD |
275 | install-html: |
276 | ||
455c8f48 RW |
277 | .PHONY: install install-strip install-info install-pdf install-html |
278 | ||
5395b47b NN |
279 | # Cleaning rules. |
280 | mostlyclean: | |
281 | ||
282 | clean: | |
283 | ||
284 | distclean: | |
285 | $(RM) Makefile config.status config.log | |
286 | ||
287 | maintainer-clean: | |
288 | ||
455c8f48 RW |
289 | .PHONY: mostlyclean clean distclean maintainer-clean |
290 | ||
5395b47b NN |
291 | # Rules for rebuilding this Makefile. |
292 | Makefile: $(srcdir)/Makefile.in config.status | |
293 | CONFIG_FILES=$@ ; \ | |
294 | CONFIG_HEADERS= ; \ | |
295 | $(SHELL) ./config.status | |
296 | ||
297 | config.status: $(srcdir)/configure | |
298 | $(SHELL) ./config.status --recheck | |
299 | ||
6efbd53f RW |
300 | AUTOCONF = autoconf |
301 | configure_deps = \ | |
302 | $(srcdir)/configure.ac \ | |
303 | $(srcdir)/../config/acx.m4 \ | |
304 | $(srcdir)/../config/override.m4 | |
305 | ||
306 | $(srcdir)/configure: @MAINT@ $(configure_deps) | |
307 | cd $(srcdir) && $(AUTOCONF) | |
5395b47b NN |
308 | |
309 | # Don't export variables to the environment, in order to not confuse | |
310 | # configure. | |
311 | .NOEXPORT: | |
312 |