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.
42 PWD_COMMAND
= $${PWDCMD-pwd
}
44 # The tedious process of getting CFLAGS right.
46 LOOSE_WARN
= -W
-Wall
-Wwrite-strings
-Wstrict-prototypes
-Wmissing-prototypes
47 GCC_WARN_CFLAGS
= $(LOOSE_WARN
) $(NOCOMMON_FLAG
)
51 # HPPA is literally the only target which sets X_ADA_CFLAGS
52 X_ADA_CFLAGS
=@x_ada_cflags@
53 ALL_ADA_CFLAGS
=$(X_ADA_CFLAGS
) $(T_ADA_CFLAGS
) $(ADA_CFLAGS
)
55 # Variables for gnattools.
56 ADAFLAGS
= -gnatpg
-gnata
57 ADA_INCLUDE_DIR
= $(libsubdir
)/adainclude
58 ADA_RTL_OBJ_DIR
= $(libsubdir
)/adalib
60 # For finding the GCC build dir, which is used far too much
62 # Include fragment generated by GCC configure; shared with libada for now.
63 include $(GCC_DIR
)/libada-mk
64 # Variables based on those gleaned from the GCC makefile. :-P
65 libsubdir
=$(libdir)/gcc
/$(target_noncanonical
)/$(gcc_version
)
67 # Get possible host-specific override for libsubdir (ick).
68 xmake_file
=$(subst /config
,/..
/gcc
/config
,$(gcc_xmake_file
))
69 ifneq ($(xmake_file
),)
73 # Absolute srcdir for gcc/ada (why do we want absolute? I dunno)
74 fsrcdir
:= $(shell cd
$(srcdir)/..
/gcc
/ada
/; ${PWD_COMMAND})
76 # Useful "subroutines" for the excess includes
77 INCLUDES_FOR_SUBDIR
= -I.
-I..
-I..
/..
-I
$(fsrcdir
) -I
$(fsrcdir
)/..
/config \
78 -I
$(fsrcdir
)/..
/..
/include -I
$(fsrcdir
)/..
79 ADA_INCLUDES_FOR_SUBDIR
= -I.
-I
$(fsrcdir
)
81 # Variables for gnattools1, native
82 TOOLS_FLAGS_TO_PASS_1
= \
83 "CC=../../xgcc -B../../" \
84 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
85 "LDFLAGS=$(LDFLAGS)" \
86 "ADAFLAGS=$(ADAFLAGS)" \
87 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
88 "ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
90 "fsrcdir=$(fsrcdir)" \
92 "GNATBIND=../../gnatbind" \
95 # Variables for regnattools
96 TOOLS_FLAGS_TO_PASS_1re
= \
97 "CC=../../xgcc -B../../" \
99 "ADAFLAGS=$(ADAFLAGS)" \
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" \
111 # Variables for gnattools2, native
112 TOOLS_FLAGS_TO_PASS_NATIVE
= \
113 "CC=../../xgcc -B../../" \
115 "ADAFLAGS=$(ADAFLAGS)" \
116 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
117 "ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)" \
119 "fsrcdir=$(fsrcdir)" \
120 "srcdir=$(fsrcdir)" \
121 "GNATMAKE=../../gnatmake" \
122 "GNATLINK=../../gnatlink" \
123 "GNATBIND=../../gnatbind" \
126 # Variables for gnattools, cross
127 TOOLS_FLAGS_TO_PASS_CROSS
= \
129 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
130 "LDFLAGS=$(LDFLAGS)" \
131 "ADAFLAGS=$(ADAFLAGS)" \
132 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
133 "ADA_INCLUDES=-I$(RTS_DIR)../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \
135 "fsrcdir=$(fsrcdir)" \
136 "srcdir=$(fsrcdir)" \
137 "GNATMAKE=gnatmake" \
138 "GNATLINK=gnatlink" \
139 "GNATBIND=gnatbind" \
146 # File associations set by configure
147 EXTRA_GNATTOOLS
= @EXTRA_GNATTOOLS@
148 TOOLS_TARGET_PAIRS
= @TOOLS_TARGET_PAIRS@
150 # These are built by gnatmake, and in both native and cross configurations.
152 ..
/..
/gnatchop
$(exeext
) \
153 ..
/..
/gnat
$(exeext
) \
154 ..
/..
/gnatkr
$(exeext
) \
155 ..
/..
/gnatls
$(exeext
) \
156 ..
/..
/gnatprep
$(exeext
) \
157 ..
/..
/gnatxref
$(exeext
) \
158 ..
/..
/gnatfind
$(exeext
) \
159 ..
/..
/gnatname
$(exeext
) \
160 ..
/..
/gnatclean
$(exeext
) \
161 ..
/..
/gprmake
$(exeext
)
166 .PHONY
: gnattools gnattools-native gnattools-cross regnattools
167 gnattools
: @default_gnattools_target@
170 $(GCC_DIR
)/stamp-gnatlib
:
171 @if
[ ! -f
$(GCC_DIR
)/stamp-gnatlib
] ; \
173 echo
"Cannot build gnattools while gnatlib is out of date or unbuilt" ; \
180 # Build directory for the tools. Let's copy the target-dependent
181 # sources using the same mechanism as for gnatlib. The other sources are
182 # accessed using the vpath directive in ada/Makefile.in
184 $(GCC_DIR
)/stamp-tools
:
185 -rm -rf
$(GCC_DIR
)/ada
/tools
186 -mkdir
-p
$(GCC_DIR
)/ada
/tools
187 -(cd
$(GCC_DIR
)/ada
/tools
; $(LN_S
) ..
/sdefault.adb .
)
188 -$(foreach PAIR
,$(TOOLS_TARGET_PAIRS
), \
189 rm -f
$(GCC_DIR
)/ada
/tools
/$(word 1,$(subst <, ,$(PAIR
)));\
190 $(LN_S
) $(fsrcdir
)/$(word 2,$(subst <, ,$(PAIR
))) \
191 $(GCC_DIR
)/ada
/tools
/$(word 1,$(subst <, ,$(PAIR
)));)
192 touch
$(GCC_DIR
)/stamp-tools
194 # gnatmake/link tools cannot always be built with gnatmake/link for bootstrap
195 # reasons: gnatmake should be built with a recent compiler, a recent compiler
196 # may not generate ALI files compatible with an old gnatmake so it is important
197 # to be able to build gnatmake without a version of gnatmake around. Once
198 # everything has been compiled once, gnatmake can be recompiled with itself
199 # (see target regnattools)
200 gnattools-native
: $(GCC_DIR
)/stamp-tools
$(GCC_DIR
)/stamp-gnatlib
202 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
203 $(TOOLS_FLAGS_TO_PASS_1
) \
204 ..
/..
/gnatmake
$(exeext
) ..
/..
/gnatlink
$(exeext
) ..
/..
/gnatbl
$(exeext
)
206 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
207 $(TOOLS_FLAGS_TO_PASS_NATIVE
) \
210 # gnatmake/link can be built with recent gnatmake/link if they are available.
211 # This is especially convenient for building cross tools or for rebuilding
212 # the tools when the original bootstrap has already be done.
213 regnattools
: $(GCC_DIR
)/stamp-gnatlib
215 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
216 $(TOOLS_FLAGS_TO_PASS_1re
) \
217 gnatmake-re gnatlink-re
219 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
220 $(TOOLS_FLAGS_TO_PASS_NATIVE
) \
223 # For cross builds of gnattools,
224 # put the host RTS dir first in the PATH to hide the default runtime
225 # files that are among the sources
226 # FIXME: This should be done in configure.
227 RTS_DIR
:=$(strip $(subst \
,/,$(shell gnatls
-v | grep adalib
)))
228 gnattools-cross
: $(GCC_DIR
)/stamp-tools
230 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
231 $(TOOLS_FLAGS_TO_PASS_CROSS
) INCLUDES
="" \
232 gnatmake-re gnatlink-re
234 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
235 $(TOOLS_FLAGS_TO_PASS_CROSS
) \
237 # gnattools4 (cross only)
238 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
239 $(TOOLS_FLAGS_TO_PASS_CROSS
) \
240 top_buildir
=..
/..
/.. \
241 ..
/..
/vxaddr2line
$(exeext
)
242 # Rename cross tools to where the GCC makefile wants them when
243 # installing. FIXME: installation should be done elsewhere.
244 if
[ -f
$(GCC_DIR
)/gnatbind
$(exeext
) ] ; then \
245 mv
$(GCC_DIR
)/gnatbind
$(exeext
) $(GCC_DIR
)/gnatbind-cross
$(exeext
); \
247 if
[ -f
$(GCC_DIR
)/gnatbl
$(exeext
) ] ; then \
248 mv
$(GCC_DIR
)/gnatbl
$(exeext
) $(GCC_DIR
)/gnatbl-cross
$(exeext
); \
250 if
[ -f
$(GCC_DIR
)/gnatchop
$(exeext
) ] ; then \
251 mv
$(GCC_DIR
)/gnatchop
$(exeext
) $(GCC_DIR
)/gnatchop-cross
$(exeext
); \
253 if
[ -f
$(GCC_DIR
)/gnat
$(exeext
) ] ; then \
254 mv
$(GCC_DIR
)/gnat
$(exeext
) $(GCC_DIR
)/gnat-cross
$(exeext
); \
256 if
[ -f
$(GCC_DIR
)/gnatkr
$(exeext
) ] ; then \
257 mv
$(GCC_DIR
)/gnatkr
$(exeext
) $(GCC_DIR
)/gnatkr-cross
$(exeext
); \
259 if
[ -f
$(GCC_DIR
)/gnatlink
$(exeext
) ] ; then \
260 mv
$(GCC_DIR
)/gnatlink
$(exeext
) $(GCC_DIR
)/gnatlink-cross
$(exeext
); \
262 if
[ -f
$(GCC_DIR
)/gnatls
$(exeext
) ] ; then \
263 mv
$(GCC_DIR
)/gnatls
$(exeext
) $(GCC_DIR
)/gnatls-cross
$(exeext
); \
265 if
[ -f
$(GCC_DIR
)/gnatmake
$(exeext
) ] ; then \
266 mv
$(GCC_DIR
)/gnatmake
$(exeext
) $(GCC_DIR
)/gnatmake-cross
$(exeext
); \
268 if
[ -f
$(GCC_DIR
)/gnatmem
$(exeext
) ] ; then \
269 mv
$(GCC_DIR
)/gnatmem
$(exeext
) $(GCC_DIR
)/gnatmem-cross
$(exeext
); \
271 if
[ -f
$(GCC_DIR
)/gnatname
$(exeext
) ] ; then \
272 mv
$(GCC_DIR
)/gnatname
$(exeext
) $(GCC_DIR
)/gnatname-cross
$(exeext
); \
274 if
[ -f
$(GCC_DIR
)/gnatprep
$(exeext
) ] ; then \
275 mv
$(GCC_DIR
)/gnatprep
$(exeext
) $(GCC_DIR
)/gnatprep-cross
$(exeext
); \
277 if
[ -f
$(GCC_DIR
)/gnatxref
$(exeext
) ] ; then \
278 mv
$(GCC_DIR
)/gnatxref
$(exeext
) $(GCC_DIR
)/gnatxref-cross
$(exeext
); \
280 if
[ -f
$(GCC_DIR
)/gnatfind
$(exeext
) ] ; then \
281 mv
$(GCC_DIR
)/gnatfind
$(exeext
) $(GCC_DIR
)/gnatfind-cross
$(exeext
); \
283 if
[ -f
$(GCC_DIR
)/gnatclean
$(exeext
) ] ; then \
284 mv
$(GCC_DIR
)/gnatclean
$(exeext
) $(GCC_DIR
)/gnatclean-cross
$(exeext
); \
286 if
[ -f
$(GCC_DIR
)/gnatsym
$(exeext
) ] ; then \
287 mv
$(GCC_DIR
)/gnatsym
$(exeext
) $(GCC_DIR
)/gnatsym-cross
$(exeext
); \
293 # Check uninstalled version.
296 # Check installed version.
299 # Build info (none here).
302 # Build DVI (none here).
305 # Build TAGS (none here).
308 # Installation rules.
319 $(RM
) Makefile config.status config.log
323 # Rules for rebuilding this Makefile.
324 Makefile
: $(srcdir)/Makefile.in config.status
327 $(SHELL
) .
/config.status
329 config.status
: $(srcdir)/configure
330 $(SHELL
) .
/config.status
--recheck
332 $(srcdir)/configure
: @MAINT@
$(srcdir)/configure.ac
333 cd
$(srcdir) && autoconf
335 # Don't export variables to the environment, in order to not confuse