Update LOCAL_PATCHES after libsanitizer merge.
[official-gcc.git] / gnattools / Makefile.in
blob8a98a2d0b1895b1798e22a31b44c6e0c9bc4ab73
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 host = @host@
28 prefix = @prefix@
29 INSTALL = @INSTALL@
30 INSTALL_DATA = @INSTALL_DATA@
31 INSTALL_PROGRAM = @INSTALL_PROGRAM@
33 # Nonstandard autoconf-set variables.
34 LN_S=@LN_S@
35 target_noncanonical=@target_noncanonical@
36 host_noncanonical=@host_noncanonical@
38 # Variables for the user (or the top level) to override.
39 exeext = @EXEEXT@
40 objext=.o
41 TRACE=no
42 ADA_FOR_BUILD=
43 ADA_FOR_TARGET=
44 LDFLAGS=
45 PWD_COMMAND = $${PWDCMD-pwd}
47 # The tedious process of getting CFLAGS right.
48 CFLAGS=-g
49 GCC_WARN_CFLAGS = -W -Wall
50 WARN_CFLAGS = @warn_cflags@
52 ADA_CFLAGS=@ADA_CFLAGS@
54 # Variables for gnattools.
55 ADAFLAGS= -gnatpg -gnata
57 # For finding the GCC build dir, which is used far too much
58 GCC_DIR=../gcc
60 # Full path to top source directory
61 ftop_srcdir := $(shell cd $(srcdir)/..;${PWD_COMMAND})
63 # Absolute srcdir for gcc (why do we want absolute? I dunno)
64 fsrcdir := $(shell cd $(srcdir)/../gcc/; ${PWD_COMMAND})
66 # Useful "subroutines" for the excess includes
67 INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
68 -iquote $(fsrcdir)/ada -iquote $(fsrcdir)/config \
69 -iquote $(fsrcdir) -I$(ftop_srcdir)/include
70 ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada
72 # Variables for gnattools, native
73 # Due to Windows path translations (See PR ada/81878) we need to add
74 # -B../../ to the compiler paths as a workaround for that $(CXX) contains
75 # Unix style paths that won't be translated by the runtime.
76 TOOLS_FLAGS_TO_PASS_NATIVE= \
77 "CC=../../xgcc -B../../" \
78 "CXX=$(CXX) -B../../" \
79 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
80 "LDFLAGS=$(LDFLAGS)" \
81 "ADAFLAGS=$(ADAFLAGS)" \
82 "ADA_CFLAGS=$(ADA_CFLAGS)" \
83 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
84 "ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
85 "exeext=$(exeext)" \
86 "fsrcdir=$(fsrcdir)" \
87 "srcdir=$(fsrcdir)" \
88 "GNATMAKE=../../gnatmake" \
89 "GNATLINK=../../gnatlink" \
90 "GNATBIND=../../gnatbind" \
91 "TOOLSCASE=native"
93 # Variables for regnattools
94 TOOLS_FLAGS_TO_PASS_RE= \
95 "CC=../../xgcc -B../../" \
96 "CXX=$(CXX)" \
97 "CFLAGS=$(CFLAGS)" \
98 "LDFLAGS=$(LDFLAGS)" \
99 "ADAFLAGS=$(ADAFLAGS)" \
100 "ADA_CFLAGS=$(ADA_CFLAGS)" \
101 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
102 "ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
103 "exeext=$(exeext)" \
104 "fsrcdir=$(fsrcdir)" \
105 "srcdir=$(fsrcdir)" \
106 "GNATMAKE=../../gnatmake" \
107 "GNATLINK=../../gnatlink" \
108 "GNATBIND=../../gnatbind" \
109 "TOOLSCASE=cross"
111 # Variables for gnattools, cross
112 ifeq ($(build), $(host))
113 GNATMAKE_FOR_HOST=gnatmake
114 GNATLINK_FOR_HOST=gnatlink
115 GNATBIND_FOR_HOST=gnatbind
116 GNATLS_FOR_HOST=gnatls
117 else
118 GNATMAKE_FOR_HOST=$(host_noncanonical)-gnatmake
119 GNATLINK_FOR_HOST=$(host_noncanonical)-gnatlink
120 GNATBIND_FOR_HOST=$(host_noncanonical)-gnatbind
121 GNATLS_FOR_HOST=$(host_noncanonical)-gnatls
122 endif
124 # Put the host RTS dir first in the PATH to hide the default runtime
125 # files that are among the sources
126 RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep adalib )))
128 TOOLS_FLAGS_TO_PASS_CROSS= \
129 "CC=$(CC)" \
130 "CXX=$(CXX)" \
131 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
132 "LDFLAGS=$(LDFLAGS)" \
133 "ADAFLAGS=$(ADAFLAGS)" \
134 "ADA_CFLAGS=$(ADA_CFLAGS)" \
135 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
136 "ADA_INCLUDES=-I$(RTS_DIR)/../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \
137 "exeext=$(exeext)" \
138 "fsrcdir=$(fsrcdir)" \
139 "srcdir=$(fsrcdir)" \
140 "GNATMAKE=$(GNATMAKE_FOR_HOST)" \
141 "GNATLINK=$(GNATLINK_FOR_HOST)" \
142 "GNATBIND=$(GNATBIND_FOR_HOST)" \
143 "TOOLSCASE=cross" \
144 "LIBGNAT="
146 # File lists
147 # ----------
149 # File associations set by configure
150 EXTRA_GNATTOOLS = @EXTRA_GNATTOOLS@
151 TOOLS_TARGET_PAIRS = @TOOLS_TARGET_PAIRS@
153 # Makefile targets
154 # ----------------
156 .PHONY: gnattools gnattools-native gnattools-cross regnattools
157 gnattools: @default_gnattools_target@
159 # Sanity check
160 $(GCC_DIR)/stamp-gnatlib-rts:
161 @if [ ! -f $(GCC_DIR)/stamp-gnatlib-rts ] ; \
162 then \
163 echo "Cannot build gnattools while gnatlib is out of date or unbuilt" ; \
164 false; \
165 else \
166 true; \
170 # Build directory for the tools. Let's copy the target-dependent
171 # sources using the same mechanism as for gnatlib. The other sources are
172 # accessed using the vpath directive in ada/Makefile.in
174 $(GCC_DIR)/stamp-tools:
175 -rm -rf $(GCC_DIR)/ada/tools
176 -mkdir -p $(GCC_DIR)/ada/tools
177 -(cd $(GCC_DIR)/ada/tools; $(LN_S) ../sdefault.adb ../snames.ads ../snames.adb .)
178 -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \
179 rm -f $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));\
180 $(LN_S) $(fsrcdir)/ada/$(word 2,$(subst <, ,$(PAIR))) \
181 $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));)
182 touch $(GCC_DIR)/stamp-tools
184 # gnatmake/link tools cannot always be built with gnatmake/link for bootstrap
185 # reasons: gnatmake should be built with a recent compiler, a recent compiler
186 # may not generate ALI files compatible with an old gnatmake so it is important
187 # to be able to build gnatmake without a version of gnatmake around. Once
188 # everything has been compiled once, gnatmake can be recompiled with itself
189 # (see target regnattools)
190 gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib-rts
191 # gnattools1
192 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
193 $(TOOLS_FLAGS_TO_PASS_NATIVE) \
194 ../../gnatmake$(exeext) ../../gnatlink$(exeext)
195 # gnattools2
196 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
197 $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools
199 # gnatmake/link can be built with recent gnatmake/link if they are available.
200 # This is especially convenient for building cross tools or for rebuilding
201 # the tools when the original bootstrap has already be done.
202 regnattools: $(GCC_DIR)/stamp-gnatlib-rts
203 # gnattools1-re
204 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
205 $(TOOLS_FLAGS_TO_PASS_RE) INCLUDES="" \
206 gnatmake-re gnatlink-re
207 # gnattools2
208 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
209 $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools
211 gnattools-cross: $(GCC_DIR)/stamp-tools
212 # gnattools1-re
213 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
214 $(TOOLS_FLAGS_TO_PASS_CROSS) INCLUDES="" \
215 gnatmake-re gnatlink-re
216 # gnattools2
217 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
218 $(TOOLS_FLAGS_TO_PASS_CROSS) common-tools
220 # Other
221 # -----
223 # Check uninstalled version.
224 check:
226 # Check installed version.
227 installcheck:
229 # Build info (none here).
230 info:
232 # Build DVI (none here).
233 dvi:
235 # Build PDF (none here).
236 pdf:
238 # Build HTML (none here).
239 html:
241 .PHONY: check installcheck info dvi pdf html
243 # Build TAGS (none here).
244 TAGS:
246 # Installation rules.
247 install:
249 install-strip: install
251 install-info:
253 install-pdf:
255 install-html:
257 .PHONY: install install-strip install-info install-pdf install-html
259 # Cleaning rules.
260 mostlyclean:
262 clean:
264 distclean:
265 $(RM) Makefile config.status config.log config.cache
267 maintainer-clean:
269 .PHONY: mostlyclean clean distclean maintainer-clean
271 # Rules for rebuilding this Makefile.
272 Makefile: $(srcdir)/Makefile.in config.status
273 CONFIG_FILES=$@ ; \
274 CONFIG_HEADERS= ; \
275 $(SHELL) ./config.status
277 config.status: $(srcdir)/configure
278 $(SHELL) ./config.status --recheck
280 AUTOCONF = autoconf
281 configure_deps = \
282 $(srcdir)/configure.ac \
283 $(srcdir)/../config/acx.m4 \
284 $(srcdir)/../config/override.m4
286 $(srcdir)/configure: @MAINT@ $(configure_deps)
287 cd $(srcdir) && $(AUTOCONF)
289 # Don't export variables to the environment, in order to not confuse
290 # configure.
291 .NOEXPORT: