2012-12-14 Steve Ellcey <sellcey@mips.com>
[official-gcc.git] / gnattools / Makefile.in
blob794d374e75e47af773b32846ea01f8cd688f5ffd
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 # Variables for gnattools, native
67 TOOLS_FLAGS_TO_PASS_NATIVE= \
68 "CC=../../xgcc -B../../" \
69 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
70 "LDFLAGS=$(LDFLAGS)" \
71 "ADAFLAGS=$(ADAFLAGS)" \
72 "ADA_CFLAGS=$(ADA_CFLAGS)" \
73 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
74 "ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
75 "exeext=$(exeext)" \
76 "fsrcdir=$(fsrcdir)" \
77 "srcdir=$(fsrcdir)" \
78 "GNATMAKE=../../gnatmake" \
79 "GNATLINK=../../gnatlink" \
80 "GNATBIND=../../gnatbind" \
81 "TOOLSCASE=native"
83 # Variables for regnattools
84 TOOLS_FLAGS_TO_PASS_RE= \
85 "CC=../../xgcc -B../../" \
86 "CFLAGS=$(CFLAGS)" \
87 "ADAFLAGS=$(ADAFLAGS)" \
88 "ADA_CFLAGS=$(ADA_CFLAGS)" \
89 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
90 "ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
91 "exeext=$(exeext)" \
92 "fsrcdir=$(fsrcdir)" \
93 "srcdir=$(fsrcdir)" \
94 "GNATMAKE=../../gnatmake" \
95 "GNATLINK=../../gnatlink" \
96 "GNATBIND=../../gnatbind" \
97 "TOOLSCASE=cross"
99 # Variables for gnattools, cross
100 TOOLS_FLAGS_TO_PASS_CROSS= \
101 "CC=$(CC)" \
102 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
103 "LDFLAGS=$(LDFLAGS)" \
104 "ADAFLAGS=$(ADAFLAGS)" \
105 "ADA_CFLAGS=$(ADA_CFLAGS)" \
106 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
107 "ADA_INCLUDES=-I$(RTS_DIR)../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \
108 "exeext=$(exeext)" \
109 "fsrcdir=$(fsrcdir)" \
110 "srcdir=$(fsrcdir)" \
111 "GNATMAKE=gnatmake" \
112 "GNATLINK=gnatlink" \
113 "GNATBIND=gnatbind" \
114 "TOOLSCASE=cross" \
115 "LIBGNAT="
117 # File lists
118 # ----------
120 # File associations set by configure
121 EXTRA_GNATTOOLS = @EXTRA_GNATTOOLS@
122 TOOLS_TARGET_PAIRS = @TOOLS_TARGET_PAIRS@
124 # Makefile targets
125 # ----------------
127 .PHONY: gnattools gnattools-native gnattools-cross regnattools
128 gnattools: @default_gnattools_target@
130 # Sanity check
131 $(GCC_DIR)/stamp-gnatlib-rts:
132 @if [ ! -f $(GCC_DIR)/stamp-gnatlib-rts ] ; \
133 then \
134 echo "Cannot build gnattools while gnatlib is out of date or unbuilt" ; \
135 false; \
136 else \
137 true; \
141 # Build directory for the tools. Let's copy the target-dependent
142 # sources using the same mechanism as for gnatlib. The other sources are
143 # accessed using the vpath directive in ada/Makefile.in
145 $(GCC_DIR)/stamp-tools:
146 -rm -rf $(GCC_DIR)/ada/tools
147 -mkdir -p $(GCC_DIR)/ada/tools
148 -(cd $(GCC_DIR)/ada/tools; $(LN_S) ../sdefault.adb ../snames.ads ../snames.adb .)
149 -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \
150 rm -f $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));\
151 $(LN_S) $(fsrcdir)/ada/$(word 2,$(subst <, ,$(PAIR))) \
152 $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));)
153 touch $(GCC_DIR)/stamp-tools
155 # gnatmake/link tools cannot always be built with gnatmake/link for bootstrap
156 # reasons: gnatmake should be built with a recent compiler, a recent compiler
157 # may not generate ALI files compatible with an old gnatmake so it is important
158 # to be able to build gnatmake without a version of gnatmake around. Once
159 # everything has been compiled once, gnatmake can be recompiled with itself
160 # (see target regnattools)
161 gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib-rts
162 # gnattools1
163 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
164 $(TOOLS_FLAGS_TO_PASS_NATIVE) \
165 ../../gnatmake$(exeext) ../../gnatlink$(exeext)
166 # gnattools2
167 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
168 $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools
170 # gnatmake/link can be built with recent gnatmake/link if they are available.
171 # This is especially convenient for building cross tools or for rebuilding
172 # the tools when the original bootstrap has already be done.
173 regnattools: $(GCC_DIR)/stamp-gnatlib-rts
174 # gnattools1-re
175 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
176 $(TOOLS_FLAGS_TO_PASS_RE) INCLUDES="" \
177 gnatmake-re gnatlink-re
178 # gnattools2
179 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
180 $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools
182 # For cross builds of gnattools,
183 # put the host RTS dir first in the PATH to hide the default runtime
184 # files that are among the sources
185 # FIXME: This should be done in configure.
186 RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
187 gnattools-cross: $(GCC_DIR)/stamp-tools
188 # gnattools1-re
189 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
190 $(TOOLS_FLAGS_TO_PASS_CROSS) INCLUDES="" \
191 gnatmake-re gnatlink-re
192 # gnattools2
193 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
194 $(TOOLS_FLAGS_TO_PASS_CROSS) common-tools
195 # Rename cross tools to where the GCC makefile wants them when
196 # installing. FIXME: installation should be done elsewhere.
197 if [ -f $(GCC_DIR)/gnatbind$(exeext) ] ; then \
198 mv $(GCC_DIR)/gnatbind$(exeext) $(GCC_DIR)/gnatbind-cross$(exeext); \
200 if [ -f $(GCC_DIR)/gnatchop$(exeext) ] ; then \
201 mv $(GCC_DIR)/gnatchop$(exeext) $(GCC_DIR)/gnatchop-cross$(exeext); \
203 if [ -f $(GCC_DIR)/gnat$(exeext) ] ; then \
204 mv $(GCC_DIR)/gnat$(exeext) $(GCC_DIR)/gnat-cross$(exeext); \
206 if [ -f $(GCC_DIR)/gnatkr$(exeext) ] ; then \
207 mv $(GCC_DIR)/gnatkr$(exeext) $(GCC_DIR)/gnatkr-cross$(exeext); \
209 if [ -f $(GCC_DIR)/gnatlink$(exeext) ] ; then \
210 mv $(GCC_DIR)/gnatlink$(exeext) $(GCC_DIR)/gnatlink-cross$(exeext); \
212 if [ -f $(GCC_DIR)/gnatls$(exeext) ] ; then \
213 mv $(GCC_DIR)/gnatls$(exeext) $(GCC_DIR)/gnatls-cross$(exeext); \
215 if [ -f $(GCC_DIR)/gnatmake$(exeext) ] ; then \
216 mv $(GCC_DIR)/gnatmake$(exeext) $(GCC_DIR)/gnatmake-cross$(exeext); \
218 if [ -f $(GCC_DIR)/gnatmem$(exeext) ] ; then \
219 mv $(GCC_DIR)/gnatmem$(exeext) $(GCC_DIR)/gnatmem-cross$(exeext); \
221 if [ -f $(GCC_DIR)/gnatname$(exeext) ] ; then \
222 mv $(GCC_DIR)/gnatname$(exeext) $(GCC_DIR)/gnatname-cross$(exeext); \
224 if [ -f $(GCC_DIR)/gnatprep$(exeext) ] ; then \
225 mv $(GCC_DIR)/gnatprep$(exeext) $(GCC_DIR)/gnatprep-cross$(exeext); \
227 if [ -f $(GCC_DIR)/gnatxref$(exeext) ] ; then \
228 mv $(GCC_DIR)/gnatxref$(exeext) $(GCC_DIR)/gnatxref-cross$(exeext); \
230 if [ -f $(GCC_DIR)/gnatfind$(exeext) ] ; then \
231 mv $(GCC_DIR)/gnatfind$(exeext) $(GCC_DIR)/gnatfind-cross$(exeext); \
233 if [ -f $(GCC_DIR)/gnatclean$(exeext) ] ; then \
234 mv $(GCC_DIR)/gnatclean$(exeext) $(GCC_DIR)/gnatclean-cross$(exeext); \
236 if [ -f $(GCC_DIR)/gnatsym$(exeext) ] ; then \
237 mv $(GCC_DIR)/gnatsym$(exeext) $(GCC_DIR)/gnatsym-cross$(exeext); \
240 # Other
241 # -----
243 # Check uninstalled version.
244 check:
246 # Check installed version.
247 installcheck:
249 # Build info (none here).
250 info:
252 # Build DVI (none here).
253 dvi:
255 # Build PDF (none here).
256 pdf:
258 # Build HTML (none here).
259 html:
261 .PHONY: check installcheck info dvi pdf html
263 # Build TAGS (none here).
264 TAGS:
266 # Installation rules.
267 install:
269 install-strip: install
271 install-info:
273 install-pdf:
275 install-html:
277 .PHONY: install install-strip install-info install-pdf install-html
279 # Cleaning rules.
280 mostlyclean:
282 clean:
284 distclean:
285 $(RM) Makefile config.status config.log
287 maintainer-clean:
289 .PHONY: mostlyclean clean distclean maintainer-clean
291 # Rules for rebuilding this Makefile.
292 Makefile: $(srcdir)/Makefile.in config.status
293 CONFIG_FILES=$@ ; \
294 CONFIG_HEADERS= ; \
295 $(SHELL) ./config.status
297 config.status: $(srcdir)/configure
298 $(SHELL) ./config.status --recheck
300 AUTOCONF = autoconf
301 configure_deps = \
302 $(srcdir)/configure.ac \
303 $(srcdir)/../config/acx.m4 \
304 $(srcdir)/../config/override.m4
306 $(srcdir)/configure: @MAINT@ $(configure_deps)
307 cd $(srcdir) && $(AUTOCONF)
309 # Don't export variables to the environment, in order to not confuse
310 # configure.
311 .NOEXPORT: