PR target/49307
[official-gcc.git] / gnattools / Makefile.in
blob3718b30593f90d6d6340001d2fbc2ef788cbb777
1 # Makefile for gnattools
2 # Copyright 2003, 2004, 2009, 2010 Free Software Foundation, Inc.
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.
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/>.
18 # Default target; must be first.
19 all: gnattools
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@
32 # Nonstandard autoconf-set variables.
33 LN_S=@LN_S@
34 target_noncanonical=@target_noncanonical@
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}
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@
51 ADA_CFLAGS=@ADA_CFLAGS@
53 # Variables for gnattools.
54 ADAFLAGS= -gnatpg -gnata
56 # For finding the GCC build dir, which is used far too much
57 GCC_DIR=../gcc
59 # Absolute srcdir for gcc (why do we want absolute? I dunno)
60 fsrcdir := $(shell cd $(srcdir)/../gcc/; ${PWD_COMMAND})
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
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"
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="
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"
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="
133 # File lists
134 # ----------
136 # File associations set by configure
137 EXTRA_GNATTOOLS = @EXTRA_GNATTOOLS@
138 TOOLS_TARGET_PAIRS = @TOOLS_TARGET_PAIRS@
140 # Makefile targets
141 # ----------------
143 .PHONY: gnattools gnattools-native gnattools-cross regnattools
144 gnattools: @default_gnattools_target@
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; \
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
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
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
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
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); \
216 if [ -f $(GCC_DIR)/gnatchop$(exeext) ] ; then \
217 mv $(GCC_DIR)/gnatchop$(exeext) $(GCC_DIR)/gnatchop-cross$(exeext); \
219 if [ -f $(GCC_DIR)/gnat$(exeext) ] ; then \
220 mv $(GCC_DIR)/gnat$(exeext) $(GCC_DIR)/gnat-cross$(exeext); \
222 if [ -f $(GCC_DIR)/gnatkr$(exeext) ] ; then \
223 mv $(GCC_DIR)/gnatkr$(exeext) $(GCC_DIR)/gnatkr-cross$(exeext); \
225 if [ -f $(GCC_DIR)/gnatlink$(exeext) ] ; then \
226 mv $(GCC_DIR)/gnatlink$(exeext) $(GCC_DIR)/gnatlink-cross$(exeext); \
228 if [ -f $(GCC_DIR)/gnatls$(exeext) ] ; then \
229 mv $(GCC_DIR)/gnatls$(exeext) $(GCC_DIR)/gnatls-cross$(exeext); \
231 if [ -f $(GCC_DIR)/gnatmake$(exeext) ] ; then \
232 mv $(GCC_DIR)/gnatmake$(exeext) $(GCC_DIR)/gnatmake-cross$(exeext); \
234 if [ -f $(GCC_DIR)/gnatmem$(exeext) ] ; then \
235 mv $(GCC_DIR)/gnatmem$(exeext) $(GCC_DIR)/gnatmem-cross$(exeext); \
237 if [ -f $(GCC_DIR)/gnatname$(exeext) ] ; then \
238 mv $(GCC_DIR)/gnatname$(exeext) $(GCC_DIR)/gnatname-cross$(exeext); \
240 if [ -f $(GCC_DIR)/gnatprep$(exeext) ] ; then \
241 mv $(GCC_DIR)/gnatprep$(exeext) $(GCC_DIR)/gnatprep-cross$(exeext); \
243 if [ -f $(GCC_DIR)/gnatxref$(exeext) ] ; then \
244 mv $(GCC_DIR)/gnatxref$(exeext) $(GCC_DIR)/gnatxref-cross$(exeext); \
246 if [ -f $(GCC_DIR)/gnatfind$(exeext) ] ; then \
247 mv $(GCC_DIR)/gnatfind$(exeext) $(GCC_DIR)/gnatfind-cross$(exeext); \
249 if [ -f $(GCC_DIR)/gnatclean$(exeext) ] ; then \
250 mv $(GCC_DIR)/gnatclean$(exeext) $(GCC_DIR)/gnatclean-cross$(exeext); \
252 if [ -f $(GCC_DIR)/gnatsym$(exeext) ] ; then \
253 mv $(GCC_DIR)/gnatsym$(exeext) $(GCC_DIR)/gnatsym-cross$(exeext); \
256 # Other
257 # -----
259 # Check uninstalled version.
260 check:
262 # Check installed version.
263 installcheck:
265 # Build info (none here).
266 info:
268 # Build DVI (none here).
269 dvi:
271 # Build PDF (none here).
272 pdf:
274 # Build HTML (none here).
275 html:
277 .PHONY: check installcheck info dvi pdf html
279 # Build TAGS (none here).
280 TAGS:
282 # Installation rules.
283 install:
285 install-strip: install
287 install-info:
289 install-pdf:
291 install-html:
293 .PHONY: install install-strip install-info install-pdf install-html
295 # Cleaning rules.
296 mostlyclean:
298 clean:
300 distclean:
301 $(RM) Makefile config.status config.log
303 maintainer-clean:
305 .PHONY: mostlyclean clean distclean maintainer-clean
307 # Rules for rebuilding this Makefile.
308 Makefile: $(srcdir)/Makefile.in config.status
309 CONFIG_FILES=$@ ; \
310 CONFIG_HEADERS= ; \
311 $(SHELL) ./config.status
313 config.status: $(srcdir)/configure
314 $(SHELL) ./config.status --recheck
316 AUTOCONF = autoconf
317 configure_deps = \
318 $(srcdir)/configure.ac \
319 $(srcdir)/../config/acx.m4 \
320 $(srcdir)/../config/override.m4
322 $(srcdir)/configure: @MAINT@ $(configure_deps)
323 cd $(srcdir) && $(AUTOCONF)
325 # Don't export variables to the environment, in order to not confuse
326 # configure.
327 .NOEXPORT: