1 # Makefile for gnattools
2 # Copyright 2003, 2004 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 2 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; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # Default target; must be first.
21 # Standard autoconf-set variables.
28 INSTALL_DATA
= @INSTALL_DATA@
29 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
31 # Nonstandard autoconf-set variables.
33 target_noncanonical
=@target_noncanonical@
35 # Variables for the user (or the top level) to override.
41 PWD_COMMAND
= $${PWDCMD-pwd
}
43 # The tedious process of getting CFLAGS right.
45 LOOSE_WARN
= -W
-Wall
-Wwrite-strings
-Wstrict-prototypes
-Wmissing-prototypes
46 GCC_WARN_CFLAGS
= $(LOOSE_WARN
) $(NOCOMMON_FLAG
)
50 # HPPA is literally the only target which sets X_ADA_CFLAGS
51 X_ADA_CFLAGS
=@x_ada_cflags@
52 ALL_ADA_CFLAGS
=$(X_ADA_CFLAGS
) $(T_ADA_CFLAGS
) $(ADA_CFLAGS
)
54 # Variables for gnattools.
55 ADAFLAGS
= -gnatpg
-gnata
56 ADA_INCLUDE_DIR
= $(libsubdir
)/adainclude
57 ADA_RTL_OBJ_DIR
= $(libsubdir
)/adalib
59 # For finding the GCC build dir, which is used far too much
61 # Include fragment generated by GCC configure; shared with libada for now.
62 include $(GCC_DIR
)/libada-mk
63 # Variables based on those gleaned from the GCC makefile. :-P
64 libsubdir
=$(libdir)/gcc
/$(target_noncanonical
)/$(gcc_version
)
66 # Get possible host-specific override for libsubdir (ick).
67 xmake_file
=$(subst /config
,/..
/gcc
/config
,$(gcc_xmake_file
))
68 ifneq ($(xmake_file
),)
72 # Absolute srcdir for gcc/ada (why do we want absolute? I dunno)
73 fsrcdir
:= $(shell cd
$(srcdir)/..
/gcc
/ada
/; ${PWD_COMMAND})
75 # Useful "subroutines" for the excess includes
76 INCLUDES_FOR_SUBDIR
= -I.
-I..
-I..
/..
-I
$(fsrcdir
) -I
$(fsrcdir
)/..
/config \
77 -I
$(fsrcdir
)/..
/..
/include -I
$(fsrcdir
)/..
78 ADA_INCLUDES_FOR_SUBDIR
= -I.
-I
$(fsrcdir
)
80 # Variables for gnattools1, native
81 TOOLS_FLAGS_TO_PASS_1
= \
82 "CC=../../xgcc -B../../" \
83 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
84 "LDFLAGS=$(LDFLAGS)" \
85 "ADAFLAGS=$(ADAFLAGS)" \
86 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
87 "ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
89 "fsrcdir=$(fsrcdir)" \
91 "GNATBIND=../../gnatbind" \
94 # Variables for regnattools
95 TOOLS_FLAGS_TO_PASS_1re
= \
96 "CC=../../xgcc -B../../" \
98 "ADAFLAGS=$(ADAFLAGS)" \
99 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
100 "ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
102 "fsrcdir=$(fsrcdir)" \
103 "srcdir=$(fsrcdir)" \
104 "GNATMAKE=../../gnatmake" \
105 "GNATLINK=../../gnatlink" \
106 "GNATBIND=../../gnatbind" \
110 # Variables for gnattools2, native
111 TOOLS_FLAGS_TO_PASS_NATIVE
= \
112 "CC=../../xgcc -B../../" \
114 "ADAFLAGS=$(ADAFLAGS)" \
115 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
116 "ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)" \
118 "fsrcdir=$(fsrcdir)" \
119 "srcdir=$(fsrcdir)" \
120 "GNATMAKE=../../gnatmake" \
121 "GNATLINK=../../gnatlink" \
122 "GNATBIND=../../gnatbind" \
125 # Variables for gnattools, cross
126 TOOLS_FLAGS_TO_PASS_CROSS
= \
128 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
129 "LDFLAGS=$(LDFLAGS)" \
130 "ADAFLAGS=$(ADAFLAGS)" \
131 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
132 "ADA_INCLUDES=-I$(RTS_DIR)../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \
134 "fsrcdir=$(fsrcdir)" \
135 "srcdir=$(fsrcdir)" \
136 "GNATMAKE=gnatmake" \
137 "GNATLINK=gnatlink" \
138 "GNATBIND=gnatbind" \
145 # File associations set by configure
146 EXTRA_GNATTOOLS
= @EXTRA_GNATTOOLS@
147 TOOLS_TARGET_PAIRS
= @TOOLS_TARGET_PAIRS@
149 # These are built by gnatmake, and in both native and cross configurations.
151 ..
/..
/gnatchop
$(exeext
) \
152 ..
/..
/gnat
$(exeext
) \
153 ..
/..
/gnatkr
$(exeext
) \
154 ..
/..
/gnatls
$(exeext
) \
155 ..
/..
/gnatprep
$(exeext
) \
156 ..
/..
/gnatxref
$(exeext
) \
157 ..
/..
/gnatfind
$(exeext
) \
158 ..
/..
/gnatname
$(exeext
) \
159 ..
/..
/gnatclean
$(exeext
)
164 .PHONY
: gnattools gnattools-native gnattools-cross regnattools
165 gnattools
: @default_gnattools_target@
168 $(GCC_DIR
)/stamp-gnatlib
:
169 @if
[ ! -f
$(GCC_DIR
)/stamp-gnatlib
] ; \
171 echo
"Cannot build gnattools while gnatlib is out of date or unbuilt" ; \
178 # Build directory for the tools. Let's copy the target-dependent
179 # sources using the same mechanism as for gnatlib. The other sources are
180 # accessed using the vpath directive in ada/Makefile.in
182 $(GCC_DIR
)/stamp-tools
:
183 -rm -rf
$(GCC_DIR
)/ada
/tools
184 -mkdir
-p
$(GCC_DIR
)/ada
/tools
185 -(cd
$(GCC_DIR
)/ada
/tools
; $(LN_S
) ..
/sdefault.adb .
)
186 -$(foreach PAIR
,$(TOOLS_TARGET_PAIRS
), \
187 rm -f
$(GCC_DIR
)/ada
/tools
/$(word 1,$(subst <, ,$(PAIR
)));\
188 $(LN_S
) $(fsrcdir
)/$(word 2,$(subst <, ,$(PAIR
))) \
189 $(GCC_DIR
)/ada
/tools
/$(word 1,$(subst <, ,$(PAIR
)));)
190 touch
$(GCC_DIR
)/stamp-tools
192 # gnatmake/link tools cannot always be built with gnatmake/link for bootstrap
193 # reasons: gnatmake should be built with a recent compiler, a recent compiler
194 # may not generate ALI files compatible with an old gnatmake so it is important
195 # to be able to build gnatmake without a version of gnatmake around. Once
196 # everything has been compiled once, gnatmake can be recompiled with itself
197 # (see target regnattools)
198 gnattools-native
: $(GCC_DIR
)/stamp-tools
$(GCC_DIR
)/stamp-gnatlib
200 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
201 $(TOOLS_FLAGS_TO_PASS_1
) \
202 ..
/..
/gnatmake
$(exeext
) ..
/..
/gnatlink
$(exeext
) ..
/..
/gnatbl
$(exeext
)
204 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
205 $(TOOLS_FLAGS_TO_PASS_NATIVE
) \
208 # gnatmake/link can be built with recent gnatmake/link if they are available.
209 # This is especially convenient for building cross tools or for rebuilding
210 # the tools when the original bootstrap has already be done.
211 regnattools
: $(GCC_DIR
)/stamp-gnatlib
213 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
214 $(TOOLS_FLAGS_TO_PASS_1re
) \
215 gnatmake-re gnatlink-re
217 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
218 $(TOOLS_FLAGS_TO_PASS_NATIVE
) \
221 # For cross builds of gnattools,
222 # put the host RTS dir first in the PATH to hide the default runtime
223 # files that are among the sources
224 # FIXME: This should be done in configure.
225 RTS_DIR
:=$(strip $(subst \
,/,$(shell gnatls
-v | grep adalib
)))
226 gnattools-cross
: $(GCC_DIR
)/stamp-tools
228 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
229 $(TOOLS_FLAGS_TO_PASS_CROSS
) INCLUDES
="" \
230 gnatmake-re gnatlink-re
232 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
233 $(TOOLS_FLAGS_TO_PASS_CROSS
) \
235 # gnattools4 (cross only)
236 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
237 $(TOOLS_FLAGS_TO_PASS_CROSS
) \
238 top_buildir
=..
/..
/.. \
239 ..
/..
/vxaddr2line
$(exeext
)
240 # Rename cross tools to where the GCC makefile wants them when
241 # installing. FIXME: installation should be done elsewhere.
242 if
[ -f
$(GCC_DIR
)/gnatbind
$(exeext
) ] ; then \
243 mv
$(GCC_DIR
)/gnatbind
$(exeext
) $(GCC_DIR
)/gnatbind-cross
$(exeext
); \
245 if
[ -f
$(GCC_DIR
)/gnatbl
$(exeext
) ] ; then \
246 mv
$(GCC_DIR
)/gnatbl
$(exeext
) $(GCC_DIR
)/gnatbl-cross
$(exeext
); \
248 if
[ -f
$(GCC_DIR
)/gnatchop
$(exeext
) ] ; then \
249 mv
$(GCC_DIR
)/gnatchop
$(exeext
) $(GCC_DIR
)/gnatchop-cross
$(exeext
); \
251 if
[ -f
$(GCC_DIR
)/gnat
$(exeext
) ] ; then \
252 mv
$(GCC_DIR
)/gnat
$(exeext
) $(GCC_DIR
)/gnat-cross
$(exeext
); \
254 if
[ -f
$(GCC_DIR
)/gnatkr
$(exeext
) ] ; then \
255 mv
$(GCC_DIR
)/gnatkr
$(exeext
) $(GCC_DIR
)/gnatkr-cross
$(exeext
); \
257 if
[ -f
$(GCC_DIR
)/gnatlink
$(exeext
) ] ; then \
258 mv
$(GCC_DIR
)/gnatlink
$(exeext
) $(GCC_DIR
)/gnatlink-cross
$(exeext
); \
260 if
[ -f
$(GCC_DIR
)/gnatls
$(exeext
) ] ; then \
261 mv
$(GCC_DIR
)/gnatls
$(exeext
) $(GCC_DIR
)/gnatls-cross
$(exeext
); \
263 if
[ -f
$(GCC_DIR
)/gnatmake
$(exeext
) ] ; then \
264 mv
$(GCC_DIR
)/gnatmake
$(exeext
) $(GCC_DIR
)/gnatmake-cross
$(exeext
); \
266 if
[ -f
$(GCC_DIR
)/gnatmem
$(exeext
) ] ; then \
267 mv
$(GCC_DIR
)/gnatmem
$(exeext
) $(GCC_DIR
)/gnatmem-cross
$(exeext
); \
269 if
[ -f
$(GCC_DIR
)/gnatname
$(exeext
) ] ; then \
270 mv
$(GCC_DIR
)/gnatname
$(exeext
) $(GCC_DIR
)/gnatname-cross
$(exeext
); \
272 if
[ -f
$(GCC_DIR
)/gnatprep
$(exeext
) ] ; then \
273 mv
$(GCC_DIR
)/gnatprep
$(exeext
) $(GCC_DIR
)/gnatprep-cross
$(exeext
); \
275 if
[ -f
$(GCC_DIR
)/gnatxref
$(exeext
) ] ; then \
276 mv
$(GCC_DIR
)/gnatxref
$(exeext
) $(GCC_DIR
)/gnatxref-cross
$(exeext
); \
278 if
[ -f
$(GCC_DIR
)/gnatfind
$(exeext
) ] ; then \
279 mv
$(GCC_DIR
)/gnatfind
$(exeext
) $(GCC_DIR
)/gnatfind-cross
$(exeext
); \
281 if
[ -f
$(GCC_DIR
)/gnatclean
$(exeext
) ] ; then \
282 mv
$(GCC_DIR
)/gnatclean
$(exeext
) $(GCC_DIR
)/gnatclean-cross
$(exeext
); \
284 if
[ -f
$(GCC_DIR
)/gnatsym
$(exeext
) ] ; then \
285 mv
$(GCC_DIR
)/gnatsym
$(exeext
) $(GCC_DIR
)/gnatsym-cross
$(exeext
); \
291 # Check uninstalled version.
294 # Check installed version.
297 # Build info (none here).
300 # Build DVI (none here).
303 # Build PDF (none here).
306 # Build HTML (none here).
309 # Build TAGS (none here).
312 # Installation rules.
327 $(RM
) Makefile config.status config.log
331 # Rules for rebuilding this Makefile.
332 Makefile
: $(srcdir)/Makefile.in config.status
335 $(SHELL
) .
/config.status
337 config.status
: $(srcdir)/configure
338 $(SHELL
) .
/config.status
--recheck
340 $(srcdir)/configure
: @MAINT@
$(srcdir)/configure.ac
341 cd
$(srcdir) && autoconf
343 # Don't export variables to the environment, in order to not confuse