Debian Codegraph @

Makefile.tpl

raw
1 [+ AutoGen5 template -*- Mode: Makefile -*-
2 in
3 +]
4
5 # Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
6 #
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
11 #
12 # This file is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 3 of the License, or
15 # (at your option) any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; see the file COPYING3. If not see
24 # <http://www.gnu.org/licenses/>.
25 #
26
27 # First, test for a proper version of make, but only where one is required.
28
29 @if gcc
30 ifeq (,$(.VARIABLES)) # The variable .VARIABLES, new with 3.80, is never empty.
31 $(error GNU make version 3.80 or newer is required.)
32 endif
33 @endif gcc
34
35 # -------------------------------
36 # Standard Autoconf-set variables
37 # -------------------------------
38 VPATH=@srcdir@
39
40 build_alias=@build_noncanonical@
41 build_vendor=@build_vendor@
42 build_os=@build_os@
43 build=@build@
44 host_alias=@host_noncanonical@
45 host_vendor=@host_vendor@
46 host_os=@host_os@
47 host=@host@
48 target_alias=@target_noncanonical@
49 target_vendor=@target_vendor@
50 target_os=@target_os@
51 target=@target@
52
53 program_transform_name = @program_transform_name@
54
55 prefix = @prefix@
56 exec_prefix = @exec_prefix@
57
58 srcdir = @srcdir@
59
60 bindir = @bindir@
61 sbindir = @sbindir@
62 libexecdir = @libexecdir@
63 datadir = @datadir@
64 sysconfdir = @sysconfdir@
65 sharedstatedir = @sharedstatedir@
66 localstatedir = @localstatedir@
67 libdir = @libdir@
68 includedir = @includedir@
69 oldincludedir = @oldincludedir@
70 infodir = @infodir@
71 datarootdir = @datarootdir@
72 docdir = @docdir@
73 pdfdir = @pdfdir@
74 htmldir = @htmldir@
75 mandir = @mandir@
76 man1dir = $(mandir)/man1
77 man2dir = $(mandir)/man2
78 man3dir = $(mandir)/man3
79 man4dir = $(mandir)/man4
80 man5dir = $(mandir)/man5
81 man6dir = $(mandir)/man6
82 man7dir = $(mandir)/man7
83 man8dir = $(mandir)/man8
84 man9dir = $(mandir)/man9
85
86 INSTALL = @INSTALL@
87 INSTALL_PROGRAM = @INSTALL_PROGRAM@
88 INSTALL_SCRIPT = @INSTALL_SCRIPT@
89 INSTALL_DATA = @INSTALL_DATA@
90 LN = @LN@
91 LN_S = @LN_S@
92 MAINT = @MAINT@
93 MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
94 MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
95
96 # -------------------------------------------------
97 # Miscellaneous non-standard autoconf-set variables
98 # -------------------------------------------------
99
100 # The gcc driver likes to know the arguments it was configured with.
101 TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
102
103 tooldir = @tooldir@
104 build_tooldir = @build_tooldir@
105
106 # This is the name of the environment variable used for the path to
107 # the libraries.
108 RPATH_ENVVAR = @RPATH_ENVVAR@
109
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@
114
115 # If the build should make suitable code for shared host resources.
116 host_shared = @host_shared@
117
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)"
123
124 # Linker flags to use on the host, for stage1 or when not
125 # bootstrapping.
126 STAGE1_LDFLAGS = @stage1_ldflags@
127
128 # Libraries to use on the host, for stage1 or when not bootstrapping.
129 STAGE1_LIBS = @stage1_libs@
130
131 # Linker flags to use for stage2 and later.
132 POSTSTAGE1_LDFLAGS = @poststage1_ldflags@
133
134 # Libraries to use for stage2 and later.
135 POSTSTAGE1_LIBS = @poststage1_libs@
136
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
140 # re-runs configure.
141 BASE_EXPORTS = \
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; \
150 GUILE="$(GUILE)"; export GUILE;
151
152 # This is the list of variables to export in the environment when
153 # configuring subdirectories for the build system.
154 BUILD_EXPORTS = \
155 $(BASE_EXPORTS) \
156 AR="$(AR_FOR_BUILD)"; export AR; \
157 AS="$(AS_FOR_BUILD)"; export AS; \
158 CC="$(CC_FOR_BUILD)"; export CC; \
159 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
160 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
161 CPP="$(CPP_FOR_BUILD)"; export CPP; \
162 CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
163 CXX="$(CXX_FOR_BUILD)"; export CXX; \
164 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
165 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
166 GOC="$(GOC_FOR_BUILD)"; export GOC; \
167 GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
168 GDC="$(GDC_FOR_BUILD)"; export GDC; \
169 GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \
170 GM2="$(GM2_FOR_BUILD)"; export GM2; \
171 GM2FLAGS="$(GM2FLAGS_FOR_BUILD)"; export GM2FLAGS; \
172 DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
173 DSYMUTIL="$(DSYMUTIL_FOR_BUILD)"; export DSYMUTIL; \
174 LD="$(LD_FOR_BUILD)"; export LD; \
175 LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
176 NM="$(NM_FOR_BUILD)"; export NM; \
177 RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
178 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
179 WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
180
181 # These variables must be set on the make command line for directories
182 # built for the build system to override those in BASE_FLAGS_TO_PASS.
183 EXTRA_BUILD_FLAGS = \
184 CFLAGS="$(CFLAGS_FOR_BUILD)" \
185 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
186
187 # This is the list of directories to built for the host system.
188 SUBDIRS = @configdirs@
189 TARGET_CONFIGDIRS = @target_configdirs@
190 # This is set by the configure script to the arguments to use when configuring
191 # directories built for the host system.
192 HOST_CONFIGARGS = @host_configargs@
193 # Host programs are put under this directory, which is . except if building
194 # with srcdir=..
195 HOST_SUBDIR = @host_subdir@
196 # This is the list of variables to export in the environment when
197 # configuring subdirectories for the host system. We need to pass
198 # some to the GCC configure because of its hybrid host/target nature.
199 HOST_EXPORTS = \
200 $(BASE_EXPORTS) \
201 CC="$(CC)"; export CC; \
202 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
203 CRAB1_LIBS="$(CRAB1_LIBS)"; export CRAB1_LIBS; \
204 CFLAGS="$(CFLAGS)"; export CFLAGS; \
205 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
206 CXX="$(CXX)"; export CXX; \
207 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
208 GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
209 GOC="$(GOC)"; export GOC; \
210 GDC="$(GDC)"; export GDC; \
211 GM2="$(GM2)"; export GM2; \
212 AR="$(AR)"; export AR; \
213 AS="$(AS)"; export AS; \
214 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
215 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
216 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
217 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
218 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
219 DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
220 LD="$(LD)"; export LD; \
221 LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
222 NM="$(NM)"; export NM; \
223 RANLIB="$(RANLIB)"; export RANLIB; \
224 WINDRES="$(WINDRES)"; export WINDRES; \
225 WINDMC="$(WINDMC)"; export WINDMC; \
226 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
227 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
228 OTOOL="$(OTOOL)"; export OTOOL; \
229 PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
230 READELF="$(READELF)"; export READELF; \
231 AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
232 AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
233 DSYMUTIL_FOR_TARGET="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL_FOR_TARGET; \
234 GCC_FOR_TARGET="$(GCC_FOR_TARGET) $$TFLAGS"; export GCC_FOR_TARGET; \
235 LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
236 NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
237 OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
238 OBJCOPY_FOR_TARGET="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY_FOR_TARGET; \
239 OTOOL_FOR_TARGET="$(OTOOL_FOR_TARGET)"; export OTOOL_FOR_TARGET; \
240 RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
241 READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
242 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
243 HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
244 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
245 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
246 ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
247 ISLINC="$(HOST_ISLINC)"; export ISLINC; \
248 XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \
249 @if gcc-bootstrap
250 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
251 @endif gcc-bootstrap
252 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
253
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"; \
269 export CXX; \
270 CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD;
271 @endif target-libstdc++-v3-bootstrap
272
273 # Similar, for later GCC stages.
274 POSTSTAGE1_HOST_EXPORTS = \
275 $(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) \
281 $(LTO_EXPORTS) \
282 GDC="$$r/$(HOST_SUBDIR)/prev-gcc/gdc$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
283 -B$(build_tooldir)/bin/ $(GDCFLAGS_FOR_TARGET) \
284 -B$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime/gcc \
285 -B$$r/prev-$(TARGET_SUBDIR)/libphobos/src \
286 -B$$r/prev-$(TARGET_SUBDIR)/libphobos/src/.libs \
287 -I$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime -I$$s/libphobos/libdruntime \
288 -L$$r/prev-$(TARGET_SUBDIR)/libphobos/src/.libs \
289 -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
290 -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs"; \
291 export GDC; \
292 GDC_FOR_BUILD="$$GDC"; export GDC_FOR_BUILD; \
293 GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \
294 LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \
295 HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS;
296
297 # Target libraries are put under this directory:
298 TARGET_SUBDIR = @target_subdir@
299 # This is set by the configure script to the arguments to use when configuring
300 # directories built for the target.
301 TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
302 # This is the list of variables to export in the environment when
303 # configuring subdirectories for the target system.
304 BASE_TARGET_EXPORTS = \
305 $(BASE_EXPORTS) \
306 AR="$(AR_FOR_TARGET)"; export AR; \
307 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
308 CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
309 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
310 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
311 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
312 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
313 GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
314 GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
315 GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \
316 GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \
317 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
318 DSYMUTIL="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL; \
319 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
320 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
321 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
322 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
323 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
324 OBJCOPY="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY; \
325 OTOOL="$(OTOOL_FOR_TARGET)"; export OTOOL; \
326 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
327 READELF="$(READELF_FOR_TARGET)"; export READELF; \
328 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
329 SYSROOT_CFLAGS_FOR_TARGET="$(SYSROOT_CFLAGS_FOR_TARGET)"; export SYSROOT_CFLAGS_FOR_TARGET; \
330 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
331 WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
332 @if gcc-bootstrap
333 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
334 @endif gcc-bootstrap
335 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
336 TARGET_CONFIGDIRS="$(TARGET_CONFIGDIRS)"; export TARGET_CONFIGDIRS;
337
338 RAW_CXX_TARGET_EXPORTS = \
339 $(BASE_TARGET_EXPORTS) \
340 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
341 CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
342
343 NORMAL_TARGET_EXPORTS = \
344 $(BASE_TARGET_EXPORTS) \
345 CXX_FOR_TARGET="$(CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
346 CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
347
348 # Where to find GMP
349 HOST_GMPLIBS = @gmplibs@
350 HOST_GMPINC = @gmpinc@
351
352 # Where to find isl
353 HOST_ISLLIBS = @isllibs@
354 HOST_ISLINC = @islinc@
355
356 # ----------------------------------------------
357 # Programs producing files for the BUILD machine
358 # ----------------------------------------------
359
360 SHELL = @SHELL@
361
362 # pwd command to use. Allow user to override default by setting PWDCMD in
363 # the environment to account for automounters. The make variable must not
364 # be called PWDCMD, otherwise the value set here is passed to make
365 # subprocesses and overrides the setting from the user's environment.
366 # Don't use PWD since it is a common shell environment variable and we
367 # don't want to corrupt it.
368 PWD_COMMAND = $${PWDCMD-pwd}
369
370 # compilers to use to create programs which must be run in the build
371 # environment.
372 AR_FOR_BUILD = @AR_FOR_BUILD@
373 AS_FOR_BUILD = @AS_FOR_BUILD@
374 CC_FOR_BUILD = @CC_FOR_BUILD@
375 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
376 CPP_FOR_BUILD = @CPP_FOR_BUILD@
377 CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
378 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
379 CXX_FOR_BUILD = @CXX_FOR_BUILD@
380 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
381 DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@
382 GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
383 GOC_FOR_BUILD = @GOC_FOR_BUILD@
384 GDC_FOR_BUILD = @GDC_FOR_BUILD@
385 GM2_FOR_BUILD = @GM2_FOR_BUILD@
386 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
387 LD_FOR_BUILD = @LD_FOR_BUILD@
388 NM_FOR_BUILD = @NM_FOR_BUILD@
389 RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@
390 WINDMC_FOR_BUILD = @WINDMC_FOR_BUILD@
391 WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@
392
393 # Special variables passed down in EXTRA_GCC_FLAGS. They are defined
394 # here so that they can be overridden by Makefile fragments.
395 BUILD_PREFIX = @BUILD_PREFIX@
396 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
397
398 # Flags to pass to stage2 and later makes. They are defined
399 # here so that they can be overridden by Makefile fragments.
400 BOOT_CFLAGS= -g -O2
401 BOOT_LDFLAGS=
402 BOOT_ADAFLAGS= -gnatpg
403
404 AWK = @AWK@
405 SED = @SED@
406 BISON = @BISON@
407 YACC = @YACC@
408 FLEX = @FLEX@
409 LEX = @LEX@
410 M4 = @M4@
411 MAKEINFO = @MAKEINFO@
412 EXPECT = @EXPECT@
413 RUNTEST = @RUNTEST@
414
415 AUTO_PROFILE = gcc-auto-profile --all -c 10000000
416
417 # This just becomes part of the MAKEINFO definition passed down to
418 # sub-makes. It lets flags be given on the command line while still
419 # using the makeinfo from the object tree.
420 # (Default to avoid splitting info files by setting the threshold high.)
421 MAKEINFOFLAGS = --split-size=5000000
422
423 # ---------------------------------------------
424 # Programs producing files for the HOST machine
425 # ---------------------------------------------
426
427 AS = @AS@
428 AR = @AR@ @AR_PLUGIN_OPTION@
429 AR_FLAGS = rc
430 CC = @CC@
431 CXX = @CXX@
432 DLLTOOL = @DLLTOOL@
433 DSYMUTIL = @DSYMUTIL@
434 LD = @LD@
435 LIPO = @LIPO@
436 NM = @NM@
437 OBJDUMP = @OBJDUMP@
438 OTOOL = @OTOOL@
439 RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
440 READELF = @READELF@
441 STRIP = @STRIP@
442 WINDRES = @WINDRES@
443 WINDMC = @WINDMC@
444
445 GDC = @GDC@
446 GNATBIND = @GNATBIND@
447 GNATMAKE = @GNATMAKE@
448
449 CFLAGS = @CFLAGS@
450 LDFLAGS = @LDFLAGS@
451 LIBCFLAGS = $(CFLAGS)
452 CXXFLAGS = @CXXFLAGS@
453 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
454 GOCFLAGS = $(CFLAGS)
455 GDCFLAGS = @GDCFLAGS@
456 GM2FLAGS = $(CFLAGS)
457
458 CRAB1_LIBS = @CRAB1_LIBS@
459
460 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
461
462 GUILE = guile
463
464 # Pass additional PGO and LTO compiler options to the PGO build.
465 BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
466 override CFLAGS += $(BUILD_CFLAGS)
467 override CXXFLAGS += $(BUILD_CFLAGS)
468
469 # Additional PGO and LTO compiler options to generate profiling data
470 # for the PGO build.
471 PGO_BUILD_GEN_FLAGS_TO_PASS = \
472 PGO_BUILD_CFLAGS="@PGO_BUILD_GEN_CFLAGS@" \
473 PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@"
474
475 # NB: Filter out any compiler options which may fail PGO training runs.
476 PGO_BUILD_TRAINING_CFLAGS:= \
477 $(filter-out -Werror=%,$(CFLAGS))
478 PGO_BUILD_TRAINING_CXXFLAGS:=\
479 $(filter-out -Werror=%,$(CXXFLAGS))
480 PGO_BUILD_TRAINING_CFLAGS:= \
481 $(filter-out -Wall,$(PGO_BUILD_TRAINING_CFLAGS))
482 PGO_BUILD_TRAINING_CXXFLAGS:= \
483 $(filter-out -Wall,$(PGO_BUILD_TRAINING_CXXFLAGS))
484 PGO_BUILD_TRAINING_CFLAGS:= \
485 $(filter-out -specs=%,$(PGO_BUILD_TRAINING_CFLAGS))
486 PGO_BUILD_TRAINING_CXXFLAGS:= \
487 $(filter-out -specs=%,$(PGO_BUILD_TRAINING_CXXFLAGS))
488 PGO_BUILD_TRAINING_FLAGS_TO_PASS = \
489 PGO_BUILD_TRAINING=yes \
490 CFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CFLAGS)" \
491 CXXFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CXXFLAGS)"
492
493 # Ignore "make check" errors in PGO training runs.
494 PGO_BUILD_TRAINING_MFLAGS = -i
495
496 # Additional PGO and LTO compiler options to use profiling data for the
497 # PGO build.
498 PGO_BUILD_USE_FLAGS_TO_PASS = \
499 PGO_BUILD_CFLAGS="@PGO_BUILD_USE_CFLAGS@" \
500 PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@"
501
502 # PGO training targets for the PGO build. FIXME: Add gold tests to
503 # training.
504 PGO-TRAINING-TARGETS = binutils gas gdb ld sim
505 PGO_BUILD_TRAINING = $(addprefix maybe-check-,$(PGO-TRAINING-TARGETS))
506
507 CREATE_GCOV = create_gcov
508 PROFILE_MERGER = profile_merger
509
510 TFLAGS =
511
512 # Defaults for all stages; some are overridden below.
513
514 STAGE_CFLAGS = $(BOOT_CFLAGS)
515 STAGE_TFLAGS = $(TFLAGS)
516 STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
517
518 [+ FOR bootstrap-stage +]
519 # Defaults for stage [+id+]; some are overridden below.
520 STAGE[+id+]_CFLAGS = $(STAGE_CFLAGS)
521 STAGE[+id+]_CXXFLAGS = $(CXXFLAGS)
522 @if target-libstdc++-v3-bootstrap
523 # Override the above if we're bootstrapping C++.
524 STAGE[+id+]_CXXFLAGS = $(STAGE[+id+]_CFLAGS)
525 @endif target-libstdc++-v3-bootstrap
526 STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS)
527 STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
528 [+ ENDFOR bootstrap-stage +]
529
530 # By default, C and C++ are the only stage1 languages, because they are the
531 # only ones we require to build with the bootstrap compiler, and also the
532 # only ones useful for building stage2.
533
534 STAGE1_CFLAGS = @stage1_cflags@
535 STAGE1_CHECKING = @stage1_checking@
536 STAGE1_LANGUAGES = @stage1_languages@
537 # * We force-disable coverage flags, since the installed compiler probably
538 # has never heard of them. Luckily, autoconf always respects the last
539 # argument when conflicting --enable arguments are passed.
540 # * We also disable -Wformat, since older GCCs don't understand newer %s.
541 STAGE1_CONFIGURE_FLAGS = $(STAGE1_CHECKING) \
542 --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" \
543 --disable-build-format-warnings
544
545 @if target-libphobos-bootstrap
546 STAGE1_CONFIGURE_FLAGS += --with-libphobos-druntime-only
547 STAGE2_CONFIGURE_FLAGS += --with-libphobos-druntime-only
548 @endif target-libphobos-bootstrap
549
550 # When using the slow stage1 compiler disable IL verification and forcefully
551 # enable it when using the stage2 compiler instead. As we later compare
552 # stage2 and stage3 we are merely avoid doing redundant work, plus we apply
553 # checking when building all target libraries for release builds.
554 STAGE1_TFLAGS += -fno-checking
555 STAGE2_CFLAGS += -fno-checking
556 STAGE2_TFLAGS += -fno-checking
557 STAGE3_CFLAGS += -fchecking=1
558 STAGE3_TFLAGS += -fchecking=1
559
560 STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
561 STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
562
563 STAGEtrain_CFLAGS = $(filter-out -fchecking=1,$(STAGE3_CFLAGS))
564 STAGEtrain_TFLAGS = $(filter-out -fchecking=1,$(STAGE3_TFLAGS))
565
566 STAGEfeedback_CFLAGS = $(STAGE4_CFLAGS) -fprofile-use -fprofile-reproducible=parallel-runs
567 STAGEfeedback_TFLAGS = $(STAGE4_TFLAGS)
568 # Disable warnings as errors for a few reasons:
569 # - sources for gen* binaries do not have .gcda files available
570 # - inlining decisions generate extra warnings
571 STAGEfeedback_CONFIGURE_FLAGS = $(filter-out --enable-werror-always,$(STAGE_CONFIGURE_FLAGS))
572
573 STAGEautoprofile_CFLAGS = $(filter-out -gtoggle,$(STAGE2_CFLAGS)) -g
574 STAGEautoprofile_TFLAGS = $(STAGE2_TFLAGS)
575
576 STAGEautofeedback_CFLAGS = $(STAGE3_CFLAGS)
577 STAGEautofeedback_TFLAGS = $(STAGE3_TFLAGS)
578 # Disable warnings as errors since inlining decisions with -fauto-profile
579 # may result in additional warnings.
580 STAGEautofeedback_CONFIGURE_FLAGS = $(filter-out --enable-werror-always,$(STAGE_CONFIGURE_FLAGS))
581
582 do-compare = @do_compare@
583 do-compare3 = $(do-compare)
584
585 # -----------------------------------------------
586 # Programs producing files for the TARGET machine
587 # -----------------------------------------------
588
589 AR_FOR_TARGET=@AR_FOR_TARGET@
590 AS_FOR_TARGET=@AS_FOR_TARGET@
591 CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@
592
593 # If GCC_FOR_TARGET is not overriden on the command line, then this
594 # variable is passed down to the gcc Makefile, where it is used to
595 # build libgcc2.a. We define it here so that it can itself be
596 # overridden on the command line.
597 GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@
598 CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@
599 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
600 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
601 GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
602 GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@
603 GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@
604 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
605 DSYMUTIL_FOR_TARGET=@DSYMUTIL_FOR_TARGET@
606 LD_FOR_TARGET=@LD_FOR_TARGET@
607
608 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
609 NM_FOR_TARGET=@NM_FOR_TARGET@
610 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
611 OBJCOPY_FOR_TARGET=@OBJCOPY_FOR_TARGET@
612 OTOOL_FOR_TARGET=@OTOOL_FOR_TARGET@
613 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
614 READELF_FOR_TARGET=@READELF_FOR_TARGET@
615 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
616 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
617 WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
618
619 COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
620 COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
621 COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
622
623 CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
624 CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
625
626 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
627 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
628 LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
629 GM2FLAGS_FOR_TARGET = -O2 -g
630 GOCFLAGS_FOR_TARGET = -O2 -g
631 GDCFLAGS_FOR_TARGET = -O2 -g
632
633 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
634 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
635 DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
636
637 XGCC_FLAGS_FOR_TARGET = $(FLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
638
639 # ------------------------------------
640 # Miscellaneous targets and flag lists
641 # ------------------------------------
642
643 # The first rule in the file had better be this one. Don't put any above it.
644 # This lives here to allow makefile fragments to contain dependencies.
645 all:
646
647 #### host and target specific makefile fragments come in here.
648 @target_makefile_frag@
649 @alphaieee_frag@
650 @ospace_frag@
651 @host_makefile_frag@
652 ###
653
654 # This is the list of directories that may be needed in RPATH_ENVVAR
655 # so that programs built for the target machine work.
656 TARGET_LIB_PATH = [+ FOR target_modules +][+
657 IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
658 ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
659 [+ FOR target_modules +][+ IF lib_path +]
660 @if target-[+module+]
661 TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
662 @endif target-[+module+]
663 [+ ENDIF lib_path +][+ ENDFOR target_modules +]
664
665
666 # This is the list of directories that may be needed in RPATH_ENVVAR
667 # so that programs built for the host machine work.
668 HOST_LIB_PATH = [+ FOR host_modules +][+
669 IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
670 ENDFOR host_modules +]
671
672 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
673 @if gcc
674 HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR):
675 @endif gcc
676
677 [+ FOR host_modules +][+ IF lib_path +]
678 @if [+module+]
679 HOST_LIB_PATH_[+module+] = \
680 $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
681 +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
682 @endif [+module+]
683 [+ ENDIF lib_path +][+ ENDFOR host_modules +]
684
685 CXX_FOR_TARGET_FLAG_TO_PASS = \
686 "CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
687 @if target-libstdc++-v3
688 # CXX_FOR_TARGET is tricky to get right for target libs that require a
689 # functional C++ compiler. When we recurse, if we expand
690 # CXX_FOR_TARGET before configuring libstdc++-v3, we won't get
691 # libstdc++ include flags from the script. Instead, we get an
692 # -funconfigured-* word, so that we'll get errors if this invalid C++
693 # command line is used for anything, but also so that we can use the
694 # word to decide whether or not to pass on this CXX_FOR_TARGET. If we
695 # don't pass it on, sub-make will use the default definition, that
696 # re-expands it at the time of use, so we'll get it right when we need
697 # it. One potential exception is the expansion of CXX_FOR_TARGET
698 # passed down as part of CXX within TARGET_FLAGS, but this wouldn't
699 # really work, for C++ host programs can't depend on the current-stage
700 # C++ target library.
701 CXX_FOR_TARGET_FLAG_TO_PASS = \
702 $(shell if echo "$(CXX_FOR_TARGET)" | grep " -funconfigured-" > /dev/null; then :; else echo '"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"'; fi)
703 @endif target-libstdc++-v3
704
705 # Flags to pass down to all sub-makes. STAGE*FLAGS,
706 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
707 # overrideable (for a bootstrap build stage1 also builds gcc.info).
708 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
709 "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
710 "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +][+ FOR bootstrap-stage +] \
711 "STAGE[+id+]_CFLAGS=$(STAGE[+id+]_CFLAGS)" \
712 "STAGE[+id+]_CXXFLAGS=$(STAGE[+id+]_CXXFLAGS)" \
713 "STAGE[+id+]_GENERATOR_CFLAGS=$(STAGE[+id+]_GENERATOR_CFLAGS)" \
714 "STAGE[+id+]_TFLAGS=$(STAGE[+id+]_TFLAGS)"[+ ENDFOR bootstrap-stage +] \
715 $(CXX_FOR_TARGET_FLAG_TO_PASS) \
716 "TFLAGS=$(TFLAGS)" \
717 "CONFIG_SHELL=$(SHELL)" \
718 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
719 $(if $(LSAN_OPTIONS),"LSAN_OPTIONS=$(LSAN_OPTIONS)")
720
721 # We leave this in just in case, but it is not needed anymore.
722 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
723
724 # Flags to pass down to most sub-makes, in which we're building with
725 # the host environment.
726 EXTRA_HOST_FLAGS = \
727 'AR=$(AR)' \
728 'AS=$(AS)' \
729 'CC=$(CC)' \
730 'CXX=$(CXX)' \
731 'DLLTOOL=$(DLLTOOL)' \
732 'DSYMUTIL=$(DSYMUTIL)' \
733 'GFORTRAN=$(GFORTRAN)' \
734 'GOC=$(GOC)' \
735 'GDC=$(GDC)' \
736 'GM2=$(GM2)' \
737 'LD=$(LD)' \
738 'LIPO=$(LIPO)' \
739 'NM=$(NM)' \
740 'OBJDUMP=$(OBJDUMP)' \
741 'OTOOL=$(OTOOL)' \
742 'RANLIB=$(RANLIB)' \
743 'READELF=$(READELF)' \
744 'STRIP=$(STRIP)' \
745 'WINDRES=$(WINDRES)' \
746 'WINDMC=$(WINDMC)' \
747 'CREATE_GCOV=$(CREATE_GCOV)' \
748 'PROFILE_MERGER=$(PROFILE_MERGER)'
749
750 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
751
752 # Flags to pass to stage1 or when not bootstrapping.
753
754 STAGE1_FLAGS_TO_PASS = \
755 LDFLAGS="$${LDFLAGS}" \
756 HOST_LIBS="$${HOST_LIBS}"
757
758 # Flags to pass to stage2 and later makes.
759
760 POSTSTAGE1_FLAGS_TO_PASS = \
761 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
762 CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
763 GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \
764 GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \
765 GNATBIND="$${GNATBIND}" \
766 LDFLAGS="$${LDFLAGS}" \
767 HOST_LIBS="$${HOST_LIBS}" \
768 $(LTO_FLAGS_TO_PASS) \
769 "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
770
771 @if gcc-bootstrap
772 EXTRA_HOST_EXPORTS = if [ $(current_stage) != stage1 ]; then \
773 $(POSTSTAGE1_HOST_EXPORTS) \
774 fi;
775
776 EXTRA_BOOTSTRAP_FLAGS = CC="$$CC" CXX="$$CXX" LDFLAGS="$$LDFLAGS"
777 @endif gcc-bootstrap
778
779 # Flags to pass down to makes which are built with the target environment.
780 # The double $ decreases the length of the command line; those variables
781 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The
782 # *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
783 # so we expand them here.
784 EXTRA_TARGET_FLAGS = \
785 'AR=$$(AR_FOR_TARGET)' \
786 'AS=$(COMPILER_AS_FOR_TARGET)' \
787 'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
788 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
789 'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
790 -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
791 $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
792 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
793 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
794 'DSYMUTIL=$$(DSYMUTIL_FOR_TARGET)' \
795 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
796 'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
797 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
798 'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
799 'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \
800 'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
801 'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \
802 'LD=$(COMPILER_LD_FOR_TARGET)' \
803 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
804 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
805 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
806 'NM=$(COMPILER_NM_FOR_TARGET)' \
807 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
808 'OBJCOPY=$$(OBJCOPY_FOR_TARGET)' \
809 'RANLIB=$$(RANLIB_FOR_TARGET)' \
810 'READELF=$$(READELF_FOR_TARGET)' \
811 'WINDRES=$$(WINDRES_FOR_TARGET)' \
812 'WINDMC=$$(WINDMC_FOR_TARGET)' \
813 'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
814 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
815 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
816 "TFLAGS=$$TFLAGS"
817
818 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
819
820 # Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
821 # unfortunately needs the native compiler and the target ar and
822 # ranlib.
823 # If any variables are added here, they must be added to do-*, below.
824 # The BUILD_* variables are a special case, which are used for the gcc
825 # cross-building scheme.
826 EXTRA_GCC_FLAGS = \
827 "GCC_FOR_TARGET=$(GCC_FOR_TARGET) $$TFLAGS" \
828 "GM2_FOR_TARGET=$(GM2_FOR_TARGET) $$TFLAGS" \
829 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
830 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
831
832 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
833
834 @if gcc
835 BUILD_CONFIG = @BUILD_CONFIG@
836 ifneq ($(BUILD_CONFIG),)
837 include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk)
838 endif
839 @endif gcc
840
841 .PHONY: configure-host
842 configure-host: [+
843 FOR host_modules +] \
844 maybe-configure-[+module+][+
845 ENDFOR host_modules +]
846 .PHONY: configure-target
847 configure-target: [+
848 FOR target_modules +] \
849 maybe-configure-target-[+module+][+
850 ENDFOR target_modules +]
851
852 # The target built for a native non-bootstrap build.
853 .PHONY: all
854
855 # --enable-pgo-build enables the PGO build.
856 # 1. First build with -fprofile-generate.
857 # 2. Use "make maybe-check-*" to generate profiling data.
858 # 3. Use "make clean" to remove the previous build.
859 # 4. Rebuild with -fprofile-use.
860 all:
861 @if gcc-bootstrap
862 [ -f stage_final ] || echo stage3 > stage_final
863 @r=`${PWD_COMMAND}`; export r; \
864 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
865 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
866 @endif gcc-bootstrap
867 @: $(MAKE); $(unstage)
868 +@r=`${PWD_COMMAND}`; export r; \
869 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
870 @if gcc-bootstrap
871 if [ -f stage_last ]; then \
872 TFLAGS="$(STAGE$(shell test ! -f stage_last || sed s,^stage,, stage_last)_TFLAGS)"; \
873 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
874 else \
875 @endif gcc-bootstrap
876 $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
877 $(PGO_BUILD_GEN_FLAGS_TO_PASS) all-host all-target \
878 @if pgo-build
879 && $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
880 $(PGO_BUILD_TRAINING_MFLAGS) \
881 $(PGO_BUILD_TRAINING_FLAGS_TO_PASS) \
882 $(PGO_BUILD_TRAINING) \
883 && $(MAKE) $(RECURSE_FLAGS_TO_PASS) clean \
884 && $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
885 $(PGO_BUILD_USE_FLAGS_TO_PASS) all-host all-target \
886 @endif pgo-build
887 @if gcc-bootstrap
888 ; \
889 fi \
890 @endif gcc-bootstrap
891 && :
892
893 .PHONY: all-build
894 [+ FOR build_modules +]
895 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
896
897 .PHONY: all-host
898 [+ FOR host_modules +][+ IF bootstrap +]
899 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
900 all-host: maybe-all-[+module+][+ IF bootstrap +]
901 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
902
903 .PHONY: all-target
904 [+ FOR target_modules +][+ IF bootstrap +]
905 @if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
906 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
907 @endif target-[+module+]-no-bootstrap[+
908 ENDIF bootstrap +][+ ENDFOR target_modules +]
909
910 # Do a target for all the subdirectories. A ``make do-X'' will do a
911 # ``make X'' in all subdirectories (because, in general, there is a
912 # dependency (below) of X upon do-X, a ``make X'' will also do this,
913 # but it may do additional work as well).
914 [+ FOR recursive_targets +]
915 .PHONY: do-[+make_target+]
916 do-[+make_target+]:
917 @: $(MAKE); $(unstage)
918 @r=`${PWD_COMMAND}`; export r; \
919 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
920 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
921 [+make_target+]-target
922
923
924 .PHONY: [+make_target+]-host
925 [+ FOR host_modules +]
926 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
927
928 .PHONY: [+make_target+]-target
929 [+ FOR target_modules +]
930 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
931 [+ ENDFOR recursive_targets +]
932
933 # Here are the targets which correspond to the do-X targets.
934
935 .PHONY: info installcheck dvi pdf html
936 .PHONY: install-info install-dvi install-pdf install-html
937 .PHONY: clean distclean mostlyclean maintainer-clean realclean
938 .PHONY: local-clean local-distclean local-maintainer-clean
939 info: do-info
940 installcheck: do-installcheck
941 dvi: do-dvi
942 pdf: do-pdf
943 html: do-html
944
945 # Make sure makeinfo is built before we do a `make info', if we're
946 # in fact building texinfo.
947 do-info: maybe-all-texinfo
948
949 install-info: do-install-info dir.info
950 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
951 if [ -f dir.info ]; then \
952 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info; \
953 else true; fi
954
955 install-dvi: do-install-dvi
956
957 install-pdf: do-install-pdf
958
959 install-html: do-install-html
960
961 local-clean:
962 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
963
964 local-distclean:
965 -rm -f Makefile config.status config.cache mh-frag mt-frag
966 -rm -f maybedep.tmp serdep.tmp stage_final
967 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
968 rm -rf $(TARGET_SUBDIR); \
969 else true; fi
970 -rm -rf $(BUILD_SUBDIR)
971 -if [ "$(HOST_SUBDIR)" != "." ]; then \
972 rm -rf $(HOST_SUBDIR); \
973 else true; fi
974 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
975 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
976 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
977 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
978 -rmdir c++tools fastjar gcc gnattools gotools 2>/dev/null
979 -rmdir libcc1 libiberty texinfo zlib 2>/dev/null
980 -find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
981
982 local-maintainer-clean:
983 @echo "This command is intended for maintainers to use;"
984 @echo "it deletes files that may require special tools to rebuild."
985
986 clean: do-clean local-clean
987 mostlyclean: do-mostlyclean local-clean
988 distclean: do-distclean local-clean local-distclean
989 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
990 maintainer-clean: local-distclean
991 realclean: maintainer-clean
992
993 # Check target.
994
995 .PHONY: check do-check
996 check: do-check
997
998 # Only include modules actually being configured and built.
999 .PHONY: check-host
1000 check-host: [+
1001 FOR host_modules +] \
1002 maybe-check-[+module+][+
1003 ENDFOR host_modules +]
1004
1005 .PHONY: check-target
1006 check-target: [+
1007 FOR target_modules +] \
1008 maybe-check-target-[+module+][+
1009 ENDFOR target_modules +]
1010
1011 do-check:
1012 @: $(MAKE); $(unstage)
1013 @r=`${PWD_COMMAND}`; export r; \
1014 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1015 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
1016
1017 # Automated reporting of test results.
1018
1019 warning.log: build.log
1020 $(srcdir)/contrib/warn_summary build.log > $@
1021
1022 mail-report.log:
1023 if test x'$(BOOT_CFLAGS)' != x''; then \
1024 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
1025 fi; \
1026 $(srcdir)/contrib/test_summary -t >$@
1027 chmod +x $@
1028 echo If you really want to send e-mail, run ./$@ now
1029
1030 mail-report-with-warnings.log: warning.log
1031 if test x'$(BOOT_CFLAGS)' != x''; then \
1032 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
1033 fi; \
1034 $(srcdir)/contrib/test_summary -t -i warning.log >$@
1035 chmod +x $@
1036 echo If you really want to send e-mail, run ./$@ now
1037
1038 # Local Vim config
1039
1040 $(srcdir)/.local.vimrc:
1041 $(LN_S) contrib/vimrc $@
1042
1043 $(srcdir)/.lvimrc:
1044 $(LN_S) contrib/vimrc $@
1045
1046 vimrc: $(srcdir)/.local.vimrc $(srcdir)/.lvimrc
1047
1048 .PHONY: vimrc
1049
1050 # clang-format config
1051
1052 $(srcdir)/.clang-format:
1053 $(LN_S) contrib/clang-format $@
1054
1055 clang-format: $(srcdir)/.clang-format
1056
1057 .PHONY: clang-format
1058
1059 # Installation targets.
1060
1061 .PHONY: install uninstall
1062 install:
1063 @: $(MAKE); $(unstage)
1064 @r=`${PWD_COMMAND}`; export r; \
1065 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1066 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
1067
1068 .PHONY: install-host-nogcc
1069 install-host-nogcc: [+
1070 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
1071 maybe-install-[+module+][+ ENDIF +][+
1072 ENDFOR host_modules +]
1073
1074 .PHONY: install-host
1075 install-host: [+
1076 FOR host_modules +] \
1077 maybe-install-[+module+][+
1078 ENDFOR host_modules +]
1079
1080 .PHONY: install-target
1081 install-target: [+
1082 FOR target_modules +] \
1083 maybe-install-target-[+module+][+
1084 ENDFOR target_modules +]
1085
1086 uninstall:
1087 @echo "the uninstall target is not supported in this tree"
1088
1089 .PHONY: install.all
1090 install.all: install-no-fixedincludes
1091 @if [ -f ./gcc/Makefile ]; then \
1092 r=`${PWD_COMMAND}`; export r; \
1093 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1094 $(HOST_EXPORTS) \
1095 (cd ./gcc && \
1096 $(MAKE) $(FLAGS_TO_PASS) install-headers); \
1097 else \
1098 true; \
1099 fi
1100
1101 # install-no-fixedincludes is used to allow the elaboration of binary packages
1102 # suitable for distribution, where we cannot include the fixed system header
1103 # files.
1104 .PHONY: install-no-fixedincludes
1105 install-no-fixedincludes: installdirs install-host-nogcc \
1106 install-target gcc-install-no-fixedincludes
1107
1108 .PHONY: install-strip
1109 install-strip:
1110 @: $(MAKE); $(unstage)
1111 @r=`${PWD_COMMAND}`; export r; \
1112 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1113 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-strip-host install-strip-target
1114
1115 .PHONY: install-strip-host
1116 install-strip-host: [+
1117 FOR host_modules +] \
1118 maybe-install-strip-[+module+][+
1119 ENDFOR host_modules +]
1120
1121 .PHONY: install-strip-target
1122 install-strip-target: [+
1123 FOR target_modules +] \
1124 maybe-install-strip-target-[+module+][+
1125 ENDFOR target_modules +]
1126
1127
1128 ### other supporting targets
1129
1130 MAKEDIRS= \
1131 $(DESTDIR)$(prefix) \
1132 $(DESTDIR)$(exec_prefix)
1133 .PHONY: installdirs
1134 installdirs: mkinstalldirs
1135 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
1136
1137 dir.info: do-install-info
1138 if [ -f $(srcdir)/texinfo/gen-info-dir ]; then \
1139 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new; \
1140 mv -f dir.info.new dir.info; \
1141 else true; \
1142 fi
1143
1144 dist:
1145 @echo "Building a full distribution of this tree isn't done"
1146 @echo "via 'make dist'. Check out the etc/ subdirectory"
1147
1148 etags tags: TAGS
1149
1150 # Right now this just builds TAGS in each subdirectory. emacs19 has the
1151 # ability to use several tags files at once, so there is probably no need
1152 # to combine them into one big TAGS file (like CVS 1.3 does). We could
1153 # (if we felt like it) have this Makefile write a piece of elisp which
1154 # the user could load to tell emacs19 where all the TAGS files we just
1155 # built are.
1156 TAGS: do-TAGS
1157
1158 # ------------------------------------
1159 # Macros for configure and all targets
1160 # ------------------------------------
1161
1162 [+ DEFINE configure +]
1163 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
1164 maybe-configure-[+prefix+][+module+]:
1165 @if gcc-bootstrap
1166 configure-[+prefix+][+module+]: stage_current
1167 @endif gcc-bootstrap
1168 @if [+prefix+][+module+]
1169 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
1170 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
1171 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1172 @r=`${PWD_COMMAND}`; export r; \
1173 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1174 [+ IF check_multilibs
1175 +]echo "Checking multilib configuration for [+module+]..."; \
1176 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1177 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \
1178 if test -r [+subdir+]/[+module+]/multilib.out; then \
1179 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
1180 rm -f [+subdir+]/[+module+]/multilib.tmp; \
1181 else \
1182 rm -f [+subdir+]/[+module+]/Makefile; \
1183 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1184 fi; \
1185 else \
1186 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1187 fi; \
1188 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
1189 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1190 [+exports+] [+extra_exports+] \
1191 echo Configuring in [+subdir+]/[+module+]; \
1192 cd "[+subdir+]/[+module+]" || exit 1; \
1193 case $(srcdir) in \
1194 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1195 *) topdir=`echo [+subdir+]/[+module+]/ | \
1196 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1197 esac; \
1198 module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \
1199 [+ IF no-config-site +]rm -f no-such-file || : ; \
1200 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) \
1201 $$s/$$module_srcdir/configure \
1202 --srcdir=$${topdir}/$$module_srcdir \
1203 [+args+] --build=${build_alias} --host=[+host_alias+] \
1204 --target=[+target_alias+] [+extra_configure_flags+] \
1205 || exit 1
1206 @endif [+prefix+][+module+]
1207
1208 [+ IF bootstrap +]
1209 [+ FOR bootstrap_stage +]
1210 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
1211 maybe-configure-stage[+id+]-[+prefix+][+module+]:
1212 @if [+prefix+][+module+]-bootstrap
1213 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
1214 configure-stage[+id+]-[+prefix+][+module+]:
1215 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
1216 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
1217 @r=`${PWD_COMMAND}`; export r; \
1218 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1219 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1220 [+ IF check_multilibs
1221 +]echo "Checking multilib configuration for [+module+]..."; \
1222 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \
1223 if test -r [+subdir+]/[+module+]/multilib.out; then \
1224 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
1225 rm -f [+subdir+]/[+module+]/multilib.tmp; \
1226 else \
1227 rm -f [+subdir+]/[+module+]/Makefile; \
1228 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1229 fi; \
1230 else \
1231 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
1232 fi; \
1233 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
1234 [+exports+][+ IF prev +] \
1235 [+poststage1_exports+][+ ENDIF prev +][+ IF prefix +] \
1236 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
1237 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
1238 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;[+ ELSE prefix +] \
1239 CFLAGS="$(STAGE[+id+]_CFLAGS)"; export CFLAGS; \
1240 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"; export CXXFLAGS;[+ IF prev +] \
1241 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1242 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +]; export LIBCFLAGS;[+
1243 ENDIF prefix +] [+extra_exports+] \
1244 echo Configuring stage [+id+] in [+subdir+]/[+module+]; \
1245 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1246 cd [+subdir+]/[+module+] || exit 1; \
1247 case $(srcdir) in \
1248 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1249 *) topdir=`echo [+subdir+]/[+module+]/ | \
1250 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1251 esac; \
1252 module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \
1253 $(SHELL) $$s/$$module_srcdir/configure \
1254 --srcdir=$${topdir}/$$module_srcdir \
1255 [+args+] --build=${build_alias} --host=[+host_alias+] \
1256 --target=[+target_alias+] \
1257 [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
1258 $(STAGE[+id+]_CONFIGURE_FLAGS)[+ IF extra_configure_flags +] \
1259 [+extra_configure_flags+][+ ENDIF extra_configure_flags +]
1260 @endif [+prefix+][+module+]-bootstrap
1261 [+ ENDFOR bootstrap_stage +]
1262 [+ ENDIF bootstrap +]
1263 [+ ENDDEF +]
1264
1265 [+ DEFINE all +]
1266 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
1267 maybe-all-[+prefix+][+module+]:
1268 @if gcc-bootstrap
1269 all-[+prefix+][+module+]: stage_current
1270 @endif gcc-bootstrap
1271 @if [+prefix+][+module+]
1272 TARGET-[+prefix+][+module+]=[+
1273 IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
1274 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
1275 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
1276 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1277 @r=`${PWD_COMMAND}`; export r; \
1278 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1279 [+exports+] [+extra_exports+] \
1280 (cd [+subdir+]/[+module+] && \
1281 $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+stage1_args+] [+extra_make_flags+] \
1282 $(TARGET-[+prefix+][+module+]))
1283 @endif [+prefix+][+module+]
1284
1285 [+ IF bootstrap +]
1286 [+ FOR bootstrap_stage +]
1287 .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
1288 .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
1289 maybe-all-stage[+id+]-[+prefix+][+module+]:
1290 maybe-clean-stage[+id+]-[+prefix+][+module+]:
1291 @if [+prefix+][+module+]-bootstrap
1292 maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
1293 all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
1294 TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
1295 all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
1296 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
1297 @r=`${PWD_COMMAND}`; export r; \
1298 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1299 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1300 [+exports+][+ IF prev +] \
1301 [+poststage1_exports+][+ ENDIF prev +] [+extra_exports+] \
1302 cd [+subdir+]/[+module+] && \
1303 [+autoprofile+] \
1304 $(MAKE) $(BASE_FLAGS_TO_PASS)[+ IF prefix +] \
1305 CFLAGS="$(CFLAGS_FOR_TARGET)" \
1306 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
1307 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"[+ ELSE prefix +] \
1308 CFLAGS="$(STAGE[+id+]_CFLAGS)" \
1309 GENERATOR_CFLAGS="$(STAGE[+id+]_GENERATOR_CFLAGS)" \
1310 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"[+ IF prev +] \
1311 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1312 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +][+ ENDIF prefix +] \
1313 CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
1314 CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
1315 LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
1316 [+args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \
1317 [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] \
1318 TFLAGS="$(STAGE[+id+]_TFLAGS)" [+profile_data+] \
1319 $(TARGET-stage[+id+]-[+prefix+][+module+])
1320
1321 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
1322 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
1323 clean-stage[+id+]-[+prefix+][+module+]:
1324 @if [ $(current_stage) = stage[+id+] ]; then \
1325 [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
1326 else \
1327 [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
1328 $(MAKE) stage[+id+]-start; \
1329 fi; \
1330 cd [+subdir+]/[+module+] && \
1331 $(MAKE) [+args+] [+ IF prev +][+poststage1_args+][+ ELSE prev +] \
1332 [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] clean
1333 @endif [+prefix+][+module+]-bootstrap
1334
1335 [+ ENDFOR bootstrap_stage +]
1336 [+ ENDIF bootstrap +]
1337 [+ ENDDEF +]
1338
1339 # --------------------------------------
1340 # Modules which run on the build machine
1341 # --------------------------------------
1342 [+ FOR build_modules +]
1343 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1344 host_alias=(get "host" "${build_alias}")
1345 target_alias=(get "target" "${target_alias}")
1346 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
1347
1348 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1349 args="$(EXTRA_BUILD_FLAGS)" +]
1350 [+ ENDFOR build_module +]
1351
1352 # --------------------------------------
1353 # Modules which run on the host machine
1354 # --------------------------------------
1355 [+ FOR host_modules +]
1356 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
1357 exports="$(HOST_EXPORTS)"
1358 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1359 host_alias=(get "host" "${host_alias}")
1360 target_alias=(get "target" "${target_alias}")
1361 args="$(HOST_CONFIGARGS)" +]
1362
1363 [+ all prefix="" subdir="$(HOST_SUBDIR)"
1364 exports="$(HOST_EXPORTS)"
1365 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1366 args="$(EXTRA_HOST_FLAGS)"
1367 stage1_args="$(STAGE1_FLAGS_TO_PASS)"
1368 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
1369
1370 .PHONY: check-[+module+] maybe-check-[+module+]
1371 maybe-check-[+module+]:
1372 @if [+module+]
1373 maybe-check-[+module+]: check-[+module+]
1374 [+ IF no_check +]
1375 check-[+module+]:
1376 [+ ELIF no_check_cross +]
1377 # This module is only tested in a native toolchain.
1378 check-[+module+]:
1379 @: $(MAKE); $(unstage)
1380 @if [ '$(host)' = '$(target)' ]; then \
1381 r=`${PWD_COMMAND}`; export r; \
1382 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1383 $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
1384 ENDIF bootstrap +] \
1385 (cd $(HOST_SUBDIR)/[+module+] && \
1386 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
1387 IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
1388 fi
1389 [+ ELSE check +]
1390 check-[+module+]:
1391 @: $(MAKE); $(unstage)
1392 @r=`${PWD_COMMAND}`; export r; \
1393 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1394 $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
1395 ENDIF bootstrap +] \
1396 (cd $(HOST_SUBDIR)/[+module+] && \
1397 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
1398 IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
1399 [+ ENDIF no_check +]
1400 @endif [+module+]
1401
1402 .PHONY: install-[+module+] maybe-install-[+module+]
1403 maybe-install-[+module+]:
1404 @if [+module+]
1405 maybe-install-[+module+]: install-[+module+]
1406 [+ IF no_install +]
1407 install-[+module+]:
1408 [+ ELSE install +]
1409 install-[+module+]: installdirs
1410 @: $(MAKE); $(unstage)
1411 @r=`${PWD_COMMAND}`; export r; \
1412 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1413 $(HOST_EXPORTS) \
1414 (cd $(HOST_SUBDIR)/[+module+] && \
1415 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
1416 [+ ENDIF no_install +]
1417 @endif [+module+]
1418
1419 .PHONY: install-strip-[+module+] maybe-install-strip-[+module+]
1420 maybe-install-strip-[+module+]:
1421 @if [+module+]
1422 maybe-install-strip-[+module+]: install-strip-[+module+]
1423 [+ IF no_install +]
1424 install-strip-[+module+]:
1425 [+ ELSE install +]
1426 install-strip-[+module+]: installdirs
1427 @: $(MAKE); $(unstage)
1428 @r=`${PWD_COMMAND}`; export r; \
1429 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1430 $(HOST_EXPORTS) \
1431 (cd $(HOST_SUBDIR)/[+module+] && \
1432 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
1433 [+ ENDIF no_install +]
1434 @endif [+module+]
1435
1436 # Other targets (info, dvi, pdf, etc.)
1437 [+ FOR recursive_targets +]
1438 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1439 maybe-[+make_target+]-[+module+]:
1440 @if [+module+]
1441 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
1442 [+ IF (match-value? = "missing" (get "make_target") ) +]
1443 # [+module+] doesn't support [+make_target+].
1444 [+make_target+]-[+module+]:
1445 [+ ELSE +]
1446 [+make_target+]-[+module+]: [+
1447 FOR depend +]\
1448 [+depend+]-[+module+] [+
1449 ENDFOR depend +]
1450 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1451 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
1452 r=`${PWD_COMMAND}`; export r; \
1453 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1454 $(HOST_EXPORTS) \
1455 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1456 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1457 done; \
1458 echo "Doing [+make_target+] in [+module+]"; \
1459 (cd $(HOST_SUBDIR)/[+module+] && \
1460 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1461 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1462 "RANLIB=$${RANLIB}" \
1463 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1464 [+make_target+]) \
1465 || exit 1
1466 [+ ENDIF +]
1467 @endif [+module+]
1468 [+ ENDFOR recursive_targets +]
1469 [+ ENDFOR host_modules +]
1470
1471 # ---------------------------------------
1472 # Modules which run on the target machine
1473 # ---------------------------------------
1474 [+ FOR target_modules +]
1475
1476 [+ IF raw_cxx +]
1477 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1478 check_multilibs=true
1479 exports="$(RAW_CXX_TARGET_EXPORTS)"
1480 host_alias=(get "host" "${target_alias}")
1481 target_alias=(get "target" "${target_alias}")
1482 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1483
1484 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1485 exports="$(RAW_CXX_TARGET_EXPORTS)"
1486 args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1487 [+ ELSE +]
1488 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1489 check_multilibs=true
1490 exports="$(NORMAL_TARGET_EXPORTS)"
1491 host_alias=(get "host" "${target_alias}")
1492 target_alias=(get "target" "${target_alias}")
1493 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1494
1495 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1496 exports="$(NORMAL_TARGET_EXPORTS)"
1497 args="$(EXTRA_TARGET_FLAGS)" +]
1498 [+ ENDIF +]
1499
1500 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1501 maybe-check-target-[+module+]:
1502 @if target-[+module+]
1503 maybe-check-target-[+module+]: check-target-[+module+]
1504 [+ IF no_check +]
1505 # Dummy target for uncheckable module.
1506 check-target-[+module+]:
1507 [+ ELSE check +]
1508 check-target-[+module+]:
1509 @: $(MAKE); $(unstage)
1510 @r=`${PWD_COMMAND}`; export r; \
1511 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1512 IF raw_cxx +]
1513 $(RAW_CXX_TARGET_EXPORTS) \[+
1514 ELSE normal_cxx +]
1515 $(NORMAL_TARGET_EXPORTS) \[+
1516 ENDIF raw_cxx +]
1517 (cd $(TARGET_SUBDIR)/[+module+] && \
1518 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1519 IF raw_cxx
1520 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1521 ENDIF raw_cxx
1522 +] [+extra_make_flags+] check)
1523 [+ ENDIF no_check +]
1524 @endif target-[+module+]
1525
1526 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1527 maybe-install-target-[+module+]:
1528 @if target-[+module+]
1529 maybe-install-target-[+module+]: install-target-[+module+]
1530 [+ IF no_install +]
1531 # Dummy target for uninstallable.
1532 install-target-[+module+]:
1533 [+ ELSE install +]
1534 install-target-[+module+]: installdirs
1535 @: $(MAKE); $(unstage)
1536 @r=`${PWD_COMMAND}`; export r; \
1537 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1538 IF raw_cxx +]
1539 $(RAW_CXX_TARGET_EXPORTS) \[+
1540 ELSE normal_cxx +]
1541 $(NORMAL_TARGET_EXPORTS) \[+
1542 ENDIF raw_cxx +]
1543 (cd $(TARGET_SUBDIR)/[+module+] && \
1544 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1545 [+ ENDIF no_install +]
1546 @endif target-[+module+]
1547
1548 .PHONY: install-strip-target-[+module+] maybe-install-strip-target-[+module+]
1549 maybe-install-strip-target-[+module+]:
1550 @if target-[+module+]
1551 maybe-install-strip-target-[+module+]: install-strip-target-[+module+]
1552 [+ IF no_install +]
1553 # Dummy target for uninstallable.
1554 install-strip-target-[+module+]:
1555 [+ ELSE install +]
1556 install-strip-target-[+module+]: installdirs
1557 @: $(MAKE); $(unstage)
1558 @r=`${PWD_COMMAND}`; export r; \
1559 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1560 IF raw_cxx +]
1561 $(RAW_CXX_TARGET_EXPORTS) \[+
1562 ELSE normal_cxx +]
1563 $(NORMAL_TARGET_EXPORTS) \[+
1564 ENDIF raw_cxx +]
1565 (cd $(TARGET_SUBDIR)/[+module+] && \
1566 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install-strip)
1567 [+ ENDIF no_install +]
1568 @endif target-[+module+]
1569
1570 # Other targets (info, dvi, pdf, etc.)
1571 [+ FOR recursive_targets +]
1572 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1573 maybe-[+make_target+]-target-[+module+]:
1574 @if target-[+module+]
1575 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1576 [+ IF (match-value? = "missing" (get "make_target") ) +]
1577 # [+module+] doesn't support [+make_target+].
1578 [+make_target+]-target-[+module+]:
1579 [+ ELSE +]
1580 [+make_target+]-target-[+module+]: [+
1581 FOR depend +]\
1582 [+depend+]-target-[+module+] [+
1583 ENDFOR depend +]
1584 @: $(MAKE); $(unstage)
1585 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0; \
1586 r=`${PWD_COMMAND}`; export r; \
1587 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1588 IF raw_cxx +]
1589 $(RAW_CXX_TARGET_EXPORTS) \[+
1590 ELSE normal_cxx +]
1591 $(NORMAL_TARGET_EXPORTS) \[+
1592 ENDIF raw_cxx +]
1593 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]"; \
1594 for flag in $(EXTRA_TARGET_FLAGS); do \
1595 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1596 done; \
1597 (cd $(TARGET_SUBDIR)/[+module+] && \
1598 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1599 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1600 "RANLIB=$${RANLIB}" \
1601 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1602 [+extra_make_flags+] [+make_target+]) \
1603 || exit 1
1604 [+ ENDIF +]
1605 @endif target-[+module+]
1606 [+ ENDFOR recursive_targets +]
1607 [+ ENDFOR target_modules +]
1608
1609 @if target-libgomp
1610 .PHONY: check-target-libgomp-c++
1611 check-target-libgomp-c++:
1612 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libgomp
1613
1614 .PHONY: check-target-libgomp-fortran
1615 check-target-libgomp-fortran:
1616 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) fortran.exp" check-target-libgomp
1617
1618 @endif target-libgomp
1619
1620 @if target-libitm
1621 .PHONY: check-target-libitm-c++
1622 check-target-libitm-c++:
1623 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libitm
1624
1625 @endif target-libitm
1626
1627 # ----------
1628 # GCC module
1629 # ----------
1630
1631 @if gcc-no-bootstrap
1632 .PHONY: cross
1633 cross: all-build all-gas all-ld
1634 @r=`${PWD_COMMAND}`; export r; \
1635 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1636 $(HOST_EXPORTS) \
1637 echo "Building the C and C++ compiler"; \
1638 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1639 @r=`${PWD_COMMAND}`; export r; \
1640 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1641 echo "Building runtime libraries"; \
1642 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1643 @endif gcc-no-bootstrap
1644
1645 @if gcc
1646
1647 .PHONY: gcc-site.exp
1648 gcc-site.exp:
1649 r=`${PWD_COMMAND}`; export r; \
1650 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1651 $(HOST_EXPORTS) \
1652 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) site.exp);
1653
1654 [+ FOR languages +]
1655 .PHONY: check-gcc-[+language+] check-[+language+]
1656 check-gcc-[+language+]: gcc-site.exp
1657 r=`${PWD_COMMAND}`; export r; \
1658 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1659 $(HOST_EXPORTS) \
1660 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]);
1661 check-[+language+]: check-gcc-[+language+][+ FOR lib-check-target +] [+ lib-check-target +][+ ENDFOR lib-check-target +]
1662 [+ ENDFOR languages +]
1663
1664 # The gcc part of install-no-fixedincludes, which relies on an intimate
1665 # knowledge of how a number of gcc internal targets (inter)operate. Delegate.
1666 .PHONY: gcc-install-no-fixedincludes
1667 gcc-install-no-fixedincludes:
1668 @if [ -f ./gcc/Makefile ]; then \
1669 r=`${PWD_COMMAND}`; export r; \
1670 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1671 $(HOST_EXPORTS) \
1672 (cd ./gcc \
1673 && $(MAKE) $(GCC_FLAGS_TO_PASS) install-no-fixedincludes); \
1674 else true; fi
1675 @endif gcc
1676
1677 # ---------------------
1678 # GCC bootstrap support
1679 # ---------------------
1680
1681 # We track the current stage (the one in 'gcc') in the stage_current file.
1682 # stage_last instead tracks the stage that was built last. These targets
1683 # are dummy when toplevel bootstrap is not active.
1684
1685 # While making host and target tools, symlinks to the final stage must be
1686 # there, so $(unstage) should be run at various points. To avoid excessive
1687 # recursive invocations of make, we "inline" them using a variable. These
1688 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1689 # to avoid warnings from the GNU Make job server.
1690
1691 unstage = :
1692 stage = :
1693 current_stage = ""
1694
1695 @if gcc-bootstrap
1696 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1697 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1698 current_stage = "`cat stage_current 2> /dev/null`"
1699 @endif gcc-bootstrap
1700
1701 .PHONY: unstage stage
1702 unstage:
1703 @: $(MAKE); $(unstage)
1704 stage:
1705 @: $(MAKE); $(stage)
1706
1707 # Disable commands for lean bootstrap.
1708 LEAN = false
1709
1710 # We name the build directories for the various stages "stage1-gcc",
1711 # "stage2-gcc","stage3-gcc", etc.
1712
1713 # Since the 'compare' process will fail (on debugging information) if any
1714 # directory names are different, we need to link the gcc directory for
1715 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1716 # the build directories constant as well. For the latter, we use naked names
1717 # like 'gcc', because the scripts in that directory assume it. We use
1718 # mv on platforms where symlinks to directories do not work or are not
1719 # reliable.
1720
1721 # 'touch' doesn't work right on some platforms.
1722 STAMP = echo timestamp >
1723
1724 # We only want to compare .o files, so set this!
1725 objext = .o
1726
1727 [+ FOR bootstrap-stage +]
1728 .PHONY: stage[+id+]-start stage[+id+]-end
1729
1730 stage[+id+]-start::
1731 @: $(MAKE); $(stage); \
1732 echo stage[+id+] > stage_current; \
1733 echo stage[+id+] > stage_last; \
1734 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1735 FOR host_modules +][+ IF bootstrap +]
1736 @if [+ module +]
1737 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1738 mkdir stage[+id+]-[+module+]; \
1739 mv stage[+id+]-[+module+] [+module+][+ IF prev +]; \
1740 mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1741 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1742 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1743 mkdir stage[+id+]-$(TARGET_SUBDIR); \
1744 mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR)[+ IF prev +]; \
1745 mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1746
1747 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1748 @if [+ module +]
1749 @if test -d $(HOST_SUBDIR)/[+module+]; then \
1750 cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+][+ IF prev +]; \
1751 mv prev-[+module+] stage[+prev+]-[+module+]; : [+ ENDIF prev +]; \
1752 fi
1753 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1754 @if test -d $(TARGET_SUBDIR); then \
1755 mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR)[+ IF prev +]; \
1756 mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR); : [+ ENDIF prev +]; \
1757 fi
1758 rm -f stage_current
1759
1760 # Bubble a bug fix through all the stages up to stage [+id+]. They are
1761 # remade, but not reconfigured. The next stage (if any) will not be
1762 # reconfigured either.
1763 .PHONY: stage[+id+]-bubble
1764 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1765 @r=`${PWD_COMMAND}`; export r; \
1766 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1767 if test -f stage[+id+]-lean [+
1768 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +]; then \
1769 echo Skipping rebuild of stage[+id+]; \
1770 else \
1771 $(MAKE) stage[+id+]-start; \[+IF lean +]
1772 if $(LEAN); then \
1773 rm -rf stage[+lean+]-*; \
1774 $(STAMP) stage[+lean+]-lean; \
1775 fi; \[+ ENDIF lean +]
1776 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1777 fi[+ IF compare-target +]
1778 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1779
1780 .PHONY: all-stage[+id+] clean-stage[+id+]
1781 do-clean: clean-stage[+id+]
1782
1783 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1784 # only possibility, but now it conflicts with no-bootstrap rules
1785 @if gcc-bootstrap
1786 [+ IF compare-target +]
1787 [+compare-target+]:
1788 @r=`${PWD_COMMAND}`; export r; \
1789 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1790 if test -f stage[+prev+]-lean; then \
1791 echo Cannot compare object files as stage [+prev+] was deleted.; \
1792 exit 0; \
1793 fi; \
1794 : $(MAKE); $(stage); \
1795 rm -f .bad_compare; \
1796 echo Comparing stages [+prev+] and [+id+]; \
1797 sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \
1798 files=`find stage[+id+]-* -name "*$(objext)" -print | \
1799 sed -n s,^stage$$sed-,,p`; \
1800 for file in $${files} ${extra-compare}; do \
1801 f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \
1802 if test ! -f $$f1; then continue; fi; \
1803 $(do-[+compare-target+]) > /dev/null 2>&1; \
1804 if test $$? -eq 1; then \
1805 case $$file in \
1806 @compare_exclusions@) \
1807 echo warning: $$file differs ;; \
1808 *) \
1809 echo $$file differs >> .bad_compare ;; \
1810 esac; \
1811 fi; \
1812 done; \
1813 if [ -f .bad_compare ]; then \
1814 echo "Bootstrap comparison failure!"; \
1815 cat .bad_compare; \
1816 exit 1; \
1817 else \
1818 echo Comparison successful.; \
1819 fi; \
1820 $(STAMP) [+compare-target+][+ IF prev +]
1821 if $(LEAN); then \
1822 rm -rf stage[+prev+]-*; \
1823 $(STAMP) stage[+prev+]-lean; \
1824 fi[+ ENDIF prev +]
1825 [+ ENDIF compare-target +]
1826
1827 [+ IF bootstrap-target +]
1828 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1829 [+bootstrap-target+]:
1830 echo stage[+id+] > stage_final
1831 @r=`${PWD_COMMAND}`; export r; \
1832 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1833 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1834 @: $(MAKE); $(unstage)
1835 @r=`${PWD_COMMAND}`; export r; \
1836 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1837 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1838 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1839
1840 [+bootstrap-target+]-lean:
1841 echo stage[+id+] > stage_final
1842 @r=`${PWD_COMMAND}`; export r; \
1843 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1844 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1845 @: $(MAKE); $(unstage)
1846 @r=`${PWD_COMMAND}`; export r; \
1847 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1848 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1849 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1850 [+ ENDIF bootstrap-target +]
1851
1852 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1853 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1854 .PHONY: distclean-stage[+id+]
1855 distclean-stage[+id+]::
1856 @: $(MAKE); $(stage)
1857 @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1858 rm -rf stage[+id+]-* [+
1859 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1860
1861 [+ IF cleanstrap-target +]
1862 .PHONY: [+cleanstrap-target+]
1863 [+cleanstrap-target+]: do-distclean local-clean
1864 echo stage[+id+] > stage_final
1865 @r=`${PWD_COMMAND}`; export r; \
1866 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1867 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1868 @: $(MAKE); $(unstage)
1869 @r=`${PWD_COMMAND}`; export r; \
1870 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1871 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1872 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1873 [+ ENDIF cleanstrap-target +]
1874 @endif gcc-bootstrap
1875
1876 [+ ENDFOR bootstrap-stage +]
1877
1878 stageprofile-end::
1879 $(MAKE) distclean-stagefeedback
1880
1881 stagefeedback-start::
1882 @r=`${PWD_COMMAND}`; export r; \
1883 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1884 for i in prev-*; do \
1885 j=`echo $$i | sed s/^prev-//`; \
1886 cd $$r/$$i && \
1887 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL); } && \
1888 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL); }; \
1889 done
1890
1891 @if gcc-bootstrap
1892 do-distclean: distclean-stage1
1893
1894 # Provide a GCC build when we're building target libraries. This does
1895 # not work as a dependency, just as the minimum necessary to avoid errors.
1896 stage_last:
1897 @r=`${PWD_COMMAND}`; export r; \
1898 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1899 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1900
1901 # Same as unstage, but not phony and defaulting to stage1-start. We place
1902 # it in the dependency so that for example `make -j3 all-gcc' works.
1903 stage_current:
1904 @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1905
1906 .PHONY: restrap
1907 restrap::
1908 @: $(MAKE); $(stage)
1909 rm -rf stage1-$(TARGET_SUBDIR)[+ FOR bootstrap-stage +][+ IF prev
1910 +] stage[+id+]-*[+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1911 restrap:: all
1912 @endif gcc-bootstrap
1913
1914 # --------------------------------------
1915 # Dependencies between different modules
1916 # --------------------------------------
1917
1918 # Generic dependencies for target modules on host stuff, especially gcc
1919 @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1920 +][+ FOR bootstrap_stage +]
1921 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1922 ENDFOR +][+ ELSE bootstrap +]
1923 configure-target-[+module+]: stage_last[+
1924 ENDIF bootstrap +][+ ENDFOR target_modules +]
1925 @endif gcc-bootstrap
1926
1927 @if gcc-no-bootstrap[+ FOR target_modules +]
1928 configure-target-[+module+]: maybe-all-gcc[+
1929 ENDFOR target_modules +]
1930 @endif gcc-no-bootstrap
1931
1932
1933 # There are two types of dependencies here: 'hard' dependencies, where one
1934 # module simply won't build without the other; and 'soft' dependencies, where
1935 # if the depended-on module is missing, the depending module will do without
1936 # or find a substitute somewhere (perhaps installed). Soft dependencies
1937 # are made here to depend on a 'maybe-' target. If you're not sure,
1938 # it's safer to use a soft dependency.
1939
1940 [+ ;; These Scheme functions build the bulk of the dependencies.
1941 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1942 ;; where "maybe-" is only included if HARD is not true, and all-gcc
1943 ;; is taken from VAR-NAME.
1944 (define dep-target (lambda (module-kind var-name hard)
1945 (string-append
1946 (if hard "" "maybe-")
1947 (dep-subtarget var-name)
1948 module-kind
1949 (dep-module var-name)
1950 )))
1951
1952 ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1953 (define make-dep (lambda (module-kind on-kind)
1954 (string-append
1955 (dep-target module-kind "module" #t) ": "
1956 (dep-target on-kind "on" (exist? "hard")))))
1957
1958 ;; dep-subtarget extracts everything up to the first dash in the given
1959 ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1960 (define dep-subtarget (lambda (var-name)
1961 (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1962
1963 ;; dep-module extracts everything up to the first dash in the given
1964 ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1965 (define dep-module (lambda (var-name)
1966 (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1967
1968 ;; dep-stage builds a string for the prefix of a bootstrap stage.
1969 (define dep-stage (lambda ()
1970 (string-append
1971 "stage"
1972 (get "id")
1973 "-")))
1974
1975 ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1976 ;; but is written in Scheme.
1977 (define dep-maybe (lambda ()
1978 (if (exist? "hard") "" "maybe-")))
1979
1980 ;; dep-kind returns "prebootstrap" for configure or build
1981 ;; dependencies of bootstrapped modules on a build module
1982 ;; (e.g. all-gcc on all-build-bison); "normal" if the dependency is
1983 ;; on an "install" target, or if the dependence module is not
1984 ;; bootstrapped; otherwise, it returns "bootstrap" or
1985 ;; "postbootstrap" depending on whether the dependent module is
1986 ;; bootstrapped. All this is only necessary for host and target
1987 ;; modules. It might seem like, in order to avoid build races, we
1988 ;; might need more elaborate detection between prebootstrap and
1989 ;; postbootstrap modules, but there are no host prebootstrap
1990 ;; modules. If there were any non-bootstrap host modules that
1991 ;; bootstrap modules depended on, we'd get unsatisfied per-stage
1992 ;; dependencies on them, which would be immediately noticed.
1993 (define dep-kind (lambda ()
1994 (cond
1995 ((and (hash-ref boot-modules (dep-module "module"))
1996 (=* (dep-module "on") "build-"))
1997 "prebootstrap")
1998
1999 ((or (= (dep-subtarget "on") "install-")
2000 (not (hash-ref boot-modules (dep-module "on"))))
2001 "normal")
2002
2003 ((hash-ref boot-modules (dep-module "module"))
2004 "bootstrap")
2005
2006 (1 "postbootstrap"))))
2007
2008 (define make-postboot-dep (lambda ()
2009 (let ((target (dep-module "module")) (dep "stage_last"))
2010 (unless (= (hash-ref postboot-targets target) dep)
2011 (hash-create-handle! postboot-targets target dep)
2012 ;; All non-bootstrap modules' configure target already
2013 ;; depend on dep.
2014 (unless (=* target "target-")
2015 (string-append "configure-" target ": " dep "\n"))))))
2016
2017 ;; Dependencies in between target modules if the dependencies
2018 ;; are bootstrap target modules and the target modules which
2019 ;; depend on them are emitted inside of @unless gcc-bootstrap.
2020 ;; Unfortunately, some target modules like libatomic or libbacktrace
2021 ;; have bootstrap flag set, but whether they are actually built
2022 ;; during bootstrap or after bootstrap depends on e.g. enabled languages;
2023 ;; if d is enabled, libphobos is built as target module and depends
2024 ;; on libatomic and libbacktrace, which are therefore also built as
2025 ;; bootstrap modules. If d is not enabled but go is, libatomic and
2026 ;; libbacktrace are just dependencies of libgo which is not a bootstrap
2027 ;; target module, but we need dependencies on libatomic and libbacktrace
2028 ;; in that case even when gcc-bootstrap. This lambda emits those.
2029 (define make-postboot-target-dep (lambda ()
2030 (let ((target (dep-module "module")) (on (dep-module "on")))
2031 (when (=* on "target-")
2032 (when (=* target "target-")
2033 (string-append "@unless " on "-bootstrap\n" (make-dep "" "")
2034 "\n@endunless " on "-bootstrap\n"))))))
2035
2036 ;; We now build the hash table that is used by dep-kind.
2037 (define boot-modules (make-hash-table 113))
2038 (define postboot-targets (make-hash-table 113))
2039 +]
2040
2041 [+ FOR host_modules +][+
2042 (if (exist? "bootstrap")
2043 (hash-create-handle! boot-modules (get "module") #t))
2044 "" +][+ ENDFOR host_modules +]
2045 [+ FOR target_modules +][+
2046 (if (exist? "bootstrap")
2047 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
2048 "" +][+ ENDFOR target_modules +]
2049
2050 # With all the machinery above in place, it is pretty easy to generate
2051 # dependencies. Host dependencies are a bit more complex because we have
2052 # to check for bootstrap/prebootstrap dependencies. To resolve
2053 # prebootstrap dependencies, prebootstrap modules are gathered in
2054 # a hash table.
2055 [+ FOR dependencies +][+ CASE (dep-kind) +]
2056 [+ == "prebootstrap" +][+ (make-dep "" "") +][+ FOR bootstrap_stage +]
2057 [+ (make-dep (dep-stage) "") +][+ ENDFOR bootstrap_stage +]
2058 [+ == "bootstrap" +][+ (make-dep "" "") +][+ FOR bootstrap_stage +]
2059 [+ (make-dep (dep-stage) (dep-stage)) +][+ ENDFOR bootstrap_stage +]
2060 [+ == "normal" +][+ (make-dep "" "") +]
2061 [+ ESAC +][+ ENDFOR dependencies +]
2062
2063 @if gcc-bootstrap
2064 [+ FOR dependencies +][+ CASE (dep-kind) +]
2065 [+ == "postbootstrap" +][+ (make-postboot-dep) +][+ ESAC +][+
2066 ENDFOR dependencies +]@endif gcc-bootstrap
2067
2068 @if gcc-bootstrap
2069 [+ FOR dependencies +][+ CASE (dep-kind) +]
2070 [+ == "postbootstrap" +][+ (make-postboot-target-dep) +][+ ESAC +][+
2071 ENDFOR dependencies +]@endif gcc-bootstrap
2072
2073 @unless gcc-bootstrap
2074 [+ FOR dependencies +][+ CASE (dep-kind) +]
2075 [+ == "postbootstrap" +][+ (make-dep "" "") +]
2076 [+ ESAC +][+ ENDFOR dependencies +]@endunless gcc-bootstrap
2077
2078 # Dependencies for target modules on other target modules are
2079 # described by lang_env_dependencies; the defaults apply to anything
2080 # not mentioned there.
2081 [+
2082 ;; Predicate for whether LANG was specified in lang_env_dependencies.
2083 (define lang-dep (lambda (lang)
2084 (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
2085
2086 ;; Build the hash table we will need.
2087 (define lang-env-deps (make-hash-table 7))
2088 +][+ FOR lang_env_dependencies +][+
2089 (if (exist? "cxx")
2090 (hash-create-handle! lang-env-deps
2091 (string-append (get "module") "-" "cxx") #t))
2092
2093 (if (exist? "no_c")
2094 (hash-create-handle! lang-env-deps
2095 (string-append (get "module") "-" "no_c") #t))
2096
2097 (if (exist? "no_gcc")
2098 (hash-create-handle! lang-env-deps
2099 (string-append (get "module") "-" "no_gcc") #t))
2100 "" +][+ ENDFOR lang_env_dependencies +]
2101
2102 @if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
2103 +][+ IF bootstrap +][+ FOR bootstrap_stage +]
2104 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
2105 ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
2106 @endif gcc-bootstrap
2107
2108 @if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
2109 configure-target-[+module+]: maybe-all-target-libgcc[+
2110 ENDIF +][+ ENDFOR target_modules +]
2111 @endif gcc-no-bootstrap
2112
2113 [+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
2114 configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
2115 ENDIF +][+ IF (lang-dep "cxx") +]
2116 configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
2117 ENDIF +]
2118 [+ ENDFOR target_modules +]
2119
2120 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
2121 GDB_TK = @GDB_TK@
2122 INSTALL_GDB_TK = @INSTALL_GDB_TK@
2123 configure-gdb: $(CONFIGURE_GDB_TK)
2124 all-gdb: $(gdbnlmrequirements) $(GDB_TK)
2125 install-gdb: $(INSTALL_GDB_TK)
2126
2127 # Serialization dependencies. Host configures don't work well in parallel to
2128 # each other, due to contention over config.cache. Target configures and
2129 # build configures are similar.
2130 @serialization_dependencies@
2131
2132 # --------------------------------
2133 # Regenerating top level configury
2134 # --------------------------------
2135
2136 # Rebuilding Makefile.in, using autogen.
2137 AUTOGEN = autogen
2138 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
2139 cd $(srcdir) && $(AUTOGEN) Makefile.def
2140
2141 # Rebuilding Makefile.
2142 Makefile: $(srcdir)/Makefile.in config.status
2143 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
2144
2145 config.status: configure
2146 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
2147
2148 # Rebuilding configure.
2149 AUTOCONF = autoconf
2150 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
2151 $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
2152 $(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
2153 $(srcdir)/config/gcc-plugin.m4 \
2154 $(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
2155 $(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
2156 cd $(srcdir) && $(AUTOCONF)
2157
2158 # ------------------------------
2159 # Special directives to GNU Make
2160 # ------------------------------
2161
2162 # Don't pass command-line variables to submakes.
2163 .NOEXPORT:
2164 MAKEOVERRIDES=
2165
2166 # end of Makefile.in