/cp
[official-gcc.git] / gnattools / Makefile.in
blobfdd649194df21de1733a0f34924f13a59e2431e5
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 GCC_WARN_CFLAGS = -W -Wall
48 WARN_CFLAGS = @warn_cflags@
50 ADA_CFLAGS=@ADA_CFLAGS@
52 # Variables for gnattools.
53 ADAFLAGS= -gnatpg -gnata
55 # For finding the GCC build dir, which is used far too much
56 GCC_DIR=../gcc
58 # Absolute srcdir for gcc (why do we want absolute? I dunno)
59 fsrcdir := $(shell cd $(srcdir)/../gcc/; ${PWD_COMMAND})
61 # Useful "subroutines" for the excess includes
62 INCLUDES_FOR_SUBDIR = -I. -I.. -I../.. -I$(fsrcdir)/ada -I$(fsrcdir)/config \
63 -I$(fsrcdir)/../include -I$(fsrcdir)
64 ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada
66 CXX_LFLAGS = \
67 -B../../../$(target_noncanonical)/libstdc++-v3/src/.libs \
68 -B../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs \
69 -L../../../$(target_noncanonical)/libstdc++-v3/src/.libs \
70 -L../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs
72 # Variables for gnattools, native
73 TOOLS_FLAGS_TO_PASS_NATIVE= \
74 "CC=../../xgcc -B../../" \
75 "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \
76 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
77 "LDFLAGS=$(LDFLAGS)" \
78 "ADAFLAGS=$(ADAFLAGS)" \
79 "ADA_CFLAGS=$(ADA_CFLAGS)" \
80 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
81 "ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
82 "exeext=$(exeext)" \
83 "fsrcdir=$(fsrcdir)" \
84 "srcdir=$(fsrcdir)" \
85 "GNATMAKE=../../gnatmake" \
86 "GNATLINK=../../gnatlink" \
87 "GNATBIND=../../gnatbind" \
88 "TOOLSCASE=native"
90 # Variables for regnattools
91 TOOLS_FLAGS_TO_PASS_RE= \
92 "CC=../../xgcc -B../../" \
93 "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \
94 "CFLAGS=$(CFLAGS)" \
95 "ADAFLAGS=$(ADAFLAGS)" \
96 "ADA_CFLAGS=$(ADA_CFLAGS)" \
97 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
98 "ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
99 "exeext=$(exeext)" \
100 "fsrcdir=$(fsrcdir)" \
101 "srcdir=$(fsrcdir)" \
102 "GNATMAKE=../../gnatmake" \
103 "GNATLINK=../../gnatlink" \
104 "GNATBIND=../../gnatbind" \
105 "TOOLSCASE=cross"
107 # Variables for gnattools, cross
108 TOOLS_FLAGS_TO_PASS_CROSS= \
109 "CC=$(CC)" \
110 "CXX=$(CXX)" \
111 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
112 "LDFLAGS=$(LDFLAGS)" \
113 "ADAFLAGS=$(ADAFLAGS)" \
114 "ADA_CFLAGS=$(ADA_CFLAGS)" \
115 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
116 "ADA_INCLUDES=-I$(RTS_DIR)../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \
117 "exeext=$(exeext)" \
118 "fsrcdir=$(fsrcdir)" \
119 "srcdir=$(fsrcdir)" \
120 "GNATMAKE=gnatmake" \
121 "GNATLINK=gnatlink" \
122 "GNATBIND=gnatbind" \
123 "TOOLSCASE=cross" \
124 "LIBGNAT="
126 # File lists
127 # ----------
129 # File associations set by configure
130 EXTRA_GNATTOOLS = @EXTRA_GNATTOOLS@
131 TOOLS_TARGET_PAIRS = @TOOLS_TARGET_PAIRS@
133 # Makefile targets
134 # ----------------
136 .PHONY: gnattools gnattools-native gnattools-cross regnattools
137 gnattools: @default_gnattools_target@
139 # Sanity check
140 $(GCC_DIR)/stamp-gnatlib-rts:
141 @if [ ! -f $(GCC_DIR)/stamp-gnatlib-rts ] ; \
142 then \
143 echo "Cannot build gnattools while gnatlib is out of date or unbuilt" ; \
144 false; \
145 else \
146 true; \
150 # Build directory for the tools. Let's copy the target-dependent
151 # sources using the same mechanism as for gnatlib. The other sources are
152 # accessed using the vpath directive in ada/Makefile.in
154 $(GCC_DIR)/stamp-tools:
155 -rm -rf $(GCC_DIR)/ada/tools
156 -mkdir -p $(GCC_DIR)/ada/tools
157 -(cd $(GCC_DIR)/ada/tools; $(LN_S) ../sdefault.adb ../snames.ads ../snames.adb .)
158 -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \
159 rm -f $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));\
160 $(LN_S) $(fsrcdir)/ada/$(word 2,$(subst <, ,$(PAIR))) \
161 $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));)
162 touch $(GCC_DIR)/stamp-tools
164 # gnatmake/link tools cannot always be built with gnatmake/link for bootstrap
165 # reasons: gnatmake should be built with a recent compiler, a recent compiler
166 # may not generate ALI files compatible with an old gnatmake so it is important
167 # to be able to build gnatmake without a version of gnatmake around. Once
168 # everything has been compiled once, gnatmake can be recompiled with itself
169 # (see target regnattools)
170 gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib-rts
171 # gnattools1
172 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
173 $(TOOLS_FLAGS_TO_PASS_NATIVE) \
174 ../../gnatmake$(exeext) ../../gnatlink$(exeext)
175 # gnattools2
176 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
177 $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools
179 # gnatmake/link can be built with recent gnatmake/link if they are available.
180 # This is especially convenient for building cross tools or for rebuilding
181 # the tools when the original bootstrap has already be done.
182 regnattools: $(GCC_DIR)/stamp-gnatlib-rts
183 # gnattools1-re
184 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
185 $(TOOLS_FLAGS_TO_PASS_RE) INCLUDES="" \
186 gnatmake-re gnatlink-re
187 # gnattools2
188 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
189 $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools
191 # For cross builds of gnattools,
192 # put the host RTS dir first in the PATH to hide the default runtime
193 # files that are among the sources
194 # FIXME: This should be done in configure.
195 RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
196 gnattools-cross: $(GCC_DIR)/stamp-tools
197 # gnattools1-re
198 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
199 $(TOOLS_FLAGS_TO_PASS_CROSS) INCLUDES="" \
200 gnatmake-re gnatlink-re
201 # gnattools2
202 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
203 $(TOOLS_FLAGS_TO_PASS_CROSS) common-tools
204 # Rename cross tools to where the GCC makefile wants them when
205 # installing. FIXME: installation should be done elsewhere.
206 if [ -f $(GCC_DIR)/gnatbind$(exeext) ] ; then \
207 mv $(GCC_DIR)/gnatbind$(exeext) $(GCC_DIR)/gnatbind-cross$(exeext); \
209 if [ -f $(GCC_DIR)/gnatchop$(exeext) ] ; then \
210 mv $(GCC_DIR)/gnatchop$(exeext) $(GCC_DIR)/gnatchop-cross$(exeext); \
212 if [ -f $(GCC_DIR)/gnat$(exeext) ] ; then \
213 mv $(GCC_DIR)/gnat$(exeext) $(GCC_DIR)/gnat-cross$(exeext); \
215 if [ -f $(GCC_DIR)/gnatkr$(exeext) ] ; then \
216 mv $(GCC_DIR)/gnatkr$(exeext) $(GCC_DIR)/gnatkr-cross$(exeext); \
218 if [ -f $(GCC_DIR)/gnatlink$(exeext) ] ; then \
219 mv $(GCC_DIR)/gnatlink$(exeext) $(GCC_DIR)/gnatlink-cross$(exeext); \
221 if [ -f $(GCC_DIR)/gnatls$(exeext) ] ; then \
222 mv $(GCC_DIR)/gnatls$(exeext) $(GCC_DIR)/gnatls-cross$(exeext); \
224 if [ -f $(GCC_DIR)/gnatmake$(exeext) ] ; then \
225 mv $(GCC_DIR)/gnatmake$(exeext) $(GCC_DIR)/gnatmake-cross$(exeext); \
227 if [ -f $(GCC_DIR)/gnatmem$(exeext) ] ; then \
228 mv $(GCC_DIR)/gnatmem$(exeext) $(GCC_DIR)/gnatmem-cross$(exeext); \
230 if [ -f $(GCC_DIR)/gnatname$(exeext) ] ; then \
231 mv $(GCC_DIR)/gnatname$(exeext) $(GCC_DIR)/gnatname-cross$(exeext); \
233 if [ -f $(GCC_DIR)/gnatprep$(exeext) ] ; then \
234 mv $(GCC_DIR)/gnatprep$(exeext) $(GCC_DIR)/gnatprep-cross$(exeext); \
236 if [ -f $(GCC_DIR)/gnatxref$(exeext) ] ; then \
237 mv $(GCC_DIR)/gnatxref$(exeext) $(GCC_DIR)/gnatxref-cross$(exeext); \
239 if [ -f $(GCC_DIR)/gnatfind$(exeext) ] ; then \
240 mv $(GCC_DIR)/gnatfind$(exeext) $(GCC_DIR)/gnatfind-cross$(exeext); \
242 if [ -f $(GCC_DIR)/gnatclean$(exeext) ] ; then \
243 mv $(GCC_DIR)/gnatclean$(exeext) $(GCC_DIR)/gnatclean-cross$(exeext); \
245 if [ -f $(GCC_DIR)/gnatsym$(exeext) ] ; then \
246 mv $(GCC_DIR)/gnatsym$(exeext) $(GCC_DIR)/gnatsym-cross$(exeext); \
249 # Other
250 # -----
252 # Check uninstalled version.
253 check:
255 # Check installed version.
256 installcheck:
258 # Build info (none here).
259 info:
261 # Build DVI (none here).
262 dvi:
264 # Build PDF (none here).
265 pdf:
267 # Build HTML (none here).
268 html:
270 .PHONY: check installcheck info dvi pdf html
272 # Build TAGS (none here).
273 TAGS:
275 # Installation rules.
276 install:
278 install-strip: install
280 install-info:
282 install-pdf:
284 install-html:
286 .PHONY: install install-strip install-info install-pdf install-html
288 # Cleaning rules.
289 mostlyclean:
291 clean:
293 distclean:
294 $(RM) Makefile config.status config.log
296 maintainer-clean:
298 .PHONY: mostlyclean clean distclean maintainer-clean
300 # Rules for rebuilding this Makefile.
301 Makefile: $(srcdir)/Makefile.in config.status
302 CONFIG_FILES=$@ ; \
303 CONFIG_HEADERS= ; \
304 $(SHELL) ./config.status
306 config.status: $(srcdir)/configure
307 $(SHELL) ./config.status --recheck
309 AUTOCONF = autoconf
310 configure_deps = \
311 $(srcdir)/configure.ac \
312 $(srcdir)/../config/acx.m4 \
313 $(srcdir)/../config/override.m4
315 $(srcdir)/configure: @MAINT@ $(configure_deps)
316 cd $(srcdir) && $(AUTOCONF)
318 # Don't export variables to the environment, in order to not confuse
319 # configure.
320 .NOEXPORT: