]>
Commit | Line | Data |
---|---|---|
a136b23d | 1 | # Makefile for gnattools |
2b7a4d59 | 2 | # Copyright 2003, 2004, 2009, 2010 Free Software Foundation, Inc. |
a136b23d | 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 | |
6bc9506f | 6 | # the Free Software Foundation; either version 3 of the License, or |
a136b23d | 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 | |
6bc9506f | 15 | # along with this program; see the file COPYING3. If not see |
16 | # <http://www.gnu.org/licenses/>. | |
a136b23d | 17 | |
18 | # Default target; must be first. | |
19 | all: gnattools | |
20 | ||
21 | # Standard autoconf-set variables. | |
22 | SHELL = @SHELL@ | |
23 | srcdir = @srcdir@ | |
9a8d280d | 24 | libdir = @libdir@ |
a136b23d | 25 | build = @build@ |
26 | target = @target@ | |
9a3248c9 | 27 | host = @host@ |
a136b23d | 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@ | |
5788a324 | 36 | host_noncanonical=@host_noncanonical@ |
a136b23d | 37 | |
38 | # Variables for the user (or the top level) to override. | |
9a8d280d | 39 | exeext = @EXEEXT@ |
a136b23d | 40 | objext=.o |
41 | TRACE=no | |
42 | ADA_FOR_BUILD= | |
43 | ADA_FOR_TARGET= | |
44 | LDFLAGS= | |
a136b23d | 45 | PWD_COMMAND = $${PWDCMD-pwd} |
46 | ||
47 | # The tedious process of getting CFLAGS right. | |
48 | CFLAGS=-g | |
95e40d0c | 49 | GCC_WARN_CFLAGS = -W -Wall |
9a8d280d | 50 | WARN_CFLAGS = @warn_cflags@ |
a136b23d | 51 | |
3bed0958 | 52 | ADA_CFLAGS=@ADA_CFLAGS@ |
a136b23d | 53 | |
54 | # Variables for gnattools. | |
55 | ADAFLAGS= -gnatpg -gnata | |
a136b23d | 56 | |
57 | # For finding the GCC build dir, which is used far too much | |
58 | GCC_DIR=../gcc | |
a136b23d | 59 | |
97c2bc38 | 60 | # Full path to top source directory |
61 | ftop_srcdir := $(shell cd $(srcdir)/..;${PWD_COMMAND}) | |
62 | ||
369e542b | 63 | # Absolute srcdir for gcc (why do we want absolute? I dunno) |
64 | fsrcdir := $(shell cd $(srcdir)/../gcc/; ${PWD_COMMAND}) | |
a136b23d | 65 | |
66 | # Useful "subroutines" for the excess includes | |
97c2bc38 | 67 | INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \ |
68 | -iquote $(fsrcdir)/ada -iquote $(fsrcdir)/config \ | |
69 | -iquote $(fsrcdir) -I$(ftop_srcdir)/include | |
369e542b | 70 | ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada |
a136b23d | 71 | |
f5824ad5 | 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 | ||
95e40d0c | 78 | # Variables for gnattools, native |
79 | TOOLS_FLAGS_TO_PASS_NATIVE= \ | |
a136b23d | 80 | "CC=../../xgcc -B../../" \ |
f5824ad5 | 81 | "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ |
a136b23d | 82 | "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ |
83 | "LDFLAGS=$(LDFLAGS)" \ | |
84 | "ADAFLAGS=$(ADAFLAGS)" \ | |
3bed0958 | 85 | "ADA_CFLAGS=$(ADA_CFLAGS)" \ |
a136b23d | 86 | "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ |
87 | "ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\ | |
88 | "exeext=$(exeext)" \ | |
89 | "fsrcdir=$(fsrcdir)" \ | |
90 | "srcdir=$(fsrcdir)" \ | |
95e40d0c | 91 | "GNATMAKE=../../gnatmake" \ |
92 | "GNATLINK=../../gnatlink" \ | |
a136b23d | 93 | "GNATBIND=../../gnatbind" \ |
94 | "TOOLSCASE=native" | |
95 | ||
96 | # Variables for regnattools | |
95e40d0c | 97 | TOOLS_FLAGS_TO_PASS_RE= \ |
a136b23d | 98 | "CC=../../xgcc -B../../" \ |
f5824ad5 | 99 | "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ |
a136b23d | 100 | "CFLAGS=$(CFLAGS)" \ |
9a3248c9 | 101 | "LDFLAGS=$(LDFLAGS)" \ |
a136b23d | 102 | "ADAFLAGS=$(ADAFLAGS)" \ |
3bed0958 | 103 | "ADA_CFLAGS=$(ADA_CFLAGS)" \ |
a136b23d | 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" \ | |
95e40d0c | 112 | "TOOLSCASE=cross" |
a136b23d | 113 | |
114 | # Variables for gnattools, cross | |
9a3248c9 | 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 | |
5788a324 | 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 | |
9a3248c9 | 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 | ||
a136b23d | 131 | TOOLS_FLAGS_TO_PASS_CROSS= \ |
132 | "CC=$(CC)" \ | |
75705de7 | 133 | "CXX=$(CXX)" \ |
a136b23d | 134 | "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ |
135 | "LDFLAGS=$(LDFLAGS)" \ | |
136 | "ADAFLAGS=$(ADAFLAGS)" \ | |
3bed0958 | 137 | "ADA_CFLAGS=$(ADA_CFLAGS)" \ |
a136b23d | 138 | "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ |
e956fd9c | 139 | "ADA_INCLUDES=-I$(RTS_DIR)/../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \ |
a136b23d | 140 | "exeext=$(exeext)" \ |
141 | "fsrcdir=$(fsrcdir)" \ | |
142 | "srcdir=$(fsrcdir)" \ | |
9a3248c9 | 143 | "GNATMAKE=$(GNATMAKE_FOR_HOST)" \ |
144 | "GNATLINK=$(GNATLINK_FOR_HOST)" \ | |
145 | "GNATBIND=$(GNATBIND_FOR_HOST)" \ | |
a136b23d | 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 | ||
a136b23d | 156 | # Makefile targets |
157 | # ---------------- | |
158 | ||
159 | .PHONY: gnattools gnattools-native gnattools-cross regnattools | |
160 | gnattools: @default_gnattools_target@ | |
161 | ||
162 | # Sanity check | |
dd53aa4f | 163 | $(GCC_DIR)/stamp-gnatlib-rts: |
164 | @if [ ! -f $(GCC_DIR)/stamp-gnatlib-rts ] ; \ | |
a136b23d | 165 | then \ |
d85be364 | 166 | echo "Cannot build gnattools while gnatlib is out of date or unbuilt" ; \ |
a136b23d | 167 | false; \ |
168 | else \ | |
169 | true; \ | |
170 | fi | |
171 | ||
172 | ||
173 | # Build directory for the tools. Let's copy the target-dependent | |
174 | # sources using the same mechanism as for gnatlib. The other sources are | |
175 | # accessed using the vpath directive in ada/Makefile.in | |
176 | ||
177 | $(GCC_DIR)/stamp-tools: | |
178 | -rm -rf $(GCC_DIR)/ada/tools | |
179 | -mkdir -p $(GCC_DIR)/ada/tools | |
d48e2634 | 180 | -(cd $(GCC_DIR)/ada/tools; $(LN_S) ../sdefault.adb ../snames.ads ../snames.adb .) |
a136b23d | 181 | -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \ |
182 | rm -f $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));\ | |
8d1917fb | 183 | $(LN_S) $(fsrcdir)/ada/$(word 2,$(subst <, ,$(PAIR))) \ |
a136b23d | 184 | $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));) |
185 | touch $(GCC_DIR)/stamp-tools | |
186 | ||
187 | # gnatmake/link tools cannot always be built with gnatmake/link for bootstrap | |
188 | # reasons: gnatmake should be built with a recent compiler, a recent compiler | |
189 | # may not generate ALI files compatible with an old gnatmake so it is important | |
190 | # to be able to build gnatmake without a version of gnatmake around. Once | |
191 | # everything has been compiled once, gnatmake can be recompiled with itself | |
192 | # (see target regnattools) | |
dd53aa4f | 193 | gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib-rts |
a136b23d | 194 | # gnattools1 |
195 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
95e40d0c | 196 | $(TOOLS_FLAGS_TO_PASS_NATIVE) \ |
bce7708a | 197 | ../../gnatmake$(exeext) ../../gnatlink$(exeext) |
a136b23d | 198 | # gnattools2 |
199 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
9ec17cc1 | 200 | $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools |
a136b23d | 201 | |
202 | # gnatmake/link can be built with recent gnatmake/link if they are available. | |
203 | # This is especially convenient for building cross tools or for rebuilding | |
204 | # the tools when the original bootstrap has already be done. | |
dd53aa4f | 205 | regnattools: $(GCC_DIR)/stamp-gnatlib-rts |
a136b23d | 206 | # gnattools1-re |
207 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
95e40d0c | 208 | $(TOOLS_FLAGS_TO_PASS_RE) INCLUDES="" \ |
a136b23d | 209 | gnatmake-re gnatlink-re |
210 | # gnattools2 | |
211 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
9ec17cc1 | 212 | $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools |
a136b23d | 213 | |
d0c5a090 | 214 | gnattools-cross: $(GCC_DIR)/stamp-tools |
a136b23d | 215 | # gnattools1-re |
216 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
217 | $(TOOLS_FLAGS_TO_PASS_CROSS) INCLUDES="" \ | |
218 | gnatmake-re gnatlink-re | |
219 | # gnattools2 | |
220 | $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ | |
9ec17cc1 | 221 | $(TOOLS_FLAGS_TO_PASS_CROSS) common-tools |
a136b23d | 222 | |
223 | # Other | |
224 | # ----- | |
225 | ||
226 | # Check uninstalled version. | |
227 | check: | |
228 | ||
229 | # Check installed version. | |
230 | installcheck: | |
231 | ||
232 | # Build info (none here). | |
233 | info: | |
234 | ||
235 | # Build DVI (none here). | |
236 | dvi: | |
237 | ||
51f93521 | 238 | # Build PDF (none here). |
239 | pdf: | |
240 | ||
4180eb7d | 241 | # Build HTML (none here). |
242 | html: | |
243 | ||
2b7a4d59 | 244 | .PHONY: check installcheck info dvi pdf html |
245 | ||
a136b23d | 246 | # Build TAGS (none here). |
247 | TAGS: | |
248 | ||
249 | # Installation rules. | |
250 | install: | |
251 | ||
2b7a4d59 | 252 | install-strip: install |
253 | ||
a136b23d | 254 | install-info: |
255 | ||
9d2d64c0 | 256 | install-pdf: |
257 | ||
4180eb7d | 258 | install-html: |
259 | ||
2b7a4d59 | 260 | .PHONY: install install-strip install-info install-pdf install-html |
261 | ||
a136b23d | 262 | # Cleaning rules. |
263 | mostlyclean: | |
264 | ||
265 | clean: | |
266 | ||
267 | distclean: | |
a66f43ae | 268 | $(RM) Makefile config.status config.log config.cache |
a136b23d | 269 | |
270 | maintainer-clean: | |
271 | ||
2b7a4d59 | 272 | .PHONY: mostlyclean clean distclean maintainer-clean |
273 | ||
a136b23d | 274 | # Rules for rebuilding this Makefile. |
275 | Makefile: $(srcdir)/Makefile.in config.status | |
276 | CONFIG_FILES=$@ ; \ | |
277 | CONFIG_HEADERS= ; \ | |
278 | $(SHELL) ./config.status | |
279 | ||
280 | config.status: $(srcdir)/configure | |
281 | $(SHELL) ./config.status --recheck | |
282 | ||
a2655af1 | 283 | AUTOCONF = autoconf |
284 | configure_deps = \ | |
285 | $(srcdir)/configure.ac \ | |
286 | $(srcdir)/../config/acx.m4 \ | |
287 | $(srcdir)/../config/override.m4 | |
288 | ||
289 | $(srcdir)/configure: @MAINT@ $(configure_deps) | |
290 | cd $(srcdir) && $(AUTOCONF) | |
a136b23d | 291 | |
292 | # Don't export variables to the environment, in order to not confuse | |
293 | # configure. | |
294 | .NOEXPORT: | |
295 |