1 |
13 |
jlechner |
# Makefile for gnattools
|
2 |
|
|
# Copyright 2003, 2004 Free Software Foundation, Inc.
|
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
|
6 |
|
|
# the Free Software Foundation; either version 2 of the License, or
|
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
|
15 |
|
|
# along with this program; if not, write to the Free Software
|
16 |
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
17 |
|
|
|
18 |
|
|
# Default target; must be first.
|
19 |
|
|
all: gnattools
|
20 |
|
|
|
21 |
|
|
# Standard autoconf-set variables.
|
22 |
|
|
SHELL = @SHELL@
|
23 |
|
|
srcdir = @srcdir@
|
24 |
|
|
build = @build@
|
25 |
|
|
target = @target@
|
26 |
|
|
prefix = @prefix@
|
27 |
|
|
INSTALL = @INSTALL@
|
28 |
|
|
INSTALL_DATA = @INSTALL_DATA@
|
29 |
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
30 |
|
|
|
31 |
|
|
# Nonstandard autoconf-set variables.
|
32 |
|
|
LN_S=@LN_S@
|
33 |
|
|
target_noncanonical=@target_noncanonical@
|
34 |
|
|
|
35 |
|
|
# Variables for the user (or the top level) to override.
|
36 |
|
|
objext=.o
|
37 |
|
|
TRACE=no
|
38 |
|
|
ADA_FOR_BUILD=
|
39 |
|
|
ADA_FOR_TARGET=
|
40 |
|
|
LDFLAGS=
|
41 |
|
|
STAGE_PREFIX=
|
42 |
|
|
PWD_COMMAND = $${PWDCMD-pwd}
|
43 |
|
|
|
44 |
|
|
# The tedious process of getting CFLAGS right.
|
45 |
|
|
CFLAGS=-g
|
46 |
|
|
LOOSE_WARN = -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
|
47 |
|
|
GCC_WARN_CFLAGS = $(LOOSE_WARN) $(NOCOMMON_FLAG)
|
48 |
|
|
|
49 |
|
|
ADA_CFLAGS=
|
50 |
|
|
T_ADA_CFLAGS=
|
51 |
|
|
# HPPA is literally the only target which sets X_ADA_CFLAGS
|
52 |
|
|
X_ADA_CFLAGS=@x_ada_cflags@
|
53 |
|
|
ALL_ADA_CFLAGS=$(X_ADA_CFLAGS) $(T_ADA_CFLAGS) $(ADA_CFLAGS)
|
54 |
|
|
|
55 |
|
|
# Variables for gnattools.
|
56 |
|
|
ADAFLAGS= -gnatpg -gnata
|
57 |
|
|
ADA_INCLUDE_DIR = $(libsubdir)/adainclude
|
58 |
|
|
ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
|
59 |
|
|
|
60 |
|
|
# For finding the GCC build dir, which is used far too much
|
61 |
|
|
GCC_DIR=../gcc
|
62 |
|
|
# Include fragment generated by GCC configure; shared with libada for now.
|
63 |
|
|
include $(GCC_DIR)/libada-mk
|
64 |
|
|
# Variables based on those gleaned from the GCC makefile. :-P
|
65 |
|
|
libsubdir=$(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
|
66 |
|
|
|
67 |
|
|
# Get possible host-specific override for libsubdir (ick).
|
68 |
|
|
xmake_file=$(subst /config,/../gcc/config,$(gcc_xmake_file))
|
69 |
|
|
ifneq ($(xmake_file),)
|
70 |
|
|
include $(xmake_file)
|
71 |
|
|
endif
|
72 |
|
|
|
73 |
|
|
# Absolute srcdir for gcc/ada (why do we want absolute? I dunno)
|
74 |
|
|
fsrcdir := $(shell cd $(srcdir)/../gcc/ada/; ${PWD_COMMAND})
|
75 |
|
|
|
76 |
|
|
# Useful "subroutines" for the excess includes
|
77 |
|
|
INCLUDES_FOR_SUBDIR = -I. -I.. -I../.. -I$(fsrcdir) -I$(fsrcdir)/../config \
|
78 |
|
|
-I$(fsrcdir)/../../include -I$(fsrcdir)/..
|
79 |
|
|
ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)
|
80 |
|
|
|
81 |
|
|
# Variables for gnattools1, native
|
82 |
|
|
TOOLS_FLAGS_TO_PASS_1= \
|
83 |
|
|
"CC=../../xgcc -B../../" \
|
84 |
|
|
"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
|
85 |
|
|
"LDFLAGS=$(LDFLAGS)" \
|
86 |
|
|
"ADAFLAGS=$(ADAFLAGS)" \
|
87 |
|
|
"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
|
88 |
|
|
"ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
|
89 |
|
|
"exeext=$(exeext)" \
|
90 |
|
|
"fsrcdir=$(fsrcdir)" \
|
91 |
|
|
"srcdir=$(fsrcdir)" \
|
92 |
|
|
"GNATBIND=../../gnatbind" \
|
93 |
|
|
"TOOLSCASE=native"
|
94 |
|
|
|
95 |
|
|
# Variables for regnattools
|
96 |
|
|
TOOLS_FLAGS_TO_PASS_1re= \
|
97 |
|
|
"CC=../../xgcc -B../../" \
|
98 |
|
|
"CFLAGS=$(CFLAGS)" \
|
99 |
|
|
"ADAFLAGS=$(ADAFLAGS)" \
|
100 |
|
|
"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
|
101 |
|
|
"ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
|
102 |
|
|
"exeext=$(exeext)" \
|
103 |
|
|
"fsrcdir=$(fsrcdir)" \
|
104 |
|
|
"srcdir=$(fsrcdir)" \
|
105 |
|
|
"GNATMAKE=../../gnatmake" \
|
106 |
|
|
"GNATLINK=../../gnatlink" \
|
107 |
|
|
"GNATBIND=../../gnatbind" \
|
108 |
|
|
"TOOLSCASE=cross" \
|
109 |
|
|
"INCLUDES="
|
110 |
|
|
|
111 |
|
|
# Variables for gnattools2, native
|
112 |
|
|
TOOLS_FLAGS_TO_PASS_NATIVE= \
|
113 |
|
|
"CC=../../xgcc -B../../" \
|
114 |
|
|
"CFLAGS=$(CFLAGS)" \
|
115 |
|
|
"ADAFLAGS=$(ADAFLAGS)" \
|
116 |
|
|
"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
|
117 |
|
|
"ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)" \
|
118 |
|
|
"exeext=$(exeext)" \
|
119 |
|
|
"fsrcdir=$(fsrcdir)" \
|
120 |
|
|
"srcdir=$(fsrcdir)" \
|
121 |
|
|
"GNATMAKE=../../gnatmake" \
|
122 |
|
|
"GNATLINK=../../gnatlink" \
|
123 |
|
|
"GNATBIND=../../gnatbind" \
|
124 |
|
|
"TOOLSCASE=native"
|
125 |
|
|
|
126 |
|
|
# Variables for gnattools, cross
|
127 |
|
|
TOOLS_FLAGS_TO_PASS_CROSS= \
|
128 |
|
|
"CC=$(CC)" \
|
129 |
|
|
"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
|
130 |
|
|
"LDFLAGS=$(LDFLAGS)" \
|
131 |
|
|
"ADAFLAGS=$(ADAFLAGS)" \
|
132 |
|
|
"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
|
133 |
|
|
"ADA_INCLUDES=-I$(RTS_DIR)../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \
|
134 |
|
|
"exeext=$(exeext)" \
|
135 |
|
|
"fsrcdir=$(fsrcdir)" \
|
136 |
|
|
"srcdir=$(fsrcdir)" \
|
137 |
|
|
"GNATMAKE=gnatmake" \
|
138 |
|
|
"GNATLINK=gnatlink" \
|
139 |
|
|
"GNATBIND=gnatbind" \
|
140 |
|
|
"TOOLSCASE=cross" \
|
141 |
|
|
"LIBGNAT="
|
142 |
|
|
|
143 |
|
|
# File lists
|
144 |
|
|
# ----------
|
145 |
|
|
|
146 |
|
|
# File associations set by configure
|
147 |
|
|
EXTRA_GNATTOOLS = @EXTRA_GNATTOOLS@
|
148 |
|
|
TOOLS_TARGET_PAIRS = @TOOLS_TARGET_PAIRS@
|
149 |
|
|
|
150 |
|
|
# These are built by gnatmake, and in both native and cross configurations.
|
151 |
|
|
GNATTOOLS2_FILES = \
|
152 |
|
|
../../gnatchop$(exeext) \
|
153 |
|
|
../../gnat$(exeext) \
|
154 |
|
|
../../gnatkr$(exeext) \
|
155 |
|
|
../../gnatls$(exeext) \
|
156 |
|
|
../../gnatprep$(exeext) \
|
157 |
|
|
../../gnatxref$(exeext) \
|
158 |
|
|
../../gnatfind$(exeext) \
|
159 |
|
|
../../gnatname$(exeext) \
|
160 |
|
|
../../gnatclean$(exeext) \
|
161 |
|
|
../../gprmake$(exeext)
|
162 |
|
|
|
163 |
|
|
# Makefile targets
|
164 |
|
|
# ----------------
|
165 |
|
|
|
166 |
|
|
.PHONY: gnattools gnattools-native gnattools-cross regnattools
|
167 |
|
|
gnattools: @default_gnattools_target@
|
168 |
|
|
|
169 |
|
|
# Sanity check
|
170 |
|
|
$(GCC_DIR)/stamp-gnatlib:
|
171 |
|
|
@if [ ! -f $(GCC_DIR)/stamp-gnatlib ] ; \
|
172 |
|
|
then \
|
173 |
|
|
echo "Cannot build gnattools while gnatlib is out of date or unbuilt" ; \
|
174 |
|
|
false; \
|
175 |
|
|
else \
|
176 |
|
|
true; \
|
177 |
|
|
fi
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
# Build directory for the tools. Let's copy the target-dependent
|
181 |
|
|
# sources using the same mechanism as for gnatlib. The other sources are
|
182 |
|
|
# accessed using the vpath directive in ada/Makefile.in
|
183 |
|
|
|
184 |
|
|
$(GCC_DIR)/stamp-tools:
|
185 |
|
|
-rm -rf $(GCC_DIR)/ada/tools
|
186 |
|
|
-mkdir -p $(GCC_DIR)/ada/tools
|
187 |
|
|
-(cd $(GCC_DIR)/ada/tools; $(LN_S) ../sdefault.adb .)
|
188 |
|
|
-$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \
|
189 |
|
|
rm -f $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));\
|
190 |
|
|
$(LN_S) $(fsrcdir)/$(word 2,$(subst <, ,$(PAIR))) \
|
191 |
|
|
$(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));)
|
192 |
|
|
touch $(GCC_DIR)/stamp-tools
|
193 |
|
|
|
194 |
|
|
# gnatmake/link tools cannot always be built with gnatmake/link for bootstrap
|
195 |
|
|
# reasons: gnatmake should be built with a recent compiler, a recent compiler
|
196 |
|
|
# may not generate ALI files compatible with an old gnatmake so it is important
|
197 |
|
|
# to be able to build gnatmake without a version of gnatmake around. Once
|
198 |
|
|
# everything has been compiled once, gnatmake can be recompiled with itself
|
199 |
|
|
# (see target regnattools)
|
200 |
|
|
gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib
|
201 |
|
|
# gnattools1
|
202 |
|
|
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
|
203 |
|
|
$(TOOLS_FLAGS_TO_PASS_1) \
|
204 |
|
|
../../gnatmake$(exeext) ../../gnatlink$(exeext) ../../gnatbl$(exeext)
|
205 |
|
|
# gnattools2
|
206 |
|
|
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
|
207 |
|
|
$(TOOLS_FLAGS_TO_PASS_NATIVE) \
|
208 |
|
|
$(GNATTOOLS2_FILES)
|
209 |
|
|
|
210 |
|
|
# gnatmake/link can be built with recent gnatmake/link if they are available.
|
211 |
|
|
# This is especially convenient for building cross tools or for rebuilding
|
212 |
|
|
# the tools when the original bootstrap has already be done.
|
213 |
|
|
regnattools: $(GCC_DIR)/stamp-gnatlib
|
214 |
|
|
# gnattools1-re
|
215 |
|
|
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
|
216 |
|
|
$(TOOLS_FLAGS_TO_PASS_1re) \
|
217 |
|
|
gnatmake-re gnatlink-re
|
218 |
|
|
# gnattools2
|
219 |
|
|
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
|
220 |
|
|
$(TOOLS_FLAGS_TO_PASS_NATIVE) \
|
221 |
|
|
$(GNATTOOLS2_FILES)
|
222 |
|
|
|
223 |
|
|
# For cross builds of gnattools,
|
224 |
|
|
# put the host RTS dir first in the PATH to hide the default runtime
|
225 |
|
|
# files that are among the sources
|
226 |
|
|
# FIXME: This should be done in configure.
|
227 |
|
|
RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
|
228 |
|
|
gnattools-cross: $(GCC_DIR)/stamp-tools
|
229 |
|
|
# gnattools1-re
|
230 |
|
|
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
|
231 |
|
|
$(TOOLS_FLAGS_TO_PASS_CROSS) INCLUDES="" \
|
232 |
|
|
gnatmake-re gnatlink-re
|
233 |
|
|
# gnattools2
|
234 |
|
|
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
|
235 |
|
|
$(TOOLS_FLAGS_TO_PASS_CROSS) \
|
236 |
|
|
$(GNATTOOLS2_FILES)
|
237 |
|
|
# gnattools4 (cross only)
|
238 |
|
|
$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
|
239 |
|
|
$(TOOLS_FLAGS_TO_PASS_CROSS) \
|
240 |
|
|
top_buildir=../../.. \
|
241 |
|
|
../../vxaddr2line$(exeext)
|
242 |
|
|
# Rename cross tools to where the GCC makefile wants them when
|
243 |
|
|
# installing. FIXME: installation should be done elsewhere.
|
244 |
|
|
if [ -f $(GCC_DIR)/gnatbind$(exeext) ] ; then \
|
245 |
|
|
mv $(GCC_DIR)/gnatbind$(exeext) $(GCC_DIR)/gnatbind-cross$(exeext); \
|
246 |
|
|
fi
|
247 |
|
|
if [ -f $(GCC_DIR)/gnatbl$(exeext) ] ; then \
|
248 |
|
|
mv $(GCC_DIR)/gnatbl$(exeext) $(GCC_DIR)/gnatbl-cross$(exeext); \
|
249 |
|
|
fi
|
250 |
|
|
if [ -f $(GCC_DIR)/gnatchop$(exeext) ] ; then \
|
251 |
|
|
mv $(GCC_DIR)/gnatchop$(exeext) $(GCC_DIR)/gnatchop-cross$(exeext); \
|
252 |
|
|
fi
|
253 |
|
|
if [ -f $(GCC_DIR)/gnat$(exeext) ] ; then \
|
254 |
|
|
mv $(GCC_DIR)/gnat$(exeext) $(GCC_DIR)/gnat-cross$(exeext); \
|
255 |
|
|
fi
|
256 |
|
|
if [ -f $(GCC_DIR)/gnatkr$(exeext) ] ; then \
|
257 |
|
|
mv $(GCC_DIR)/gnatkr$(exeext) $(GCC_DIR)/gnatkr-cross$(exeext); \
|
258 |
|
|
fi
|
259 |
|
|
if [ -f $(GCC_DIR)/gnatlink$(exeext) ] ; then \
|
260 |
|
|
mv $(GCC_DIR)/gnatlink$(exeext) $(GCC_DIR)/gnatlink-cross$(exeext); \
|
261 |
|
|
fi
|
262 |
|
|
if [ -f $(GCC_DIR)/gnatls$(exeext) ] ; then \
|
263 |
|
|
mv $(GCC_DIR)/gnatls$(exeext) $(GCC_DIR)/gnatls-cross$(exeext); \
|
264 |
|
|
fi
|
265 |
|
|
if [ -f $(GCC_DIR)/gnatmake$(exeext) ] ; then \
|
266 |
|
|
mv $(GCC_DIR)/gnatmake$(exeext) $(GCC_DIR)/gnatmake-cross$(exeext); \
|
267 |
|
|
fi
|
268 |
|
|
if [ -f $(GCC_DIR)/gnatmem$(exeext) ] ; then \
|
269 |
|
|
mv $(GCC_DIR)/gnatmem$(exeext) $(GCC_DIR)/gnatmem-cross$(exeext); \
|
270 |
|
|
fi
|
271 |
|
|
if [ -f $(GCC_DIR)/gnatname$(exeext) ] ; then \
|
272 |
|
|
mv $(GCC_DIR)/gnatname$(exeext) $(GCC_DIR)/gnatname-cross$(exeext); \
|
273 |
|
|
fi
|
274 |
|
|
if [ -f $(GCC_DIR)/gnatprep$(exeext) ] ; then \
|
275 |
|
|
mv $(GCC_DIR)/gnatprep$(exeext) $(GCC_DIR)/gnatprep-cross$(exeext); \
|
276 |
|
|
fi
|
277 |
|
|
if [ -f $(GCC_DIR)/gnatxref$(exeext) ] ; then \
|
278 |
|
|
mv $(GCC_DIR)/gnatxref$(exeext) $(GCC_DIR)/gnatxref-cross$(exeext); \
|
279 |
|
|
fi
|
280 |
|
|
if [ -f $(GCC_DIR)/gnatfind$(exeext) ] ; then \
|
281 |
|
|
mv $(GCC_DIR)/gnatfind$(exeext) $(GCC_DIR)/gnatfind-cross$(exeext); \
|
282 |
|
|
fi
|
283 |
|
|
if [ -f $(GCC_DIR)/gnatclean$(exeext) ] ; then \
|
284 |
|
|
mv $(GCC_DIR)/gnatclean$(exeext) $(GCC_DIR)/gnatclean-cross$(exeext); \
|
285 |
|
|
fi
|
286 |
|
|
if [ -f $(GCC_DIR)/gnatsym$(exeext) ] ; then \
|
287 |
|
|
mv $(GCC_DIR)/gnatsym$(exeext) $(GCC_DIR)/gnatsym-cross$(exeext); \
|
288 |
|
|
fi
|
289 |
|
|
|
290 |
|
|
# Other
|
291 |
|
|
# -----
|
292 |
|
|
|
293 |
|
|
# Check uninstalled version.
|
294 |
|
|
check:
|
295 |
|
|
|
296 |
|
|
# Check installed version.
|
297 |
|
|
installcheck:
|
298 |
|
|
|
299 |
|
|
# Build info (none here).
|
300 |
|
|
info:
|
301 |
|
|
|
302 |
|
|
# Build DVI (none here).
|
303 |
|
|
dvi:
|
304 |
|
|
|
305 |
|
|
# Build TAGS (none here).
|
306 |
|
|
TAGS:
|
307 |
|
|
|
308 |
|
|
# Installation rules.
|
309 |
|
|
install:
|
310 |
|
|
|
311 |
|
|
install-info:
|
312 |
|
|
|
313 |
|
|
# Cleaning rules.
|
314 |
|
|
mostlyclean:
|
315 |
|
|
|
316 |
|
|
clean:
|
317 |
|
|
|
318 |
|
|
distclean:
|
319 |
|
|
$(RM) Makefile config.status config.log
|
320 |
|
|
|
321 |
|
|
maintainer-clean:
|
322 |
|
|
|
323 |
|
|
# Rules for rebuilding this Makefile.
|
324 |
|
|
Makefile: $(srcdir)/Makefile.in config.status
|
325 |
|
|
CONFIG_FILES=$@ ; \
|
326 |
|
|
CONFIG_HEADERS= ; \
|
327 |
|
|
$(SHELL) ./config.status
|
328 |
|
|
|
329 |
|
|
config.status: $(srcdir)/configure
|
330 |
|
|
$(SHELL) ./config.status --recheck
|
331 |
|
|
|
332 |
|
|
$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac
|
333 |
|
|
cd $(srcdir) && autoconf
|
334 |
|
|
|
335 |
|
|
# Don't export variables to the environment, in order to not confuse
|
336 |
|
|
# configure.
|
337 |
|
|
.NOEXPORT:
|
338 |
|
|
|