re PR rtl-optimization/89795 (wrong code with -O2 -fno-dce -fno-forward-propagate...
[official-gcc.git] / Makefile.tpl
blobefed1511750412f7dff03a363779b78c6ecccb41
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         GDC="$(GDC_FOR_BUILD)"; export GDC; \
163         GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \
164         DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
165         LD="$(LD_FOR_BUILD)"; export LD; \
166         LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
167         NM="$(NM_FOR_BUILD)"; export NM; \
168         RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
169         WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
170         WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
172 # These variables must be set on the make command line for directories
173 # built for the build system to override those in BASE_FLAGS_TO_PASS.
174 EXTRA_BUILD_FLAGS = \
175         CFLAGS="$(CFLAGS_FOR_BUILD)" \
176         LDFLAGS="$(LDFLAGS_FOR_BUILD)"
178 # This is the list of directories to built for the host system.
179 SUBDIRS = @configdirs@
180 TARGET_CONFIGDIRS = @target_configdirs@
181 # This is set by the configure script to the arguments to use when configuring
182 # directories built for the host system.
183 HOST_CONFIGARGS = @host_configargs@
184 # Host programs are put under this directory, which is . except if building
185 # with srcdir=..
186 HOST_SUBDIR = @host_subdir@
187 # This is the list of variables to export in the environment when
188 # configuring subdirectories for the host system.  We need to pass
189 # some to the GCC configure because of its hybrid host/target nature.
190 HOST_EXPORTS = \
191         $(BASE_EXPORTS) \
192         CC="$(CC)"; export CC; \
193         ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
194         CFLAGS="$(CFLAGS)"; export CFLAGS; \
195         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
196         CXX="$(CXX)"; export CXX; \
197         CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
198         GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
199         GOC="$(GOC)"; export GOC; \
200         GDC="$(GDC)"; export GDC; \
201         AR="$(AR)"; export AR; \
202         AS="$(AS)"; export AS; \
203         CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
204         CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
205         DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
206         LD="$(LD)"; export LD; \
207         LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
208         NM="$(NM)"; export NM; \
209         RANLIB="$(RANLIB)"; export RANLIB; \
210         WINDRES="$(WINDRES)"; export WINDRES; \
211         WINDMC="$(WINDMC)"; export WINDMC; \
212         OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
213         OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
214         OTOOL="$(OTOOL)"; export OTOOL; \
215         READELF="$(READELF)"; export READELF; \
216         AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
217         AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
218         GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
219         LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
220         NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
221         OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
222         OBJCOPY_FOR_TARGET="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY_FOR_TARGET; \
223         OTOOL_FOR_TARGET="$(OTOOL_FOR_TARGET)"; export OTOOL_FOR_TARGET; \
224         RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
225         READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
226         TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
227         HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
228         GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
229         GMPINC="$(HOST_GMPINC)"; export GMPINC; \
230         ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
231         ISLINC="$(HOST_ISLINC)"; export ISLINC; \
232         LIBELFLIBS="$(HOST_LIBELFLIBS)"; export LIBELFLIBS; \
233         LIBELFINC="$(HOST_LIBELFINC)"; export LIBELFINC; \
234         XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \
235 @if gcc-bootstrap
236         $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
237 @endif gcc-bootstrap
238         $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
240 POSTSTAGE1_CXX_EXPORT = \
241         CXX='$(CXX)'; export CXX; \
242         CXX_FOR_BUILD='$(CXX_FOR_BUILD)'; export CXX_FOR_BUILD;
243 @if target-libstdc++-v3-bootstrap
244 # Override the above if we're bootstrapping C++.
245 POSTSTAGE1_CXX_EXPORT = \
246         CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xg++$(exeext) \
247           -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \
248           -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
249           -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
250           `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \
251           `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \
252           `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$s/libstdc++-v3/libsupc++ \
253           -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
254           -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \
255           export CXX; \
256         CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD;
257 @endif target-libstdc++-v3-bootstrap
259 # Similar, for later GCC stages.
260 POSTSTAGE1_HOST_EXPORTS = \
261         $(HOST_EXPORTS) \
262         CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
263           -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ \
264           $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
265         CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \
266         $(POSTSTAGE1_CXX_EXPORT) \
267         $(LTO_EXPORTS) \
268         GDC="$$r/$(HOST_SUBDIR)/prev-gcc/gdc$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
269           -B$(build_tooldir)/bin/ $(GDC_FLAGS_FOR_TARGET) \
270           -B$$r/prev-$(TARGET_SUBDIR)/libphobos/src \
271           -I$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime -I$$s/libphobos/libdruntime \
272           -L$$r/prev-$(TARGET_SUBDIR)/libphobos/src/.libs \
273           -L$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime/.libs"; \
274         export GDC; \
275         GDC_FOR_BUILD="$$GDC"; export GDC_FOR_BUILD; \
276         GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \
277         LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \
278         HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS;
280 # Target libraries are put under this directory:
281 TARGET_SUBDIR = @target_subdir@
282 # This is set by the configure script to the arguments to use when configuring
283 # directories built for the target.
284 TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
285 # This is the list of variables to export in the environment when
286 # configuring subdirectories for the target system.
287 BASE_TARGET_EXPORTS = \
288         $(BASE_EXPORTS) \
289         AR="$(AR_FOR_TARGET)"; export AR; \
290         AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
291         CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
292         CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
293         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
294         CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
295         CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
296         GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
297         GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
298         GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \
299         DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
300         LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
301         LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
302         LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
303         NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
304         OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
305         OBJCOPY="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY; \
306         OTOOL="$(OTOOL_FOR_TARGET)"; export OTOOL; \
307         RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
308         READELF="$(READELF_FOR_TARGET)"; export READELF; \
309         STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
310         WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
311         WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
312 @if gcc-bootstrap
313         $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
314 @endif gcc-bootstrap
315         $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
316         TARGET_CONFIGDIRS="$(TARGET_CONFIGDIRS)"; export TARGET_CONFIGDIRS;
318 RAW_CXX_TARGET_EXPORTS = \
319         $(BASE_TARGET_EXPORTS) \
320         CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
321         CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
323 NORMAL_TARGET_EXPORTS = \
324         $(BASE_TARGET_EXPORTS) \
325         CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
327 # Where to find GMP
328 HOST_GMPLIBS = @gmplibs@
329 HOST_GMPINC = @gmpinc@
331 # Where to find isl
332 HOST_ISLLIBS = @isllibs@
333 HOST_ISLINC = @islinc@
335 # Where to find libelf
336 HOST_LIBELFLIBS = @libelflibs@
337 HOST_LIBELFINC = @libelfinc@
339 # ----------------------------------------------
340 # Programs producing files for the BUILD machine
341 # ----------------------------------------------
343 SHELL = @SHELL@
345 # pwd command to use.  Allow user to override default by setting PWDCMD in
346 # the environment to account for automounters.  The make variable must not
347 # be called PWDCMD, otherwise the value set here is passed to make
348 # subprocesses and overrides the setting from the user's environment.
349 # Don't use PWD since it is a common shell environment variable and we
350 # don't want to corrupt it.
351 PWD_COMMAND = $${PWDCMD-pwd}
353 # compilers to use to create programs which must be run in the build
354 # environment.
355 AR_FOR_BUILD = @AR_FOR_BUILD@
356 AS_FOR_BUILD = @AS_FOR_BUILD@
357 CC_FOR_BUILD = @CC_FOR_BUILD@
358 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
359 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
360 CXX_FOR_BUILD = @CXX_FOR_BUILD@
361 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
362 GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
363 GOC_FOR_BUILD = @GOC_FOR_BUILD@
364 GDC_FOR_BUILD = @GDC_FOR_BUILD@
365 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
366 LD_FOR_BUILD = @LD_FOR_BUILD@
367 NM_FOR_BUILD = @NM_FOR_BUILD@
368 RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@
369 WINDMC_FOR_BUILD = @WINDMC_FOR_BUILD@
370 WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@
372 # Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
373 # here so that they can be overridden by Makefile fragments.
374 BUILD_PREFIX = @BUILD_PREFIX@
375 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
377 # Flags to pass to stage2 and later makes.  They are defined
378 # here so that they can be overridden by Makefile fragments.
379 BOOT_CFLAGS= -g -O2
380 BOOT_LDFLAGS=
381 BOOT_ADAFLAGS= -gnatpg
383 AWK = @AWK@
384 SED = @SED@
385 BISON = @BISON@
386 YACC = @YACC@
387 FLEX = @FLEX@
388 LEX = @LEX@
389 M4 = @M4@
390 MAKEINFO = @MAKEINFO@
391 EXPECT = @EXPECT@
392 RUNTEST = @RUNTEST@
394 AUTO_PROFILE = gcc-auto-profile -c 10000000
396 # This just becomes part of the MAKEINFO definition passed down to
397 # sub-makes.  It lets flags be given on the command line while still
398 # using the makeinfo from the object tree.
399 # (Default to avoid splitting info files by setting the threshold high.)
400 MAKEINFOFLAGS = --split-size=5000000
402 # ---------------------------------------------
403 # Programs producing files for the HOST machine
404 # ---------------------------------------------
406 AS = @AS@
407 AR = @AR@
408 AR_FLAGS = rc
409 CC = @CC@
410 CXX = @CXX@
411 DLLTOOL = @DLLTOOL@
412 LD = @LD@
413 LIPO = @LIPO@
414 NM = @NM@
415 OBJDUMP = @OBJDUMP@
416 OTOOL = @OTOOL@
417 RANLIB = @RANLIB@
418 READELF = @READELF@
419 STRIP = @STRIP@
420 WINDRES = @WINDRES@
421 WINDMC = @WINDMC@
423 GDC = @GDC@
424 GNATBIND = @GNATBIND@
425 GNATMAKE = @GNATMAKE@
427 CFLAGS = @CFLAGS@
428 LDFLAGS = @LDFLAGS@
429 LIBCFLAGS = $(CFLAGS)
430 CXXFLAGS = @CXXFLAGS@
431 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
432 GOCFLAGS = $(CFLAGS)
433 GDCFLAGS = $(CFLAGS)
435 CREATE_GCOV = create_gcov
437 TFLAGS =
439 # Defaults for all stages; some are overridden below.
441 STAGE_CFLAGS = $(BOOT_CFLAGS)
442 STAGE_TFLAGS = $(TFLAGS)
443 STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
445 [+ FOR bootstrap-stage +]
446 # Defaults for stage [+id+]; some are overridden below.
447 STAGE[+id+]_CFLAGS = $(STAGE_CFLAGS)
448 STAGE[+id+]_CXXFLAGS = $(CXXFLAGS)
449 @if target-libstdc++-v3-bootstrap
450 # Override the above if we're bootstrapping C++.
451 STAGE[+id+]_CXXFLAGS = $(STAGE[+id+]_CFLAGS)
452 @endif target-libstdc++-v3-bootstrap
453 STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS)
454 STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
455 [+ ENDFOR bootstrap-stage +]
457 # By default, C and C++ are the only stage1 languages, because they are the
458 # only ones we require to build with the bootstrap compiler, and also the
459 # only ones useful for building stage2.
461 STAGE1_CFLAGS = @stage1_cflags@
462 STAGE1_CHECKING = @stage1_checking@
463 STAGE1_LANGUAGES = @stage1_languages@
464 # * We force-disable intermodule optimizations, even if
465 #   --enable-intermodule was passed, since the installed compiler
466 #   probably can't handle them.  Luckily, autoconf always respects
467 #   the last argument when conflicting --enable arguments are passed.
468 # * Likewise, we force-disable coverage flags, since the installed
469 #   compiler probably has never heard of them.
470 # * We also disable -Wformat, since older GCCs don't understand newer %s.
471 STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
472           --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" \
473           --disable-build-format-warnings
475 # When using the slow stage1 compiler disable IL verification and forcefully
476 # enable it when using the stage2 compiler instead.  As we later compare
477 # stage2 and stage3 we are merely avoid doing redundant work, plus we apply
478 # checking when building all target libraries for release builds.
479 STAGE1_TFLAGS += -fno-checking
480 STAGE2_CFLAGS += -fno-checking
481 STAGE2_TFLAGS += -fno-checking
482 STAGE3_CFLAGS += -fchecking=1
483 STAGE3_TFLAGS += -fchecking=1
485 STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
486 STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
488 STAGEtrain_CFLAGS = $(filter-out -fchecking=1,$(STAGE3_CFLAGS))
489 STAGEtrain_TFLAGS = $(filter-out -fchecking=1,$(STAGE3_TFLAGS))
491 STAGEfeedback_CFLAGS = $(STAGE4_CFLAGS) -fprofile-use
492 STAGEfeedback_TFLAGS = $(STAGE4_TFLAGS)
494 STAGEautoprofile_CFLAGS = $(STAGE2_CFLAGS) -g
495 STAGEautoprofile_TFLAGS = $(STAGE2_TFLAGS)
497 STAGEautofeedback_CFLAGS = $(STAGE3_CFLAGS)
498 STAGEautofeedback_TFLAGS = $(STAGE3_TFLAGS)
500 do-compare = @do_compare@
501 do-compare3 = $(do-compare)
503 # -----------------------------------------------
504 # Programs producing files for the TARGET machine
505 # -----------------------------------------------
507 AR_FOR_TARGET=@AR_FOR_TARGET@
508 AS_FOR_TARGET=@AS_FOR_TARGET@
509 CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@
511 # If GCC_FOR_TARGET is not overriden on the command line, then this
512 # variable is passed down to the gcc Makefile, where it is used to
513 # build libgcc2.a.  We define it here so that it can itself be
514 # overridden on the command line.
515 GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@
516 CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@
517 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
518 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
519 GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
520 GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@
521 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
522 LD_FOR_TARGET=@LD_FOR_TARGET@
524 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
525 NM_FOR_TARGET=@NM_FOR_TARGET@
526 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
527 OBJCOPY_FOR_TARGET=@OBJCOPY_FOR_TARGET@
528 OTOOL_FOR_TARGET=@OTOOL_FOR_TARGET@
529 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
530 READELF_FOR_TARGET=@READELF_FOR_TARGET@
531 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
532 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
533 WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
535 COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
536 COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
537 COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
539 CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
540 CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
542 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
543 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
544 LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
545 GOCFLAGS_FOR_TARGET = -O2 -g
546 GDCFLAGS_FOR_TARGET = -O2 -g
548 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
549 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
550 DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
552 XGCC_FLAGS_FOR_TARGET = $(FLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
554 # ------------------------------------
555 # Miscellaneous targets and flag lists
556 # ------------------------------------
558 # The first rule in the file had better be this one.  Don't put any above it.
559 # This lives here to allow makefile fragments to contain dependencies.
560 all:
562 #### host and target specific makefile fragments come in here.
563 @target_makefile_frag@
564 @alphaieee_frag@
565 @ospace_frag@
566 @host_makefile_frag@
569 # This is the list of directories that may be needed in RPATH_ENVVAR
570 # so that programs built for the target machine work.
571 TARGET_LIB_PATH = [+ FOR target_modules +][+
572   IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
573   ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
574 [+ FOR target_modules +][+ IF lib_path +]
575 @if target-[+module+]
576 TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
577 @endif target-[+module+]
578 [+ ENDIF lib_path +][+ ENDFOR target_modules +]
581 # This is the list of directories that may be needed in RPATH_ENVVAR
582 # so that programs built for the host machine work.
583 HOST_LIB_PATH = [+ FOR host_modules +][+
584   IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
585   ENDFOR host_modules +]
587 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
588 @if gcc
589 HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR):
590 @endif gcc
592 [+ FOR host_modules +][+ IF lib_path +]
593 @if [+module+]
594 HOST_LIB_PATH_[+module+] = \
595   $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
596   +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
597 @endif [+module+]
598 [+ ENDIF lib_path +][+ ENDFOR host_modules +]
600 CXX_FOR_TARGET_FLAG_TO_PASS = \
601         "CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
602 @if target-libstdc++-v3
603 # CXX_FOR_TARGET is tricky to get right for target libs that require a
604 # functional C++ compiler.  When we recurse, if we expand
605 # CXX_FOR_TARGET before configuring libstdc++-v3, we won't get
606 # libstdc++ include flags from the script.  Instead, we get an
607 # -funconfigured-* word, so that we'll get errors if this invalid C++
608 # command line is used for anything, but also so that we can use the
609 # word to decide whether or not to pass on this CXX_FOR_TARGET.  If we
610 # don't pass it on, sub-make will use the default definition, that
611 # re-expands it at the time of use, so we'll get it right when we need
612 # it.  One potential exception is the expansion of CXX_FOR_TARGET
613 # passed down as part of CXX within TARGET_FLAGS, but this wouldn't
614 # really work, for C++ host programs can't depend on the current-stage
615 # C++ target library.
616 CXX_FOR_TARGET_FLAG_TO_PASS = \
617         $(shell if echo "$(CXX_FOR_TARGET)" | grep " -funconfigured-" > /dev/null; then :; else echo '"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"'; fi)
618 @endif target-libstdc++-v3
620 # Flags to pass down to all sub-makes. STAGE*FLAGS,
621 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
622 # overrideable (for a bootstrap build stage1 also builds gcc.info).
623 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
624         "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
625         "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +][+ FOR bootstrap-stage +] \
626         "STAGE[+id+]_CFLAGS=$(STAGE[+id+]_CFLAGS)" \
627         "STAGE[+id+]_CXXFLAGS=$(STAGE[+id+]_CXXFLAGS)" \
628         "STAGE[+id+]_GENERATOR_CFLAGS=$(STAGE[+id+]_GENERATOR_CFLAGS)" \
629         "STAGE[+id+]_TFLAGS=$(STAGE[+id+]_TFLAGS)"[+ ENDFOR bootstrap-stage +] \
630         $(CXX_FOR_TARGET_FLAG_TO_PASS) \
631         "TFLAGS=$(TFLAGS)" \
632         "CONFIG_SHELL=$(SHELL)" \
633         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
634         $(if $(LSAN_OPTIONS),"LSAN_OPTIONS=$(LSAN_OPTIONS)")
636 # We leave this in just in case, but it is not needed anymore.
637 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
639 # Flags to pass down to most sub-makes, in which we're building with
640 # the host environment.
641 EXTRA_HOST_FLAGS = \
642         'AR=$(AR)' \
643         'AS=$(AS)' \
644         'CC=$(CC)' \
645         'CXX=$(CXX)' \
646         'DLLTOOL=$(DLLTOOL)' \
647         'GFORTRAN=$(GFORTRAN)' \
648         'GOC=$(GOC)' \
649         'GDC=$(GDC)' \
650         'LD=$(LD)' \
651         'LIPO=$(LIPO)' \
652         'NM=$(NM)' \
653         'OBJDUMP=$(OBJDUMP)' \
654         'OTOOL=$(OTOOL)' \
655         'RANLIB=$(RANLIB)' \
656         'READELF=$(READELF)' \
657         'STRIP=$(STRIP)' \
658         'WINDRES=$(WINDRES)' \
659         'WINDMC=$(WINDMC)' \
660         'CREATE_GCOV=$(CREATE_GCOV)'
662 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
664 # Flags to pass to stage1 or when not bootstrapping.
666 STAGE1_FLAGS_TO_PASS = \
667         LDFLAGS="$${LDFLAGS}" \
668         HOST_LIBS="$${HOST_LIBS}"
670 # Flags to pass to stage2 and later makes.
672 POSTSTAGE1_FLAGS_TO_PASS = \
673         CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
674         CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
675         GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \
676         GNATBIND="$${GNATBIND}" \
677         LDFLAGS="$${LDFLAGS}" \
678         HOST_LIBS="$${HOST_LIBS}" \
679         $(LTO_FLAGS_TO_PASS) \
680         "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
682 @if gcc-bootstrap
683 EXTRA_HOST_EXPORTS = if [ $(current_stage) != stage1 ]; then \
684                        $(POSTSTAGE1_HOST_EXPORTS) \
685                      fi;
687 EXTRA_BOOTSTRAP_FLAGS = CC="$$CC" CXX="$$CXX" LDFLAGS="$$LDFLAGS"
688 @endif gcc-bootstrap
690 # Flags to pass down to makes which are built with the target environment.
691 # The double $ decreases the length of the command line; those variables
692 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.  The
693 # *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
694 # so we expand them here.
695 EXTRA_TARGET_FLAGS = \
696         'AR=$$(AR_FOR_TARGET)' \
697         'AS=$(COMPILER_AS_FOR_TARGET)' \
698         'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
699         'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
700         'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
701          -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
702          $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
703         'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
704         'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
705         'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
706         'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
707         'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
708         'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
709         'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \
710         'LD=$(COMPILER_LD_FOR_TARGET)' \
711         'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
712         'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
713         'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
714         'NM=$(COMPILER_NM_FOR_TARGET)' \
715         'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
716         'OBJCOPY=$$(OBJCOPY_FOR_TARGET)' \
717         'RANLIB=$$(RANLIB_FOR_TARGET)' \
718         'READELF=$$(READELF_FOR_TARGET)' \
719         'WINDRES=$$(WINDRES_FOR_TARGET)' \
720         'WINDMC=$$(WINDMC_FOR_TARGET)' \
721         'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
722         'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
723         'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
724         "TFLAGS=$$TFLAGS"
726 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
728 # Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
729 # unfortunately needs the native compiler and the target ar and
730 # ranlib.
731 # If any variables are added here, they must be added to do-*, below.
732 # The BUILD_* variables are a special case, which are used for the gcc
733 # cross-building scheme.
734 EXTRA_GCC_FLAGS = \
735         "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
736         "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
737         "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
739 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
741 @if gcc
742 BUILD_CONFIG = @BUILD_CONFIG@
743 ifneq ($(BUILD_CONFIG),)
744 include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk)
745 endif
746 @endif gcc
748 .PHONY: configure-host
749 configure-host: [+
750   FOR host_modules +] \
751     maybe-configure-[+module+][+
752   ENDFOR host_modules +]
753 .PHONY: configure-target
754 configure-target: [+
755   FOR target_modules +] \
756     maybe-configure-target-[+module+][+
757   ENDFOR target_modules +]
759 # The target built for a native non-bootstrap build.
760 .PHONY: all
761 all:
762 @if gcc-bootstrap
763         [ -f stage_final ] || echo stage3 > stage_final
764         @r=`${PWD_COMMAND}`; export r; \
765         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
766         $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
767 @endif gcc-bootstrap
768         @: $(MAKE); $(unstage)
769         @r=`${PWD_COMMAND}`; export r; \
770         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
771 @if gcc-bootstrap
772         if [ -f stage_last ]; then \
773           TFLAGS="$(STAGE$(shell test ! -f stage_last || sed s,^stage,, stage_last)_TFLAGS)"; \
774           $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
775         else \
776 @endif gcc-bootstrap
777           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
778 @if gcc-bootstrap
779             ; \
780         fi \
781 @endif gcc-bootstrap
782         && :
784 .PHONY: all-build
785 [+ FOR build_modules +]
786 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
788 .PHONY: all-host
789 [+ FOR host_modules +][+ IF bootstrap +]
790 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
791 all-host: maybe-all-[+module+][+ IF bootstrap +]
792 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
794 .PHONY: all-target
795 [+ FOR target_modules +][+ IF bootstrap +]
796 @if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
797 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
798 @endif target-[+module+]-no-bootstrap[+
799   ENDIF bootstrap +][+ ENDFOR target_modules +]
801 # Do a target for all the subdirectories.  A ``make do-X'' will do a
802 # ``make X'' in all subdirectories (because, in general, there is a
803 # dependency (below) of X upon do-X, a ``make X'' will also do this,
804 # but it may do additional work as well).
805 [+ FOR recursive_targets +]
806 .PHONY: do-[+make_target+]
807 do-[+make_target+]:
808         @: $(MAKE); $(unstage)
809         @r=`${PWD_COMMAND}`; export r; \
810         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
811         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
812           [+make_target+]-target
815 .PHONY: [+make_target+]-host
816 [+ FOR host_modules +]
817 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
819 .PHONY: [+make_target+]-target
820 [+ FOR target_modules +]
821 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
822 [+ ENDFOR recursive_targets +]
824 # Here are the targets which correspond to the do-X targets.
826 .PHONY: info installcheck dvi pdf html
827 .PHONY: install-info install-pdf install-html
828 .PHONY: clean distclean mostlyclean maintainer-clean realclean
829 .PHONY: local-clean local-distclean local-maintainer-clean
830 info: do-info
831 installcheck: do-installcheck
832 dvi: do-dvi
833 pdf: do-pdf
834 html: do-html
836 # Make sure makeinfo is built before we do a `make info', if we're
837 # in fact building texinfo.
838 do-info: maybe-all-texinfo
840 install-info: do-install-info dir.info
841         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
842         if [ -f dir.info ]; then \
843           $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info; \
844         else true; fi
846 install-pdf: do-install-pdf
848 install-html: do-install-html
850 local-clean:
851         -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
853 local-distclean:
854         -rm -f Makefile config.status config.cache mh-frag mt-frag
855         -rm -f maybedep.tmp serdep.tmp stage_final
856         -if [ "$(TARGET_SUBDIR)" != "." ]; then \
857           rm -rf $(TARGET_SUBDIR); \
858         else true; fi
859         -rm -rf $(BUILD_SUBDIR)
860         -if [ "$(HOST_SUBDIR)" != "." ]; then \
861           rm -rf $(HOST_SUBDIR); \
862         else true; fi
863         -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
864         -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
865         -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
866         -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
867         -rmdir fastjar gcc gnattools gotools libcc1 libiberty 2>/dev/null
868         -rmdir texinfo zlib 2>/dev/null
869         -find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
871 local-maintainer-clean:
872         @echo "This command is intended for maintainers to use;"
873         @echo "it deletes files that may require special tools to rebuild."
875 clean: do-clean local-clean
876 mostlyclean: do-mostlyclean local-clean
877 distclean: do-distclean local-clean local-distclean
878 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
879 maintainer-clean: local-distclean
880 realclean: maintainer-clean
882 # Check target.
884 .PHONY: check do-check
885 check: do-check
887 # Only include modules actually being configured and built.
888 .PHONY: check-host
889 check-host: [+
890   FOR host_modules +] \
891     maybe-check-[+module+][+
892   ENDFOR host_modules +]
894 .PHONY: check-target
895 check-target: [+
896   FOR target_modules +] \
897     maybe-check-target-[+module+][+
898   ENDFOR target_modules +]
900 do-check:
901         @: $(MAKE); $(unstage)
902         @r=`${PWD_COMMAND}`; export r; \
903         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
904         $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
906 # Automated reporting of test results.
908 warning.log: build.log
909         $(srcdir)/contrib/warn_summary build.log > $@
911 mail-report.log:
912         if test x'$(BOOT_CFLAGS)' != x''; then \
913             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
914         fi; \
915         $(srcdir)/contrib/test_summary -t >$@
916         chmod +x $@
917         echo If you really want to send e-mail, run ./$@ now
919 mail-report-with-warnings.log: warning.log
920         if test x'$(BOOT_CFLAGS)' != x''; then \
921             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
922         fi; \
923         $(srcdir)/contrib/test_summary -t -i warning.log >$@
924         chmod +x $@
925         echo If you really want to send e-mail, run ./$@ now
927 # Local Vim config
929 $(srcdir)/.local.vimrc:
930         $(LN_S) contrib/vimrc $@
932 $(srcdir)/.lvimrc:
933         $(LN_S) contrib/vimrc $@
935 vimrc: $(srcdir)/.local.vimrc $(srcdir)/.lvimrc
937 .PHONY: vimrc
939 # clang-format config
941 $(srcdir)/.clang-format:
942         $(LN_S) contrib/clang-format $@
944 clang-format: $(srcdir)/.clang-format
946 .PHONY: clang-format
948 # Installation targets.
950 .PHONY: install uninstall
951 install:
952         @: $(MAKE); $(unstage)
953         @r=`${PWD_COMMAND}`; export r; \
954         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
955         $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
957 .PHONY: install-host-nogcc
958 install-host-nogcc: [+
959   FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
960     maybe-install-[+module+][+ ENDIF +][+
961   ENDFOR host_modules +]
963 .PHONY: install-host
964 install-host: [+
965   FOR host_modules +] \
966     maybe-install-[+module+][+
967   ENDFOR host_modules +]
969 .PHONY: install-target
970 install-target: [+
971   FOR target_modules +] \
972     maybe-install-target-[+module+][+
973   ENDFOR target_modules +]
975 uninstall:
976         @echo "the uninstall target is not supported in this tree"
978 .PHONY: install.all
979 install.all: install-no-fixedincludes
980         @if [ -f ./gcc/Makefile ]; then \
981                 r=`${PWD_COMMAND}`; export r; \
982                 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
983                 $(HOST_EXPORTS) \
984                 (cd ./gcc && \
985                 $(MAKE) $(FLAGS_TO_PASS) install-headers); \
986         else \
987                 true; \
988         fi
990 # install-no-fixedincludes is used to allow the elaboration of binary packages
991 # suitable for distribution, where we cannot include the fixed system header
992 # files.
993 .PHONY: install-no-fixedincludes
994 install-no-fixedincludes: installdirs install-host-nogcc \
995         install-target gcc-install-no-fixedincludes
997 .PHONY: install-strip
998 install-strip:
999         @: $(MAKE); $(unstage)
1000         @r=`${PWD_COMMAND}`; export r; \
1001         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1002         $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-strip-host install-strip-target
1004 .PHONY: install-strip-host
1005 install-strip-host: [+
1006   FOR host_modules +] \
1007     maybe-install-strip-[+module+][+
1008   ENDFOR host_modules +]
1010 .PHONY: install-strip-target
1011 install-strip-target: [+
1012   FOR target_modules +] \
1013     maybe-install-strip-target-[+module+][+
1014   ENDFOR target_modules +]
1017 ### other supporting targets
1019 MAKEDIRS= \
1020         $(DESTDIR)$(prefix) \
1021         $(DESTDIR)$(exec_prefix)
1022 .PHONY: installdirs
1023 installdirs: mkinstalldirs
1024         $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
1026 dir.info: do-install-info
1027         if [ -f $(srcdir)/texinfo/gen-info-dir ]; then \
1028           $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new; \
1029           mv -f dir.info.new dir.info; \
1030         else true; \
1031         fi
1033 dist:
1034         @echo "Building a full distribution of this tree isn't done"
1035         @echo "via 'make dist'.  Check out the etc/ subdirectory" 
1037 etags tags: TAGS
1039 # Right now this just builds TAGS in each subdirectory.  emacs19 has the
1040 # ability to use several tags files at once, so there is probably no need
1041 # to combine them into one big TAGS file (like CVS 1.3 does).  We could
1042 # (if we felt like it) have this Makefile write a piece of elisp which
1043 # the user could load to tell emacs19 where all the TAGS files we just
1044 # built are.
1045 TAGS: do-TAGS
1047 # ------------------------------------
1048 # Macros for configure and all targets
1049 # ------------------------------------
1051 [+ DEFINE configure +]
1052 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
1053 maybe-configure-[+prefix+][+module+]:
1054 @if gcc-bootstrap
1055 configure-[+prefix+][+module+]: stage_current
1056 @endif gcc-bootstrap
1057 @if [+prefix+][+module+]
1058 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
1059 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
1060         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1061         @r=`${PWD_COMMAND}`; export r; \
1062         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1063         [+ IF check_multilibs
1064         +]echo "Checking multilib configuration for [+module+]..."; \
1065         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1066         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \
1067         if test -r [+subdir+]/[+module+]/multilib.out; then \
1068           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
1069             rm -f [+subdir+]/[+module+]/multilib.tmp; \
1070           else \
1071             rm -f [+subdir+]/[+module+]/Makefile; \
1072             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1073           fi; \
1074         else \
1075           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1076         fi; \
1077         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
1078         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1079         [+exports+] [+extra_exports+] \
1080         echo Configuring in [+subdir+]/[+module+]; \
1081         cd "[+subdir+]/[+module+]" || exit 1; \
1082         case $(srcdir) in \
1083           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1084           *) topdir=`echo [+subdir+]/[+module+]/ | \
1085                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1086         esac; \
1087         module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \
1088         [+ IF no-config-site +]rm -f no-such-file || : ; \
1089         CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) \
1090           $$s/$$module_srcdir/configure \
1091           --srcdir=$${topdir}/$$module_srcdir \
1092           [+args+] --build=${build_alias} --host=[+host_alias+] \
1093           --target=[+target_alias+] [+extra_configure_flags+] \
1094           || exit 1
1095 @endif [+prefix+][+module+]
1097 [+ IF bootstrap +]
1098 [+ FOR bootstrap_stage +]
1099 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
1100 maybe-configure-stage[+id+]-[+prefix+][+module+]:
1101 @if [+prefix+][+module+]-bootstrap
1102 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
1103 configure-stage[+id+]-[+prefix+][+module+]:
1104         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
1105         @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
1106         @r=`${PWD_COMMAND}`; export r; \
1107         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1108         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1109         [+ IF check_multilibs
1110         +]echo "Checking multilib configuration for [+module+]..."; \
1111         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \
1112         if test -r [+subdir+]/[+module+]/multilib.out; then \
1113           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
1114             rm -f [+subdir+]/[+module+]/multilib.tmp; \
1115           else \
1116             rm -f [+subdir+]/[+module+]/Makefile; \
1117             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1118           fi; \
1119         else \
1120           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1121         fi; \
1122         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
1123         [+exports+][+ IF prev +] \
1124         [+poststage1_exports+][+ ENDIF prev +][+ IF prefix +] \
1125         CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
1126         CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
1127         LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;[+ ELSE prefix +] \
1128         CFLAGS="$(STAGE[+id+]_CFLAGS)"; export CFLAGS; \
1129         CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"; export CXXFLAGS;[+ IF prev +] \
1130         LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1131         LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +]; export LIBCFLAGS;[+
1132   ENDIF prefix +] [+extra_exports+] \
1133         echo Configuring stage [+id+] in [+subdir+]/[+module+]; \
1134         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1135         cd [+subdir+]/[+module+] || exit 1; \
1136         case $(srcdir) in \
1137           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1138           *) topdir=`echo [+subdir+]/[+module+]/ | \
1139                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1140         esac; \
1141         module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \
1142         $(SHELL) $$s/$$module_srcdir/configure \
1143           --srcdir=$${topdir}/$$module_srcdir \
1144           [+args+] --build=${build_alias} --host=[+host_alias+] \
1145           --target=[+target_alias+] \
1146           [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
1147           $(STAGE[+id+]_CONFIGURE_FLAGS)[+ IF extra_configure_flags +] \
1148           [+extra_configure_flags+][+ ENDIF extra_configure_flags +]
1149 @endif [+prefix+][+module+]-bootstrap
1150 [+ ENDFOR bootstrap_stage +]
1151 [+ ENDIF bootstrap +]
1152 [+ ENDDEF +]
1154 [+ DEFINE all +]
1155 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
1156 maybe-all-[+prefix+][+module+]:
1157 @if gcc-bootstrap
1158 all-[+prefix+][+module+]: stage_current
1159 @endif gcc-bootstrap
1160 @if [+prefix+][+module+]
1161 TARGET-[+prefix+][+module+]=[+
1162   IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
1163 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
1164 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
1165         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1166         @r=`${PWD_COMMAND}`; export r; \
1167         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1168         [+exports+] [+extra_exports+] \
1169         (cd [+subdir+]/[+module+] && \
1170           $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+stage1_args+] [+extra_make_flags+] \
1171                 $(TARGET-[+prefix+][+module+]))
1172 @endif [+prefix+][+module+]
1174 [+ IF bootstrap +]
1175 [+ FOR bootstrap_stage +]
1176 .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
1177 .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
1178 maybe-all-stage[+id+]-[+prefix+][+module+]:
1179 maybe-clean-stage[+id+]-[+prefix+][+module+]:
1180 @if [+prefix+][+module+]-bootstrap
1181 maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
1182 all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
1183 TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
1184 all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
1185         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
1186         @r=`${PWD_COMMAND}`; export r; \
1187         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1188         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1189         [+exports+][+ IF prev +] \
1190         [+poststage1_exports+][+ ENDIF prev +] [+extra_exports+] \
1191         cd [+subdir+]/[+module+] && \
1192         [+autoprofile+] \
1193         $(MAKE) $(BASE_FLAGS_TO_PASS)[+ IF prefix +] \
1194                 CFLAGS="$(CFLAGS_FOR_TARGET)" \
1195                 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
1196                 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"[+ ELSE prefix +] \
1197                 CFLAGS="$(STAGE[+id+]_CFLAGS)" \
1198                 GENERATOR_CFLAGS="$(STAGE[+id+]_GENERATOR_CFLAGS)" \
1199                 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"[+ IF prev +] \
1200                 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1201                 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +][+ ENDIF prefix +] \
1202                 CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
1203                 CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
1204                 LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
1205                 [+args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \
1206                 [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] \
1207                 TFLAGS="$(STAGE[+id+]_TFLAGS)" [+profile_data+] \
1208                 $(TARGET-stage[+id+]-[+prefix+][+module+])
1210 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
1211 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
1212 clean-stage[+id+]-[+prefix+][+module+]:
1213         @if [ $(current_stage) = stage[+id+] ]; then \
1214           [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
1215         else \
1216           [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
1217           $(MAKE) stage[+id+]-start; \
1218         fi; \
1219         cd [+subdir+]/[+module+] && \
1220         $(MAKE) [+args+] [+ IF prev +][+poststage1_args+][+ ELSE prev +] \
1221         [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] clean
1222 @endif [+prefix+][+module+]-bootstrap
1224 [+ ENDFOR bootstrap_stage +]
1225 [+ ENDIF bootstrap +]
1226 [+ ENDDEF +]
1228 # --------------------------------------
1229 # Modules which run on the build machine
1230 # --------------------------------------
1231 [+ FOR build_modules +]
1232 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1233              host_alias=(get "host" "${build_alias}")
1234              target_alias=(get "target" "${target_alias}")
1235              args="$(BUILD_CONFIGARGS)" no-config-site=true +]
1237 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1238              args="$(EXTRA_BUILD_FLAGS)" +]
1239 [+ ENDFOR build_module +]
1241 # --------------------------------------
1242 # Modules which run on the host machine
1243 # --------------------------------------
1244 [+ FOR host_modules +]
1245 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
1246              exports="$(HOST_EXPORTS)"
1247              poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1248              host_alias=(get "host" "${host_alias}")
1249              target_alias=(get "target" "${target_alias}")
1250              args="$(HOST_CONFIGARGS)" +]
1252 [+ all prefix="" subdir="$(HOST_SUBDIR)"
1253        exports="$(HOST_EXPORTS)"
1254        poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1255        args="$(EXTRA_HOST_FLAGS)"
1256        stage1_args="$(STAGE1_FLAGS_TO_PASS)"
1257        poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
1259 .PHONY: check-[+module+] maybe-check-[+module+]
1260 maybe-check-[+module+]:
1261 @if [+module+]
1262 maybe-check-[+module+]: check-[+module+]
1263 [+ IF no_check +]
1264 check-[+module+]:
1265 [+ ELIF no_check_cross +]
1266 # This module is only tested in a native toolchain.
1267 check-[+module+]:
1268         @: $(MAKE); $(unstage)
1269         @if [ '$(host)' = '$(target)' ]; then \
1270           r=`${PWD_COMMAND}`; export r; \
1271           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1272           $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
1273           ENDIF bootstrap +] \
1274           (cd $(HOST_SUBDIR)/[+module+] && \
1275             $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
1276             IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
1277         fi
1278 [+ ELSE check +]
1279 check-[+module+]:
1280         @: $(MAKE); $(unstage)
1281         @r=`${PWD_COMMAND}`; export r; \
1282         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1283         $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
1284         ENDIF bootstrap +] \
1285         (cd $(HOST_SUBDIR)/[+module+] && \
1286           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
1287           IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
1288 [+ ENDIF no_check +]
1289 @endif [+module+]
1291 .PHONY: install-[+module+] maybe-install-[+module+]
1292 maybe-install-[+module+]:
1293 @if [+module+]
1294 maybe-install-[+module+]: install-[+module+]
1295 [+ IF no_install +]
1296 install-[+module+]:
1297 [+ ELSE install +]
1298 install-[+module+]: installdirs
1299         @: $(MAKE); $(unstage)
1300         @r=`${PWD_COMMAND}`; export r; \
1301         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1302         $(HOST_EXPORTS) \
1303         (cd $(HOST_SUBDIR)/[+module+] && \
1304           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
1305 [+ ENDIF no_install +]
1306 @endif [+module+]
1308 .PHONY: install-strip-[+module+] maybe-install-strip-[+module+]
1309 maybe-install-strip-[+module+]:
1310 @if [+module+]
1311 maybe-install-strip-[+module+]: install-strip-[+module+]
1312 [+ IF no_install +]
1313 install-strip-[+module+]:
1314 [+ ELSE install +]
1315 install-strip-[+module+]: installdirs
1316         @: $(MAKE); $(unstage)
1317         @r=`${PWD_COMMAND}`; export r; \
1318         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1319         $(HOST_EXPORTS) \
1320         (cd $(HOST_SUBDIR)/[+module+] && \
1321           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
1322 [+ ENDIF no_install +]
1323 @endif [+module+]
1325 # Other targets (info, dvi, pdf, etc.)
1326 [+ FOR recursive_targets +]
1327 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1328 maybe-[+make_target+]-[+module+]:
1329 @if [+module+]
1330 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
1331 [+ IF (match-value? = "missing" (get "make_target") ) +]
1332 # [+module+] doesn't support [+make_target+].
1333 [+make_target+]-[+module+]:
1334 [+ ELSE +]
1335 [+make_target+]-[+module+]: [+
1336   FOR depend +]\
1337     [+depend+]-[+module+] [+
1338   ENDFOR depend +]
1339         @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1340         @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
1341         r=`${PWD_COMMAND}`; export r; \
1342         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1343         $(HOST_EXPORTS) \
1344         for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1345           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1346         done; \
1347         echo "Doing [+make_target+] in [+module+]"; \
1348         (cd $(HOST_SUBDIR)/[+module+] && \
1349           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1350                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1351                   "RANLIB=$${RANLIB}" \
1352                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1353                   [+make_target+]) \
1354           || exit 1
1355 [+ ENDIF +]
1356 @endif [+module+]
1357 [+ ENDFOR recursive_targets +]
1358 [+ ENDFOR host_modules +]
1360 # ---------------------------------------
1361 # Modules which run on the target machine
1362 # ---------------------------------------
1363 [+ FOR target_modules +]
1365 [+ IF raw_cxx +]
1366 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1367              check_multilibs=true
1368              exports="$(RAW_CXX_TARGET_EXPORTS)"
1369              host_alias=(get "host" "${target_alias}")
1370              target_alias=(get "target" "${target_alias}")
1371              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1373 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1374        exports="$(RAW_CXX_TARGET_EXPORTS)"
1375        args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1376 [+ ELSE +]
1377 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1378              check_multilibs=true
1379              exports="$(NORMAL_TARGET_EXPORTS)"
1380              host_alias=(get "host" "${target_alias}")
1381              target_alias=(get "target" "${target_alias}")
1382              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1384 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1385        exports="$(NORMAL_TARGET_EXPORTS)"
1386        args="$(EXTRA_TARGET_FLAGS)" +]
1387 [+ ENDIF +]
1389 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1390 maybe-check-target-[+module+]:
1391 @if target-[+module+]
1392 maybe-check-target-[+module+]: check-target-[+module+]
1393 [+ IF no_check +]
1394 # Dummy target for uncheckable module.
1395 check-target-[+module+]:
1396 [+ ELSE check +]
1397 check-target-[+module+]:
1398         @: $(MAKE); $(unstage)
1399         @r=`${PWD_COMMAND}`; export r; \
1400         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1401 IF raw_cxx +]
1402         $(RAW_CXX_TARGET_EXPORTS) \[+
1403 ELSE normal_cxx +]
1404         $(NORMAL_TARGET_EXPORTS) \[+
1405 ENDIF raw_cxx +]
1406         (cd $(TARGET_SUBDIR)/[+module+] && \
1407           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1408             IF raw_cxx 
1409               +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1410             ENDIF raw_cxx 
1411           +] [+extra_make_flags+] check)
1412 [+ ENDIF no_check +]
1413 @endif target-[+module+]
1415 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1416 maybe-install-target-[+module+]:
1417 @if target-[+module+]
1418 maybe-install-target-[+module+]: install-target-[+module+]
1419 [+ IF no_install +]
1420 # Dummy target for uninstallable.
1421 install-target-[+module+]:
1422 [+ ELSE install +]
1423 install-target-[+module+]: installdirs
1424         @: $(MAKE); $(unstage)
1425         @r=`${PWD_COMMAND}`; export r; \
1426         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1427 IF raw_cxx +]
1428         $(RAW_CXX_TARGET_EXPORTS) \[+
1429 ELSE normal_cxx +]
1430         $(NORMAL_TARGET_EXPORTS) \[+
1431 ENDIF raw_cxx +]
1432         (cd $(TARGET_SUBDIR)/[+module+] && \
1433           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1434 [+ ENDIF no_install +]
1435 @endif target-[+module+]
1437 .PHONY: install-strip-target-[+module+] maybe-install-strip-target-[+module+]
1438 maybe-install-strip-target-[+module+]:
1439 @if target-[+module+]
1440 maybe-install-strip-target-[+module+]: install-strip-target-[+module+]
1441 [+ IF no_install +]
1442 # Dummy target for uninstallable.
1443 install-strip-target-[+module+]:
1444 [+ ELSE install +]
1445 install-strip-target-[+module+]: installdirs
1446         @: $(MAKE); $(unstage)
1447         @r=`${PWD_COMMAND}`; export r; \
1448         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1449 IF raw_cxx +]
1450         $(RAW_CXX_TARGET_EXPORTS) \[+
1451 ELSE normal_cxx +]
1452         $(NORMAL_TARGET_EXPORTS) \[+
1453 ENDIF raw_cxx +]
1454         (cd $(TARGET_SUBDIR)/[+module+] && \
1455           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
1456 [+ ENDIF no_install +]
1457 @endif target-[+module+]
1459 # Other targets (info, dvi, pdf, etc.)
1460 [+ FOR recursive_targets +]
1461 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1462 maybe-[+make_target+]-target-[+module+]:
1463 @if target-[+module+]
1464 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1465 [+ IF (match-value? = "missing" (get "make_target") ) +]
1466 # [+module+] doesn't support [+make_target+].
1467 [+make_target+]-target-[+module+]:
1468 [+ ELSE +]
1469 [+make_target+]-target-[+module+]: [+
1470   FOR depend +]\
1471     [+depend+]-target-[+module+] [+
1472   ENDFOR depend +]
1473         @: $(MAKE); $(unstage)
1474         @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0; \
1475         r=`${PWD_COMMAND}`; export r; \
1476         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1477 IF raw_cxx +]
1478         $(RAW_CXX_TARGET_EXPORTS) \[+
1479 ELSE normal_cxx +]
1480         $(NORMAL_TARGET_EXPORTS) \[+
1481 ENDIF raw_cxx +]
1482         echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]"; \
1483         for flag in $(EXTRA_TARGET_FLAGS); do \
1484           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1485         done; \
1486         (cd $(TARGET_SUBDIR)/[+module+] && \
1487           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1488                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1489                   "RANLIB=$${RANLIB}" \
1490                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1491                   [+extra_make_flags+] [+make_target+]) \
1492           || exit 1
1493 [+ ENDIF +]
1494 @endif target-[+module+]
1495 [+ ENDFOR recursive_targets +]
1496 [+ ENDFOR target_modules +]
1498 @if target-libgomp
1499 .PHONY: check-target-libgomp-c++
1500 check-target-libgomp-c++:
1501         $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libgomp
1503 .PHONY: check-target-libgomp-fortran
1504 check-target-libgomp-fortran:
1505         $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) fortran.exp" check-target-libgomp
1507 @endif target-libgomp
1509 @if target-libitm
1510 .PHONY: check-target-libitm-c++
1511 check-target-libitm-c++:
1512         $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libitm
1514 @endif target-libitm
1516 # ----------
1517 # GCC module
1518 # ----------
1520 @if gcc-no-bootstrap
1521 .PHONY: cross
1522 cross: all-build all-gas all-ld
1523         @r=`${PWD_COMMAND}`; export r; \
1524         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1525         $(HOST_EXPORTS) \
1526         echo "Building the C and C++ compiler"; \
1527         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1528         @r=`${PWD_COMMAND}`; export r; \
1529         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1530         echo "Building runtime libraries"; \
1531         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1532 @endif gcc-no-bootstrap
1534 @if gcc
1535 [+ FOR languages +]
1536 .PHONY: check-gcc-[+language+] check-[+language+]
1537 check-gcc-[+language+]:
1538         r=`${PWD_COMMAND}`; export r; \
1539         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1540         $(HOST_EXPORTS) \
1541         (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]);
1542 check-[+language+]: check-gcc-[+language+][+ FOR lib-check-target +] [+ lib-check-target +][+ ENDFOR lib-check-target +]
1543 [+ ENDFOR languages +]
1545 # The gcc part of install-no-fixedincludes, which relies on an intimate
1546 # knowledge of how a number of gcc internal targets (inter)operate.  Delegate.
1547 .PHONY: gcc-install-no-fixedincludes
1548 gcc-install-no-fixedincludes:
1549         @if [ -f ./gcc/Makefile ]; then \
1550           r=`${PWD_COMMAND}`; export r; \
1551           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1552           $(HOST_EXPORTS) \
1553           (cd ./gcc \
1554            && $(MAKE) $(GCC_FLAGS_TO_PASS) install-no-fixedincludes); \
1555         else true; fi
1556 @endif gcc
1558 # ---------------------
1559 # GCC bootstrap support
1560 # ---------------------
1562 # We track the current stage (the one in 'gcc') in the stage_current file.
1563 # stage_last instead tracks the stage that was built last.  These targets
1564 # are dummy when toplevel bootstrap is not active.
1566 # While making host and target tools, symlinks to the final stage must be
1567 # there, so $(unstage) should be run at various points.  To avoid excessive
1568 # recursive invocations of make, we "inline" them using a variable.  These
1569 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1570 # to avoid warnings from the GNU Make job server.
1572 unstage = :
1573 stage = :
1574 current_stage = ""
1576 @if gcc-bootstrap
1577 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1578 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1579 current_stage = "`cat stage_current 2> /dev/null`"
1580 @endif gcc-bootstrap
1582 .PHONY: unstage stage
1583 unstage:
1584         @: $(MAKE); $(unstage)
1585 stage:
1586         @: $(MAKE); $(stage)
1588 # Disable commands for lean bootstrap.
1589 LEAN = false
1591 # We name the build directories for the various stages "stage1-gcc",
1592 # "stage2-gcc","stage3-gcc", etc.
1594 # Since the 'compare' process will fail (on debugging information) if any
1595 # directory names are different, we need to link the gcc directory for
1596 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1597 # the build directories constant as well. For the latter, we use naked names
1598 # like 'gcc', because the scripts in that directory assume it.  We use
1599 # mv on platforms where symlinks to directories do not work or are not
1600 # reliable.
1602 # 'touch' doesn't work right on some platforms.
1603 STAMP = echo timestamp > 
1605 # We only want to compare .o files, so set this!
1606 objext = .o
1608 [+ FOR bootstrap-stage +]
1609 .PHONY: stage[+id+]-start stage[+id+]-end
1611 stage[+id+]-start::
1612         @: $(MAKE); $(stage); \
1613         echo stage[+id+] > stage_current; \
1614         echo stage[+id+] > stage_last; \
1615         $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1616    FOR host_modules +][+ IF bootstrap +]
1617 @if [+ module +]
1618         @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1619           mkdir stage[+id+]-[+module+]; \
1620         mv stage[+id+]-[+module+] [+module+][+ IF prev +]; \
1621         mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1622 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1623         @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1624           mkdir stage[+id+]-$(TARGET_SUBDIR); \
1625         mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR)[+ IF prev +]; \
1626         mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1628 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1629 @if [+ module +]
1630         @if test -d $(HOST_SUBDIR)/[+module+]; then \
1631           cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+][+ IF prev +]; \
1632           mv prev-[+module+] stage[+prev+]-[+module+]; : [+ ENDIF prev +]; \
1633         fi
1634 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1635         @if test -d $(TARGET_SUBDIR); then \
1636           mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR)[+ IF prev +]; \
1637           mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR); : [+ ENDIF prev +]; \
1638         fi
1639         rm -f stage_current
1641 # Bubble a bug fix through all the stages up to stage [+id+].  They are
1642 # remade, but not reconfigured.  The next stage (if any) will not be
1643 # reconfigured either.
1644 .PHONY: stage[+id+]-bubble
1645 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1646         @r=`${PWD_COMMAND}`; export r; \
1647         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1648         if test -f stage[+id+]-lean [+
1649           IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +]; then \
1650           echo Skipping rebuild of stage[+id+]; \
1651         else \
1652           $(MAKE) stage[+id+]-start; \[+IF lean +]
1653           if $(LEAN); then \
1654             rm -rf stage[+lean+]-*; \
1655             $(STAMP) stage[+lean+]-lean; \
1656           fi; \[+ ENDIF lean +]
1657           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1658         fi[+ IF compare-target +]
1659         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1661 .PHONY: all-stage[+id+] clean-stage[+id+]
1662 do-clean: clean-stage[+id+]
1664 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1665 # only possibility, but now it conflicts with no-bootstrap rules
1666 @if gcc-bootstrap
1667 [+ IF compare-target +]
1668 [+compare-target+]:
1669         @r=`${PWD_COMMAND}`; export r; \
1670         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1671         if test -f stage[+prev+]-lean; then \
1672           echo Cannot compare object files as stage [+prev+] was deleted.; \
1673           exit 0; \
1674         fi; \
1675         : $(MAKE); $(stage); \
1676         rm -f .bad_compare; \
1677         echo Comparing stages [+prev+] and [+id+]; \
1678         sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \
1679         files=`find stage[+id+]-* -name "*$(objext)" -print | \
1680                  sed -n s,^stage$$sed-,,p`; \
1681         for file in $${files} ${extra-compare}; do \
1682           f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \
1683           if test ! -f $$f1; then continue; fi; \
1684           $(do-[+compare-target+]) > /dev/null 2>&1; \
1685           if test $$? -eq 1; then \
1686             case $$file in \
1687               @compare_exclusions@) \
1688                 echo warning: $$file differs ;; \
1689               *) \
1690                 echo $$file differs >> .bad_compare ;; \
1691             esac; \
1692           fi; \
1693         done; \
1694         if [ -f .bad_compare ]; then \
1695           echo "Bootstrap comparison failure!"; \
1696           cat .bad_compare; \
1697           exit 1; \
1698         else \
1699           echo Comparison successful.; \
1700         fi; \
1701         $(STAMP) [+compare-target+][+ IF prev +]
1702         if $(LEAN); then \
1703           rm -rf stage[+prev+]-*; \
1704           $(STAMP) stage[+prev+]-lean; \
1705         fi[+ ENDIF prev +]
1706 [+ ENDIF compare-target +]
1708 [+ IF bootstrap-target +]
1709 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1710 [+bootstrap-target+]:
1711         echo stage[+id+] > stage_final
1712         @r=`${PWD_COMMAND}`; export r; \
1713         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1714         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1715         @: $(MAKE); $(unstage)
1716         @r=`${PWD_COMMAND}`; export r; \
1717         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1718         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1719         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1721 [+bootstrap-target+]-lean:
1722         echo stage[+id+] > stage_final
1723         @r=`${PWD_COMMAND}`; export r; \
1724         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1725         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1726         @: $(MAKE); $(unstage)
1727         @r=`${PWD_COMMAND}`; export r; \
1728         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1729         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1730         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1731 [+ ENDIF bootstrap-target +]
1733 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1734 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1735 .PHONY: distclean-stage[+id+]
1736 distclean-stage[+id+]::
1737         @: $(MAKE); $(stage)
1738         @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1739         rm -rf stage[+id+]-* [+
1740           IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1742 [+ IF cleanstrap-target +]
1743 .PHONY: [+cleanstrap-target+]
1744 [+cleanstrap-target+]: do-distclean local-clean
1745         echo stage[+id+] > stage_final
1746         @r=`${PWD_COMMAND}`; export r; \
1747         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1748         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1749         @: $(MAKE); $(unstage)
1750         @r=`${PWD_COMMAND}`; export r; \
1751         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1752         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1753         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1754 [+ ENDIF cleanstrap-target +]
1755 @endif gcc-bootstrap
1757 [+ ENDFOR bootstrap-stage +]
1759 stageprofile-end::
1760         $(MAKE) distclean-stagefeedback
1762 stagefeedback-start::
1763         @r=`${PWD_COMMAND}`; export r; \
1764         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1765         for i in prev-*; do \
1766           j=`echo $$i | sed s/^prev-//`; \
1767           cd $$r/$$i && \
1768           { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL); } && \
1769           { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL); }; \
1770         done
1772 @if gcc-bootstrap
1773 do-distclean: distclean-stage1
1775 # Provide a GCC build when we're building target libraries.  This does
1776 # not work as a dependency, just as the minimum necessary to avoid errors.
1777 stage_last:
1778         @r=`${PWD_COMMAND}`; export r; \
1779         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1780         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1782 # Same as unstage, but not phony and defaulting to stage1-start.  We place
1783 # it in the dependency so that for example `make -j3 all-gcc' works.
1784 stage_current:
1785         @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1787 .PHONY: restrap
1788 restrap::
1789         @: $(MAKE); $(stage)
1790         rm -rf stage1-$(TARGET_SUBDIR)[+ FOR bootstrap-stage +][+ IF prev
1791           +] stage[+id+]-*[+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1792 restrap:: all
1793 @endif gcc-bootstrap
1795 # --------------------------------------
1796 # Dependencies between different modules
1797 # --------------------------------------
1799 # Generic dependencies for target modules on host stuff, especially gcc
1800 @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1801   +][+ FOR bootstrap_stage +]
1802 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1803   ENDFOR +][+ ELSE bootstrap +]
1804 configure-target-[+module+]: stage_last[+
1805   ENDIF bootstrap +][+ ENDFOR target_modules +]
1806 @endif gcc-bootstrap
1808 @if gcc-no-bootstrap[+ FOR target_modules +]
1809 configure-target-[+module+]: maybe-all-gcc[+
1810   ENDFOR target_modules +]
1811 @endif gcc-no-bootstrap
1814 # There are two types of dependencies here: 'hard' dependencies, where one
1815 # module simply won't build without the other; and 'soft' dependencies, where
1816 # if the depended-on module is missing, the depending module will do without
1817 # or find a substitute somewhere (perhaps installed).  Soft dependencies
1818 # are made here to depend on a 'maybe-' target.  If you're not sure,
1819 # it's safer to use a soft dependency.
1821 [+ ;; These Scheme functions build the bulk of the dependencies.
1822    ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1823    ;; where "maybe-" is only included if HARD is not true, and all-gcc
1824    ;; is taken from VAR-NAME.
1825    (define dep-target (lambda (module-kind var-name hard)
1826       (string-append
1827          (if hard "" "maybe-")
1828          (dep-subtarget var-name)
1829          module-kind
1830          (dep-module var-name)
1831       )))
1833    ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1834    (define make-dep (lambda (module-kind on-kind)
1835       (string-append
1836          (dep-target module-kind "module" #t) ": "
1837          (dep-target on-kind "on" (exist? "hard")))))
1839    ;; dep-subtarget extracts everything up to the first dash in the given
1840    ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1841    (define dep-subtarget (lambda (var-name)
1842       (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1844    ;; dep-module extracts everything up to the first dash in the given
1845    ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1846    (define dep-module (lambda (var-name)
1847       (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1849    ;; dep-stage builds a string for the prefix of a bootstrap stage.
1850    (define dep-stage (lambda ()
1851       (string-append
1852          "stage"
1853          (get "id")
1854          "-")))
1856    ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1857    ;; but is written in Scheme.
1858    (define dep-maybe (lambda ()
1859       (if (exist? "hard") "" "maybe-")))
1861    ;; dep-kind returns returns "prebootstrap" for configure or build
1862    ;; dependencies of bootstrapped modules on a build module
1863    ;; (e.g. all-gcc on all-build-bison); "normal" if the dependency is
1864    ;; on an "install" target, or if the dependence module is not
1865    ;; bootstrapped; otherwise, it returns "bootstrap" or
1866    ;; "postbootstrap" depending on whether the dependent module is
1867    ;; bootstrapped.  All this is only necessary for host and target
1868    ;; modules.  It might seem like, in order to avoid build races, we
1869    ;; might need more elaborate detection between prebootstrap and
1870    ;; postbootstrap modules, but there are no host prebootstrap
1871    ;; modules.  If there were any non-bootstrap host modules that
1872    ;; bootstrap modules depended on, we'd get unsatisfied per-stage
1873    ;; dependencies on them, which would be immediately noticed.
1874    (define dep-kind (lambda ()
1875       (cond
1876        ((and (hash-ref boot-modules (dep-module "module"))
1877              (=* (dep-module "on") "build-"))
1878         "prebootstrap")
1880        ((or (= (dep-subtarget "on") "install-")
1881             (not (hash-ref boot-modules (dep-module "on"))))
1882         "normal")
1884        ((hash-ref boot-modules (dep-module "module"))
1885         "bootstrap")
1887        (1 "postbootstrap"))))
1889    (define make-postboot-dep (lambda ()
1890      (let ((target (dep-module "module")) (dep "stage_last"))
1891        (unless (= (hash-ref postboot-targets target) dep)
1892          (hash-create-handle! postboot-targets target dep)
1893          ;; All non-bootstrap modules' configure target already
1894          ;; depend on dep.
1895          (unless (=* target "target-")
1896            (string-append "configure-" target ": " dep "\n"))))))
1898    ;; We now build the hash table that is used by dep-kind.
1899    (define boot-modules (make-hash-table 113))
1900    (define postboot-targets (make-hash-table 113))
1903 [+ FOR host_modules +][+
1904    (if (exist? "bootstrap")
1905        (hash-create-handle! boot-modules (get "module") #t))
1906    "" +][+ ENDFOR host_modules +]
1907 [+ FOR target_modules +][+
1908    (if (exist? "bootstrap")
1909        (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1910    "" +][+ ENDFOR target_modules +]
1912 # With all the machinery above in place, it is pretty easy to generate
1913 # dependencies.  Host dependencies are a bit more complex because we have
1914 # to check for bootstrap/prebootstrap dependencies.  To resolve
1915 # prebootstrap dependencies, prebootstrap modules are gathered in
1916 # a hash table.
1917 [+ FOR dependencies +][+ CASE (dep-kind) +]
1918 [+ == "prebootstrap" +][+ (make-dep "" "") +][+ FOR bootstrap_stage +]
1919 [+ (make-dep (dep-stage) "") +][+ ENDFOR bootstrap_stage +]
1920 [+ == "bootstrap" +][+ (make-dep "" "") +][+ FOR bootstrap_stage +]
1921 [+ (make-dep (dep-stage) (dep-stage)) +][+ ENDFOR bootstrap_stage +]
1922 [+ == "normal" +][+ (make-dep "" "") +]
1923 [+ ESAC +][+ ENDFOR dependencies +]
1925 @if gcc-bootstrap
1926 [+ FOR dependencies +][+ CASE (dep-kind) +]
1927 [+ == "postbootstrap" +][+ (make-postboot-dep) +][+ ESAC +][+
1928 ENDFOR dependencies +]@endif gcc-bootstrap
1930 @unless gcc-bootstrap
1931 [+ FOR dependencies +][+ CASE (dep-kind) +]
1932 [+ == "postbootstrap" +][+ (make-dep "" "") +]
1933 [+ ESAC +][+ ENDFOR dependencies +]@endunless gcc-bootstrap
1935 # Dependencies for target modules on other target modules are
1936 # described by lang_env_dependencies; the defaults apply to anything
1937 # not mentioned there.
1939    ;; Predicate for whether LANG was specified in lang_env_dependencies.
1940    (define lang-dep (lambda (lang)
1941       (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1943    ;; Build the hash table we will need.
1944    (define lang-env-deps (make-hash-table 7))
1945 +][+ FOR lang_env_dependencies +][+
1946    (if (exist? "cxx")
1947        (hash-create-handle! lang-env-deps
1948           (string-append (get "module") "-" "cxx") #t))
1950    (if (exist? "no_c")
1951        (hash-create-handle! lang-env-deps
1952           (string-append (get "module") "-" "no_c") #t))
1954    (if (exist? "no_gcc")
1955        (hash-create-handle! lang-env-deps
1956           (string-append (get "module") "-" "no_gcc") #t))
1957    "" +][+ ENDFOR lang_env_dependencies +]
1959 @if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1960   +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1961 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1962   ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1963 @endif gcc-bootstrap
1965 @if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1966 configure-target-[+module+]: maybe-all-target-libgcc[+
1967   ENDIF +][+ ENDFOR target_modules +]
1968 @endif gcc-no-bootstrap
1970 [+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1971 configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1972   ENDIF +][+ IF (lang-dep "cxx") +]
1973 configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1974   ENDIF +]
1975 [+ ENDFOR target_modules +]
1977 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
1978 GDB_TK = @GDB_TK@
1979 INSTALL_GDB_TK = @INSTALL_GDB_TK@
1980 configure-gdb: $(CONFIGURE_GDB_TK)
1981 all-gdb: $(gdbnlmrequirements) $(GDB_TK)
1982 install-gdb: $(INSTALL_GDB_TK)
1984 # Serialization dependencies.  Host configures don't work well in parallel to
1985 # each other, due to contention over config.cache.  Target configures and 
1986 # build configures are similar.
1987 @serialization_dependencies@
1989 # --------------------------------
1990 # Regenerating top level configury
1991 # --------------------------------
1993 # Rebuilding Makefile.in, using autogen.
1994 AUTOGEN = autogen
1995 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1996         cd $(srcdir) && $(AUTOGEN) Makefile.def
1998 # Rebuilding Makefile.
1999 Makefile: $(srcdir)/Makefile.in config.status
2000         CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
2002 config.status: configure
2003         CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
2005 # Rebuilding configure.
2006 AUTOCONF = autoconf
2007 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
2008         $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
2009         $(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
2010         $(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
2011         $(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
2012         cd $(srcdir) && $(AUTOCONF)
2014 # ------------------------------
2015 # Special directives to GNU Make
2016 # ------------------------------
2018 # Don't pass command-line variables to submakes.
2019 .NOEXPORT:
2020 MAKEOVERRIDES=
2022 # end of Makefile.in