OSDN Git Service

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