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, 2023
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@
45 host_alias=@host_noncanonical@
46 host_vendor=@host_vendor@
49 target_alias=@target_noncanonical@
50 target_vendor=@target_vendor@
54 program_transform_name = @program_transform_name@
57 exec_prefix = @exec_prefix@
63 libexecdir = @libexecdir@
65 sysconfdir = @sysconfdir@
66 sharedstatedir = @sharedstatedir@
67 localstatedir = @localstatedir@
69 includedir = @includedir@
70 oldincludedir = @oldincludedir@
72 datarootdir = @datarootdir@
77 man1dir = $(mandir)/man1
78 man2dir = $(mandir)/man2
79 man3dir = $(mandir)/man3
80 man4dir = $(mandir)/man4
81 man5dir = $(mandir)/man5
82 man6dir = $(mandir)/man6
83 man7dir = $(mandir)/man7
84 man8dir = $(mandir)/man8
85 man9dir = $(mandir)/man9
88 INSTALL_PROGRAM = @INSTALL_PROGRAM@
89 INSTALL_SCRIPT = @INSTALL_SCRIPT@
90 INSTALL_DATA = @INSTALL_DATA@
94 MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
95 MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
97 # -------------------------------------------------
98 # Miscellaneous non-standard autoconf-set variables
99 # -------------------------------------------------
101 # The gcc driver likes to know the arguments it was configured with.
102 TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
105 build_tooldir = @build_tooldir@
107 # This is the name of the environment variable used for the path to
109 RPATH_ENVVAR = @RPATH_ENVVAR@
111 # On targets where RPATH_ENVVAR is PATH, a subdirectory of the GCC build path
112 # is used instead of the directory itself to avoid including built
113 # executables in PATH.
114 GCC_SHLIB_SUBDIR = @GCC_SHLIB_SUBDIR@
116 # If the build should make suitable code for shared host resources.
117 host_shared = @host_shared@
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; \
151 GUILE="$(GUILE)"; export GUILE;
153 # This is the list of variables to export in the environment when
154 # configuring subdirectories for the build system.
157 AR="$(AR_FOR_BUILD)"; export AR; \
158 AS="$(AS_FOR_BUILD)"; export AS; \
159 CC="$(CC_FOR_BUILD)"; export CC; \
160 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
161 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
162 CPP="$(CPP_FOR_BUILD)"; export CPP; \
163 CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
164 CXX="$(CXX_FOR_BUILD)"; export CXX; \
165 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
166 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
167 GOC="$(GOC_FOR_BUILD)"; export GOC; \
168 GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
169 GDC="$(GDC_FOR_BUILD)"; export GDC; \
170 GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \
171 GM2="$(GM2_FOR_BUILD)"; export GM2; \
172 GM2FLAGS="$(GM2FLAGS_FOR_BUILD)"; export GM2FLAGS; \
173 DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
174 DSYMUTIL="$(DSYMUTIL_FOR_BUILD)"; export DSYMUTIL; \
175 LD="$(LD_FOR_BUILD)"; export LD; \
176 LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
177 NM="$(NM_FOR_BUILD)"; export NM; \
178 RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
179 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
180 WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
182 # These variables must be set on the make command line for directories
183 # built for the build system to override those in BASE_FLAGS_TO_PASS.
184 EXTRA_BUILD_FLAGS = \
185 CFLAGS="$(CFLAGS_FOR_BUILD)" \
186 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
188 # This is the list of directories to built for the host system.
189 SUBDIRS = @configdirs@
190 TARGET_CONFIGDIRS = @target_configdirs@
191 # This is set by the configure script to the arguments to use when configuring
192 # directories built for the host system.
193 HOST_CONFIGARGS = @host_configargs@
194 # Host programs are put under this directory, which is . except if building
196 HOST_SUBDIR = @host_subdir@
197 # This is the list of variables to export in the environment when
198 # configuring subdirectories for the host system. We need to pass
199 # some to the GCC configure because of its hybrid host/target nature.
202 CC="$(CC)"; export CC; \
203 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
204 CRAB1_LIBS="$(CRAB1_LIBS)"; export CRAB1_LIBS; \
205 CFLAGS="$(CFLAGS)"; export CFLAGS; \
206 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
207 CXX="$(CXX)"; export CXX; \
208 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
209 GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
210 GOC="$(GOC)"; export GOC; \
211 GDC="$(GDC)"; export GDC; \
212 GM2="$(GM2)"; export GM2; \
213 GNATMAKE_FOR_BUILD="$(GNATMAKE_FOR_BUILD)"; export GNATMAKE_FOR_BUILD; \
214 AR="$(AR)"; export AR; \
215 AS="$(AS)"; export AS; \
216 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
217 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
218 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
219 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
220 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
221 DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
222 LD="$(LD)"; export LD; \
223 LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
224 NM="$(NM)"; export NM; \
225 RANLIB="$(RANLIB)"; export RANLIB; \
226 WINDRES="$(WINDRES)"; export WINDRES; \
227 WINDMC="$(WINDMC)"; export WINDMC; \
228 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
229 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
230 OTOOL="$(OTOOL)"; export OTOOL; \
231 PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
232 READELF="$(READELF)"; export READELF; \
233 AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
234 AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
235 DSYMUTIL_FOR_TARGET="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL_FOR_TARGET; \
236 GCC_FOR_TARGET="$(GCC_FOR_TARGET) $$TFLAGS"; export GCC_FOR_TARGET; \
237 LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
238 NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
239 OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
240 OBJCOPY_FOR_TARGET="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY_FOR_TARGET; \
241 OTOOL_FOR_TARGET="$(OTOOL_FOR_TARGET)"; export OTOOL_FOR_TARGET; \
242 RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
243 READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
244 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
245 HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
246 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
247 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
248 ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
249 ISLINC="$(HOST_ISLINC)"; export ISLINC; \
250 XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \
252 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
254 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
256 POSTSTAGE1_CXX_EXPORT = \
257 CXX='$(CXX)'; export CXX; \
258 CXX_FOR_BUILD='$(CXX_FOR_BUILD)'; export CXX_FOR_BUILD;
259 @if target-libstdc++-v3-bootstrap
260 # Override the above if we're bootstrapping C++.
261 POSTSTAGE1_CXX_EXPORT = \
262 CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xg++$(exeext) \
263 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \
264 -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
265 -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
266 `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \
267 `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \
268 `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$s/libstdc++-v3/libsupc++ \
269 -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
270 -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \
272 CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD;
273 @endif target-libstdc++-v3-bootstrap
275 # Similar, for later GCC stages.
276 POSTSTAGE1_HOST_EXPORTS = \
278 CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
279 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ \
280 $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
281 CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \
282 $(POSTSTAGE1_CXX_EXPORT) \
284 GDC="$$r/$(HOST_SUBDIR)/prev-gcc/gdc$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
285 -B$(build_tooldir)/bin/ $(GDCFLAGS_FOR_TARGET) \
286 -B$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime/gcc \
287 -B$$r/prev-$(TARGET_SUBDIR)/libphobos/src \
288 -B$$r/prev-$(TARGET_SUBDIR)/libphobos/src/.libs \
289 -I$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime -I$$s/libphobos/libdruntime \
290 -L$$r/prev-$(TARGET_SUBDIR)/libphobos/src/.libs \
291 -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
292 -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs"; \
294 GDC_FOR_BUILD="$$GDC"; export GDC_FOR_BUILD; \
295 GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \
296 LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \
297 HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS;
299 # Target libraries are put under this directory:
300 TARGET_SUBDIR = @target_subdir@
301 # This is set by the configure script to the arguments to use when configuring
302 # directories built for the target.
303 TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
304 # This is the list of variables to export in the environment when
305 # configuring subdirectories for the target system.
306 BASE_TARGET_EXPORTS = \
308 AR="$(AR_FOR_TARGET)"; export AR; \
309 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
310 CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
311 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
312 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
313 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
314 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
315 GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
316 GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
317 GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \
318 GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \
319 GNATMAKE_FOR_BUILD="$(GNATMAKE_FOR_BUILD)"; export GNATMAKE_FOR_BUILD; \
320 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
321 DSYMUTIL="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL; \
322 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
323 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
324 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
325 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
326 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
327 OBJCOPY="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY; \
328 OTOOL="$(OTOOL_FOR_TARGET)"; export OTOOL; \
329 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
330 READELF="$(READELF_FOR_TARGET)"; export READELF; \
331 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
332 SYSROOT_CFLAGS_FOR_TARGET="$(SYSROOT_CFLAGS_FOR_TARGET)"; export SYSROOT_CFLAGS_FOR_TARGET; \
333 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
334 WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
336 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
338 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
339 TARGET_CONFIGDIRS="$(TARGET_CONFIGDIRS)"; export TARGET_CONFIGDIRS;
341 RAW_CXX_TARGET_EXPORTS = \
342 $(BASE_TARGET_EXPORTS) \
343 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
344 CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
346 NORMAL_TARGET_EXPORTS = \
347 $(BASE_TARGET_EXPORTS) \
348 CXX_FOR_TARGET="$(CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
349 CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
352 HOST_GMPLIBS = @gmplibs@
353 HOST_GMPINC = @gmpinc@
356 HOST_ISLLIBS = @isllibs@
357 HOST_ISLINC = @islinc@
359 # ----------------------------------------------
360 # Programs producing files for the BUILD machine
361 # ----------------------------------------------
365 # pwd command to use. Allow user to override default by setting PWDCMD in
366 # the environment to account for automounters. The make variable must not
367 # be called PWDCMD, otherwise the value set here is passed to make
368 # subprocesses and overrides the setting from the user's environment.
369 # Don't use PWD since it is a common shell environment variable and we
370 # don't want to corrupt it.
371 PWD_COMMAND = $${PWDCMD-pwd}
373 # compilers to use to create programs which must be run in the build
375 AR_FOR_BUILD = @AR_FOR_BUILD@
376 AS_FOR_BUILD = @AS_FOR_BUILD@
377 CC_FOR_BUILD = @CC_FOR_BUILD@
378 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
379 CPP_FOR_BUILD = @CPP_FOR_BUILD@
380 CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
381 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
382 CXX_FOR_BUILD = @CXX_FOR_BUILD@
383 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
384 DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@
385 GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
386 GOC_FOR_BUILD = @GOC_FOR_BUILD@
387 GDC_FOR_BUILD = @GDC_FOR_BUILD@
388 GM2_FOR_BUILD = @GM2_FOR_BUILD@
389 GNATMAKE_FOR_BUILD = @GNATMAKE_FOR_BUILD@
390 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
391 LD_FOR_BUILD = @LD_FOR_BUILD@
392 NM_FOR_BUILD = @NM_FOR_BUILD@
393 RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@
394 WINDMC_FOR_BUILD = @WINDMC_FOR_BUILD@
395 WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@
397 # Special variables passed down in EXTRA_GCC_FLAGS. They are defined
398 # here so that they can be overridden by Makefile fragments.
399 BUILD_PREFIX = @BUILD_PREFIX@
400 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
402 # Flags to pass to stage2 and later makes. They are defined
403 # here so that they can be overridden by Makefile fragments.
406 BOOT_ADAFLAGS= -gnatpg
415 MAKEINFO = @MAKEINFO@
419 AUTO_PROFILE = gcc-auto-profile --all -c 10000000
421 # This just becomes part of the MAKEINFO definition passed down to
422 # sub-makes. It lets flags be given on the command line while still
423 # using the makeinfo from the object tree.
424 # (Default to avoid splitting info files by setting the threshold high.)
425 MAKEINFOFLAGS = --split-size=5000000
427 # ---------------------------------------------
428 # Programs producing files for the HOST machine
429 # ---------------------------------------------
432 AR = @AR@ @AR_PLUGIN_OPTION@
437 DSYMUTIL = @DSYMUTIL@
443 RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
450 GNATBIND = @GNATBIND@
451 GNATMAKE = @GNATMAKE@
455 LIBCFLAGS = $(CFLAGS)
456 CXXFLAGS = @CXXFLAGS@
457 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
459 GDCFLAGS = @GDCFLAGS@
462 CRAB1_LIBS = @CRAB1_LIBS@
464 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
468 # Pass additional PGO and LTO compiler options to the PGO build.
469 BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
470 override CFLAGS += $(BUILD_CFLAGS)
471 override CXXFLAGS += $(BUILD_CFLAGS)
473 # Additional PGO and LTO compiler options to generate profiling data
475 PGO_BUILD_GEN_FLAGS_TO_PASS = \
476 PGO_BUILD_CFLAGS="@PGO_BUILD_GEN_CFLAGS@" \
477 PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@"
479 # NB: Filter out any compiler options which may fail PGO training runs.
480 PGO_BUILD_TRAINING_CFLAGS:= \
481 $(filter-out -Werror=%,$(CFLAGS))
482 PGO_BUILD_TRAINING_CXXFLAGS:=\
483 $(filter-out -Werror=%,$(CXXFLAGS))
484 PGO_BUILD_TRAINING_CFLAGS:= \
485 $(filter-out -Wall,$(PGO_BUILD_TRAINING_CFLAGS))
486 PGO_BUILD_TRAINING_CXXFLAGS:= \
487 $(filter-out -Wall,$(PGO_BUILD_TRAINING_CXXFLAGS))
488 PGO_BUILD_TRAINING_CFLAGS:= \
489 $(filter-out -specs=%,$(PGO_BUILD_TRAINING_CFLAGS))
490 PGO_BUILD_TRAINING_CXXFLAGS:= \
491 $(filter-out -specs=%,$(PGO_BUILD_TRAINING_CXXFLAGS))
492 PGO_BUILD_TRAINING_FLAGS_TO_PASS = \
493 PGO_BUILD_TRAINING=yes \
494 CFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CFLAGS)" \
495 CXXFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CXXFLAGS)"
497 # Ignore "make check" errors in PGO training runs.
498 PGO_BUILD_TRAINING_MFLAGS = -i
500 # Additional PGO and LTO compiler options to use profiling data for the
502 PGO_BUILD_USE_FLAGS_TO_PASS = \
503 PGO_BUILD_CFLAGS="@PGO_BUILD_USE_CFLAGS@" \
504 PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@"
506 # PGO training targets for the PGO build. FIXME: Add gold tests to
508 PGO-TRAINING-TARGETS = binutils gas gdb ld sim
509 PGO_BUILD_TRAINING = $(addprefix maybe-check-,$(PGO-TRAINING-TARGETS))
511 CREATE_GCOV = create_gcov
512 PROFILE_MERGER = profile_merger
516 # Defaults for all stages; some are overridden below.
518 STAGE_CFLAGS = $(BOOT_CFLAGS)
519 STAGE_TFLAGS = $(TFLAGS)
520 STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
522 [+ FOR bootstrap-stage +]
523 # Defaults for stage [+id+]; some are overridden below.
524 STAGE[+id+]_CFLAGS = $(STAGE_CFLAGS)
525 STAGE[+id+]_CXXFLAGS = $(CXXFLAGS)
526 @if target-libstdc++-v3-bootstrap
527 # Override the above if we're bootstrapping C++.
528 STAGE[+id+]_CXXFLAGS = $(STAGE[+id+]_CFLAGS)
529 @endif target-libstdc++-v3-bootstrap
530 STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS)
531 STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
532 [+ ENDFOR bootstrap-stage +]
534 # By default, C and C++ are the only stage1 languages, because they are the
535 # only ones we require to build with the bootstrap compiler, and also the
536 # only ones useful for building stage2.
538 STAGE1_CFLAGS = @stage1_cflags@
539 STAGE1_CHECKING = @stage1_checking@
540 STAGE1_LANGUAGES = @stage1_languages@
541 # * We force-disable coverage flags, since the installed compiler probably
542 # has never heard of them. Luckily, autoconf always respects the last
543 # argument when conflicting --enable arguments are passed.
544 # * We also disable -Wformat, since older GCCs don't understand newer %s.
545 STAGE1_CONFIGURE_FLAGS = $(STAGE1_CHECKING) \
546 --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" \
547 --disable-build-format-warnings
549 @if target-libphobos-bootstrap
550 STAGE1_CONFIGURE_FLAGS += --with-libphobos-druntime-only
551 STAGE2_CONFIGURE_FLAGS += --with-libphobos-druntime-only
552 @endif target-libphobos-bootstrap
554 # When using the slow stage1 compiler disable IL verification and forcefully
555 # enable it when using the stage2 compiler instead. As we later compare
556 # stage2 and stage3 we are merely avoid doing redundant work, plus we apply
557 # checking when building all target libraries for release builds.
558 STAGE1_TFLAGS += -fno-checking
559 STAGE2_CFLAGS += -fno-checking
560 STAGE2_TFLAGS += -fno-checking
561 STAGE3_CFLAGS += -fchecking=1
562 STAGE3_TFLAGS += -fchecking=1
564 STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
565 STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
567 STAGEtrain_CFLAGS = $(filter-out -fchecking=1,$(STAGE3_CFLAGS))
568 STAGEtrain_TFLAGS = $(filter-out -fchecking=1,$(STAGE3_TFLAGS))
570 STAGEfeedback_CFLAGS = $(STAGE4_CFLAGS) -fprofile-use -fprofile-reproducible=parallel-runs
571 STAGEfeedback_TFLAGS = $(STAGE4_TFLAGS)
572 # Disable warnings as errors for a few reasons:
573 # - sources for gen* binaries do not have .gcda files available
574 # - inlining decisions generate extra warnings
575 STAGEfeedback_CONFIGURE_FLAGS = $(filter-out --enable-werror-always,$(STAGE_CONFIGURE_FLAGS))
577 STAGEautoprofile_CFLAGS = $(filter-out -gtoggle,$(STAGE2_CFLAGS)) -g
578 STAGEautoprofile_TFLAGS = $(STAGE2_TFLAGS)
580 STAGEautofeedback_CFLAGS = $(STAGE3_CFLAGS)
581 STAGEautofeedback_TFLAGS = $(STAGE3_TFLAGS)
582 # Disable warnings as errors since inlining decisions with -fauto-profile
583 # may result in additional warnings.
584 STAGEautofeedback_CONFIGURE_FLAGS = $(filter-out --enable-werror-always,$(STAGE_CONFIGURE_FLAGS))
586 do-compare = @do_compare@
587 do-compare3 = $(do-compare)
589 # -----------------------------------------------
590 # Programs producing files for the TARGET machine
591 # -----------------------------------------------
593 AR_FOR_TARGET=@AR_FOR_TARGET@
594 AS_FOR_TARGET=@AS_FOR_TARGET@
595 CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@
597 # If GCC_FOR_TARGET is not overriden on the command line, then this
598 # variable is passed down to the gcc Makefile, where it is used to
599 # build libgcc2.a. We define it here so that it can itself be
600 # overridden on the command line.
601 GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@
602 CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@
603 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
604 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
605 GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
606 GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@
607 GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@
608 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
609 DSYMUTIL_FOR_TARGET=@DSYMUTIL_FOR_TARGET@
610 LD_FOR_TARGET=@LD_FOR_TARGET@
612 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
613 NM_FOR_TARGET=@NM_FOR_TARGET@
614 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
615 OBJCOPY_FOR_TARGET=@OBJCOPY_FOR_TARGET@
616 OTOOL_FOR_TARGET=@OTOOL_FOR_TARGET@
617 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
618 READELF_FOR_TARGET=@READELF_FOR_TARGET@
619 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
620 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
621 WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
623 COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
624 COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
625 COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
627 CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
628 CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
630 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
631 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
632 LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
633 GM2FLAGS_FOR_TARGET = -O2 -g
634 GOCFLAGS_FOR_TARGET = -O2 -g
635 GDCFLAGS_FOR_TARGET = -O2 -g
637 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
638 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
639 DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
641 XGCC_FLAGS_FOR_TARGET = $(FLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
643 # ------------------------------------
644 # Miscellaneous targets and flag lists
645 # ------------------------------------
647 # The first rule in the file had better be this one. Don't put any above it.
648 # This lives here to allow makefile fragments to contain dependencies.
651 #### host and target specific makefile fragments come in here.
652 @target_makefile_frag@
658 # This is the list of directories that may be needed in RPATH_ENVVAR
659 # so that programs built for the target machine work.
660 TARGET_LIB_PATH = [+ FOR target_modules +][+
661 IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
662 ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
663 [+ FOR target_modules +][+ IF lib_path +]
664 @if target-[+module+]
665 TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
666 @endif target-[+module+]
667 [+ ENDIF lib_path +][+ ENDFOR target_modules +]
670 # This is the list of directories that may be needed in RPATH_ENVVAR
671 # so that programs built for the host machine work.
672 HOST_LIB_PATH = [+ FOR host_modules +][+
673 IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
674 ENDFOR host_modules +]
676 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
678 HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR):
681 [+ FOR host_modules +][+ IF lib_path +]
683 HOST_LIB_PATH_[+module+] = \
684 $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
685 +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
687 [+ ENDIF lib_path +][+ ENDFOR host_modules +]
689 CXX_FOR_TARGET_FLAG_TO_PASS = \
690 "CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
691 @if target-libstdc++-v3
692 # CXX_FOR_TARGET is tricky to get right for target libs that require a
693 # functional C++ compiler. When we recurse, if we expand
694 # CXX_FOR_TARGET before configuring libstdc++-v3, we won't get
695 # libstdc++ include flags from the script. Instead, we get an
696 # -funconfigured-* word, so that we'll get errors if this invalid C++
697 # command line is used for anything, but also so that we can use the
698 # word to decide whether or not to pass on this CXX_FOR_TARGET. If we
699 # don't pass it on, sub-make will use the default definition, that
700 # re-expands it at the time of use, so we'll get it right when we need
701 # it. One potential exception is the expansion of CXX_FOR_TARGET
702 # passed down as part of CXX within TARGET_FLAGS, but this wouldn't
703 # really work, for C++ host programs can't depend on the current-stage
704 # C++ target library.
705 CXX_FOR_TARGET_FLAG_TO_PASS = \
706 $(shell if echo "$(CXX_FOR_TARGET)" | grep " -funconfigured-" > /dev/null; then :; else echo '"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"'; fi)
707 @endif target-libstdc++-v3
709 # Flags to pass down to all sub-makes. STAGE*FLAGS,
710 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
711 # overrideable (for a bootstrap build stage1 also builds gcc.info).
712 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
713 "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
714 "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +][+ FOR bootstrap-stage +] \
715 "STAGE[+id+]_CFLAGS=$(STAGE[+id+]_CFLAGS)" \
716 "STAGE[+id+]_CXXFLAGS=$(STAGE[+id+]_CXXFLAGS)" \
717 "STAGE[+id+]_GENERATOR_CFLAGS=$(STAGE[+id+]_GENERATOR_CFLAGS)" \
718 "STAGE[+id+]_TFLAGS=$(STAGE[+id+]_TFLAGS)"[+ ENDFOR bootstrap-stage +] \
719 $(CXX_FOR_TARGET_FLAG_TO_PASS) \
721 "CONFIG_SHELL=$(SHELL)" \
722 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
723 $(if $(LSAN_OPTIONS),"LSAN_OPTIONS=$(LSAN_OPTIONS)")
725 # We leave this in just in case, but it is not needed anymore.
726 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
728 # Flags to pass down to most sub-makes, in which we're building with
729 # the host environment.
735 'DLLTOOL=$(DLLTOOL)' \
736 'DSYMUTIL=$(DSYMUTIL)' \
737 'GFORTRAN=$(GFORTRAN)' \
744 'OBJDUMP=$(OBJDUMP)' \
747 'READELF=$(READELF)' \
749 'WINDRES=$(WINDRES)' \
751 'CREATE_GCOV=$(CREATE_GCOV)' \
752 'PROFILE_MERGER=$(PROFILE_MERGER)'
754 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
756 # Flags to pass to stage1 or when not bootstrapping.
758 STAGE1_FLAGS_TO_PASS = \
759 LDFLAGS="$${LDFLAGS}" \
760 HOST_LIBS="$${HOST_LIBS}"
762 # Flags to pass to stage2 and later makes.
764 POSTSTAGE1_FLAGS_TO_PASS = \
765 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
766 CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
767 GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \
768 GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \
769 GNATBIND="$${GNATBIND}" \
770 LDFLAGS="$${LDFLAGS}" \
771 HOST_LIBS="$${HOST_LIBS}" \
772 $(LTO_FLAGS_TO_PASS) \
773 "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
776 EXTRA_HOST_EXPORTS = if [ $(current_stage) != stage1 ]; then \
777 $(POSTSTAGE1_HOST_EXPORTS) \
780 EXTRA_BOOTSTRAP_FLAGS = CC="$$CC" CXX="$$CXX" LDFLAGS="$$LDFLAGS"
783 # Flags to pass down to makes which are built with the target environment.
784 # The double $ decreases the length of the command line; those variables
785 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The
786 # *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
787 # so we expand them here.
788 EXTRA_TARGET_FLAGS = \
789 'AR=$$(AR_FOR_TARGET)' \
790 'AS=$(COMPILER_AS_FOR_TARGET)' \
791 'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
792 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
793 'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
794 -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
795 $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
796 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
797 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
798 'DSYMUTIL=$$(DSYMUTIL_FOR_TARGET)' \
799 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
800 'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
801 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
802 'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
803 'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \
804 'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
805 'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \
806 'LD=$(COMPILER_LD_FOR_TARGET)' \
807 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
808 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
809 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
810 'NM=$(COMPILER_NM_FOR_TARGET)' \
811 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
812 'OBJCOPY=$$(OBJCOPY_FOR_TARGET)' \
813 'RANLIB=$$(RANLIB_FOR_TARGET)' \
814 'READELF=$$(READELF_FOR_TARGET)' \
815 'WINDRES=$$(WINDRES_FOR_TARGET)' \
816 'WINDMC=$$(WINDMC_FOR_TARGET)' \
817 'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
818 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
819 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
822 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
824 # Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
825 # unfortunately needs the native compiler and the target ar and
827 # If any variables are added here, they must be added to do-*, below.
828 # The BUILD_* variables are a special case, which are used for the gcc
829 # cross-building scheme.
831 "GCC_FOR_TARGET=$(GCC_FOR_TARGET) $$TFLAGS" \
832 "GM2_FOR_TARGET=$(GM2_FOR_TARGET) $$TFLAGS" \
833 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
834 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
836 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
839 BUILD_CONFIG = @BUILD_CONFIG@
840 ifneq ($(BUILD_CONFIG),)
841 include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk)
845 .PHONY: configure-host
847 FOR host_modules +] \
848 maybe-configure-[+module+][+
849 ENDFOR host_modules +]
850 .PHONY: configure-target
852 FOR target_modules +] \
853 maybe-configure-target-[+module+][+
854 ENDFOR target_modules +]
856 # The target built for a native non-bootstrap build.
859 # --enable-pgo-build enables the PGO build.
860 # 1. First build with -fprofile-generate.
861 # 2. Use "make maybe-check-*" to generate profiling data.
862 # 3. Use "make clean" to remove the previous build.
863 # 4. Rebuild with -fprofile-use.
866 [ -f stage_final ] || echo stage3 > stage_final
867 @r=`${PWD_COMMAND}`; export r; \
868 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
869 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
871 @: $(MAKE); $(unstage)
872 +@r=`${PWD_COMMAND}`; export r; \
873 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
875 if [ -f stage_last ]; then \
876 TFLAGS="$(STAGE$(shell test ! -f stage_last || sed s,^stage,, stage_last)_TFLAGS)"; \
877 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
880 $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
881 $(PGO_BUILD_GEN_FLAGS_TO_PASS) all-host all-target \
883 && $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
884 $(PGO_BUILD_TRAINING_MFLAGS) \
885 $(PGO_BUILD_TRAINING_FLAGS_TO_PASS) \
886 $(PGO_BUILD_TRAINING) \
887 && $(MAKE) $(RECURSE_FLAGS_TO_PASS) clean \
888 && $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
889 $(PGO_BUILD_USE_FLAGS_TO_PASS) all-host all-target \
898 [+ FOR build_modules +]
899 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
902 [+ FOR host_modules +][+ IF bootstrap +]
903 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
904 all-host: maybe-all-[+module+][+ IF bootstrap +]
905 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
908 [+ FOR target_modules +][+ IF bootstrap +]
909 @if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
910 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
911 @endif target-[+module+]-no-bootstrap[+
912 ENDIF bootstrap +][+ ENDFOR target_modules +]
914 # Do a target for all the subdirectories. A ``make do-X'' will do a
915 # ``make X'' in all subdirectories (because, in general, there is a
916 # dependency (below) of X upon do-X, a ``make X'' will also do this,
917 # but it may do additional work as well).
918 [+ FOR recursive_targets +]
919 .PHONY: do-[+make_target+]
921 @: $(MAKE); $(unstage)
922 @r=`${PWD_COMMAND}`; export r; \
923 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
924 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
925 [+make_target+]-target
928 .PHONY: [+make_target+]-host
929 [+ FOR host_modules +]
930 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
932 .PHONY: [+make_target+]-target
933 [+ FOR target_modules +]
934 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
935 [+ ENDFOR recursive_targets +]
937 # Here are the targets which correspond to the do-X targets.
939 .PHONY: info installcheck dvi pdf html
940 .PHONY: install-info install-dvi install-pdf install-html
941 .PHONY: clean distclean mostlyclean maintainer-clean realclean
942 .PHONY: local-clean local-distclean local-maintainer-clean
944 installcheck: do-installcheck
949 # Make sure makeinfo is built before we do a `make info', if we're
950 # in fact building texinfo.
951 do-info: maybe-all-texinfo
953 install-info: do-install-info dir.info
954 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
955 if [ -f dir.info ]; then \
956 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info; \
959 install-dvi: do-install-dvi
961 install-pdf: do-install-pdf
963 install-html: do-install-html
966 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
969 -rm -f Makefile config.status config.cache mh-frag mt-frag
970 -rm -f maybedep.tmp serdep.tmp stage_final
971 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
972 rm -rf $(TARGET_SUBDIR); \
974 -rm -rf $(BUILD_SUBDIR)
975 -if [ "$(HOST_SUBDIR)" != "." ]; then \
976 rm -rf $(HOST_SUBDIR); \
978 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
979 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
980 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
981 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
982 -rmdir c++tools fastjar gcc gnattools gotools 2>/dev/null
983 -rmdir libcc1 libiberty texinfo zlib 2>/dev/null
984 -find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
986 local-maintainer-clean:
987 @echo "This command is intended for maintainers to use;"
988 @echo "it deletes files that may require special tools to rebuild."
990 clean: do-clean local-clean
991 mostlyclean: do-mostlyclean local-clean
992 distclean: do-distclean local-clean local-distclean
993 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
994 maintainer-clean: local-distclean
995 realclean: maintainer-clean
999 .PHONY: check do-check
1002 # Only include modules actually being configured and built.
1005 FOR host_modules +] \
1006 maybe-check-[+module+][+
1007 ENDFOR host_modules +]
1009 .PHONY: check-target
1011 FOR target_modules +] \
1012 maybe-check-target-[+module+][+
1013 ENDFOR target_modules +]
1016 @: $(MAKE); $(unstage)
1017 @r=`${PWD_COMMAND}`; export r; \
1018 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1019 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
1021 # Automated reporting of test results.
1023 warning.log: build.log
1024 $(srcdir)/contrib/warn_summary build.log > $@
1027 if test x'$(BOOT_CFLAGS)' != x''; then \
1028 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
1030 $(srcdir)/contrib/test_summary -t >$@
1032 echo If you really want to send e-mail, run ./$@ now
1034 mail-report-with-warnings.log: warning.log
1035 if test x'$(BOOT_CFLAGS)' != x''; then \
1036 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
1038 $(srcdir)/contrib/test_summary -t -i warning.log >$@
1040 echo If you really want to send e-mail, run ./$@ now
1044 $(srcdir)/.local.vimrc:
1045 $(LN_S) contrib/vimrc $@
1048 $(LN_S) contrib/vimrc $@
1050 vimrc: $(srcdir)/.local.vimrc $(srcdir)/.lvimrc
1054 # clang-format config
1056 $(srcdir)/.clang-format:
1057 $(LN_S) contrib/clang-format $@
1059 clang-format: $(srcdir)/.clang-format
1061 .PHONY: clang-format
1063 # Installation targets.
1065 .PHONY: install uninstall
1067 @: $(MAKE); $(unstage)
1068 @r=`${PWD_COMMAND}`; export r; \
1069 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1070 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
1072 .PHONY: install-host-nogcc
1073 install-host-nogcc: [+
1074 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
1075 maybe-install-[+module+][+ ENDIF +][+
1076 ENDFOR host_modules +]
1078 .PHONY: install-host
1080 FOR host_modules +] \
1081 maybe-install-[+module+][+
1082 ENDFOR host_modules +]
1084 .PHONY: install-target
1086 FOR target_modules +] \
1087 maybe-install-target-[+module+][+
1088 ENDFOR target_modules +]
1091 @echo "the uninstall target is not supported in this tree"
1094 install.all: install-no-fixedincludes
1095 @if [ -f ./gcc/Makefile ]; then \
1096 r=`${PWD_COMMAND}`; export r; \
1097 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1100 $(MAKE) $(FLAGS_TO_PASS) install-headers); \
1105 # install-no-fixedincludes is used to allow the elaboration of binary packages
1106 # suitable for distribution, where we cannot include the fixed system header
1108 .PHONY: install-no-fixedincludes
1109 install-no-fixedincludes: installdirs install-host-nogcc \
1110 install-target gcc-install-no-fixedincludes
1112 .PHONY: install-strip
1114 @: $(MAKE); $(unstage)
1115 @r=`${PWD_COMMAND}`; export r; \
1116 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1117 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-strip-host install-strip-target
1119 .PHONY: install-strip-host
1120 install-strip-host: [+
1121 FOR host_modules +] \
1122 maybe-install-strip-[+module+][+
1123 ENDFOR host_modules +]
1125 .PHONY: install-strip-target
1126 install-strip-target: [+
1127 FOR target_modules +] \
1128 maybe-install-strip-target-[+module+][+
1129 ENDFOR target_modules +]
1132 ### other supporting targets
1135 $(DESTDIR)$(prefix) \
1136 $(DESTDIR)$(exec_prefix)
1138 installdirs: mkinstalldirs
1139 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
1141 dir.info: do-install-info
1142 if [ -f $(srcdir)/texinfo/gen-info-dir ]; then \
1143 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new; \
1144 mv -f dir.info.new dir.info; \
1149 @echo "Building a full distribution of this tree isn't done"
1150 @echo "via 'make dist'. Check out the etc/ subdirectory"
1154 # Right now this just builds TAGS in each subdirectory. emacs19 has the
1155 # ability to use several tags files at once, so there is probably no need
1156 # to combine them into one big TAGS file (like CVS 1.3 does). We could
1157 # (if we felt like it) have this Makefile write a piece of elisp which
1158 # the user could load to tell emacs19 where all the TAGS files we just
1162 # ------------------------------------
1163 # Macros for configure and all targets
1164 # ------------------------------------
1166 [+ DEFINE configure +]
1167 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
1168 maybe-configure-[+prefix+][+module+]:
1170 configure-[+prefix+][+module+]: stage_current
1171 @endif gcc-bootstrap
1172 @if [+prefix+][+module+]
1173 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
1174 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
1175 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1176 @r=`${PWD_COMMAND}`; export r; \
1177 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1178 [+ IF check_multilibs
1179 +]echo "Checking multilib configuration for [+module+]..."; \
1180 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1181 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \
1182 if test -r [+subdir+]/[+module+]/multilib.out; then \
1183 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
1184 rm -f [+subdir+]/[+module+]/multilib.tmp; \
1186 rm -f [+subdir+]/[+module+]/Makefile; \
1187 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1190 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1192 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
1193 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1194 [+exports+] [+extra_exports+] \
1195 echo Configuring in [+subdir+]/[+module+]; \
1196 cd "[+subdir+]/[+module+]" || exit 1; \
1198 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1199 *) topdir=`echo [+subdir+]/[+module+]/ | \
1200 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1202 module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \
1203 [+ IF no-config-site +]rm -f no-such-file || : ; \
1204 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) \
1205 $$s/$$module_srcdir/configure \
1206 --srcdir=$${topdir}/$$module_srcdir \
1207 [+args+] --build=${build_alias} --host=[+host_alias+] \
1208 --target=[+target_alias+] [+extra_configure_flags+] \
1210 @endif [+prefix+][+module+]
1213 [+ FOR bootstrap_stage +]
1214 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
1215 maybe-configure-stage[+id+]-[+prefix+][+module+]:
1216 @if [+prefix+][+module+]-bootstrap
1217 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
1218 configure-stage[+id+]-[+prefix+][+module+]:
1219 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
1220 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
1221 @r=`${PWD_COMMAND}`; export r; \
1222 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1223 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1224 [+ IF check_multilibs
1225 +]echo "Checking multilib configuration for [+module+]..."; \
1226 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \
1227 if test -r [+subdir+]/[+module+]/multilib.out; then \
1228 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
1229 rm -f [+subdir+]/[+module+]/multilib.tmp; \
1231 rm -f [+subdir+]/[+module+]/Makefile; \
1232 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1235 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1237 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
1238 [+exports+][+ IF prev +] \
1239 [+poststage1_exports+][+ ENDIF prev +][+ IF prefix +] \
1240 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
1241 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
1242 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;[+ ELSE prefix +] \
1243 CFLAGS="$(STAGE[+id+]_CFLAGS)"; export CFLAGS; \
1244 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"; export CXXFLAGS;[+ IF prev +] \
1245 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1246 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +]; export LIBCFLAGS;[+
1247 ENDIF prefix +] [+extra_exports+] \
1248 echo Configuring stage [+id+] in [+subdir+]/[+module+]; \
1249 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1250 cd [+subdir+]/[+module+] || exit 1; \
1252 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1253 *) topdir=`echo [+subdir+]/[+module+]/ | \
1254 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1256 module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \
1257 $(SHELL) $$s/$$module_srcdir/configure \
1258 --srcdir=$${topdir}/$$module_srcdir \
1259 [+args+] --build=${build_alias} --host=[+host_alias+] \
1260 --target=[+target_alias+] \
1261 [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
1262 $(STAGE[+id+]_CONFIGURE_FLAGS)[+ IF extra_configure_flags +] \
1263 [+extra_configure_flags+][+ ENDIF extra_configure_flags +]
1264 @endif [+prefix+][+module+]-bootstrap
1265 [+ ENDFOR bootstrap_stage +]
1266 [+ ENDIF bootstrap +]
1270 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
1271 maybe-all-[+prefix+][+module+]:
1273 all-[+prefix+][+module+]: stage_current
1274 @endif gcc-bootstrap
1275 @if [+prefix+][+module+]
1276 TARGET-[+prefix+][+module+]=[+
1277 IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
1278 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
1279 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
1280 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1281 @r=`${PWD_COMMAND}`; export r; \
1282 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1283 [+exports+] [+extra_exports+] \
1284 (cd [+subdir+]/[+module+] && \
1285 $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+stage1_args+] [+extra_make_flags+] \
1286 $(TARGET-[+prefix+][+module+]))
1287 @endif [+prefix+][+module+]
1290 [+ FOR bootstrap_stage +]
1291 .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
1292 .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
1293 maybe-all-stage[+id+]-[+prefix+][+module+]:
1294 maybe-clean-stage[+id+]-[+prefix+][+module+]:
1295 @if [+prefix+][+module+]-bootstrap
1296 maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
1297 all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
1298 TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
1299 all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
1300 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
1301 @r=`${PWD_COMMAND}`; export r; \
1302 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1303 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1304 [+exports+][+ IF prev +] \
1305 [+poststage1_exports+][+ ENDIF prev +] [+extra_exports+] \
1306 cd [+subdir+]/[+module+] && \
1308 $(MAKE) $(BASE_FLAGS_TO_PASS)[+ IF prefix +] \
1309 CFLAGS="$(CFLAGS_FOR_TARGET)" \
1310 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
1311 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"[+ ELSE prefix +] \
1312 CFLAGS="$(STAGE[+id+]_CFLAGS)" \
1313 GENERATOR_CFLAGS="$(STAGE[+id+]_GENERATOR_CFLAGS)" \
1314 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"[+ IF prev +] \
1315 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1316 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +][+ ENDIF prefix +] \
1317 CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
1318 CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
1319 LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
1320 [+args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \
1321 [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] \
1322 TFLAGS="$(STAGE[+id+]_TFLAGS)" [+profile_data+] \
1323 $(TARGET-stage[+id+]-[+prefix+][+module+])
1325 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
1326 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
1327 clean-stage[+id+]-[+prefix+][+module+]:
1328 @if [ $(current_stage) = stage[+id+] ]; then \
1329 [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
1331 [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
1332 $(MAKE) stage[+id+]-start; \
1334 cd [+subdir+]/[+module+] && \
1335 $(MAKE) [+args+] [+ IF prev +][+poststage1_args+][+ ELSE prev +] \
1336 [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] clean
1337 @endif [+prefix+][+module+]-bootstrap
1339 [+ ENDFOR bootstrap_stage +]
1340 [+ ENDIF bootstrap +]
1343 # --------------------------------------
1344 # Modules which run on the build machine
1345 # --------------------------------------
1346 [+ FOR build_modules +]
1347 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1348 host_alias=(get "host" "${build_alias}")
1349 target_alias=(get "target" "${target_alias}")
1350 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
1352 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1353 args="$(EXTRA_BUILD_FLAGS)" +]
1354 [+ ENDFOR build_module +]
1356 # --------------------------------------
1357 # Modules which run on the host machine
1358 # --------------------------------------
1359 [+ FOR host_modules +]
1360 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
1361 exports="$(HOST_EXPORTS)"
1362 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1363 host_alias=(get "host" "${host_alias}")
1364 target_alias=(get "target" "${target_alias}")
1365 args="$(HOST_CONFIGARGS)" +]
1367 [+ all prefix="" subdir="$(HOST_SUBDIR)"
1368 exports="$(HOST_EXPORTS)"
1369 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1370 args="$(EXTRA_HOST_FLAGS)"
1371 stage1_args="$(STAGE1_FLAGS_TO_PASS)"
1372 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
1374 .PHONY: check-[+module+] maybe-check-[+module+]
1375 maybe-check-[+module+]:
1377 maybe-check-[+module+]: check-[+module+]
1380 [+ ELIF no_check_cross +]
1381 # This module is only tested in a native toolchain.
1383 @: $(MAKE); $(unstage)
1384 @if [ '$(host)' = '$(target)' ]; then \
1385 r=`${PWD_COMMAND}`; export r; \
1386 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1387 $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
1388 ENDIF bootstrap +] \
1389 (cd $(HOST_SUBDIR)/[+module+] && \
1390 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
1391 IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
1395 @: $(MAKE); $(unstage)
1396 @r=`${PWD_COMMAND}`; export r; \
1397 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1398 $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
1399 ENDIF bootstrap +] \
1400 (cd $(HOST_SUBDIR)/[+module+] && \
1401 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
1402 IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
1403 [+ ENDIF no_check +]
1406 .PHONY: install-[+module+] maybe-install-[+module+]
1407 maybe-install-[+module+]:
1409 maybe-install-[+module+]: install-[+module+]
1413 install-[+module+]: installdirs
1414 @: $(MAKE); $(unstage)
1415 @r=`${PWD_COMMAND}`; export r; \
1416 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1418 (cd $(HOST_SUBDIR)/[+module+] && \
1419 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
1420 [+ ENDIF no_install +]
1423 .PHONY: install-strip-[+module+] maybe-install-strip-[+module+]
1424 maybe-install-strip-[+module+]:
1426 maybe-install-strip-[+module+]: install-strip-[+module+]
1428 install-strip-[+module+]:
1430 install-strip-[+module+]: installdirs
1431 @: $(MAKE); $(unstage)
1432 @r=`${PWD_COMMAND}`; export r; \
1433 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1435 (cd $(HOST_SUBDIR)/[+module+] && \
1436 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
1437 [+ ENDIF no_install +]
1440 # Other targets (info, dvi, pdf, etc.)
1441 [+ FOR recursive_targets +]
1442 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1443 maybe-[+make_target+]-[+module+]:
1445 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
1446 [+ IF (match-value? = "missing" (get "make_target") ) +]
1447 # [+module+] doesn't support [+make_target+].
1448 [+make_target+]-[+module+]:
1450 [+make_target+]-[+module+]: [+
1452 [+depend+]-[+module+] [+
1454 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1455 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
1456 r=`${PWD_COMMAND}`; export r; \
1457 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1459 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1460 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1462 echo "Doing [+make_target+] in [+module+]"; \
1463 (cd $(HOST_SUBDIR)/[+module+] && \
1464 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1465 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1466 "RANLIB=$${RANLIB}" \
1467 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1472 [+ ENDFOR recursive_targets +]
1473 [+ ENDFOR host_modules +]
1475 # ---------------------------------------
1476 # Modules which run on the target machine
1477 # ---------------------------------------
1478 [+ FOR target_modules +]
1481 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1482 check_multilibs=true
1483 exports="$(RAW_CXX_TARGET_EXPORTS)"
1484 host_alias=(get "host" "${target_alias}")
1485 target_alias=(get "target" "${target_alias}")
1486 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1488 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1489 exports="$(RAW_CXX_TARGET_EXPORTS)"
1490 args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1492 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1493 check_multilibs=true
1494 exports="$(NORMAL_TARGET_EXPORTS)"
1495 host_alias=(get "host" "${target_alias}")
1496 target_alias=(get "target" "${target_alias}")
1497 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1499 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1500 exports="$(NORMAL_TARGET_EXPORTS)"
1501 args="$(EXTRA_TARGET_FLAGS)" +]
1504 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1505 maybe-check-target-[+module+]:
1506 @if target-[+module+]
1507 maybe-check-target-[+module+]: check-target-[+module+]
1509 # Dummy target for uncheckable module.
1510 check-target-[+module+]:
1512 check-target-[+module+]:
1513 @: $(MAKE); $(unstage)
1514 @r=`${PWD_COMMAND}`; export r; \
1515 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1517 $(RAW_CXX_TARGET_EXPORTS) \[+
1519 $(NORMAL_TARGET_EXPORTS) \[+
1521 (cd $(TARGET_SUBDIR)/[+module+] && \
1522 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1524 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1526 +] [+extra_make_flags+] check)
1527 [+ ENDIF no_check +]
1528 @endif target-[+module+]
1530 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1531 maybe-install-target-[+module+]:
1532 @if target-[+module+]
1533 maybe-install-target-[+module+]: install-target-[+module+]
1535 # Dummy target for uninstallable.
1536 install-target-[+module+]:
1538 install-target-[+module+]: installdirs
1539 @: $(MAKE); $(unstage)
1540 @r=`${PWD_COMMAND}`; export r; \
1541 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1543 $(RAW_CXX_TARGET_EXPORTS) \[+
1545 $(NORMAL_TARGET_EXPORTS) \[+
1547 (cd $(TARGET_SUBDIR)/[+module+] && \
1548 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1549 [+ ENDIF no_install +]
1550 @endif target-[+module+]
1552 .PHONY: install-strip-target-[+module+] maybe-install-strip-target-[+module+]
1553 maybe-install-strip-target-[+module+]:
1554 @if target-[+module+]
1555 maybe-install-strip-target-[+module+]: install-strip-target-[+module+]
1557 # Dummy target for uninstallable.
1558 install-strip-target-[+module+]:
1560 install-strip-target-[+module+]: installdirs
1561 @: $(MAKE); $(unstage)
1562 @r=`${PWD_COMMAND}`; export r; \
1563 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1565 $(RAW_CXX_TARGET_EXPORTS) \[+
1567 $(NORMAL_TARGET_EXPORTS) \[+
1569 (cd $(TARGET_SUBDIR)/[+module+] && \
1570 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
1571 [+ ENDIF no_install +]
1572 @endif target-[+module+]
1574 # Other targets (info, dvi, pdf, etc.)
1575 [+ FOR recursive_targets +]
1576 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1577 maybe-[+make_target+]-target-[+module+]:
1578 @if target-[+module+]
1579 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1580 [+ IF (match-value? = "missing" (get "make_target") ) +]
1581 # [+module+] doesn't support [+make_target+].
1582 [+make_target+]-target-[+module+]:
1584 [+make_target+]-target-[+module+]: [+
1586 [+depend+]-target-[+module+] [+
1588 @: $(MAKE); $(unstage)
1589 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0; \
1590 r=`${PWD_COMMAND}`; export r; \
1591 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1593 $(RAW_CXX_TARGET_EXPORTS) \[+
1595 $(NORMAL_TARGET_EXPORTS) \[+
1597 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]"; \
1598 for flag in $(EXTRA_TARGET_FLAGS); do \
1599 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1601 (cd $(TARGET_SUBDIR)/[+module+] && \
1602 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1603 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1604 "RANLIB=$${RANLIB}" \
1605 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1606 [+extra_make_flags+] [+make_target+]) \
1609 @endif target-[+module+]
1610 [+ ENDFOR recursive_targets +]
1611 [+ ENDFOR target_modules +]
1614 .PHONY: check-target-libgomp-c++
1615 check-target-libgomp-c++:
1616 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libgomp
1618 .PHONY: check-target-libgomp-fortran
1619 check-target-libgomp-fortran:
1620 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) fortran.exp" check-target-libgomp
1622 @endif target-libgomp
1625 .PHONY: check-target-libitm-c++
1626 check-target-libitm-c++:
1627 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libitm
1629 @endif target-libitm
1635 @if gcc-no-bootstrap
1637 cross: all-build all-gas all-ld
1638 @r=`${PWD_COMMAND}`; export r; \
1639 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1641 echo "Building the C and C++ compiler"; \
1642 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1643 @r=`${PWD_COMMAND}`; export r; \
1644 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1645 echo "Building runtime libraries"; \
1646 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1647 @endif gcc-no-bootstrap
1651 .PHONY: gcc-site.exp
1653 r=`${PWD_COMMAND}`; export r; \
1654 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1656 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) site.exp);
1659 .PHONY: check-gcc-[+language+] check-[+language+]
1660 check-gcc-[+language+]: gcc-site.exp
1661 r=`${PWD_COMMAND}`; export r; \
1662 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1664 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]);
1665 check-[+language+]: check-gcc-[+language+][+ FOR lib-check-target +] [+ lib-check-target +][+ ENDFOR lib-check-target +]
1666 [+ ENDFOR languages +]
1668 # The gcc part of install-no-fixedincludes, which relies on an intimate
1669 # knowledge of how a number of gcc internal targets (inter)operate. Delegate.
1670 .PHONY: gcc-install-no-fixedincludes
1671 gcc-install-no-fixedincludes:
1672 @if [ -f ./gcc/Makefile ]; then \
1673 r=`${PWD_COMMAND}`; export r; \
1674 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1677 && $(MAKE) $(GCC_FLAGS_TO_PASS) install-no-fixedincludes); \
1681 # ---------------------
1682 # GCC bootstrap support
1683 # ---------------------
1685 # We track the current stage (the one in 'gcc') in the stage_current file.
1686 # stage_last instead tracks the stage that was built last. These targets
1687 # are dummy when toplevel bootstrap is not active.
1689 # While making host and target tools, symlinks to the final stage must be
1690 # there, so $(unstage) should be run at various points. To avoid excessive
1691 # recursive invocations of make, we "inline" them using a variable. These
1692 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1693 # to avoid warnings from the GNU Make job server.
1700 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1701 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1702 current_stage = "`cat stage_current 2> /dev/null`"
1703 @endif gcc-bootstrap
1705 .PHONY: unstage stage
1707 @: $(MAKE); $(unstage)
1709 @: $(MAKE); $(stage)
1711 # Disable commands for lean bootstrap.
1714 # We name the build directories for the various stages "stage1-gcc",
1715 # "stage2-gcc","stage3-gcc", etc.
1717 # Since the 'compare' process will fail (on debugging information) if any
1718 # directory names are different, we need to link the gcc directory for
1719 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1720 # the build directories constant as well. For the latter, we use naked names
1721 # like 'gcc', because the scripts in that directory assume it. We use
1722 # mv on platforms where symlinks to directories do not work or are not
1725 # 'touch' doesn't work right on some platforms.
1726 STAMP = echo timestamp >
1728 # We only want to compare .o files, so set this!
1731 [+ FOR bootstrap-stage +]
1732 .PHONY: stage[+id+]-start stage[+id+]-end
1735 @: $(MAKE); $(stage); \
1736 echo stage[+id+] > stage_current; \
1737 echo stage[+id+] > stage_last; \
1738 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1739 FOR host_modules +][+ IF bootstrap +]
1741 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1742 mkdir stage[+id+]-[+module+]; \
1743 mv stage[+id+]-[+module+] [+module+][+ IF prev +]; \
1744 mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1745 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1746 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1747 mkdir stage[+id+]-$(TARGET_SUBDIR); \
1748 mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR)[+ IF prev +]; \
1749 mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1751 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1753 @if test -d $(HOST_SUBDIR)/[+module+]; then \
1754 cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+][+ IF prev +]; \
1755 mv prev-[+module+] stage[+prev+]-[+module+]; : [+ ENDIF prev +]; \
1757 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1758 @if test -d $(TARGET_SUBDIR); then \
1759 mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR)[+ IF prev +]; \
1760 mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR); : [+ ENDIF prev +]; \
1764 # Bubble a bug fix through all the stages up to stage [+id+]. They are
1765 # remade, but not reconfigured. The next stage (if any) will not be
1766 # reconfigured either.
1767 .PHONY: stage[+id+]-bubble
1768 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1769 @r=`${PWD_COMMAND}`; export r; \
1770 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1771 if test -f stage[+id+]-lean [+
1772 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +]; then \
1773 echo Skipping rebuild of stage[+id+]; \
1775 $(MAKE) stage[+id+]-start; \[+IF lean +]
1777 rm -rf stage[+lean+]-*; \
1778 $(STAMP) stage[+lean+]-lean; \
1779 fi; \[+ ENDIF lean +]
1780 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1781 fi[+ IF compare-target +]
1782 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1784 .PHONY: all-stage[+id+] clean-stage[+id+]
1785 do-clean: clean-stage[+id+]
1787 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1788 # only possibility, but now it conflicts with no-bootstrap rules
1790 [+ IF compare-target +]
1792 @r=`${PWD_COMMAND}`; export r; \
1793 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1794 if test -f stage[+prev+]-lean; then \
1795 echo Cannot compare object files as stage [+prev+] was deleted.; \
1798 : $(MAKE); $(stage); \
1799 rm -f .bad_compare; \
1800 echo Comparing stages [+prev+] and [+id+]; \
1801 sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \
1802 files=`find stage[+id+]-* -name "*$(objext)" -print | \
1803 sed -n s,^stage$$sed-,,p`; \
1804 for file in $${files} ${extra-compare}; do \
1805 f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \
1806 if test ! -f $$f1; then continue; fi; \
1807 $(do-[+compare-target+]) > /dev/null 2>&1; \
1808 if test $$? -eq 1; then \
1810 @compare_exclusions@) \
1811 echo warning: $$file differs ;; \
1813 echo $$file differs >> .bad_compare ;; \
1817 if [ -f .bad_compare ]; then \
1818 echo "Bootstrap comparison failure!"; \
1822 echo Comparison successful.; \
1824 $(STAMP) [+compare-target+][+ IF prev +]
1826 rm -rf stage[+prev+]-*; \
1827 $(STAMP) stage[+prev+]-lean; \
1829 [+ ENDIF compare-target +]
1831 [+ IF bootstrap-target +]
1832 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1833 [+bootstrap-target+]:
1834 echo stage[+id+] > stage_final
1835 @r=`${PWD_COMMAND}`; export r; \
1836 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1837 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1838 @: $(MAKE); $(unstage)
1839 @r=`${PWD_COMMAND}`; export r; \
1840 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1841 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1842 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1844 [+bootstrap-target+]-lean:
1845 echo stage[+id+] > stage_final
1846 @r=`${PWD_COMMAND}`; export r; \
1847 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1848 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1849 @: $(MAKE); $(unstage)
1850 @r=`${PWD_COMMAND}`; export r; \
1851 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1852 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1853 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1854 [+ ENDIF bootstrap-target +]
1856 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1857 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1858 .PHONY: distclean-stage[+id+]
1859 distclean-stage[+id+]::
1860 @: $(MAKE); $(stage)
1861 @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1862 rm -rf stage[+id+]-* [+
1863 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1865 [+ IF cleanstrap-target +]
1866 .PHONY: [+cleanstrap-target+]
1867 [+cleanstrap-target+]: do-distclean local-clean
1868 echo stage[+id+] > stage_final
1869 @r=`${PWD_COMMAND}`; export r; \
1870 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1871 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1872 @: $(MAKE); $(unstage)
1873 @r=`${PWD_COMMAND}`; export r; \
1874 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1875 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1876 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1877 [+ ENDIF cleanstrap-target +]
1878 @endif gcc-bootstrap
1880 [+ ENDFOR bootstrap-stage +]
1883 $(MAKE) distclean-stagefeedback
1885 stagefeedback-start::
1886 @r=`${PWD_COMMAND}`; export r; \
1887 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1888 for i in prev-*; do \
1889 j=`echo $$i | sed s/^prev-//`; \
1891 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL); } && \
1892 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL); }; \
1896 do-distclean: distclean-stage1
1898 # Provide a GCC build when we're building target libraries. This does
1899 # not work as a dependency, just as the minimum necessary to avoid errors.
1901 @r=`${PWD_COMMAND}`; export r; \
1902 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1903 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1905 # Same as unstage, but not phony and defaulting to stage1-start. We place
1906 # it in the dependency so that for example `make -j3 all-gcc' works.
1908 @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1912 @: $(MAKE); $(stage)
1913 rm -rf stage1-$(TARGET_SUBDIR)[+ FOR bootstrap-stage +][+ IF prev
1914 +] stage[+id+]-*[+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1916 @endif gcc-bootstrap
1918 # --------------------------------------
1919 # Dependencies between different modules
1920 # --------------------------------------
1922 # Generic dependencies for target modules on host stuff, especially gcc
1923 @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1924 +][+ FOR bootstrap_stage +]
1925 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1926 ENDFOR +][+ ELSE bootstrap +]
1927 configure-target-[+module+]: stage_last[+
1928 ENDIF bootstrap +][+ ENDFOR target_modules +]
1929 @endif gcc-bootstrap
1931 @if gcc-no-bootstrap[+ FOR target_modules +]
1932 configure-target-[+module+]: maybe-all-gcc[+
1933 ENDFOR target_modules +]
1934 @endif gcc-no-bootstrap
1937 # There are two types of dependencies here: 'hard' dependencies, where one
1938 # module simply won't build without the other; and 'soft' dependencies, where
1939 # if the depended-on module is missing, the depending module will do without
1940 # or find a substitute somewhere (perhaps installed). Soft dependencies
1941 # are made here to depend on a 'maybe-' target. If you're not sure,
1942 # it's safer to use a soft dependency.
1944 [+ ;; These Scheme functions build the bulk of the dependencies.
1945 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1946 ;; where "maybe-" is only included if HARD is not true, and all-gcc
1947 ;; is taken from VAR-NAME.
1948 (define dep-target (lambda (module-kind var-name hard)
1950 (if hard "" "maybe-")
1951 (dep-subtarget var-name)
1953 (dep-module var-name)
1956 ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1957 (define make-dep (lambda (module-kind on-kind)
1959 (dep-target module-kind "module" #t) ": "
1960 (dep-target on-kind "on" (exist? "hard")))))
1962 ;; dep-subtarget extracts everything up to the first dash in the given
1963 ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1964 (define dep-subtarget (lambda (var-name)
1965 (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1967 ;; dep-module extracts everything up to the first dash in the given
1968 ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1969 (define dep-module (lambda (var-name)
1970 (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1972 ;; dep-stage builds a string for the prefix of a bootstrap stage.
1973 (define dep-stage (lambda ()
1979 ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1980 ;; but is written in Scheme.
1981 (define dep-maybe (lambda ()
1982 (if (exist? "hard") "" "maybe-")))
1984 ;; dep-kind returns "prebootstrap" for configure or build
1985 ;; dependencies of bootstrapped modules on a build module
1986 ;; (e.g. all-gcc on all-build-bison); "normal" if the dependency is
1987 ;; on an "install" target, or if the dependence module is not
1988 ;; bootstrapped; otherwise, it returns "bootstrap" or
1989 ;; "postbootstrap" depending on whether the dependent module is
1990 ;; bootstrapped. All this is only necessary for host and target
1991 ;; modules. It might seem like, in order to avoid build races, we
1992 ;; might need more elaborate detection between prebootstrap and
1993 ;; postbootstrap modules, but there are no host prebootstrap
1994 ;; modules. If there were any non-bootstrap host modules that
1995 ;; bootstrap modules depended on, we'd get unsatisfied per-stage
1996 ;; dependencies on them, which would be immediately noticed.
1997 (define dep-kind (lambda ()
1999 ((and (hash-ref boot-modules (dep-module "module"))
2000 (=* (dep-module "on") "build-"))
2003 ((or (= (dep-subtarget "on") "install-")
2004 (not (hash-ref boot-modules (dep-module "on"))))
2007 ((hash-ref boot-modules (dep-module "module"))
2010 (1 "postbootstrap"))))
2012 (define make-postboot-dep (lambda ()
2013 (let ((target (dep-module "module")) (dep "stage_last"))
2014 (unless (= (hash-ref postboot-targets target) dep)
2015 (hash-create-handle! postboot-targets target dep)
2016 ;; All non-bootstrap modules' configure target already
2018 (unless (=* target "target-")
2019 (string-append "configure-" target ": " dep "\n"))))))
2021 ;; Dependencies in between target modules if the dependencies
2022 ;; are bootstrap target modules and the target modules which
2023 ;; depend on them are emitted inside of @unless gcc-bootstrap.
2024 ;; Unfortunately, some target modules like libatomic or libbacktrace
2025 ;; have bootstrap flag set, but whether they are actually built
2026 ;; during bootstrap or after bootstrap depends on e.g. enabled languages;
2027 ;; if d is enabled, libphobos is built as target module and depends
2028 ;; on libatomic and libbacktrace, which are therefore also built as
2029 ;; bootstrap modules. If d is not enabled but go is, libatomic and
2030 ;; libbacktrace are just dependencies of libgo which is not a bootstrap
2031 ;; target module, but we need dependencies on libatomic and libbacktrace
2032 ;; in that case even when gcc-bootstrap. This lambda emits those.
2033 (define make-postboot-target-dep (lambda ()
2034 (let ((target (dep-module "module")) (on (dep-module "on")))
2035 (when (=* on "target-")
2036 (when (=* target "target-")
2037 (string-append "@unless " on "-bootstrap\n" (make-dep "" "")
2038 "\n@endunless " on "-bootstrap\n"))))))
2040 ;; We now build the hash table that is used by dep-kind.
2041 (define boot-modules (make-hash-table 113))
2042 (define postboot-targets (make-hash-table 113))
2045 [+ FOR host_modules +][+
2046 (if (exist? "bootstrap")
2047 (hash-create-handle! boot-modules (get "module") #t))
2048 "" +][+ ENDFOR host_modules +]
2049 [+ FOR target_modules +][+
2050 (if (exist? "bootstrap")
2051 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
2052 "" +][+ ENDFOR target_modules +]
2054 # With all the machinery above in place, it is pretty easy to generate
2055 # dependencies. Host dependencies are a bit more complex because we have
2056 # to check for bootstrap/prebootstrap dependencies. To resolve
2057 # prebootstrap dependencies, prebootstrap modules are gathered in
2059 [+ FOR dependencies +][+ CASE (dep-kind) +]
2060 [+ == "prebootstrap" +][+ (make-dep "" "") +][+ FOR bootstrap_stage +]
2061 [+ (make-dep (dep-stage) "") +][+ ENDFOR bootstrap_stage +]
2062 [+ == "bootstrap" +][+ (make-dep "" "") +][+ FOR bootstrap_stage +]
2063 [+ (make-dep (dep-stage) (dep-stage)) +][+ ENDFOR bootstrap_stage +]
2064 [+ == "normal" +][+ (make-dep "" "") +]
2065 [+ ESAC +][+ ENDFOR dependencies +]
2068 [+ FOR dependencies +][+ CASE (dep-kind) +]
2069 [+ == "postbootstrap" +][+ (make-postboot-dep) +][+ ESAC +][+
2070 ENDFOR dependencies +]@endif gcc-bootstrap
2073 [+ FOR dependencies +][+ CASE (dep-kind) +]
2074 [+ == "postbootstrap" +][+ (make-postboot-target-dep) +][+ ESAC +][+
2075 ENDFOR dependencies +]@endif gcc-bootstrap
2077 @unless gcc-bootstrap
2078 [+ FOR dependencies +][+ CASE (dep-kind) +]
2079 [+ == "postbootstrap" +][+ (make-dep "" "") +]
2080 [+ ESAC +][+ ENDFOR dependencies +]@endunless gcc-bootstrap
2082 # Dependencies for target modules on other target modules are
2083 # described by lang_env_dependencies; the defaults apply to anything
2084 # not mentioned there.
2086 ;; Predicate for whether LANG was specified in lang_env_dependencies.
2087 (define lang-dep (lambda (lang)
2088 (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
2090 ;; Build the hash table we will need.
2091 (define lang-env-deps (make-hash-table 7))
2092 +][+ FOR lang_env_dependencies +][+
2094 (hash-create-handle! lang-env-deps
2095 (string-append (get "module") "-" "cxx") #t))
2098 (hash-create-handle! lang-env-deps
2099 (string-append (get "module") "-" "no_c") #t))
2101 (if (exist? "no_gcc")
2102 (hash-create-handle! lang-env-deps
2103 (string-append (get "module") "-" "no_gcc") #t))
2104 "" +][+ ENDFOR lang_env_dependencies +]
2106 @if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
2107 +][+ IF bootstrap +][+ FOR bootstrap_stage +]
2108 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
2109 ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
2110 @endif gcc-bootstrap
2112 @if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
2113 configure-target-[+module+]: maybe-all-target-libgcc[+
2114 ENDIF +][+ ENDFOR target_modules +]
2115 @endif gcc-no-bootstrap
2117 [+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
2118 configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
2119 ENDIF +][+ IF (lang-dep "cxx") +]
2120 configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
2122 [+ ENDFOR target_modules +]
2124 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
2126 INSTALL_GDB_TK = @INSTALL_GDB_TK@
2127 configure-gdb: $(CONFIGURE_GDB_TK)
2128 all-gdb: $(gdbnlmrequirements) $(GDB_TK)
2129 install-gdb: $(INSTALL_GDB_TK)
2131 # Serialization dependencies. Host configures don't work well in parallel to
2132 # each other, due to contention over config.cache. Target configures and
2133 # build configures are similar.
2134 @serialization_dependencies@
2136 # --------------------------------
2137 # Regenerating top level configury
2138 # --------------------------------
2140 # Rebuilding Makefile.in, using autogen.
2142 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
2143 cd $(srcdir) && $(AUTOGEN) Makefile.def
2145 # Rebuilding Makefile.
2146 Makefile: $(srcdir)/Makefile.in config.status
2147 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
2149 config.status: configure
2150 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
2152 # Rebuilding configure.
2154 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
2155 $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
2156 $(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
2157 $(srcdir)/config/gcc-plugin.m4 \
2158 $(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
2159 $(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
2160 cd $(srcdir) && $(AUTOCONF)
2162 # ------------------------------
2163 # Special directives to GNU Make
2164 # ------------------------------
2166 # Don't pass command-line variables to submakes.
2170 # end of Makefile.in