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.
29 INSTALL_DATA
= @INSTALL_DATA@
30 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
32 # Nonstandard autoconf-set variables.
34 target_noncanonical
=@target_noncanonical@
36 # Variables for the user (or the top level) to override.
43 PWD_COMMAND
= $${PWDCMD-pwd
}
45 # The tedious process of getting CFLAGS right.
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
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)"\
76 "fsrcdir=$(fsrcdir)" \
78 "GNATMAKE=../../gnatmake" \
79 "GNATLINK=../../gnatlink" \
80 "GNATBIND=../../gnatbind" \
83 # Variables for regnattools
84 TOOLS_FLAGS_TO_PASS_RE
= \
85 "CC=../../xgcc -B../../" \
87 "ADAFLAGS=$(ADAFLAGS)" \
88 "ADA_CFLAGS=$(ADA_CFLAGS)" \
89 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
90 "ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
92 "fsrcdir=$(fsrcdir)" \
94 "GNATMAKE=../../gnatmake" \
95 "GNATLINK=../../gnatlink" \
96 "GNATBIND=../../gnatbind" \
99 # Variables for gnattools, cross
100 TOOLS_FLAGS_TO_PASS_CROSS
= \
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)" \
109 "fsrcdir=$(fsrcdir)" \
110 "srcdir=$(fsrcdir)" \
111 "GNATMAKE=gnatmake" \
112 "GNATLINK=gnatlink" \
113 "GNATBIND=gnatbind" \
120 # File associations set by configure
121 EXTRA_GNATTOOLS
= @EXTRA_GNATTOOLS@
122 TOOLS_TARGET_PAIRS
= @TOOLS_TARGET_PAIRS@
127 .PHONY
: gnattools gnattools-native gnattools-cross regnattools
128 gnattools
: @default_gnattools_target@
131 $(GCC_DIR
)/stamp-gnatlib-rts
:
132 @if
[ ! -f
$(GCC_DIR
)/stamp-gnatlib-rts
] ; \
134 echo
"Cannot build gnattools while gnatlib is out of date or unbuilt" ; \
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
163 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
164 $(TOOLS_FLAGS_TO_PASS_NATIVE
) \
165 ..
/..
/gnatmake
$(exeext
) ..
/..
/gnatlink
$(exeext
)
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
175 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
176 $(TOOLS_FLAGS_TO_PASS_RE
) INCLUDES
="" \
177 gnatmake-re gnatlink-re
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
189 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
190 $(TOOLS_FLAGS_TO_PASS_CROSS
) INCLUDES
="" \
191 gnatmake-re gnatlink-re
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
); \
243 # Check uninstalled version.
246 # Check installed version.
249 # Build info (none here).
252 # Build DVI (none here).
255 # Build PDF (none here).
258 # Build HTML (none here).
261 .PHONY
: check installcheck info dvi pdf html
263 # Build TAGS (none here).
266 # Installation rules.
269 install-strip
: install
277 .PHONY
: install install-strip install-info install-pdf install-html
285 $(RM
) Makefile config.status config.log
289 .PHONY
: mostlyclean clean distclean maintainer-clean
291 # Rules for rebuilding this Makefile.
292 Makefile
: $(srcdir)/Makefile.in config.status
295 $(SHELL
) .
/config.status
297 config.status
: $(srcdir)/configure
298 $(SHELL
) .
/config.status
--recheck
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