]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - Makefile.tpl
PowerPC: Don't generate unused section symbols
[thirdparty/binutils-gdb.git] / Makefile.tpl
CommitLineData
52d7cdee 1[+ AutoGen5 template -*- Mode: Makefile -*-
405ea7a0
NN
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,
52cf9762 9# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
e3f56a99 10# 2011, 2012, 2013, 2014, 2015, 2016, 2017
1b05fbbd 11# Free Software Foundation
405ea7a0
NN
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
e8a5fa9c 15# the Free Software Foundation; either version 3 of the License, or
405ea7a0
NN
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
e8a5fa9c
RW
24# along with this program; see the file COPYING3. If not see
25# <http://www.gnu.org/licenses/>.
405ea7a0
NN
26#
27
0bb6ea20
HPN
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
50212802
NN
36# -------------------------------
37# Standard Autoconf-set variables
38# -------------------------------
583d52d7 39VPATH=@srcdir@
583d52d7 40
c6b750e1 41build_alias=@build_noncanonical@
4b900473
PB
42build_vendor=@build_vendor@
43build_os=@build_os@
7f121bbf 44build=@build@
c6b750e1 45host_alias=@host_noncanonical@
4b900473
PB
46host_vendor=@host_vendor@
47host_os=@host_os@
7f121bbf 48host=@host@
c6b750e1 49target_alias=@target_noncanonical@
4b900473
PB
50target_vendor=@target_vendor@
51target_os=@target_os@
7f121bbf 52target=@target@
583d52d7 53
50212802 54program_transform_name = @program_transform_name@
c66d951e
NN
55
56prefix = @prefix@
57exec_prefix = @exec_prefix@
58
50212802
NN
59srcdir = @srcdir@
60
c66d951e
NN
61bindir = @bindir@
62sbindir = @sbindir@
63libexecdir = @libexecdir@
64datadir = @datadir@
65sysconfdir = @sysconfdir@
66sharedstatedir = @sharedstatedir@
67localstatedir = @localstatedir@
68libdir = @libdir@
69includedir = @includedir@
70oldincludedir = @oldincludedir@
71infodir = @infodir@
108a6f8e
CD
72datarootdir = @datarootdir@
73docdir = @docdir@
a3ca38d2 74pdfdir = @pdfdir@
108a6f8e 75htmldir = @htmldir@
c66d951e 76mandir = @mandir@
405ea7a0
NN
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
405ea7a0 86
e5c3f801
NN
87INSTALL = @INSTALL@
88INSTALL_PROGRAM = @INSTALL_PROGRAM@
89INSTALL_SCRIPT = @INSTALL_SCRIPT@
90INSTALL_DATA = @INSTALL_DATA@
656fdd47
PB
91LN = @LN@
92LN_S = @LN_S@
77d7106f
AM
93MAINT = @MAINT@
94MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
95MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
405ea7a0 96
50212802
NN
97# -------------------------------------------------
98# Miscellaneous non-standard autoconf-set variables
99# -------------------------------------------------
405ea7a0 100
50212802
NN
101# The gcc driver likes to know the arguments it was configured with.
102TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
405ea7a0 103
50212802
NN
104tooldir = @tooldir@
105build_tooldir = @build_tooldir@
405ea7a0 106
50212802
NN
107# This is the name of the environment variable used for the path to
108# the libraries.
109RPATH_ENVVAR = @RPATH_ENVVAR@
405ea7a0 110
3bbd2f8f
AL
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
50212802
NN
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.
a7254363 120BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
6a9cf61e 121
e8a5fa9c
RW
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
6a9cf61e
PB
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; \
8e957354
PB
145 SED="$(SED)"; export SED; \
146 AWK="$(AWK)"; export AWK; \
6a9cf61e
PB
147 MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
148
378fce5b 149# This is the list of variables to export in the environment when
6a9cf61e 150# configuring subdirectories for the build system.
378fce5b 151BUILD_EXPORTS = \
6a9cf61e 152 $(BASE_EXPORTS) \
378fce5b
DD
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; \
378fce5b 160 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
e552509b
ILT
161 GOC="$(GOC_FOR_BUILD)"; export GOC; \
162 GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
378fce5b
DD
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; \
0c24b341
NC
168 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
169 WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
50212802 170
6641ce42 171# These variables must be set on the make command line for directories
2440009d 172# built for the build system to override those in BASE_FLAGS_TO_PASS.
6641ce42
JM
173EXTRA_BUILD_FLAGS = \
174 CFLAGS="$(CFLAGS_FOR_BUILD)" \
175 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
176
50212802
NN
177# This is the list of directories to built for the host system.
178SUBDIRS = @configdirs@
911e63d0 179TARGET_CONFIGDIRS = @target_configdirs@
50212802
NN
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@
b00612cc
PB
183# Host programs are put under this directory, which is . except if building
184# with srcdir=..
185HOST_SUBDIR = @host_subdir@
378fce5b 186# This is the list of variables to export in the environment when
be01d343
PB
187# configuring subdirectories for the host system. We need to pass
188# some to the GCC configure because of its hybrid host/target nature.
378fce5b 189HOST_EXPORTS = \
6a9cf61e 190 $(BASE_EXPORTS) \
378fce5b 191 CC="$(CC)"; export CC; \
da888c87 192 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
378fce5b
DD
193 CFLAGS="$(CFLAGS)"; export CFLAGS; \
194 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
195 CXX="$(CXX)"; export CXX; \
196 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
1b05fbbd 197 GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
e552509b 198 GOC="$(GOC)"; export GOC; \
378fce5b
DD
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; \
e8a5fa9c 204 LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
378fce5b
DD
205 NM="$(NM)"; export NM; \
206 RANLIB="$(RANLIB)"; export RANLIB; \
207 WINDRES="$(WINDRES)"; export WINDRES; \
0c24b341 208 WINDMC="$(WINDMC)"; export WINDMC; \
378fce5b 209 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
95b6a1f2 210 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
b121d7d4 211 READELF="$(READELF)"; export READELF; \
be01d343
PB
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; \
6b91c541 218 OBJCOPY_FOR_TARGET="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY_FOR_TARGET; \
be01d343 219 RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
b121d7d4 220 READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
378fce5b 221 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
e8a5fa9c 222 HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
378fce5b 223 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
315b3b02 224 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
1b6c0831 225 ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
7ec59b9e 226 ISLINC="$(HOST_ISLINC)"; export ISLINC; \
e3f56a99 227 ISLVER="$(HOST_ISLVER)"; export ISLVER; \
22121df0
L
228 LIBELFLIBS="$(HOST_LIBELFLIBS)"; export LIBELFLIBS; \
229 LIBELFINC="$(HOST_LIBELFINC)"; export LIBELFINC; \
4849dfd8 230 XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \
f70224b5
PB
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
e90269c8 234 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
378fce5b 235
1f53ca9a
AO
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 = \
d2489204 242 CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xg++$(exeext) \
1f53ca9a 243 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \
1d14850f 244 -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
ffdd6afc 245 -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
abca8d87 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++ \
ffdd6afc
ILT
249 -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
250 -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \
251 export CXX; \
1f53ca9a
AO
252 CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD;
253@endif target-libstdc++-v3-bootstrap
254
378fce5b 255# Similar, for later GCC stages.
d545f33b 256POSTSTAGE1_HOST_EXPORTS = \
7ffa0b57 257 $(HOST_EXPORTS) \
b00612cc 258 CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
1b05fbbd
AO
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; \
1f53ca9a 262 $(POSTSTAGE1_CXX_EXPORT) \
1b6c0831 263 $(LTO_EXPORTS) \
e8a5fa9c
RW
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;
50212802 267
50212802
NN
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.
a7254363 272TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
378fce5b 273# This is the list of variables to export in the environment when
f2b2dd91 274# configuring subdirectories for the target system.
378fce5b 275BASE_TARGET_EXPORTS = \
6a9cf61e 276 $(BASE_EXPORTS) \
378fce5b 277 AR="$(AR_FOR_TARGET)"; export AR; \
be01d343 278 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
1b05fbbd
AO
279 CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
280 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
378fce5b 281 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
06bcb89d 282 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
1b05fbbd 283 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
1b05fbbd 284 GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
e552509b 285 GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
378fce5b 286 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
be01d343 287 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
378fce5b 288 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
7e0f7140 289 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
be01d343 290 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
5ae72758 291 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
6b91c541 292 OBJCOPY="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY; \
378fce5b 293 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
b121d7d4 294 READELF="$(READELF_FOR_TARGET)"; export READELF; \
7e0f7140 295 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
315b3b02 296 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
0c24b341 297 WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
f2b2dd91
RW
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
911e63d0
JR
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;
378fce5b
DD
303
304RAW_CXX_TARGET_EXPORTS = \
305 $(BASE_TARGET_EXPORTS) \
306 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
1b05fbbd 307 CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
378fce5b
DD
308
309NORMAL_TARGET_EXPORTS = \
310 $(BASE_TARGET_EXPORTS) \
1b05fbbd 311 CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
50212802 312
4b1cb4fe
DD
313# Where to find GMP
314HOST_GMPLIBS = @gmplibs@
315HOST_GMPINC = @gmpinc@
316
4849dfd8 317# Where to find isl
1b6c0831 318HOST_ISLLIBS = @isllibs@
7ec59b9e 319HOST_ISLINC = @islinc@
e3f56a99 320HOST_ISLVER = @islver@
e28c595f 321
700d40ca
ILT
322# Where to find libelf
323HOST_LIBELFLIBS = @libelflibs@
324HOST_LIBELFINC = @libelfinc@
325
50212802
NN
326# ----------------------------------------------
327# Programs producing files for the BUILD machine
328# ----------------------------------------------
329
f6c1938b 330SHELL = @SHELL@
50212802
NN
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.
b40e3958
L
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}
50212802
NN
339
340# compilers to use to create programs which must be run in the build
341# environment.
b5714970
PB
342AR_FOR_BUILD = @AR_FOR_BUILD@
343AS_FOR_BUILD = @AS_FOR_BUILD@
50212802 344CC_FOR_BUILD = @CC_FOR_BUILD@
5fbad20a 345CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
b5714970
PB
346CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
347CXX_FOR_BUILD = @CXX_FOR_BUILD@
348DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
b5714970 349GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
e552509b 350GOC_FOR_BUILD = @GOC_FOR_BUILD@
b5714970
PB
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@
50212802
NN
357
358# Special variables passed down in EXTRA_GCC_FLAGS. They are defined
359# here so that they can be overridden by Makefile fragments.
50212802
NN
360BUILD_PREFIX = @BUILD_PREFIX@
361BUILD_PREFIX_1 = @BUILD_PREFIX_1@
405ea7a0 362
0df3d27f
PB
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
f6d183c0 366BOOT_LDFLAGS=
d7b9dae9 367BOOT_ADAFLAGS= -gnatpg
0df3d27f 368
8e957354
PB
369AWK = @AWK@
370SED = @SED@
be01d343
PB
371BISON = @BISON@
372YACC = @YACC@
373FLEX = @FLEX@
374LEX = @LEX@
375M4 = @M4@
376MAKEINFO = @MAKEINFO@
377EXPECT = @EXPECT@
378RUNTEST = @RUNTEST@
405ea7a0 379
e3f56a99 380AUTO_PROFILE = gcc-auto-profile -c 1000000
05a13254 381
405ea7a0
NN
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.
62a3fc85
DD
385# (Default to avoid splitting info files by setting the threshold high.)
386MAKEINFOFLAGS = --split-size=5000000
405ea7a0 387
50212802
NN
388# ---------------------------------------------
389# Programs producing files for the HOST machine
390# ---------------------------------------------
405ea7a0 391
50212802 392AS = @AS@
50ad1254 393AR = @AR@ @AR_PLUGIN_OPTION@
50212802 394AR_FLAGS = rc
50212802 395CC = @CC@
50212802 396CXX = @CXX@
50212802 397DLLTOOL = @DLLTOOL@
50212802 398LD = @LD@
be01d343
PB
399LIPO = @LIPO@
400NM = @NM@
80911fe1 401OBJDUMP = @OBJDUMP@
50ad1254 402RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
b121d7d4 403READELF = @READELF@
be01d343 404STRIP = @STRIP@
50212802 405WINDRES = @WINDRES@
0c24b341 406WINDMC = @WINDMC@
405ea7a0 407
a0323144
PB
408GNATBIND = @GNATBIND@
409GNATMAKE = @GNATMAKE@
410
be01d343 411CFLAGS = @CFLAGS@
b2edfdd2 412LDFLAGS = @LDFLAGS@
be01d343
PB
413LIBCFLAGS = $(CFLAGS)
414CXXFLAGS = @CXXFLAGS@
415LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
e552509b 416GOCFLAGS = $(CFLAGS)
50212802 417
af019bfd
L
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
05a13254
NC
457CREATE_GCOV = create_gcov
458
1b05fbbd
AO
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)
1f53ca9a
AO
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
1b05fbbd 475STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS)
7ec59b9e 476STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
1b05fbbd
AO
477[+ ENDFOR bootstrap-stage +]
478
22121df0
L
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.
8a0d8a5c 482
1b05fbbd 483STAGE1_CFLAGS = @stage1_cflags@
1f53ca9a
AO
484STAGE1_CHECKING = @stage1_checking@
485STAGE1_LANGUAGES = @stage1_languages@
1b05fbbd
AO
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.
880b18d1 492# * We also disable -Wformat, since older GCCs don't understand newer %s.
1b05fbbd 493STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
880b18d1 494 --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" \
495 --disable-build-format-warnings
8a0d8a5c 496
1b05fbbd
AO
497STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
498STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
8520c408 499
e3f56a99
NC
500STAGEfeedback_CFLAGS = $(STAGE3_CFLAGS) -fprofile-use
501STAGEfeedback_TFLAGS = $(STAGE3_TFLAGS)
7f6ef0c0 502
05a13254
NC
503STAGEautoprofile_CFLAGS = $(STAGE2_CFLAGS) -g
504STAGEautoprofile_TFLAGS = $(STAGE2_TFLAGS)
505
506STAGEautofeedback_CFLAGS = $(STAGE3_CFLAGS)
507STAGEautofeedback_TFLAGS = $(STAGE3_TFLAGS)
508
8520c408
AO
509do-compare = @do_compare@
510do-compare3 = $(do-compare)
8520c408 511
50212802
NN
512# -----------------------------------------------
513# Programs producing files for the TARGET machine
514# -----------------------------------------------
405ea7a0 515
50212802 516AR_FOR_TARGET=@AR_FOR_TARGET@
852e5f18 517AS_FOR_TARGET=@AS_FOR_TARGET@
1b05fbbd 518CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@
55db4b87 519
50212802
NN
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.
1b05fbbd
AO
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@
1b05fbbd 527GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
e552509b 528GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
852e5f18 529DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
50212802 530LD_FOR_TARGET=@LD_FOR_TARGET@
50212802 531
7e0f7140 532LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
50212802 533NM_FOR_TARGET=@NM_FOR_TARGET@
5ae72758 534OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
6b91c541 535OBJCOPY_FOR_TARGET=@OBJCOPY_FOR_TARGET@
852e5f18 536RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
b121d7d4 537READELF_FOR_TARGET=@READELF_FOR_TARGET@
7e0f7140 538STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
50212802 539WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
0c24b341 540WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
405ea7a0 541
be01d343
PB
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
7f6ef0c0
PB
546CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
547CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
7f6ef0c0 548
be01d343
PB
549LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
550LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
91c1f14c 551LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
e552509b 552GOCFLAGS_FOR_TARGET = -O2 -g
50212802 553
1b05fbbd
AO
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
50212802
NN
560# ------------------------------------
561# Miscellaneous targets and flag lists
562# ------------------------------------
563
405ea7a0
NN
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.
f70224b5 566all:
405ea7a0 567
405ea7a0 568#### host and target specific makefile fragments come in here.
a0da8069
NN
569@target_makefile_frag@
570@alphaieee_frag@
571@ospace_frag@
572@host_makefile_frag@
405ea7a0
NN
573###
574
e90269c8 575# This is the list of directories that may be needed in RPATH_ENVVAR
18a8530e 576# so that programs built for the target machine work.
e90269c8
PB
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
3bbd2f8f 595HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR):
e90269c8
PB
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
87cda2cf
AO
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
22121df0
L
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).
c52c6897
PB
629BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
630 "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
1b05fbbd
AO
631 "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +][+ FOR bootstrap-stage +] \
632 "STAGE[+id+]_CFLAGS=$(STAGE[+id+]_CFLAGS)" \
1f53ca9a 633 "STAGE[+id+]_CXXFLAGS=$(STAGE[+id+]_CXXFLAGS)" \
1b05fbbd 634 "STAGE[+id+]_TFLAGS=$(STAGE[+id+]_TFLAGS)"[+ ENDFOR bootstrap-stage +] \
87cda2cf 635 $(CXX_FOR_TARGET_FLAG_TO_PASS) \
1b05fbbd 636 "TFLAGS=$(TFLAGS)" \
10ecffb9 637 "CONFIG_SHELL=$(SHELL)" \
52cf9762
NC
638 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
639 $(if $(LSAN_OPTIONS),"LSAN_OPTIONS=$(LSAN_OPTIONS)")
405ea7a0 640
55db4b87
PB
641# We leave this in just in case, but it is not needed anymore.
642RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
656fdd47 643
405ea7a0
NN
644# Flags to pass down to most sub-makes, in which we're building with
645# the host environment.
405ea7a0
NN
646EXTRA_HOST_FLAGS = \
647 'AR=$(AR)' \
648 'AS=$(AS)' \
649 'CC=$(CC)' \
650 'CXX=$(CXX)' \
651 'DLLTOOL=$(DLLTOOL)' \
1b05fbbd 652 'GFORTRAN=$(GFORTRAN)' \
e552509b 653 'GOC=$(GOC)' \
405ea7a0 654 'LD=$(LD)' \
be01d343 655 'LIPO=$(LIPO)' \
405ea7a0 656 'NM=$(NM)' \
80911fe1 657 'OBJDUMP=$(OBJDUMP)' \
b9459e83 658 'RANLIB=$(RANLIB)' \
b121d7d4 659 'READELF=$(READELF)' \
be01d343 660 'STRIP=$(STRIP)' \
0c24b341 661 'WINDRES=$(WINDRES)' \
05a13254
NC
662 'WINDMC=$(WINDMC)' \
663 'CREATE_GCOV=$(CREATE_GCOV)'
405ea7a0
NN
664
665FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
666
b3676d82
EB
667# Flags to pass to stage1 or when not bootstrapping.
668
669STAGE1_FLAGS_TO_PASS = \
670 LDFLAGS="$${LDFLAGS}" \
671 HOST_LIBS="$${HOST_LIBS}"
672
8a0d8a5c
PB
673# Flags to pass to stage2 and later makes.
674
675POSTSTAGE1_FLAGS_TO_PASS = \
e8a5fa9c
RW
676 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
677 CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
678 GNATBIND="$${GNATBIND}" \
1f53ca9a
AO
679 LDFLAGS="$${LDFLAGS}" \
680 HOST_LIBS="$${HOST_LIBS}" \
1b6c0831 681 $(LTO_FLAGS_TO_PASS) \
8a0d8a5c
PB
682 "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
683
f91ca6bc
IB
684@if gcc-bootstrap
685EXTRA_HOST_EXPORTS = if [ $(current_stage) != stage1 ]; then \
686 $(POSTSTAGE1_HOST_EXPORTS) \
22121df0 687 fi;
f91ca6bc
IB
688
689EXTRA_BOOTSTRAP_FLAGS = CC="$$CC" CXX="$$CXX" LDFLAGS="$$LDFLAGS"
690@endif gcc-bootstrap
691
405ea7a0 692# Flags to pass down to makes which are built with the target environment.
0aed8855
PB
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
7f6ef0c0
PB
695# *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
696# so we expand them here.
405ea7a0
NN
697EXTRA_TARGET_FLAGS = \
698 'AR=$$(AR_FOR_TARGET)' \
0aed8855 699 'AS=$(COMPILER_AS_FOR_TARGET)' \
1b05fbbd
AO
700 'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
701 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
1b6c0831
L
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)' \
1b05fbbd 705 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
405ea7a0 706 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
1b05fbbd 707 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
e552509b
ILT
708 'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
709 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
0aed8855 710 'LD=$(COMPILER_LD_FOR_TARGET)' \
414e5532 711 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
1b05fbbd
AO
712 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
713 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
0aed8855 714 'NM=$(COMPILER_NM_FOR_TARGET)' \
5ae72758 715 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
6b91c541 716 'OBJCOPY=$$(OBJCOPY_FOR_TARGET)' \
405ea7a0 717 'RANLIB=$$(RANLIB_FOR_TARGET)' \
b121d7d4 718 'READELF=$$(READELF_FOR_TARGET)' \
0c24b341 719 'WINDRES=$$(WINDRES_FOR_TARGET)' \
1b05fbbd
AO
720 'WINDMC=$$(WINDMC_FOR_TARGET)' \
721 'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
1b6c0831
L
722 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
723 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
1b05fbbd 724 "TFLAGS=$$TFLAGS"
405ea7a0
NN
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.
2a4cbe27 732# The BUILD_* variables are a special case, which are used for the gcc
405ea7a0
NN
733# cross-building scheme.
734EXTRA_GCC_FLAGS = \
405ea7a0 735 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
3dee29da 736 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
98dd765a 737 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
405ea7a0 738
f0b24077 739GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
405ea7a0 740
1b05fbbd 741@if gcc
96655cc4 742BUILD_CONFIG = @BUILD_CONFIG@
1b05fbbd
AO
743ifneq ($(BUILD_CONFIG),)
744include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk)
745endif
746@endif gcc
747
dd12c3a8 748.PHONY: configure-host
b813574b 749configure-host: [+
dd12c3a8
NN
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 +]
405ea7a0 758
319cab08
PB
759# The target built for a native non-bootstrap build.
760.PHONY: all
af019bfd
L
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.
f70224b5
PB
767all:
768@if gcc-bootstrap
be01d343 769 [ -f stage_final ] || echo stage3 > stage_final
f70224b5
PB
770 @r=`${PWD_COMMAND}`; export r; \
771 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
0aed8855 772 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
f70224b5 773@endif gcc-bootstrap
0aed8855 774 @: $(MAKE); $(unstage)
af019bfd 775 +@r=`${PWD_COMMAND}`; export r; \
f70224b5 776 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1b05fbbd 777@if gcc-bootstrap
7b6175f9 778 if [ -f stage_last ]; then \
07fc31c9 779 TFLAGS="$(STAGE$(shell test ! -f stage_last || sed s,^stage,, stage_last)_TFLAGS)"; \
be01d343 780 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
f70224b5 781 else \
1b05fbbd 782@endif gcc-bootstrap
af019bfd
L
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
b5233201
AO
793@if gcc-bootstrap
794 ; \
04ec0acb 795 fi \
b5233201 796@endif gcc-bootstrap
04ec0acb 797 && :
dd12c3a8 798
6a9cf61e 799.PHONY: all-build
c52c6897
PB
800[+ FOR build_modules +]
801all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
802
dd12c3a8 803.PHONY: all-host
c52c6897
PB
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
dd12c3a8 809.PHONY: all-target
c52c6897 810[+ FOR target_modules +][+ IF bootstrap +]
f86e35b8 811@if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
c52c6897 812all-target: maybe-all-target-[+module+][+ IF bootstrap +]
f86e35b8
NC
813@endif target-[+module+]-no-bootstrap[+
814 ENDIF bootstrap +][+ ENDFOR target_modules +]
405ea7a0
NN
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).
e393202e 820[+ FOR recursive_targets +]
27b1cc72 821.PHONY: do-[+make_target+]
f70224b5 822do-[+make_target+]:
0aed8855 823 @: $(MAKE); $(unstage)
e360f423
PB
824 @r=`${PWD_COMMAND}`; export r; \
825 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
826 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
f70224b5 827 [+make_target+]-target
f70224b5 828
2a4cbe27
NN
829
830.PHONY: [+make_target+]-host
c52c6897
PB
831[+ FOR host_modules +]
832[+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
2a4cbe27
NN
833
834.PHONY: [+make_target+]-target
c52c6897
PB
835[+ FOR target_modules +]
836[+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
e393202e
NN
837[+ ENDFOR recursive_targets +]
838
405ea7a0
NN
839# Here are the targets which correspond to the do-X targets.
840
a3ca38d2
DD
841.PHONY: info installcheck dvi pdf html
842.PHONY: install-info install-pdf install-html
405ea7a0
NN
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
56a8fe78 848pdf: do-pdf
6d389afc 849html: do-html
405ea7a0 850
43d92c63
NN
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
405ea7a0
NN
854
855install-info: do-install-info dir.info
b40e3958 856 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
22121df0
L
857 if [ -f dir.info ]; then \
858 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info; \
859 else true; fi
405ea7a0 860
a3ca38d2
DD
861install-pdf: do-install-pdf
862
108a6f8e
CD
863install-html: do-install-html
864
405ea7a0
NN
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
bb7dc663 870 -rm -f maybedep.tmp serdep.tmp stage_final
405ea7a0
NN
871 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
872 rm -rf $(TARGET_SUBDIR); \
873 else true; fi
e4c4d240 874 -rm -rf $(BUILD_SUBDIR)
b00612cc
PB
875 -if [ "$(HOST_SUBDIR)" != "." ]; then \
876 rm -rf $(HOST_SUBDIR); \
877 else true; fi
405ea7a0
NN
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
bb7dc663
NC
882 -rmdir fastjar gcc gnattools gotools libcc1 libiberty 2>/dev/null
883 -rmdir texinfo zlib 2>/dev/null
792cdb50 884 -find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
405ea7a0
NN
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
405ea7a0
NN
897# Check target.
898
899.PHONY: check do-check
ede4fbe4 900check: do-check
405ea7a0 901
3866be5d 902# Only include modules actually being configured and built.
f70224b5
PB
903.PHONY: check-host
904check-host: [+
16ae0395
NN
905 FOR host_modules +] \
906 maybe-check-[+module+][+
f70224b5
PB
907 ENDFOR host_modules +]
908
909.PHONY: check-target
910check-target: [+
16ae0395
NN
911 FOR target_modules +] \
912 maybe-check-target-[+module+][+
f70224b5
PB
913 ENDFOR target_modules +]
914
915do-check:
0aed8855 916 @: $(MAKE); $(unstage)
e360f423
PB
917 @r=`${PWD_COMMAND}`; export r; \
918 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
919 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
405ea7a0
NN
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
1b6c0831
L
942# Local Vim config
943
944$(srcdir)/.local.vimrc:
22121df0 945 $(LN_S) contrib/vimrc $@
1b6c0831
L
946
947$(srcdir)/.lvimrc:
22121df0 948 $(LN_S) contrib/vimrc $@
1b6c0831
L
949
950vimrc: $(srcdir)/.local.vimrc $(srcdir)/.lvimrc
951
952.PHONY: vimrc
953
4849dfd8
NC
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
405ea7a0
NN
963# Installation targets.
964
ae831be5 965.PHONY: install uninstall
f70224b5 966install:
0aed8855 967 @: $(MAKE); $(unstage)
e360f423
PB
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
dd12c3a8 971
16ae0395
NN
972.PHONY: install-host-nogcc
973install-host-nogcc: [+
9e6ce191
PB
974 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
975 maybe-install-[+module+][+ ENDIF +][+
16ae0395
NN
976 ENDFOR host_modules +]
977
dd12c3a8 978.PHONY: install-host
b813574b 979install-host: [+
dd12c3a8
NN
980 FOR host_modules +] \
981 maybe-install-[+module+][+
982 ENDFOR host_modules +]
16ae0395 983
dd12c3a8
NN
984.PHONY: install-target
985install-target: [+
986 FOR target_modules +] \
987 maybe-install-target-[+module+][+
988 ENDFOR target_modules +]
405ea7a0
NN
989
990uninstall:
991 @echo "the uninstall target is not supported in this tree"
992
405ea7a0
NN
993.PHONY: install.all
994install.all: install-no-fixedincludes
22121df0
L
995 @if [ -f ./gcc/Makefile ]; then \
996 r=`${PWD_COMMAND}`; export r; \
0aed8855 997 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7ffa0b57 998 $(HOST_EXPORTS) \
1086bc09 999 (cd ./gcc && \
22121df0 1000 $(MAKE) $(FLAGS_TO_PASS) install-headers); \
405ea7a0 1001 else \
22121df0 1002 true; \
405ea7a0
NN
1003 fi
1004
7ec59b9e
L
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.
405ea7a0 1008.PHONY: install-no-fixedincludes
16ae0395 1009install-no-fixedincludes: installdirs install-host-nogcc \
7ec59b9e 1010 install-target gcc-install-no-fixedincludes
405ea7a0 1011
9b980aa1
RW
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
15723a45 1032### other supporting targets
405ea7a0 1033
15723a45
NN
1034MAKEDIRS= \
1035 $(DESTDIR)$(prefix) \
1036 $(DESTDIR)$(exec_prefix)
1037.PHONY: installdirs
1038installdirs: mkinstalldirs
1039 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
1040
1041dir.info: do-install-info
22121df0
L
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; \
405ea7a0
NN
1046 fi
1047
15723a45
NN
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
a7254363
PB
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+]:
4f0ef2d8
CD
1069@if gcc-bootstrap
1070configure-[+prefix+][+module+]: stage_current
1071@endif gcc-bootstrap
a7254363
PB
1072@if [+prefix+][+module+]
1073maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
4f0ef2d8 1074configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
c52c6897
PB
1075 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1076 @r=`${PWD_COMMAND}`; export r; \
0aed8855 1077 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
c52c6897
PB
1078 [+ IF check_multilibs
1079 +]echo "Checking multilib configuration for [+module+]..."; \
22121df0
L
1080 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1081 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \
0aed8855
PB
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; \
c52c6897
PB
1091 fi; \
1092 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
22121df0 1093 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
1f53ca9a 1094 [+exports+] [+extra_exports+] \
a7254363
PB
1095 echo Configuring in [+subdir+]/[+module+]; \
1096 cd "[+subdir+]/[+module+]" || exit 1; \
bba45b8b 1097 case $(srcdir) in \
b00612cc 1098 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
a7254363 1099 *) topdir=`echo [+subdir+]/[+module+]/ | \
b00612cc 1100 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
bba45b8b 1101 esac; \
1b6c0831 1102 module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \
a7254363 1103 [+ IF no-config-site +]rm -f no-such-file || : ; \
1b6c0831
L
1104 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) \
1105 $$s/$$module_srcdir/configure \
1106 --srcdir=$${topdir}/$$module_srcdir \
4b900473 1107 [+args+] --build=${build_alias} --host=[+host_alias+] \
1b6c0831 1108 --target=[+target_alias+] [+extra_configure_flags+] \
bba45b8b 1109 || exit 1
a7254363 1110@endif [+prefix+][+module+]
d545f33b
PB
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+]:
0aed8855 1116@if [+prefix+][+module+]-bootstrap
d545f33b 1117maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
0aed8855 1118configure-stage[+id+]-[+prefix+][+module+]:
c52c6897 1119 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
0aed8855 1120 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
c52c6897 1121 @r=`${PWD_COMMAND}`; export r; \
d545f33b 1122 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1b05fbbd 1123 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
c52c6897
PB
1124 [+ IF check_multilibs
1125 +]echo "Checking multilib configuration for [+module+]..."; \
22121df0 1126 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \
0aed8855
PB
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; \
c52c6897
PB
1136 fi; \
1137 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
d545f33b 1138 [+exports+][+ IF prev +] \
1b05fbbd
AO
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; \
1f53ca9a 1144 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"; export CXXFLAGS;[+ IF prev +] \
1b05fbbd 1145 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1f53ca9a
AO
1146 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +]; export LIBCFLAGS;[+
1147 ENDIF prefix +] [+extra_exports+] \
22121df0
L
1148 echo Configuring stage [+id+] in [+subdir+]/[+module+]; \
1149 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \
d545f33b
PB
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; \
1b6c0831
L
1156 module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \
1157 $(SHELL) $$s/$$module_srcdir/configure \
1158 --srcdir=$${topdir}/$$module_srcdir \
4b900473 1159 [+args+] --build=${build_alias} --host=[+host_alias+] \
1b6c0831 1160 --target=[+target_alias+] \
22121df0 1161 [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
1b05fbbd
AO
1162 $(STAGE[+id+]_CONFIGURE_FLAGS)[+ IF extra_configure_flags +] \
1163 [+extra_configure_flags+][+ ENDIF extra_configure_flags +]
0aed8855 1164@endif [+prefix+][+module+]-bootstrap
d545f33b
PB
1165[+ ENDFOR bootstrap_stage +]
1166[+ ENDIF bootstrap +]
a7254363
PB
1167[+ ENDDEF +]
1168
1169[+ DEFINE all +]
1170.PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
1171maybe-all-[+prefix+][+module+]:
4f0ef2d8
CD
1172@if gcc-bootstrap
1173all-[+prefix+][+module+]: stage_current
1174@endif gcc-bootstrap
a7254363
PB
1175@if [+prefix+][+module+]
1176TARGET-[+prefix+][+module+]=[+
4b900473 1177 IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
a7254363 1178maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
4f0ef2d8 1179all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
c52c6897
PB
1180 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1181 @r=`${PWD_COMMAND}`; export r; \
b40e3958 1182 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1f53ca9a 1183 [+exports+] [+extra_exports+] \
a7254363 1184 (cd [+subdir+]/[+module+] && \
b3676d82 1185 $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+stage1_args+] [+extra_make_flags+] \
7f6ef0c0 1186 $(TARGET-[+prefix+][+module+]))
a7254363 1187@endif [+prefix+][+module+]
d545f33b
PB
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+]:
0aed8855 1195@if [+prefix+][+module+]-bootstrap
d545f33b
PB
1196maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
1197all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
f70224b5 1198TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
d545f33b 1199all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
c52c6897 1200 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
d545f33b
PB
1201 @r=`${PWD_COMMAND}`; export r; \
1202 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1b05fbbd 1203 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
d545f33b 1204 [+exports+][+ IF prev +] \
1f53ca9a 1205 [+poststage1_exports+][+ ENDIF prev +] [+extra_exports+] \
d545f33b 1206 cd [+subdir+]/[+module+] && \
05a13254 1207 [+autoprofile+] \
1b05fbbd
AO
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)" \
1f53ca9a 1213 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"[+ IF prev +] \
1b05fbbd
AO
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)" \
b3676d82
EB
1219 [+args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \
1220 [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] \
05a13254 1221 TFLAGS="$(STAGE[+id+]_TFLAGS)" [+profile_data+] \
f70224b5 1222 $(TARGET-stage[+id+]-[+prefix+][+module+])
d545f33b
PB
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+]:
9dbaa842
DD
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; \
d545f33b 1233 cd [+subdir+]/[+module+] && \
b3676d82
EB
1234 $(MAKE) [+args+] [+ IF prev +][+poststage1_args+][+ ELSE prev +] \
1235 [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] clean
0aed8855 1236@endif [+prefix+][+module+]-bootstrap
d545f33b
PB
1237
1238[+ ENDFOR bootstrap_stage +]
1239[+ ENDIF bootstrap +]
a7254363
PB
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)"
4b900473
PB
1247 host_alias=(get "host" "${build_alias}")
1248 target_alias=(get "target" "${target_alias}")
a7254363
PB
1249 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
1250
6641ce42
JM
1251[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1252 args="$(EXTRA_BUILD_FLAGS)" +]
a7254363 1253[+ ENDFOR build_module +]
405ea7a0 1254
15723a45
NN
1255# --------------------------------------
1256# Modules which run on the host machine
1257# --------------------------------------
3866be5d 1258[+ FOR host_modules +]
d545f33b
PB
1259[+ configure prefix="" subdir="$(HOST_SUBDIR)"
1260 exports="$(HOST_EXPORTS)"
1261 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
4b900473
PB
1262 host_alias=(get "host" "${host_alias}")
1263 target_alias=(get "target" "${target_alias}")
a7254363 1264 args="$(HOST_CONFIGARGS)" +]
e2b9e2dc 1265
d545f33b
PB
1266[+ all prefix="" subdir="$(HOST_SUBDIR)"
1267 exports="$(HOST_EXPORTS)"
1268 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
7f6ef0c0 1269 args="$(EXTRA_HOST_FLAGS)"
b3676d82 1270 stage1_args="$(STAGE1_FLAGS_TO_PASS)"
d545f33b 1271 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
405ea7a0 1272
16ae0395
NN
1273.PHONY: check-[+module+] maybe-check-[+module+]
1274maybe-check-[+module+]:
6bd3dfaa
PB
1275@if [+module+]
1276maybe-check-[+module+]: check-[+module+]
3866be5d 1277[+ IF no_check +]
3866be5d
NN
1278check-[+module+]:
1279[+ ELIF no_check_cross +]
3866be5d
NN
1280# This module is only tested in a native toolchain.
1281check-[+module+]:
0aed8855 1282 @: $(MAKE); $(unstage)
22121df0 1283 @if [ '$(host)' = '$(target)' ]; then \
b40e3958
L
1284 r=`${PWD_COMMAND}`; export r; \
1285 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
f91ca6bc
IB
1286 $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
1287 ENDIF bootstrap +] \
b00612cc 1288 (cd $(HOST_SUBDIR)/[+module+] && \
f91ca6bc
IB
1289 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
1290 IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
bba45b8b
NN
1291 fi
1292[+ ELSE check +]
bba45b8b 1293check-[+module+]:
0aed8855 1294 @: $(MAKE); $(unstage)
b40e3958
L
1295 @r=`${PWD_COMMAND}`; export r; \
1296 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
f91ca6bc
IB
1297 $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+
1298 ENDIF bootstrap +] \
b00612cc 1299 (cd $(HOST_SUBDIR)/[+module+] && \
f91ca6bc
IB
1300 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+
1301 IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check)
3866be5d 1302[+ ENDIF no_check +]
6bd3dfaa 1303@endif [+module+]
405ea7a0 1304
930314a4
NN
1305.PHONY: install-[+module+] maybe-install-[+module+]
1306maybe-install-[+module+]:
6bd3dfaa
PB
1307@if [+module+]
1308maybe-install-[+module+]: install-[+module+]
16ae0395 1309[+ IF no_install +]
3866be5d
NN
1310install-[+module+]:
1311[+ ELSE install +]
3866be5d 1312install-[+module+]: installdirs
0aed8855 1313 @: $(MAKE); $(unstage)
b40e3958
L
1314 @r=`${PWD_COMMAND}`; export r; \
1315 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
378fce5b 1316 $(HOST_EXPORTS) \
b00612cc 1317 (cd $(HOST_SUBDIR)/[+module+] && \
2da12f12 1318 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
3866be5d 1319[+ ENDIF no_install +]
6bd3dfaa 1320@endif [+module+]
4fa63067 1321
9b980aa1
RW
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
56a8fe78 1339# Other targets (info, dvi, pdf, etc.)
4fa63067
NN
1340[+ FOR recursive_targets +]
1341.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1342maybe-[+make_target+]-[+module+]:
6bd3dfaa
PB
1343@if [+module+]
1344maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
4fa63067
NN
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 +]
0aed8855 1353 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
f70224b5 1354 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
4fa63067
NN
1355 r=`${PWD_COMMAND}`; export r; \
1356 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
378fce5b 1357 $(HOST_EXPORTS) \
b813574b 1358 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
4fa63067
NN
1359 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1360 done; \
22121df0 1361 echo "Doing [+make_target+] in [+module+]"; \
b00612cc 1362 (cd $(HOST_SUBDIR)/[+module+] && \
4fa63067
NN
1363 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1364 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1365 "RANLIB=$${RANLIB}" \
0c24b341 1366 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
b813574b 1367 [+make_target+]) \
4fa63067
NN
1368 || exit 1
1369[+ ENDIF +]
6bd3dfaa 1370@endif [+module+]
4fa63067 1371[+ ENDFOR recursive_targets +]
3866be5d 1372[+ ENDFOR host_modules +]
405ea7a0 1373
15723a45
NN
1374# ---------------------------------------
1375# Modules which run on the target machine
1376# ---------------------------------------
e393202e 1377[+ FOR target_modules +]
15723a45 1378
a7254363
PB
1379[+ IF raw_cxx +]
1380[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
0aed8855 1381 check_multilibs=true
a7254363 1382 exports="$(RAW_CXX_TARGET_EXPORTS)"
4b900473
PB
1383 host_alias=(get "host" "${target_alias}")
1384 target_alias=(get "target" "${target_alias}")
a7254363
PB
1385 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1386
1387[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1388 exports="$(RAW_CXX_TARGET_EXPORTS)"
7f6ef0c0 1389 args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
a7254363
PB
1390[+ ELSE +]
1391[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
0aed8855 1392 check_multilibs=true
a7254363 1393 exports="$(NORMAL_TARGET_EXPORTS)"
4b900473
PB
1394 host_alias=(get "host" "${target_alias}")
1395 target_alias=(get "target" "${target_alias}")
a7254363
PB
1396 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1397
1398[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1399 exports="$(NORMAL_TARGET_EXPORTS)"
7f6ef0c0 1400 args="$(EXTRA_TARGET_FLAGS)" +]
a7254363 1401[+ ENDIF +]
16ae0395
NN
1402
1403.PHONY: check-target-[+module+] maybe-check-target-[+module+]
1404maybe-check-target-[+module+]:
6bd3dfaa
PB
1405@if target-[+module+]
1406maybe-check-target-[+module+]: check-target-[+module+]
3866be5d
NN
1407[+ IF no_check +]
1408# Dummy target for uncheckable module.
3866be5d
NN
1409check-target-[+module+]:
1410[+ ELSE check +]
e393202e 1411check-target-[+module+]:
0aed8855 1412 @: $(MAKE); $(unstage)
b40e3958 1413 @r=`${PWD_COMMAND}`; export r; \
e90269c8 1414 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
378fce5b
DD
1415IF raw_cxx +]
1416 $(RAW_CXX_TARGET_EXPORTS) \[+
1417ELSE normal_cxx +]
1418 $(NORMAL_TARGET_EXPORTS) \[+
1419ENDIF raw_cxx +]
bba45b8b
NN
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
7ffa0b57 1425 +] [+extra_make_flags+] check)
e393202e 1426[+ ENDIF no_check +]
6bd3dfaa 1427@endif target-[+module+]
16ae0395 1428
930314a4
NN
1429.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1430maybe-install-target-[+module+]:
6bd3dfaa
PB
1431@if target-[+module+]
1432maybe-install-target-[+module+]: install-target-[+module+]
16ae0395 1433[+ IF no_install +]
930314a4
NN
1434# Dummy target for uninstallable.
1435install-target-[+module+]:
1436[+ ELSE install +]
e393202e 1437install-target-[+module+]: installdirs
0aed8855 1438 @: $(MAKE); $(unstage)
b40e3958 1439 @r=`${PWD_COMMAND}`; export r; \
e90269c8 1440 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
378fce5b
DD
1441IF raw_cxx +]
1442 $(RAW_CXX_TARGET_EXPORTS) \[+
1443ELSE normal_cxx +]
1444 $(NORMAL_TARGET_EXPORTS) \[+
1445ENDIF raw_cxx +]
bba45b8b 1446 (cd $(TARGET_SUBDIR)/[+module+] && \
7ffa0b57 1447 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
e393202e 1448[+ ENDIF no_install +]
6bd3dfaa 1449@endif target-[+module+]
4fa63067 1450
9b980aa1
RW
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
56a8fe78 1473# Other targets (info, dvi, pdf, etc.)
4fa63067
NN
1474[+ FOR recursive_targets +]
1475.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1476maybe-[+make_target+]-target-[+module+]:
6bd3dfaa
PB
1477@if target-[+module+]
1478maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
4fa63067
NN
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 +]
0aed8855 1487 @: $(MAKE); $(unstage)
22121df0 1488 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0; \
4fa63067 1489 r=`${PWD_COMMAND}`; export r; \
e90269c8 1490 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
378fce5b
DD
1491IF raw_cxx +]
1492 $(RAW_CXX_TARGET_EXPORTS) \[+
1493ELSE normal_cxx +]
1494 $(NORMAL_TARGET_EXPORTS) \[+
1495ENDIF raw_cxx +]
22121df0 1496 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]"; \
4fa63067
NN
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}" \
0c24b341 1504 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
7ffa0b57 1505 [+extra_make_flags+] [+make_target+]) \
4fa63067
NN
1506 || exit 1
1507[+ ENDIF +]
6bd3dfaa 1508@endif target-[+module+]
4fa63067 1509[+ ENDFOR recursive_targets +]
e393202e 1510[+ ENDFOR target_modules +]
405ea7a0 1511
7ec59b9e
L
1512@if target-libgomp
1513.PHONY: check-target-libgomp-c++
1514check-target-libgomp-c++:
1515 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libgomp
1516
e0541124
EB
1517.PHONY: check-target-libgomp-fortran
1518check-target-libgomp-fortran:
1519 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) fortran.exp" check-target-libgomp
1520
7ec59b9e
L
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
15723a45
NN
1530# ----------
1531# GCC module
1532# ----------
1533
319cab08 1534@if gcc-no-bootstrap
405ea7a0 1535.PHONY: cross
72b2455a 1536cross: all-build all-gas all-ld
b40e3958
L
1537 @r=`${PWD_COMMAND}`; export r; \
1538 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7ffa0b57 1539 $(HOST_EXPORTS) \
405ea7a0
NN
1540 echo "Building the C and C++ compiler"; \
1541 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
b40e3958 1542 @r=`${PWD_COMMAND}`; export r; \
22121df0 1543 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
405ea7a0 1544 echo "Building runtime libraries"; \
656fdd47 1545 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
319cab08 1546@endif gcc-no-bootstrap
405ea7a0 1547
6bd3dfaa 1548@if gcc
c50523ce
L
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+]);
e552509b 1556check-[+language+]: check-gcc-[+language+][+ FOR lib-check-target +] [+ lib-check-target +][+ ENDFOR lib-check-target +]
c50523ce 1557[+ ENDFOR languages +]
405ea7a0 1558
7ec59b9e
L
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:
15723a45 1563 @if [ -f ./gcc/Makefile ]; then \
b40e3958 1564 r=`${PWD_COMMAND}`; export r; \
7ec59b9e 1565 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7ffa0b57 1566 $(HOST_EXPORTS) \
7ec59b9e
L
1567 (cd ./gcc \
1568 && $(MAKE) $(GCC_FLAGS_TO_PASS) install-no-fixedincludes); \
15723a45 1569 else true; fi
6bd3dfaa 1570@endif gcc
4fa63067 1571
1d39f329
NN
1572# ---------------------
1573# GCC bootstrap support
1574# ---------------------
1575
b813574b
PB
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
f70224b5 1580# While making host and target tools, symlinks to the final stage must be
0aed8855
PB
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.
f70224b5
PB
1585
1586unstage = :
1587stage = :
c52c6897 1588current_stage = ""
f70224b5 1589
b813574b 1590@if gcc-bootstrap
9daf3993 1591unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
f6d183c0 1592stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
c52c6897 1593current_stage = "`cat stage_current 2> /dev/null`"
b813574b
PB
1594@endif gcc-bootstrap
1595
f70224b5
PB
1596.PHONY: unstage stage
1597unstage:
0aed8855 1598 @: $(MAKE); $(unstage)
b813574b 1599stage:
0aed8855 1600 @: $(MAKE); $(stage)
b813574b 1601
80911fe1
PB
1602# Disable commands for lean bootstrap.
1603LEAN = false
1604
dfdffa2c
PB
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
0aed8855 1610# the previous stage to a constant name ('prev-gcc'), and to make the name of
dfdffa2c
PB
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
1d39f329
NN
1616# 'touch' doesn't work right on some platforms.
1617STAMP = echo timestamp >
1618
dfdffa2c
PB
1619# We only want to compare .o files, so set this!
1620objext = .o
1d39f329 1621
dfdffa2c 1622[+ FOR bootstrap-stage +]
319cab08 1623.PHONY: stage[+id+]-start stage[+id+]-end
dfdffa2c 1624
656fdd47 1625stage[+id+]-start::
0aed8855 1626 @: $(MAKE); $(stage); \
22121df0 1627 echo stage[+id+] > stage_current; \
b00612cc 1628 echo stage[+id+] > stage_last; \
0aed8855 1629 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
b00612cc 1630 FOR host_modules +][+ IF bootstrap +]
72b2455a 1631@if [+ module +]
b00612cc
PB
1632 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1633 mkdir stage[+id+]-[+module+]; \
22121df0 1634 mv stage[+id+]-[+module+] [+module+][+ IF prev +]; \
80911fe1 1635 mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
0aed8855
PB
1636@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1637 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1638 mkdir stage[+id+]-$(TARGET_SUBDIR); \
22121df0 1639 mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR)[+ IF prev +]; \
80911fe1 1640 mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
dfdffa2c 1641
80911fe1 1642stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
72b2455a 1643@if [+ module +]
22121df0
L
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 +]; \
0aed8855
PB
1647 fi
1648@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
22121df0
L
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 +]; \
0aed8855 1652 fi
80911fe1 1653 rm -f stage_current
dfdffa2c 1654
973601e1 1655# Bubble a bug fix through all the stages up to stage [+id+]. They are
0aed8855 1656# remade, but not reconfigured. The next stage (if any) will not be
675492f0 1657# reconfigured either.
319cab08 1658.PHONY: stage[+id+]-bubble
80911fe1 1659stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
e360f423
PB
1660 @r=`${PWD_COMMAND}`; export r; \
1661 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1662 if test -f stage[+id+]-lean [+
22121df0
L
1663 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +]; then \
1664 echo Skipping rebuild of stage[+id+]; \
9cb3fa6f 1665 else \
80911fe1
PB
1666 $(MAKE) stage[+id+]-start; \[+IF lean +]
1667 if $(LEAN); then \
22121df0
L
1668 rm -rf stage[+lean+]-*; \
1669 $(STAMP) stage[+lean+]-lean; \
80911fe1 1670 fi; \[+ ENDIF lean +]
f70224b5 1671 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
be01d343 1672 fi[+ IF compare-target +]
f6d183c0 1673 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
72b2455a 1674
0df3d27f 1675.PHONY: all-stage[+id+] clean-stage[+id+]
0df3d27f 1676do-clean: clean-stage[+id+]
1d39f329 1677
72b2455a
PB
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
dfdffa2c 1681[+ IF compare-target +]
9cb3fa6f 1682[+compare-target+]:
e360f423
PB
1683 @r=`${PWD_COMMAND}`; export r; \
1684 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1685 if test -f stage[+prev+]-lean; then \
22121df0
L
1686 echo Cannot compare object files as stage [+prev+] was deleted.; \
1687 exit 0; \
9cb3fa6f 1688 fi; \
0aed8855 1689 : $(MAKE); $(stage); \
22121df0
L
1690 rm -f .bad_compare; \
1691 echo Comparing stages [+prev+] and [+id+]; \
fda13ee8
AO
1692 sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \
1693 files=`find stage[+id+]-* -name "*$(objext)" -print | \
22121df0 1694 sed -n s,^stage$$sed-,,p`; \
e3f56a99 1695 for file in $${files}; do \
fda13ee8
AO
1696 f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \
1697 if test ! -f $$f1; then continue; fi; \
8520c408 1698 $(do-[+compare-target+]) > /dev/null 2>&1; \
f70224b5
PB
1699 if test $$? -eq 1; then \
1700 case $$file in \
e8a5fa9c 1701 @compare_exclusions@) \
f70224b5
PB
1702 echo warning: $$file differs ;; \
1703 *) \
1704 echo $$file differs >> .bad_compare ;; \
22121df0
L
1705 esac; \
1706 fi; \
1707 done; \
1d39f329
NN
1708 if [ -f .bad_compare ]; then \
1709 echo "Bootstrap comparison failure!"; \
1710 cat .bad_compare; \
1711 exit 1; \
1712 else \
c52c6897 1713 echo Comparison successful.; \
22121df0 1714 fi; \
9cb3fa6f 1715 $(STAMP) [+compare-target+][+ IF prev +]
80911fe1
PB
1716 if $(LEAN); then \
1717 rm -rf stage[+prev+]-*; \
1718 $(STAMP) stage[+prev+]-lean; \
1719 fi[+ ENDIF prev +]
dfdffa2c
PB
1720[+ ENDIF compare-target +]
1721
1722[+ IF bootstrap-target +]
80911fe1 1723.PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
be01d343
PB
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
0aed8855 1729 @: $(MAKE); $(unstage)
be01d343
PB
1730 @r=`${PWD_COMMAND}`; export r; \
1731 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1b05fbbd 1732 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
be01d343 1733 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
80911fe1
PB
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; \
1b05fbbd 1743 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
80911fe1 1744 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
dfdffa2c
PB
1745[+ ENDIF bootstrap-target +]
1746
0df3d27f 1747# Rules to wipe a stage and all the following ones, also used for cleanstrap
656fdd47 1748[+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
0df3d27f 1749.PHONY: distclean-stage[+id+]
656fdd47 1750distclean-stage[+id+]::
0aed8855 1751 @: $(MAKE); $(stage)
e00a73e3 1752 @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
9cb3fa6f 1753 rm -rf stage[+id+]-* [+
dfdffa2c 1754 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
dfdffa2c
PB
1755
1756[+ IF cleanstrap-target +]
1757.PHONY: [+cleanstrap-target+]
e00a73e3
PB
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; \
1b05fbbd 1766 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
e00a73e3 1767 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
dfdffa2c 1768[+ ENDIF cleanstrap-target +]
72b2455a 1769@endif gcc-bootstrap
dfdffa2c
PB
1770
1771[+ ENDFOR bootstrap-stage +]
656fdd47 1772
7d329e61
PB
1773stageprofile-end::
1774 $(MAKE) distclean-stagefeedback
656fdd47 1775
7d329e61 1776stagefeedback-start::
656fdd47
PB
1777 @r=`${PWD_COMMAND}`; export r; \
1778 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7d329e61 1779 for i in prev-*; do \
22121df0 1780 j=`echo $$i | sed s/^prev-//`; \
7d329e61 1781 cd $$r/$$i && \
22121df0
L
1782 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL); } && \
1783 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL); }; \
7d329e61 1784 done
b8908782 1785
0df3d27f 1786@if gcc-bootstrap
0df3d27f 1787do-distclean: distclean-stage1
c52c6897
PB
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:
314b2e66
AS
1792 @r=`${PWD_COMMAND}`; export r; \
1793 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
c52c6897 1794 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
0df3d27f 1795
4f0ef2d8
CD
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
c52c6897 1801.PHONY: restrap
266df637 1802restrap::
c52c6897 1803 @: $(MAKE); $(stage)
1b05fbbd
AO
1804 rm -rf stage1-$(TARGET_SUBDIR)[+ FOR bootstrap-stage +][+ IF prev
1805 +] stage[+id+]-*[+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
266df637 1806restrap:: all
c380fdd8 1807@endif gcc-bootstrap
c52c6897 1808
ae831be5
NN
1809# --------------------------------------
1810# Dependencies between different modules
1811# --------------------------------------
405ea7a0 1812
9e6ce191 1813# Generic dependencies for target modules on host stuff, especially gcc
c52c6897
PB
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
6aa8ef82 1822@if gcc-no-bootstrap[+ FOR target_modules +]
c52c6897 1823configure-target-[+module+]: maybe-all-gcc[+
6aa8ef82 1824 ENDFOR target_modules +]
c52c6897
PB
1825@endif gcc-no-bootstrap
1826
9e6ce191 1827
ae831be5
NN
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
9e6ce191 1832# are made here to depend on a 'maybe-' target. If you're not sure,
ae831be5
NN
1833# it's safer to use a soft dependency.
1834
9e6ce191
PB
1835[+ ;; These Scheme functions build the bulk of the dependencies.
1836 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
675492f0 1837 ;; where "maybe-" is only included if HARD is not true, and all-gcc
9e6ce191
PB
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.
72b2455a 1848 (define make-dep (lambda (module-kind on-kind)
9e6ce191
PB
1849 (string-append
1850 (dep-target module-kind "module" #t) ": "
72b2455a 1851 (dep-target on-kind "on" (exist? "hard")))))
9e6ce191
PB
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
4119873a
AO
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.
9e6ce191 1888 (define dep-kind (lambda ()
4119873a
AO
1889 (cond
1890 ((and (hash-ref boot-modules (dep-module "module"))
1891 (=* (dep-module "on") "build-"))
1892 "prebootstrap")
9e6ce191 1893
4119873a
AO
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"))))))
9e6ce191
PB
1911
1912 ;; We now build the hash table that is used by dep-kind.
1913 (define boot-modules (make-hash-table 113))
4119873a 1914 (define postboot-targets (make-hash-table 113))
9e6ce191
PB
1915+]
1916
1917[+ FOR host_modules +][+
1918 (if (exist? "bootstrap")
1919 (hash-create-handle! boot-modules (get "module") #t))
1920 "" +][+ ENDFOR host_modules +]
1dc3053f
PB
1921[+ FOR target_modules +][+
1922 (if (exist? "bootstrap")
1923 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1924 "" +][+ ENDFOR target_modules +]
9e6ce191
PB
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.
4119873a
AO
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
9e6ce191 1948
6aa8ef82
DJ
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
907be67c 1991CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
ae831be5 1992GDB_TK = @GDB_TK@
907be67c
DJ
1993INSTALL_GDB_TK = @INSTALL_GDB_TK@
1994configure-gdb: $(CONFIGURE_GDB_TK)
9e6ce191 1995all-gdb: $(gdbnlmrequirements) $(GDB_TK)
907be67c 1996install-gdb: $(INSTALL_GDB_TK)
907a7241 1997
a2cc058a
NN
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
15723a45
NN
2003# --------------------------------
2004# Regenerating top level configury
2005# --------------------------------
405ea7a0
NN
2006
2007# Rebuilding Makefile.in, using autogen.
43be203f 2008AUTOGEN = autogen
6b784d9f 2009$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
43be203f 2010 cd $(srcdir) && $(AUTOGEN) Makefile.def
405ea7a0 2011
a0da8069 2012# Rebuilding Makefile.
43be203f
AO
2013Makefile: $(srcdir)/Makefile.in config.status
2014 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
2015
479759c8 2016config.status: configure
10ecffb9 2017 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
405ea7a0 2018
a0da8069 2019# Rebuilding configure.
43be203f 2020AUTOCONF = autoconf
da888c87 2021$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
0597bdc4
AM
2022 $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
2023 $(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
50ad1254 2024 $(srcdir)/config/gcc-plugin.m4 \
0597bdc4
AM
2025 $(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
2026 $(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
43be203f 2027 cd $(srcdir) && $(AUTOCONF)
405ea7a0 2028
3728fade
NN
2029# ------------------------------
2030# Special directives to GNU Make
2031# ------------------------------
2032
3728fade
NN
2033# Don't pass command-line variables to submakes.
2034.NOEXPORT:
2035MAKEOVERRIDES=
2036
405ea7a0 2037# end of Makefile.in