OSDN Git Service

Fix out-of-bounds array access found by mudflap.
[pf3gnuchains/gcc-fork.git] / libada / Makefile.in
1 # Makefile for libada.
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: gnatlib 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 enable_shared = @enable_shared@
33 LN_S=@LN_S@
34 target_noncanonical=@target_noncanonical@
35
36 # Variables for the user (or the top level) to override.
37 objext=.o
38 GNATLIBFLAGS= -W -Wall -gnatpg
39 THREAD_KIND=native
40 TRACE=no
41 GNATLIBLDFLAGS=
42 ADA_FOR_BUILD=
43 ADA_FOR_TARGET=
44 LDFLAGS=
45 STAGE_PREFIX=
46
47 # The tedious process of getting CFLAGS right.
48 CFLAGS=-g
49 LOOSE_WARN = -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
50 GCC_WARN_CFLAGS = $(LOOSE_WARN) $(NOCOMMON_FLAG)
51
52 ADA_CFLAGS=
53 T_ADA_CFLAGS=
54 # HPPA is literally the only target which sets X_ADA_CFLAGS
55 X_ADA_CFLAGS=@x_ada_cflags@
56 ALL_ADA_CFLAGS=$(X_ADA_CFLAGS) $(T_ADA_CFLAGS) $(ADA_CFLAGS)
57
58 # Variables for gnattools.
59 ADAFLAGS= -gnatpg -gnata
60 ADA_INCLUDE_DIR = $(libsubdir)/adainclude
61 ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
62
63 # For finding the GCC build dir, which is used far too much
64 GCC_DIR=../../gcc
65 # Include fragment generated by GCC configure.
66 include $(GCC_DIR)/libada-mk
67 # Variables based on those gleaned from the GCC makefile.  :-P
68 libsubdir=$(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
69
70 TARGET_LIBGCC2_CFLAGS=
71 GNATLIBCFLAGS= -g -O2
72 # Get target-specific overrides for TARGET_LIBGCC2_CFLAGS
73 # and possibly GNATLIBCFLAGS.  Currently this uses files
74 # in gcc/config.  The 'subst' call is used to rerelativize them
75 # from their gcc locations.  This is hackery, but there isn't
76 # yet a better way to do this.
77 tmake_file=$(subst /config,/../gcc/config,$(gcc_tmake_file))
78 ifneq ($(tmake_file),)
79 include $(tmake_file)
80 endif
81
82 # Get possible host-specific override for libsubdir (ick).
83 xmake_file=$(subst /config,/../gcc/config,$(gcc_xmake_file))
84 ifneq ($(xmake_file),)
85 include $(xmake_file)
86 endif
87
88 FLAGS_TO_PASS = \
89         "MAKEOVERRIDES=" \
90         "LDFLAGS=$(LDFLAGS)" \
91         "LN_S=$(LN_S)" \
92         "SHELL=$(SHELL)" \
93         "exeext=$(exeext)" \
94         "objext=$(objext)" \
95         "prefix=$(prefix)" \
96         "STAGE_PREFIX=$(STAGE_PREFIX)" \
97         "CC=$(cc_set_by_configure)" \
98         "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)"
99
100 ADA_FLAGS_TO_PASS = \
101         "ADA_FOR_BUILD=$(ADA_FOR_BUILD)"        \
102         "ADA_INCLUDE_DIR=$(ADA_INCLUDE_DIR)"    \
103         "ADA_RTL_OBJ_DIR=$(ADA_RTL_OBJ_DIR)"    \
104         "ADAFLAGS=$(ADAFLAGS)"                  \
105         "ADA_FOR_TARGET=$(ADA_FOR_TARGET)"      \
106         "INSTALL=$(INSTALL)"                    \
107         "INSTALL_DATA=$(INSTALL_DATA)"          \
108         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)"
109
110 ADA_TOOLS_FLAGS_TO_PASS=\
111         "CC=../../xgcc -B../../"        \
112         "CFLAGS=$(CFLAGS)"              \
113         "exeext=$(exeext)"              \
114         "ADAFLAGS=$(ADAFLAGS)"          \
115         "ADA_INCLUDES=-I../rts"         \
116         "GNATMAKE=../../gnatmake"       \
117         "GNATLINK=../../gnatlink"       \
118         "GNATBIND=../../gnatbind"
119
120 # Rules to build gnatlib.
121 .PHONY: gnatlib gnatlib-plain gnatlib-sjlj gnatlib-zcx gnatlib-shared
122 gnatlib: @default_gnatlib_target@
123
124 gnatlib-plain:
125         $(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) \
126           GNATLIBFLAGS="$(GNATLIBFLAGS)" \
127           GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
128           TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
129           THREAD_KIND="$(THREAD_KIND)" \
130           TRACE="$(TRACE)" \
131           gnatlib
132
133 gnatlib-sjlj gnatlib-zcx gnatlib-shared:
134         $(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) \
135           GNATLIBFLAGS="$(GNATLIBFLAGS)" \
136           GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
137           TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
138           THREAD_KIND="$(THREAD_KIND)" \
139           TRACE="$(TRACE)" \
140           $@
141
142 .PHONY: rts-zfp rts-ravenscar
143 rts-zfp rts-ravenscar:
144         $(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) \
145           GNATMAKE=../gnatmake-cross \
146           $@
147
148 # Rules to build gnattools.
149 .PHONY: gnattools gnattools-native gnattools-cross regnattools
150 gnattools: @default_gnattools_target@
151
152 gnattools-native: gnatlib
153         $(MAKE) -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
154           ADA_INCLUDES="-I- -I../rts" \
155           CC="../../xgcc -B../../" STAGE_PREFIX=../../  gnattools1
156         $(MAKE) -C $(GCC_DIR)/ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2
157         $(MAKE) -C $(GCC_DIR)/ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools3
158
159 # For cross builds of gnattools,
160 # put the host RTS dir first in the PATH to hide the default runtime
161 # files that are among the sources
162 # FIXME: This should be done in configure.
163 RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
164 gnattools-cross: gnatlib
165         $(MAKE)  -C $(GCC_DIR)/ada $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
166           ADA_INCLUDES="-I$(RTS_DIR)../adainclude -I$(RTS_DIR)" \
167           GNATMAKE="gnatmake" \
168           GNATBIND="gnatbind" \
169           GNATLINK="gnatlink" \
170           LIBGNAT="" \
171           gnattools1-re gnattools2 gnattools4
172         # Rename cross tools to where the GCC makefile wants them when
173         # installing.  FIXME: installation should be done elsewhere.
174         if [ -f $(GCC_DIR)/gnatbind$(exeext) ] ; then \
175           mv $(GCC_DIR)/gnatbind$(exeext) $(GCC_DIR)/gnatbind-cross$(exeext); \
176         fi
177         if [ -f $(GCC_DIR)/gnatbl$(exeext) ] ; then \
178           mv $(GCC_DIR)/gnatbl$(exeext) $(GCC_DIR)/gnatbl-cross$(exeext); \
179         fi
180         if [ -f $(GCC_DIR)/gnatchop$(exeext) ] ; then \
181           mv $(GCC_DIR)/gnatchop$(exeext) $(GCC_DIR)/gnatchop-cross$(exeext); \
182         fi
183         if [ -f $(GCC_DIR)/gnat$(exeext) ] ; then \
184           mv $(GCC_DIR)/gnat$(exeext) $(GCC_DIR)/gnat-cross$(exeext); \
185         fi
186         if [ -f $(GCC_DIR)/gnatkr$(exeext) ] ; then \
187           mv $(GCC_DIR)/gnatkr$(exeext) $(GCC_DIR)/gnatkr-cross$(exeext); \
188         fi
189         if [ -f $(GCC_DIR)/gnatlink$(exeext) ] ; then \
190           mv $(GCC_DIR)/gnatlink$(exeext) $(GCC_DIR)/gnatlink-cross$(exeext); \
191         fi
192         if [ -f $(GCC_DIR)/gnatls$(exeext) ] ; then \
193           mv $(GCC_DIR)/gnatls$(exeext) $(GCC_DIR)/gnatls-cross$(exeext); \
194         fi
195         if [ -f $(GCC_DIR)/gnatmake$(exeext) ] ; then \
196           mv $(GCC_DIR)/gnatmake$(exeext) $(GCC_DIR)/gnatmake-cross$(exeext); \
197         fi
198         if [ -f $(GCC_DIR)/gnatmem$(exeext) ] ; then \
199           mv $(GCC_DIR)/gnatmem$(exeext) $(GCC_DIR)/gnatmem-cross$(exeext); \
200         fi
201         if [ -f $(GCC_DIR)/gnatname$(exeext) ] ; then \
202           mv $(GCC_DIR)/gnatname$(exeext) $(GCC_DIR)/gnatname-cross$(exeext); \
203         fi
204         if [ -f $(GCC_DIR)/gnatprep$(exeext) ] ; then \
205           mv $(GCC_DIR)/gnatprep$(exeext) $(GCC_DIR)/gnatprep-cross$(exeext); \
206         fi
207         if [ -f $(GCC_DIR)/gnatxref$(exeext) ] ; then \
208           mv $(GCC_DIR)/gnatxref$(exeext) $(GCC_DIR)/gnatxref-cross$(exeext); \
209         fi
210         if [ -f $(GCC_DIR)/gnatfind$(exeext) ] ; then \
211           mv $(GCC_DIR)/gnatfind$(exeext) $(GCC_DIR)/gnatfind-cross$(exeext); \
212         fi
213         if [ -f $(GCC_DIR)/gnatclean$(exeext) ] ; then \
214           mv $(GCC_DIR)/gnatclean$(exeext) $(GCC_DIR)/gnatclean-cross$(exeext); \
215         fi
216         if [ -f $(GCC_DIR)/gnatsym$(exeext) ] ; then \
217           mv $(GCC_DIR)/gnatsym$(exeext) $(GCC_DIR)/gnatsym-cross$(exeext); \
218         fi
219         if [ -f $(GCC_DIR)/gpr2make$(exeext) ] ; then \
220           mv $(GCC_DIR)/gpr2make$(exeext) $(GCC_DIR)/gpr2make-cross$(exeext); \
221         fi
222         if [ -f $(GCC_DIR)/gprcmd$(exeext) ] ; then \
223           mv $(GCC_DIR)/gprcmd$(exeext) $(GCC_DIR)/gprcmd-cross$(exeext); \
224         fi
225
226 regnattools:
227         $(MAKE) -C $(GCC_DIR)/ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools1-re
228         $(MAKE) -C $(GCC_DIR)/ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2
229         $(MAKE) -C $(GCC_DIR)/ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools3
230
231 # Check uninstalled version.
232 check:
233
234 # Check installed version.
235 installcheck:
236
237 # Build info (none here).
238 info:
239
240 # Build DVI (none here).
241 dvi:
242
243 # Build TAGS (none here).
244 TAGS:
245
246 # Installation rules.
247 install:
248
249 install-info:
250
251 # Cleaning rules.
252 mostlyclean:
253
254 clean:
255
256 distclean:
257         $(RM) Makefile config.status config.log
258
259 maintainer-clean:
260
261 # Rules for rebuilding this Makefile.
262 Makefile: $(srcdir)/Makefile.in config.status
263         CONFIG_FILES=$@ ; \
264         CONFIG_HEADERS= ; \
265         $(SHELL) ./config.status
266
267 config.status: $(srcdir)/configure
268         $(SHELL) ./config.status --recheck
269
270 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac
271         cd $(srcdir) && autoconf
272
273 # Don't export variables to the environment, in order to not confuse
274 # configure.
275 .NOEXPORT: