Commit | Line | Data |
---|---|---|
52d7cdee | 1 | [+ AutoGen5 template -*- Mode: Makefile -*- |
405ea7a0 NN |
2 | in |
3 | +] | |
4 | ||
5 | # Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'. | |
6 | # | |
7 | # Makefile for directory with subdirs to build. | |
8 | # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, | |
378fce5b | 9 | # 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation |
405ea7a0 NN |
10 | # |
11 | # This file is free software; you can redistribute it and/or modify | |
12 | # it under the terms of the GNU General Public License as published by | |
13 | # the Free Software Foundation; either version 2 of the License, or | |
14 | # (at your option) any later version. | |
15 | # | |
16 | # This program is distributed in the hope that it will be useful, | |
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | # GNU General Public License for more details. | |
20 | # | |
21 | # You should have received a copy of the GNU General Public License | |
22 | # along with this program; if not, write to the Free Software | |
6e4d0bcb | 23 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
405ea7a0 NN |
24 | # |
25 | ||
50212802 NN |
26 | # ------------------------------- |
27 | # Standard Autoconf-set variables | |
28 | # ------------------------------- | |
583d52d7 | 29 | VPATH=@srcdir@ |
583d52d7 NN |
30 | |
31 | build_alias=@build_alias@ | |
7f121bbf | 32 | build=@build@ |
583d52d7 | 33 | host_alias=@host_alias@ |
7f121bbf | 34 | host=@host@ |
583d52d7 | 35 | target_alias=@target_alias@ |
7f121bbf | 36 | target=@target@ |
583d52d7 | 37 | |
50212802 | 38 | program_transform_name = @program_transform_name@ |
c66d951e NN |
39 | |
40 | prefix = @prefix@ | |
41 | exec_prefix = @exec_prefix@ | |
42 | ||
50212802 NN |
43 | srcdir = @srcdir@ |
44 | ||
c66d951e NN |
45 | bindir = @bindir@ |
46 | sbindir = @sbindir@ | |
47 | libexecdir = @libexecdir@ | |
48 | datadir = @datadir@ | |
49 | sysconfdir = @sysconfdir@ | |
50 | sharedstatedir = @sharedstatedir@ | |
51 | localstatedir = @localstatedir@ | |
52 | libdir = @libdir@ | |
53 | includedir = @includedir@ | |
54 | oldincludedir = @oldincludedir@ | |
55 | infodir = @infodir@ | |
56 | mandir = @mandir@ | |
405ea7a0 NN |
57 | man1dir = $(mandir)/man1 |
58 | man2dir = $(mandir)/man2 | |
59 | man3dir = $(mandir)/man3 | |
60 | man4dir = $(mandir)/man4 | |
61 | man5dir = $(mandir)/man5 | |
62 | man6dir = $(mandir)/man6 | |
63 | man7dir = $(mandir)/man7 | |
64 | man8dir = $(mandir)/man8 | |
65 | man9dir = $(mandir)/man9 | |
405ea7a0 | 66 | |
e5c3f801 NN |
67 | INSTALL = @INSTALL@ |
68 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
69 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | |
70 | INSTALL_DATA = @INSTALL_DATA@ | |
656fdd47 PB |
71 | LN = @LN@ |
72 | LN_S = @LN_S@ | |
405ea7a0 | 73 | |
50212802 NN |
74 | # ------------------------------------------------- |
75 | # Miscellaneous non-standard autoconf-set variables | |
76 | # ------------------------------------------------- | |
405ea7a0 | 77 | |
50212802 NN |
78 | # The gcc driver likes to know the arguments it was configured with. |
79 | TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@ | |
405ea7a0 | 80 | |
50212802 NN |
81 | tooldir = @tooldir@ |
82 | build_tooldir = @build_tooldir@ | |
405ea7a0 | 83 | |
50212802 | 84 | GDB_NLM_DEPS = |
405ea7a0 | 85 | |
50212802 NN |
86 | # This is the name of the environment variable used for the path to |
87 | # the libraries. | |
88 | RPATH_ENVVAR = @RPATH_ENVVAR@ | |
405ea7a0 | 89 | |
50212802 | 90 | # This is the list of directories to be built for the build system. |
be75bbe1 | 91 | BUILD_CONFIGDIRS = libiberty |
50212802 NN |
92 | # Build programs are put under this directory. |
93 | BUILD_SUBDIR = @build_subdir@ | |
94 | # This is set by the configure script to the arguments to use when configuring | |
95 | # directories built for the build system. | |
a7254363 | 96 | BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)" |
6a9cf61e PB |
97 | |
98 | # This is the list of variables to export in the environment when | |
99 | # configuring any subdirectory. It must also be exported whenever | |
100 | # recursing into a build directory in case that directory's Makefile | |
101 | # re-runs configure. | |
102 | BASE_EXPORTS = \ | |
103 | FLEX="$(FLEX)"; export FLEX; \ | |
104 | LEX="$(LEX)"; export LEX; \ | |
105 | BISON="$(BISON)"; export BISON; \ | |
106 | YACC="$(YACC)"; export YACC; \ | |
107 | M4="$(M4)"; export M4; \ | |
108 | MAKEINFO="$(MAKEINFO)"; export MAKEINFO; | |
109 | ||
378fce5b | 110 | # This is the list of variables to export in the environment when |
6a9cf61e | 111 | # configuring subdirectories for the build system. |
378fce5b | 112 | BUILD_EXPORTS = \ |
6a9cf61e | 113 | $(BASE_EXPORTS) \ |
378fce5b DD |
114 | AR="$(AR_FOR_BUILD)"; export AR; \ |
115 | AS="$(AS_FOR_BUILD)"; export AS; \ | |
116 | CC="$(CC_FOR_BUILD)"; export CC; \ | |
117 | CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ | |
118 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ | |
119 | CXX="$(CXX_FOR_BUILD)"; export CXX; \ | |
120 | CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ | |
121 | GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \ | |
122 | GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ | |
123 | DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \ | |
124 | LD="$(LD_FOR_BUILD)"; export LD; \ | |
125 | LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \ | |
126 | NM="$(NM_FOR_BUILD)"; export NM; \ | |
127 | RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \ | |
128 | WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; | |
50212802 NN |
129 | |
130 | # This is the list of directories to built for the host system. | |
131 | SUBDIRS = @configdirs@ | |
132 | # This is set by the configure script to the arguments to use when configuring | |
133 | # directories built for the host system. | |
134 | HOST_CONFIGARGS = @host_configargs@ | |
b00612cc PB |
135 | # Host programs are put under this directory, which is . except if building |
136 | # with srcdir=.. | |
137 | HOST_SUBDIR = @host_subdir@ | |
378fce5b | 138 | # This is the list of variables to export in the environment when |
6a9cf61e | 139 | # configuring subdirectories for the host system. |
378fce5b | 140 | HOST_EXPORTS = \ |
6a9cf61e | 141 | $(BASE_EXPORTS) \ |
378fce5b DD |
142 | CC="$(CC)"; export CC; \ |
143 | CFLAGS="$(CFLAGS)"; export CFLAGS; \ | |
144 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ | |
145 | CXX="$(CXX)"; export CXX; \ | |
146 | CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ | |
147 | AR="$(AR)"; export AR; \ | |
148 | AS="$(AS)"; export AS; \ | |
149 | CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ | |
150 | DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ | |
151 | LD="$(LD)"; export LD; \ | |
152 | LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ | |
153 | NM="$(NM)"; export NM; \ | |
154 | RANLIB="$(RANLIB)"; export RANLIB; \ | |
155 | WINDRES="$(WINDRES)"; export WINDRES; \ | |
156 | OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ | |
95b6a1f2 | 157 | OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ |
378fce5b DD |
158 | TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ |
159 | GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \ | |
315b3b02 | 160 | GMPINC="$(HOST_GMPINC)"; export GMPINC; \ |
f70224b5 PB |
161 | @if gcc-bootstrap |
162 | $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ | |
163 | @endif gcc-bootstrap | |
e90269c8 | 164 | $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); |
378fce5b DD |
165 | |
166 | # Similar, for later GCC stages. | |
d545f33b | 167 | POSTSTAGE1_HOST_EXPORTS = \ |
7ffa0b57 | 168 | $(HOST_EXPORTS) \ |
b00612cc PB |
169 | CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \ |
170 | -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \ | |
171 | CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \ | |
172 | $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \ | |
173 | -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ | |
174 | -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; | |
50212802 NN |
175 | |
176 | # This is set by the configure script to the list of directories which | |
177 | # should be built using the target tools. | |
178 | TARGET_CONFIGDIRS = @target_configdirs@ | |
179 | # Target libraries are put under this directory: | |
180 | TARGET_SUBDIR = @target_subdir@ | |
181 | # This is set by the configure script to the arguments to use when configuring | |
182 | # directories built for the target. | |
a7254363 | 183 | TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)" |
378fce5b | 184 | # This is the list of variables to export in the environment when |
6a9cf61e | 185 | # configuring subdirectories for the host system. |
378fce5b | 186 | BASE_TARGET_EXPORTS = \ |
6a9cf61e | 187 | $(BASE_EXPORTS) \ |
378fce5b DD |
188 | AR="$(AR_FOR_TARGET)"; export AR; \ |
189 | AS="$(AS_FOR_TARGET)"; export AS; \ | |
190 | CC="$(CC_FOR_TARGET)"; export CC; \ | |
191 | CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ | |
192 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ | |
06bcb89d | 193 | CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \ |
378fce5b DD |
194 | CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ |
195 | GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ | |
196 | GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \ | |
197 | DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ | |
198 | LD="$(LD_FOR_TARGET)"; export LD; \ | |
199 | LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ | |
7e0f7140 | 200 | LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \ |
378fce5b | 201 | NM="$(NM_FOR_TARGET)"; export NM; \ |
5ae72758 | 202 | OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \ |
378fce5b | 203 | RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ |
7e0f7140 | 204 | STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \ |
315b3b02 | 205 | WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ |
e90269c8 | 206 | $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); |
378fce5b DD |
207 | |
208 | RAW_CXX_TARGET_EXPORTS = \ | |
209 | $(BASE_TARGET_EXPORTS) \ | |
210 | CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ | |
211 | CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; | |
212 | ||
213 | NORMAL_TARGET_EXPORTS = \ | |
214 | $(BASE_TARGET_EXPORTS) \ | |
215 | CXX="$(CXX_FOR_TARGET)"; export CXX; | |
50212802 | 216 | |
4b1cb4fe DD |
217 | # Where to find GMP |
218 | HOST_GMPLIBS = @gmplibs@ | |
219 | HOST_GMPINC = @gmpinc@ | |
220 | ||
50212802 NN |
221 | # ---------------------------------------------- |
222 | # Programs producing files for the BUILD machine | |
223 | # ---------------------------------------------- | |
224 | ||
225 | SHELL = @config_shell@ | |
226 | ||
227 | # pwd command to use. Allow user to override default by setting PWDCMD in | |
228 | # the environment to account for automounters. The make variable must not | |
229 | # be called PWDCMD, otherwise the value set here is passed to make | |
230 | # subprocesses and overrides the setting from the user's environment. | |
b40e3958 L |
231 | # Don't use PWD since it is a common shell environment variable and we |
232 | # don't want to corrupt it. | |
233 | PWD_COMMAND = $${PWDCMD-pwd} | |
50212802 NN |
234 | |
235 | # compilers to use to create programs which must be run in the build | |
236 | # environment. | |
237 | CC_FOR_BUILD = @CC_FOR_BUILD@ | |
5fbad20a | 238 | CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ |
50212802 NN |
239 | |
240 | CXX_FOR_BUILD = $(CXX) | |
241 | ||
242 | # Special variables passed down in EXTRA_GCC_FLAGS. They are defined | |
243 | # here so that they can be overridden by Makefile fragments. | |
50212802 NN |
244 | BUILD_PREFIX = @BUILD_PREFIX@ |
245 | BUILD_PREFIX_1 = @BUILD_PREFIX_1@ | |
405ea7a0 | 246 | |
0df3d27f PB |
247 | # Flags to pass to stage2 and later makes. They are defined |
248 | # here so that they can be overridden by Makefile fragments. | |
249 | BOOT_CFLAGS= -g -O2 | |
250 | ||
6a9cf61e | 251 | CONFIGURED_BISON = @CONFIGURED_BISON@ |
72b2455a PB |
252 | BISON = `if [ -f $$r/$(BUILD_SUBDIR)/bison/tests/bison ] ; then \ |
253 | echo $$r/$(BUILD_SUBDIR)/bison/tests/bison ; \ | |
405ea7a0 | 254 | else \ |
6a9cf61e | 255 | echo ${CONFIGURED_BISON} ; \ |
405ea7a0 NN |
256 | fi` |
257 | ||
6a9cf61e | 258 | CONFIGURED_YACC = @CONFIGURED_YACC@ |
72b2455a PB |
259 | YACC = `if [ -f $$r/$(BUILD_SUBDIR)/bison/tests/bison ] ; then \ |
260 | echo $$r/$(BUILD_SUBDIR)/bison/tests/bison -y ; \ | |
261 | elif [ -f $$r/$(BUILD_SUBDIR)/byacc/byacc ] ; then \ | |
262 | echo $$r/$(BUILD_SUBDIR)/byacc/byacc ; \ | |
405ea7a0 | 263 | else \ |
6a9cf61e | 264 | echo ${CONFIGURED_YACC} ; \ |
405ea7a0 NN |
265 | fi` |
266 | ||
6a9cf61e | 267 | CONFIGURED_FLEX = @CONFIGURED_FLEX@ |
72b2455a PB |
268 | FLEX = `if [ -f $$r/$(BUILD_SUBDIR)/flex/flex ] ; \ |
269 | then echo $$r/$(BUILD_SUBDIR)/flex/flex ; \ | |
6a9cf61e PB |
270 | else echo ${CONFIGURED_FLEX} ; fi` |
271 | ||
272 | CONFIGURED_LEX = @CONFIGURED_LEX@ | |
72b2455a PB |
273 | LEX = `if [ -f $$r/$(BUILD_SUBDIR)/flex/flex ] ; \ |
274 | then echo $$r/$(BUILD_SUBDIR)/flex/flex ; \ | |
6a9cf61e | 275 | else echo ${CONFIGURED_LEX} ; fi` |
405ea7a0 | 276 | |
6a9cf61e | 277 | CONFIGURED_M4 = @CONFIGURED_M4@ |
72b2455a PB |
278 | M4 = `if [ -f $$r/$(BUILD_SUBDIR)/m4/m4 ] ; \ |
279 | then echo $$r/$(BUILD_SUBDIR)/m4/m4 ; \ | |
6a9cf61e | 280 | else echo ${CONFIGURED_M4} ; fi` |
405ea7a0 | 281 | |
77f7441a | 282 | # For an installed makeinfo, we require it to be from texinfo 4.2 or |
6a9cf61e PB |
283 | # higher, else we use the "missing" dummy. We also pass the subdirectory |
284 | # makeinfo even if only the Makefile is there, because Texinfo builds its | |
285 | # manual when made, and it requires its own version. | |
286 | CONFIGURED_MAKEINFO = @CONFIGURED_MAKEINFO@ | |
72b2455a PB |
287 | MAKEINFO = `if [ -f $$r/$(BUILD_SUBDIR)/texinfo/makeinfo/Makefile ] ; \ |
288 | then echo $$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo ; \ | |
6a9cf61e | 289 | else if (${CONFIGURED_MAKEINFO} --version \ |
77f7441a | 290 | | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])') >/dev/null 2>&1; \ |
6a9cf61e | 291 | then echo ${CONFIGURED_MAKEINFO}; else echo $$s/missing makeinfo; fi; fi` |
405ea7a0 NN |
292 | |
293 | # This just becomes part of the MAKEINFO definition passed down to | |
294 | # sub-makes. It lets flags be given on the command line while still | |
295 | # using the makeinfo from the object tree. | |
62a3fc85 DD |
296 | # (Default to avoid splitting info files by setting the threshold high.) |
297 | MAKEINFOFLAGS = --split-size=5000000 | |
405ea7a0 | 298 | |
b00612cc PB |
299 | # FIXME: expect may become a build tool? |
300 | EXPECT = `if [ -f $$r/$(HOST_SUBDIR)/expect/expect ] ; \ | |
301 | then echo $$r/$(HOST_SUBDIR)/expect/expect ; \ | |
405ea7a0 NN |
302 | else echo expect ; fi` |
303 | ||
304 | RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \ | |
305 | then echo $$s/dejagnu/runtest ; \ | |
306 | else echo runtest ; fi` | |
307 | ||
50212802 NN |
308 | # --------------------------------------------- |
309 | # Programs producing files for the HOST machine | |
310 | # --------------------------------------------- | |
405ea7a0 | 311 | |
50212802 | 312 | AS = @AS@ |
405ea7a0 | 313 | |
50212802 NN |
314 | AR = @AR@ |
315 | AR_FLAGS = rc | |
405ea7a0 | 316 | |
50212802 NN |
317 | CC = @CC@ |
318 | CFLAGS = @CFLAGS@ | |
319 | LIBCFLAGS = $(CFLAGS) | |
405ea7a0 | 320 | |
50212802 NN |
321 | CXX = @CXX@ |
322 | CXXFLAGS = @CXXFLAGS@ | |
323 | LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates | |
405ea7a0 | 324 | |
50212802 | 325 | DLLTOOL = @DLLTOOL@ |
405ea7a0 | 326 | |
50212802 | 327 | NM = @NM@ |
15723a45 | 328 | |
50212802 NN |
329 | LD = @LD@ |
330 | LDFLAGS = | |
15723a45 | 331 | |
50212802 | 332 | RANLIB = @RANLIB@ |
405ea7a0 | 333 | |
50212802 | 334 | WINDRES = @WINDRES@ |
405ea7a0 | 335 | |
50212802 NN |
336 | PICFLAG = |
337 | ||
338 | # ----------------------------------------------- | |
339 | # Programs producing files for the TARGET machine | |
340 | # ----------------------------------------------- | |
405ea7a0 | 341 | |
58daee98 | 342 | FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@ |
405ea7a0 | 343 | |
50212802 | 344 | AR_FOR_TARGET=@AR_FOR_TARGET@ |
54752a6b | 345 | CONFIGURED_AR_FOR_TARGET=@CONFIGURED_AR_FOR_TARGET@ |
50212802 | 346 | USUAL_AR_FOR_TARGET = ` \ |
b00612cc PB |
347 | if [ -f $$r/$(HOST_SUBDIR)/binutils/ar ] ; then \ |
348 | echo $$r/$(HOST_SUBDIR)/binutils/ar ; \ | |
50212802 | 349 | else \ |
7f121bbf | 350 | if [ '$(host)' = '$(target)' ] ; then \ |
50212802 NN |
351 | echo $(AR); \ |
352 | else \ | |
54752a6b | 353 | echo $(CONFIGURED_AR_FOR_TARGET) ; \ |
50212802 NN |
354 | fi; \ |
355 | fi` | |
405ea7a0 | 356 | |
852e5f18 | 357 | AS_FOR_TARGET=@AS_FOR_TARGET@ |
54752a6b | 358 | CONFIGURED_AS_FOR_TARGET=@CONFIGURED_AS_FOR_TARGET@ |
852e5f18 | 359 | USUAL_AS_FOR_TARGET = ` \ |
b00612cc PB |
360 | if [ -f $$r/$(HOST_SUBDIR)/gas/as-new ] ; then \ |
361 | echo $$r/$(HOST_SUBDIR)/gas/as-new ; \ | |
55db4b87 PB |
362 | elif [ -f $$r/$(HOST_SUBDIR)/gcc/as ]; then \ |
363 | echo $$r/$(HOST_SUBDIR)/gcc/as ; \ | |
405ea7a0 | 364 | else \ |
7f121bbf | 365 | if [ '$(host)' = '$(target)' ] ; then \ |
405ea7a0 NN |
366 | echo $(AS); \ |
367 | else \ | |
54752a6b | 368 | echo $(CONFIGURED_AS_FOR_TARGET) ; \ |
405ea7a0 NN |
369 | fi; \ |
370 | fi` | |
371 | ||
55db4b87 PB |
372 | CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET) |
373 | CONFIGURED_CC_FOR_TARGET=@CONFIGURED_CC_FOR_TARGET@ | |
374 | USUAL_CC_FOR_TARGET = ` \ | |
375 | if [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ] ; then \ | |
e1e3d0f5 | 376 | echo $$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/ ; \ |
55db4b87 PB |
377 | else \ |
378 | if [ '$(host)' = '$(target)' ] ; then \ | |
379 | echo $(CC); \ | |
380 | else \ | |
381 | echo $(CONFIGURED_CC_FOR_TARGET) ; \ | |
382 | fi; \ | |
383 | fi` | |
384 | ||
50212802 NN |
385 | # During gcc bootstrap, if we use some random cc for stage1 then |
386 | # CFLAGS will be just -g. We want to ensure that TARGET libraries | |
387 | # (which we know are built with gcc) are built with optimizations so | |
388 | # prepend -O2 when setting CFLAGS_FOR_TARGET. | |
a19b6204 | 389 | CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) |
55db4b87 PB |
390 | SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ |
391 | ||
50212802 NN |
392 | # If GCC_FOR_TARGET is not overriden on the command line, then this |
393 | # variable is passed down to the gcc Makefile, where it is used to | |
394 | # build libgcc2.a. We define it here so that it can itself be | |
395 | # overridden on the command line. | |
396 | GCC_FOR_TARGET=@GCC_FOR_TARGET@ | |
55db4b87 | 397 | CONFIGURED_GCC_FOR_TARGET=@CONFIGURED_GCC_FOR_TARGET@ |
b00612cc PB |
398 | USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) \ |
399 | $$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/ $(FLAGS_FOR_TARGET) | |
50212802 NN |
400 | LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) |
401 | ||
55db4b87 PB |
402 | CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET) |
403 | CONFIGURED_CXX_FOR_TARGET=@CONFIGURED_CXX_FOR_TARGET@ | |
404 | USUAL_CXX_FOR_TARGET = ` \ | |
405 | if [ -f $$r/$(HOST_SUBDIR)/gcc/g++ ] ; then \ | |
406 | (echo $$r/$(HOST_SUBDIR)/gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++; \ | |
407 | test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; \ | |
408 | echo -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs) | tr '\015\012' ' '; \ | |
409 | else \ | |
410 | if [ '$(host)' = '$(target)' ] ; then \ | |
411 | echo $(CXX); \ | |
412 | else \ | |
413 | echo $(CONFIGURED_CXX_FOR_TARGET) ; \ | |
414 | fi; \ | |
415 | fi` | |
416 | ||
417 | RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET) | |
418 | USUAL_RAW_CXX_FOR_TARGET = ` \ | |
419 | if [ -f $$r/$(HOST_SUBDIR)/gcc/xgcc ] ; then \ | |
420 | echo $$r/$(HOST_SUBDIR)/gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs; \ | |
421 | else \ | |
422 | if [ '$(host)' = '$(target)' ] ; then \ | |
423 | echo $(CXX); \ | |
424 | else \ | |
425 | echo $(CONFIGURED_CXX_FOR_TARGET) ; \ | |
426 | fi; \ | |
427 | fi` | |
428 | ||
a19b6204 | 429 | CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) |
50212802 | 430 | LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates |
405ea7a0 | 431 | |
55db4b87 PB |
432 | GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET) |
433 | CONFIGURED_GCJ_FOR_TARGET=@CONFIGURED_GCJ_FOR_TARGET@ | |
434 | USUAL_GCJ_FOR_TARGET = ` \ | |
435 | if [ -f $$r/$(HOST_SUBDIR)/gcc/gcj ] ; then \ | |
436 | echo $$r/$(HOST_SUBDIR)/gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc ; \ | |
437 | else \ | |
438 | if [ '$(host)' = '$(target)' ] ; then \ | |
439 | echo $(GCJ); \ | |
440 | else \ | |
441 | echo $(CONFIGURED_GCJ_FOR_TARGET) ; \ | |
442 | fi; \ | |
443 | fi` | |
444 | ||
445 | GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET) | |
446 | CONFIGURED_GFORTRAN_FOR_TARGET=@CONFIGURED_GFORTRAN_FOR_TARGET@ | |
447 | USUAL_GFORTRAN_FOR_TARGET = ` \ | |
448 | if [ -f $$r/$(HOST_SUBDIR)/gcc/gfortran ] ; then \ | |
449 | echo $$r/$(HOST_SUBDIR)/gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc ; \ | |
450 | else \ | |
451 | if [ '$(host)' = '$(target)' ] ; then \ | |
452 | echo $(GFORTRAN); \ | |
453 | else \ | |
454 | echo $(CONFIGURED_GFORTRAN_FOR_TARGET) ; \ | |
455 | fi; \ | |
456 | fi` | |
457 | ||
458 | ||
852e5f18 | 459 | DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@ |
54752a6b | 460 | CONFIGURED_DLLTOOL_FOR_TARGET=@CONFIGURED_DLLTOOL_FOR_TARGET@ |
852e5f18 | 461 | USUAL_DLLTOOL_FOR_TARGET = ` \ |
b00612cc PB |
462 | if [ -f $$r/$(HOST_SUBDIR)/binutils/dlltool ] ; then \ |
463 | echo $$r/$(HOST_SUBDIR)/binutils/dlltool ; \ | |
405ea7a0 | 464 | else \ |
7f121bbf | 465 | if [ '$(host)' = '$(target)' ] ; then \ |
405ea7a0 NN |
466 | echo $(DLLTOOL); \ |
467 | else \ | |
54752a6b | 468 | echo $(CONFIGURED_DLLTOOL_FOR_TARGET) ; \ |
405ea7a0 NN |
469 | fi; \ |
470 | fi` | |
471 | ||
50212802 | 472 | LD_FOR_TARGET=@LD_FOR_TARGET@ |
54752a6b | 473 | CONFIGURED_LD_FOR_TARGET=@CONFIGURED_LD_FOR_TARGET@ |
50212802 | 474 | USUAL_LD_FOR_TARGET = ` \ |
b00612cc PB |
475 | if [ -f $$r/$(HOST_SUBDIR)/ld/ld-new ] ; then \ |
476 | echo $$r/$(HOST_SUBDIR)/ld/ld-new ; \ | |
55db4b87 PB |
477 | elif [ -f $$r/$(HOST_SUBDIR)/gcc/collect-ld ]; then \ |
478 | echo $$r/$(HOST_SUBDIR)/gcc/collect-ld ; \ | |
405ea7a0 | 479 | else \ |
7f121bbf | 480 | if [ '$(host)' = '$(target)' ] ; then \ |
50212802 | 481 | echo $(LD); \ |
405ea7a0 | 482 | else \ |
54752a6b | 483 | echo $(CONFIGURED_LD_FOR_TARGET) ; \ |
405ea7a0 NN |
484 | fi; \ |
485 | fi` | |
486 | ||
50212802 NN |
487 | LDFLAGS_FOR_TARGET = |
488 | ||
7e0f7140 GK |
489 | LIPO_FOR_TARGET=@LIPO_FOR_TARGET@ |
490 | CONFIGURED_LIPO_FOR_TARGET=@CONFIGURED_LIPO_FOR_TARGET@ | |
491 | USUAL_LIPO_FOR_TARGET = ` \ | |
492 | if [ '$(host)' = '$(target)' ] ; then \ | |
493 | if [ x'$(LIPO)' != x ]; then \ | |
494 | echo $(LIPO); \ | |
495 | else \ | |
496 | echo lipo; \ | |
497 | fi; \ | |
498 | else \ | |
499 | echo $(CONFIGURED_LIPO_FOR_TARGET) ; \ | |
500 | fi` | |
501 | ||
50212802 | 502 | NM_FOR_TARGET=@NM_FOR_TARGET@ |
54752a6b | 503 | CONFIGURED_NM_FOR_TARGET=@CONFIGURED_NM_FOR_TARGET@ |
50212802 | 504 | USUAL_NM_FOR_TARGET = ` \ |
b00612cc PB |
505 | if [ -f $$r/$(HOST_SUBDIR)/binutils/nm-new ] ; then \ |
506 | echo $$r/$(HOST_SUBDIR)/binutils/nm-new ; \ | |
55db4b87 PB |
507 | elif [ -f $$r/$(HOST_SUBDIR)/gcc/nm ]; then \ |
508 | echo $$r/$(HOST_SUBDIR)/gcc/nm ; \ | |
405ea7a0 | 509 | else \ |
7f121bbf | 510 | if [ '$(host)' = '$(target)' ] ; then \ |
50212802 | 511 | echo $(NM); \ |
405ea7a0 | 512 | else \ |
54752a6b | 513 | echo $(CONFIGURED_NM_FOR_TARGET) ; \ |
405ea7a0 NN |
514 | fi; \ |
515 | fi` | |
516 | ||
5ae72758 DJ |
517 | OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@ |
518 | CONFIGURED_OBJDUMP_FOR_TARGET=@CONFIGURED_OBJDUMP_FOR_TARGET@ | |
519 | USUAL_OBJDUMP_FOR_TARGET = ` \ | |
520 | if [ -f $$r/$(HOST_SUBDIR)/binutils/objdump ] ; then \ | |
521 | echo $$r/$(HOST_SUBDIR)/binutils/objdump ; \ | |
522 | else \ | |
523 | if [ '$(host)' = '$(target)' ] ; then \ | |
524 | if [ x'$(OBJDUMP)' != x ]; then \ | |
525 | echo $(OBJDUMP); \ | |
526 | else \ | |
527 | echo objdump; \ | |
528 | fi; \ | |
529 | else \ | |
530 | echo $(CONFIGURED_OBJDUMP_FOR_TARGET) ; \ | |
531 | fi; \ | |
532 | fi` | |
533 | ||
852e5f18 | 534 | RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@ |
54752a6b | 535 | CONFIGURED_RANLIB_FOR_TARGET=@CONFIGURED_RANLIB_FOR_TARGET@ |
852e5f18 | 536 | USUAL_RANLIB_FOR_TARGET = ` \ |
b00612cc PB |
537 | if [ -f $$r/$(HOST_SUBDIR)/binutils/ranlib ] ; then \ |
538 | echo $$r/$(HOST_SUBDIR)/binutils/ranlib ; \ | |
405ea7a0 | 539 | else \ |
7f121bbf | 540 | if [ '$(host)' = '$(target)' ] ; then \ |
405ea7a0 NN |
541 | if [ x'$(RANLIB)' != x ]; then \ |
542 | echo $(RANLIB); \ | |
543 | else \ | |
544 | echo ranlib; \ | |
545 | fi; \ | |
546 | else \ | |
54752a6b | 547 | echo $(CONFIGURED_RANLIB_FOR_TARGET) ; \ |
405ea7a0 NN |
548 | fi; \ |
549 | fi` | |
550 | ||
7e0f7140 GK |
551 | STRIP_FOR_TARGET=@STRIP_FOR_TARGET@ |
552 | CONFIGURED_STRIP_FOR_TARGET=@CONFIGURED_STRIP_FOR_TARGET@ | |
553 | USUAL_STRIP_FOR_TARGET = ` \ | |
554 | if [ -f $$r/$(HOST_SUBDIR)/binutils/strip ] ; then \ | |
555 | echo $$r/$(HOST_SUBDIR)/binutils/strip ; \ | |
556 | else \ | |
557 | if [ '$(host)' = '$(target)' ] ; then \ | |
558 | if [ x'$(STRIP)' != x ]; then \ | |
559 | echo $(STRIP); \ | |
560 | else \ | |
561 | echo strip; \ | |
562 | fi; \ | |
563 | else \ | |
564 | echo $(CONFIGURED_STRIP_FOR_TARGET) ; \ | |
565 | fi; \ | |
566 | fi` | |
567 | ||
50212802 | 568 | WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@ |
54752a6b | 569 | CONFIGURED_WINDRES_FOR_TARGET=@CONFIGURED_WINDRES_FOR_TARGET@ |
50212802 | 570 | USUAL_WINDRES_FOR_TARGET = ` \ |
b00612cc PB |
571 | if [ -f $$r/$(HOST_SUBDIR)/binutils/windres ] ; then \ |
572 | echo $$r/$(HOST_SUBDIR)/binutils/windres ; \ | |
405ea7a0 | 573 | else \ |
7f121bbf | 574 | if [ '$(host)' = '$(target)' ] ; then \ |
50212802 | 575 | echo $(WINDRES); \ |
405ea7a0 | 576 | else \ |
54752a6b | 577 | echo $(CONFIGURED_WINDRES_FOR_TARGET) ; \ |
405ea7a0 NN |
578 | fi; \ |
579 | fi` | |
580 | ||
50212802 NN |
581 | PICFLAG_FOR_TARGET = |
582 | ||
583 | # ------------------------------------ | |
584 | # Miscellaneous targets and flag lists | |
585 | # ------------------------------------ | |
586 | ||
405ea7a0 NN |
587 | # The first rule in the file had better be this one. Don't put any above it. |
588 | # This lives here to allow makefile fragments to contain dependencies. | |
f70224b5 | 589 | all: |
405ea7a0 | 590 | |
405ea7a0 | 591 | #### host and target specific makefile fragments come in here. |
a0da8069 NN |
592 | @target_makefile_frag@ |
593 | @alphaieee_frag@ | |
594 | @ospace_frag@ | |
595 | @host_makefile_frag@ | |
405ea7a0 NN |
596 | ### |
597 | ||
e90269c8 PB |
598 | # This is the list of directories that may be needed in RPATH_ENVVAR |
599 | # so that prorgams built for the target machine work. | |
600 | TARGET_LIB_PATH = [+ FOR target_modules +][+ | |
601 | IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+ | |
602 | ENDFOR target_modules +]$(HOST_LIB_PATH_gcc) | |
603 | [+ FOR target_modules +][+ IF lib_path +] | |
604 | @if target-[+module+] | |
605 | TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]: | |
606 | @endif target-[+module+] | |
607 | [+ ENDIF lib_path +][+ ENDFOR target_modules +] | |
608 | ||
609 | ||
610 | # This is the list of directories that may be needed in RPATH_ENVVAR | |
611 | # so that programs built for the host machine work. | |
612 | HOST_LIB_PATH = [+ FOR host_modules +][+ | |
613 | IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+ | |
614 | ENDFOR host_modules +] | |
615 | ||
616 | # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch | |
617 | @if gcc | |
618 | HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc: | |
619 | @endif gcc | |
620 | ||
621 | [+ FOR host_modules +][+ IF lib_path +] | |
622 | @if [+module+] | |
623 | HOST_LIB_PATH_[+module+] = \ | |
624 | $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap | |
625 | +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +] | |
626 | @endif [+module+] | |
627 | [+ ENDIF lib_path +][+ ENDFOR host_modules +] | |
628 | ||
405ea7a0 | 629 | # Flags to pass down to all sub-makes. |
12f0bd74 NN |
630 | BASE_FLAGS_TO_PASS = [+ FOR flags_to_pass +]\ |
631 | "[+flag+]=$([+flag+])" [+ ENDFOR flags_to_pass +]\ | |
10ecffb9 | 632 | "CONFIG_SHELL=$(SHELL)" \ |
12f0bd74 | 633 | "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" |
405ea7a0 | 634 | |
55db4b87 PB |
635 | # We leave this in just in case, but it is not needed anymore. |
636 | RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) | |
656fdd47 | 637 | |
405ea7a0 NN |
638 | # Flags to pass down to most sub-makes, in which we're building with |
639 | # the host environment. | |
405ea7a0 NN |
640 | EXTRA_HOST_FLAGS = \ |
641 | 'AR=$(AR)' \ | |
642 | 'AS=$(AS)' \ | |
643 | 'CC=$(CC)' \ | |
644 | 'CXX=$(CXX)' \ | |
645 | 'DLLTOOL=$(DLLTOOL)' \ | |
646 | 'LD=$(LD)' \ | |
647 | 'NM=$(NM)' \ | |
b9459e83 | 648 | 'RANLIB=$(RANLIB)' \ |
405ea7a0 NN |
649 | 'WINDRES=$(WINDRES)' |
650 | ||
651 | FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) | |
652 | ||
653 | # Flags that are concerned with the location of the X11 include files | |
654 | # and library files | |
655 | # | |
656 | # NOTE: until the top-level is getting the values via autoconf, it only | |
657 | # causes problems to have this top-level Makefile overriding the autoconf-set | |
658 | # values in child directories. Only variables that don't conflict with | |
659 | # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now. | |
660 | # | |
661 | X11_FLAGS_TO_PASS = \ | |
662 | 'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \ | |
663 | 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)' | |
664 | ||
665 | # Flags to pass down to makes which are built with the target environment. | |
666 | # The double $ decreases the length of the command line; the variables | |
667 | # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. | |
405ea7a0 NN |
668 | EXTRA_TARGET_FLAGS = \ |
669 | 'AR=$$(AR_FOR_TARGET)' \ | |
670 | 'AS=$$(AS_FOR_TARGET)' \ | |
671 | 'CC=$$(CC_FOR_TARGET)' \ | |
672 | 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \ | |
673 | 'CXX=$$(CXX_FOR_TARGET)' \ | |
674 | 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \ | |
675 | 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \ | |
676 | 'LD=$$(LD_FOR_TARGET)' \ | |
414e5532 | 677 | 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \ |
405ea7a0 NN |
678 | 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \ |
679 | 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \ | |
680 | 'NM=$$(NM_FOR_TARGET)' \ | |
5ae72758 | 681 | 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \ |
405ea7a0 NN |
682 | 'RANLIB=$$(RANLIB_FOR_TARGET)' \ |
683 | 'WINDRES=$$(WINDRES_FOR_TARGET)' | |
684 | ||
685 | TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) | |
686 | ||
687 | # Flags to pass down to gcc. gcc builds a library, libgcc.a, so it | |
688 | # unfortunately needs the native compiler and the target ar and | |
689 | # ranlib. | |
690 | # If any variables are added here, they must be added to do-*, below. | |
2a4cbe27 | 691 | # The BUILD_* variables are a special case, which are used for the gcc |
405ea7a0 NN |
692 | # cross-building scheme. |
693 | EXTRA_GCC_FLAGS = \ | |
405ea7a0 NN |
694 | 'BUILD_PREFIX=$(BUILD_PREFIX)' \ |
695 | 'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \ | |
405ea7a0 | 696 | "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \ |
3dee29da NN |
697 | "`echo 'LANGUAGES=$(LANGUAGES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ |
698 | "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
699 | "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
700 | "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
701 | "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
702 | "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
703 | "`echo 'STAGE1_CFLAGS=$(STAGE1_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
704 | "`echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ | |
705 | "`echo 'BOOT_ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" | |
405ea7a0 | 706 | |
f0b24077 | 707 | GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) |
405ea7a0 | 708 | |
dd12c3a8 | 709 | .PHONY: configure-host |
b813574b | 710 | configure-host: [+ |
dd12c3a8 NN |
711 | FOR host_modules +] \ |
712 | maybe-configure-[+module+][+ | |
713 | ENDFOR host_modules +] | |
714 | .PHONY: configure-target | |
715 | configure-target: [+ | |
716 | FOR target_modules +] \ | |
717 | maybe-configure-target-[+module+][+ | |
718 | ENDFOR target_modules +] | |
405ea7a0 | 719 | |
319cab08 PB |
720 | # The target built for a native non-bootstrap build. |
721 | .PHONY: all | |
f70224b5 PB |
722 | all: |
723 | @if gcc-bootstrap | |
724 | @r=`${PWD_COMMAND}`; export r; \ | |
725 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
726 | if [ ! -f stage_last ]; then \ | |
727 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) bootstrap; \ | |
728 | fi | |
729 | @endif gcc-bootstrap | |
730 | @$(unstage) | |
cc96343e PB |
731 | @if gcc-no-bootstrap |
732 | @r=`${PWD_COMMAND}`; export r; \ | |
733 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
734 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-prebootstrap | |
735 | @endif gcc-no-bootstrap | |
f70224b5 PB |
736 | @r=`${PWD_COMMAND}`; export r; \ |
737 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
738 | if [ -f stage_last ]; then \ | |
739 | $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host; \ | |
740 | else \ | |
741 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host; \ | |
742 | fi | |
743 | @r=`${PWD_COMMAND}`; export r; \ | |
744 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
745 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-target | |
746 | @$(stage) | |
dd12c3a8 | 747 | |
6a9cf61e PB |
748 | .PHONY: all-build |
749 | all-build: [+ | |
750 | FOR build_modules +] \ | |
751 | maybe-all-build-[+module+][+ | |
752 | ENDFOR build_modules +] | |
dd12c3a8 | 753 | .PHONY: all-host |
b813574b | 754 | all-host: [+ |
dd12c3a8 NN |
755 | FOR host_modules +] \ |
756 | maybe-all-[+module+][+ | |
757 | ENDFOR host_modules +] | |
758 | .PHONY: all-target | |
759 | all-target: [+ | |
760 | FOR target_modules +] \ | |
761 | maybe-all-target-[+module+][+ | |
762 | ENDFOR target_modules +] | |
405ea7a0 NN |
763 | |
764 | # Do a target for all the subdirectories. A ``make do-X'' will do a | |
765 | # ``make X'' in all subdirectories (because, in general, there is a | |
766 | # dependency (below) of X upon do-X, a ``make X'' will also do this, | |
767 | # but it may do additional work as well). | |
e393202e | 768 | [+ FOR recursive_targets +] |
27b1cc72 | 769 | .PHONY: do-[+make_target+] |
f70224b5 PB |
770 | do-[+make_target+]: |
771 | @$(unstage) | |
772 | @$(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \ | |
773 | [+make_target+]-target | |
774 | @$(stage) | |
775 | ||
2a4cbe27 NN |
776 | |
777 | .PHONY: [+make_target+]-host | |
b813574b | 778 | [+make_target+]-host: [+ |
2a4cbe27 NN |
779 | FOR host_modules +] \ |
780 | maybe-[+make_target+]-[+module+][+ | |
781 | ENDFOR host_modules +] | |
782 | ||
783 | .PHONY: [+make_target+]-target | |
784 | [+make_target+]-target: [+ | |
785 | FOR target_modules +] \ | |
786 | maybe-[+make_target+]-target-[+module+][+ | |
787 | ENDFOR target_modules +] | |
e393202e NN |
788 | [+ ENDFOR recursive_targets +] |
789 | ||
405ea7a0 NN |
790 | # Here are the targets which correspond to the do-X targets. |
791 | ||
6d389afc | 792 | .PHONY: info installcheck dvi html install-info |
405ea7a0 NN |
793 | .PHONY: clean distclean mostlyclean maintainer-clean realclean |
794 | .PHONY: local-clean local-distclean local-maintainer-clean | |
795 | info: do-info | |
796 | installcheck: do-installcheck | |
797 | dvi: do-dvi | |
6d389afc | 798 | html: do-html |
405ea7a0 | 799 | |
43d92c63 NN |
800 | # Make sure makeinfo is built before we do a `make info', if we're |
801 | # in fact building texinfo. | |
802 | do-info: maybe-all-texinfo | |
405ea7a0 NN |
803 | |
804 | install-info: do-install-info dir.info | |
b40e3958 | 805 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
405ea7a0 | 806 | if [ -f dir.info ] ; then \ |
497f816e | 807 | $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \ |
405ea7a0 NN |
808 | else true ; fi |
809 | ||
810 | local-clean: | |
811 | -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log | |
812 | ||
813 | local-distclean: | |
814 | -rm -f Makefile config.status config.cache mh-frag mt-frag | |
e6bfb94a | 815 | -rm -f multilib.out multilib.tmp maybedep.tmp serdep.tmp |
405ea7a0 NN |
816 | -if [ "$(TARGET_SUBDIR)" != "." ]; then \ |
817 | rm -rf $(TARGET_SUBDIR); \ | |
818 | else true; fi | |
e4c4d240 | 819 | -rm -rf $(BUILD_SUBDIR) |
b00612cc PB |
820 | -if [ "$(HOST_SUBDIR)" != "." ]; then \ |
821 | rm -rf $(HOST_SUBDIR); \ | |
822 | else true; fi | |
405ea7a0 NN |
823 | -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile |
824 | -rm -f texinfo/doc/Makefile texinfo/po/POTFILES | |
825 | -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null | |
826 | -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null | |
827 | -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null | |
828 | ||
829 | local-maintainer-clean: | |
830 | @echo "This command is intended for maintainers to use;" | |
831 | @echo "it deletes files that may require special tools to rebuild." | |
832 | ||
833 | clean: do-clean local-clean | |
834 | mostlyclean: do-mostlyclean local-clean | |
835 | distclean: do-distclean local-clean local-distclean | |
836 | maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean | |
837 | maintainer-clean: local-distclean | |
838 | realclean: maintainer-clean | |
839 | ||
2a4cbe27 NN |
840 | # Extra dependency for clean-target, owing to the mixed nature of gcc |
841 | clean-target: clean-target-libgcc | |
405ea7a0 NN |
842 | clean-target-libgcc: |
843 | test ! -d gcc/libgcc || \ | |
844 | (cd gcc/libgcc && find . -type d -print) | \ | |
845 | while read d; do rm -f gcc/$$d/libgcc.a || : ; done | |
846 | -rm -rf gcc/libgcc | |
6c8e6ce9 | 847 | -rm -f gcc/stmp-dirs |
405ea7a0 NN |
848 | |
849 | # Check target. | |
850 | ||
851 | .PHONY: check do-check | |
ede4fbe4 | 852 | check: do-check |
405ea7a0 | 853 | |
3866be5d | 854 | # Only include modules actually being configured and built. |
f70224b5 PB |
855 | .PHONY: check-host |
856 | check-host: [+ | |
16ae0395 NN |
857 | FOR host_modules +] \ |
858 | maybe-check-[+module+][+ | |
f70224b5 PB |
859 | ENDFOR host_modules +] |
860 | ||
861 | .PHONY: check-target | |
862 | check-target: [+ | |
16ae0395 NN |
863 | FOR target_modules +] \ |
864 | maybe-check-target-[+module+][+ | |
f70224b5 PB |
865 | ENDFOR target_modules +] |
866 | ||
867 | do-check: | |
868 | @$(unstage) | |
869 | @$(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target | |
870 | @$(stage) | |
405ea7a0 NN |
871 | |
872 | # Automated reporting of test results. | |
873 | ||
874 | warning.log: build.log | |
875 | $(srcdir)/contrib/warn_summary build.log > $@ | |
876 | ||
877 | mail-report.log: | |
878 | if test x'$(BOOT_CFLAGS)' != x''; then \ | |
879 | BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \ | |
880 | fi; \ | |
881 | $(srcdir)/contrib/test_summary -t >$@ | |
882 | chmod +x $@ | |
883 | echo If you really want to send e-mail, run ./$@ now | |
884 | ||
885 | mail-report-with-warnings.log: warning.log | |
886 | if test x'$(BOOT_CFLAGS)' != x''; then \ | |
887 | BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \ | |
888 | fi; \ | |
889 | $(srcdir)/contrib/test_summary -t -i warning.log >$@ | |
890 | chmod +x $@ | |
891 | echo If you really want to send e-mail, run ./$@ now | |
892 | ||
893 | # Installation targets. | |
894 | ||
ae831be5 | 895 | .PHONY: install uninstall |
f70224b5 PB |
896 | install: |
897 | @$(unstage) | |
898 | @$(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target | |
899 | @$(stage) | |
dd12c3a8 | 900 | |
16ae0395 NN |
901 | .PHONY: install-host-nogcc |
902 | install-host-nogcc: [+ | |
9e6ce191 PB |
903 | FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \ |
904 | maybe-install-[+module+][+ ENDIF +][+ | |
16ae0395 NN |
905 | ENDFOR host_modules +] |
906 | ||
dd12c3a8 | 907 | .PHONY: install-host |
b813574b | 908 | install-host: [+ |
dd12c3a8 NN |
909 | FOR host_modules +] \ |
910 | maybe-install-[+module+][+ | |
911 | ENDFOR host_modules +] | |
16ae0395 | 912 | |
dd12c3a8 NN |
913 | .PHONY: install-target |
914 | install-target: [+ | |
915 | FOR target_modules +] \ | |
916 | maybe-install-target-[+module+][+ | |
917 | ENDFOR target_modules +] | |
405ea7a0 NN |
918 | |
919 | uninstall: | |
920 | @echo "the uninstall target is not supported in this tree" | |
921 | ||
405ea7a0 NN |
922 | .PHONY: install.all |
923 | install.all: install-no-fixedincludes | |
924 | @if [ -f ./gcc/Makefile ] ; then \ | |
b40e3958 | 925 | r=`${PWD_COMMAND}` ; export r ; \ |
7ffa0b57 | 926 | $(HOST_EXPORTS) \ |
1086bc09 | 927 | (cd ./gcc && \ |
405ea7a0 NN |
928 | $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \ |
929 | else \ | |
930 | true ; \ | |
931 | fi | |
932 | ||
933 | # install-no-fixedincludes is used because Cygnus can not distribute | |
934 | # the fixed header files. | |
935 | .PHONY: install-no-fixedincludes | |
16ae0395 | 936 | install-no-fixedincludes: installdirs install-host-nogcc \ |
dd12c3a8 | 937 | install-target gcc-no-fixedincludes |
405ea7a0 | 938 | |
15723a45 | 939 | ### other supporting targets |
405ea7a0 | 940 | |
15723a45 NN |
941 | MAKEDIRS= \ |
942 | $(DESTDIR)$(prefix) \ | |
943 | $(DESTDIR)$(exec_prefix) | |
944 | .PHONY: installdirs | |
945 | installdirs: mkinstalldirs | |
946 | $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS) | |
947 | ||
948 | dir.info: do-install-info | |
949 | if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \ | |
497f816e | 950 | $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \ |
15723a45 NN |
951 | mv -f dir.info.new dir.info ; \ |
952 | else true ; \ | |
405ea7a0 NN |
953 | fi |
954 | ||
15723a45 NN |
955 | dist: |
956 | @echo "Building a full distribution of this tree isn't done" | |
957 | @echo "via 'make dist'. Check out the etc/ subdirectory" | |
958 | ||
959 | etags tags: TAGS | |
960 | ||
961 | # Right now this just builds TAGS in each subdirectory. emacs19 has the | |
962 | # ability to use several tags files at once, so there is probably no need | |
963 | # to combine them into one big TAGS file (like CVS 1.3 does). We could | |
964 | # (if we felt like it) have this Makefile write a piece of elisp which | |
965 | # the user could load to tell emacs19 where all the TAGS files we just | |
966 | # built are. | |
967 | TAGS: do-TAGS | |
968 | ||
a7254363 PB |
969 | # ------------------------------------ |
970 | # Macros for configure and all targets | |
971 | # ------------------------------------ | |
972 | ||
973 | [+ DEFINE configure +] | |
974 | .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+] | |
975 | maybe-configure-[+prefix+][+module+]: | |
976 | @if [+prefix+][+module+] | |
977 | maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+] | |
978 | configure-[+prefix+][+module+]: [+deps+] | |
979 | @[+ IF bootstrap +]test -f stage_last && exit 0; \ | |
f70224b5 PB |
980 | [+ ELSE bootstrap +]$(unstage) |
981 | @[+ ENDIF bootstrap +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \ | |
a7254363 | 982 | $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \ |
b40e3958 L |
983 | r=`${PWD_COMMAND}`; export r; \ |
984 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
a7254363 PB |
985 | [+exports+] \ |
986 | echo Configuring in [+subdir+]/[+module+]; \ | |
987 | cd "[+subdir+]/[+module+]" || exit 1; \ | |
bba45b8b | 988 | case $(srcdir) in \ |
b00612cc | 989 | /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ |
a7254363 | 990 | *) topdir=`echo [+subdir+]/[+module+]/ | \ |
b00612cc | 991 | sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ |
bba45b8b | 992 | esac; \ |
b00612cc PB |
993 | srcdiroption="--srcdir=$${topdir}/[+module+]"; \ |
994 | libsrcdir="$$s/[+module+]"; \ | |
a7254363 PB |
995 | [+ IF no-config-site +]rm -f no-such-file || : ; \ |
996 | CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \ | |
997 | [+args+] $${srcdiroption} [+extra_configure_flags+] \ | |
bba45b8b | 998 | || exit 1 |
a7254363 | 999 | @endif [+prefix+][+module+] |
d545f33b PB |
1000 | |
1001 | [+ IF bootstrap +] | |
1002 | [+ FOR bootstrap_stage +] | |
1003 | .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+] | |
1004 | maybe-configure-stage[+id+]-[+prefix+][+module+]: | |
1005 | @if [+module+]-bootstrap | |
1006 | maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+] | |
1007 | configure-stage[+id+]-[+prefix+][+module+]: [+deps+] | |
f70224b5 | 1008 | @[ `cat stage_current` = stage[+id+] ] || $(MAKE) stage[+id+]-start |
d545f33b PB |
1009 | @[ -f [+subdir+]/[+module+]/Makefile ] && exit 0 || : ; \ |
1010 | r=`${PWD_COMMAND}`; export r; \ | |
1011 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1012 | [+exports+][+ IF prev +] \ | |
1013 | [+poststage1_exports+][+ ENDIF prev +] \ | |
1014 | echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \ | |
1015 | cd [+subdir+]/[+module+] || exit 1; \ | |
1016 | case $(srcdir) in \ | |
1017 | /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ | |
1018 | *) topdir=`echo [+subdir+]/[+module+]/ | \ | |
1019 | sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ | |
1020 | esac; \ | |
1021 | srcdiroption="--srcdir=$${topdir}/[+module+]"; \ | |
1022 | libsrcdir="$$s/[+module+]"; \ | |
1023 | $(SHELL) $${libsrcdir}/configure \ | |
1024 | [+args+] $${srcdiroption} \ | |
1025 | [+stage_configure_flags+] [+extra_configure_flags+] | |
1026 | @endif [+module+]-bootstrap | |
1027 | [+ ENDFOR bootstrap_stage +] | |
1028 | [+ ENDIF bootstrap +] | |
a7254363 PB |
1029 | [+ ENDDEF +] |
1030 | ||
1031 | [+ DEFINE all +] | |
1032 | .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+] | |
1033 | maybe-all-[+prefix+][+module+]: | |
1034 | @if [+prefix+][+module+] | |
1035 | TARGET-[+prefix+][+module+]=[+ | |
1036 | IF target +][+target+][+ ELSE +]all[+ ENDIF target +] | |
1037 | maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+] | |
1038 | all-[+prefix+][+module+]: configure-[+prefix+][+module+] | |
1039 | @[+ IF bootstrap +]test -f stage_last && exit 0; \ | |
f70224b5 PB |
1040 | [+ ELSE bootstrap +]$(unstage) |
1041 | @[+ ENDIF bootstrap +]r=`${PWD_COMMAND}`; export r; \ | |
b40e3958 | 1042 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
a7254363 PB |
1043 | [+exports+] \ |
1044 | (cd [+subdir+]/[+module+] && \ | |
1045 | $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+])) | |
1046 | @endif [+prefix+][+module+] | |
d545f33b PB |
1047 | |
1048 | [+ IF bootstrap +] | |
1049 | [+ FOR bootstrap_stage +] | |
1050 | .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+] | |
1051 | .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+] | |
1052 | maybe-all-stage[+id+]-[+prefix+][+module+]: | |
1053 | maybe-clean-stage[+id+]-[+prefix+][+module+]: | |
1054 | @if [+module+]-bootstrap | |
1055 | maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+] | |
1056 | all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+] | |
f70224b5 | 1057 | TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+]) |
d545f33b | 1058 | all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+] |
f70224b5 | 1059 | @[ `cat stage_current` = stage[+id+] ] || $(MAKE) stage[+id+]-start |
d545f33b PB |
1060 | @r=`${PWD_COMMAND}`; export r; \ |
1061 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1062 | [+exports+][+ IF prev +] \ | |
1063 | [+poststage1_exports+][+ ENDIF prev +] \ | |
1064 | cd [+subdir+]/[+module+] && \ | |
1065 | $(MAKE) [+args+] [+ IF prev | |
1066 | +][+poststage1_args+][+ ENDIF prev | |
f70224b5 PB |
1067 | +] [+stage_make_flags+] [+extra_make_flags+] \ |
1068 | $(TARGET-stage[+id+]-[+prefix+][+module+]) | |
d545f33b PB |
1069 | |
1070 | maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+] | |
1071 | clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+] | |
1072 | clean-stage[+id+]-[+prefix+][+module+]: | |
1073 | @[ -f [+subdir+]/[+module+]/Makefile ] || [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] \ | |
1074 | || exit 0 ; \ | |
f70224b5 | 1075 | @[ `cat stage_current` = stage[+id+] ] || $(MAKE) stage[+id+]-start |
d545f33b PB |
1076 | cd [+subdir+]/[+module+] && \ |
1077 | $(MAKE) [+args+] [+ IF prev +] \ | |
1078 | [+poststage1_args+] [+ ENDIF prev +] \ | |
1079 | [+stage_make_flags+] [+extra_make_flags+] clean | |
1080 | @endif [+module+]-bootstrap | |
1081 | ||
1082 | [+ ENDFOR bootstrap_stage +] | |
1083 | [+ ENDIF bootstrap +] | |
a7254363 PB |
1084 | [+ ENDDEF +] |
1085 | ||
1086 | # -------------------------------------- | |
1087 | # Modules which run on the build machine | |
1088 | # -------------------------------------- | |
1089 | [+ FOR build_modules +] | |
1090 | [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" | |
1091 | args="$(BUILD_CONFIGARGS)" no-config-site=true +] | |
1092 | ||
1093 | [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +] | |
1094 | [+ ENDFOR build_module +] | |
405ea7a0 | 1095 | |
15723a45 NN |
1096 | # -------------------------------------- |
1097 | # Modules which run on the host machine | |
1098 | # -------------------------------------- | |
3866be5d | 1099 | [+ FOR host_modules +] |
d545f33b PB |
1100 | [+ configure prefix="" subdir="$(HOST_SUBDIR)" |
1101 | exports="$(HOST_EXPORTS)" | |
1102 | poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)" | |
a7254363 | 1103 | args="$(HOST_CONFIGARGS)" +] |
e2b9e2dc | 1104 | |
d545f33b PB |
1105 | [+ all prefix="" subdir="$(HOST_SUBDIR)" |
1106 | exports="$(HOST_EXPORTS)" | |
1107 | poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)" | |
1108 | args="$(FLAGS_TO_PASS)" | |
1109 | poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +] | |
405ea7a0 | 1110 | |
16ae0395 NN |
1111 | .PHONY: check-[+module+] maybe-check-[+module+] |
1112 | maybe-check-[+module+]: | |
6bd3dfaa PB |
1113 | @if [+module+] |
1114 | maybe-check-[+module+]: check-[+module+] | |
3866be5d | 1115 | [+ IF no_check +] |
3866be5d NN |
1116 | check-[+module+]: |
1117 | [+ ELIF no_check_cross +] | |
3866be5d NN |
1118 | # This module is only tested in a native toolchain. |
1119 | check-[+module+]: | |
f70224b5 | 1120 | @$(unstage) |
7f121bbf | 1121 | @if [ '$(host)' = '$(target)' ] ; then \ |
b40e3958 L |
1122 | r=`${PWD_COMMAND}`; export r; \ |
1123 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
378fce5b | 1124 | $(HOST_EXPORTS) \ |
b00612cc | 1125 | (cd $(HOST_SUBDIR)/[+module+] && \ |
4cfaf6d5 | 1126 | $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \ |
bba45b8b NN |
1127 | fi |
1128 | [+ ELSE check +] | |
bba45b8b | 1129 | check-[+module+]: |
f70224b5 | 1130 | @$(unstage) |
b40e3958 L |
1131 | @r=`${PWD_COMMAND}`; export r; \ |
1132 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
378fce5b | 1133 | $(HOST_EXPORTS) \ |
b00612cc PB |
1134 | (cd $(HOST_SUBDIR)/[+module+] && \ |
1135 | $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check) | |
3866be5d | 1136 | [+ ENDIF no_check +] |
6bd3dfaa | 1137 | @endif [+module+] |
405ea7a0 | 1138 | |
930314a4 NN |
1139 | .PHONY: install-[+module+] maybe-install-[+module+] |
1140 | maybe-install-[+module+]: | |
6bd3dfaa PB |
1141 | @if [+module+] |
1142 | maybe-install-[+module+]: install-[+module+] | |
16ae0395 | 1143 | [+ IF no_install +] |
3866be5d NN |
1144 | install-[+module+]: |
1145 | [+ ELSE install +] | |
3866be5d | 1146 | install-[+module+]: installdirs |
f70224b5 | 1147 | @$(unstage) |
b40e3958 L |
1148 | @r=`${PWD_COMMAND}`; export r; \ |
1149 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
378fce5b | 1150 | $(HOST_EXPORTS) \ |
b00612cc | 1151 | (cd $(HOST_SUBDIR)/[+module+] && \ |
2da12f12 | 1152 | $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install) |
3866be5d | 1153 | [+ ENDIF no_install +] |
6bd3dfaa | 1154 | @endif [+module+] |
4fa63067 NN |
1155 | |
1156 | # Other targets (info, dvi, etc.) | |
1157 | [+ FOR recursive_targets +] | |
1158 | .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+] | |
1159 | maybe-[+make_target+]-[+module+]: | |
6bd3dfaa PB |
1160 | @if [+module+] |
1161 | maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+] | |
4fa63067 NN |
1162 | [+ IF (match-value? = "missing" (get "make_target") ) +] |
1163 | # [+module+] doesn't support [+make_target+]. | |
1164 | [+make_target+]-[+module+]: | |
1165 | [+ ELSE +] | |
1166 | [+make_target+]-[+module+]: [+ | |
1167 | FOR depend +]\ | |
1168 | [+depend+]-[+module+] [+ | |
1169 | ENDFOR depend +] | |
f70224b5 PB |
1170 | @[+ IF bootstrap +][+ ELSE +]$(unstage) |
1171 | @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \ | |
4fa63067 NN |
1172 | r=`${PWD_COMMAND}`; export r; \ |
1173 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
378fce5b | 1174 | $(HOST_EXPORTS) \ |
b813574b | 1175 | for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \ |
4fa63067 NN |
1176 | eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ |
1177 | done; \ | |
1178 | echo "Doing [+make_target+] in [+module+]" ; \ | |
b00612cc | 1179 | (cd $(HOST_SUBDIR)/[+module+] && \ |
4fa63067 NN |
1180 | $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ |
1181 | "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ | |
1182 | "RANLIB=$${RANLIB}" \ | |
1183 | "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ | |
b813574b | 1184 | [+make_target+]) \ |
4fa63067 NN |
1185 | || exit 1 |
1186 | [+ ENDIF +] | |
6bd3dfaa | 1187 | @endif [+module+] |
4fa63067 | 1188 | [+ ENDFOR recursive_targets +] |
3866be5d | 1189 | [+ ENDFOR host_modules +] |
405ea7a0 | 1190 | |
15723a45 NN |
1191 | # --------------------------------------- |
1192 | # Modules which run on the target machine | |
1193 | # --------------------------------------- | |
e393202e | 1194 | [+ FOR target_modules +] |
15723a45 | 1195 | |
1086bc09 | 1196 | # There's only one multilib.out. Cleverer subdirs shouldn't need it copied. |
a7254363 | 1197 | @if target-[+module+] |
1086bc09 | 1198 | $(TARGET_SUBDIR)/[+module+]/multilib.out: multilib.out |
9175bfc0 | 1199 | $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/[+module+] ; \ |
e6bfb94a | 1200 | rm -f $(TARGET_SUBDIR)/[+module+]/Makefile || : ; \ |
1086bc09 | 1201 | cp multilib.out $(TARGET_SUBDIR)/[+module+]/multilib.out |
a8637a7d | 1202 | @endif target-[+module+] |
e90269c8 | 1203 | |
a7254363 PB |
1204 | [+ IF raw_cxx +] |
1205 | [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)" | |
1206 | deps=(string-append "$(TARGET_SUBDIR)/" (get "module") "/multilib.out") | |
1207 | exports="$(RAW_CXX_TARGET_EXPORTS)" | |
1208 | args="$(TARGET_CONFIGARGS)" no-config-site=true +] | |
1209 | ||
1210 | [+ all prefix="target-" subdir="$(TARGET_SUBDIR)" | |
1211 | exports="$(RAW_CXX_TARGET_EXPORTS)" | |
1212 | args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +] | |
1213 | [+ ELSE +] | |
1214 | [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)" | |
1215 | deps=(string-append "$(TARGET_SUBDIR)/" (get "module") "/multilib.out") | |
1216 | exports="$(NORMAL_TARGET_EXPORTS)" | |
1217 | args="$(TARGET_CONFIGARGS)" no-config-site=true +] | |
1218 | ||
1219 | [+ all prefix="target-" subdir="$(TARGET_SUBDIR)" | |
1220 | exports="$(NORMAL_TARGET_EXPORTS)" | |
1221 | args="$(TARGET_FLAGS_TO_PASS)" +] | |
1222 | [+ ENDIF +] | |
16ae0395 NN |
1223 | |
1224 | .PHONY: check-target-[+module+] maybe-check-target-[+module+] | |
1225 | maybe-check-target-[+module+]: | |
6bd3dfaa PB |
1226 | @if target-[+module+] |
1227 | maybe-check-target-[+module+]: check-target-[+module+] | |
3866be5d NN |
1228 | [+ IF no_check +] |
1229 | # Dummy target for uncheckable module. | |
3866be5d NN |
1230 | check-target-[+module+]: |
1231 | [+ ELSE check +] | |
e393202e | 1232 | check-target-[+module+]: |
f70224b5 | 1233 | @$(unstage) |
b40e3958 | 1234 | @r=`${PWD_COMMAND}`; export r; \ |
e90269c8 | 1235 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ |
378fce5b DD |
1236 | IF raw_cxx +] |
1237 | $(RAW_CXX_TARGET_EXPORTS) \[+ | |
1238 | ELSE normal_cxx +] | |
1239 | $(NORMAL_TARGET_EXPORTS) \[+ | |
1240 | ENDIF raw_cxx +] | |
bba45b8b NN |
1241 | (cd $(TARGET_SUBDIR)/[+module+] && \ |
1242 | $(MAKE) $(TARGET_FLAGS_TO_PASS) [+ | |
1243 | IF raw_cxx | |
1244 | +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ | |
1245 | ENDIF raw_cxx | |
7ffa0b57 | 1246 | +] [+extra_make_flags+] check) |
e393202e | 1247 | [+ ENDIF no_check +] |
6bd3dfaa | 1248 | @endif target-[+module+] |
16ae0395 | 1249 | |
930314a4 NN |
1250 | .PHONY: install-target-[+module+] maybe-install-target-[+module+] |
1251 | maybe-install-target-[+module+]: | |
6bd3dfaa PB |
1252 | @if target-[+module+] |
1253 | maybe-install-target-[+module+]: install-target-[+module+] | |
16ae0395 | 1254 | [+ IF no_install +] |
930314a4 NN |
1255 | # Dummy target for uninstallable. |
1256 | install-target-[+module+]: | |
1257 | [+ ELSE install +] | |
e393202e | 1258 | install-target-[+module+]: installdirs |
f70224b5 | 1259 | @$(unstage) |
b40e3958 | 1260 | @r=`${PWD_COMMAND}`; export r; \ |
e90269c8 | 1261 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ |
378fce5b DD |
1262 | IF raw_cxx +] |
1263 | $(RAW_CXX_TARGET_EXPORTS) \[+ | |
1264 | ELSE normal_cxx +] | |
1265 | $(NORMAL_TARGET_EXPORTS) \[+ | |
1266 | ENDIF raw_cxx +] | |
bba45b8b | 1267 | (cd $(TARGET_SUBDIR)/[+module+] && \ |
7ffa0b57 | 1268 | $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install) |
e393202e | 1269 | [+ ENDIF no_install +] |
6bd3dfaa | 1270 | @endif target-[+module+] |
4fa63067 NN |
1271 | |
1272 | # Other targets (info, dvi, etc.) | |
1273 | [+ FOR recursive_targets +] | |
1274 | .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+] | |
1275 | maybe-[+make_target+]-target-[+module+]: | |
6bd3dfaa PB |
1276 | @if target-[+module+] |
1277 | maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+] | |
4fa63067 NN |
1278 | [+ IF (match-value? = "missing" (get "make_target") ) +] |
1279 | # [+module+] doesn't support [+make_target+]. | |
1280 | [+make_target+]-target-[+module+]: | |
1281 | [+ ELSE +] | |
1282 | [+make_target+]-target-[+module+]: [+ | |
1283 | FOR depend +]\ | |
1284 | [+depend+]-target-[+module+] [+ | |
1285 | ENDFOR depend +] | |
f70224b5 | 1286 | @$(unstage) |
4fa63067 NN |
1287 | @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \ |
1288 | r=`${PWD_COMMAND}`; export r; \ | |
e90269c8 | 1289 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ |
378fce5b DD |
1290 | IF raw_cxx +] |
1291 | $(RAW_CXX_TARGET_EXPORTS) \[+ | |
1292 | ELSE normal_cxx +] | |
1293 | $(NORMAL_TARGET_EXPORTS) \[+ | |
1294 | ENDIF raw_cxx +] | |
4fa63067 NN |
1295 | echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \ |
1296 | for flag in $(EXTRA_TARGET_FLAGS); do \ | |
1297 | eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ | |
1298 | done; \ | |
1299 | (cd $(TARGET_SUBDIR)/[+module+] && \ | |
1300 | $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ | |
1301 | "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ | |
1302 | "RANLIB=$${RANLIB}" \ | |
1303 | "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ | |
7ffa0b57 | 1304 | [+extra_make_flags+] [+make_target+]) \ |
4fa63067 NN |
1305 | || exit 1 |
1306 | [+ ENDIF +] | |
6bd3dfaa | 1307 | @endif target-[+module+] |
4fa63067 | 1308 | [+ ENDFOR recursive_targets +] |
e393202e | 1309 | [+ ENDFOR target_modules +] |
405ea7a0 | 1310 | |
15723a45 NN |
1311 | # ---------- |
1312 | # GCC module | |
1313 | # ---------- | |
1314 | ||
319cab08 | 1315 | @if gcc-no-bootstrap |
b813574b PB |
1316 | # GCC has some more recursive targets, which trigger the old |
1317 | # (but still current, until the toplevel bootstrap project | |
1318 | # is finished) compiler bootstrapping rules. | |
405ea7a0 | 1319 | |
5b474aa8 DD |
1320 | GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap |
1321 | .PHONY: $(GCC_STRAP_TARGETS) | |
9e6ce191 | 1322 | $(GCC_STRAP_TARGETS): all-prebootstrap configure-gcc |
b40e3958 L |
1323 | @r=`${PWD_COMMAND}`; export r; \ |
1324 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
7ffa0b57 | 1325 | $(HOST_EXPORTS) \ |
405ea7a0 | 1326 | echo "Bootstrapping the compiler"; \ |
e90269c8 | 1327 | $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ |
405ea7a0 | 1328 | cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@ |
b40e3958 L |
1329 | @r=`${PWD_COMMAND}`; export r; \ |
1330 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
405ea7a0 NN |
1331 | case "$@" in \ |
1332 | *bootstrap4-lean ) \ | |
bba45b8b NN |
1333 | msg="Comparing stage3 and stage4 of the compiler"; \ |
1334 | compare=compare3-lean ;; \ | |
1335 | *bootstrap4 ) \ | |
1336 | msg="Comparing stage3 and stage4 of the compiler"; \ | |
1337 | compare=compare3 ;; \ | |
1338 | *-lean ) \ | |
1339 | msg="Comparing stage2 and stage3 of the compiler"; \ | |
1340 | compare=compare-lean ;; \ | |
1341 | * ) \ | |
1342 | msg="Comparing stage2 and stage3 of the compiler"; \ | |
1343 | compare=compare ;; \ | |
405ea7a0 | 1344 | esac; \ |
7ffa0b57 | 1345 | $(HOST_EXPORTS) \ |
405ea7a0 NN |
1346 | echo "$$msg"; \ |
1347 | cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare | |
b40e3958 L |
1348 | @r=`${PWD_COMMAND}`; export r; \ |
1349 | s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ | |
405ea7a0 | 1350 | echo "Building runtime libraries"; \ |
656fdd47 | 1351 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) all |
405ea7a0 | 1352 | |
9e6ce191 | 1353 | profiledbootstrap: all-prebootstrap configure-gcc |
b40e3958 L |
1354 | @r=`${PWD_COMMAND}`; export r; \ |
1355 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
7ffa0b57 | 1356 | $(HOST_EXPORTS) \ |
e90269c8 | 1357 | $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ |
3e707e94 | 1358 | echo "Bootstrapping training compiler"; \ |
ec7e0995 | 1359 | cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build |
b40e3958 | 1360 | @r=`${PWD_COMMAND}`; export r; \ |
b40e3958 | 1361 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
7ffa0b57 | 1362 | $(HOST_EXPORTS) \ |
ec7e0995 NN |
1363 | echo "Building feedback based compiler"; \ |
1364 | cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build | |
3e707e94 PB |
1365 | @r=`${PWD_COMMAND}`; export r; \ |
1366 | s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ | |
3e707e94 PB |
1367 | echo "Building runtime libraries"; \ |
1368 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) all | |
ec7e0995 | 1369 | |
405ea7a0 | 1370 | .PHONY: cross |
72b2455a | 1371 | cross: all-build all-gas all-ld |
b40e3958 L |
1372 | @r=`${PWD_COMMAND}`; export r; \ |
1373 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
7ffa0b57 | 1374 | $(HOST_EXPORTS) \ |
405ea7a0 NN |
1375 | echo "Building the C and C++ compiler"; \ |
1376 | cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++" | |
b40e3958 L |
1377 | @r=`${PWD_COMMAND}`; export r; \ |
1378 | s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ | |
405ea7a0 | 1379 | echo "Building runtime libraries"; \ |
656fdd47 | 1380 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all |
319cab08 | 1381 | @endif gcc-no-bootstrap |
405ea7a0 | 1382 | |
6bd3dfaa | 1383 | @if gcc |
7d695d07 JM |
1384 | .PHONY: check-gcc-c++ |
1385 | check-gcc-c++: | |
405ea7a0 | 1386 | @if [ -f ./gcc/Makefile ] ; then \ |
b40e3958 L |
1387 | r=`${PWD_COMMAND}`; export r; \ |
1388 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
7ffa0b57 | 1389 | $(HOST_EXPORTS) \ |
1086bc09 | 1390 | (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \ |
405ea7a0 NN |
1391 | else \ |
1392 | true; \ | |
7d695d07 JM |
1393 | fi |
1394 | ||
1395 | .PHONY: check-c++ | |
ede4fbe4 | 1396 | check-c++: check-target-libstdc++-v3 check-gcc-c++ |
405ea7a0 | 1397 | |
15723a45 NN |
1398 | # Install the gcc headers files, but not the fixed include files, |
1399 | # which Cygnus is not allowed to distribute. This rule is very | |
1400 | # dependent on the workings of the gcc Makefile.in. | |
1401 | .PHONY: gcc-no-fixedincludes | |
1402 | gcc-no-fixedincludes: | |
1403 | @if [ -f ./gcc/Makefile ]; then \ | |
1404 | rm -rf gcc/tmp-include; \ | |
1405 | mv gcc/include gcc/tmp-include 2>/dev/null; \ | |
1406 | mkdir gcc/include; \ | |
1407 | cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \ | |
1408 | touch gcc/stmp-fixinc gcc/include/fixed; \ | |
1409 | rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \ | |
b40e3958 L |
1410 | r=`${PWD_COMMAND}`; export r; \ |
1411 | s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ | |
7ffa0b57 | 1412 | $(HOST_EXPORTS) \ |
1086bc09 | 1413 | (cd ./gcc && \ |
15723a45 NN |
1414 | $(MAKE) $(GCC_FLAGS_TO_PASS) install); \ |
1415 | rm -rf gcc/include; \ | |
1416 | mv gcc/tmp-include gcc/include 2>/dev/null; \ | |
1417 | else true; fi | |
6bd3dfaa | 1418 | @endif gcc |
4fa63067 | 1419 | |
1d39f329 NN |
1420 | # --------------------- |
1421 | # GCC bootstrap support | |
1422 | # --------------------- | |
1423 | ||
b813574b PB |
1424 | # We track the current stage (the one in 'gcc') in the stage_current file. |
1425 | # stage_last instead tracks the stage that was built last. These targets | |
1426 | # are dummy when toplevel bootstrap is not active. | |
1427 | ||
f70224b5 PB |
1428 | # While making host and target tools, symlinks to the final stage must be |
1429 | # there, so $(MAKE) $(unstage) should be run at various points. To avoid | |
1430 | # excessive recursive invocations of make, we "inline" them using a variable. | |
1431 | ||
1432 | unstage = : | |
1433 | stage = : | |
1434 | ||
b813574b | 1435 | @if gcc-bootstrap |
f70224b5 PB |
1436 | unstage = [ -f stage_current ] || $(MAKE) `cat stage_last`-start |
1437 | stage = $(MAKE) `cat stage_current`-end | |
b813574b PB |
1438 | @endif gcc-bootstrap |
1439 | ||
f70224b5 PB |
1440 | .PHONY: unstage stage |
1441 | unstage: | |
1442 | @$(unstage) | |
b813574b | 1443 | stage: |
f70224b5 | 1444 | @$(stage) |
b813574b | 1445 | |
dfdffa2c PB |
1446 | # We name the build directories for the various stages "stage1-gcc", |
1447 | # "stage2-gcc","stage3-gcc", etc. | |
1448 | ||
1449 | # Since the 'compare' process will fail (on debugging information) if any | |
1450 | # directory names are different, we need to link the gcc directory for | |
1451 | # the previous stage to a constant name ('gcc-prev'), and to make the name of | |
1452 | # the build directories constant as well. For the latter, we use naked names | |
1453 | # like 'gcc', because the scripts in that directory assume it. We use | |
1454 | # mv on platforms where symlinks to directories do not work or are not | |
1455 | # reliable. | |
1456 | ||
1d39f329 NN |
1457 | # 'touch' doesn't work right on some platforms. |
1458 | STAMP = echo timestamp > | |
1459 | ||
1460 | # Only build the C compiler for stage1, because that is the only one that | |
1461 | # we can guarantee will build with the native compiler, and also it is the | |
1462 | # only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS), | |
1463 | # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them | |
1464 | # overrideable (for a bootstrap build stage1 also builds gcc.info). | |
1465 | ||
1466 | STAGE1_CFLAGS=@stage1_cflags@ | |
1467 | STAGE1_LANGUAGES=@stage1_languages@ | |
1468 | ||
dfdffa2c PB |
1469 | # We only want to compare .o files, so set this! |
1470 | objext = .o | |
1d39f329 | 1471 | |
1d39f329 | 1472 | # Flags to pass to stage2 and later makes. |
1d39f329 | 1473 | POSTSTAGE1_FLAGS_TO_PASS = \ |
656fdd47 | 1474 | CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \ |
064d0a7c | 1475 | STAGE_PREFIX=$$r/prev-gcc/ \ |
1d39f329 | 1476 | CFLAGS="$(BOOT_CFLAGS)" \ |
a0049f1b | 1477 | ADAC="\$$(CC)" |
1d39f329 | 1478 | |
dfdffa2c PB |
1479 | # For stage 1: |
1480 | # * We force-disable intermodule optimizations, even if | |
1481 | # --enable-intermodule was passed, since the installed compiler probably | |
1482 | # can't handle them. Luckily, autoconf always respects | |
1483 | # the last argument when conflicting --enable arguments are passed. | |
1484 | # * Likewise, we force-disable coverage flags, since the installed compiler | |
1485 | # probably has never heard of them. | |
1486 | # * We build only C (and possibly Ada). | |
1487 | ||
1488 | [+ FOR bootstrap-stage +] | |
319cab08 | 1489 | .PHONY: stage[+id+]-start stage[+id+]-end |
dfdffa2c | 1490 | |
656fdd47 | 1491 | stage[+id+]-start:: |
9cb3fa6f | 1492 | @[ -f stage_current ] && $(MAKE) `cat stage_current`-end || : ; \ |
b813574b | 1493 | echo stage[+id+] > stage_current ; \ |
b00612cc | 1494 | echo stage[+id+] > stage_last; \ |
1dc3053f | 1495 | $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR) $(TARGET_SUBDIR)[+ |
b00612cc | 1496 | FOR host_modules +][+ IF bootstrap +] |
72b2455a | 1497 | @if [+ module +] |
b00612cc PB |
1498 | @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \ |
1499 | mkdir stage[+id+]-[+module+]; \ | |
1500 | set stage[+id+]-[+module+] [+module+] ; \ | |
1501 | @CREATE_LINK_TO_DIR@ [+ IF prev +] ; \ | |
1502 | set stage[+prev+]-[+module+] prev-[+module+] ; \ | |
1503 | @CREATE_LINK_TO_DIR@ [+ ENDIF prev +] | |
1dc3053f PB |
1504 | @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +][+ |
1505 | FOR target_modules +][+ IF bootstrap +] | |
1506 | @if target-[+ module +] | |
1507 | @cd $(TARGET_SUBDIR); [ -d stage[+id+]-[+module+] ] || \ | |
1508 | mkdir stage[+id+]-[+module+]; \ | |
1509 | set stage[+id+]-[+module+] [+module+] ; \ | |
1510 | @CREATE_LINK_TO_DIR@ [+ IF prev +] ; \ | |
1511 | set stage[+prev+]-[+module+] prev-[+module+] ; \ | |
1512 | @CREATE_LINK_TO_DIR@ [+ ENDIF prev +] | |
1513 | @endif target-[+ module +][+ ENDIF bootstrap +][+ ENDFOR target_modules +] | |
dfdffa2c | 1514 | |
656fdd47 | 1515 | stage[+id+]-end:: |
9cb3fa6f | 1516 | @rm -f stage_current[+ FOR host_modules +][+ IF bootstrap +] |
72b2455a | 1517 | @if [+ module +] |
b00612cc PB |
1518 | @cd $(HOST_SUBDIR); set [+module+] stage[+id+]-[+module+] ; \ |
1519 | @UNDO_LINK_TO_DIR@ [+ IF prev +] ; \ | |
1520 | set prev-[+module+] stage[+prev+]-[+module+] ; \ | |
1521 | @UNDO_LINK_TO_DIR@ [+ ENDIF prev +] | |
1dc3053f PB |
1522 | @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +][+ |
1523 | FOR target_modules +][+ IF bootstrap +] | |
1524 | @if target-[+ module +] | |
1525 | @cd $(HOST_SUBDIR); set [+module+] stage[+id+]-[+module+] ; \ | |
1526 | @UNDO_LINK_TO_DIR@ [+ IF prev +] ; \ | |
1527 | set prev-[+module+] stage[+prev+]-[+module+] ; \ | |
1528 | @UNDO_LINK_TO_DIR@ [+ ENDIF prev +] | |
1529 | @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR target_modules +] | |
dfdffa2c PB |
1530 | |
1531 | # Bubble a bugfix through all the stages up to stage [+id+]. They | |
1532 | # are remade, but not reconfigured. The next stage (if any) will not | |
1533 | # be reconfigured as well. | |
319cab08 | 1534 | .PHONY: stage[+id+]-bubble |
9cb3fa6f PB |
1535 | stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +][+IF lean +] |
1536 | @bootstrap_lean@-rm -rf stage[+lean+]-* ; $(STAMP) stage[+lean+]-lean[+ ENDIF lean +] | |
1537 | @if test -f stage[+id+]-lean [+ | |
1538 | IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \ | |
1539 | echo Skipping rebuild of stage[+id+] ; \ | |
1540 | else \ | |
f70224b5 PB |
1541 | $(MAKE) stage[+id+]-start; \ |
1542 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \ | |
9cb3fa6f | 1543 | fi |
72b2455a | 1544 | |
0df3d27f | 1545 | .PHONY: all-stage[+id+] clean-stage[+id+] |
0df3d27f | 1546 | do-clean: clean-stage[+id+] |
1d39f329 | 1547 | |
72b2455a PB |
1548 | # FIXME: Will not need to be conditional when toplevel bootstrap is the |
1549 | # only possibility, but now it conflicts with no-bootstrap rules | |
1550 | @if gcc-bootstrap | |
dfdffa2c | 1551 | [+ IF compare-target +] |
9cb3fa6f PB |
1552 | [+compare-target+]: |
1553 | @if test -f stage[+prev+]-lean; then \ | |
1554 | echo Cannot compare object files as stage [+prev+] was deleted. ; \ | |
1555 | exit 0 ; \ | |
1556 | fi; \ | |
1557 | [ -f stage_current ] && $(MAKE) `cat stage_current`-end || : ; \ | |
dfdffa2c | 1558 | @r=`${PWD_COMMAND}`; export r; \ |
1d39f329 NN |
1559 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
1560 | rm -f .bad_compare ; \ | |
dfdffa2c | 1561 | cd stage[+id+]-gcc; \ |
1d39f329 NN |
1562 | files=`find . -name "*$(objext)" -print` ; \ |
1563 | cd .. ; \ | |
1564 | for file in $${files} ; do \ | |
dfdffa2c | 1565 | f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \ |
b8908782 | 1566 | @do_compare@ > /dev/null 2>&1; \ |
f70224b5 PB |
1567 | if test $$? -eq 1; then \ |
1568 | case $$file in \ | |
1569 | ./cc*-checksum$(objext) | ./libgcc/* ) \ | |
1570 | echo warning: $$file differs ;; \ | |
1571 | *) \ | |
1572 | echo $$file differs >> .bad_compare ;; \ | |
1573 | esac ; \ | |
1574 | fi ; \ | |
1d39f329 NN |
1575 | done ; \ |
1576 | if [ -f .bad_compare ]; then \ | |
1577 | echo "Bootstrap comparison failure!"; \ | |
1578 | cat .bad_compare; \ | |
1579 | exit 1; \ | |
1580 | else \ | |
1581 | true; \ | |
1582 | fi ; \ | |
9cb3fa6f PB |
1583 | $(STAMP) [+compare-target+][+ IF prev +] |
1584 | @bootstrap_lean@-rm -rf stage[+prev+]-* ; $(STAMP) stage[+prev+]-lean[+ ENDIF prev +] | |
dfdffa2c PB |
1585 | [+ ENDIF compare-target +] |
1586 | ||
1587 | [+ IF bootstrap-target +] | |
1588 | .PHONY: [+bootstrap-target+] | |
f70224b5 PB |
1589 | [+bootstrap-target+]: stage[+id+]-bubble |
1590 | [+ IF compare-target +]$(MAKE) [+compare-target+] | |
1591 | [+ ENDIF compare-target +]$(MAKE) $(RECURSE_FLAGS_TO_PASS) all | |
dfdffa2c PB |
1592 | [+ ENDIF bootstrap-target +] |
1593 | ||
0df3d27f | 1594 | # Rules to wipe a stage and all the following ones, also used for cleanstrap |
656fdd47 | 1595 | [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +] |
0df3d27f | 1596 | .PHONY: distclean-stage[+id+] |
656fdd47 | 1597 | distclean-stage[+id+]:: |
b813574b | 1598 | [ -f stage_current ] && $(MAKE) `cat stage_current`-end || : |
9cb3fa6f | 1599 | rm -rf stage[+id+]-* [+ |
dfdffa2c | 1600 | IF compare-target +][+compare-target+] [+ ENDIF compare-target +] |
dfdffa2c PB |
1601 | |
1602 | [+ IF cleanstrap-target +] | |
1603 | .PHONY: [+cleanstrap-target+] | |
0df3d27f | 1604 | [+cleanstrap-target+]: distclean [+bootstrap-target+] |
dfdffa2c | 1605 | [+ ENDIF cleanstrap-target +] |
72b2455a | 1606 | @endif gcc-bootstrap |
dfdffa2c PB |
1607 | |
1608 | [+ ENDFOR bootstrap-stage +] | |
656fdd47 | 1609 | |
7d329e61 PB |
1610 | stageprofile-end:: |
1611 | $(MAKE) distclean-stagefeedback | |
656fdd47 | 1612 | |
7d329e61 | 1613 | stagefeedback-start:: |
656fdd47 PB |
1614 | @r=`${PWD_COMMAND}`; export r; \ |
1615 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
7d329e61 PB |
1616 | for i in prev-*; do \ |
1617 | j=`echo $$i | sed s/^prev-//` ; \ | |
1618 | cd $$r/$$i && \ | |
1619 | { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \ | |
1620 | { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \ | |
1621 | done | |
b8908782 | 1622 | |
0df3d27f | 1623 | @if gcc-bootstrap |
0df3d27f PB |
1624 | do-distclean: distclean-stage1 |
1625 | @endif gcc-bootstrap | |
1626 | ||
ae831be5 NN |
1627 | # -------------------------------------- |
1628 | # Dependencies between different modules | |
1629 | # -------------------------------------- | |
405ea7a0 | 1630 | |
9e6ce191 | 1631 | # Generic dependencies for target modules on host stuff, especially gcc |
1dc3053f PB |
1632 | [+ FOR target_modules +][+ IF bootstrap +] |
1633 | @if gcc-bootstrap[+ FOR bootstrap_stage +] | |
1634 | configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+ ENDFOR +] | |
1635 | @endif gcc-bootstrap[+ ENDIF bootstrap +] | |
9e6ce191 PB |
1636 | configure-target-[+module+]: maybe-all-gcc |
1637 | [+ ENDFOR target_modules +] | |
1638 | ||
1639 | [+ FOR lang_env_dependencies +] | |
1640 | configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss | |
1641 | [+ IF cxx +]configure-target-[+module+]: maybe-all-target-libstdc++-v3 | |
1642 | [+ ENDIF cxx +][+ ENDFOR lang_env_dependencies +] | |
1643 | ||
ae831be5 NN |
1644 | # There are two types of dependencies here: 'hard' dependencies, where one |
1645 | # module simply won't build without the other; and 'soft' dependencies, where | |
1646 | # if the depended-on module is missing, the depending module will do without | |
1647 | # or find a substitute somewhere (perhaps installed). Soft dependencies | |
9e6ce191 | 1648 | # are made here to depend on a 'maybe-' target. If you're not sure, |
ae831be5 NN |
1649 | # it's safer to use a soft dependency. |
1650 | ||
9e6ce191 PB |
1651 | [+ ;; These Scheme functions build the bulk of the dependencies. |
1652 | ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc", | |
1653 | ;; where "maybe-" is only included if HARD is true, and all-gcc | |
1654 | ;; is taken from VAR-NAME. | |
1655 | (define dep-target (lambda (module-kind var-name hard) | |
1656 | (string-append | |
1657 | (if hard "" "maybe-") | |
1658 | (dep-subtarget var-name) | |
1659 | module-kind | |
1660 | (dep-module var-name) | |
1661 | ))) | |
1662 | ||
1663 | ;; make-dep builds a dependency from the MODULE and ON AutoGen vars. | |
72b2455a | 1664 | (define make-dep (lambda (module-kind on-kind) |
9e6ce191 PB |
1665 | (string-append |
1666 | (dep-target module-kind "module" #t) ": " | |
72b2455a | 1667 | (dep-target on-kind "on" (exist? "hard"))))) |
9e6ce191 PB |
1668 | |
1669 | ;; dep-subtarget extracts everything up to the first dash in the given | |
1670 | ;; AutoGen variable, for example it extracts "all-" out of "all-gcc". | |
1671 | (define dep-subtarget (lambda (var-name) | |
1672 | (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-))))) | |
1673 | ||
1674 | ;; dep-module extracts everything up to the first dash in the given | |
1675 | ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc". | |
1676 | (define dep-module (lambda (var-name) | |
1677 | (substring (get var-name) (+ 1 (string-index (get var-name) #\-))))) | |
1678 | ||
1679 | ;; dep-stage builds a string for the prefix of a bootstrap stage. | |
1680 | (define dep-stage (lambda () | |
1681 | (string-append | |
1682 | "stage" | |
1683 | (get "id") | |
1684 | "-"))) | |
1685 | ||
1686 | ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'" | |
1687 | ;; but is written in Scheme. | |
1688 | (define dep-maybe (lambda () | |
1689 | (if (exist? "hard") "" "maybe-"))) | |
1690 | ||
21fde4dc DD |
1691 | ;; dep-kind returns "normal" if the dependency is on an "install" target, |
1692 | ;; or if either module is not bootstrapped. It returns "bootstrap" for | |
9e6ce191 PB |
1693 | ;; configure or build dependencies between bootstrapped modules; it returns |
1694 | ;; "prebootstrap" for configure or build dependencies of bootstrapped | |
72b2455a | 1695 | ;; modules on a build module (e.g. all-gcc on all-build-bison). All this |
9e6ce191 PB |
1696 | ;; is only necessary for host modules. |
1697 | (define dep-kind (lambda () | |
72b2455a PB |
1698 | (if (and (hash-ref boot-modules (dep-module "module")) |
1699 | (=* (dep-module "on") "build-")) | |
1700 | "prebootstrap" | |
9e6ce191 | 1701 | |
72b2455a | 1702 | (if (or (= (dep-subtarget "on") "install-") |
21fde4dc DD |
1703 | (not (hash-ref boot-modules (dep-module "module"))) |
1704 | (not (hash-ref boot-modules (dep-module "on")))) | |
72b2455a PB |
1705 | "normal" |
1706 | "bootstrap")))) | |
9e6ce191 PB |
1707 | |
1708 | ;; We now build the hash table that is used by dep-kind. | |
1709 | (define boot-modules (make-hash-table 113)) | |
9e6ce191 PB |
1710 | +] |
1711 | ||
1712 | [+ FOR host_modules +][+ | |
1713 | (if (exist? "bootstrap") | |
1714 | (hash-create-handle! boot-modules (get "module") #t)) | |
1715 | "" +][+ ENDFOR host_modules +] | |
1dc3053f PB |
1716 | [+ FOR target_modules +][+ |
1717 | (if (exist? "bootstrap") | |
1718 | (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t)) | |
1719 | "" +][+ ENDFOR target_modules +] | |
9e6ce191 PB |
1720 | |
1721 | # With all the machinery above in place, it is pretty easy to generate | |
1722 | # dependencies. Host dependencies are a bit more complex because we have | |
1723 | # to check for bootstrap/prebootstrap dependencies. To resolve | |
1724 | # prebootstrap dependencies, prebootstrap modules are gathered in | |
1725 | # a hash table. | |
72b2455a PB |
1726 | [+ FOR dependencies +][+ (make-dep "" "") +] |
1727 | [+ CASE (dep-kind) +] | |
1728 | [+ == "prebootstrap" | |
9e6ce191 | 1729 | +][+ FOR bootstrap_stage +] |
72b2455a PB |
1730 | [+ (make-dep (dep-stage) "") +][+ |
1731 | ENDFOR bootstrap_stage +] | |
1732 | all-prebootstrap: [+ (dep-target "" "on" (exist? "hard")) +] | |
1733 | [+ == "bootstrap" | |
1734 | +][+ FOR bootstrap_stage +] | |
1735 | [+ (make-dep (dep-stage) (dep-stage)) +][+ | |
9e6ce191 PB |
1736 | ENDFOR bootstrap_stage +] |
1737 | [+ ESAC +][+ | |
1738 | ENDFOR dependencies +] | |
1739 | ||
72b2455a PB |
1740 | # Non-toplevel bootstrap rules must depend on several packages, to be built |
1741 | # before gcc. Another wart that will go away, hopefully soon. | |
9e6ce191 PB |
1742 | @if gcc-no-bootstrap |
1743 | [+ FOR host_modules +][+ | |
1744 | IF (and (not (= (get "module") "gcc")) | |
1745 | (hash-ref boot-modules (get "module"))) +] | |
1746 | all-prebootstrap: maybe-all-[+module+][+ | |
1747 | ENDIF +][+ | |
1748 | ENDFOR host_modules +] | |
1749 | @endif gcc-no-bootstrap | |
1750 | ||
ae831be5 | 1751 | GDB_TK = @GDB_TK@ |
9e6ce191 | 1752 | all-gdb: $(gdbnlmrequirements) $(GDB_TK) |
907a7241 | 1753 | |
a2cc058a NN |
1754 | # Serialization dependencies. Host configures don't work well in parallel to |
1755 | # each other, due to contention over config.cache. Target configures and | |
1756 | # build configures are similar. | |
1757 | @serialization_dependencies@ | |
1758 | ||
15723a45 NN |
1759 | # -------------------------------- |
1760 | # Regenerating top level configury | |
1761 | # -------------------------------- | |
405ea7a0 | 1762 | |
1086bc09 NN |
1763 | # Multilib.out tells target dirs what multilibs they should build. |
1764 | # There is really only one copy. We use the 'timestamp' method to | |
1765 | # work around various timestamp bugs on some systems. | |
1766 | # We use move-if-change so that it's only considered updated when it | |
1767 | # actually changes, because it has to depend on a phony target. | |
e6bfb94a | 1768 | multilib.out: maybe-all-gcc |
b40e3958 | 1769 | @r=`${PWD_COMMAND}`; export r; \ |
1086bc09 NN |
1770 | echo "Checking multilib configuration..."; \ |
1771 | $(CC_FOR_TARGET) --print-multi-lib > multilib.tmp 2> /dev/null ; \ | |
1772 | $(SHELL) $(srcdir)/move-if-change multilib.tmp multilib.out ; \ | |
1086bc09 | 1773 | |
405ea7a0 | 1774 | # Rebuilding Makefile.in, using autogen. |
43be203f | 1775 | AUTOGEN = autogen |
6b784d9f | 1776 | $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def |
43be203f | 1777 | cd $(srcdir) && $(AUTOGEN) Makefile.def |
405ea7a0 | 1778 | |
a0da8069 | 1779 | # Rebuilding Makefile. |
43be203f AO |
1780 | Makefile: $(srcdir)/Makefile.in config.status |
1781 | CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status | |
1782 | ||
479759c8 | 1783 | config.status: configure |
10ecffb9 | 1784 | CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck |
405ea7a0 | 1785 | |
a0da8069 | 1786 | # Rebuilding configure. |
43be203f | 1787 | AUTOCONF = autoconf |
6b784d9f | 1788 | $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4 |
43be203f | 1789 | cd $(srcdir) && $(AUTOCONF) |
405ea7a0 | 1790 | |
3728fade NN |
1791 | # ------------------------------ |
1792 | # Special directives to GNU Make | |
1793 | # ------------------------------ | |
1794 | ||
3728fade NN |
1795 | # Don't pass command-line variables to submakes. |
1796 | .NOEXPORT: | |
1797 | MAKEOVERRIDES= | |
1798 | ||
405ea7a0 | 1799 | # end of Makefile.in |