2017-01-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
[official-gcc.git] / Makefile.tpl
bloba6a31660a0fd449f1f5eae8651c6e5f23bff4ecc
1 [+ AutoGen5 template -*- Mode: Makefile -*-
2 in
3 +]
5 # Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
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
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/>.
27 # First, test for a proper version of make, but only where one is required.
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
35 # -------------------------------
36 # Standard Autoconf-set variables
37 # -------------------------------
38 VPATH=@srcdir@
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@
53 program_transform_name = @program_transform_name@
55 prefix = @prefix@
56 exec_prefix = @exec_prefix@
58 srcdir = @srcdir@
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
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@
96 # -------------------------------------------------
97 # Miscellaneous non-standard autoconf-set variables
98 # -------------------------------------------------
100 # The gcc driver likes to know the arguments it was configured with.
101 TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
103 tooldir = @tooldir@
104 build_tooldir = @build_tooldir@
106 # This is the name of the environment variable used for the path to
107 # the libraries.
108 RPATH_ENVVAR = @RPATH_ENVVAR@
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@
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)"
121 # Linker flags to use on the host, for stage1 or when not
122 # bootstrapping.
123 STAGE1_LDFLAGS = @stage1_ldflags@
125 # Libraries to use on the host, for stage1 or when not bootstrapping.
126 STAGE1_LIBS = @stage1_libs@
128 # Linker flags to use for stage2 and later.
129 POSTSTAGE1_LDFLAGS = @poststage1_ldflags@
131 # Libraries to use for stage2 and later.
132 POSTSTAGE1_LIBS = @poststage1_libs@
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;
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         GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
160         GOC="$(GOC_FOR_BUILD)"; export GOC; \
161         GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
162         DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
163         LD="$(LD_FOR_BUILD)"; export LD; \
164         LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
165         NM="$(NM_FOR_BUILD)"; export NM; \
166         RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
167         WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
168         WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
170 # These variables must be set on the make command line for directories
171 # built for the build system to override those in BASE_FLAGS_TO_PASS.
172 EXTRA_BUILD_FLAGS = \
173         CFLAGS="$(CFLAGS_FOR_BUILD)" \
174         LDFLAGS="$(LDFLAGS_FOR_BUILD)"
176 # This is the list of directories to built for the host system.
177 SUBDIRS = @configdirs@
178 TARGET_CONFIGDIRS = @target_configdirs@
179 # This is set by the configure script to the arguments to use when configuring
180 # directories built for the host system.
181 HOST_CONFIGARGS = @host_configargs@
182 # Host programs are put under this directory, which is . except if building
183 # with srcdir=..
184 HOST_SUBDIR = @host_subdir@
185 # This is the list of variables to export in the environment when
186 # configuring subdirectories for the host system.  We need to pass
187 # some to the GCC configure because of its hybrid host/target nature.
188 HOST_EXPORTS = \
189         $(BASE_EXPORTS) \
190         CC="$(CC)"; export CC; \
191         ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
192         CFLAGS="$(CFLAGS)"; export CFLAGS; \
193         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
194         CXX="$(CXX)"; export CXX; \
195         CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
196         GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
197         GOC="$(GOC)"; export GOC; \
198         AR="$(AR)"; export AR; \
199         AS="$(AS)"; export AS; \
200         CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
201         DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
202         LD="$(LD)"; export LD; \
203         LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
204         NM="$(NM)"; export NM; \
205         RANLIB="$(RANLIB)"; export RANLIB; \
206         WINDRES="$(WINDRES)"; export WINDRES; \
207         WINDMC="$(WINDMC)"; export WINDMC; \
208         OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
209         OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
210         READELF="$(READELF)"; export READELF; \
211         AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
212         AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
213         GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
214         LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
215         NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
216         OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
217         OBJCOPY_FOR_TARGET="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY_FOR_TARGET; \
218         RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
219         READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
220         TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
221         HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
222         GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
223         GMPINC="$(HOST_GMPINC)"; export GMPINC; \
224         ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
225         ISLINC="$(HOST_ISLINC)"; export ISLINC; \
226         ISLVER="$(HOST_ISLVER)"; export ISLVER; \
227         LIBELFLIBS="$(HOST_LIBELFLIBS)"; export LIBELFLIBS; \
228         LIBELFINC="$(HOST_LIBELFINC)"; export LIBELFINC; \
229         XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \
230 @if gcc-bootstrap
231         $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
232 @endif gcc-bootstrap
233         $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
235 POSTSTAGE1_CXX_EXPORT = \
236         CXX='$(CXX)'; export CXX; \
237         CXX_FOR_BUILD='$(CXX_FOR_BUILD)'; export CXX_FOR_BUILD;
238 @if target-libstdc++-v3-bootstrap
239 # Override the above if we're bootstrapping C++.
240 POSTSTAGE1_CXX_EXPORT = \
241         CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xg++$(exeext) \
242           -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \
243           -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
244           -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
245           `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \
246           `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \
247           `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$s/libstdc++-v3/libsupc++ \
248           -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
249           -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \
250           export CXX; \
251         CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD;
252 @endif target-libstdc++-v3-bootstrap
254 # Similar, for later GCC stages.
255 POSTSTAGE1_HOST_EXPORTS = \
256         $(HOST_EXPORTS) \
257         CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
258           -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ \
259           $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
260         CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \
261         $(POSTSTAGE1_CXX_EXPORT) \
262         $(LTO_EXPORTS) \
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;
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         GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
284         GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
285         DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
286         LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
287         LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
288         LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
289         NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
290         OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
291         OBJCOPY="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY; \
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;
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;
308 NORMAL_TARGET_EXPORTS = \
309         $(BASE_TARGET_EXPORTS) \
310         CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
312 # Where to find GMP
313 HOST_GMPLIBS = @gmplibs@
314 HOST_GMPINC = @gmpinc@
316 # Where to find isl
317 HOST_ISLLIBS = @isllibs@
318 HOST_ISLINC = @islinc@
319 HOST_ISLVER = @islver@
321 # Where to find libelf
322 HOST_LIBELFLIBS = @libelflibs@
323 HOST_LIBELFINC = @libelfinc@
325 # ----------------------------------------------
326 # Programs producing files for the BUILD machine
327 # ----------------------------------------------
329 SHELL = @SHELL@
331 # pwd command to use.  Allow user to override default by setting PWDCMD in
332 # the environment to account for automounters.  The make variable must not
333 # be called PWDCMD, otherwise the value set here is passed to make
334 # subprocesses and overrides the setting from the user's environment.
335 # Don't use PWD since it is a common shell environment variable and we
336 # don't want to corrupt it.
337 PWD_COMMAND = $${PWDCMD-pwd}
339 # compilers to use to create programs which must be run in the build
340 # environment.
341 AR_FOR_BUILD = @AR_FOR_BUILD@
342 AS_FOR_BUILD = @AS_FOR_BUILD@
343 CC_FOR_BUILD = @CC_FOR_BUILD@
344 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
345 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
346 CXX_FOR_BUILD = @CXX_FOR_BUILD@
347 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
348 GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
349 GOC_FOR_BUILD = @GOC_FOR_BUILD@
350 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
351 LD_FOR_BUILD = @LD_FOR_BUILD@
352 NM_FOR_BUILD = @NM_FOR_BUILD@
353 RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@
354 WINDMC_FOR_BUILD = @WINDMC_FOR_BUILD@
355 WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@
357 # Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
358 # here so that they can be overridden by Makefile fragments.
359 BUILD_PREFIX = @BUILD_PREFIX@
360 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
362 # Flags to pass to stage2 and later makes.  They are defined
363 # here so that they can be overridden by Makefile fragments.
364 BOOT_CFLAGS= -g -O2
365 BOOT_LDFLAGS=
366 BOOT_ADAFLAGS= -gnatpg
368 AWK = @AWK@
369 SED = @SED@
370 BISON = @BISON@
371 YACC = @YACC@
372 FLEX = @FLEX@
373 LEX = @LEX@
374 M4 = @M4@
375 MAKEINFO = @MAKEINFO@
376 EXPECT = @EXPECT@
377 RUNTEST = @RUNTEST@
379 AUTO_PROFILE = gcc-auto-profile -c 1000000
381 # This just becomes part of the MAKEINFO definition passed down to
382 # sub-makes.  It lets flags be given on the command line while still
383 # using the makeinfo from the object tree.
384 # (Default to avoid splitting info files by setting the threshold high.)
385 MAKEINFOFLAGS = --split-size=5000000
387 # ---------------------------------------------
388 # Programs producing files for the HOST machine
389 # ---------------------------------------------
391 AS = @AS@
392 AR = @AR@
393 AR_FLAGS = rc
394 CC = @CC@
395 CXX = @CXX@
396 DLLTOOL = @DLLTOOL@
397 LD = @LD@
398 LIPO = @LIPO@
399 NM = @NM@
400 OBJDUMP = @OBJDUMP@
401 RANLIB = @RANLIB@
402 READELF = @READELF@
403 STRIP = @STRIP@
404 WINDRES = @WINDRES@
405 WINDMC = @WINDMC@
407 GNATBIND = @GNATBIND@
408 GNATMAKE = @GNATMAKE@
410 CFLAGS = @CFLAGS@
411 LDFLAGS = @LDFLAGS@
412 LIBCFLAGS = $(CFLAGS)
413 CXXFLAGS = @CXXFLAGS@
414 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
415 GOCFLAGS = $(CFLAGS)
417 CREATE_GCOV = create_gcov
419 TFLAGS =
421 # Defaults for all stages; some are overridden below.
423 STAGE_CFLAGS = $(BOOT_CFLAGS)
424 STAGE_TFLAGS = $(TFLAGS)
425 STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
427 [+ FOR bootstrap-stage +]
428 # Defaults for stage [+id+]; some are overridden below.
429 STAGE[+id+]_CFLAGS = $(STAGE_CFLAGS)
430 STAGE[+id+]_CXXFLAGS = $(CXXFLAGS)
431 @if target-libstdc++-v3-bootstrap
432 # Override the above if we're bootstrapping C++.
433 STAGE[+id+]_CXXFLAGS = $(STAGE[+id+]_CFLAGS)
434 @endif target-libstdc++-v3-bootstrap
435 STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS)
436 STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
437 [+ ENDFOR bootstrap-stage +]
439 # By default, C and C++ are the only stage1 languages, because they are the
440 # only ones we require to build with the bootstrap compiler, and also the
441 # only ones useful for building stage2.
443 STAGE1_CFLAGS = @stage1_cflags@
444 STAGE1_CHECKING = @stage1_checking@
445 STAGE1_LANGUAGES = @stage1_languages@
446 # * We force-disable intermodule optimizations, even if
447 #   --enable-intermodule was passed, since the installed compiler
448 #   probably can't handle them.  Luckily, autoconf always respects
449 #   the last argument when conflicting --enable arguments are passed.
450 # * Likewise, we force-disable coverage flags, since the installed
451 #   compiler probably has never heard of them.
452 # * We also disable -Wformat, since older GCCs don't understand newer %s.
453 STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
454           --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" \
455           --disable-build-format-warnings
457 STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
458 STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
460 STAGEfeedback_CFLAGS = $(STAGE3_CFLAGS) -fprofile-use
461 STAGEfeedback_TFLAGS = $(STAGE3_TFLAGS)
463 STAGEautoprofile_CFLAGS = $(STAGE2_CFLAGS) -g
464 STAGEautoprofile_TFLAGS = $(STAGE2_TFLAGS)
466 STAGEautofeedback_CFLAGS = $(STAGE3_CFLAGS)
467 STAGEautofeedback_TFLAGS = $(STAGE3_TFLAGS)
469 do-compare = @do_compare@
470 do-compare3 = $(do-compare)
472 # -----------------------------------------------
473 # Programs producing files for the TARGET machine
474 # -----------------------------------------------
476 AR_FOR_TARGET=@AR_FOR_TARGET@
477 AS_FOR_TARGET=@AS_FOR_TARGET@
478 CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@
480 # If GCC_FOR_TARGET is not overriden on the command line, then this
481 # variable is passed down to the gcc Makefile, where it is used to
482 # build libgcc2.a.  We define it here so that it can itself be
483 # overridden on the command line.
484 GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@
485 CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@
486 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
487 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
488 GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
489 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
490 LD_FOR_TARGET=@LD_FOR_TARGET@
492 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
493 NM_FOR_TARGET=@NM_FOR_TARGET@
494 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
495 OBJCOPY_FOR_TARGET=@OBJCOPY_FOR_TARGET@
496 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
497 READELF_FOR_TARGET=@READELF_FOR_TARGET@
498 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
499 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
500 WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
502 COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
503 COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
504 COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
506 CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
507 CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
509 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
510 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
511 LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
512 GOCFLAGS_FOR_TARGET = -O2 -g
514 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
515 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
516 DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
518 XGCC_FLAGS_FOR_TARGET = $(FLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
520 # ------------------------------------
521 # Miscellaneous targets and flag lists
522 # ------------------------------------
524 # The first rule in the file had better be this one.  Don't put any above it.
525 # This lives here to allow makefile fragments to contain dependencies.
526 all:
528 #### host and target specific makefile fragments come in here.
529 @target_makefile_frag@
530 @alphaieee_frag@
531 @ospace_frag@
532 @host_makefile_frag@
535 # This is the list of directories that may be needed in RPATH_ENVVAR
536 # so that programs built for the target machine work.
537 TARGET_LIB_PATH = [+ FOR target_modules +][+
538   IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
539   ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
540 [+ FOR target_modules +][+ IF lib_path +]
541 @if target-[+module+]
542 TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
543 @endif target-[+module+]
544 [+ ENDIF lib_path +][+ ENDFOR target_modules +]
547 # This is the list of directories that may be needed in RPATH_ENVVAR
548 # so that programs built for the host machine work.
549 HOST_LIB_PATH = [+ FOR host_modules +][+
550   IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
551   ENDFOR host_modules +]
553 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
554 @if gcc
555 HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR):
556 @endif gcc
558 [+ FOR host_modules +][+ IF lib_path +]
559 @if [+module+]
560 HOST_LIB_PATH_[+module+] = \
561   $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
562   +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
563 @endif [+module+]
564 [+ ENDIF lib_path +][+ ENDFOR host_modules +]
566 CXX_FOR_TARGET_FLAG_TO_PASS = \
567         "CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
568 @if target-libstdc++-v3
569 # CXX_FOR_TARGET is tricky to get right for target libs that require a
570 # functional C++ compiler.  When we recurse, if we expand
571 # CXX_FOR_TARGET before configuring libstdc++-v3, we won't get
572 # libstdc++ include flags from the script.  Instead, we get an
573 # -funconfigured-* word, so that we'll get errors if this invalid C++
574 # command line is used for anything, but also so that we can use the
575 # word to decide whether or not to pass on this CXX_FOR_TARGET.  If we
576 # don't pass it on, sub-make will use the default definition, that
577 # re-expands it at the time of use, so we'll get it right when we need
578 # it.  One potential exception is the expansion of CXX_FOR_TARGET
579 # passed down as part of CXX within TARGET_FLAGS, but this wouldn't
580 # really work, for C++ host programs can't depend on the current-stage
581 # C++ target library.
582 CXX_FOR_TARGET_FLAG_TO_PASS = \
583         $(shell if echo "$(CXX_FOR_TARGET)" | grep " -funconfigured-" > /dev/null; then :; else echo '"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"'; fi)
584 @endif target-libstdc++-v3
586 # Flags to pass down to all sub-makes. STAGE*FLAGS,
587 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
588 # overrideable (for a bootstrap build stage1 also builds gcc.info).
589 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
590         "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
591         "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +][+ FOR bootstrap-stage +] \
592         "STAGE[+id+]_CFLAGS=$(STAGE[+id+]_CFLAGS)" \
593         "STAGE[+id+]_CXXFLAGS=$(STAGE[+id+]_CXXFLAGS)" \
594         "STAGE[+id+]_TFLAGS=$(STAGE[+id+]_TFLAGS)"[+ ENDFOR bootstrap-stage +] \
595         $(CXX_FOR_TARGET_FLAG_TO_PASS) \
596         "TFLAGS=$(TFLAGS)" \
597         "CONFIG_SHELL=$(SHELL)" \
598         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
599         $(if $(LSAN_OPTIONS),"LSAN_OPTIONS=$(LSAN_OPTIONS)")
601 # We leave this in just in case, but it is not needed anymore.
602 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
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         'GFORTRAN=$(GFORTRAN)' \
613         'GOC=$(GOC)' \
614         'LD=$(LD)' \
615         'LIPO=$(LIPO)' \
616         'NM=$(NM)' \
617         'OBJDUMP=$(OBJDUMP)' \
618         'RANLIB=$(RANLIB)' \
619         'READELF=$(READELF)' \
620         'STRIP=$(STRIP)' \
621         'WINDRES=$(WINDRES)' \
622         'WINDMC=$(WINDMC)' \
623         'CREATE_GCOV=$(CREATE_GCOV)'
625 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
627 # Flags to pass to stage1 or when not bootstrapping.
629 STAGE1_FLAGS_TO_PASS = \
630         LDFLAGS="$${LDFLAGS}" \
631         HOST_LIBS="$${HOST_LIBS}"
633 # Flags to pass to stage2 and later makes.
635 POSTSTAGE1_FLAGS_TO_PASS = \
636         CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
637         CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
638         GNATBIND="$${GNATBIND}" \
639         LDFLAGS="$${LDFLAGS}" \
640         HOST_LIBS="$${HOST_LIBS}" \
641         $(LTO_FLAGS_TO_PASS) \
642         "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
644 @if gcc-bootstrap
645 EXTRA_HOST_EXPORTS = if [ $(current_stage) != stage1 ]; then \
646                        $(POSTSTAGE1_HOST_EXPORTS) \
647                      fi;
649 EXTRA_BOOTSTRAP_FLAGS = CC="$$CC" CXX="$$CXX" LDFLAGS="$$LDFLAGS"
650 @endif gcc-bootstrap
652 # Flags to pass down to makes which are built with the target environment.
653 # The double $ decreases the length of the command line; those variables
654 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.  The
655 # *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
656 # so we expand them here.
657 EXTRA_TARGET_FLAGS = \
658         'AR=$$(AR_FOR_TARGET)' \
659         'AS=$(COMPILER_AS_FOR_TARGET)' \
660         'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
661         'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
662         'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
663          -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
664          $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
665         'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
666         'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
667         'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
668         'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
669         'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
670         'LD=$(COMPILER_LD_FOR_TARGET)' \
671         'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
672         'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
673         'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
674         'NM=$(COMPILER_NM_FOR_TARGET)' \
675         'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
676         'OBJCOPY=$$(OBJCOPY_FOR_TARGET)' \
677         'RANLIB=$$(RANLIB_FOR_TARGET)' \
678         'READELF=$$(READELF_FOR_TARGET)' \
679         'WINDRES=$$(WINDRES_FOR_TARGET)' \
680         'WINDMC=$$(WINDMC_FOR_TARGET)' \
681         'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
682         'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
683         'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
684         "TFLAGS=$$TFLAGS"
686 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
688 # Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
689 # unfortunately needs the native compiler and the target ar and
690 # ranlib.
691 # If any variables are added here, they must be added to do-*, below.
692 # The BUILD_* variables are a special case, which are used for the gcc
693 # cross-building scheme.
694 EXTRA_GCC_FLAGS = \
695         "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
696         "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
697         "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
699 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
701 @if gcc
702 BUILD_CONFIG = @BUILD_CONFIG@
703 ifneq ($(BUILD_CONFIG),)
704 include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk)
705 endif
706 @endif gcc
708 .PHONY: configure-host
709 configure-host: [+
710   FOR host_modules +] \
711     maybe-configure-[+module+][+
712   ENDFOR host_modules +]
713 .PHONY: configure-target
714 configure-target: [+
715   FOR target_modules +] \
716     maybe-configure-target-[+module+][+
717   ENDFOR target_modules +]
719 # The target built for a native non-bootstrap build.
720 .PHONY: all
721 all:
722 @if gcc-bootstrap
723         [ -f stage_final ] || echo stage3 > stage_final
724         @r=`${PWD_COMMAND}`; export r; \
725         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
726         $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
727 @endif gcc-bootstrap
728         @: $(MAKE); $(unstage)
729         @r=`${PWD_COMMAND}`; export r; \
730         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
731 @if gcc-bootstrap
732         if [ -f stage_last ]; then \
733           TFLAGS="$(STAGE$(shell test ! -f stage_last || sed s,^stage,, stage_last)_TFLAGS)"; \
734           $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
735         else \
736 @endif gcc-bootstrap
737           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
738 @if gcc-bootstrap
739             ; \
740         fi \
741 @endif gcc-bootstrap
742         && :
744 .PHONY: all-build
745 [+ FOR build_modules +]
746 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
748 .PHONY: all-host
749 [+ FOR host_modules +][+ IF bootstrap +]
750 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
751 all-host: maybe-all-[+module+][+ IF bootstrap +]
752 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
754 .PHONY: all-target
755 [+ FOR target_modules +][+ IF bootstrap +]
756 @if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
757 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
758 @endif target-[+module+]-no-bootstrap[+
759   ENDIF bootstrap +][+ ENDFOR target_modules +]
761 # Do a target for all the subdirectories.  A ``make do-X'' will do a
762 # ``make X'' in all subdirectories (because, in general, there is a
763 # dependency (below) of X upon do-X, a ``make X'' will also do this,
764 # but it may do additional work as well).
765 [+ FOR recursive_targets +]
766 .PHONY: do-[+make_target+]
767 do-[+make_target+]:
768         @: $(MAKE); $(unstage)
769         @r=`${PWD_COMMAND}`; export r; \
770         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
771         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
772           [+make_target+]-target
775 .PHONY: [+make_target+]-host
776 [+ FOR host_modules +]
777 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
779 .PHONY: [+make_target+]-target
780 [+ FOR target_modules +]
781 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
782 [+ ENDFOR recursive_targets +]
784 # Here are the targets which correspond to the do-X targets.
786 .PHONY: info installcheck dvi pdf html
787 .PHONY: install-info install-pdf install-html
788 .PHONY: clean distclean mostlyclean maintainer-clean realclean
789 .PHONY: local-clean local-distclean local-maintainer-clean
790 info: do-info
791 installcheck: do-installcheck
792 dvi: do-dvi
793 pdf: do-pdf
794 html: do-html
796 # Make sure makeinfo is built before we do a `make info', if we're
797 # in fact building texinfo.
798 do-info: maybe-all-texinfo
800 install-info: do-install-info dir.info
801         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
802         if [ -f dir.info ]; then \
803           $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info; \
804         else true; fi
806 install-pdf: do-install-pdf
808 install-html: do-install-html
810 local-clean:
811         -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
813 local-distclean:
814         -rm -f Makefile config.status config.cache mh-frag mt-frag
815         -rm -f maybedep.tmp serdep.tmp stage_final
816         -if [ "$(TARGET_SUBDIR)" != "." ]; then \
817           rm -rf $(TARGET_SUBDIR); \
818         else true; fi
819         -rm -rf $(BUILD_SUBDIR)
820         -if [ "$(HOST_SUBDIR)" != "." ]; then \
821           rm -rf $(HOST_SUBDIR); \
822         else true; fi
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 gnattools gotools libcc1 libiberty 2>/dev/null
828         -rmdir texinfo zlib 2>/dev/null
829         -find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
831 local-maintainer-clean:
832         @echo "This command is intended for maintainers to use;"
833         @echo "it deletes files that may require special tools to rebuild."
835 clean: do-clean local-clean
836 mostlyclean: do-mostlyclean local-clean
837 distclean: do-distclean local-clean local-distclean
838 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
839 maintainer-clean: local-distclean
840 realclean: maintainer-clean
842 # Check target.
844 .PHONY: check do-check
845 check: do-check
847 # Only include modules actually being configured and built.
848 .PHONY: check-host
849 check-host: [+
850   FOR host_modules +] \
851     maybe-check-[+module+][+
852   ENDFOR host_modules +]
854 .PHONY: check-target
855 check-target: [+
856   FOR target_modules +] \
857     maybe-check-target-[+module+][+
858   ENDFOR target_modules +]
860 do-check:
861         @: $(MAKE); $(unstage)
862         @r=`${PWD_COMMAND}`; export r; \
863         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
864         $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
866 # Automated reporting of test results.
868 warning.log: build.log
869         $(srcdir)/contrib/warn_summary build.log > $@
871 mail-report.log:
872         if test x'$(BOOT_CFLAGS)' != x''; then \
873             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
874         fi; \
875         $(srcdir)/contrib/test_summary -t >$@
876         chmod +x $@
877         echo If you really want to send e-mail, run ./$@ now
879 mail-report-with-warnings.log: warning.log
880         if test x'$(BOOT_CFLAGS)' != x''; then \
881             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
882         fi; \
883         $(srcdir)/contrib/test_summary -t -i warning.log >$@
884         chmod +x $@
885         echo If you really want to send e-mail, run ./$@ now
887 # Local Vim config
889 $(srcdir)/.local.vimrc:
890         $(LN_S) contrib/vimrc $@
892 $(srcdir)/.lvimrc:
893         $(LN_S) contrib/vimrc $@
895 vimrc: $(srcdir)/.local.vimrc $(srcdir)/.lvimrc
897 .PHONY: vimrc
899 # clang-format config
901 $(srcdir)/.clang-format:
902         $(LN_S) contrib/clang-format $@
904 clang-format: $(srcdir)/.clang-format
906 .PHONY: clang-format
908 # Installation targets.
910 .PHONY: install uninstall
911 install:
912         @: $(MAKE); $(unstage)
913         @r=`${PWD_COMMAND}`; export r; \
914         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
915         $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
917 .PHONY: install-host-nogcc
918 install-host-nogcc: [+
919   FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
920     maybe-install-[+module+][+ ENDIF +][+
921   ENDFOR host_modules +]
923 .PHONY: install-host
924 install-host: [+
925   FOR host_modules +] \
926     maybe-install-[+module+][+
927   ENDFOR host_modules +]
929 .PHONY: install-target
930 install-target: [+
931   FOR target_modules +] \
932     maybe-install-target-[+module+][+
933   ENDFOR target_modules +]
935 uninstall:
936         @echo "the uninstall target is not supported in this tree"
938 .PHONY: install.all
939 install.all: install-no-fixedincludes
940         @if [ -f ./gcc/Makefile ]; then \
941                 r=`${PWD_COMMAND}`; export r; \
942                 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
943                 $(HOST_EXPORTS) \
944                 (cd ./gcc && \
945                 $(MAKE) $(FLAGS_TO_PASS) install-headers); \
946         else \
947                 true; \
948         fi
950 # install-no-fixedincludes is used to allow the elaboration of binary packages
951 # suitable for distribution, where we cannot include the fixed system header
952 # files.
953 .PHONY: install-no-fixedincludes
954 install-no-fixedincludes: installdirs install-host-nogcc \
955         install-target gcc-install-no-fixedincludes
957 .PHONY: install-strip
958 install-strip:
959         @: $(MAKE); $(unstage)
960         @r=`${PWD_COMMAND}`; export r; \
961         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
962         $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-strip-host install-strip-target
964 .PHONY: install-strip-host
965 install-strip-host: [+
966   FOR host_modules +] \
967     maybe-install-strip-[+module+][+
968   ENDFOR host_modules +]
970 .PHONY: install-strip-target
971 install-strip-target: [+
972   FOR target_modules +] \
973     maybe-install-strip-target-[+module+][+
974   ENDFOR target_modules +]
977 ### other supporting targets
979 MAKEDIRS= \
980         $(DESTDIR)$(prefix) \
981         $(DESTDIR)$(exec_prefix)
982 .PHONY: installdirs
983 installdirs: mkinstalldirs
984         $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
986 dir.info: do-install-info
987         if [ -f $(srcdir)/texinfo/gen-info-dir ]; then \
988           $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new; \
989           mv -f dir.info.new dir.info; \
990         else true; \
991         fi
993 dist:
994         @echo "Building a full distribution of this tree isn't done"
995         @echo "via 'make dist'.  Check out the etc/ subdirectory" 
997 etags tags: TAGS
999 # Right now this just builds TAGS in each subdirectory.  emacs19 has the
1000 # ability to use several tags files at once, so there is probably no need
1001 # to combine them into one big TAGS file (like CVS 1.3 does).  We could
1002 # (if we felt like it) have this Makefile write a piece of elisp which
1003 # the user could load to tell emacs19 where all the TAGS files we just
1004 # built are.
1005 TAGS: do-TAGS
1007 # ------------------------------------
1008 # Macros for configure and all targets
1009 # ------------------------------------
1011 [+ DEFINE configure +]
1012 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
1013 maybe-configure-[+prefix+][+module+]:
1014 @if gcc-bootstrap
1015 configure-[+prefix+][+module+]: stage_current
1016 @endif gcc-bootstrap
1017 @if [+prefix+][+module+]
1018 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
1019 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
1020         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1021         @r=`${PWD_COMMAND}`; export r; \
1022         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1023         [+ IF check_multilibs
1024         +]echo "Checking multilib configuration for [+module+]..."; \
1025         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1026         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \
1027         if test -r [+subdir+]/[+module+]/multilib.out; then \
1028           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
1029             rm -f [+subdir+]/[+module+]/multilib.tmp; \
1030           else \
1031             rm -f [+subdir+]/[+module+]/Makefile; \
1032             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1033           fi; \
1034         else \
1035           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1036         fi; \
1037         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
1038         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1039         [+exports+] [+extra_exports+] \
1040         echo Configuring in [+subdir+]/[+module+]; \
1041         cd "[+subdir+]/[+module+]" || exit 1; \
1042         case $(srcdir) in \
1043           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1044           *) topdir=`echo [+subdir+]/[+module+]/ | \
1045                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1046         esac; \
1047         module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \
1048         [+ IF no-config-site +]rm -f no-such-file || : ; \
1049         CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) \
1050           $$s/$$module_srcdir/configure \
1051           --srcdir=$${topdir}/$$module_srcdir \
1052           [+args+] --build=${build_alias} --host=[+host_alias+] \
1053           --target=[+target_alias+] [+extra_configure_flags+] \
1054           || exit 1
1055 @endif [+prefix+][+module+]
1057 [+ IF bootstrap +]
1058 [+ FOR bootstrap_stage +]
1059 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
1060 maybe-configure-stage[+id+]-[+prefix+][+module+]:
1061 @if [+prefix+][+module+]-bootstrap
1062 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
1063 configure-stage[+id+]-[+prefix+][+module+]:
1064         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
1065         @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
1066         @r=`${PWD_COMMAND}`; export r; \
1067         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1068         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1069         [+ IF check_multilibs
1070         +]echo "Checking multilib configuration for [+module+]..."; \
1071         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \
1072         if test -r [+subdir+]/[+module+]/multilib.out; then \
1073           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
1074             rm -f [+subdir+]/[+module+]/multilib.tmp; \
1075           else \
1076             rm -f [+subdir+]/[+module+]/Makefile; \
1077             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1078           fi; \
1079         else \
1080           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1081         fi; \
1082         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
1083         [+exports+][+ IF prev +] \
1084         [+poststage1_exports+][+ ENDIF prev +][+ IF prefix +] \
1085         CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
1086         CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
1087         LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;[+ ELSE prefix +] \
1088         CFLAGS="$(STAGE[+id+]_CFLAGS)"; export CFLAGS; \
1089         CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"; export CXXFLAGS;[+ IF prev +] \
1090         LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1091         LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +]; export LIBCFLAGS;[+
1092   ENDIF prefix +] [+extra_exports+] \
1093         echo Configuring stage [+id+] in [+subdir+]/[+module+]; \
1094         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1095         cd [+subdir+]/[+module+] || exit 1; \
1096         case $(srcdir) in \
1097           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1098           *) topdir=`echo [+subdir+]/[+module+]/ | \
1099                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1100         esac; \
1101         module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \
1102         $(SHELL) $$s/$$module_srcdir/configure \
1103           --srcdir=$${topdir}/$$module_srcdir \
1104           [+args+] --build=${build_alias} --host=[+host_alias+] \
1105           --target=[+target_alias+] \
1106           [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
1107           $(STAGE[+id+]_CONFIGURE_FLAGS)[+ IF extra_configure_flags +] \
1108           [+extra_configure_flags+][+ ENDIF extra_configure_flags +]
1109 @endif [+prefix+][+module+]-bootstrap
1110 [+ ENDFOR bootstrap_stage +]
1111 [+ ENDIF bootstrap +]
1112 [+ ENDDEF +]
1114 [+ DEFINE all +]
1115 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
1116 maybe-all-[+prefix+][+module+]:
1117 @if gcc-bootstrap
1118 all-[+prefix+][+module+]: stage_current
1119 @endif gcc-bootstrap
1120 @if [+prefix+][+module+]
1121 TARGET-[+prefix+][+module+]=[+
1122   IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
1123 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
1124 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
1125         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1126         @r=`${PWD_COMMAND}`; export r; \
1127         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1128         [+exports+] [+extra_exports+] \
1129         (cd [+subdir+]/[+module+] && \
1130           $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+stage1_args+] [+extra_make_flags+] \
1131                 $(TARGET-[+prefix+][+module+]))
1132 @endif [+prefix+][+module+]
1134 [+ IF bootstrap +]
1135 [+ FOR bootstrap_stage +]
1136 .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
1137 .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
1138 maybe-all-stage[+id+]-[+prefix+][+module+]:
1139 maybe-clean-stage[+id+]-[+prefix+][+module+]:
1140 @if [+prefix+][+module+]-bootstrap
1141 maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
1142 all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
1143 TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
1144 all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
1145         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
1146         @r=`${PWD_COMMAND}`; export r; \
1147         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1148         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1149         [+exports+][+ IF prev +] \
1150         [+poststage1_exports+][+ ENDIF prev +] [+extra_exports+] \
1151         cd [+subdir+]/[+module+] && \
1152         [+autoprofile+] \
1153         $(MAKE) $(BASE_FLAGS_TO_PASS)[+ IF prefix +] \
1154                 CFLAGS="$(CFLAGS_FOR_TARGET)" \
1155                 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
1156                 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"[+ ELSE prefix +] \
1157                 CFLAGS="$(STAGE[+id+]_CFLAGS)" \
1158                 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"[+ IF prev +] \
1159                 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1160                 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +][+ ENDIF prefix +] \
1161                 CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
1162                 CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
1163                 LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
1164                 [+args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \
1165                 [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] \
1166                 TFLAGS="$(STAGE[+id+]_TFLAGS)" [+profile_data+] \
1167                 $(TARGET-stage[+id+]-[+prefix+][+module+])
1169 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
1170 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
1171 clean-stage[+id+]-[+prefix+][+module+]:
1172         @if [ $(current_stage) = stage[+id+] ]; then \
1173           [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
1174         else \
1175           [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
1176           $(MAKE) stage[+id+]-start; \
1177         fi; \
1178         cd [+subdir+]/[+module+] && \
1179         $(MAKE) [+args+] [+ IF prev +][+poststage1_args+][+ ELSE prev +] \
1180         [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] clean
1181 @endif [+prefix+][+module+]-bootstrap
1183 [+ ENDFOR bootstrap_stage +]
1184 [+ ENDIF bootstrap +]
1185 [+ ENDDEF +]
1187 # --------------------------------------
1188 # Modules which run on the build machine
1189 # --------------------------------------
1190 [+ FOR build_modules +]
1191 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1192              host_alias=(get "host" "${build_alias}")
1193              target_alias=(get "target" "${target_alias}")
1194              args="$(BUILD_CONFIGARGS)" no-config-site=true +]
1196 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1197              args="$(EXTRA_BUILD_FLAGS)" +]
1198 [+ ENDFOR build_module +]
1200 # --------------------------------------
1201 # Modules which run on the host machine
1202 # --------------------------------------
1203 [+ FOR host_modules +]
1204 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
1205              exports="$(HOST_EXPORTS)"
1206              poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1207              host_alias=(get "host" "${host_alias}")
1208              target_alias=(get "target" "${target_alias}")
1209              args="$(HOST_CONFIGARGS)" +]
1211 [+ all prefix="" subdir="$(HOST_SUBDIR)"
1212        exports="$(HOST_EXPORTS)"
1213        poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1214        args="$(EXTRA_HOST_FLAGS)"
1215        stage1_args="$(STAGE1_FLAGS_TO_PASS)"
1216        poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
1218 .PHONY: check-[+module+] maybe-check-[+module+]
1219 maybe-check-[+module+]:
1220 @if [+module+]
1221 maybe-check-[+module+]: check-[+module+]
1222 [+ IF no_check +]
1223 check-[+module+]:
1224 [+ ELIF no_check_cross +]
1225 # This module is only tested in a native toolchain.
1226 check-[+module+]:
1227         @: $(MAKE); $(unstage)
1228         @if [ '$(host)' = '$(target)' ]; then \
1229           r=`${PWD_COMMAND}`; export r; \
1230           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1231           $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
1232           ENDIF bootstrap +] \
1233           (cd $(HOST_SUBDIR)/[+module+] && \
1234             $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
1235             IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
1236         fi
1237 [+ ELSE check +]
1238 check-[+module+]:
1239         @: $(MAKE); $(unstage)
1240         @r=`${PWD_COMMAND}`; export r; \
1241         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1242         $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
1243         ENDIF bootstrap +] \
1244         (cd $(HOST_SUBDIR)/[+module+] && \
1245           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
1246           IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
1247 [+ ENDIF no_check +]
1248 @endif [+module+]
1250 .PHONY: install-[+module+] maybe-install-[+module+]
1251 maybe-install-[+module+]:
1252 @if [+module+]
1253 maybe-install-[+module+]: install-[+module+]
1254 [+ IF no_install +]
1255 install-[+module+]:
1256 [+ ELSE install +]
1257 install-[+module+]: installdirs
1258         @: $(MAKE); $(unstage)
1259         @r=`${PWD_COMMAND}`; export r; \
1260         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1261         $(HOST_EXPORTS) \
1262         (cd $(HOST_SUBDIR)/[+module+] && \
1263           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
1264 [+ ENDIF no_install +]
1265 @endif [+module+]
1267 .PHONY: install-strip-[+module+] maybe-install-strip-[+module+]
1268 maybe-install-strip-[+module+]:
1269 @if [+module+]
1270 maybe-install-strip-[+module+]: install-strip-[+module+]
1271 [+ IF no_install +]
1272 install-strip-[+module+]:
1273 [+ ELSE install +]
1274 install-strip-[+module+]: installdirs
1275         @: $(MAKE); $(unstage)
1276         @r=`${PWD_COMMAND}`; export r; \
1277         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1278         $(HOST_EXPORTS) \
1279         (cd $(HOST_SUBDIR)/[+module+] && \
1280           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
1281 [+ ENDIF no_install +]
1282 @endif [+module+]
1284 # Other targets (info, dvi, pdf, etc.)
1285 [+ FOR recursive_targets +]
1286 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1287 maybe-[+make_target+]-[+module+]:
1288 @if [+module+]
1289 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
1290 [+ IF (match-value? = "missing" (get "make_target") ) +]
1291 # [+module+] doesn't support [+make_target+].
1292 [+make_target+]-[+module+]:
1293 [+ ELSE +]
1294 [+make_target+]-[+module+]: [+
1295   FOR depend +]\
1296     [+depend+]-[+module+] [+
1297   ENDFOR depend +]
1298         @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1299         @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
1300         r=`${PWD_COMMAND}`; export r; \
1301         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1302         $(HOST_EXPORTS) \
1303         for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1304           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1305         done; \
1306         echo "Doing [+make_target+] in [+module+]"; \
1307         (cd $(HOST_SUBDIR)/[+module+] && \
1308           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1309                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1310                   "RANLIB=$${RANLIB}" \
1311                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1312                   [+make_target+]) \
1313           || exit 1
1314 [+ ENDIF +]
1315 @endif [+module+]
1316 [+ ENDFOR recursive_targets +]
1317 [+ ENDFOR host_modules +]
1319 # ---------------------------------------
1320 # Modules which run on the target machine
1321 # ---------------------------------------
1322 [+ FOR target_modules +]
1324 [+ IF raw_cxx +]
1325 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1326              check_multilibs=true
1327              exports="$(RAW_CXX_TARGET_EXPORTS)"
1328              host_alias=(get "host" "${target_alias}")
1329              target_alias=(get "target" "${target_alias}")
1330              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1332 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1333        exports="$(RAW_CXX_TARGET_EXPORTS)"
1334        args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1335 [+ ELSE +]
1336 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1337              check_multilibs=true
1338              exports="$(NORMAL_TARGET_EXPORTS)"
1339              host_alias=(get "host" "${target_alias}")
1340              target_alias=(get "target" "${target_alias}")
1341              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1343 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1344        exports="$(NORMAL_TARGET_EXPORTS)"
1345        args="$(EXTRA_TARGET_FLAGS)" +]
1346 [+ ENDIF +]
1348 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1349 maybe-check-target-[+module+]:
1350 @if target-[+module+]
1351 maybe-check-target-[+module+]: check-target-[+module+]
1352 [+ IF no_check +]
1353 # Dummy target for uncheckable module.
1354 check-target-[+module+]:
1355 [+ ELSE check +]
1356 check-target-[+module+]:
1357         @: $(MAKE); $(unstage)
1358         @r=`${PWD_COMMAND}`; export r; \
1359         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1360 IF raw_cxx +]
1361         $(RAW_CXX_TARGET_EXPORTS) \[+
1362 ELSE normal_cxx +]
1363         $(NORMAL_TARGET_EXPORTS) \[+
1364 ENDIF raw_cxx +]
1365         (cd $(TARGET_SUBDIR)/[+module+] && \
1366           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1367             IF raw_cxx 
1368               +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1369             ENDIF raw_cxx 
1370           +] [+extra_make_flags+] check)
1371 [+ ENDIF no_check +]
1372 @endif target-[+module+]
1374 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1375 maybe-install-target-[+module+]:
1376 @if target-[+module+]
1377 maybe-install-target-[+module+]: install-target-[+module+]
1378 [+ IF no_install +]
1379 # Dummy target for uninstallable.
1380 install-target-[+module+]:
1381 [+ ELSE install +]
1382 install-target-[+module+]: installdirs
1383         @: $(MAKE); $(unstage)
1384         @r=`${PWD_COMMAND}`; export r; \
1385         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1386 IF raw_cxx +]
1387         $(RAW_CXX_TARGET_EXPORTS) \[+
1388 ELSE normal_cxx +]
1389         $(NORMAL_TARGET_EXPORTS) \[+
1390 ENDIF raw_cxx +]
1391         (cd $(TARGET_SUBDIR)/[+module+] && \
1392           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1393 [+ ENDIF no_install +]
1394 @endif target-[+module+]
1396 .PHONY: install-strip-target-[+module+] maybe-install-strip-target-[+module+]
1397 maybe-install-strip-target-[+module+]:
1398 @if target-[+module+]
1399 maybe-install-strip-target-[+module+]: install-strip-target-[+module+]
1400 [+ IF no_install +]
1401 # Dummy target for uninstallable.
1402 install-strip-target-[+module+]:
1403 [+ ELSE install +]
1404 install-strip-target-[+module+]: installdirs
1405         @: $(MAKE); $(unstage)
1406         @r=`${PWD_COMMAND}`; export r; \
1407         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1408 IF raw_cxx +]
1409         $(RAW_CXX_TARGET_EXPORTS) \[+
1410 ELSE normal_cxx +]
1411         $(NORMAL_TARGET_EXPORTS) \[+
1412 ENDIF raw_cxx +]
1413         (cd $(TARGET_SUBDIR)/[+module+] && \
1414           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
1415 [+ ENDIF no_install +]
1416 @endif target-[+module+]
1418 # Other targets (info, dvi, pdf, etc.)
1419 [+ FOR recursive_targets +]
1420 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1421 maybe-[+make_target+]-target-[+module+]:
1422 @if target-[+module+]
1423 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1424 [+ IF (match-value? = "missing" (get "make_target") ) +]
1425 # [+module+] doesn't support [+make_target+].
1426 [+make_target+]-target-[+module+]:
1427 [+ ELSE +]
1428 [+make_target+]-target-[+module+]: [+
1429   FOR depend +]\
1430     [+depend+]-target-[+module+] [+
1431   ENDFOR depend +]
1432         @: $(MAKE); $(unstage)
1433         @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0; \
1434         r=`${PWD_COMMAND}`; export r; \
1435         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1436 IF raw_cxx +]
1437         $(RAW_CXX_TARGET_EXPORTS) \[+
1438 ELSE normal_cxx +]
1439         $(NORMAL_TARGET_EXPORTS) \[+
1440 ENDIF raw_cxx +]
1441         echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]"; \
1442         for flag in $(EXTRA_TARGET_FLAGS); do \
1443           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1444         done; \
1445         (cd $(TARGET_SUBDIR)/[+module+] && \
1446           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1447                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1448                   "RANLIB=$${RANLIB}" \
1449                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1450                   [+extra_make_flags+] [+make_target+]) \
1451           || exit 1
1452 [+ ENDIF +]
1453 @endif target-[+module+]
1454 [+ ENDFOR recursive_targets +]
1455 [+ ENDFOR target_modules +]
1457 @if target-libgomp
1458 .PHONY: check-target-libgomp-c++
1459 check-target-libgomp-c++:
1460         $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libgomp
1462 @endif target-libgomp
1464 @if target-libitm
1465 .PHONY: check-target-libitm-c++
1466 check-target-libitm-c++:
1467         $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libitm
1469 @endif target-libitm
1471 # ----------
1472 # GCC module
1473 # ----------
1475 @if gcc-no-bootstrap
1476 .PHONY: cross
1477 cross: all-build all-gas all-ld
1478         @r=`${PWD_COMMAND}`; export r; \
1479         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1480         $(HOST_EXPORTS) \
1481         echo "Building the C and C++ compiler"; \
1482         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1483         @r=`${PWD_COMMAND}`; export r; \
1484         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1485         echo "Building runtime libraries"; \
1486         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1487 @endif gcc-no-bootstrap
1489 @if gcc
1490 [+ FOR languages +]
1491 .PHONY: check-gcc-[+language+] check-[+language+]
1492 check-gcc-[+language+]:
1493         r=`${PWD_COMMAND}`; export r; \
1494         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1495         $(HOST_EXPORTS) \
1496         (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]);
1497 check-[+language+]: check-gcc-[+language+][+ FOR lib-check-target +] [+ lib-check-target +][+ ENDFOR lib-check-target +]
1498 [+ ENDFOR languages +]
1500 # The gcc part of install-no-fixedincludes, which relies on an intimate
1501 # knowledge of how a number of gcc internal targets (inter)operate.  Delegate.
1502 .PHONY: gcc-install-no-fixedincludes
1503 gcc-install-no-fixedincludes:
1504         @if [ -f ./gcc/Makefile ]; then \
1505           r=`${PWD_COMMAND}`; export r; \
1506           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1507           $(HOST_EXPORTS) \
1508           (cd ./gcc \
1509            && $(MAKE) $(GCC_FLAGS_TO_PASS) install-no-fixedincludes); \
1510         else true; fi
1511 @endif gcc
1513 # ---------------------
1514 # GCC bootstrap support
1515 # ---------------------
1517 # We track the current stage (the one in 'gcc') in the stage_current file.
1518 # stage_last instead tracks the stage that was built last.  These targets
1519 # are dummy when toplevel bootstrap is not active.
1521 # While making host and target tools, symlinks to the final stage must be
1522 # there, so $(unstage) should be run at various points.  To avoid excessive
1523 # recursive invocations of make, we "inline" them using a variable.  These
1524 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1525 # to avoid warnings from the GNU Make job server.
1527 unstage = :
1528 stage = :
1529 current_stage = ""
1531 @if gcc-bootstrap
1532 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1533 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1534 current_stage = "`cat stage_current 2> /dev/null`"
1535 @endif gcc-bootstrap
1537 .PHONY: unstage stage
1538 unstage:
1539         @: $(MAKE); $(unstage)
1540 stage:
1541         @: $(MAKE); $(stage)
1543 # Disable commands for lean bootstrap.
1544 LEAN = false
1546 # We name the build directories for the various stages "stage1-gcc",
1547 # "stage2-gcc","stage3-gcc", etc.
1549 # Since the 'compare' process will fail (on debugging information) if any
1550 # directory names are different, we need to link the gcc directory for
1551 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1552 # the build directories constant as well. For the latter, we use naked names
1553 # like 'gcc', because the scripts in that directory assume it.  We use
1554 # mv on platforms where symlinks to directories do not work or are not
1555 # reliable.
1557 # 'touch' doesn't work right on some platforms.
1558 STAMP = echo timestamp > 
1560 # We only want to compare .o files, so set this!
1561 objext = .o
1563 [+ FOR bootstrap-stage +]
1564 .PHONY: stage[+id+]-start stage[+id+]-end
1566 stage[+id+]-start::
1567         @: $(MAKE); $(stage); \
1568         echo stage[+id+] > stage_current; \
1569         echo stage[+id+] > stage_last; \
1570         $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1571    FOR host_modules +][+ IF bootstrap +]
1572 @if [+ module +]
1573         @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1574           mkdir stage[+id+]-[+module+]; \
1575         mv stage[+id+]-[+module+] [+module+][+ IF prev +]; \
1576         mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1577 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1578         @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1579           mkdir stage[+id+]-$(TARGET_SUBDIR); \
1580         mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR)[+ IF prev +]; \
1581         mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1583 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1584 @if [+ module +]
1585         @if test -d $(HOST_SUBDIR)/[+module+]; then \
1586           cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+][+ IF prev +]; \
1587           mv prev-[+module+] stage[+prev+]-[+module+]; : [+ ENDIF prev +]; \
1588         fi
1589 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1590         @if test -d $(TARGET_SUBDIR); then \
1591           mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR)[+ IF prev +]; \
1592           mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR); : [+ ENDIF prev +]; \
1593         fi
1594         rm -f stage_current
1596 # Bubble a bug fix through all the stages up to stage [+id+].  They are
1597 # remade, but not reconfigured.  The next stage (if any) will not be
1598 # reconfigured either.
1599 .PHONY: stage[+id+]-bubble
1600 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1601         @r=`${PWD_COMMAND}`; export r; \
1602         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1603         if test -f stage[+id+]-lean [+
1604           IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +]; then \
1605           echo Skipping rebuild of stage[+id+]; \
1606         else \
1607           $(MAKE) stage[+id+]-start; \[+IF lean +]
1608           if $(LEAN); then \
1609             rm -rf stage[+lean+]-*; \
1610             $(STAMP) stage[+lean+]-lean; \
1611           fi; \[+ ENDIF lean +]
1612           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1613         fi[+ IF compare-target +]
1614         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1616 .PHONY: all-stage[+id+] clean-stage[+id+]
1617 do-clean: clean-stage[+id+]
1619 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1620 # only possibility, but now it conflicts with no-bootstrap rules
1621 @if gcc-bootstrap
1622 [+ IF compare-target +]
1623 [+compare-target+]:
1624         @r=`${PWD_COMMAND}`; export r; \
1625         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1626         if test -f stage[+prev+]-lean; then \
1627           echo Cannot compare object files as stage [+prev+] was deleted.; \
1628           exit 0; \
1629         fi; \
1630         : $(MAKE); $(stage); \
1631         rm -f .bad_compare; \
1632         echo Comparing stages [+prev+] and [+id+]; \
1633         sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \
1634         files=`find stage[+id+]-* -name "*$(objext)" -print | \
1635                  sed -n s,^stage$$sed-,,p`; \
1636         for file in $${files}; do \
1637           f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \
1638           if test ! -f $$f1; then continue; fi; \
1639           $(do-[+compare-target+]) > /dev/null 2>&1; \
1640           if test $$? -eq 1; then \
1641             case $$file in \
1642               @compare_exclusions@) \
1643                 echo warning: $$file differs ;; \
1644               *) \
1645                 echo $$file differs >> .bad_compare ;; \
1646             esac; \
1647           fi; \
1648         done; \
1649         if [ -f .bad_compare ]; then \
1650           echo "Bootstrap comparison failure!"; \
1651           cat .bad_compare; \
1652           exit 1; \
1653         else \
1654           echo Comparison successful.; \
1655         fi; \
1656         $(STAMP) [+compare-target+][+ IF prev +]
1657         if $(LEAN); then \
1658           rm -rf stage[+prev+]-*; \
1659           $(STAMP) stage[+prev+]-lean; \
1660         fi[+ ENDIF prev +]
1661 [+ ENDIF compare-target +]
1663 [+ IF bootstrap-target +]
1664 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1665 [+bootstrap-target+]:
1666         echo stage[+id+] > stage_final
1667         @r=`${PWD_COMMAND}`; export r; \
1668         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1669         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1670         @: $(MAKE); $(unstage)
1671         @r=`${PWD_COMMAND}`; export r; \
1672         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1673         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1674         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1676 [+bootstrap-target+]-lean:
1677         echo stage[+id+] > stage_final
1678         @r=`${PWD_COMMAND}`; export r; \
1679         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1680         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1681         @: $(MAKE); $(unstage)
1682         @r=`${PWD_COMMAND}`; export r; \
1683         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1684         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1685         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1686 [+ ENDIF bootstrap-target +]
1688 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1689 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1690 .PHONY: distclean-stage[+id+]
1691 distclean-stage[+id+]::
1692         @: $(MAKE); $(stage)
1693         @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1694         rm -rf stage[+id+]-* [+
1695           IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1697 [+ IF cleanstrap-target +]
1698 .PHONY: [+cleanstrap-target+]
1699 [+cleanstrap-target+]: do-distclean local-clean
1700         echo stage[+id+] > stage_final
1701         @r=`${PWD_COMMAND}`; export r; \
1702         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1703         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1704         @: $(MAKE); $(unstage)
1705         @r=`${PWD_COMMAND}`; export r; \
1706         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1707         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1708         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1709 [+ ENDIF cleanstrap-target +]
1710 @endif gcc-bootstrap
1712 [+ ENDFOR bootstrap-stage +]
1714 stageprofile-end::
1715         $(MAKE) distclean-stagefeedback
1717 stagefeedback-start::
1718         @r=`${PWD_COMMAND}`; export r; \
1719         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1720         for i in prev-*; do \
1721           j=`echo $$i | sed s/^prev-//`; \
1722           cd $$r/$$i && \
1723           { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL); } && \
1724           { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL); }; \
1725         done
1727 @if gcc-bootstrap
1728 do-distclean: distclean-stage1
1730 # Provide a GCC build when we're building target libraries.  This does
1731 # not work as a dependency, just as the minimum necessary to avoid errors.
1732 stage_last:
1733         @r=`${PWD_COMMAND}`; export r; \
1734         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1735         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1737 # Same as unstage, but not phony and defaulting to stage1-start.  We place
1738 # it in the dependency so that for example `make -j3 all-gcc' works.
1739 stage_current:
1740         @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1742 .PHONY: restrap
1743 restrap::
1744         @: $(MAKE); $(stage)
1745         rm -rf stage1-$(TARGET_SUBDIR)[+ FOR bootstrap-stage +][+ IF prev
1746           +] stage[+id+]-*[+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1747 restrap:: all
1748 @endif gcc-bootstrap
1750 # --------------------------------------
1751 # Dependencies between different modules
1752 # --------------------------------------
1754 # Generic dependencies for target modules on host stuff, especially gcc
1755 @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1756   +][+ FOR bootstrap_stage +]
1757 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1758   ENDFOR +][+ ELSE bootstrap +]
1759 configure-target-[+module+]: stage_last[+
1760   ENDIF bootstrap +][+ ENDFOR target_modules +]
1761 @endif gcc-bootstrap
1763 @if gcc-no-bootstrap[+ FOR target_modules +]
1764 configure-target-[+module+]: maybe-all-gcc[+
1765   ENDFOR target_modules +]
1766 @endif gcc-no-bootstrap
1769 # There are two types of dependencies here: 'hard' dependencies, where one
1770 # module simply won't build without the other; and 'soft' dependencies, where
1771 # if the depended-on module is missing, the depending module will do without
1772 # or find a substitute somewhere (perhaps installed).  Soft dependencies
1773 # are made here to depend on a 'maybe-' target.  If you're not sure,
1774 # it's safer to use a soft dependency.
1776 [+ ;; These Scheme functions build the bulk of the dependencies.
1777    ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1778    ;; where "maybe-" is only included if HARD is not true, and all-gcc
1779    ;; is taken from VAR-NAME.
1780    (define dep-target (lambda (module-kind var-name hard)
1781       (string-append
1782          (if hard "" "maybe-")
1783          (dep-subtarget var-name)
1784          module-kind
1785          (dep-module var-name)
1786       )))
1788    ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1789    (define make-dep (lambda (module-kind on-kind)
1790       (string-append
1791          (dep-target module-kind "module" #t) ": "
1792          (dep-target on-kind "on" (exist? "hard")))))
1794    ;; dep-subtarget extracts everything up to the first dash in the given
1795    ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1796    (define dep-subtarget (lambda (var-name)
1797       (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1799    ;; dep-module extracts everything up to the first dash in the given
1800    ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1801    (define dep-module (lambda (var-name)
1802       (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1804    ;; dep-stage builds a string for the prefix of a bootstrap stage.
1805    (define dep-stage (lambda ()
1806       (string-append
1807          "stage"
1808          (get "id")
1809          "-")))
1811    ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1812    ;; but is written in Scheme.
1813    (define dep-maybe (lambda ()
1814       (if (exist? "hard") "" "maybe-")))
1816    ;; dep-kind returns "normal" if the dependency is on an "install" target,
1817    ;; or if either module is not bootstrapped.  It returns "bootstrap" for
1818    ;; configure or build dependencies between bootstrapped modules; it returns
1819    ;; "prebootstrap" for configure or build dependencies of bootstrapped
1820    ;; modules on a build module (e.g. all-gcc on all-build-bison).  All this
1821    ;; is only necessary for host modules.
1822    (define dep-kind (lambda ()
1823       (if (and (hash-ref boot-modules (dep-module "module"))
1824                (=* (dep-module "on") "build-"))
1825           "prebootstrap"
1827           (if (or (= (dep-subtarget "on") "install-")
1828                   (not (hash-ref boot-modules (dep-module "module")))
1829                   (not (hash-ref boot-modules (dep-module "on"))))
1830               "normal"
1831               "bootstrap"))))
1833    ;; We now build the hash table that is used by dep-kind.
1834    (define boot-modules (make-hash-table 113))
1837 [+ FOR host_modules +][+
1838    (if (exist? "bootstrap")
1839        (hash-create-handle! boot-modules (get "module") #t))
1840    "" +][+ ENDFOR host_modules +]
1841 [+ FOR target_modules +][+
1842    (if (exist? "bootstrap")
1843        (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1844    "" +][+ ENDFOR target_modules +]
1846 # With all the machinery above in place, it is pretty easy to generate
1847 # dependencies.  Host dependencies are a bit more complex because we have
1848 # to check for bootstrap/prebootstrap dependencies.  To resolve
1849 # prebootstrap dependencies, prebootstrap modules are gathered in
1850 # a hash table.
1851 [+ FOR dependencies +][+ (make-dep "" "") +]
1852 [+ CASE (dep-kind) +]
1853 [+ == "prebootstrap"
1854      +][+ FOR bootstrap_stage +]
1855 [+ (make-dep (dep-stage) "") +][+
1856        ENDFOR bootstrap_stage +]
1857 [+ == "bootstrap"
1858      +][+ FOR bootstrap_stage +]
1859 [+ (make-dep (dep-stage) (dep-stage)) +][+
1860        ENDFOR bootstrap_stage +]
1861 [+ ESAC +][+
1862 ENDFOR dependencies +]
1864 # Dependencies for target modules on other target modules are
1865 # described by lang_env_dependencies; the defaults apply to anything
1866 # not mentioned there.
1868    ;; Predicate for whether LANG was specified in lang_env_dependencies.
1869    (define lang-dep (lambda (lang)
1870       (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1872    ;; Build the hash table we will need.
1873    (define lang-env-deps (make-hash-table 7))
1874 +][+ FOR lang_env_dependencies +][+
1875    (if (exist? "cxx")
1876        (hash-create-handle! lang-env-deps
1877           (string-append (get "module") "-" "cxx") #t))
1879    (if (exist? "no_c")
1880        (hash-create-handle! lang-env-deps
1881           (string-append (get "module") "-" "no_c") #t))
1883    (if (exist? "no_gcc")
1884        (hash-create-handle! lang-env-deps
1885           (string-append (get "module") "-" "no_gcc") #t))
1886    "" +][+ ENDFOR lang_env_dependencies +]
1888 @if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1889   +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1890 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1891   ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1892 @endif gcc-bootstrap
1894 @if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1895 configure-target-[+module+]: maybe-all-target-libgcc[+
1896   ENDIF +][+ ENDFOR target_modules +]
1897 @endif gcc-no-bootstrap
1899 [+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1900 configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1901   ENDIF +][+ IF (lang-dep "cxx") +]
1902 configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1903   ENDIF +]
1904 [+ ENDFOR target_modules +]
1906 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
1907 GDB_TK = @GDB_TK@
1908 INSTALL_GDB_TK = @INSTALL_GDB_TK@
1909 configure-gdb: $(CONFIGURE_GDB_TK)
1910 all-gdb: $(gdbnlmrequirements) $(GDB_TK)
1911 install-gdb: $(INSTALL_GDB_TK)
1913 # Serialization dependencies.  Host configures don't work well in parallel to
1914 # each other, due to contention over config.cache.  Target configures and 
1915 # build configures are similar.
1916 @serialization_dependencies@
1918 # --------------------------------
1919 # Regenerating top level configury
1920 # --------------------------------
1922 # Rebuilding Makefile.in, using autogen.
1923 AUTOGEN = autogen
1924 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1925         cd $(srcdir) && $(AUTOGEN) Makefile.def
1927 # Rebuilding Makefile.
1928 Makefile: $(srcdir)/Makefile.in config.status
1929         CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1931 config.status: configure
1932         CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
1934 # Rebuilding configure.
1935 AUTOCONF = autoconf
1936 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
1937         $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
1938         $(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
1939         $(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
1940         $(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
1941         cd $(srcdir) && $(AUTOCONF)
1943 # ------------------------------
1944 # Special directives to GNU Make
1945 # ------------------------------
1947 # Don't pass command-line variables to submakes.
1948 .NOEXPORT:
1949 MAKEOVERRIDES=
1951 # end of Makefile.in