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@
53 program_transform_name = @program_transform_name@
56 exec_prefix = @exec_prefix@
62 libexecdir = @libexecdir@
64 sysconfdir = @sysconfdir@
65 sharedstatedir = @sharedstatedir@
66 localstatedir = @localstatedir@
68 includedir = @includedir@
69 oldincludedir = @oldincludedir@
71 datarootdir = @datarootdir@
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
87 INSTALL_PROGRAM = @INSTALL_PROGRAM@
88 INSTALL_SCRIPT = @INSTALL_SCRIPT@
89 INSTALL_DATA = @INSTALL_DATA@
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@
104 build_tooldir = @build_tooldir@
106 # This is the name of the environment variable used for the path to
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 # If the build should make suitable code for shared host resources.
116 host_shared = @host_shared@
118 # Build programs are put under this directory.
119 BUILD_SUBDIR = @build_subdir@
120 # This is set by the configure script to the arguments to use when configuring
121 # directories built for the build system.
122 BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
124 # Linker flags to use on the host, for stage1 or when not
126 STAGE1_LDFLAGS = @stage1_ldflags@
128 # Libraries to use on the host, for stage1 or when not bootstrapping.
129 STAGE1_LIBS = @stage1_libs@
131 # Linker flags to use for stage2 and later.
132 POSTSTAGE1_LDFLAGS = @poststage1_ldflags@
134 # Libraries to use for stage2 and later.
135 POSTSTAGE1_LIBS = @poststage1_libs@
137 # This is the list of variables to export in the environment when
138 # configuring any subdirectory. It must also be exported whenever
139 # recursing into a build directory in case that directory's Makefile
142 FLEX="$(FLEX)"; export FLEX; \
143 LEX="$(LEX)"; export LEX; \
144 BISON="$(BISON)"; export BISON; \
145 YACC="$(YACC)"; export YACC; \
146 M4="$(M4)"; export M4; \
147 SED="$(SED)"; export SED; \
148 AWK="$(AWK)"; export AWK; \
149 MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
151 # This is the list of variables to export in the environment when
152 # configuring subdirectories for the build system.
155 AR="$(AR_FOR_BUILD)"; export AR; \
156 AS="$(AS_FOR_BUILD)"; export AS; \
157 CC="$(CC_FOR_BUILD)"; export CC; \
158 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
159 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
160 CPP="$(CPP_FOR_BUILD)"; export CPP; \
161 CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
162 CXX="$(CXX_FOR_BUILD)"; export CXX; \
163 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
164 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
165 GOC="$(GOC_FOR_BUILD)"; export GOC; \
166 GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
167 GDC="$(GDC_FOR_BUILD)"; export GDC; \
168 GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \
169 GM2="$(GM2_FOR_BUILD)"; export GM2; \
170 GM2FLAGS="$(GM2FLAGS_FOR_BUILD)"; export GM2FLAGS; \
171 DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
172 DSYMUTIL="$(DSYMUTIL_FOR_BUILD)"; export DSYMUTIL; \
173 LD="$(LD_FOR_BUILD)"; export LD; \
174 LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
175 NM="$(NM_FOR_BUILD)"; export NM; \
176 RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
177 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
178 WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
180 # These variables must be set on the make command line for directories
181 # built for the build system to override those in BASE_FLAGS_TO_PASS.
182 EXTRA_BUILD_FLAGS = \
183 CFLAGS="$(CFLAGS_FOR_BUILD)" \
184 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
186 # This is the list of directories to built for the host system.
187 SUBDIRS = @configdirs@
188 TARGET_CONFIGDIRS = @target_configdirs@
189 # This is set by the configure script to the arguments to use when configuring
190 # directories built for the host system.
191 HOST_CONFIGARGS = @host_configargs@
192 # Host programs are put under this directory, which is . except if building
194 HOST_SUBDIR = @host_subdir@
195 # This is the list of variables to export in the environment when
196 # configuring subdirectories for the host system. We need to pass
197 # some to the GCC configure because of its hybrid host/target nature.
200 CC="$(CC)"; export CC; \
201 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
202 CFLAGS="$(CFLAGS)"; export CFLAGS; \
203 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
204 CXX="$(CXX)"; export CXX; \
205 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
206 GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
207 GOC="$(GOC)"; export GOC; \
208 GDC="$(GDC)"; export GDC; \
209 GM2="$(GM2)"; export GM2; \
210 AR="$(AR)"; export AR; \
211 AS="$(AS)"; export AS; \
212 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
213 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
214 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
215 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
216 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
217 DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
218 LD="$(LD)"; export LD; \
219 LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
220 NM="$(NM)"; export NM; \
221 RANLIB="$(RANLIB)"; export RANLIB; \
222 WINDRES="$(WINDRES)"; export WINDRES; \
223 WINDMC="$(WINDMC)"; export WINDMC; \
224 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
225 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
226 OTOOL="$(OTOOL)"; export OTOOL; \
227 PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
228 READELF="$(READELF)"; export READELF; \
229 AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
230 AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
231 DSYMUTIL_FOR_TARGET="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL_FOR_TARGET; \
232 GCC_FOR_TARGET="$(GCC_FOR_TARGET) $$TFLAGS"; export GCC_FOR_TARGET; \
233 LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
234 NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
235 OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
236 OBJCOPY_FOR_TARGET="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY_FOR_TARGET; \
237 OTOOL_FOR_TARGET="$(OTOOL_FOR_TARGET)"; export OTOOL_FOR_TARGET; \
238 RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
239 READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
240 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
241 HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
242 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
243 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
244 ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
245 ISLINC="$(HOST_ISLINC)"; export ISLINC; \
246 LIBELFLIBS="$(HOST_LIBELFLIBS)"; export LIBELFLIBS; \
247 LIBELFINC="$(HOST_LIBELFINC)"; export LIBELFINC; \
248 XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \
250 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
252 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
254 POSTSTAGE1_CXX_EXPORT = \
255 CXX='$(CXX)'; export CXX; \
256 CXX_FOR_BUILD='$(CXX_FOR_BUILD)'; export CXX_FOR_BUILD;
257 @if target-libstdc++-v3-bootstrap
258 # Override the above if we're bootstrapping C++.
259 POSTSTAGE1_CXX_EXPORT = \
260 CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xg++$(exeext) \
261 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \
262 -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
263 -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
264 `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \
265 `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \
266 `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$s/libstdc++-v3/libsupc++ \
267 -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
268 -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \
270 CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD;
271 @endif target-libstdc++-v3-bootstrap
273 # Similar, for later GCC stages.
274 POSTSTAGE1_HOST_EXPORTS = \
276 CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
277 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ \
278 $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
279 CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \
280 $(POSTSTAGE1_CXX_EXPORT) \
282 GDC="$$r/$(HOST_SUBDIR)/prev-gcc/gdc$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
283 -B$(build_tooldir)/bin/ $(GDC_FLAGS_FOR_TARGET) \
284 -B$$r/prev-$(TARGET_SUBDIR)/libphobos/src \
285 -I$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime -I$$s/libphobos/libdruntime \
286 -L$$r/prev-$(TARGET_SUBDIR)/libphobos/src/.libs \
287 -L$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime/.libs"; \
289 GDC_FOR_BUILD="$$GDC"; export GDC_FOR_BUILD; \
290 GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \
291 LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \
292 HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS;
294 # Target libraries are put under this directory:
295 TARGET_SUBDIR = @target_subdir@
296 # This is set by the configure script to the arguments to use when configuring
297 # directories built for the target.
298 TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
299 # This is the list of variables to export in the environment when
300 # configuring subdirectories for the target system.
301 BASE_TARGET_EXPORTS = \
303 AR="$(AR_FOR_TARGET)"; export AR; \
304 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
305 CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
306 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
307 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
308 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
309 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
310 GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
311 GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
312 GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \
313 GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \
314 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
315 DSYMUTIL="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL; \
316 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
317 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
318 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
319 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
320 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
321 OBJCOPY="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY; \
322 OTOOL="$(OTOOL_FOR_TARGET)"; export OTOOL; \
323 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
324 READELF="$(READELF_FOR_TARGET)"; export READELF; \
325 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
326 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
327 WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
329 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
331 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
332 TARGET_CONFIGDIRS="$(TARGET_CONFIGDIRS)"; export TARGET_CONFIGDIRS;
334 RAW_CXX_TARGET_EXPORTS = \
335 $(BASE_TARGET_EXPORTS) \
336 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
337 CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
339 NORMAL_TARGET_EXPORTS = \
340 $(BASE_TARGET_EXPORTS) \
341 CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
344 HOST_GMPLIBS = @gmplibs@
345 HOST_GMPINC = @gmpinc@
348 HOST_ISLLIBS = @isllibs@
349 HOST_ISLINC = @islinc@
351 # Where to find libelf
352 HOST_LIBELFLIBS = @libelflibs@
353 HOST_LIBELFINC = @libelfinc@
355 # ----------------------------------------------
356 # Programs producing files for the BUILD machine
357 # ----------------------------------------------
361 # pwd command to use. Allow user to override default by setting PWDCMD in
362 # the environment to account for automounters. The make variable must not
363 # be called PWDCMD, otherwise the value set here is passed to make
364 # subprocesses and overrides the setting from the user's environment.
365 # Don't use PWD since it is a common shell environment variable and we
366 # don't want to corrupt it.
367 PWD_COMMAND = $${PWDCMD-pwd}
369 # compilers to use to create programs which must be run in the build
371 AR_FOR_BUILD = @AR_FOR_BUILD@
372 AS_FOR_BUILD = @AS_FOR_BUILD@
373 CC_FOR_BUILD = @CC_FOR_BUILD@
374 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
375 CPP_FOR_BUILD = @CPP_FOR_BUILD@
376 CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
377 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
378 CXX_FOR_BUILD = @CXX_FOR_BUILD@
379 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
380 DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@
381 GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
382 GOC_FOR_BUILD = @GOC_FOR_BUILD@
383 GDC_FOR_BUILD = @GDC_FOR_BUILD@
384 GM2_FOR_BUILD = @GM2_FOR_BUILD@
385 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
386 LD_FOR_BUILD = @LD_FOR_BUILD@
387 NM_FOR_BUILD = @NM_FOR_BUILD@
388 RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@
389 WINDMC_FOR_BUILD = @WINDMC_FOR_BUILD@
390 WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@
392 # Special variables passed down in EXTRA_GCC_FLAGS. They are defined
393 # here so that they can be overridden by Makefile fragments.
394 BUILD_PREFIX = @BUILD_PREFIX@
395 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
397 # Flags to pass to stage2 and later makes. They are defined
398 # here so that they can be overridden by Makefile fragments.
401 BOOT_ADAFLAGS= -gnatpg
410 MAKEINFO = @MAKEINFO@
414 AUTO_PROFILE = gcc-auto-profile -c 10000000
416 # This just becomes part of the MAKEINFO definition passed down to
417 # sub-makes. It lets flags be given on the command line while still
418 # using the makeinfo from the object tree.
419 # (Default to avoid splitting info files by setting the threshold high.)
420 MAKEINFOFLAGS = --split-size=5000000
422 # ---------------------------------------------
423 # Programs producing files for the HOST machine
424 # ---------------------------------------------
427 AR = @AR@ @AR_PLUGIN_OPTION@
432 DSYMUTIL = @DSYMUTIL@
438 RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
445 GNATBIND = @GNATBIND@
446 GNATMAKE = @GNATMAKE@
450 LIBCFLAGS = $(CFLAGS)
451 CXXFLAGS = @CXXFLAGS@
452 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
457 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
459 # Pass additional PGO and LTO compiler options to the PGO build.
460 BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
461 override CFLAGS += $(BUILD_CFLAGS)
462 override CXXFLAGS += $(BUILD_CFLAGS)
464 # Additional PGO and LTO compiler options to generate profiling data
466 PGO_BUILD_GEN_FLAGS_TO_PASS = \
467 PGO_BUILD_CFLAGS="@PGO_BUILD_GEN_CFLAGS@" \
468 PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@"
470 # NB: Filter out any compiler options which may fail PGO training runs.
471 PGO_BUILD_TRAINING_CFLAGS:= \
472 $(filter-out -Werror=%,$(CFLAGS))
473 PGO_BUILD_TRAINING_CXXFLAGS:=\
474 $(filter-out -Werror=%,$(CXXFLAGS))
475 PGO_BUILD_TRAINING_CFLAGS:= \
476 $(filter-out -Wall,$(PGO_BUILD_TRAINING_CFLAGS))
477 PGO_BUILD_TRAINING_CXXFLAGS:= \
478 $(filter-out -Wall,$(PGO_BUILD_TRAINING_CXXFLAGS))
479 PGO_BUILD_TRAINING_CFLAGS:= \
480 $(filter-out -specs=%,$(PGO_BUILD_TRAINING_CFLAGS))
481 PGO_BUILD_TRAINING_CXXFLAGS:= \
482 $(filter-out -specs=%,$(PGO_BUILD_TRAINING_CXXFLAGS))
483 PGO_BUILD_TRAINING_FLAGS_TO_PASS = \
484 PGO_BUILD_TRAINING=yes \
485 CFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CFLAGS)" \
486 CXXFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CXXFLAGS)"
488 # Ignore "make check" errors in PGO training runs.
489 PGO_BUILD_TRAINING_MFLAGS = -i
491 # Additional PGO and LTO compiler options to use profiling data for the
493 PGO_BUILD_USE_FLAGS_TO_PASS = \
494 PGO_BUILD_CFLAGS="@PGO_BUILD_USE_CFLAGS@" \
495 PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@"
497 # PGO training targets for the PGO build. FIXME: Add gold tests to
499 PGO-TRAINING-TARGETS = binutils gas gdb ld sim
500 PGO_BUILD_TRAINING = $(addprefix maybe-check-,$(PGO-TRAINING-TARGETS))
502 CREATE_GCOV = create_gcov
506 # Defaults for all stages; some are overridden below.
508 STAGE_CFLAGS = $(BOOT_CFLAGS)
509 STAGE_TFLAGS = $(TFLAGS)
510 STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
512 [+ FOR bootstrap-stage +]
513 # Defaults for stage [+id+]; some are overridden below.
514 STAGE[+id+]_CFLAGS = $(STAGE_CFLAGS)
515 STAGE[+id+]_CXXFLAGS = $(CXXFLAGS)
516 @if target-libstdc++-v3-bootstrap
517 # Override the above if we're bootstrapping C++.
518 STAGE[+id+]_CXXFLAGS = $(STAGE[+id+]_CFLAGS)
519 @endif target-libstdc++-v3-bootstrap
520 STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS)
521 STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
522 [+ ENDFOR bootstrap-stage +]
524 # By default, C and C++ are the only stage1 languages, because they are the
525 # only ones we require to build with the bootstrap compiler, and also the
526 # only ones useful for building stage2.
528 STAGE1_CFLAGS = @stage1_cflags@
529 STAGE1_CHECKING = @stage1_checking@
530 STAGE1_LANGUAGES = @stage1_languages@
531 # * We force-disable intermodule optimizations, even if
532 # --enable-intermodule was passed, since the installed compiler
533 # probably can't handle them. Luckily, autoconf always respects
534 # the last argument when conflicting --enable arguments are passed.
535 # * Likewise, we force-disable coverage flags, since the installed
536 # compiler probably has never heard of them.
537 # * We also disable -Wformat, since older GCCs don't understand newer %s.
538 STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
539 --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" \
540 --disable-build-format-warnings
542 # When using the slow stage1 compiler disable IL verification and forcefully
543 # enable it when using the stage2 compiler instead. As we later compare
544 # stage2 and stage3 we are merely avoid doing redundant work, plus we apply
545 # checking when building all target libraries for release builds.
546 STAGE1_TFLAGS += -fno-checking
547 STAGE2_CFLAGS += -fno-checking
548 STAGE2_TFLAGS += -fno-checking
549 STAGE3_CFLAGS += -fchecking=1
550 STAGE3_TFLAGS += -fchecking=1
552 STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
553 STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
555 STAGEtrain_CFLAGS = $(filter-out -fchecking=1,$(STAGE3_CFLAGS))
556 STAGEtrain_TFLAGS = $(filter-out -fchecking=1,$(STAGE3_TFLAGS))
558 STAGEfeedback_CFLAGS = $(STAGE4_CFLAGS) -fprofile-use -fprofile-reproducible=parallel-runs
559 STAGEfeedback_TFLAGS = $(STAGE4_TFLAGS)
561 STAGEautoprofile_CFLAGS = $(STAGE2_CFLAGS) -g
562 STAGEautoprofile_TFLAGS = $(STAGE2_TFLAGS)
564 STAGEautofeedback_CFLAGS = $(STAGE3_CFLAGS)
565 STAGEautofeedback_TFLAGS = $(STAGE3_TFLAGS)
567 do-compare = @do_compare@
568 do-compare3 = $(do-compare)
570 # -----------------------------------------------
571 # Programs producing files for the TARGET machine
572 # -----------------------------------------------
574 AR_FOR_TARGET=@AR_FOR_TARGET@
575 AS_FOR_TARGET=@AS_FOR_TARGET@
576 CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@
578 # If GCC_FOR_TARGET is not overriden on the command line, then this
579 # variable is passed down to the gcc Makefile, where it is used to
580 # build libgcc2.a. We define it here so that it can itself be
581 # overridden on the command line.
582 GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@
583 CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@
584 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
585 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
586 GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
587 GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@
588 GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@
589 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
590 DSYMUTIL_FOR_TARGET=@DSYMUTIL_FOR_TARGET@
591 LD_FOR_TARGET=@LD_FOR_TARGET@
593 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
594 NM_FOR_TARGET=@NM_FOR_TARGET@
595 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
596 OBJCOPY_FOR_TARGET=@OBJCOPY_FOR_TARGET@
597 OTOOL_FOR_TARGET=@OTOOL_FOR_TARGET@
598 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
599 READELF_FOR_TARGET=@READELF_FOR_TARGET@
600 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
601 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
602 WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
604 COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
605 COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
606 COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
608 CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
609 CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
611 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
612 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
613 LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
614 GM2FLAGS_FOR_TARGET = -O2 -g
615 GOCFLAGS_FOR_TARGET = -O2 -g
616 GDCFLAGS_FOR_TARGET = -O2 -g
618 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
619 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
620 DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
622 XGCC_FLAGS_FOR_TARGET = $(FLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
624 # ------------------------------------
625 # Miscellaneous targets and flag lists
626 # ------------------------------------
628 # The first rule in the file had better be this one. Don't put any above it.
629 # This lives here to allow makefile fragments to contain dependencies.
632 #### host and target specific makefile fragments come in here.
633 @target_makefile_frag@
639 # This is the list of directories that may be needed in RPATH_ENVVAR
640 # so that programs built for the target machine work.
641 TARGET_LIB_PATH = [+ FOR target_modules +][+
642 IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
643 ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
644 [+ FOR target_modules +][+ IF lib_path +]
645 @if target-[+module+]
646 TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
647 @endif target-[+module+]
648 [+ ENDIF lib_path +][+ ENDFOR target_modules +]
651 # This is the list of directories that may be needed in RPATH_ENVVAR
652 # so that programs built for the host machine work.
653 HOST_LIB_PATH = [+ FOR host_modules +][+
654 IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
655 ENDFOR host_modules +]
657 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
659 HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR):
662 [+ FOR host_modules +][+ IF lib_path +]
664 HOST_LIB_PATH_[+module+] = \
665 $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
666 +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
668 [+ ENDIF lib_path +][+ ENDFOR host_modules +]
670 CXX_FOR_TARGET_FLAG_TO_PASS = \
671 "CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
672 @if target-libstdc++-v3
673 # CXX_FOR_TARGET is tricky to get right for target libs that require a
674 # functional C++ compiler. When we recurse, if we expand
675 # CXX_FOR_TARGET before configuring libstdc++-v3, we won't get
676 # libstdc++ include flags from the script. Instead, we get an
677 # -funconfigured-* word, so that we'll get errors if this invalid C++
678 # command line is used for anything, but also so that we can use the
679 # word to decide whether or not to pass on this CXX_FOR_TARGET. If we
680 # don't pass it on, sub-make will use the default definition, that
681 # re-expands it at the time of use, so we'll get it right when we need
682 # it. One potential exception is the expansion of CXX_FOR_TARGET
683 # passed down as part of CXX within TARGET_FLAGS, but this wouldn't
684 # really work, for C++ host programs can't depend on the current-stage
685 # C++ target library.
686 CXX_FOR_TARGET_FLAG_TO_PASS = \
687 $(shell if echo "$(CXX_FOR_TARGET)" | grep " -funconfigured-" > /dev/null; then :; else echo '"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"'; fi)
688 @endif target-libstdc++-v3
690 # Flags to pass down to all sub-makes. STAGE*FLAGS,
691 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
692 # overrideable (for a bootstrap build stage1 also builds gcc.info).
693 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
694 "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
695 "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +][+ FOR bootstrap-stage +] \
696 "STAGE[+id+]_CFLAGS=$(STAGE[+id+]_CFLAGS)" \
697 "STAGE[+id+]_CXXFLAGS=$(STAGE[+id+]_CXXFLAGS)" \
698 "STAGE[+id+]_GENERATOR_CFLAGS=$(STAGE[+id+]_GENERATOR_CFLAGS)" \
699 "STAGE[+id+]_TFLAGS=$(STAGE[+id+]_TFLAGS)"[+ ENDFOR bootstrap-stage +] \
700 $(CXX_FOR_TARGET_FLAG_TO_PASS) \
702 "CONFIG_SHELL=$(SHELL)" \
703 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
704 $(if $(LSAN_OPTIONS),"LSAN_OPTIONS=$(LSAN_OPTIONS)")
706 # We leave this in just in case, but it is not needed anymore.
707 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
709 # Flags to pass down to most sub-makes, in which we're building with
710 # the host environment.
716 'DLLTOOL=$(DLLTOOL)' \
717 'DSYMUTIL=$(DSYMUTIL)' \
718 'GFORTRAN=$(GFORTRAN)' \
725 'OBJDUMP=$(OBJDUMP)' \
728 'READELF=$(READELF)' \
730 'WINDRES=$(WINDRES)' \
732 'CREATE_GCOV=$(CREATE_GCOV)'
734 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
736 # Flags to pass to stage1 or when not bootstrapping.
738 STAGE1_FLAGS_TO_PASS = \
739 LDFLAGS="$${LDFLAGS}" \
740 HOST_LIBS="$${HOST_LIBS}"
742 # Flags to pass to stage2 and later makes.
744 POSTSTAGE1_FLAGS_TO_PASS = \
745 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
746 CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
747 GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \
748 GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \
749 GNATBIND="$${GNATBIND}" \
750 LDFLAGS="$${LDFLAGS}" \
751 HOST_LIBS="$${HOST_LIBS}" \
752 $(LTO_FLAGS_TO_PASS) \
753 "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
756 EXTRA_HOST_EXPORTS = if [ $(current_stage) != stage1 ]; then \
757 $(POSTSTAGE1_HOST_EXPORTS) \
760 EXTRA_BOOTSTRAP_FLAGS = CC="$$CC" CXX="$$CXX" LDFLAGS="$$LDFLAGS"
763 # Flags to pass down to makes which are built with the target environment.
764 # The double $ decreases the length of the command line; those variables
765 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The
766 # *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
767 # so we expand them here.
768 EXTRA_TARGET_FLAGS = \
769 'AR=$$(AR_FOR_TARGET)' \
770 'AS=$(COMPILER_AS_FOR_TARGET)' \
771 'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
772 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
773 'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
774 -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
775 $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
776 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
777 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
778 'DSYMUTIL=$$(DSYMUTIL_FOR_TARGET)' \
779 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
780 'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
781 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
782 'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
783 'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \
784 'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
785 'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \
786 'LD=$(COMPILER_LD_FOR_TARGET)' \
787 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
788 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
789 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
790 'NM=$(COMPILER_NM_FOR_TARGET)' \
791 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
792 'OBJCOPY=$$(OBJCOPY_FOR_TARGET)' \
793 'RANLIB=$$(RANLIB_FOR_TARGET)' \
794 'READELF=$$(READELF_FOR_TARGET)' \
795 'WINDRES=$$(WINDRES_FOR_TARGET)' \
796 'WINDMC=$$(WINDMC_FOR_TARGET)' \
797 'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
798 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
799 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
802 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
804 # Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
805 # unfortunately needs the native compiler and the target ar and
807 # If any variables are added here, they must be added to do-*, below.
808 # The BUILD_* variables are a special case, which are used for the gcc
809 # cross-building scheme.
811 "GCC_FOR_TARGET=$(GCC_FOR_TARGET) $$TFLAGS" \
812 "GM2_FOR_TARGET=$(GM2_FOR_TARGET) $$TFLAGS" \
813 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
814 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
816 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
819 BUILD_CONFIG = @BUILD_CONFIG@
820 ifneq ($(BUILD_CONFIG),)
821 include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk)
825 .PHONY: configure-host
827 FOR host_modules +] \
828 maybe-configure-[+module+][+
829 ENDFOR host_modules +]
830 .PHONY: configure-target
832 FOR target_modules +] \
833 maybe-configure-target-[+module+][+
834 ENDFOR target_modules +]
836 # The target built for a native non-bootstrap build.
839 # --enable-pgo-build enables the PGO build.
840 # 1. First build with -fprofile-generate.
841 # 2. Use "make maybe-check-*" to generate profiling data.
842 # 3. Use "make clean" to remove the previous build.
843 # 4. Rebuild with -fprofile-use.
846 [ -f stage_final ] || echo stage3 > stage_final
847 @r=`${PWD_COMMAND}`; export r; \
848 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
849 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
851 @: $(MAKE); $(unstage)
852 +@r=`${PWD_COMMAND}`; export r; \
853 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
855 if [ -f stage_last ]; then \
856 TFLAGS="$(STAGE$(shell test ! -f stage_last || sed s,^stage,, stage_last)_TFLAGS)"; \
857 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
860 $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
861 $(PGO_BUILD_GEN_FLAGS_TO_PASS) all-host all-target \
863 && $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
864 $(PGO_BUILD_TRAINING_MFLAGS) \
865 $(PGO_BUILD_TRAINING_FLAGS_TO_PASS) \
866 $(PGO_BUILD_TRAINING) \
867 && $(MAKE) $(RECURSE_FLAGS_TO_PASS) clean \
868 && $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
869 $(PGO_BUILD_USE_FLAGS_TO_PASS) all-host all-target \
878 [+ FOR build_modules +]
879 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
882 [+ FOR host_modules +][+ IF bootstrap +]
883 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
884 all-host: maybe-all-[+module+][+ IF bootstrap +]
885 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
888 [+ FOR target_modules +][+ IF bootstrap +]
889 @if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
890 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
891 @endif target-[+module+]-no-bootstrap[+
892 ENDIF bootstrap +][+ ENDFOR target_modules +]
894 # Do a target for all the subdirectories. A ``make do-X'' will do a
895 # ``make X'' in all subdirectories (because, in general, there is a
896 # dependency (below) of X upon do-X, a ``make X'' will also do this,
897 # but it may do additional work as well).
898 [+ FOR recursive_targets +]
899 .PHONY: do-[+make_target+]
901 @: $(MAKE); $(unstage)
902 @r=`${PWD_COMMAND}`; export r; \
903 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
904 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
905 [+make_target+]-target
908 .PHONY: [+make_target+]-host
909 [+ FOR host_modules +]
910 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
912 .PHONY: [+make_target+]-target
913 [+ FOR target_modules +]
914 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
915 [+ ENDFOR recursive_targets +]
917 # Here are the targets which correspond to the do-X targets.
919 .PHONY: info installcheck dvi pdf html
920 .PHONY: install-info install-dvi install-pdf install-html
921 .PHONY: clean distclean mostlyclean maintainer-clean realclean
922 .PHONY: local-clean local-distclean local-maintainer-clean
924 installcheck: do-installcheck
929 # Make sure makeinfo is built before we do a `make info', if we're
930 # in fact building texinfo.
931 do-info: maybe-all-texinfo
933 install-info: do-install-info dir.info
934 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
935 if [ -f dir.info ]; then \
936 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info; \
939 install-dvi: do-install-dvi
941 install-pdf: do-install-pdf
943 install-html: do-install-html
946 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
949 -rm -f Makefile config.status config.cache mh-frag mt-frag
950 -rm -f maybedep.tmp serdep.tmp stage_final
951 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
952 rm -rf $(TARGET_SUBDIR); \
954 -rm -rf $(BUILD_SUBDIR)
955 -if [ "$(HOST_SUBDIR)" != "." ]; then \
956 rm -rf $(HOST_SUBDIR); \
958 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
959 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
960 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
961 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
962 -rmdir c++tools fastjar gcc gnattools gotools 2>/dev/null
963 -rmdir libcc1 libiberty texinfo zlib 2>/dev/null
964 -find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
966 local-maintainer-clean:
967 @echo "This command is intended for maintainers to use;"
968 @echo "it deletes files that may require special tools to rebuild."
970 clean: do-clean local-clean
971 mostlyclean: do-mostlyclean local-clean
972 distclean: do-distclean local-clean local-distclean
973 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
974 maintainer-clean: local-distclean
975 realclean: maintainer-clean
979 .PHONY: check do-check
982 # Only include modules actually being configured and built.
985 FOR host_modules +] \
986 maybe-check-[+module+][+
987 ENDFOR host_modules +]
991 FOR target_modules +] \
992 maybe-check-target-[+module+][+
993 ENDFOR target_modules +]
996 @: $(MAKE); $(unstage)
997 @r=`${PWD_COMMAND}`; export r; \
998 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
999 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
1001 # Automated reporting of test results.
1003 warning.log: build.log
1004 $(srcdir)/contrib/warn_summary build.log > $@
1007 if test x'$(BOOT_CFLAGS)' != x''; then \
1008 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
1010 $(srcdir)/contrib/test_summary -t >$@
1012 echo If you really want to send e-mail, run ./$@ now
1014 mail-report-with-warnings.log: warning.log
1015 if test x'$(BOOT_CFLAGS)' != x''; then \
1016 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
1018 $(srcdir)/contrib/test_summary -t -i warning.log >$@
1020 echo If you really want to send e-mail, run ./$@ now
1024 $(srcdir)/.local.vimrc:
1025 $(LN_S) contrib/vimrc $@
1028 $(LN_S) contrib/vimrc $@
1030 vimrc: $(srcdir)/.local.vimrc $(srcdir)/.lvimrc
1034 # clang-format config
1036 $(srcdir)/.clang-format:
1037 $(LN_S) contrib/clang-format $@
1039 clang-format: $(srcdir)/.clang-format
1041 .PHONY: clang-format
1043 # Installation targets.
1045 .PHONY: install uninstall
1047 @: $(MAKE); $(unstage)
1048 @r=`${PWD_COMMAND}`; export r; \
1049 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1050 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
1052 .PHONY: install-host-nogcc
1053 install-host-nogcc: [+
1054 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
1055 maybe-install-[+module+][+ ENDIF +][+
1056 ENDFOR host_modules +]
1058 .PHONY: install-host
1060 FOR host_modules +] \
1061 maybe-install-[+module+][+
1062 ENDFOR host_modules +]
1064 .PHONY: install-target
1066 FOR target_modules +] \
1067 maybe-install-target-[+module+][+
1068 ENDFOR target_modules +]
1071 @echo "the uninstall target is not supported in this tree"
1074 install.all: install-no-fixedincludes
1075 @if [ -f ./gcc/Makefile ]; then \
1076 r=`${PWD_COMMAND}`; export r; \
1077 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1080 $(MAKE) $(FLAGS_TO_PASS) install-headers); \
1085 # install-no-fixedincludes is used to allow the elaboration of binary packages
1086 # suitable for distribution, where we cannot include the fixed system header
1088 .PHONY: install-no-fixedincludes
1089 install-no-fixedincludes: installdirs install-host-nogcc \
1090 install-target gcc-install-no-fixedincludes
1092 .PHONY: install-strip
1094 @: $(MAKE); $(unstage)
1095 @r=`${PWD_COMMAND}`; export r; \
1096 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1097 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-strip-host install-strip-target
1099 .PHONY: install-strip-host
1100 install-strip-host: [+
1101 FOR host_modules +] \
1102 maybe-install-strip-[+module+][+
1103 ENDFOR host_modules +]
1105 .PHONY: install-strip-target
1106 install-strip-target: [+
1107 FOR target_modules +] \
1108 maybe-install-strip-target-[+module+][+
1109 ENDFOR target_modules +]
1112 ### other supporting targets
1115 $(DESTDIR)$(prefix) \
1116 $(DESTDIR)$(exec_prefix)
1118 installdirs: mkinstalldirs
1119 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
1121 dir.info: do-install-info
1122 if [ -f $(srcdir)/texinfo/gen-info-dir ]; then \
1123 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new; \
1124 mv -f dir.info.new dir.info; \
1129 @echo "Building a full distribution of this tree isn't done"
1130 @echo "via 'make dist'. Check out the etc/ subdirectory"
1134 # Right now this just builds TAGS in each subdirectory. emacs19 has the
1135 # ability to use several tags files at once, so there is probably no need
1136 # to combine them into one big TAGS file (like CVS 1.3 does). We could
1137 # (if we felt like it) have this Makefile write a piece of elisp which
1138 # the user could load to tell emacs19 where all the TAGS files we just
1142 # ------------------------------------
1143 # Macros for configure and all targets
1144 # ------------------------------------
1146 [+ DEFINE configure +]
1147 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
1148 maybe-configure-[+prefix+][+module+]:
1150 configure-[+prefix+][+module+]: stage_current
1151 @endif gcc-bootstrap
1152 @if [+prefix+][+module+]
1153 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
1154 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
1155 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1156 @r=`${PWD_COMMAND}`; export r; \
1157 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1158 [+ IF check_multilibs
1159 +]echo "Checking multilib configuration for [+module+]..."; \
1160 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1161 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \
1162 if test -r [+subdir+]/[+module+]/multilib.out; then \
1163 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
1164 rm -f [+subdir+]/[+module+]/multilib.tmp; \
1166 rm -f [+subdir+]/[+module+]/Makefile; \
1167 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1170 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1172 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
1173 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1174 [+exports+] [+extra_exports+] \
1175 echo Configuring in [+subdir+]/[+module+]; \
1176 cd "[+subdir+]/[+module+]" || exit 1; \
1178 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1179 *) topdir=`echo [+subdir+]/[+module+]/ | \
1180 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1182 module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \
1183 [+ IF no-config-site +]rm -f no-such-file || : ; \
1184 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) \
1185 $$s/$$module_srcdir/configure \
1186 --srcdir=$${topdir}/$$module_srcdir \
1187 [+args+] --build=${build_alias} --host=[+host_alias+] \
1188 --target=[+target_alias+] [+extra_configure_flags+] \
1190 @endif [+prefix+][+module+]
1193 [+ FOR bootstrap_stage +]
1194 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
1195 maybe-configure-stage[+id+]-[+prefix+][+module+]:
1196 @if [+prefix+][+module+]-bootstrap
1197 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
1198 configure-stage[+id+]-[+prefix+][+module+]:
1199 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
1200 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
1201 @r=`${PWD_COMMAND}`; export r; \
1202 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1203 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1204 [+ IF check_multilibs
1205 +]echo "Checking multilib configuration for [+module+]..."; \
1206 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \
1207 if test -r [+subdir+]/[+module+]/multilib.out; then \
1208 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
1209 rm -f [+subdir+]/[+module+]/multilib.tmp; \
1211 rm -f [+subdir+]/[+module+]/Makefile; \
1212 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1215 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1217 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
1218 [+exports+][+ IF prev +] \
1219 [+poststage1_exports+][+ ENDIF prev +][+ IF prefix +] \
1220 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
1221 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
1222 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;[+ ELSE prefix +] \
1223 CFLAGS="$(STAGE[+id+]_CFLAGS)"; export CFLAGS; \
1224 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"; export CXXFLAGS;[+ IF prev +] \
1225 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1226 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +]; export LIBCFLAGS;[+
1227 ENDIF prefix +] [+extra_exports+] \
1228 echo Configuring stage [+id+] in [+subdir+]/[+module+]; \
1229 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1230 cd [+subdir+]/[+module+] || exit 1; \
1232 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1233 *) topdir=`echo [+subdir+]/[+module+]/ | \
1234 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1236 module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \
1237 $(SHELL) $$s/$$module_srcdir/configure \
1238 --srcdir=$${topdir}/$$module_srcdir \
1239 [+args+] --build=${build_alias} --host=[+host_alias+] \
1240 --target=[+target_alias+] \
1241 [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
1242 $(STAGE[+id+]_CONFIGURE_FLAGS)[+ IF extra_configure_flags +] \
1243 [+extra_configure_flags+][+ ENDIF extra_configure_flags +]
1244 @endif [+prefix+][+module+]-bootstrap
1245 [+ ENDFOR bootstrap_stage +]
1246 [+ ENDIF bootstrap +]
1250 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
1251 maybe-all-[+prefix+][+module+]:
1253 all-[+prefix+][+module+]: stage_current
1254 @endif gcc-bootstrap
1255 @if [+prefix+][+module+]
1256 TARGET-[+prefix+][+module+]=[+
1257 IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
1258 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
1259 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
1260 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1261 @r=`${PWD_COMMAND}`; export r; \
1262 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1263 [+exports+] [+extra_exports+] \
1264 (cd [+subdir+]/[+module+] && \
1265 $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+stage1_args+] [+extra_make_flags+] \
1266 $(TARGET-[+prefix+][+module+]))
1267 @endif [+prefix+][+module+]
1270 [+ FOR bootstrap_stage +]
1271 .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
1272 .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
1273 maybe-all-stage[+id+]-[+prefix+][+module+]:
1274 maybe-clean-stage[+id+]-[+prefix+][+module+]:
1275 @if [+prefix+][+module+]-bootstrap
1276 maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
1277 all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
1278 TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
1279 all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
1280 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
1281 @r=`${PWD_COMMAND}`; export r; \
1282 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1283 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1284 [+exports+][+ IF prev +] \
1285 [+poststage1_exports+][+ ENDIF prev +] [+extra_exports+] \
1286 cd [+subdir+]/[+module+] && \
1288 $(MAKE) $(BASE_FLAGS_TO_PASS)[+ IF prefix +] \
1289 CFLAGS="$(CFLAGS_FOR_TARGET)" \
1290 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
1291 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"[+ ELSE prefix +] \
1292 CFLAGS="$(STAGE[+id+]_CFLAGS)" \
1293 GENERATOR_CFLAGS="$(STAGE[+id+]_GENERATOR_CFLAGS)" \
1294 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"[+ IF prev +] \
1295 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1296 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +][+ ENDIF prefix +] \
1297 CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
1298 CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
1299 LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
1300 [+args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \
1301 [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] \
1302 TFLAGS="$(STAGE[+id+]_TFLAGS)" [+profile_data+] \
1303 $(TARGET-stage[+id+]-[+prefix+][+module+])
1305 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
1306 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
1307 clean-stage[+id+]-[+prefix+][+module+]:
1308 @if [ $(current_stage) = stage[+id+] ]; then \
1309 [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
1311 [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
1312 $(MAKE) stage[+id+]-start; \
1314 cd [+subdir+]/[+module+] && \
1315 $(MAKE) [+args+] [+ IF prev +][+poststage1_args+][+ ELSE prev +] \
1316 [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] clean
1317 @endif [+prefix+][+module+]-bootstrap
1319 [+ ENDFOR bootstrap_stage +]
1320 [+ ENDIF bootstrap +]
1323 # --------------------------------------
1324 # Modules which run on the build machine
1325 # --------------------------------------
1326 [+ FOR build_modules +]
1327 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1328 host_alias=(get "host" "${build_alias}")
1329 target_alias=(get "target" "${target_alias}")
1330 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
1332 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1333 args="$(EXTRA_BUILD_FLAGS)" +]
1334 [+ ENDFOR build_module +]
1336 # --------------------------------------
1337 # Modules which run on the host machine
1338 # --------------------------------------
1339 [+ FOR host_modules +]
1340 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
1341 exports="$(HOST_EXPORTS)"
1342 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1343 host_alias=(get "host" "${host_alias}")
1344 target_alias=(get "target" "${target_alias}")
1345 args="$(HOST_CONFIGARGS)" +]
1347 [+ all prefix="" subdir="$(HOST_SUBDIR)"
1348 exports="$(HOST_EXPORTS)"
1349 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1350 args="$(EXTRA_HOST_FLAGS)"
1351 stage1_args="$(STAGE1_FLAGS_TO_PASS)"
1352 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
1354 .PHONY: check-[+module+] maybe-check-[+module+]
1355 maybe-check-[+module+]:
1357 maybe-check-[+module+]: check-[+module+]
1360 [+ ELIF no_check_cross +]
1361 # This module is only tested in a native toolchain.
1363 @: $(MAKE); $(unstage)
1364 @if [ '$(host)' = '$(target)' ]; then \
1365 r=`${PWD_COMMAND}`; export r; \
1366 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1367 $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
1368 ENDIF bootstrap +] \
1369 (cd $(HOST_SUBDIR)/[+module+] && \
1370 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
1371 IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
1375 @: $(MAKE); $(unstage)
1376 @r=`${PWD_COMMAND}`; export r; \
1377 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1378 $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
1379 ENDIF bootstrap +] \
1380 (cd $(HOST_SUBDIR)/[+module+] && \
1381 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
1382 IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
1383 [+ ENDIF no_check +]
1386 .PHONY: install-[+module+] maybe-install-[+module+]
1387 maybe-install-[+module+]:
1389 maybe-install-[+module+]: install-[+module+]
1393 install-[+module+]: installdirs
1394 @: $(MAKE); $(unstage)
1395 @r=`${PWD_COMMAND}`; export r; \
1396 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1398 (cd $(HOST_SUBDIR)/[+module+] && \
1399 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
1400 [+ ENDIF no_install +]
1403 .PHONY: install-strip-[+module+] maybe-install-strip-[+module+]
1404 maybe-install-strip-[+module+]:
1406 maybe-install-strip-[+module+]: install-strip-[+module+]
1408 install-strip-[+module+]:
1410 install-strip-[+module+]: installdirs
1411 @: $(MAKE); $(unstage)
1412 @r=`${PWD_COMMAND}`; export r; \
1413 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1415 (cd $(HOST_SUBDIR)/[+module+] && \
1416 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
1417 [+ ENDIF no_install +]
1420 # Other targets (info, dvi, pdf, etc.)
1421 [+ FOR recursive_targets +]
1422 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1423 maybe-[+make_target+]-[+module+]:
1425 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
1426 [+ IF (match-value? = "missing" (get "make_target") ) +]
1427 # [+module+] doesn't support [+make_target+].
1428 [+make_target+]-[+module+]:
1430 [+make_target+]-[+module+]: [+
1432 [+depend+]-[+module+] [+
1434 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1435 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
1436 r=`${PWD_COMMAND}`; export r; \
1437 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1439 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1440 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1442 echo "Doing [+make_target+] in [+module+]"; \
1443 (cd $(HOST_SUBDIR)/[+module+] && \
1444 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1445 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1446 "RANLIB=$${RANLIB}" \
1447 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1452 [+ ENDFOR recursive_targets +]
1453 [+ ENDFOR host_modules +]
1455 # ---------------------------------------
1456 # Modules which run on the target machine
1457 # ---------------------------------------
1458 [+ FOR target_modules +]
1461 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1462 check_multilibs=true
1463 exports="$(RAW_CXX_TARGET_EXPORTS)"
1464 host_alias=(get "host" "${target_alias}")
1465 target_alias=(get "target" "${target_alias}")
1466 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1468 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1469 exports="$(RAW_CXX_TARGET_EXPORTS)"
1470 args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1472 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1473 check_multilibs=true
1474 exports="$(NORMAL_TARGET_EXPORTS)"
1475 host_alias=(get "host" "${target_alias}")
1476 target_alias=(get "target" "${target_alias}")
1477 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1479 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1480 exports="$(NORMAL_TARGET_EXPORTS)"
1481 args="$(EXTRA_TARGET_FLAGS)" +]
1484 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1485 maybe-check-target-[+module+]:
1486 @if target-[+module+]
1487 maybe-check-target-[+module+]: check-target-[+module+]
1489 # Dummy target for uncheckable module.
1490 check-target-[+module+]:
1492 check-target-[+module+]:
1493 @: $(MAKE); $(unstage)
1494 @r=`${PWD_COMMAND}`; export r; \
1495 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1497 $(RAW_CXX_TARGET_EXPORTS) \[+
1499 $(NORMAL_TARGET_EXPORTS) \[+
1501 (cd $(TARGET_SUBDIR)/[+module+] && \
1502 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1504 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1506 +] [+extra_make_flags+] check)
1507 [+ ENDIF no_check +]
1508 @endif target-[+module+]
1510 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1511 maybe-install-target-[+module+]:
1512 @if target-[+module+]
1513 maybe-install-target-[+module+]: install-target-[+module+]
1515 # Dummy target for uninstallable.
1516 install-target-[+module+]:
1518 install-target-[+module+]: installdirs
1519 @: $(MAKE); $(unstage)
1520 @r=`${PWD_COMMAND}`; export r; \
1521 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1523 $(RAW_CXX_TARGET_EXPORTS) \[+
1525 $(NORMAL_TARGET_EXPORTS) \[+
1527 (cd $(TARGET_SUBDIR)/[+module+] && \
1528 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1529 [+ ENDIF no_install +]
1530 @endif target-[+module+]
1532 .PHONY: install-strip-target-[+module+] maybe-install-strip-target-[+module+]
1533 maybe-install-strip-target-[+module+]:
1534 @if target-[+module+]
1535 maybe-install-strip-target-[+module+]: install-strip-target-[+module+]
1537 # Dummy target for uninstallable.
1538 install-strip-target-[+module+]:
1540 install-strip-target-[+module+]: installdirs
1541 @: $(MAKE); $(unstage)
1542 @r=`${PWD_COMMAND}`; export r; \
1543 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1545 $(RAW_CXX_TARGET_EXPORTS) \[+
1547 $(NORMAL_TARGET_EXPORTS) \[+
1549 (cd $(TARGET_SUBDIR)/[+module+] && \
1550 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
1551 [+ ENDIF no_install +]
1552 @endif target-[+module+]
1554 # Other targets (info, dvi, pdf, etc.)
1555 [+ FOR recursive_targets +]
1556 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1557 maybe-[+make_target+]-target-[+module+]:
1558 @if target-[+module+]
1559 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1560 [+ IF (match-value? = "missing" (get "make_target") ) +]
1561 # [+module+] doesn't support [+make_target+].
1562 [+make_target+]-target-[+module+]:
1564 [+make_target+]-target-[+module+]: [+
1566 [+depend+]-target-[+module+] [+
1568 @: $(MAKE); $(unstage)
1569 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0; \
1570 r=`${PWD_COMMAND}`; export r; \
1571 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1573 $(RAW_CXX_TARGET_EXPORTS) \[+
1575 $(NORMAL_TARGET_EXPORTS) \[+
1577 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]"; \
1578 for flag in $(EXTRA_TARGET_FLAGS); do \
1579 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1581 (cd $(TARGET_SUBDIR)/[+module+] && \
1582 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1583 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1584 "RANLIB=$${RANLIB}" \
1585 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1586 [+extra_make_flags+] [+make_target+]) \
1589 @endif target-[+module+]
1590 [+ ENDFOR recursive_targets +]
1591 [+ ENDFOR target_modules +]
1594 .PHONY: check-target-libgomp-c++
1595 check-target-libgomp-c++:
1596 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libgomp
1598 .PHONY: check-target-libgomp-fortran
1599 check-target-libgomp-fortran:
1600 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) fortran.exp" check-target-libgomp
1602 @endif target-libgomp
1605 .PHONY: check-target-libitm-c++
1606 check-target-libitm-c++:
1607 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libitm
1609 @endif target-libitm
1615 @if gcc-no-bootstrap
1617 cross: all-build all-gas all-ld
1618 @r=`${PWD_COMMAND}`; export r; \
1619 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1621 echo "Building the C and C++ compiler"; \
1622 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1623 @r=`${PWD_COMMAND}`; export r; \
1624 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1625 echo "Building runtime libraries"; \
1626 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1627 @endif gcc-no-bootstrap
1631 .PHONY: check-gcc-[+language+] check-[+language+]
1632 check-gcc-[+language+]:
1633 r=`${PWD_COMMAND}`; export r; \
1634 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1636 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]);
1637 check-[+language+]: check-gcc-[+language+][+ FOR lib-check-target +] [+ lib-check-target +][+ ENDFOR lib-check-target +]
1638 [+ ENDFOR languages +]
1640 # The gcc part of install-no-fixedincludes, which relies on an intimate
1641 # knowledge of how a number of gcc internal targets (inter)operate. Delegate.
1642 .PHONY: gcc-install-no-fixedincludes
1643 gcc-install-no-fixedincludes:
1644 @if [ -f ./gcc/Makefile ]; then \
1645 r=`${PWD_COMMAND}`; export r; \
1646 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1649 && $(MAKE) $(GCC_FLAGS_TO_PASS) install-no-fixedincludes); \
1653 # ---------------------
1654 # GCC bootstrap support
1655 # ---------------------
1657 # We track the current stage (the one in 'gcc') in the stage_current file.
1658 # stage_last instead tracks the stage that was built last. These targets
1659 # are dummy when toplevel bootstrap is not active.
1661 # While making host and target tools, symlinks to the final stage must be
1662 # there, so $(unstage) should be run at various points. To avoid excessive
1663 # recursive invocations of make, we "inline" them using a variable. These
1664 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1665 # to avoid warnings from the GNU Make job server.
1672 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1673 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1674 current_stage = "`cat stage_current 2> /dev/null`"
1675 @endif gcc-bootstrap
1677 .PHONY: unstage stage
1679 @: $(MAKE); $(unstage)
1681 @: $(MAKE); $(stage)
1683 # Disable commands for lean bootstrap.
1686 # We name the build directories for the various stages "stage1-gcc",
1687 # "stage2-gcc","stage3-gcc", etc.
1689 # Since the 'compare' process will fail (on debugging information) if any
1690 # directory names are different, we need to link the gcc directory for
1691 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1692 # the build directories constant as well. For the latter, we use naked names
1693 # like 'gcc', because the scripts in that directory assume it. We use
1694 # mv on platforms where symlinks to directories do not work or are not
1697 # 'touch' doesn't work right on some platforms.
1698 STAMP = echo timestamp >
1700 # We only want to compare .o files, so set this!
1703 [+ FOR bootstrap-stage +]
1704 .PHONY: stage[+id+]-start stage[+id+]-end
1707 @: $(MAKE); $(stage); \
1708 echo stage[+id+] > stage_current; \
1709 echo stage[+id+] > stage_last; \
1710 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1711 FOR host_modules +][+ IF bootstrap +]
1713 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1714 mkdir stage[+id+]-[+module+]; \
1715 mv stage[+id+]-[+module+] [+module+][+ IF prev +]; \
1716 mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1717 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1718 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1719 mkdir stage[+id+]-$(TARGET_SUBDIR); \
1720 mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR)[+ IF prev +]; \
1721 mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1723 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1725 @if test -d $(HOST_SUBDIR)/[+module+]; then \
1726 cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+][+ IF prev +]; \
1727 mv prev-[+module+] stage[+prev+]-[+module+]; : [+ ENDIF prev +]; \
1729 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1730 @if test -d $(TARGET_SUBDIR); then \
1731 mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR)[+ IF prev +]; \
1732 mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR); : [+ ENDIF prev +]; \
1736 # Bubble a bug fix through all the stages up to stage [+id+]. They are
1737 # remade, but not reconfigured. The next stage (if any) will not be
1738 # reconfigured either.
1739 .PHONY: stage[+id+]-bubble
1740 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1741 @r=`${PWD_COMMAND}`; export r; \
1742 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1743 if test -f stage[+id+]-lean [+
1744 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +]; then \
1745 echo Skipping rebuild of stage[+id+]; \
1747 $(MAKE) stage[+id+]-start; \[+IF lean +]
1749 rm -rf stage[+lean+]-*; \
1750 $(STAMP) stage[+lean+]-lean; \
1751 fi; \[+ ENDIF lean +]
1752 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1753 fi[+ IF compare-target +]
1754 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1756 .PHONY: all-stage[+id+] clean-stage[+id+]
1757 do-clean: clean-stage[+id+]
1759 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1760 # only possibility, but now it conflicts with no-bootstrap rules
1762 [+ IF compare-target +]
1764 @r=`${PWD_COMMAND}`; export r; \
1765 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1766 if test -f stage[+prev+]-lean; then \
1767 echo Cannot compare object files as stage [+prev+] was deleted.; \
1770 : $(MAKE); $(stage); \
1771 rm -f .bad_compare; \
1772 echo Comparing stages [+prev+] and [+id+]; \
1773 sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \
1774 files=`find stage[+id+]-* -name "*$(objext)" -print | \
1775 sed -n s,^stage$$sed-,,p`; \
1776 for file in $${files} ${extra-compare}; do \
1777 f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \
1778 if test ! -f $$f1; then continue; fi; \
1779 $(do-[+compare-target+]) > /dev/null 2>&1; \
1780 if test $$? -eq 1; then \
1782 @compare_exclusions@) \
1783 echo warning: $$file differs ;; \
1785 echo $$file differs >> .bad_compare ;; \
1789 if [ -f .bad_compare ]; then \
1790 echo "Bootstrap comparison failure!"; \
1794 echo Comparison successful.; \
1796 $(STAMP) [+compare-target+][+ IF prev +]
1798 rm -rf stage[+prev+]-*; \
1799 $(STAMP) stage[+prev+]-lean; \
1801 [+ ENDIF compare-target +]
1803 [+ IF bootstrap-target +]
1804 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1805 [+bootstrap-target+]:
1806 echo stage[+id+] > stage_final
1807 @r=`${PWD_COMMAND}`; export r; \
1808 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1809 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1810 @: $(MAKE); $(unstage)
1811 @r=`${PWD_COMMAND}`; export r; \
1812 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1813 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1814 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1816 [+bootstrap-target+]-lean:
1817 echo stage[+id+] > stage_final
1818 @r=`${PWD_COMMAND}`; export r; \
1819 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1820 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1821 @: $(MAKE); $(unstage)
1822 @r=`${PWD_COMMAND}`; export r; \
1823 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1824 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1825 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1826 [+ ENDIF bootstrap-target +]
1828 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1829 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1830 .PHONY: distclean-stage[+id+]
1831 distclean-stage[+id+]::
1832 @: $(MAKE); $(stage)
1833 @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1834 rm -rf stage[+id+]-* [+
1835 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1837 [+ IF cleanstrap-target +]
1838 .PHONY: [+cleanstrap-target+]
1839 [+cleanstrap-target+]: do-distclean local-clean
1840 echo stage[+id+] > stage_final
1841 @r=`${PWD_COMMAND}`; export r; \
1842 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1843 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1844 @: $(MAKE); $(unstage)
1845 @r=`${PWD_COMMAND}`; export r; \
1846 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1847 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1848 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1849 [+ ENDIF cleanstrap-target +]
1850 @endif gcc-bootstrap
1852 [+ ENDFOR bootstrap-stage +]
1855 $(MAKE) distclean-stagefeedback
1857 stagefeedback-start::
1858 @r=`${PWD_COMMAND}`; export r; \
1859 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1860 for i in prev-*; do \
1861 j=`echo $$i | sed s/^prev-//`; \
1863 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL); } && \
1864 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL); }; \
1868 do-distclean: distclean-stage1
1870 # Provide a GCC build when we're building target libraries. This does
1871 # not work as a dependency, just as the minimum necessary to avoid errors.
1873 @r=`${PWD_COMMAND}`; export r; \
1874 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1875 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1877 # Same as unstage, but not phony and defaulting to stage1-start. We place
1878 # it in the dependency so that for example `make -j3 all-gcc' works.
1880 @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1884 @: $(MAKE); $(stage)
1885 rm -rf stage1-$(TARGET_SUBDIR)[+ FOR bootstrap-stage +][+ IF prev
1886 +] stage[+id+]-*[+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1888 @endif gcc-bootstrap
1890 # --------------------------------------
1891 # Dependencies between different modules
1892 # --------------------------------------
1894 # Generic dependencies for target modules on host stuff, especially gcc
1895 @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1896 +][+ FOR bootstrap_stage +]
1897 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1898 ENDFOR +][+ ELSE bootstrap +]
1899 configure-target-[+module+]: stage_last[+
1900 ENDIF bootstrap +][+ ENDFOR target_modules +]
1901 @endif gcc-bootstrap
1903 @if gcc-no-bootstrap[+ FOR target_modules +]
1904 configure-target-[+module+]: maybe-all-gcc[+
1905 ENDFOR target_modules +]
1906 @endif gcc-no-bootstrap
1909 # There are two types of dependencies here: 'hard' dependencies, where one
1910 # module simply won't build without the other; and 'soft' dependencies, where
1911 # if the depended-on module is missing, the depending module will do without
1912 # or find a substitute somewhere (perhaps installed). Soft dependencies
1913 # are made here to depend on a 'maybe-' target. If you're not sure,
1914 # it's safer to use a soft dependency.
1916 [+ ;; These Scheme functions build the bulk of the dependencies.
1917 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1918 ;; where "maybe-" is only included if HARD is not true, and all-gcc
1919 ;; is taken from VAR-NAME.
1920 (define dep-target (lambda (module-kind var-name hard)
1922 (if hard "" "maybe-")
1923 (dep-subtarget var-name)
1925 (dep-module var-name)
1928 ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1929 (define make-dep (lambda (module-kind on-kind)
1931 (dep-target module-kind "module" #t) ": "
1932 (dep-target on-kind "on" (exist? "hard")))))
1934 ;; dep-subtarget extracts everything up to the first dash in the given
1935 ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1936 (define dep-subtarget (lambda (var-name)
1937 (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1939 ;; dep-module extracts everything up to the first dash in the given
1940 ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1941 (define dep-module (lambda (var-name)
1942 (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1944 ;; dep-stage builds a string for the prefix of a bootstrap stage.
1945 (define dep-stage (lambda ()
1951 ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1952 ;; but is written in Scheme.
1953 (define dep-maybe (lambda ()
1954 (if (exist? "hard") "" "maybe-")))
1956 ;; dep-kind returns returns "prebootstrap" for configure or build
1957 ;; dependencies of bootstrapped modules on a build module
1958 ;; (e.g. all-gcc on all-build-bison); "normal" if the dependency is
1959 ;; on an "install" target, or if the dependence module is not
1960 ;; bootstrapped; otherwise, it returns "bootstrap" or
1961 ;; "postbootstrap" depending on whether the dependent module is
1962 ;; bootstrapped. All this is only necessary for host and target
1963 ;; modules. It might seem like, in order to avoid build races, we
1964 ;; might need more elaborate detection between prebootstrap and
1965 ;; postbootstrap modules, but there are no host prebootstrap
1966 ;; modules. If there were any non-bootstrap host modules that
1967 ;; bootstrap modules depended on, we'd get unsatisfied per-stage
1968 ;; dependencies on them, which would be immediately noticed.
1969 (define dep-kind (lambda ()
1971 ((and (hash-ref boot-modules (dep-module "module"))
1972 (=* (dep-module "on") "build-"))
1975 ((or (= (dep-subtarget "on") "install-")
1976 (not (hash-ref boot-modules (dep-module "on"))))
1979 ((hash-ref boot-modules (dep-module "module"))
1982 (1 "postbootstrap"))))
1984 (define make-postboot-dep (lambda ()
1985 (let ((target (dep-module "module")) (dep "stage_last"))
1986 (unless (= (hash-ref postboot-targets target) dep)
1987 (hash-create-handle! postboot-targets target dep)
1988 ;; All non-bootstrap modules' configure target already
1990 (unless (=* target "target-")
1991 (string-append "configure-" target ": " dep "\n"))))))
1993 ;; We now build the hash table that is used by dep-kind.
1994 (define boot-modules (make-hash-table 113))
1995 (define postboot-targets (make-hash-table 113))
1998 [+ FOR host_modules +][+
1999 (if (exist? "bootstrap")
2000 (hash-create-handle! boot-modules (get "module") #t))
2001 "" +][+ ENDFOR host_modules +]
2002 [+ FOR target_modules +][+
2003 (if (exist? "bootstrap")
2004 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
2005 "" +][+ ENDFOR target_modules +]
2007 # With all the machinery above in place, it is pretty easy to generate
2008 # dependencies. Host dependencies are a bit more complex because we have
2009 # to check for bootstrap/prebootstrap dependencies. To resolve
2010 # prebootstrap dependencies, prebootstrap modules are gathered in
2012 [+ FOR dependencies +][+ CASE (dep-kind) +]
2013 [+ == "prebootstrap" +][+ (make-dep "" "") +][+ FOR bootstrap_stage +]
2014 [+ (make-dep (dep-stage) "") +][+ ENDFOR bootstrap_stage +]
2015 [+ == "bootstrap" +][+ (make-dep "" "") +][+ FOR bootstrap_stage +]
2016 [+ (make-dep (dep-stage) (dep-stage)) +][+ ENDFOR bootstrap_stage +]
2017 [+ == "normal" +][+ (make-dep "" "") +]
2018 [+ ESAC +][+ ENDFOR dependencies +]
2021 [+ FOR dependencies +][+ CASE (dep-kind) +]
2022 [+ == "postbootstrap" +][+ (make-postboot-dep) +][+ ESAC +][+
2023 ENDFOR dependencies +]@endif gcc-bootstrap
2025 @unless gcc-bootstrap
2026 [+ FOR dependencies +][+ CASE (dep-kind) +]
2027 [+ == "postbootstrap" +][+ (make-dep "" "") +]
2028 [+ ESAC +][+ ENDFOR dependencies +]@endunless gcc-bootstrap
2030 # Dependencies for target modules on other target modules are
2031 # described by lang_env_dependencies; the defaults apply to anything
2032 # not mentioned there.
2034 ;; Predicate for whether LANG was specified in lang_env_dependencies.
2035 (define lang-dep (lambda (lang)
2036 (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
2038 ;; Build the hash table we will need.
2039 (define lang-env-deps (make-hash-table 7))
2040 +][+ FOR lang_env_dependencies +][+
2042 (hash-create-handle! lang-env-deps
2043 (string-append (get "module") "-" "cxx") #t))
2046 (hash-create-handle! lang-env-deps
2047 (string-append (get "module") "-" "no_c") #t))
2049 (if (exist? "no_gcc")
2050 (hash-create-handle! lang-env-deps
2051 (string-append (get "module") "-" "no_gcc") #t))
2052 "" +][+ ENDFOR lang_env_dependencies +]
2054 @if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
2055 +][+ IF bootstrap +][+ FOR bootstrap_stage +]
2056 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
2057 ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
2058 @endif gcc-bootstrap
2060 @if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
2061 configure-target-[+module+]: maybe-all-target-libgcc[+
2062 ENDIF +][+ ENDFOR target_modules +]
2063 @endif gcc-no-bootstrap
2065 [+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
2066 configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
2067 ENDIF +][+ IF (lang-dep "cxx") +]
2068 configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
2070 [+ ENDFOR target_modules +]
2072 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
2074 INSTALL_GDB_TK = @INSTALL_GDB_TK@
2075 configure-gdb: $(CONFIGURE_GDB_TK)
2076 all-gdb: $(gdbnlmrequirements) $(GDB_TK)
2077 install-gdb: $(INSTALL_GDB_TK)
2079 # Serialization dependencies. Host configures don't work well in parallel to
2080 # each other, due to contention over config.cache. Target configures and
2081 # build configures are similar.
2082 @serialization_dependencies@
2084 # --------------------------------
2085 # Regenerating top level configury
2086 # --------------------------------
2088 # Rebuilding Makefile.in, using autogen.
2090 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
2091 cd $(srcdir) && $(AUTOGEN) Makefile.def
2093 # Rebuilding Makefile.
2094 Makefile: $(srcdir)/Makefile.in config.status
2095 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
2097 config.status: configure
2098 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
2100 # Rebuilding configure.
2102 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
2103 $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
2104 $(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
2105 $(srcdir)/config/gcc-plugin.m4 \
2106 $(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
2107 $(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
2108 cd $(srcdir) && $(AUTOCONF)
2110 # ------------------------------
2111 # Special directives to GNU Make
2112 # ------------------------------
2114 # Don't pass command-line variables to submakes.
2118 # end of Makefile.in