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