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.
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.
21 # Standard autoconf-set variables.
28 host_alias
= @host_alias@
31 INSTALL_DATA
= @INSTALL_DATA@
32 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
34 # Nonstandard autoconf-set variables.
36 target_noncanonical
=@target_noncanonical@
38 # Variables for the user (or the top level) to override.
45 PWD_COMMAND
= $${PWDCMD-pwd
}
47 # The tedious process of getting CFLAGS right.
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
60 # Absolute srcdir for gcc (why do we want absolute? I dunno)
61 fsrcdir
:= $(shell cd
$(srcdir)/..
/gcc
/; ${PWD_COMMAND})
63 # Useful "subroutines" for the excess includes
64 INCLUDES_FOR_SUBDIR
= -I.
-I..
-I..
/..
-I
$(fsrcdir
)/ada
-I
$(fsrcdir
)/config \
65 -I
$(fsrcdir
)/..
/include -I
$(fsrcdir
)
66 ADA_INCLUDES_FOR_SUBDIR
= -I.
-I
$(fsrcdir
)/ada
69 -B..
/..
/..
/$(target_noncanonical
)/libstdc
++-v3
/src
/.libs \
70 -B..
/..
/..
/$(target_noncanonical
)/libstdc
++-v3
/libsupc
++/.libs \
71 -L..
/..
/..
/$(target_noncanonical
)/libstdc
++-v3
/src
/.libs \
72 -L..
/..
/..
/$(target_noncanonical
)/libstdc
++-v3
/libsupc
++/.libs
74 # Variables for gnattools, native
75 TOOLS_FLAGS_TO_PASS_NATIVE
= \
76 "CC=../../xgcc -B../../" \
77 "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \
78 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
79 "LDFLAGS=$(LDFLAGS)" \
80 "ADAFLAGS=$(ADAFLAGS)" \
81 "ADA_CFLAGS=$(ADA_CFLAGS)" \
82 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
83 "ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
85 "fsrcdir=$(fsrcdir)" \
87 "GNATMAKE=../../gnatmake" \
88 "GNATLINK=../../gnatlink" \
89 "GNATBIND=../../gnatbind" \
92 # Variables for regnattools
93 TOOLS_FLAGS_TO_PASS_RE
= \
94 "CC=../../xgcc -B../../" \
95 "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \
97 "LDFLAGS=$(LDFLAGS)" \
98 "ADAFLAGS=$(ADAFLAGS)" \
99 "ADA_CFLAGS=$(ADA_CFLAGS)" \
100 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
101 "ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
103 "fsrcdir=$(fsrcdir)" \
104 "srcdir=$(fsrcdir)" \
105 "GNATMAKE=../../gnatmake" \
106 "GNATLINK=../../gnatlink" \
107 "GNATBIND=../../gnatbind" \
110 # Variables for gnattools, cross
111 ifeq ($(build
), $(host
))
112 GNATMAKE_FOR_HOST
=gnatmake
113 GNATLINK_FOR_HOST
=gnatlink
114 GNATBIND_FOR_HOST
=gnatbind
115 GNATLS_FOR_HOST
=gnatls
117 GNATMAKE_FOR_HOST
=$(host_alias
)-gnatmake
118 GNATLINK_FOR_HOST
=$(host_alias
)-gnatlink
119 GNATBIND_FOR_HOST
=$(host_alias
)-gnatbind
120 GNATLS_FOR_HOST
=$(host_alias
)-gnatls
123 # Put the host RTS dir first in the PATH to hide the default runtime
124 # files that are among the sources
125 RTS_DIR
:=$(strip $(subst \
,/,$(shell $(GNATLS_FOR_HOST
) -v | grep adalib
)))
127 TOOLS_FLAGS_TO_PASS_CROSS
= \
130 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
131 "LDFLAGS=$(LDFLAGS)" \
132 "ADAFLAGS=$(ADAFLAGS)" \
133 "ADA_CFLAGS=$(ADA_CFLAGS)" \
134 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
135 "ADA_INCLUDES=-I$(RTS_DIR)/../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \
137 "fsrcdir=$(fsrcdir)" \
138 "srcdir=$(fsrcdir)" \
139 "GNATMAKE=$(GNATMAKE_FOR_HOST)" \
140 "GNATLINK=$(GNATLINK_FOR_HOST)" \
141 "GNATBIND=$(GNATBIND_FOR_HOST)" \
148 # File associations set by configure
149 EXTRA_GNATTOOLS
= @EXTRA_GNATTOOLS@
150 TOOLS_TARGET_PAIRS
= @TOOLS_TARGET_PAIRS@
155 .PHONY
: gnattools gnattools-native gnattools-cross regnattools
156 gnattools
: @default_gnattools_target@
159 $(GCC_DIR
)/stamp-gnatlib-rts
:
160 @if
[ ! -f
$(GCC_DIR
)/stamp-gnatlib-rts
] ; \
162 echo
"Cannot build gnattools while gnatlib is out of date or unbuilt" ; \
169 # Build directory for the tools. Let's copy the target-dependent
170 # sources using the same mechanism as for gnatlib. The other sources are
171 # accessed using the vpath directive in ada/Makefile.in
173 $(GCC_DIR
)/stamp-tools
:
174 -rm -rf
$(GCC_DIR
)/ada
/tools
175 -mkdir
-p
$(GCC_DIR
)/ada
/tools
176 -(cd
$(GCC_DIR
)/ada
/tools
; $(LN_S
) ..
/sdefault.adb ..
/snames.ads ..
/snames.adb .
)
177 -$(foreach PAIR
,$(TOOLS_TARGET_PAIRS
), \
178 rm -f
$(GCC_DIR
)/ada
/tools
/$(word 1,$(subst <, ,$(PAIR
)));\
179 $(LN_S
) $(fsrcdir
)/ada
/$(word 2,$(subst <, ,$(PAIR
))) \
180 $(GCC_DIR
)/ada
/tools
/$(word 1,$(subst <, ,$(PAIR
)));)
181 touch
$(GCC_DIR
)/stamp-tools
183 # gnatmake/link tools cannot always be built with gnatmake/link for bootstrap
184 # reasons: gnatmake should be built with a recent compiler, a recent compiler
185 # may not generate ALI files compatible with an old gnatmake so it is important
186 # to be able to build gnatmake without a version of gnatmake around. Once
187 # everything has been compiled once, gnatmake can be recompiled with itself
188 # (see target regnattools)
189 gnattools-native
: $(GCC_DIR
)/stamp-tools
$(GCC_DIR
)/stamp-gnatlib-rts
191 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
192 $(TOOLS_FLAGS_TO_PASS_NATIVE
) \
193 ..
/..
/gnatmake
$(exeext
) ..
/..
/gnatlink
$(exeext
)
195 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
196 $(TOOLS_FLAGS_TO_PASS_NATIVE
) common-tools
198 # gnatmake/link can be built with recent gnatmake/link if they are available.
199 # This is especially convenient for building cross tools or for rebuilding
200 # the tools when the original bootstrap has already be done.
201 regnattools
: $(GCC_DIR
)/stamp-gnatlib-rts
203 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
204 $(TOOLS_FLAGS_TO_PASS_RE
) INCLUDES
="" \
205 gnatmake-re gnatlink-re
207 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
208 $(TOOLS_FLAGS_TO_PASS_NATIVE
) common-tools
210 gnattools-cross
: $(GCC_DIR
)/stamp-tools
212 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
213 $(TOOLS_FLAGS_TO_PASS_CROSS
) INCLUDES
="" \
214 gnatmake-re gnatlink-re
216 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
217 $(TOOLS_FLAGS_TO_PASS_CROSS
) common-tools
218 # Rename cross tools to where the GCC makefile wants them when
219 # installing. FIXME: installation should be done elsewhere.
220 if
[ -f
$(GCC_DIR
)/gnatbind
$(exeext
) ] ; then \
221 mv
$(GCC_DIR
)/gnatbind
$(exeext
) $(GCC_DIR
)/gnatbind-cross
$(exeext
); \
223 if
[ -f
$(GCC_DIR
)/gnatchop
$(exeext
) ] ; then \
224 mv
$(GCC_DIR
)/gnatchop
$(exeext
) $(GCC_DIR
)/gnatchop-cross
$(exeext
); \
226 if
[ -f
$(GCC_DIR
)/gnat
$(exeext
) ] ; then \
227 mv
$(GCC_DIR
)/gnat
$(exeext
) $(GCC_DIR
)/gnat-cross
$(exeext
); \
229 if
[ -f
$(GCC_DIR
)/gnatkr
$(exeext
) ] ; then \
230 mv
$(GCC_DIR
)/gnatkr
$(exeext
) $(GCC_DIR
)/gnatkr-cross
$(exeext
); \
232 if
[ -f
$(GCC_DIR
)/gnatlink
$(exeext
) ] ; then \
233 mv
$(GCC_DIR
)/gnatlink
$(exeext
) $(GCC_DIR
)/gnatlink-cross
$(exeext
); \
235 if
[ -f
$(GCC_DIR
)/gnatls
$(exeext
) ] ; then \
236 mv
$(GCC_DIR
)/gnatls
$(exeext
) $(GCC_DIR
)/gnatls-cross
$(exeext
); \
238 if
[ -f
$(GCC_DIR
)/gnatmake
$(exeext
) ] ; then \
239 mv
$(GCC_DIR
)/gnatmake
$(exeext
) $(GCC_DIR
)/gnatmake-cross
$(exeext
); \
241 if
[ -f
$(GCC_DIR
)/gnatmem
$(exeext
) ] ; then \
242 mv
$(GCC_DIR
)/gnatmem
$(exeext
) $(GCC_DIR
)/gnatmem-cross
$(exeext
); \
244 if
[ -f
$(GCC_DIR
)/gnatname
$(exeext
) ] ; then \
245 mv
$(GCC_DIR
)/gnatname
$(exeext
) $(GCC_DIR
)/gnatname-cross
$(exeext
); \
247 if
[ -f
$(GCC_DIR
)/gnatprep
$(exeext
) ] ; then \
248 mv
$(GCC_DIR
)/gnatprep
$(exeext
) $(GCC_DIR
)/gnatprep-cross
$(exeext
); \
250 if
[ -f
$(GCC_DIR
)/gnatxref
$(exeext
) ] ; then \
251 mv
$(GCC_DIR
)/gnatxref
$(exeext
) $(GCC_DIR
)/gnatxref-cross
$(exeext
); \
253 if
[ -f
$(GCC_DIR
)/gnatfind
$(exeext
) ] ; then \
254 mv
$(GCC_DIR
)/gnatfind
$(exeext
) $(GCC_DIR
)/gnatfind-cross
$(exeext
); \
256 if
[ -f
$(GCC_DIR
)/gnatclean
$(exeext
) ] ; then \
257 mv
$(GCC_DIR
)/gnatclean
$(exeext
) $(GCC_DIR
)/gnatclean-cross
$(exeext
); \
259 if
[ -f
$(GCC_DIR
)/gnatsym
$(exeext
) ] ; then \
260 mv
$(GCC_DIR
)/gnatsym
$(exeext
) $(GCC_DIR
)/gnatsym-cross
$(exeext
); \
266 # Check uninstalled version.
269 # Check installed version.
272 # Build info (none here).
275 # Build DVI (none here).
278 # Build PDF (none here).
281 # Build HTML (none here).
284 .PHONY
: check installcheck info dvi pdf html
286 # Build TAGS (none here).
289 # Installation rules.
292 install-strip
: install
300 .PHONY
: install install-strip install-info install-pdf install-html
308 $(RM
) Makefile config.status config.log
312 .PHONY
: mostlyclean clean distclean maintainer-clean
314 # Rules for rebuilding this Makefile.
315 Makefile
: $(srcdir)/Makefile.in config.status
318 $(SHELL
) .
/config.status
320 config.status
: $(srcdir)/configure
321 $(SHELL
) .
/config.status
--recheck
325 $(srcdir)/configure.ac \
326 $(srcdir)/..
/config
/acx.m4 \
327 $(srcdir)/..
/config
/override.m4
329 $(srcdir)/configure
: @MAINT@
$(configure_deps
)
330 cd
$(srcdir) && $(AUTOCONF
)
332 # Don't export variables to the environment, in order to not confuse