]>
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@ | |
c8601e41 | 27 | host = @host@ |
5395b47b NN |
28 | prefix = @prefix@ |
29 | INSTALL = @INSTALL@ | |
30 | INSTALL_DATA = @INSTALL_DATA@ | |
31 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
32 | ||
33 | # Nonstandard autoconf-set variables. | |
34 | LN_S=@LN_S@ | |
35 | target_noncanonical=@target_noncanonical@ | |
47e62307 | 36 | host_noncanonical=@host_noncanonical@ |
5395b47b NN |
37 | |
38 | # Variables for the user (or the top level) to override. | |
47ad7893 | 39 | exeext = @EXEEXT@ |
5395b47b NN |
40 | objext=.o |
41 | TRACE=no | |
42 | ADA_FOR_BUILD= | |
43 | ADA_FOR_TARGET= | |
44 | LDFLAGS= | |
5395b47b NN |
45 | PWD_COMMAND = $${PWDCMD-pwd} |
46 | ||
47 | # The tedious process of getting CFLAGS right. | |
48 | CFLAGS=-g | |
0cfaf83f | 49 | GCC_WARN_CFLAGS = -W -Wall |
47ad7893 | 50 | WARN_CFLAGS = @warn_cflags@ |
5395b47b | 51 | |
00afcaa0 | 52 | ADA_CFLAGS=@ADA_CFLAGS@ |
5395b47b NN |
53 | |
54 | # Variables for gnattools. | |
55 | ADAFLAGS= -gnatpg -gnata | |
5395b47b NN |
56 | |
57 | # For finding the GCC build dir, which is used far too much | |
58 | GCC_DIR=../gcc | |
5395b47b | 59 | |
e4b2093f EB |
60 | # Full path to top source directory |
61 | ftop_srcdir := $(shell cd $(srcdir)/..;${PWD_COMMAND}) | |
62 | ||
a760c977 AS |
63 | # Absolute srcdir for gcc (why do we want absolute? I dunno) |
64 | fsrcdir := $(shell cd $(srcdir)/../gcc/; ${PWD_COMMAND}) | |
5395b47b NN |
65 | |
66 | # Useful "subroutines" for the excess includes | |
e4b2093f EB |
67 | INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \ |
68 | -iquote $(fsrcdir)/ada -iquote $(fsrcdir)/config \ | |
69 | -iquote $(fsrcdir) -I$(ftop_srcdir)/include | |
a760c977 | 70 | ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada |
5395b47b | 71 | |
d24c3ef2 EB |
72 | CXX_LFLAGS = \ |
73 | -B../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ | |
74 | -B../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs \ | |
75 | -L../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ | |
76 | -L../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs | |
77 | ||
0cfaf83f EB |
78 | # Variables for gnattools, native |
79 | TOOLS_FLAGS_TO_PASS_NATIVE= \ | |
5395b47b | 80 | "CC=../../xgcc -B../../" \ |
d24c3ef2 | 81 | "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ |
5395b47b NN |
82 | "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ |
83 | "LDFLAGS=$(LDFLAGS)" \ | |
84 | "ADAFLAGS=$(ADAFLAGS)" \ | |
00afcaa0 | 85 | "ADA_CFLAGS=$(ADA_CFLAGS)" \ |
5395b47b NN |
86 | "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ |
87 | "ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\ | |
88 | "exeext=$(exeext)" \ | |
89 | "fsrcdir=$(fsrcdir)" \ | |
90 | "srcdir=$(fsrcdir)" \ | |
0cfaf83f EB |
91 | "GNATMAKE=../../gnatmake" \ |
92 | "GNATLINK=../../gnatlink" \ | |
5395b47b NN |
93 | "GNATBIND=../../gnatbind" \ |
94 | "TOOLSCASE=native" | |
95 | ||
96 | # Variables for regnattools | |
0cfaf83f | 97 | TOOLS_FLAGS_TO_PASS_RE= \ |
5395b47b | 98 | "CC=../../xgcc -B../../" \ |
d24c3ef2 | 99 | "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ |
5395b47b | 100 | "CFLAGS=$(CFLAGS)" \ |
c8601e41 | 101 | "LDFLAGS=$(LDFLAGS)" \ |
5395b47b | 102 | "ADAFLAGS=$(ADAFLAGS)" \ |
00afcaa0 | 103 | "ADA_CFLAGS=$(ADA_CFLAGS)" \ |
5395b47b NN |
104 | "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ |
105 | "ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\ | |
106 | "exeext=$(exeext)" \ | |
107 | "fsrcdir=$(fsrcdir)" \ | |
108 | "srcdir=$(fsrcdir)" \ | |
109 | "GNATMAKE=../../gnatmake" \ | |
110 | "GNATLINK=../../gnatlink" \ | |
111 | "GNATBIND=../../gnatbind" \ | |
0cfaf83f | 112 | "TOOLSCASE=cross" |
5395b47b NN |
113 | |
114 | # Variables for gnattools, cross | |
c8601e41 EB |
115 | ifeq ($(build), $(host)) |
116 | GNATMAKE_FOR_HOST=gnatmake | |
117 | GNATLINK_FOR_HOST=gnatlink | |
118 | GNATBIND_FOR_HOST=gnatbind | |
119 | GNATLS_FOR_HOST=gnatls | |
120 | else | |
47e62307 EB |
121 | GNATMAKE_FOR_HOST=$(host_noncanonical)-gnatmake |
122 | GNATLINK_FOR_HOST=$(host_noncanonical)-gnatlink | |
123 | GNATBIND_FOR_HOST=$(host_noncanonical)-gnatbind | |
124 | GNATLS_FOR_HOST=$(host_noncanonical)-gnatls | |
c8601e41 EB |
125 | endif |
126 | ||
127 | # Put the host RTS dir first in the PATH to hide the default runtime | |
128 | # files that are among the sources | |
129 | RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep adalib ))) | |
130 | ||
5395b47b NN |
131 | TOOLS_FLAGS_TO_PASS_CROSS= \ |
132 | "CC=$(CC)" \ | |
d775b5ea | 133 | "CXX=$(CXX)" \ |
5395b47b NN |
134 | "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ |
135 | "LDFLAGS=$(LDFLAGS)" \ | |
136 | "ADAFLAGS=$(ADAFLAGS)" \ | |
00afcaa0 | 137 | "ADA_CFLAGS=$(ADA_CFLAGS)" \ |
5395b47b | 138 | "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ |
9fbb94f2 | 139 | "ADA_INCLUDES=-I$(RTS_DIR)/../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \ |
5395b47b NN |
140 | "exeext=$(exeext)" \ |
141 | "fsrcdir=$(fsrcdir)" \ | |
142 | "srcdir=$(fsrcdir)" \ | |
c8601e41 EB |
143 | "GNATMAKE=$(GNATMAKE_FOR_HOST)" \ |
144 | "GNATLINK=$(GNATLINK_FOR_HOST)" \ | |
145 | "GNATBIND=$(GNATBIND_FOR_HOST)" \ | |
5395b47b NN |
146 | "TOOLSCASE=cross" \ |
147 | "LIBGNAT=" | |
148 | ||
149 | # File lists | |
150 | # ---------- | |
151 | ||
152 | # File associations set by configure | |
153 | EXTRA_GNATTOOLS = @EXTRA_GNATTOOLS@ | |
154 | TOOLS_TARGET_PAIRS = @TOOLS_TARGET_PAIRS@ | |
155 | ||
5395b47b NN |
156 | # Makefile targets |
157 | # ---------------- | |
158 | ||
159 | .PHONY: gnattools gnattools-native gnattools-cross regnattools | |
160 | gnattools: @default_gnattools_target@ | |
161 | ||
162 | # Sanity check | |
a7dafa20 LG |
163 | $(GCC_DIR)/stamp-gnatlib-rts: |
164 | @if [ ! -f $(GCC_DIR)/stamp-gnatlib-rts ] ; \ | |
5395b47b | 165 | then \ |
ab743bf6 | 166 | echo "Cannot build gnattools while gnatlib is out of date or unbuilt" ; \ |
5395b47b NN |
167 | false; \ |
168 | else \ | |
169 | true; \ | |
170 | fi | |
171 | ||
172 | ||
76f9c7f4 BD |
173 | # Build directory for the tools. We first need to copy the generated files, |
174 | # then the target-dependent sources using the same mechanism as for gnatlib. | |
175 | ||
176 | GENERATED_FILES_FOR_TOOLS = \ | |
177 | einfo-entities.ads einfo-entities.adb sdefault.adb seinfo.ads \ | |
178 | sinfo-nodes.ads sinfo-nodes.adb snames.ads snames.adb | |
5395b47b NN |
179 | |
180 | $(GCC_DIR)/stamp-tools: | |
181 | -rm -rf $(GCC_DIR)/ada/tools | |
182 | -mkdir -p $(GCC_DIR)/ada/tools | |
76f9c7f4 BD |
183 | -(cd $(GCC_DIR)/ada/tools; $(foreach FILE,$(GENERATED_FILES_FOR_TOOLS), \ |
184 | $(LN_S) ../$(FILE) $(FILE);)) | |
5395b47b NN |
185 | -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \ |
186 | rm -f $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));\ | |
676fd528 | 187 | $(LN_S) $(fsrcdir)/ada/$(word 2,$(subst <, ,$(PAIR))) \ |
5395b47b NN |
188 | $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));) |
189 | touch $(GCC_DIR)/stamp-tools | |
190 | ||
191 | # gnatmake/link tools cannot always be built with gnatmake/link for bootstrap | |
192 | # reasons: gnatmake should be built with a recent compiler, a recent compiler | |
193 | # may not generate ALI files compatible with an old gnatmake so it is important | |
194 | # to be able to build gnatmake without a version of gnatmake around. Once | |
195 | # everything has been compiled once, gnatmake can be recompiled with itself | |
196 | # (see target regnattools) | |
a7dafa20 | 197 | gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib-rts |
5395b47b NN |
198 | # gnattools1 |
199 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
0cfaf83f | 200 | $(TOOLS_FLAGS_TO_PASS_NATIVE) \ |
7053a60f | 201 | ../../gnatmake$(exeext) ../../gnatlink$(exeext) |
5395b47b NN |
202 | # gnattools2 |
203 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
eede5a0d | 204 | $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools |
5395b47b NN |
205 | |
206 | # gnatmake/link can be built with recent gnatmake/link if they are available. | |
207 | # This is especially convenient for building cross tools or for rebuilding | |
208 | # the tools when the original bootstrap has already be done. | |
a7dafa20 | 209 | regnattools: $(GCC_DIR)/stamp-gnatlib-rts |
5395b47b NN |
210 | # gnattools1-re |
211 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
0cfaf83f | 212 | $(TOOLS_FLAGS_TO_PASS_RE) INCLUDES="" \ |
5395b47b NN |
213 | gnatmake-re gnatlink-re |
214 | # gnattools2 | |
215 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
eede5a0d | 216 | $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools |
5395b47b | 217 | |
9ecbc8f4 | 218 | gnattools-cross: $(GCC_DIR)/stamp-tools |
5395b47b NN |
219 | # gnattools1-re |
220 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
221 | $(TOOLS_FLAGS_TO_PASS_CROSS) INCLUDES="" \ | |
222 | gnatmake-re gnatlink-re | |
223 | # gnattools2 | |
224 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
eede5a0d | 225 | $(TOOLS_FLAGS_TO_PASS_CROSS) common-tools |
5395b47b NN |
226 | |
227 | # Other | |
228 | # ----- | |
229 | ||
230 | # Check uninstalled version. | |
231 | check: | |
232 | ||
233 | # Check installed version. | |
234 | installcheck: | |
235 | ||
236 | # Build info (none here). | |
237 | info: | |
238 | ||
239 | # Build DVI (none here). | |
240 | dvi: | |
241 | ||
b5422ad7 BM |
242 | # Build PDF (none here). |
243 | pdf: | |
244 | ||
4f3d9054 CD |
245 | # Build HTML (none here). |
246 | html: | |
247 | ||
455c8f48 RW |
248 | .PHONY: check installcheck info dvi pdf html |
249 | ||
5395b47b NN |
250 | # Build TAGS (none here). |
251 | TAGS: | |
252 | ||
253 | # Installation rules. | |
254 | install: | |
255 | ||
455c8f48 RW |
256 | install-strip: install |
257 | ||
5395b47b NN |
258 | install-info: |
259 | ||
32f1ac6d BM |
260 | install-pdf: |
261 | ||
c3e80a16 EG |
262 | install-dvi: |
263 | ||
4f3d9054 CD |
264 | install-html: |
265 | ||
c3e80a16 | 266 | .PHONY: install install-strip install-info install-pdf install-dvi install-html |
455c8f48 | 267 | |
5395b47b NN |
268 | # Cleaning rules. |
269 | mostlyclean: | |
270 | ||
271 | clean: | |
272 | ||
273 | distclean: | |
123451d7 | 274 | $(RM) Makefile config.status config.log config.cache |
5395b47b NN |
275 | |
276 | maintainer-clean: | |
277 | ||
455c8f48 RW |
278 | .PHONY: mostlyclean clean distclean maintainer-clean |
279 | ||
5395b47b NN |
280 | # Rules for rebuilding this Makefile. |
281 | Makefile: $(srcdir)/Makefile.in config.status | |
282 | CONFIG_FILES=$@ ; \ | |
283 | CONFIG_HEADERS= ; \ | |
284 | $(SHELL) ./config.status | |
285 | ||
286 | config.status: $(srcdir)/configure | |
287 | $(SHELL) ./config.status --recheck | |
288 | ||
6efbd53f RW |
289 | AUTOCONF = autoconf |
290 | configure_deps = \ | |
291 | $(srcdir)/configure.ac \ | |
292 | $(srcdir)/../config/acx.m4 \ | |
293 | $(srcdir)/../config/override.m4 | |
294 | ||
295 | $(srcdir)/configure: @MAINT@ $(configure_deps) | |
296 | cd $(srcdir) && $(AUTOCONF) | |
5395b47b NN |
297 | |
298 | # Don't export variables to the environment, in order to not confuse | |
299 | # configure. | |
300 | .NOEXPORT: | |
301 |