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.
30 INSTALL_DATA
= @INSTALL_DATA@
31 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
33 # Nonstandard autoconf-set variables.
35 target_noncanonical
=@target_noncanonical@
36 host_noncanonical
=@host_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 # 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 TOOLS_FLAGS_TO_PASS_NATIVE
= \
74 "CC=../../xgcc -B../../" \
76 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
77 "LDFLAGS=$(LDFLAGS)" \
78 "ADAFLAGS=$(ADAFLAGS)" \
79 "ADA_CFLAGS=$(ADA_CFLAGS)" \
80 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
81 "ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
83 "fsrcdir=$(fsrcdir)" \
85 "GNATMAKE=../../gnatmake" \
86 "GNATLINK=../../gnatlink" \
87 "GNATBIND=../../gnatbind" \
90 # Variables for regnattools
91 TOOLS_FLAGS_TO_PASS_RE
= \
92 "CC=../../xgcc -B../../" \
95 "LDFLAGS=$(LDFLAGS)" \
96 "ADAFLAGS=$(ADAFLAGS)" \
97 "ADA_CFLAGS=$(ADA_CFLAGS)" \
98 "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
99 "ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
101 "fsrcdir=$(fsrcdir)" \
102 "srcdir=$(fsrcdir)" \
103 "GNATMAKE=../../gnatmake" \
104 "GNATLINK=../../gnatlink" \
105 "GNATBIND=../../gnatbind" \
108 # Variables for gnattools, cross
109 ifeq ($(build
), $(host
))
110 GNATMAKE_FOR_HOST
=gnatmake
111 GNATLINK_FOR_HOST
=gnatlink
112 GNATBIND_FOR_HOST
=gnatbind
113 GNATLS_FOR_HOST
=gnatls
115 GNATMAKE_FOR_HOST
=$(host_noncanonical
)-gnatmake
116 GNATLINK_FOR_HOST
=$(host_noncanonical
)-gnatlink
117 GNATBIND_FOR_HOST
=$(host_noncanonical
)-gnatbind
118 GNATLS_FOR_HOST
=$(host_noncanonical
)-gnatls
121 # Put the host RTS dir first in the PATH to hide the default runtime
122 # files that are among the sources
123 RTS_DIR
:=$(strip $(subst \
,/,$(shell $(GNATLS_FOR_HOST
) -v | grep adalib
)))
125 TOOLS_FLAGS_TO_PASS_CROSS
= \
128 "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
129 "LDFLAGS=$(LDFLAGS)" \
130 "ADAFLAGS=$(ADAFLAGS)" \
131 "ADA_CFLAGS=$(ADA_CFLAGS)" \
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_FOR_HOST)" \
138 "GNATLINK=$(GNATLINK_FOR_HOST)" \
139 "GNATBIND=$(GNATBIND_FOR_HOST)" \
146 # File associations set by configure
147 EXTRA_GNATTOOLS
= @EXTRA_GNATTOOLS@
148 TOOLS_TARGET_PAIRS
= @TOOLS_TARGET_PAIRS@
153 .PHONY
: gnattools gnattools-native gnattools-cross regnattools
154 gnattools
: @default_gnattools_target@
157 $(GCC_DIR
)/stamp-gnatlib-rts
:
158 @if
[ ! -f
$(GCC_DIR
)/stamp-gnatlib-rts
] ; \
160 echo
"Cannot build gnattools while gnatlib is out of date or unbuilt" ; \
167 # Build directory for the tools. Let's copy the target-dependent
168 # sources using the same mechanism as for gnatlib. The other sources are
169 # accessed using the vpath directive in ada/Makefile.in
171 $(GCC_DIR
)/stamp-tools
:
172 -rm -rf
$(GCC_DIR
)/ada
/tools
173 -mkdir
-p
$(GCC_DIR
)/ada
/tools
174 -(cd
$(GCC_DIR
)/ada
/tools
; $(LN_S
) ..
/sdefault.adb ..
/snames.ads ..
/snames.adb .
)
175 -$(foreach PAIR
,$(TOOLS_TARGET_PAIRS
), \
176 rm -f
$(GCC_DIR
)/ada
/tools
/$(word 1,$(subst <, ,$(PAIR
)));\
177 $(LN_S
) $(fsrcdir
)/ada
/$(word 2,$(subst <, ,$(PAIR
))) \
178 $(GCC_DIR
)/ada
/tools
/$(word 1,$(subst <, ,$(PAIR
)));)
179 touch
$(GCC_DIR
)/stamp-tools
181 # gnatmake/link tools cannot always be built with gnatmake/link for bootstrap
182 # reasons: gnatmake should be built with a recent compiler, a recent compiler
183 # may not generate ALI files compatible with an old gnatmake so it is important
184 # to be able to build gnatmake without a version of gnatmake around. Once
185 # everything has been compiled once, gnatmake can be recompiled with itself
186 # (see target regnattools)
187 gnattools-native
: $(GCC_DIR
)/stamp-tools
$(GCC_DIR
)/stamp-gnatlib-rts
189 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
190 $(TOOLS_FLAGS_TO_PASS_NATIVE
) \
191 ..
/..
/gnatmake
$(exeext
) ..
/..
/gnatlink
$(exeext
)
193 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
194 $(TOOLS_FLAGS_TO_PASS_NATIVE
) common-tools
196 # gnatmake/link can be built with recent gnatmake/link if they are available.
197 # This is especially convenient for building cross tools or for rebuilding
198 # the tools when the original bootstrap has already be done.
199 regnattools
: $(GCC_DIR
)/stamp-gnatlib-rts
201 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
202 $(TOOLS_FLAGS_TO_PASS_RE
) INCLUDES
="" \
203 gnatmake-re gnatlink-re
205 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
206 $(TOOLS_FLAGS_TO_PASS_NATIVE
) common-tools
208 gnattools-cross
: $(GCC_DIR
)/stamp-tools
210 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
211 $(TOOLS_FLAGS_TO_PASS_CROSS
) INCLUDES
="" \
212 gnatmake-re gnatlink-re
214 $(MAKE
) -C
$(GCC_DIR
)/ada
/tools
-f ..
/Makefile \
215 $(TOOLS_FLAGS_TO_PASS_CROSS
) common-tools
220 # Check uninstalled version.
223 # Check installed version.
226 # Build info (none here).
229 # Build DVI (none here).
232 # Build PDF (none here).
235 # Build HTML (none here).
238 .PHONY
: check installcheck info dvi pdf html
240 # Build TAGS (none here).
243 # Installation rules.
246 install-strip
: install
254 .PHONY
: install install-strip install-info install-pdf install-html
262 $(RM
) Makefile config.status config.log config.cache
266 .PHONY
: mostlyclean clean distclean maintainer-clean
268 # Rules for rebuilding this Makefile.
269 Makefile
: $(srcdir)/Makefile.in config.status
272 $(SHELL
) .
/config.status
274 config.status
: $(srcdir)/configure
275 $(SHELL
) .
/config.status
--recheck
279 $(srcdir)/configure.ac \
280 $(srcdir)/..
/config
/acx.m4 \
281 $(srcdir)/..
/config
/override.m4
283 $(srcdir)/configure
: @MAINT@
$(configure_deps
)
284 cd
$(srcdir) && $(AUTOCONF
)
286 # Don't export variables to the environment, in order to not confuse