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