1 [+ AutoGen5 template -*- Mode: Makefile -*-
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.
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.
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.
30 ifeq (,$(.VARIABLES)) # The variable .VARIABLES, new with 3.80, is never empty.
31 $(error GNU make version 3.80 or newer is required.)
35 # -------------------------------
36 # Standard Autoconf-set variables
37 # -------------------------------
40 build_alias=@build_noncanonical@
41 build_vendor=@build_vendor@
44 host_alias=@host_noncanonical@
45 host_vendor=@host_vendor@
48 target_alias=@target_noncanonical@
49 target_vendor=@target_vendor@
52 accel_target_alias=@accel_target_noncanonical@
53 accel_target_vendor=@accel_target_vendor@
54 accel_target_os=@accel_target_os@
55 accel_target=@accel_target@
57 program_transform_name = @program_transform_name@
60 exec_prefix = @exec_prefix@
66 libexecdir = @libexecdir@
68 sysconfdir = @sysconfdir@
69 sharedstatedir = @sharedstatedir@
70 localstatedir = @localstatedir@
72 includedir = @includedir@
73 oldincludedir = @oldincludedir@
75 datarootdir = @datarootdir@
80 man1dir = $(mandir)/man1
81 man2dir = $(mandir)/man2
82 man3dir = $(mandir)/man3
83 man4dir = $(mandir)/man4
84 man5dir = $(mandir)/man5
85 man6dir = $(mandir)/man6
86 man7dir = $(mandir)/man7
87 man8dir = $(mandir)/man8
88 man9dir = $(mandir)/man9
91 INSTALL_PROGRAM = @INSTALL_PROGRAM@
92 INSTALL_SCRIPT = @INSTALL_SCRIPT@
93 INSTALL_DATA = @INSTALL_DATA@
97 MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
98 MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
100 # -------------------------------------------------
101 # Miscellaneous non-standard autoconf-set variables
102 # -------------------------------------------------
104 # The gcc driver likes to know the arguments it was configured with.
105 TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
108 build_tooldir = @build_tooldir@
110 # This is the name of the environment variable used for the path to
112 RPATH_ENVVAR = @RPATH_ENVVAR@
114 # On targets where RPATH_ENVVAR is PATH, a subdirectory of the GCC build path
115 # is used instead of the directory itself to avoid including built
116 # executables in PATH.
117 GCC_SHLIB_SUBDIR = @GCC_SHLIB_SUBDIR@
119 # Build programs are put under this directory.
120 BUILD_SUBDIR = @build_subdir@
121 # This is set by the configure script to the arguments to use when configuring
122 # directories built for the build system.
123 BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
125 # Linker flags to use on the host, for stage1 or when not
127 STAGE1_LDFLAGS = @stage1_ldflags@
129 # Libraries to use on the host, for stage1 or when not bootstrapping.
130 STAGE1_LIBS = @stage1_libs@
132 # Linker flags to use for stage2 and later.
133 POSTSTAGE1_LDFLAGS = @poststage1_ldflags@
135 # Libraries to use for stage2 and later.
136 POSTSTAGE1_LIBS = @poststage1_libs@
138 # This is the list of variables to export in the environment when
139 # configuring any subdirectory. It must also be exported whenever
140 # recursing into a build directory in case that directory's Makefile
143 FLEX="$(FLEX)"; export FLEX; \
144 LEX="$(LEX)"; export LEX; \
145 BISON="$(BISON)"; export BISON; \
146 YACC="$(YACC)"; export YACC; \
147 M4="$(M4)"; export M4; \
148 SED="$(SED)"; export SED; \
149 AWK="$(AWK)"; export AWK; \
150 MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
152 # This is the list of variables to export in the environment when
153 # configuring subdirectories for the build system.
156 AR="$(AR_FOR_BUILD)"; export AR; \
157 AS="$(AS_FOR_BUILD)"; export AS; \
158 CC="$(CC_FOR_BUILD)"; export CC; \
159 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
160 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
161 CXX="$(CXX_FOR_BUILD)"; export CXX; \
162 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
163 GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
164 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
165 GOC="$(GOC_FOR_BUILD)"; export GOC; \
166 GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
167 DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
168 LD="$(LD_FOR_BUILD)"; export LD; \
169 LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
170 NM="$(NM_FOR_BUILD)"; export NM; \
171 RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
172 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
173 WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
175 # These variables must be set on the make command line for directories
176 # built for the build system to override those in BASE_FLAGS_TO_PASS.
177 EXTRA_BUILD_FLAGS = \
178 CFLAGS="$(CFLAGS_FOR_BUILD)" \
179 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
181 # This is the list of directories to built for the host system.
182 SUBDIRS = @configdirs@
183 TARGET_CONFIGDIRS = @target_configdirs@
184 # This is set by the configure script to the arguments to use when configuring
185 # directories built for the host system.
186 HOST_CONFIGARGS = @host_configargs@
187 # Host programs are put under this directory, which is . except if building
189 HOST_SUBDIR = @host_subdir@
190 # This is the list of variables to export in the environment when
191 # configuring subdirectories for the host system. We need to pass
192 # some to the GCC configure because of its hybrid host/target nature.
195 CC="$(CC)"; export CC; \
196 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
197 CFLAGS="$(CFLAGS)"; export CFLAGS; \
198 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
199 CXX="$(CXX)"; export CXX; \
200 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
201 GCJ="$(GCJ)"; export GCJ; \
202 GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
203 GOC="$(GOC)"; export GOC; \
204 AR="$(AR)"; export AR; \
205 AS="$(AS)"; export AS; \
206 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
207 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
208 LD="$(LD)"; export LD; \
209 LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
210 NM="$(NM)"; export NM; \
211 RANLIB="$(RANLIB)"; export RANLIB; \
212 WINDRES="$(WINDRES)"; export WINDRES; \
213 WINDMC="$(WINDMC)"; export WINDMC; \
214 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
215 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
216 READELF="$(READELF)"; export READELF; \
217 AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
218 AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
219 GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
220 LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
221 NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
222 OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
223 RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
224 READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
225 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
226 HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
227 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
228 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
229 ISLINC="$(HOST_ISLINC)"; export ISLINC; \
230 CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \
231 CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \
232 LIBELFLIBS="$(HOST_LIBELFLIBS)" ; export LIBELFLIBS; \
233 LIBELFINC="$(HOST_LIBELFINC)" ; export LIBELFINC; \
235 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
237 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
239 POSTSTAGE1_CXX_EXPORT = \
240 CXX='$(CXX)'; export CXX; \
241 CXX_FOR_BUILD='$(CXX_FOR_BUILD)'; export CXX_FOR_BUILD;
242 @if target-libstdc++-v3-bootstrap
243 # Override the above if we're bootstrapping C++.
244 POSTSTAGE1_CXX_EXPORT = \
245 CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xg++$(exeext) \
246 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \
247 -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
248 -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
249 -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \
250 -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \
251 -I$$s/libstdc++-v3/libsupc++ \
252 -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
253 -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \
255 CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD;
256 @endif target-libstdc++-v3-bootstrap
258 # Similar, for later GCC stages.
259 POSTSTAGE1_HOST_EXPORTS = \
261 CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
262 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ \
263 $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
264 CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \
265 $(POSTSTAGE1_CXX_EXPORT) \
266 GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \
267 LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \
268 HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS;
270 # Target libraries are put under this directory:
271 TARGET_SUBDIR = @target_subdir@
272 # This is set by the configure script to the arguments to use when configuring
273 # directories built for the target.
274 TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
275 # This is the list of variables to export in the environment when
276 # configuring subdirectories for the target system.
277 BASE_TARGET_EXPORTS = \
279 AR="$(AR_FOR_TARGET)"; export AR; \
280 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
281 CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
282 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
283 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
284 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
285 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
286 GCJ="$(GCJ_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GCJ; \
287 GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
288 GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
289 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
290 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
291 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
292 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
293 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
294 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
295 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
296 READELF="$(READELF_FOR_TARGET)"; export READELF; \
297 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
298 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
299 WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
301 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
303 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
304 TARGET_CONFIGDIRS="$(TARGET_CONFIGDIRS)"; export TARGET_CONFIGDIRS;
306 RAW_CXX_TARGET_EXPORTS = \
307 $(BASE_TARGET_EXPORTS) \
308 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
309 CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
311 NORMAL_TARGET_EXPORTS = \
312 $(BASE_TARGET_EXPORTS) \
313 CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
316 HOST_GMPLIBS = @gmplibs@
317 HOST_GMPINC = @gmpinc@
320 HOST_ISLINC = @islinc@
322 # Where to find CLOOG
323 HOST_CLOOGLIBS = @clooglibs@
324 HOST_CLOOGINC = @clooginc@
326 # Where to find libelf
327 HOST_LIBELFLIBS = @libelflibs@
328 HOST_LIBELFINC = @libelfinc@
330 EXTRA_CONFIGARGS_LIBJAVA = @EXTRA_CONFIGARGS_LIBJAVA@
332 # ----------------------------------------------
333 # Programs producing files for the BUILD machine
334 # ----------------------------------------------
338 # pwd command to use. Allow user to override default by setting PWDCMD in
339 # the environment to account for automounters. The make variable must not
340 # be called PWDCMD, otherwise the value set here is passed to make
341 # subprocesses and overrides the setting from the user's environment.
342 # Don't use PWD since it is a common shell environment variable and we
343 # don't want to corrupt it.
344 PWD_COMMAND = $${PWDCMD-pwd}
346 # compilers to use to create programs which must be run in the build
348 AR_FOR_BUILD = @AR_FOR_BUILD@
349 AS_FOR_BUILD = @AS_FOR_BUILD@
350 CC_FOR_BUILD = @CC_FOR_BUILD@
351 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
352 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
353 CXX_FOR_BUILD = @CXX_FOR_BUILD@
354 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
355 GCJ_FOR_BUILD = @GCJ_FOR_BUILD@
356 GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
357 GOC_FOR_BUILD = @GOC_FOR_BUILD@
358 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
359 LD_FOR_BUILD = @LD_FOR_BUILD@
360 NM_FOR_BUILD = @NM_FOR_BUILD@
361 RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@
362 WINDMC_FOR_BUILD = @WINDMC_FOR_BUILD@
363 WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@
365 # Special variables passed down in EXTRA_GCC_FLAGS. They are defined
366 # here so that they can be overridden by Makefile fragments.
367 BUILD_PREFIX = @BUILD_PREFIX@
368 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
370 # Flags to pass to stage2 and later makes. They are defined
371 # here so that they can be overridden by Makefile fragments.
374 BOOT_ADAFLAGS= -gnatpg
383 MAKEINFO = @MAKEINFO@
387 # This just becomes part of the MAKEINFO definition passed down to
388 # sub-makes. It lets flags be given on the command line while still
389 # using the makeinfo from the object tree.
390 # (Default to avoid splitting info files by setting the threshold high.)
391 MAKEINFOFLAGS = --split-size=5000000
393 # ---------------------------------------------
394 # Programs producing files for the HOST machine
395 # ---------------------------------------------
413 GNATBIND = @GNATBIND@
414 GNATMAKE = @GNATMAKE@
418 LIBCFLAGS = $(CFLAGS)
419 CXXFLAGS = @CXXFLAGS@
420 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
425 # Defaults for all stages; some are overridden below.
427 STAGE_CFLAGS = $(BOOT_CFLAGS)
428 STAGE_TFLAGS = $(TFLAGS)
429 STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
431 [+ FOR bootstrap-stage +]
432 # Defaults for stage [+id+]; some are overridden below.
433 STAGE[+id+]_CFLAGS = $(STAGE_CFLAGS)
434 STAGE[+id+]_CXXFLAGS = $(CXXFLAGS)
435 @if target-libstdc++-v3-bootstrap
436 # Override the above if we're bootstrapping C++.
437 STAGE[+id+]_CXXFLAGS = $(STAGE[+id+]_CFLAGS)
438 @endif target-libstdc++-v3-bootstrap
439 STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS)
440 STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
441 [+ ENDFOR bootstrap-stage +]
443 # Only build the C compiler for stage1, because that is the only one that
444 # we can guarantee will build with the native compiler, and also it is the
445 # only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
446 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
447 # overrideable (for a bootstrap build stage1 also builds gcc.info).
449 STAGE1_CFLAGS = @stage1_cflags@
450 STAGE1_CHECKING = @stage1_checking@
451 STAGE1_LANGUAGES = @stage1_languages@
452 # * We force-disable intermodule optimizations, even if
453 # --enable-intermodule was passed, since the installed compiler
454 # probably can't handle them. Luckily, autoconf always respects
455 # the last argument when conflicting --enable arguments are passed.
456 # * Likewise, we force-disable coverage flags, since the installed
457 # compiler probably has never heard of them.
458 # * We also disable -Wformat, since older GCCs don't understand newer %s.
459 STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
460 --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" \
461 --disable-build-format-warnings
463 STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
464 STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
466 STAGEfeedback_CFLAGS = $(STAGE3_CFLAGS) -fprofile-use
467 STAGEfeedback_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 GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@
488 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
489 GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
490 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
491 LD_FOR_TARGET=@LD_FOR_TARGET@
493 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
494 NM_FOR_TARGET=@NM_FOR_TARGET@
495 OBJDUMP_FOR_TARGET=@OBJDUMP_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.
528 #### host and target specific makefile fragments come in here.
529 @target_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
555 HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR):
558 [+ FOR host_modules +][+ IF lib_path +]
560 HOST_LIB_PATH_[+module+] = \
561 $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
562 +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
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.
587 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
588 "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
589 "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +][+ FOR bootstrap-stage +] \
590 "STAGE[+id+]_CFLAGS=$(STAGE[+id+]_CFLAGS)" \
591 "STAGE[+id+]_CXXFLAGS=$(STAGE[+id+]_CXXFLAGS)" \
592 "STAGE[+id+]_TFLAGS=$(STAGE[+id+]_TFLAGS)"[+ ENDFOR bootstrap-stage +] \
593 $(CXX_FOR_TARGET_FLAG_TO_PASS) \
595 "CONFIG_SHELL=$(SHELL)" \
596 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"
598 # We leave this in just in case, but it is not needed anymore.
599 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
601 # Flags to pass down to most sub-makes, in which we're building with
602 # the host environment.
608 'DLLTOOL=$(DLLTOOL)' \
610 'GFORTRAN=$(GFORTRAN)' \
615 'OBJDUMP=$(OBJDUMP)' \
617 'READELF=$(READELF)' \
619 'WINDRES=$(WINDRES)' \
622 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
624 # Flags to pass to stage1 or when not bootstrapping.
626 STAGE1_FLAGS_TO_PASS = \
627 LDFLAGS="$${LDFLAGS}" \
628 HOST_LIBS="$${HOST_LIBS}"
630 # Flags to pass to stage2 and later makes.
632 POSTSTAGE1_FLAGS_TO_PASS = \
633 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
634 CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
635 GNATBIND="$${GNATBIND}" \
636 LDFLAGS="$${LDFLAGS}" \
637 HOST_LIBS="$${HOST_LIBS}" \
638 "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
640 # Flags to pass down to makes which are built with the target environment.
641 # The double $ decreases the length of the command line; those variables
642 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The
643 # *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
644 # so we expand them here.
645 EXTRA_TARGET_FLAGS = \
646 'AR=$$(AR_FOR_TARGET)' \
647 'AS=$(COMPILER_AS_FOR_TARGET)' \
648 'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
649 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
650 'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
651 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
652 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
653 'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
654 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
655 'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
656 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
657 'LD=$(COMPILER_LD_FOR_TARGET)' \
658 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
659 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
660 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
661 'NM=$(COMPILER_NM_FOR_TARGET)' \
662 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
663 'RANLIB=$$(RANLIB_FOR_TARGET)' \
664 'READELF=$$(READELF_FOR_TARGET)' \
665 'WINDRES=$$(WINDRES_FOR_TARGET)' \
666 'WINDMC=$$(WINDMC_FOR_TARGET)' \
667 'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
670 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
672 # Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
673 # unfortunately needs the native compiler and the target ar and
675 # If any variables are added here, they must be added to do-*, below.
676 # The BUILD_* variables are a special case, which are used for the gcc
677 # cross-building scheme.
679 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
680 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
681 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
683 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
686 BUILD_CONFIG = @BUILD_CONFIG@
687 ifneq ($(BUILD_CONFIG),)
688 include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk)
692 .PHONY: configure-host
694 FOR host_modules +] \
695 maybe-configure-[+module+][+
696 ENDFOR host_modules +]
697 .PHONY: configure-target
699 FOR target_modules +] \
700 maybe-configure-target-[+module+][+
701 ENDFOR target_modules +]
703 # The target built for a native non-bootstrap build.
707 [ -f stage_final ] || echo stage3 > stage_final
708 @r=`${PWD_COMMAND}`; export r; \
709 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
710 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
712 @: $(MAKE); $(unstage)
713 @r=`${PWD_COMMAND}`; export r; \
714 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
716 if [ -f stage_last ]; then \
717 TFLAGS="$(STAGE$(shell test ! -f stage_last || sed s,^stage,, stage_last)_TFLAGS)"; \
718 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
721 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
729 [+ FOR build_modules +]
730 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
733 [+ FOR host_modules +][+ IF bootstrap +]
734 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
735 all-host: maybe-all-[+module+][+ IF bootstrap +]
736 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
739 [+ FOR target_modules +][+ IF bootstrap +]
740 @if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
741 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
742 @endif target-[+module+]-no-bootstrap[+
743 ENDIF bootstrap +][+ ENDFOR target_modules +]
745 # Do a target for all the subdirectories. A ``make do-X'' will do a
746 # ``make X'' in all subdirectories (because, in general, there is a
747 # dependency (below) of X upon do-X, a ``make X'' will also do this,
748 # but it may do additional work as well).
749 [+ FOR recursive_targets +]
750 .PHONY: do-[+make_target+]
752 @: $(MAKE); $(unstage)
753 @r=`${PWD_COMMAND}`; export r; \
754 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
755 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
756 [+make_target+]-target
759 .PHONY: [+make_target+]-host
760 [+ FOR host_modules +]
761 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
763 .PHONY: [+make_target+]-target
764 [+ FOR target_modules +]
765 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
766 [+ ENDFOR recursive_targets +]
768 # Here are the targets which correspond to the do-X targets.
770 .PHONY: info installcheck dvi pdf html
771 .PHONY: install-info install-pdf install-html
772 .PHONY: clean distclean mostlyclean maintainer-clean realclean
773 .PHONY: local-clean local-distclean local-maintainer-clean
775 installcheck: do-installcheck
780 # Make sure makeinfo is built before we do a `make info', if we're
781 # in fact building texinfo.
782 do-info: maybe-all-texinfo
784 install-info: do-install-info dir.info
785 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
786 if [ -f dir.info ] ; then \
787 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
790 install-pdf: do-install-pdf
792 install-html: do-install-html
795 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
798 -rm -f Makefile config.status config.cache mh-frag mt-frag
799 -rm -f maybedep.tmp serdep.tmp
800 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
801 rm -rf $(TARGET_SUBDIR); \
803 -rm -rf $(BUILD_SUBDIR)
804 -if [ "$(HOST_SUBDIR)" != "." ]; then \
805 rm -rf $(HOST_SUBDIR); \
807 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
808 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
809 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
810 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
811 -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
812 -find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
814 local-maintainer-clean:
815 @echo "This command is intended for maintainers to use;"
816 @echo "it deletes files that may require special tools to rebuild."
818 clean: do-clean local-clean
819 mostlyclean: do-mostlyclean local-clean
820 distclean: do-distclean local-clean local-distclean
821 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
822 maintainer-clean: local-distclean
823 realclean: maintainer-clean
827 .PHONY: check do-check
830 # Only include modules actually being configured and built.
833 FOR host_modules +] \
834 maybe-check-[+module+][+
835 ENDFOR host_modules +]
839 FOR target_modules +] \
840 maybe-check-target-[+module+][+
841 ENDFOR target_modules +]
844 @: $(MAKE); $(unstage)
845 @r=`${PWD_COMMAND}`; export r; \
846 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
847 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
849 # Automated reporting of test results.
851 warning.log: build.log
852 $(srcdir)/contrib/warn_summary build.log > $@
855 if test x'$(BOOT_CFLAGS)' != x''; then \
856 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
858 $(srcdir)/contrib/test_summary -t >$@
860 echo If you really want to send e-mail, run ./$@ now
862 mail-report-with-warnings.log: warning.log
863 if test x'$(BOOT_CFLAGS)' != x''; then \
864 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
866 $(srcdir)/contrib/test_summary -t -i warning.log >$@
868 echo If you really want to send e-mail, run ./$@ now
870 # Installation targets.
872 .PHONY: install uninstall
874 @: $(MAKE); $(unstage)
875 @r=`${PWD_COMMAND}`; export r; \
876 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
877 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
879 .PHONY: install-host-nogcc
880 install-host-nogcc: [+
881 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
882 maybe-install-[+module+][+ ENDIF +][+
883 ENDFOR host_modules +]
887 FOR host_modules +] \
888 maybe-install-[+module+][+
889 ENDFOR host_modules +]
891 .PHONY: install-target
893 FOR target_modules +] \
894 maybe-install-target-[+module+][+
895 ENDFOR target_modules +]
898 @echo "the uninstall target is not supported in this tree"
901 install.all: install-no-fixedincludes
902 @if [ -f ./gcc/Makefile ] ; then \
903 r=`${PWD_COMMAND}` ; export r ; \
904 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
907 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
912 # install-no-fixedincludes is used to allow the elaboration of binary packages
913 # suitable for distribution, where we cannot include the fixed system header
915 .PHONY: install-no-fixedincludes
916 install-no-fixedincludes: installdirs install-host-nogcc \
917 install-target gcc-install-no-fixedincludes
919 .PHONY: install-strip
921 @: $(MAKE); $(unstage)
922 @r=`${PWD_COMMAND}`; export r; \
923 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
924 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-strip-host install-strip-target
926 .PHONY: install-strip-host
927 install-strip-host: [+
928 FOR host_modules +] \
929 maybe-install-strip-[+module+][+
930 ENDFOR host_modules +]
932 .PHONY: install-strip-target
933 install-strip-target: [+
934 FOR target_modules +] \
935 maybe-install-strip-target-[+module+][+
936 ENDFOR target_modules +]
939 ### other supporting targets
942 $(DESTDIR)$(prefix) \
943 $(DESTDIR)$(exec_prefix)
945 installdirs: mkinstalldirs
946 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
948 dir.info: do-install-info
949 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
950 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
951 mv -f dir.info.new dir.info ; \
956 @echo "Building a full distribution of this tree isn't done"
957 @echo "via 'make dist'. Check out the etc/ subdirectory"
961 # Right now this just builds TAGS in each subdirectory. emacs19 has the
962 # ability to use several tags files at once, so there is probably no need
963 # to combine them into one big TAGS file (like CVS 1.3 does). We could
964 # (if we felt like it) have this Makefile write a piece of elisp which
965 # the user could load to tell emacs19 where all the TAGS files we just
969 # ------------------------------------
970 # Macros for configure and all targets
971 # ------------------------------------
973 [+ DEFINE configure +]
974 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
975 maybe-configure-[+prefix+][+module+]:
977 configure-[+prefix+][+module+]: stage_current
979 @if [+prefix+][+module+]
980 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
981 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
982 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
983 @r=`${PWD_COMMAND}`; export r; \
984 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
985 [+ IF check_multilibs
986 +]echo "Checking multilib configuration for [+module+]..."; \
987 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
988 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
989 if test -r [+subdir+]/[+module+]/multilib.out; then \
990 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
991 rm -f [+subdir+]/[+module+]/multilib.tmp; \
993 rm -f [+subdir+]/[+module+]/Makefile; \
994 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
997 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
999 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
1000 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
1001 [+exports+] [+extra_exports+] \
1002 echo Configuring in [+subdir+]/[+module+]; \
1003 [+ IF (= (get "module") "accel-gcc") +] \
1004 this_target="$(accel_target_alias)"; \
1006 this_target="[+target_alias+]"; \
1008 cd "[+subdir+]/[+module+]" || exit 1; \
1010 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1011 *) topdir=`echo [+subdir+]/[+? actual_module (get "actual_module") (get "module")+]/ | \
1012 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1014 srcdiroption="--srcdir=$${topdir}/[+? actual_module (get "actual_module") (get "module")+]"; \
1015 libsrcdir="$$s/[+? actual_module (get "actual_module") (get "module")+]"; \
1016 [+ IF no-config-site +]rm -f no-such-file || : ; \
1017 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
1018 [+args+] --build=${build_alias} --host=[+host_alias+] \
1019 --target=$${this_target} $${srcdiroption} [+extra_configure_flags+] \
1021 @endif [+prefix+][+module+]
1024 [+ FOR bootstrap_stage +]
1025 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
1026 maybe-configure-stage[+id+]-[+prefix+][+module+]:
1027 @if [+prefix+][+module+]-bootstrap
1028 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
1029 configure-stage[+id+]-[+prefix+][+module+]:
1030 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
1031 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
1032 @r=`${PWD_COMMAND}`; export r; \
1033 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1034 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1035 [+ IF check_multilibs
1036 +]echo "Checking multilib configuration for [+module+]..."; \
1037 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
1038 if test -r [+subdir+]/[+module+]/multilib.out; then \
1039 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
1040 rm -f [+subdir+]/[+module+]/multilib.tmp; \
1042 rm -f [+subdir+]/[+module+]/Makefile; \
1043 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1046 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1048 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
1049 [+exports+][+ IF prev +] \
1050 [+poststage1_exports+][+ ENDIF prev +][+ IF prefix +] \
1051 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
1052 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
1053 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;[+ ELSE prefix +] \
1054 CFLAGS="$(STAGE[+id+]_CFLAGS)"; export CFLAGS; \
1055 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"; export CXXFLAGS;[+ IF prev +] \
1056 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1057 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +]; export LIBCFLAGS;[+
1058 ENDIF prefix +] [+extra_exports+] \
1059 echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
1060 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
1061 cd [+subdir+]/[+module+] || exit 1; \
1063 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1064 *) topdir=`echo [+subdir+]/[+module+]/ | \
1065 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1067 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
1068 libsrcdir="$$s/[+module+]"; \
1069 $(SHELL) $${libsrcdir}/configure \
1070 [+args+] --build=${build_alias} --host=[+host_alias+] \
1071 --target=[+target_alias+] $${srcdiroption} [+ IF prev +]\
1072 --with-build-libsubdir=$(HOST_SUBDIR) [+ ENDIF prev +]\
1073 $(STAGE[+id+]_CONFIGURE_FLAGS)[+ IF extra_configure_flags +] \
1074 [+extra_configure_flags+][+ ENDIF extra_configure_flags +]
1075 @endif [+prefix+][+module+]-bootstrap
1076 [+ ENDFOR bootstrap_stage +]
1077 [+ ENDIF bootstrap +]
1081 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
1082 maybe-all-[+prefix+][+module+]:
1084 all-[+prefix+][+module+]: stage_current
1085 @endif gcc-bootstrap
1086 @if [+prefix+][+module+]
1087 TARGET-[+prefix+][+module+]=[+
1088 IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
1089 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
1090 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
1091 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1092 @r=`${PWD_COMMAND}`; export r; \
1093 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1094 [+exports+] [+extra_exports+] \
1095 (cd [+subdir+]/[+module+] && \
1096 $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+stage1_args+] [+extra_make_flags+] \
1097 $(TARGET-[+prefix+][+? actual_module (get "actual_module") (get "module")+]))
1098 @endif [+prefix+][+module+]
1101 [+ FOR bootstrap_stage +]
1102 .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
1103 .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
1104 maybe-all-stage[+id+]-[+prefix+][+module+]:
1105 maybe-clean-stage[+id+]-[+prefix+][+module+]:
1106 @if [+prefix+][+module+]-bootstrap
1107 maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
1108 all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
1109 TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
1110 all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
1111 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
1112 @r=`${PWD_COMMAND}`; export r; \
1113 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1114 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1115 [+exports+][+ IF prev +] \
1116 [+poststage1_exports+][+ ENDIF prev +] [+extra_exports+] \
1117 cd [+subdir+]/[+module+] && \
1118 $(MAKE) $(BASE_FLAGS_TO_PASS)[+ IF prefix +] \
1119 CFLAGS="$(CFLAGS_FOR_TARGET)" \
1120 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
1121 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"[+ ELSE prefix +] \
1122 CFLAGS="$(STAGE[+id+]_CFLAGS)" \
1123 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"[+ IF prev +] \
1124 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1125 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +][+ ENDIF prefix +] \
1126 CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
1127 CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
1128 LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
1129 [+args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \
1130 [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] \
1131 TFLAGS="$(STAGE[+id+]_TFLAGS)" \
1132 $(TARGET-stage[+id+]-[+prefix+][+module+])
1134 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
1135 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
1136 clean-stage[+id+]-[+prefix+][+module+]:
1137 @if [ $(current_stage) = stage[+id+] ]; then \
1138 [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
1140 [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
1141 $(MAKE) stage[+id+]-start; \
1143 cd [+subdir+]/[+module+] && \
1144 $(MAKE) [+args+] [+ IF prev +][+poststage1_args+][+ ELSE prev +] \
1145 [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] clean
1146 @endif [+prefix+][+module+]-bootstrap
1148 [+ ENDFOR bootstrap_stage +]
1149 [+ ENDIF bootstrap +]
1152 # --------------------------------------
1153 # Modules which run on the build machine
1154 # --------------------------------------
1155 [+ FOR build_modules +]
1156 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1157 host_alias=(get "host" "${build_alias}")
1158 target_alias=(get "target" "${target_alias}")
1159 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
1161 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1162 args="$(EXTRA_BUILD_FLAGS)" +]
1163 [+ ENDFOR build_module +]
1165 # --------------------------------------
1166 # Modules which run on the host machine
1167 # --------------------------------------
1168 [+ FOR host_modules +]
1169 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
1170 exports="$(HOST_EXPORTS)"
1171 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1172 host_alias=(get "host" "${host_alias}")
1173 target_alias=(get "target" "${target_alias}")
1174 args="$(HOST_CONFIGARGS)" +]
1176 [+ all prefix="" subdir="$(HOST_SUBDIR)"
1177 exports="$(HOST_EXPORTS)"
1178 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1179 args="$(EXTRA_HOST_FLAGS)"
1180 stage1_args="$(STAGE1_FLAGS_TO_PASS)"
1181 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
1183 .PHONY: check-[+module+] maybe-check-[+module+]
1184 maybe-check-[+module+]:
1186 maybe-check-[+module+]: check-[+module+]
1189 [+ ELIF no_check_cross +]
1190 # This module is only tested in a native toolchain.
1192 @: $(MAKE); $(unstage)
1193 @if [ '$(host)' = '$(target)' ] ; then \
1194 r=`${PWD_COMMAND}`; export r; \
1195 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1197 (cd $(HOST_SUBDIR)/[+module+] && \
1198 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
1202 @: $(MAKE); $(unstage)
1203 @r=`${PWD_COMMAND}`; export r; \
1204 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1206 (cd $(HOST_SUBDIR)/[+module+] && \
1207 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
1208 [+ ENDIF no_check +]
1211 .PHONY: install-[+module+] maybe-install-[+module+]
1212 maybe-install-[+module+]:
1214 maybe-install-[+module+]: install-[+module+]
1218 install-[+module+]: installdirs
1219 @: $(MAKE); $(unstage)
1220 @r=`${PWD_COMMAND}`; export r; \
1221 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1223 (cd $(HOST_SUBDIR)/[+module+] && \
1224 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
1225 [+ ENDIF no_install +]
1228 .PHONY: install-strip-[+module+] maybe-install-strip-[+module+]
1229 maybe-install-strip-[+module+]:
1231 maybe-install-strip-[+module+]: install-strip-[+module+]
1233 install-strip-[+module+]:
1235 install-strip-[+module+]: installdirs
1236 @: $(MAKE); $(unstage)
1237 @r=`${PWD_COMMAND}`; export r; \
1238 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1240 (cd $(HOST_SUBDIR)/[+module+] && \
1241 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
1242 [+ ENDIF no_install +]
1245 # Other targets (info, dvi, pdf, etc.)
1246 [+ FOR recursive_targets +]
1247 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1248 maybe-[+make_target+]-[+module+]:
1250 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
1251 [+ IF (match-value? = "missing" (get "make_target") ) +]
1252 # [+module+] doesn't support [+make_target+].
1253 [+make_target+]-[+module+]:
1255 [+make_target+]-[+module+]: [+
1257 [+depend+]-[+module+] [+
1259 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1260 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
1261 r=`${PWD_COMMAND}`; export r; \
1262 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1264 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1265 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1267 echo "Doing [+make_target+] in [+module+]" ; \
1268 (cd $(HOST_SUBDIR)/[+module+] && \
1269 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1270 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1271 "RANLIB=$${RANLIB}" \
1272 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1277 [+ ENDFOR recursive_targets +]
1278 [+ ENDFOR host_modules +]
1280 # ---------------------------------------
1281 # Modules which run on the target machine
1282 # ---------------------------------------
1283 [+ FOR target_modules +]
1286 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1287 check_multilibs=true
1288 exports="$(RAW_CXX_TARGET_EXPORTS)"
1289 host_alias=(get "host" "${target_alias}")
1290 target_alias=(get "target" "${target_alias}")
1291 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1293 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1294 exports="$(RAW_CXX_TARGET_EXPORTS)"
1295 args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1297 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1298 check_multilibs=true
1299 exports="$(NORMAL_TARGET_EXPORTS)"
1300 host_alias=(get "host" "${target_alias}")
1301 target_alias=(get "target" "${target_alias}")
1302 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1304 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1305 exports="$(NORMAL_TARGET_EXPORTS)"
1306 args="$(EXTRA_TARGET_FLAGS)" +]
1309 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1310 maybe-check-target-[+module+]:
1311 @if target-[+module+]
1312 maybe-check-target-[+module+]: check-target-[+module+]
1314 # Dummy target for uncheckable module.
1315 check-target-[+module+]:
1317 check-target-[+module+]:
1318 @: $(MAKE); $(unstage)
1319 @r=`${PWD_COMMAND}`; export r; \
1320 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1322 $(RAW_CXX_TARGET_EXPORTS) \[+
1324 $(NORMAL_TARGET_EXPORTS) \[+
1326 (cd $(TARGET_SUBDIR)/[+module+] && \
1327 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1329 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1331 +] [+extra_make_flags+] check)
1332 [+ ENDIF no_check +]
1333 @endif target-[+module+]
1335 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1336 maybe-install-target-[+module+]:
1337 @if target-[+module+]
1338 maybe-install-target-[+module+]: install-target-[+module+]
1340 # Dummy target for uninstallable.
1341 install-target-[+module+]:
1343 install-target-[+module+]: installdirs
1344 @: $(MAKE); $(unstage)
1345 @r=`${PWD_COMMAND}`; export r; \
1346 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1348 $(RAW_CXX_TARGET_EXPORTS) \[+
1350 $(NORMAL_TARGET_EXPORTS) \[+
1352 (cd $(TARGET_SUBDIR)/[+module+] && \
1353 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1354 [+ ENDIF no_install +]
1355 @endif target-[+module+]
1357 .PHONY: install-strip-target-[+module+] maybe-install-strip-target-[+module+]
1358 maybe-install-strip-target-[+module+]:
1359 @if target-[+module+]
1360 maybe-install-strip-target-[+module+]: install-strip-target-[+module+]
1362 # Dummy target for uninstallable.
1363 install-strip-target-[+module+]:
1365 install-strip-target-[+module+]: installdirs
1366 @: $(MAKE); $(unstage)
1367 @r=`${PWD_COMMAND}`; export r; \
1368 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1370 $(RAW_CXX_TARGET_EXPORTS) \[+
1372 $(NORMAL_TARGET_EXPORTS) \[+
1374 (cd $(TARGET_SUBDIR)/[+module+] && \
1375 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
1376 [+ ENDIF no_install +]
1377 @endif target-[+module+]
1379 # Other targets (info, dvi, pdf, etc.)
1380 [+ FOR recursive_targets +]
1381 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1382 maybe-[+make_target+]-target-[+module+]:
1383 @if target-[+module+]
1384 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1385 [+ IF (match-value? = "missing" (get "make_target") ) +]
1386 # [+module+] doesn't support [+make_target+].
1387 [+make_target+]-target-[+module+]:
1389 [+make_target+]-target-[+module+]: [+
1391 [+depend+]-target-[+module+] [+
1393 @: $(MAKE); $(unstage)
1394 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1395 r=`${PWD_COMMAND}`; export r; \
1396 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1398 $(RAW_CXX_TARGET_EXPORTS) \[+
1400 $(NORMAL_TARGET_EXPORTS) \[+
1402 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1403 for flag in $(EXTRA_TARGET_FLAGS); do \
1404 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1406 (cd $(TARGET_SUBDIR)/[+module+] && \
1407 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1408 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1409 "RANLIB=$${RANLIB}" \
1410 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1411 [+extra_make_flags+] [+make_target+]) \
1414 @endif target-[+module+]
1415 [+ ENDFOR recursive_targets +]
1416 [+ ENDFOR target_modules +]
1419 .PHONY: check-target-libgomp-c++
1420 check-target-libgomp-c++:
1421 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libgomp
1423 @endif target-libgomp
1426 .PHONY: check-target-libitm-c++
1427 check-target-libitm-c++:
1428 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libitm
1430 @endif target-libitm
1436 @if gcc-no-bootstrap
1438 cross: all-build all-gas all-ld
1439 @r=`${PWD_COMMAND}`; export r; \
1440 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1442 echo "Building the C and C++ compiler"; \
1443 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1444 @r=`${PWD_COMMAND}`; export r; \
1445 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1446 echo "Building runtime libraries"; \
1447 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1448 @endif gcc-no-bootstrap
1452 .PHONY: check-gcc-[+language+] check-[+language+]
1453 check-gcc-[+language+]:
1454 r=`${PWD_COMMAND}`; export r; \
1455 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1457 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]);
1458 check-[+language+]: check-gcc-[+language+][+ FOR lib-check-target +] [+ lib-check-target +][+ ENDFOR lib-check-target +]
1459 [+ ENDFOR languages +]
1461 # The gcc part of install-no-fixedincludes, which relies on an intimate
1462 # knowledge of how a number of gcc internal targets (inter)operate. Delegate.
1463 .PHONY: gcc-install-no-fixedincludes
1464 gcc-install-no-fixedincludes:
1465 @if [ -f ./gcc/Makefile ]; then \
1466 r=`${PWD_COMMAND}`; export r; \
1467 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1470 && $(MAKE) $(GCC_FLAGS_TO_PASS) install-no-fixedincludes); \
1474 # ---------------------
1475 # GCC bootstrap support
1476 # ---------------------
1478 # We track the current stage (the one in 'gcc') in the stage_current file.
1479 # stage_last instead tracks the stage that was built last. These targets
1480 # are dummy when toplevel bootstrap is not active.
1482 # While making host and target tools, symlinks to the final stage must be
1483 # there, so $(unstage) should be run at various points. To avoid excessive
1484 # recursive invocations of make, we "inline" them using a variable. These
1485 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1486 # to avoid warnings from the GNU Make job server.
1493 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1494 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1495 current_stage = "`cat stage_current 2> /dev/null`"
1496 @endif gcc-bootstrap
1498 .PHONY: unstage stage
1500 @: $(MAKE); $(unstage)
1502 @: $(MAKE); $(stage)
1504 # Disable commands for lean bootstrap.
1507 # We name the build directories for the various stages "stage1-gcc",
1508 # "stage2-gcc","stage3-gcc", etc.
1510 # Since the 'compare' process will fail (on debugging information) if any
1511 # directory names are different, we need to link the gcc directory for
1512 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1513 # the build directories constant as well. For the latter, we use naked names
1514 # like 'gcc', because the scripts in that directory assume it. We use
1515 # mv on platforms where symlinks to directories do not work or are not
1518 # 'touch' doesn't work right on some platforms.
1519 STAMP = echo timestamp >
1521 # We only want to compare .o files, so set this!
1524 [+ FOR bootstrap-stage +]
1525 .PHONY: stage[+id+]-start stage[+id+]-end
1528 @: $(MAKE); $(stage); \
1529 echo stage[+id+] > stage_current ; \
1530 echo stage[+id+] > stage_last; \
1531 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1532 FOR host_modules +][+ IF bootstrap +]
1534 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1535 mkdir stage[+id+]-[+module+]; \
1536 mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1537 mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1538 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1539 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1540 mkdir stage[+id+]-$(TARGET_SUBDIR); \
1541 mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1542 mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1544 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1546 @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1547 cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1548 mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
1550 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1551 @if test -d $(TARGET_SUBDIR) ; then \
1552 mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1553 mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
1557 # Bubble a bug fix through all the stages up to stage [+id+]. They are
1558 # remade, but not reconfigured. The next stage (if any) will not be
1559 # reconfigured either.
1560 .PHONY: stage[+id+]-bubble
1561 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1562 @r=`${PWD_COMMAND}`; export r; \
1563 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1564 if test -f stage[+id+]-lean [+
1565 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1566 echo Skipping rebuild of stage[+id+] ; \
1568 $(MAKE) stage[+id+]-start; \[+IF lean +]
1570 rm -rf stage[+lean+]-* ; \
1571 $(STAMP) stage[+lean+]-lean ; \
1572 fi; \[+ ENDIF lean +]
1573 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1574 fi[+ IF compare-target +]
1575 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1577 .PHONY: all-stage[+id+] clean-stage[+id+]
1578 do-clean: clean-stage[+id+]
1580 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1581 # only possibility, but now it conflicts with no-bootstrap rules
1583 [+ IF compare-target +]
1585 @r=`${PWD_COMMAND}`; export r; \
1586 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1587 if test -f stage[+prev+]-lean; then \
1588 echo Cannot compare object files as stage [+prev+] was deleted. ; \
1591 : $(MAKE); $(stage); \
1592 rm -f .bad_compare ; \
1593 echo Comparing stages [+prev+] and [+id+] ; \
1594 sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \
1595 files=`find stage[+id+]-* -name "*$(objext)" -print | \
1596 sed -n s,^stage$$sed-,,p` ; \
1597 for file in $${files} ; do \
1598 f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \
1599 if test ! -f $$f1; then continue; fi; \
1600 $(do-[+compare-target+]) > /dev/null 2>&1; \
1601 if test $$? -eq 1; then \
1603 @compare_exclusions@) \
1604 echo warning: $$file differs ;; \
1606 echo $$file differs >> .bad_compare ;; \
1610 if [ -f .bad_compare ]; then \
1611 echo "Bootstrap comparison failure!"; \
1615 echo Comparison successful.; \
1617 $(STAMP) [+compare-target+][+ IF prev +]
1619 rm -rf stage[+prev+]-*; \
1620 $(STAMP) stage[+prev+]-lean; \
1622 [+ ENDIF compare-target +]
1624 [+ IF bootstrap-target +]
1625 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1626 [+bootstrap-target+]:
1627 echo stage[+id+] > stage_final
1628 @r=`${PWD_COMMAND}`; export r; \
1629 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1630 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1631 @: $(MAKE); $(unstage)
1632 @r=`${PWD_COMMAND}`; export r; \
1633 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1634 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1635 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1637 [+bootstrap-target+]-lean:
1638 echo stage[+id+] > stage_final
1639 @r=`${PWD_COMMAND}`; export r; \
1640 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1641 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1642 @: $(MAKE); $(unstage)
1643 @r=`${PWD_COMMAND}`; export r; \
1644 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1645 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1646 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1647 [+ ENDIF bootstrap-target +]
1649 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1650 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1651 .PHONY: distclean-stage[+id+]
1652 distclean-stage[+id+]::
1653 @: $(MAKE); $(stage)
1654 @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1655 rm -rf stage[+id+]-* [+
1656 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1658 [+ IF cleanstrap-target +]
1659 .PHONY: [+cleanstrap-target+]
1660 [+cleanstrap-target+]: do-distclean local-clean
1661 echo stage[+id+] > stage_final
1662 @r=`${PWD_COMMAND}`; export r; \
1663 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1664 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1665 @: $(MAKE); $(unstage)
1666 @r=`${PWD_COMMAND}`; export r; \
1667 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1668 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1669 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1670 [+ ENDIF cleanstrap-target +]
1671 @endif gcc-bootstrap
1673 [+ ENDFOR bootstrap-stage +]
1676 $(MAKE) distclean-stagefeedback
1678 stagefeedback-start::
1679 @r=`${PWD_COMMAND}`; export r; \
1680 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1681 for i in prev-*; do \
1682 j=`echo $$i | sed s/^prev-//` ; \
1684 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1685 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1689 do-distclean: distclean-stage1
1691 # Provide a GCC build when we're building target libraries. This does
1692 # not work as a dependency, just as the minimum necessary to avoid errors.
1694 @r=`${PWD_COMMAND}`; export r; \
1695 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1696 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1698 # Same as unstage, but not phony and defaulting to stage1-start. We place
1699 # it in the dependency so that for example `make -j3 all-gcc' works.
1701 @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1705 @: $(MAKE); $(stage)
1706 rm -rf stage1-$(TARGET_SUBDIR)[+ FOR bootstrap-stage +][+ IF prev
1707 +] stage[+id+]-*[+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1709 @endif gcc-bootstrap
1711 # --------------------------------------
1712 # Dependencies between different modules
1713 # --------------------------------------
1715 # Generic dependencies for target modules on host stuff, especially gcc
1716 @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1717 +][+ FOR bootstrap_stage +]
1718 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1719 ENDFOR +][+ ELSE bootstrap +]
1720 configure-target-[+module+]: stage_last[+
1721 ENDIF bootstrap +][+ ENDFOR target_modules +]
1722 @endif gcc-bootstrap
1724 @if gcc-no-bootstrap[+ FOR target_modules +]
1725 configure-target-[+module+]: maybe-all-gcc[+
1726 ENDFOR target_modules +]
1727 @endif gcc-no-bootstrap
1730 # There are two types of dependencies here: 'hard' dependencies, where one
1731 # module simply won't build without the other; and 'soft' dependencies, where
1732 # if the depended-on module is missing, the depending module will do without
1733 # or find a substitute somewhere (perhaps installed). Soft dependencies
1734 # are made here to depend on a 'maybe-' target. If you're not sure,
1735 # it's safer to use a soft dependency.
1737 [+ ;; These Scheme functions build the bulk of the dependencies.
1738 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1739 ;; where "maybe-" is only included if HARD is not true, and all-gcc
1740 ;; is taken from VAR-NAME.
1741 (define dep-target (lambda (module-kind var-name hard)
1743 (if hard "" "maybe-")
1744 (dep-subtarget var-name)
1746 (dep-module var-name)
1749 ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1750 (define make-dep (lambda (module-kind on-kind)
1752 (dep-target module-kind "module" #t) ": "
1753 (dep-target on-kind "on" (exist? "hard")))))
1755 ;; dep-subtarget extracts everything up to the first dash in the given
1756 ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1757 (define dep-subtarget (lambda (var-name)
1758 (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1760 ;; dep-module extracts everything up to the first dash in the given
1761 ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1762 (define dep-module (lambda (var-name)
1763 (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1765 ;; dep-stage builds a string for the prefix of a bootstrap stage.
1766 (define dep-stage (lambda ()
1772 ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1773 ;; but is written in Scheme.
1774 (define dep-maybe (lambda ()
1775 (if (exist? "hard") "" "maybe-")))
1777 ;; dep-kind returns "normal" if the dependency is on an "install" target,
1778 ;; or if either module is not bootstrapped. It returns "bootstrap" for
1779 ;; configure or build dependencies between bootstrapped modules; it returns
1780 ;; "prebootstrap" for configure or build dependencies of bootstrapped
1781 ;; modules on a build module (e.g. all-gcc on all-build-bison). All this
1782 ;; is only necessary for host modules.
1783 (define dep-kind (lambda ()
1784 (if (and (hash-ref boot-modules (dep-module "module"))
1785 (=* (dep-module "on") "build-"))
1788 (if (or (= (dep-subtarget "on") "install-")
1789 (not (hash-ref boot-modules (dep-module "module")))
1790 (not (hash-ref boot-modules (dep-module "on"))))
1794 ;; We now build the hash table that is used by dep-kind.
1795 (define boot-modules (make-hash-table 113))
1798 [+ FOR host_modules +][+
1799 (if (exist? "bootstrap")
1800 (hash-create-handle! boot-modules (get "module") #t))
1801 "" +][+ ENDFOR host_modules +]
1802 [+ FOR target_modules +][+
1803 (if (exist? "bootstrap")
1804 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1805 "" +][+ ENDFOR target_modules +]
1807 # With all the machinery above in place, it is pretty easy to generate
1808 # dependencies. Host dependencies are a bit more complex because we have
1809 # to check for bootstrap/prebootstrap dependencies. To resolve
1810 # prebootstrap dependencies, prebootstrap modules are gathered in
1812 [+ FOR dependencies +][+ (make-dep "" "") +]
1813 [+ CASE (dep-kind) +]
1814 [+ == "prebootstrap"
1815 +][+ FOR bootstrap_stage +]
1816 [+ (make-dep (dep-stage) "") +][+
1817 ENDFOR bootstrap_stage +]
1819 +][+ FOR bootstrap_stage +]
1820 [+ (make-dep (dep-stage) (dep-stage)) +][+
1821 ENDFOR bootstrap_stage +]
1823 ENDFOR dependencies +]
1825 # Dependencies for target modules on other target modules are
1826 # described by lang_env_dependencies; the defaults apply to anything
1827 # not mentioned there.
1829 ;; Predicate for whether LANG was specified in lang_env_dependencies.
1830 (define lang-dep (lambda (lang)
1831 (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1833 ;; Build the hash table we will need.
1834 (define lang-env-deps (make-hash-table 7))
1835 +][+ FOR lang_env_dependencies +][+
1837 (hash-create-handle! lang-env-deps
1838 (string-append (get "module") "-" "cxx") #t))
1841 (hash-create-handle! lang-env-deps
1842 (string-append (get "module") "-" "no_c") #t))
1844 (if (exist? "no_gcc")
1845 (hash-create-handle! lang-env-deps
1846 (string-append (get "module") "-" "no_gcc") #t))
1847 "" +][+ ENDFOR lang_env_dependencies +]
1849 @if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1850 +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1851 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1852 ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1853 @endif gcc-bootstrap
1855 @if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1856 configure-target-[+module+]: maybe-all-target-libgcc[+
1857 ENDIF +][+ ENDFOR target_modules +]
1858 @endif gcc-no-bootstrap
1860 [+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1861 configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1862 ENDIF +][+ IF (lang-dep "cxx") +]
1863 configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1865 [+ ENDFOR target_modules +]
1867 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
1869 INSTALL_GDB_TK = @INSTALL_GDB_TK@
1870 configure-gdb: $(CONFIGURE_GDB_TK)
1871 all-gdb: $(gdbnlmrequirements) $(GDB_TK)
1872 install-gdb: $(INSTALL_GDB_TK)
1874 # Serialization dependencies. Host configures don't work well in parallel to
1875 # each other, due to contention over config.cache. Target configures and
1876 # build configures are similar.
1877 @serialization_dependencies@
1879 # --------------------------------
1880 # Regenerating top level configury
1881 # --------------------------------
1883 # Rebuilding Makefile.in, using autogen.
1885 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1886 cd $(srcdir) && $(AUTOGEN) Makefile.def
1888 # Rebuilding Makefile.
1889 Makefile: $(srcdir)/Makefile.in config.status
1890 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1892 config.status: configure
1893 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
1895 # Rebuilding configure.
1897 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
1898 $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4
1899 cd $(srcdir) && $(AUTOCONF)
1901 # ------------------------------
1902 # Special directives to GNU Make
1903 # ------------------------------
1905 # Don't pass command-line variables to submakes.
1909 # end of Makefile.in