OSDN Git Service

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