]> git.ipfire.org Git - thirdparty/gcc.git/blame - Makefile.tpl
invoke.texi (Optimize Options): Move -finline-small-functions to the -O2 list.
[thirdparty/gcc.git] / Makefile.tpl
CommitLineData
d3ac17c9 1[+ AutoGen5 template -*- Mode: Makefile -*-
95ddd785
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,
4a4a4e99 9# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
309c24a9 10# Free Software Foundation
95ddd785
NN
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
309c24a9 14# the Free Software Foundation; either version 3 of the License, or
95ddd785
NN
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
309c24a9
JJ
23# along with this program; see the file COPYING3. If not see
24# <http://www.gnu.org/licenses/>.
95ddd785
NN
25#
26
295e261a
HPN
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
df0f0674
NN
35# -------------------------------
36# Standard Autoconf-set variables
37# -------------------------------
4977bab6 38VPATH=@srcdir@
4977bab6 39
1c710c3c 40build_alias=@build_noncanonical@
e69bf64b
PB
41build_vendor=@build_vendor@
42build_os=@build_os@
e89fbdfe 43build=@build@
1c710c3c 44host_alias=@host_noncanonical@
e69bf64b
PB
45host_vendor=@host_vendor@
46host_os=@host_os@
e89fbdfe 47host=@host@
1c710c3c 48target_alias=@target_noncanonical@
e69bf64b
PB
49target_vendor=@target_vendor@
50target_os=@target_os@
e89fbdfe 51target=@target@
4977bab6 52
df0f0674 53program_transform_name = @program_transform_name@
0dffceed
NN
54
55prefix = @prefix@
56exec_prefix = @exec_prefix@
57
df0f0674
NN
58srcdir = @srcdir@
59
0dffceed
NN
60bindir = @bindir@
61sbindir = @sbindir@
62libexecdir = @libexecdir@
63datadir = @datadir@
64sysconfdir = @sysconfdir@
65sharedstatedir = @sharedstatedir@
66localstatedir = @localstatedir@
67libdir = @libdir@
68includedir = @includedir@
69oldincludedir = @oldincludedir@
70infodir = @infodir@
65d6e994
CD
71datarootdir = @datarootdir@
72docdir = @docdir@
9c4d2493 73pdfdir = @pdfdir@
65d6e994 74htmldir = @htmldir@
0dffceed 75mandir = @mandir@
95ddd785
NN
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
95ddd785 85
775956d0
NN
86INSTALL = @INSTALL@
87INSTALL_PROGRAM = @INSTALL_PROGRAM@
88INSTALL_SCRIPT = @INSTALL_SCRIPT@
89INSTALL_DATA = @INSTALL_DATA@
ad6717df
PB
90LN = @LN@
91LN_S = @LN_S@
58e24147
AM
92MAINT = @MAINT@
93MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
94MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
95ddd785 95
df0f0674
NN
96# -------------------------------------------------
97# Miscellaneous non-standard autoconf-set variables
98# -------------------------------------------------
95ddd785 99
df0f0674
NN
100# The gcc driver likes to know the arguments it was configured with.
101TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
95ddd785 102
df0f0674
NN
103tooldir = @tooldir@
104build_tooldir = @build_tooldir@
95ddd785 105
df0f0674 106GDB_NLM_DEPS =
95ddd785 107
df0f0674
NN
108# This is the name of the environment variable used for the path to
109# the libraries.
110RPATH_ENVVAR = @RPATH_ENVVAR@
95ddd785 111
d89f0ad6
AL
112# On targets where RPATH_ENVVAR is PATH, a subdirectory of the GCC build path
113# is used instead of the directory itself to avoid including built
114# executables in PATH.
115GCC_SHLIB_SUBDIR = @GCC_SHLIB_SUBDIR@
116
df0f0674
NN
117# Build programs are put under this directory.
118BUILD_SUBDIR = @build_subdir@
119# This is set by the configure script to the arguments to use when configuring
120# directories built for the build system.
25b42232 121BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
23f6b2f9 122
00020c16
ILT
123# Linker flags to use on the host, for stage1 or when not
124# bootstrapping.
125STAGE1_LDFLAGS = @stage1_ldflags@
126
127# Libraries to use on the host, for stage1 or when not bootstrapping.
128STAGE1_LIBS = @stage1_libs@
129
130# Linker flags to use for stage2 and later.
131POSTSTAGE1_LDFLAGS = @poststage1_ldflags@
132
133# Libraries to use for stage2 and later.
134POSTSTAGE1_LIBS = @poststage1_libs@
135
23f6b2f9
PB
136# This is the list of variables to export in the environment when
137# configuring any subdirectory. It must also be exported whenever
138# recursing into a build directory in case that directory's Makefile
139# re-runs configure.
140BASE_EXPORTS = \
141 FLEX="$(FLEX)"; export FLEX; \
142 LEX="$(LEX)"; export LEX; \
143 BISON="$(BISON)"; export BISON; \
144 YACC="$(YACC)"; export YACC; \
145 M4="$(M4)"; export M4; \
87264276 146 SED="$(SED)"; export SED; \
f945e229 147 AWK="$(AWK)"; export AWK; \
23f6b2f9
PB
148 MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
149
4fc4dd12 150# This is the list of variables to export in the environment when
23f6b2f9 151# configuring subdirectories for the build system.
4fc4dd12 152BUILD_EXPORTS = \
23f6b2f9 153 $(BASE_EXPORTS) \
4fc4dd12
DJ
154 AR="$(AR_FOR_BUILD)"; export AR; \
155 AS="$(AS_FOR_BUILD)"; export AS; \
156 CC="$(CC_FOR_BUILD)"; export CC; \
157 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
158 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
159 CXX="$(CXX_FOR_BUILD)"; export CXX; \
160 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
161 GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
162 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
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; \
0136f2f7 168 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
901119ae 169 WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
df0f0674 170
f8c33439 171# These variables must be set on the make command line for directories
487e299b 172# built for the build system to override those in BASE_FLAGS_TO_PASSS.
f8c33439
JM
173EXTRA_BUILD_FLAGS = \
174 CFLAGS="$(CFLAGS_FOR_BUILD)" \
175 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
176
df0f0674
NN
177# This is the list of directories to built for the host system.
178SUBDIRS = @configdirs@
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@
215c351a
PB
182# Host programs are put under this directory, which is . except if building
183# with srcdir=..
184HOST_SUBDIR = @host_subdir@
4fc4dd12 185# This is the list of variables to export in the environment when
2abefe3d
PB
186# configuring subdirectories for the host system. We need to pass
187# some to the GCC configure because of its hybrid host/target nature.
4fc4dd12 188HOST_EXPORTS = \
23f6b2f9 189 $(BASE_EXPORTS) \
4fc4dd12 190 CC="$(CC)"; export CC; \
00afcaa0 191 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
4fc4dd12
DJ
192 CFLAGS="$(CFLAGS)"; export CFLAGS; \
193 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
194 CXX="$(CXX)"; export CXX; \
195 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
4a4a4e99
AO
196 GCJ="$(GCJ)"; export GCJ; \
197 GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
4fc4dd12
DJ
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; \
00020c16 203 LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
4fc4dd12
DJ
204 NM="$(NM)"; export NM; \
205 RANLIB="$(RANLIB)"; export RANLIB; \
206 WINDRES="$(WINDRES)"; export WINDRES; \
901119ae 207 WINDMC="$(WINDMC)"; export WINDMC; \
4fc4dd12 208 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
1c020272 209 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
2abefe3d
PB
210 AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
211 AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
212 GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
213 LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
214 NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
215 OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
216 RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
4fc4dd12 217 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
00020c16 218 HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
4fc4dd12 219 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
4c4a5bbc 220 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
f8bf9252
SP
221 PPLLIBS="$(HOST_PPLLIBS)"; export PPLLIBS; \
222 PPLINC="$(HOST_PPLINC)"; export PPLINC; \
223 CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \
224 CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \
1061f99e
PB
225@if gcc-bootstrap
226 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
227@endif gcc-bootstrap
0bff65e7 228 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
4fc4dd12
DJ
229
230# Similar, for later GCC stages.
ce406537 231POSTSTAGE1_HOST_EXPORTS = \
a52a0a7f 232 $(HOST_EXPORTS) \
215c351a 233 CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
4a4a4e99
AO
234 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ \
235 $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
236 CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \
00020c16
ILT
237 CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/g++$(exeext) \
238 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \
239 -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \
240 -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \
241 -I$$r/$(srcdir)/libstdc++-v3/libsupc++ \
242 -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs"; export CXX; \
243 CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD; \
244 GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \
245 LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \
246 HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS;
df0f0674 247
df0f0674
NN
248# Target libraries are put under this directory:
249TARGET_SUBDIR = @target_subdir@
250# This is set by the configure script to the arguments to use when configuring
251# directories built for the target.
25b42232 252TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
4fc4dd12 253# This is the list of variables to export in the environment when
23f6b2f9 254# configuring subdirectories for the host system.
4fc4dd12 255BASE_TARGET_EXPORTS = \
23f6b2f9 256 $(BASE_EXPORTS) \
4fc4dd12 257 AR="$(AR_FOR_TARGET)"; export AR; \
2abefe3d 258 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
4a4a4e99
AO
259 CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
260 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
4fc4dd12 261 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
e7daab31 262 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
4a4a4e99
AO
263 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
264 GCJ="$(GCJ_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GCJ; \
265 GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
4fc4dd12 266 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
2abefe3d 267 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
4fc4dd12 268 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
040b1c5a 269 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
2abefe3d 270 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
d739199a 271 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
4fc4dd12 272 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
040b1c5a 273 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
4c4a5bbc 274 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
901119ae 275 WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
0bff65e7 276 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
4fc4dd12
DJ
277
278RAW_CXX_TARGET_EXPORTS = \
279 $(BASE_TARGET_EXPORTS) \
280 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
4a4a4e99 281 CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
4fc4dd12
DJ
282
283NORMAL_TARGET_EXPORTS = \
284 $(BASE_TARGET_EXPORTS) \
4a4a4e99 285 CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
df0f0674 286
6de9cd9a
DN
287# Where to find GMP
288HOST_GMPLIBS = @gmplibs@
289HOST_GMPINC = @gmpinc@
290
f8bf9252
SP
291# Where to find PPL
292HOST_PPLLIBS = @ppllibs@
293HOST_PPLINC = @pplinc@
294
295# Where to find CLOOG
296HOST_CLOOGLIBS = @clooglibs@
297HOST_CLOOGINC = @clooginc@
298
df0f0674
NN
299# ----------------------------------------------
300# Programs producing files for the BUILD machine
301# ----------------------------------------------
302
303SHELL = @config_shell@
304
305# pwd command to use. Allow user to override default by setting PWDCMD in
306# the environment to account for automounters. The make variable must not
307# be called PWDCMD, otherwise the value set here is passed to make
308# subprocesses and overrides the setting from the user's environment.
8c90b13a
L
309# Don't use PWD since it is a common shell environment variable and we
310# don't want to corrupt it.
311PWD_COMMAND = $${PWDCMD-pwd}
df0f0674
NN
312
313# compilers to use to create programs which must be run in the build
314# environment.
0999159b
PB
315AR_FOR_BUILD = @AR_FOR_BUILD@
316AS_FOR_BUILD = @AS_FOR_BUILD@
df0f0674 317CC_FOR_BUILD = @CC_FOR_BUILD@
6691a79e 318CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
0999159b
PB
319CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
320CXX_FOR_BUILD = @CXX_FOR_BUILD@
321DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
322GCJ_FOR_BUILD = @GCJ_FOR_BUILD@
323GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
324LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
325LD_FOR_BUILD = @LD_FOR_BUILD@
326NM_FOR_BUILD = @NM_FOR_BUILD@
327RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@
328WINDMC_FOR_BUILD = @WINDMC_FOR_BUILD@
329WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@
df0f0674
NN
330
331# Special variables passed down in EXTRA_GCC_FLAGS. They are defined
332# here so that they can be overridden by Makefile fragments.
df0f0674
NN
333BUILD_PREFIX = @BUILD_PREFIX@
334BUILD_PREFIX_1 = @BUILD_PREFIX_1@
95ddd785 335
45f366ab
PB
336# Flags to pass to stage2 and later makes. They are defined
337# here so that they can be overridden by Makefile fragments.
338BOOT_CFLAGS= -g -O2
d19bca38 339BOOT_LDFLAGS=
dd609cc1 340BOOT_ADAFLAGS=-gnatpg -gnata
45f366ab 341
87264276
PB
342AWK = @AWK@
343SED = @SED@
2abefe3d
PB
344BISON = @BISON@
345YACC = @YACC@
346FLEX = @FLEX@
347LEX = @LEX@
348M4 = @M4@
349MAKEINFO = @MAKEINFO@
350EXPECT = @EXPECT@
351RUNTEST = @RUNTEST@
95ddd785
NN
352
353# This just becomes part of the MAKEINFO definition passed down to
354# sub-makes. It lets flags be given on the command line while still
355# using the makeinfo from the object tree.
2f50999f
GP
356# (Default to avoid splitting info files by setting the threshold high.)
357MAKEINFOFLAGS = --split-size=5000000
95ddd785 358
df0f0674
NN
359# ---------------------------------------------
360# Programs producing files for the HOST machine
361# ---------------------------------------------
95ddd785 362
df0f0674 363AS = @AS@
df0f0674
NN
364AR = @AR@
365AR_FLAGS = rc
df0f0674 366CC = @CC@
df0f0674 367CXX = @CXX@
df0f0674 368DLLTOOL = @DLLTOOL@
df0f0674 369LD = @LD@
2abefe3d
PB
370LIPO = @LIPO@
371NM = @NM@
2d309510 372OBJDUMP = @OBJDUMP@
df0f0674 373RANLIB = @RANLIB@
2abefe3d 374STRIP = @STRIP@
df0f0674 375WINDRES = @WINDRES@
901119ae 376WINDMC = @WINDMC@
95ddd785 377
5305be7e
RG
378GNATBIND = @GNATBIND@
379GNATMAKE = @GNATMAKE@
380
2abefe3d 381CFLAGS = @CFLAGS@
f6671c93 382LDFLAGS = @LDFLAGS@
2abefe3d
PB
383LIBCFLAGS = $(CFLAGS)
384CXXFLAGS = @CXXFLAGS@
385LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
df0f0674 386
4a4a4e99
AO
387TFLAGS =
388
389# Defaults for all stages; some are overridden below.
390
391STAGE_CFLAGS = $(BOOT_CFLAGS)
392STAGE_TFLAGS = $(TFLAGS)
393STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
394
395[+ FOR bootstrap-stage +]
396# Defaults for stage [+id+]; some are overridden below.
397STAGE[+id+]_CFLAGS = $(STAGE_CFLAGS)
398STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS)
399STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
400[+ ENDFOR bootstrap-stage +]
401
8efea775
PB
402# Only build the C compiler for stage1, because that is the only one that
403# we can guarantee will build with the native compiler, and also it is the
404# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
405# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
406# overrideable (for a bootstrap build stage1 also builds gcc.info).
407
4a4a4e99 408STAGE1_CFLAGS = @stage1_cflags@
8efea775
PB
409STAGE1_CHECKING=@stage1_checking@
410STAGE1_LANGUAGES=@stage1_languages@
4a4a4e99
AO
411# * We force-disable intermodule optimizations, even if
412# --enable-intermodule was passed, since the installed compiler
413# probably can't handle them. Luckily, autoconf always respects
414# the last argument when conflicting --enable arguments are passed.
415# * Likewise, we force-disable coverage flags, since the installed
416# compiler probably has never heard of them.
417STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
418 --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)"
8efea775 419
4a4a4e99
AO
420STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
421STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
bb286d71 422
4a4a4e99
AO
423STAGEfeedback_CFLAGS = $(STAGE3_CFLAGS) -fprofile-use
424STAGEfeedback_TFLAGS = $(STAGE3_TFLAGS)
1c8bd6a3 425
bb286d71
AO
426do-compare = @do_compare@
427do-compare3 = $(do-compare)
bb286d71 428
df0f0674
NN
429# -----------------------------------------------
430# Programs producing files for the TARGET machine
431# -----------------------------------------------
95ddd785 432
df0f0674 433AR_FOR_TARGET=@AR_FOR_TARGET@
4977bab6 434AS_FOR_TARGET=@AS_FOR_TARGET@
4a4a4e99 435CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@
4de997d1 436
df0f0674
NN
437# If GCC_FOR_TARGET is not overriden on the command line, then this
438# variable is passed down to the gcc Makefile, where it is used to
439# build libgcc2.a. We define it here so that it can itself be
440# overridden on the command line.
4a4a4e99
AO
441GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@
442CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@
443RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
444GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@
445GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
4977bab6 446DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
df0f0674 447LD_FOR_TARGET=@LD_FOR_TARGET@
df0f0674 448
040b1c5a 449LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
df0f0674 450NM_FOR_TARGET=@NM_FOR_TARGET@
d739199a 451OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
4977bab6 452RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
040b1c5a 453STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
df0f0674 454WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
901119ae 455WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
95ddd785 456
2abefe3d
PB
457COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
458COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
459COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
460
1c8bd6a3
PB
461CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
462CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
1c8bd6a3 463
2abefe3d
PB
464LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
465LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
487e299b 466LDFLAGS_FOR_TARGET =
df0f0674 467
4a4a4e99
AO
468FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
469SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
470DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
471
472XGCC_FLAGS_FOR_TARGET = $(FLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
473
df0f0674
NN
474# ------------------------------------
475# Miscellaneous targets and flag lists
476# ------------------------------------
477
95ddd785
NN
478# The first rule in the file had better be this one. Don't put any above it.
479# This lives here to allow makefile fragments to contain dependencies.
1061f99e 480all:
95ddd785 481
95ddd785 482#### host and target specific makefile fragments come in here.
671aa708
NN
483@target_makefile_frag@
484@alphaieee_frag@
485@ospace_frag@
486@host_makefile_frag@
95ddd785
NN
487###
488
0bff65e7
PB
489# This is the list of directories that may be needed in RPATH_ENVVAR
490# so that prorgams built for the target machine work.
491TARGET_LIB_PATH = [+ FOR target_modules +][+
492 IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
493 ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
494[+ FOR target_modules +][+ IF lib_path +]
495@if target-[+module+]
496TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
497@endif target-[+module+]
498[+ ENDIF lib_path +][+ ENDFOR target_modules +]
499
500
501# This is the list of directories that may be needed in RPATH_ENVVAR
502# so that programs built for the host machine work.
503HOST_LIB_PATH = [+ FOR host_modules +][+
504 IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
505 ENDFOR host_modules +]
506
507# Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
508@if gcc
d89f0ad6 509HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR):
0bff65e7
PB
510@endif gcc
511
512[+ FOR host_modules +][+ IF lib_path +]
513@if [+module+]
514HOST_LIB_PATH_[+module+] = \
515 $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
516 +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
517@endif [+module+]
518[+ ENDIF lib_path +][+ ENDFOR host_modules +]
519
95ddd785 520# Flags to pass down to all sub-makes.
cc11cc9b
PB
521BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
522 "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
4a4a4e99
AO
523 "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +][+ FOR bootstrap-stage +] \
524 "STAGE[+id+]_CFLAGS=$(STAGE[+id+]_CFLAGS)" \
525 "STAGE[+id+]_TFLAGS=$(STAGE[+id+]_TFLAGS)"[+ ENDFOR bootstrap-stage +] \
526 "TFLAGS=$(TFLAGS)" \
e75f9147 527 "CONFIG_SHELL=$(SHELL)" \
11405c93 528 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"
95ddd785 529
4de997d1
PB
530# We leave this in just in case, but it is not needed anymore.
531RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
ad6717df 532
95ddd785
NN
533# Flags to pass down to most sub-makes, in which we're building with
534# the host environment.
95ddd785
NN
535EXTRA_HOST_FLAGS = \
536 'AR=$(AR)' \
537 'AS=$(AS)' \
538 'CC=$(CC)' \
539 'CXX=$(CXX)' \
540 'DLLTOOL=$(DLLTOOL)' \
4a4a4e99
AO
541 'GCJ=$(GCJ)' \
542 'GFORTRAN=$(GFORTRAN)' \
95ddd785 543 'LD=$(LD)' \
2abefe3d 544 'LIPO=$(LIPO)' \
95ddd785 545 'NM=$(NM)' \
2d309510 546 'OBJDUMP=$(OBJDUMP)' \
c858bf1e 547 'RANLIB=$(RANLIB)' \
2abefe3d 548 'STRIP=$(STRIP)' \
901119ae
KT
549 'WINDRES=$(WINDRES)' \
550 'WINDMC=$(WINDMC)'
95ddd785
NN
551
552FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
553
554# Flags that are concerned with the location of the X11 include files
555# and library files
556#
557# NOTE: until the top-level is getting the values via autoconf, it only
558# causes problems to have this top-level Makefile overriding the autoconf-set
559# values in child directories. Only variables that don't conflict with
560# autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
561#
562X11_FLAGS_TO_PASS = \
563 'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
564 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
565
8efea775
PB
566# Flags to pass to stage2 and later makes.
567
568POSTSTAGE1_FLAGS_TO_PASS = \
00020c16
ILT
569 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
570 CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
571 GNATBIND="$${GNATBIND}" \
572 LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)" \
573 HOST_LIBS="$(POSTSTAGE1_LIBS)" \
8efea775
PB
574 "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
575
95ddd785 576# Flags to pass down to makes which are built with the target environment.
f41d6665
DJ
577# The double $ decreases the length of the command line; those variables
578# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The
1c8bd6a3
PB
579# *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
580# so we expand them here.
95ddd785
NN
581EXTRA_TARGET_FLAGS = \
582 'AR=$$(AR_FOR_TARGET)' \
f41d6665 583 'AS=$(COMPILER_AS_FOR_TARGET)' \
4a4a4e99
AO
584 'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
585 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
586 'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
587 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
95ddd785 588 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
4a4a4e99
AO
589 'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
590 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
f41d6665 591 'LD=$(COMPILER_LD_FOR_TARGET)' \
e3791243 592 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
4a4a4e99
AO
593 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
594 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
f41d6665 595 'NM=$(COMPILER_NM_FOR_TARGET)' \
d739199a 596 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
95ddd785 597 'RANLIB=$$(RANLIB_FOR_TARGET)' \
901119ae 598 'WINDRES=$$(WINDRES_FOR_TARGET)' \
4a4a4e99
AO
599 'WINDMC=$$(WINDMC_FOR_TARGET)' \
600 'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
601 "TFLAGS=$$TFLAGS"
95ddd785
NN
602
603TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
604
605# Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
606# unfortunately needs the native compiler and the target ar and
607# ranlib.
608# If any variables are added here, they must be added to do-*, below.
1358ccea 609# The BUILD_* variables are a special case, which are used for the gcc
95ddd785
NN
610# cross-building scheme.
611EXTRA_GCC_FLAGS = \
95ddd785 612 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
d4cd9d81
NN
613 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
614 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
615 "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
616 "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
cc11cc9b 617 "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
95ddd785 618
d29b8ad8 619GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
95ddd785 620
4a4a4e99 621@if gcc
b5b8b0ac 622BUILD_CONFIG = bootstrap-debug
4a4a4e99
AO
623ifneq ($(BUILD_CONFIG),)
624include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk)
625endif
626@endif gcc
627
8b87bb96 628.PHONY: configure-host
d32ab992 629configure-host: [+
8b87bb96
NN
630 FOR host_modules +] \
631 maybe-configure-[+module+][+
632 ENDFOR host_modules +]
633.PHONY: configure-target
634configure-target: [+
635 FOR target_modules +] \
636 maybe-configure-target-[+module+][+
637 ENDFOR target_modules +]
95ddd785 638
f516a7da
PB
639# The target built for a native non-bootstrap build.
640.PHONY: all
1061f99e
PB
641all:
642@if gcc-bootstrap
2abefe3d 643 [ -f stage_final ] || echo stage3 > stage_final
1061f99e
PB
644 @r=`${PWD_COMMAND}`; export r; \
645 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
f41d6665 646 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
1061f99e 647@endif gcc-bootstrap
f41d6665 648 @: $(MAKE); $(unstage)
1061f99e
PB
649 @r=`${PWD_COMMAND}`; export r; \
650 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4a4a4e99 651@if gcc-bootstrap
0f501837 652 if [ -f stage_last ]; then \
a1fc946a 653 TFLAGS="$(STAGE$(shell test ! -f stage_last || sed s,^stage,, stage_last)_TFLAGS)"; \
2abefe3d 654 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
1061f99e 655 else \
4a4a4e99 656@endif gcc-bootstrap
31c98f49
AO
657 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
658@if gcc-bootstrap
659 ; \
394e9195 660 fi \
31c98f49 661@endif gcc-bootstrap
394e9195 662 && :
8b87bb96 663
23f6b2f9 664.PHONY: all-build
cc11cc9b
PB
665[+ FOR build_modules +]
666all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
667
8b87bb96 668.PHONY: all-host
cc11cc9b
PB
669[+ FOR host_modules +][+ IF bootstrap +]
670@if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
671all-host: maybe-all-[+module+][+ IF bootstrap +]
672@endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
673
8b87bb96 674.PHONY: all-target
cc11cc9b 675[+ FOR target_modules +][+ IF bootstrap +]
54fdc474 676@if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
cc11cc9b 677all-target: maybe-all-target-[+module+][+ IF bootstrap +]
54fdc474
DJ
678@endif target-[+module+]-no-bootstrap[+
679 ENDIF bootstrap +][+ ENDFOR target_modules +]
95ddd785
NN
680
681# Do a target for all the subdirectories. A ``make do-X'' will do a
682# ``make X'' in all subdirectories (because, in general, there is a
683# dependency (below) of X upon do-X, a ``make X'' will also do this,
684# but it may do additional work as well).
4977bab6 685[+ FOR recursive_targets +]
1a1e6b96 686.PHONY: do-[+make_target+]
1061f99e 687do-[+make_target+]:
f41d6665 688 @: $(MAKE); $(unstage)
e7c84bf8
PB
689 @r=`${PWD_COMMAND}`; export r; \
690 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
691 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
1061f99e 692 [+make_target+]-target
1061f99e 693
1358ccea
NN
694
695.PHONY: [+make_target+]-host
cc11cc9b
PB
696[+ FOR host_modules +]
697[+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
1358ccea
NN
698
699.PHONY: [+make_target+]-target
cc11cc9b
PB
700[+ FOR target_modules +]
701[+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
4977bab6
ZW
702[+ ENDFOR recursive_targets +]
703
95ddd785
NN
704# Here are the targets which correspond to the do-X targets.
705
9c4d2493
BM
706.PHONY: info installcheck dvi pdf html
707.PHONY: install-info install-pdf install-html
95ddd785
NN
708.PHONY: clean distclean mostlyclean maintainer-clean realclean
709.PHONY: local-clean local-distclean local-maintainer-clean
710info: do-info
711installcheck: do-installcheck
712dvi: do-dvi
b5422ad7 713pdf: do-pdf
f87a2b2e 714html: do-html
95ddd785 715
212f6dd0
NN
716# Make sure makeinfo is built before we do a `make info', if we're
717# in fact building texinfo.
718do-info: maybe-all-texinfo
95ddd785
NN
719
720install-info: do-install-info dir.info
8c90b13a 721 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
95ddd785 722 if [ -f dir.info ] ; then \
3fbe8e4a 723 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
95ddd785
NN
724 else true ; fi
725
9c4d2493
BM
726install-pdf: do-install-pdf
727
65d6e994
CD
728install-html: do-install-html
729
95ddd785
NN
730local-clean:
731 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
732
733local-distclean:
734 -rm -f Makefile config.status config.cache mh-frag mt-frag
f41d6665 735 -rm -f maybedep.tmp serdep.tmp
95ddd785
NN
736 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
737 rm -rf $(TARGET_SUBDIR); \
738 else true; fi
0c227849 739 -rm -rf $(BUILD_SUBDIR)
215c351a
PB
740 -if [ "$(HOST_SUBDIR)" != "." ]; then \
741 rm -rf $(HOST_SUBDIR); \
742 else true; fi
95ddd785
NN
743 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
744 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
745 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
746 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
747 -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
748
749local-maintainer-clean:
750 @echo "This command is intended for maintainers to use;"
751 @echo "it deletes files that may require special tools to rebuild."
752
753clean: do-clean local-clean
754mostlyclean: do-mostlyclean local-clean
755distclean: do-distclean local-clean local-distclean
756maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
757maintainer-clean: local-distclean
758realclean: maintainer-clean
759
95ddd785
NN
760# Check target.
761
762.PHONY: check do-check
333a28b4 763check: do-check
95ddd785 764
4977bab6 765# Only include modules actually being configured and built.
1061f99e
PB
766.PHONY: check-host
767check-host: [+
7e2dbcef
NN
768 FOR host_modules +] \
769 maybe-check-[+module+][+
1061f99e
PB
770 ENDFOR host_modules +]
771
772.PHONY: check-target
773check-target: [+
7e2dbcef
NN
774 FOR target_modules +] \
775 maybe-check-target-[+module+][+
1061f99e
PB
776 ENDFOR target_modules +]
777
778do-check:
f41d6665 779 @: $(MAKE); $(unstage)
e7c84bf8
PB
780 @r=`${PWD_COMMAND}`; export r; \
781 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
782 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
95ddd785
NN
783
784# Automated reporting of test results.
785
786warning.log: build.log
787 $(srcdir)/contrib/warn_summary build.log > $@
788
789mail-report.log:
790 if test x'$(BOOT_CFLAGS)' != x''; then \
791 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
792 fi; \
793 $(srcdir)/contrib/test_summary -t >$@
794 chmod +x $@
795 echo If you really want to send e-mail, run ./$@ now
796
797mail-report-with-warnings.log: warning.log
798 if test x'$(BOOT_CFLAGS)' != x''; then \
799 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
800 fi; \
801 $(srcdir)/contrib/test_summary -t -i warning.log >$@
802 chmod +x $@
803 echo If you really want to send e-mail, run ./$@ now
804
805# Installation targets.
806
4977bab6 807.PHONY: install uninstall
1061f99e 808install:
f41d6665 809 @: $(MAKE); $(unstage)
e7c84bf8
PB
810 @r=`${PWD_COMMAND}`; export r; \
811 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
812 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
8b87bb96 813
7e2dbcef
NN
814.PHONY: install-host-nogcc
815install-host-nogcc: [+
3589b69e
PB
816 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
817 maybe-install-[+module+][+ ENDIF +][+
7e2dbcef
NN
818 ENDFOR host_modules +]
819
8b87bb96 820.PHONY: install-host
d32ab992 821install-host: [+
8b87bb96
NN
822 FOR host_modules +] \
823 maybe-install-[+module+][+
824 ENDFOR host_modules +]
7e2dbcef 825
8b87bb96
NN
826.PHONY: install-target
827install-target: [+
828 FOR target_modules +] \
829 maybe-install-target-[+module+][+
830 ENDFOR target_modules +]
95ddd785
NN
831
832uninstall:
833 @echo "the uninstall target is not supported in this tree"
834
95ddd785
NN
835.PHONY: install.all
836install.all: install-no-fixedincludes
837 @if [ -f ./gcc/Makefile ] ; then \
8c90b13a 838 r=`${PWD_COMMAND}` ; export r ; \
f41d6665 839 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 840 $(HOST_EXPORTS) \
88b5521b 841 (cd ./gcc && \
95ddd785
NN
842 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
843 else \
844 true ; \
845 fi
846
847# install-no-fixedincludes is used because Cygnus can not distribute
848# the fixed header files.
849.PHONY: install-no-fixedincludes
7e2dbcef 850install-no-fixedincludes: installdirs install-host-nogcc \
8b87bb96 851 install-target gcc-no-fixedincludes
95ddd785 852
4977bab6 853### other supporting targets
95ddd785 854
4977bab6
ZW
855MAKEDIRS= \
856 $(DESTDIR)$(prefix) \
857 $(DESTDIR)$(exec_prefix)
858.PHONY: installdirs
859installdirs: mkinstalldirs
860 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
861
862dir.info: do-install-info
863 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
3fbe8e4a 864 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
4977bab6
ZW
865 mv -f dir.info.new dir.info ; \
866 else true ; \
95ddd785
NN
867 fi
868
4977bab6
ZW
869dist:
870 @echo "Building a full distribution of this tree isn't done"
871 @echo "via 'make dist'. Check out the etc/ subdirectory"
872
873etags tags: TAGS
874
875# Right now this just builds TAGS in each subdirectory. emacs19 has the
876# ability to use several tags files at once, so there is probably no need
877# to combine them into one big TAGS file (like CVS 1.3 does). We could
878# (if we felt like it) have this Makefile write a piece of elisp which
879# the user could load to tell emacs19 where all the TAGS files we just
880# built are.
881TAGS: do-TAGS
882
25b42232
PB
883# ------------------------------------
884# Macros for configure and all targets
885# ------------------------------------
886
887[+ DEFINE configure +]
888.PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
889maybe-configure-[+prefix+][+module+]:
3ff3adad
PB
890@if gcc-bootstrap
891configure-[+prefix+][+module+]: stage_current
892@endif gcc-bootstrap
25b42232
PB
893@if [+prefix+][+module+]
894maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
3ff3adad 895configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
cc11cc9b
PB
896 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
897 @r=`${PWD_COMMAND}`; export r; \
f41d6665 898 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
cc11cc9b
PB
899 [+ IF check_multilibs
900 +]echo "Checking multilib configuration for [+module+]..."; \
f41d6665
DJ
901 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
902 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
903 if test -r [+subdir+]/[+module+]/multilib.out; then \
904 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
905 rm -f [+subdir+]/[+module+]/multilib.tmp; \
906 else \
907 rm -f [+subdir+]/[+module+]/Makefile; \
908 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
909 fi; \
910 else \
911 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
cc11cc9b
PB
912 fi; \
913 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
25b42232 914 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
25b42232
PB
915 [+exports+] \
916 echo Configuring in [+subdir+]/[+module+]; \
917 cd "[+subdir+]/[+module+]" || exit 1; \
3aa83176 918 case $(srcdir) in \
215c351a 919 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
25b42232 920 *) topdir=`echo [+subdir+]/[+module+]/ | \
215c351a 921 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
3aa83176 922 esac; \
215c351a
PB
923 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
924 libsrcdir="$$s/[+module+]"; \
25b42232
PB
925 [+ IF no-config-site +]rm -f no-such-file || : ; \
926 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
e69bf64b
PB
927 [+args+] --build=${build_alias} --host=[+host_alias+] \
928 --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
3aa83176 929 || exit 1
25b42232 930@endif [+prefix+][+module+]
ce406537
PB
931
932[+ IF bootstrap +]
933[+ FOR bootstrap_stage +]
934.PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
935maybe-configure-stage[+id+]-[+prefix+][+module+]:
f41d6665 936@if [+prefix+][+module+]-bootstrap
ce406537 937maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
f41d6665 938configure-stage[+id+]-[+prefix+][+module+]:
cc11cc9b 939 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
f41d6665 940 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
cc11cc9b 941 @r=`${PWD_COMMAND}`; export r; \
ce406537 942 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4a4a4e99 943 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
cc11cc9b
PB
944 [+ IF check_multilibs
945 +]echo "Checking multilib configuration for [+module+]..."; \
f41d6665
DJ
946 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
947 if test -r [+subdir+]/[+module+]/multilib.out; then \
948 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
949 rm -f [+subdir+]/[+module+]/multilib.tmp; \
950 else \
951 rm -f [+subdir+]/[+module+]/Makefile; \
952 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
953 fi; \
954 else \
955 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
cc11cc9b
PB
956 fi; \
957 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
ce406537 958 [+exports+][+ IF prev +] \
4a4a4e99
AO
959 [+poststage1_exports+][+ ENDIF prev +][+ IF prefix +] \
960 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
961 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
962 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;[+ ELSE prefix +] \
963 CFLAGS="$(STAGE[+id+]_CFLAGS)"; export CFLAGS; \
964 CXXFLAGS="$(STAGE[+id+]_CFLAGS)"; export CXXFLAGS;[+ IF prev +] \
965 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
966 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +]; export LIBCFLAGS;[+ ENDIF prefix +] \
ce406537 967 echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
f41d6665 968 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
ce406537
PB
969 cd [+subdir+]/[+module+] || exit 1; \
970 case $(srcdir) in \
971 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
972 *) topdir=`echo [+subdir+]/[+module+]/ | \
973 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
974 esac; \
975 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
976 libsrcdir="$$s/[+module+]"; \
977 $(SHELL) $${libsrcdir}/configure \
e69bf64b 978 [+args+] --build=${build_alias} --host=[+host_alias+] \
4a4a4e99
AO
979 --target=[+target_alias+] $${srcdiroption} [+ IF prev +]\
980 --with-build-libsubdir=$(HOST_SUBDIR) [+ ENDIF prev +]\
981 $(STAGE[+id+]_CONFIGURE_FLAGS)[+ IF extra_configure_flags +] \
982 [+extra_configure_flags+][+ ENDIF extra_configure_flags +]
f41d6665 983@endif [+prefix+][+module+]-bootstrap
ce406537
PB
984[+ ENDFOR bootstrap_stage +]
985[+ ENDIF bootstrap +]
25b42232
PB
986[+ ENDDEF +]
987
988[+ DEFINE all +]
989.PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
990maybe-all-[+prefix+][+module+]:
3ff3adad
PB
991@if gcc-bootstrap
992all-[+prefix+][+module+]: stage_current
993@endif gcc-bootstrap
25b42232
PB
994@if [+prefix+][+module+]
995TARGET-[+prefix+][+module+]=[+
e69bf64b 996 IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
25b42232 997maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
3ff3adad 998all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
cc11cc9b
PB
999 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1000 @r=`${PWD_COMMAND}`; export r; \
8c90b13a 1001 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
25b42232
PB
1002 [+exports+] \
1003 (cd [+subdir+]/[+module+] && \
1c8bd6a3
PB
1004 $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+extra_make_flags+] \
1005 $(TARGET-[+prefix+][+module+]))
25b42232 1006@endif [+prefix+][+module+]
ce406537
PB
1007
1008[+ IF bootstrap +]
1009[+ FOR bootstrap_stage +]
1010.PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
1011.PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
1012maybe-all-stage[+id+]-[+prefix+][+module+]:
1013maybe-clean-stage[+id+]-[+prefix+][+module+]:
f41d6665 1014@if [+prefix+][+module+]-bootstrap
ce406537
PB
1015maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
1016all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
1061f99e 1017TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
ce406537 1018all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
cc11cc9b 1019 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
ce406537
PB
1020 @r=`${PWD_COMMAND}`; export r; \
1021 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4a4a4e99 1022 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
ce406537
PB
1023 [+exports+][+ IF prev +] \
1024 [+poststage1_exports+][+ ENDIF prev +] \
1025 cd [+subdir+]/[+module+] && \
4a4a4e99
AO
1026 $(MAKE) $(BASE_FLAGS_TO_PASS)[+ IF prefix +] \
1027 CFLAGS="$(CFLAGS_FOR_TARGET)" \
1028 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
1029 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"[+ ELSE prefix +] \
1030 CFLAGS="$(STAGE[+id+]_CFLAGS)" \
1031 CXXFLAGS="$(STAGE[+id+]_CFLAGS)"[+ IF prev +] \
1032 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1033 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +][+ ENDIF prefix +] \
1034 CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
1035 CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
1036 LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
1037 [+args+] [+
342b9200
PB
1038 IF prev +][+poststage1_args+][+ ENDIF prev
1039 +] [+extra_make_flags+] \
4a4a4e99 1040 TFLAGS="$(STAGE[+id+]_TFLAGS)" \
1061f99e 1041 $(TARGET-stage[+id+]-[+prefix+][+module+])
ce406537
PB
1042
1043maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
1044clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
1045clean-stage[+id+]-[+prefix+][+module+]:
995a5697
PB
1046 @if [ $(current_stage) = stage[+id+] ]; then \
1047 [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
1048 else \
1049 [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
1050 $(MAKE) stage[+id+]-start; \
1051 fi; \
ce406537
PB
1052 cd [+subdir+]/[+module+] && \
1053 $(MAKE) [+args+] [+ IF prev +] \
1054 [+poststage1_args+] [+ ENDIF prev +] \
342b9200 1055 [+extra_make_flags+] clean
f41d6665 1056@endif [+prefix+][+module+]-bootstrap
ce406537
PB
1057
1058[+ ENDFOR bootstrap_stage +]
1059[+ ENDIF bootstrap +]
25b42232
PB
1060[+ ENDDEF +]
1061
1062# --------------------------------------
1063# Modules which run on the build machine
1064# --------------------------------------
1065[+ FOR build_modules +]
1066[+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
e69bf64b
PB
1067 host_alias=(get "host" "${build_alias}")
1068 target_alias=(get "target" "${target_alias}")
25b42232
PB
1069 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
1070
f8c33439
JM
1071[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1072 args="$(EXTRA_BUILD_FLAGS)" +]
25b42232 1073[+ ENDFOR build_module +]
4977bab6
ZW
1074
1075# --------------------------------------
1076# Modules which run on the host machine
1077# --------------------------------------
1078[+ FOR host_modules +]
ce406537
PB
1079[+ configure prefix="" subdir="$(HOST_SUBDIR)"
1080 exports="$(HOST_EXPORTS)"
1081 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
e69bf64b
PB
1082 host_alias=(get "host" "${host_alias}")
1083 target_alias=(get "target" "${target_alias}")
25b42232 1084 args="$(HOST_CONFIGARGS)" +]
95ddd785 1085
ce406537
PB
1086[+ all prefix="" subdir="$(HOST_SUBDIR)"
1087 exports="$(HOST_EXPORTS)"
1088 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1c8bd6a3 1089 args="$(EXTRA_HOST_FLAGS)"
ce406537 1090 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
4977bab6 1091
7e2dbcef
NN
1092.PHONY: check-[+module+] maybe-check-[+module+]
1093maybe-check-[+module+]:
60975492
PB
1094@if [+module+]
1095maybe-check-[+module+]: check-[+module+]
4977bab6 1096[+ IF no_check +]
4977bab6
ZW
1097check-[+module+]:
1098[+ ELIF no_check_cross +]
4977bab6
ZW
1099# This module is only tested in a native toolchain.
1100check-[+module+]:
f41d6665 1101 @: $(MAKE); $(unstage)
e89fbdfe 1102 @if [ '$(host)' = '$(target)' ] ; then \
8c90b13a
L
1103 r=`${PWD_COMMAND}`; export r; \
1104 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 1105 $(HOST_EXPORTS) \
215c351a 1106 (cd $(HOST_SUBDIR)/[+module+] && \
ef6e9bc0 1107 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
3aa83176
NN
1108 fi
1109[+ ELSE check +]
3aa83176 1110check-[+module+]:
f41d6665 1111 @: $(MAKE); $(unstage)
8c90b13a
L
1112 @r=`${PWD_COMMAND}`; export r; \
1113 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 1114 $(HOST_EXPORTS) \
215c351a
PB
1115 (cd $(HOST_SUBDIR)/[+module+] && \
1116 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
4977bab6 1117[+ ENDIF no_check +]
60975492 1118@endif [+module+]
4977bab6 1119
4977bab6
ZW
1120.PHONY: install-[+module+] maybe-install-[+module+]
1121maybe-install-[+module+]:
60975492
PB
1122@if [+module+]
1123maybe-install-[+module+]: install-[+module+]
7e2dbcef 1124[+ IF no_install +]
4977bab6
ZW
1125install-[+module+]:
1126[+ ELSE install +]
4977bab6 1127install-[+module+]: installdirs
f41d6665 1128 @: $(MAKE); $(unstage)
8c90b13a
L
1129 @r=`${PWD_COMMAND}`; export r; \
1130 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 1131 $(HOST_EXPORTS) \
215c351a 1132 (cd $(HOST_SUBDIR)/[+module+] && \
ace9ac7b 1133 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
4977bab6 1134[+ ENDIF no_install +]
60975492 1135@endif [+module+]
295f4e42 1136
b5422ad7 1137# Other targets (info, dvi, pdf, etc.)
295f4e42
NN
1138[+ FOR recursive_targets +]
1139.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1140maybe-[+make_target+]-[+module+]:
60975492
PB
1141@if [+module+]
1142maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
295f4e42
NN
1143[+ IF (match-value? = "missing" (get "make_target") ) +]
1144# [+module+] doesn't support [+make_target+].
1145[+make_target+]-[+module+]:
1146[+ ELSE +]
1147[+make_target+]-[+module+]: [+
1148 FOR depend +]\
1149 [+depend+]-[+module+] [+
1150 ENDFOR depend +]
f41d6665 1151 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1061f99e 1152 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
295f4e42
NN
1153 r=`${PWD_COMMAND}`; export r; \
1154 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 1155 $(HOST_EXPORTS) \
d32ab992 1156 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
295f4e42
NN
1157 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1158 done; \
1159 echo "Doing [+make_target+] in [+module+]" ; \
215c351a 1160 (cd $(HOST_SUBDIR)/[+module+] && \
295f4e42
NN
1161 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1162 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1163 "RANLIB=$${RANLIB}" \
901119ae 1164 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
d32ab992 1165 [+make_target+]) \
295f4e42
NN
1166 || exit 1
1167[+ ENDIF +]
60975492 1168@endif [+module+]
295f4e42 1169[+ ENDFOR recursive_targets +]
4977bab6
ZW
1170[+ ENDFOR host_modules +]
1171
1172# ---------------------------------------
1173# Modules which run on the target machine
1174# ---------------------------------------
1175[+ FOR target_modules +]
4977bab6 1176
25b42232
PB
1177[+ IF raw_cxx +]
1178[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
f41d6665 1179 check_multilibs=true
25b42232 1180 exports="$(RAW_CXX_TARGET_EXPORTS)"
e69bf64b
PB
1181 host_alias=(get "host" "${target_alias}")
1182 target_alias=(get "target" "${target_alias}")
25b42232
PB
1183 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1184
1185[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1186 exports="$(RAW_CXX_TARGET_EXPORTS)"
1c8bd6a3 1187 args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
25b42232
PB
1188[+ ELSE +]
1189[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
f41d6665 1190 check_multilibs=true
25b42232 1191 exports="$(NORMAL_TARGET_EXPORTS)"
e69bf64b
PB
1192 host_alias=(get "host" "${target_alias}")
1193 target_alias=(get "target" "${target_alias}")
25b42232
PB
1194 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1195
1196[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1197 exports="$(NORMAL_TARGET_EXPORTS)"
1c8bd6a3 1198 args="$(EXTRA_TARGET_FLAGS)" +]
25b42232 1199[+ ENDIF +]
7e2dbcef
NN
1200
1201.PHONY: check-target-[+module+] maybe-check-target-[+module+]
1202maybe-check-target-[+module+]:
60975492
PB
1203@if target-[+module+]
1204maybe-check-target-[+module+]: check-target-[+module+]
4977bab6
ZW
1205[+ IF no_check +]
1206# Dummy target for uncheckable module.
4977bab6
ZW
1207check-target-[+module+]:
1208[+ ELSE check +]
4977bab6 1209check-target-[+module+]:
f41d6665 1210 @: $(MAKE); $(unstage)
8c90b13a 1211 @r=`${PWD_COMMAND}`; export r; \
0bff65e7 1212 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1213IF raw_cxx +]
1214 $(RAW_CXX_TARGET_EXPORTS) \[+
1215ELSE normal_cxx +]
1216 $(NORMAL_TARGET_EXPORTS) \[+
1217ENDIF raw_cxx +]
3aa83176
NN
1218 (cd $(TARGET_SUBDIR)/[+module+] && \
1219 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1220 IF raw_cxx
1221 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1222 ENDIF raw_cxx
a52a0a7f 1223 +] [+extra_make_flags+] check)
4977bab6 1224[+ ENDIF no_check +]
60975492 1225@endif target-[+module+]
7e2dbcef 1226
4977bab6
ZW
1227.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1228maybe-install-target-[+module+]:
60975492
PB
1229@if target-[+module+]
1230maybe-install-target-[+module+]: install-target-[+module+]
7e2dbcef 1231[+ IF no_install +]
4977bab6
ZW
1232# Dummy target for uninstallable.
1233install-target-[+module+]:
1234[+ ELSE install +]
4977bab6 1235install-target-[+module+]: installdirs
f41d6665 1236 @: $(MAKE); $(unstage)
8c90b13a 1237 @r=`${PWD_COMMAND}`; export r; \
0bff65e7 1238 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1239IF raw_cxx +]
1240 $(RAW_CXX_TARGET_EXPORTS) \[+
1241ELSE normal_cxx +]
1242 $(NORMAL_TARGET_EXPORTS) \[+
1243ENDIF raw_cxx +]
3aa83176 1244 (cd $(TARGET_SUBDIR)/[+module+] && \
a52a0a7f 1245 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
4977bab6 1246[+ ENDIF no_install +]
60975492 1247@endif target-[+module+]
295f4e42 1248
b5422ad7 1249# Other targets (info, dvi, pdf, etc.)
295f4e42
NN
1250[+ FOR recursive_targets +]
1251.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1252maybe-[+make_target+]-target-[+module+]:
60975492
PB
1253@if target-[+module+]
1254maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
295f4e42
NN
1255[+ IF (match-value? = "missing" (get "make_target") ) +]
1256# [+module+] doesn't support [+make_target+].
1257[+make_target+]-target-[+module+]:
1258[+ ELSE +]
1259[+make_target+]-target-[+module+]: [+
1260 FOR depend +]\
1261 [+depend+]-target-[+module+] [+
1262 ENDFOR depend +]
f41d6665 1263 @: $(MAKE); $(unstage)
295f4e42
NN
1264 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1265 r=`${PWD_COMMAND}`; export r; \
0bff65e7 1266 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1267IF raw_cxx +]
1268 $(RAW_CXX_TARGET_EXPORTS) \[+
1269ELSE normal_cxx +]
1270 $(NORMAL_TARGET_EXPORTS) \[+
1271ENDIF raw_cxx +]
295f4e42
NN
1272 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1273 for flag in $(EXTRA_TARGET_FLAGS); do \
1274 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1275 done; \
1276 (cd $(TARGET_SUBDIR)/[+module+] && \
1277 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1278 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1279 "RANLIB=$${RANLIB}" \
901119ae 1280 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
a52a0a7f 1281 [+extra_make_flags+] [+make_target+]) \
295f4e42
NN
1282 || exit 1
1283[+ ENDIF +]
60975492 1284@endif target-[+module+]
295f4e42 1285[+ ENDFOR recursive_targets +]
4977bab6 1286[+ ENDFOR target_modules +]
95ddd785 1287
4977bab6
ZW
1288# ----------
1289# GCC module
1290# ----------
95ddd785 1291
f516a7da 1292@if gcc-no-bootstrap
95ddd785 1293.PHONY: cross
7c27e184 1294cross: all-build all-gas all-ld
8c90b13a
L
1295 @r=`${PWD_COMMAND}`; export r; \
1296 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1297 $(HOST_EXPORTS) \
95ddd785
NN
1298 echo "Building the C and C++ compiler"; \
1299 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
8c90b13a
L
1300 @r=`${PWD_COMMAND}`; export r; \
1301 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
95ddd785 1302 echo "Building runtime libraries"; \
ad6717df 1303 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
f516a7da 1304@endif gcc-no-bootstrap
95ddd785 1305
60975492 1306@if gcc
60911f14
SE
1307[+ FOR languages +]
1308.PHONY: check-gcc-[+language+] check-[+language+]
1309check-gcc-[+language+]:
1310 r=`${PWD_COMMAND}`; export r; \
1311 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1312 $(HOST_EXPORTS) \
1313 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]);
1314check-[+language+]: check-gcc-[+language+][+ IF lib-check-target +] [+ lib-check-target +][+ ENDIF lib-check-target +]
1315[+ ENDFOR languages +]
95ddd785 1316
4977bab6
ZW
1317# Install the gcc headers files, but not the fixed include files,
1318# which Cygnus is not allowed to distribute. This rule is very
1319# dependent on the workings of the gcc Makefile.in.
1320.PHONY: gcc-no-fixedincludes
1321gcc-no-fixedincludes:
1322 @if [ -f ./gcc/Makefile ]; then \
1323 rm -rf gcc/tmp-include; \
1324 mv gcc/include gcc/tmp-include 2>/dev/null; \
1325 mkdir gcc/include; \
1326 cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1327 touch gcc/stmp-fixinc gcc/include/fixed; \
1328 rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
8c90b13a
L
1329 r=`${PWD_COMMAND}`; export r; \
1330 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
a52a0a7f 1331 $(HOST_EXPORTS) \
88b5521b 1332 (cd ./gcc && \
4977bab6
ZW
1333 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1334 rm -rf gcc/include; \
1335 mv gcc/tmp-include gcc/include 2>/dev/null; \
1336 else true; fi
60975492 1337@endif gcc
295f4e42 1338
2805b53a
NN
1339# ---------------------
1340# GCC bootstrap support
1341# ---------------------
1342
d32ab992
PB
1343# We track the current stage (the one in 'gcc') in the stage_current file.
1344# stage_last instead tracks the stage that was built last. These targets
1345# are dummy when toplevel bootstrap is not active.
1346
1061f99e 1347# While making host and target tools, symlinks to the final stage must be
f41d6665
DJ
1348# there, so $(unstage) should be run at various points. To avoid excessive
1349# recursive invocations of make, we "inline" them using a variable. These
1350# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1351# to avoid warnings from the GNU Make job server.
1061f99e
PB
1352
1353unstage = :
1354stage = :
cc11cc9b 1355current_stage = ""
1061f99e 1356
d32ab992 1357@if gcc-bootstrap
9bd6112c 1358unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
d19bca38 1359stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
cc11cc9b 1360current_stage = "`cat stage_current 2> /dev/null`"
d32ab992
PB
1361@endif gcc-bootstrap
1362
1061f99e
PB
1363.PHONY: unstage stage
1364unstage:
f41d6665 1365 @: $(MAKE); $(unstage)
d32ab992 1366stage:
f41d6665 1367 @: $(MAKE); $(stage)
d32ab992 1368
2d309510
PB
1369# Disable commands for lean bootstrap.
1370LEAN = false
1371
148907ea
PB
1372# We name the build directories for the various stages "stage1-gcc",
1373# "stage2-gcc","stage3-gcc", etc.
1374
1375# Since the 'compare' process will fail (on debugging information) if any
1376# directory names are different, we need to link the gcc directory for
f41d6665 1377# the previous stage to a constant name ('prev-gcc'), and to make the name of
148907ea
PB
1378# the build directories constant as well. For the latter, we use naked names
1379# like 'gcc', because the scripts in that directory assume it. We use
1380# mv on platforms where symlinks to directories do not work or are not
1381# reliable.
1382
2805b53a
NN
1383# 'touch' doesn't work right on some platforms.
1384STAMP = echo timestamp >
1385
148907ea
PB
1386# We only want to compare .o files, so set this!
1387objext = .o
2805b53a 1388
148907ea 1389[+ FOR bootstrap-stage +]
f516a7da 1390.PHONY: stage[+id+]-start stage[+id+]-end
148907ea 1391
ad6717df 1392stage[+id+]-start::
f41d6665 1393 @: $(MAKE); $(stage); \
d32ab992 1394 echo stage[+id+] > stage_current ; \
215c351a 1395 echo stage[+id+] > stage_last; \
f41d6665 1396 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
215c351a 1397 FOR host_modules +][+ IF bootstrap +]
7c27e184 1398@if [+ module +]
215c351a
PB
1399 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1400 mkdir stage[+id+]-[+module+]; \
2d309510
PB
1401 mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1402 mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
f41d6665
DJ
1403@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1404 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1405 mkdir stage[+id+]-$(TARGET_SUBDIR); \
2d309510
PB
1406 mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1407 mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
148907ea 1408
2d309510 1409stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
7c27e184 1410@if [+ module +]
2d309510
PB
1411 @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1412 cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1413 mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
f41d6665
DJ
1414 fi
1415@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1416 @if test -d $(TARGET_SUBDIR) ; then \
2d309510
PB
1417 mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1418 mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
f41d6665 1419 fi
2d309510 1420 rm -f stage_current
148907ea 1421
8024d75e 1422# Bubble a bug fix through all the stages up to stage [+id+]. They are
f41d6665 1423# remade, but not reconfigured. The next stage (if any) will not be
cdce5c41 1424# reconfigured either.
f516a7da 1425.PHONY: stage[+id+]-bubble
2d309510 1426stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
e7c84bf8
PB
1427 @r=`${PWD_COMMAND}`; export r; \
1428 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1429 if test -f stage[+id+]-lean [+
ce521a9c
PB
1430 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1431 echo Skipping rebuild of stage[+id+] ; \
1432 else \
2d309510
PB
1433 $(MAKE) stage[+id+]-start; \[+IF lean +]
1434 if $(LEAN); then \
1435 rm -rf stage[+lean+]-* ; \
1436 $(STAMP) stage[+lean+]-lean ; \
1437 fi; \[+ ENDIF lean +]
1061f99e 1438 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
2abefe3d 1439 fi[+ IF compare-target +]
d19bca38 1440 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
7c27e184 1441
45f366ab 1442.PHONY: all-stage[+id+] clean-stage[+id+]
45f366ab 1443do-clean: clean-stage[+id+]
2805b53a 1444
7c27e184
PB
1445# FIXME: Will not need to be conditional when toplevel bootstrap is the
1446# only possibility, but now it conflicts with no-bootstrap rules
1447@if gcc-bootstrap
148907ea 1448[+ IF compare-target +]
ce521a9c 1449[+compare-target+]:
e7c84bf8
PB
1450 @r=`${PWD_COMMAND}`; export r; \
1451 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1452 if test -f stage[+prev+]-lean; then \
ce521a9c
PB
1453 echo Cannot compare object files as stage [+prev+] was deleted. ; \
1454 exit 0 ; \
1455 fi; \
f41d6665 1456 : $(MAKE); $(stage); \
2805b53a 1457 rm -f .bad_compare ; \
cc11cc9b 1458 echo Comparing stages [+prev+] and [+id+] ; \
70cb2d9f
AO
1459 sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \
1460 files=`find stage[+id+]-* -name "*$(objext)" -print | \
1461 sed -n s,^stage$$sed-,,p` ; \
2805b53a 1462 for file in $${files} ; do \
70cb2d9f
AO
1463 f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \
1464 if test ! -f $$f1; then continue; fi; \
bb286d71 1465 $(do-[+compare-target+]) > /dev/null 2>&1; \
1061f99e
PB
1466 if test $$? -eq 1; then \
1467 case $$file in \
f2689b09 1468 @compare_exclusions@) \
1061f99e
PB
1469 echo warning: $$file differs ;; \
1470 *) \
1471 echo $$file differs >> .bad_compare ;; \
1472 esac ; \
1473 fi ; \
2805b53a
NN
1474 done ; \
1475 if [ -f .bad_compare ]; then \
1476 echo "Bootstrap comparison failure!"; \
1477 cat .bad_compare; \
1478 exit 1; \
1479 else \
cc11cc9b 1480 echo Comparison successful.; \
2805b53a 1481 fi ; \
ce521a9c 1482 $(STAMP) [+compare-target+][+ IF prev +]
2d309510
PB
1483 if $(LEAN); then \
1484 rm -rf stage[+prev+]-*; \
1485 $(STAMP) stage[+prev+]-lean; \
1486 fi[+ ENDIF prev +]
148907ea
PB
1487[+ ENDIF compare-target +]
1488
1489[+ IF bootstrap-target +]
2d309510 1490.PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
2abefe3d
PB
1491[+bootstrap-target+]:
1492 echo stage[+id+] > stage_final
1493 @r=`${PWD_COMMAND}`; export r; \
1494 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1495 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
f41d6665 1496 @: $(MAKE); $(unstage)
2abefe3d
PB
1497 @r=`${PWD_COMMAND}`; export r; \
1498 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4a4a4e99 1499 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
2abefe3d 1500 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
2d309510
PB
1501
1502[+bootstrap-target+]-lean:
1503 echo stage[+id+] > stage_final
1504 @r=`${PWD_COMMAND}`; export r; \
1505 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1506 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1507 @: $(MAKE); $(unstage)
1508 @r=`${PWD_COMMAND}`; export r; \
1509 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4a4a4e99 1510 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
2d309510 1511 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
148907ea
PB
1512[+ ENDIF bootstrap-target +]
1513
45f366ab 1514# Rules to wipe a stage and all the following ones, also used for cleanstrap
ad6717df 1515[+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
45f366ab 1516.PHONY: distclean-stage[+id+]
ad6717df 1517distclean-stage[+id+]::
f41d6665 1518 @: $(MAKE); $(stage)
a19e8f64 1519 @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
ce521a9c 1520 rm -rf stage[+id+]-* [+
148907ea 1521 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
148907ea
PB
1522
1523[+ IF cleanstrap-target +]
1524.PHONY: [+cleanstrap-target+]
a19e8f64
PB
1525[+cleanstrap-target+]: do-distclean local-clean
1526 echo stage[+id+] > stage_final
1527 @r=`${PWD_COMMAND}`; export r; \
1528 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1529 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1530 @: $(MAKE); $(unstage)
1531 @r=`${PWD_COMMAND}`; export r; \
1532 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4a4a4e99 1533 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
a19e8f64 1534 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
148907ea 1535[+ ENDIF cleanstrap-target +]
7c27e184 1536@endif gcc-bootstrap
148907ea
PB
1537
1538[+ ENDFOR bootstrap-stage +]
ad6717df 1539
c7870f5d
PB
1540stageprofile-end::
1541 $(MAKE) distclean-stagefeedback
ad6717df 1542
c7870f5d 1543stagefeedback-start::
ad6717df
PB
1544 @r=`${PWD_COMMAND}`; export r; \
1545 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
c7870f5d
PB
1546 for i in prev-*; do \
1547 j=`echo $$i | sed s/^prev-//` ; \
1548 cd $$r/$$i && \
1549 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1550 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1551 done
03a91701 1552
45f366ab 1553@if gcc-bootstrap
45f366ab 1554do-distclean: distclean-stage1
cc11cc9b
PB
1555
1556# Provide a GCC build when we're building target libraries. This does
1557# not work as a dependency, just as the minimum necessary to avoid errors.
1558stage_last:
ee04b574
AS
1559 @r=`${PWD_COMMAND}`; export r; \
1560 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
cc11cc9b 1561 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
45f366ab 1562
3ff3adad
PB
1563# Same as unstage, but not phony and defaulting to stage1-start. We place
1564# it in the dependency so that for example `make -j3 all-gcc' works.
1565stage_current:
1566 @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1567
cc11cc9b 1568.PHONY: restrap
c6b196de 1569restrap::
cc11cc9b 1570 @: $(MAKE); $(stage)
4a4a4e99
AO
1571 rm -rf stage1-$(TARGET_SUBDIR)[+ FOR bootstrap-stage +][+ IF prev
1572 +] stage[+id+]-*[+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
c6b196de 1573restrap:: all
e9a54b07 1574@endif gcc-bootstrap
cc11cc9b 1575
4977bab6
ZW
1576# --------------------------------------
1577# Dependencies between different modules
1578# --------------------------------------
1579
3589b69e 1580# Generic dependencies for target modules on host stuff, especially gcc
cc11cc9b
PB
1581@if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1582 +][+ FOR bootstrap_stage +]
1583configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1584 ENDFOR +][+ ELSE bootstrap +]
1585configure-target-[+module+]: stage_last[+
1586 ENDIF bootstrap +][+ ENDFOR target_modules +]
1587@endif gcc-bootstrap
1588
fa958513 1589@if gcc-no-bootstrap[+ FOR target_modules +]
cc11cc9b 1590configure-target-[+module+]: maybe-all-gcc[+
fa958513 1591 ENDFOR target_modules +]
cc11cc9b
PB
1592@endif gcc-no-bootstrap
1593
3589b69e 1594
4977bab6
ZW
1595# There are two types of dependencies here: 'hard' dependencies, where one
1596# module simply won't build without the other; and 'soft' dependencies, where
1597# if the depended-on module is missing, the depending module will do without
1598# or find a substitute somewhere (perhaps installed). Soft dependencies
3589b69e 1599# are made here to depend on a 'maybe-' target. If you're not sure,
4977bab6
ZW
1600# it's safer to use a soft dependency.
1601
3589b69e
PB
1602[+ ;; These Scheme functions build the bulk of the dependencies.
1603 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
cdce5c41 1604 ;; where "maybe-" is only included if HARD is not true, and all-gcc
3589b69e
PB
1605 ;; is taken from VAR-NAME.
1606 (define dep-target (lambda (module-kind var-name hard)
1607 (string-append
1608 (if hard "" "maybe-")
1609 (dep-subtarget var-name)
1610 module-kind
1611 (dep-module var-name)
1612 )))
1613
1614 ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
7c27e184 1615 (define make-dep (lambda (module-kind on-kind)
3589b69e
PB
1616 (string-append
1617 (dep-target module-kind "module" #t) ": "
7c27e184 1618 (dep-target on-kind "on" (exist? "hard")))))
3589b69e
PB
1619
1620 ;; dep-subtarget extracts everything up to the first dash in the given
1621 ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1622 (define dep-subtarget (lambda (var-name)
1623 (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1624
1625 ;; dep-module extracts everything up to the first dash in the given
1626 ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1627 (define dep-module (lambda (var-name)
1628 (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1629
1630 ;; dep-stage builds a string for the prefix of a bootstrap stage.
1631 (define dep-stage (lambda ()
1632 (string-append
1633 "stage"
1634 (get "id")
1635 "-")))
1636
1637 ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1638 ;; but is written in Scheme.
1639 (define dep-maybe (lambda ()
1640 (if (exist? "hard") "" "maybe-")))
1641
893f1e87
MK
1642 ;; dep-kind returns "normal" if the dependency is on an "install" target,
1643 ;; or if either module is not bootstrapped. It returns "bootstrap" for
3589b69e
PB
1644 ;; configure or build dependencies between bootstrapped modules; it returns
1645 ;; "prebootstrap" for configure or build dependencies of bootstrapped
7c27e184 1646 ;; modules on a build module (e.g. all-gcc on all-build-bison). All this
3589b69e
PB
1647 ;; is only necessary for host modules.
1648 (define dep-kind (lambda ()
7c27e184
PB
1649 (if (and (hash-ref boot-modules (dep-module "module"))
1650 (=* (dep-module "on") "build-"))
1651 "prebootstrap"
3589b69e 1652
7c27e184 1653 (if (or (= (dep-subtarget "on") "install-")
893f1e87
MK
1654 (not (hash-ref boot-modules (dep-module "module")))
1655 (not (hash-ref boot-modules (dep-module "on"))))
7c27e184
PB
1656 "normal"
1657 "bootstrap"))))
3589b69e
PB
1658
1659 ;; We now build the hash table that is used by dep-kind.
1660 (define boot-modules (make-hash-table 113))
3589b69e
PB
1661+]
1662
1663[+ FOR host_modules +][+
1664 (if (exist? "bootstrap")
1665 (hash-create-handle! boot-modules (get "module") #t))
1666 "" +][+ ENDFOR host_modules +]
2dfbef6d
PB
1667[+ FOR target_modules +][+
1668 (if (exist? "bootstrap")
1669 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1670 "" +][+ ENDFOR target_modules +]
3589b69e
PB
1671
1672# With all the machinery above in place, it is pretty easy to generate
1673# dependencies. Host dependencies are a bit more complex because we have
1674# to check for bootstrap/prebootstrap dependencies. To resolve
1675# prebootstrap dependencies, prebootstrap modules are gathered in
1676# a hash table.
7c27e184
PB
1677[+ FOR dependencies +][+ (make-dep "" "") +]
1678[+ CASE (dep-kind) +]
1679[+ == "prebootstrap"
3589b69e 1680 +][+ FOR bootstrap_stage +]
7c27e184
PB
1681[+ (make-dep (dep-stage) "") +][+
1682 ENDFOR bootstrap_stage +]
7c27e184
PB
1683[+ == "bootstrap"
1684 +][+ FOR bootstrap_stage +]
1685[+ (make-dep (dep-stage) (dep-stage)) +][+
3589b69e
PB
1686 ENDFOR bootstrap_stage +]
1687[+ ESAC +][+
1688ENDFOR dependencies +]
1689
fa958513
DJ
1690# Dependencies for target modules on other target modules are
1691# described by lang_env_dependencies; the defaults apply to anything
1692# not mentioned there.
1693[+
1694 ;; Predicate for whether LANG was specified in lang_env_dependencies.
1695 (define lang-dep (lambda (lang)
1696 (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1697
1698 ;; Build the hash table we will need.
1699 (define lang-env-deps (make-hash-table 7))
1700+][+ FOR lang_env_dependencies +][+
1701 (if (exist? "cxx")
1702 (hash-create-handle! lang-env-deps
1703 (string-append (get "module") "-" "cxx") #t))
1704
1705 (if (exist? "no_c")
1706 (hash-create-handle! lang-env-deps
1707 (string-append (get "module") "-" "no_c") #t))
1708
1709 (if (exist? "no_gcc")
1710 (hash-create-handle! lang-env-deps
1711 (string-append (get "module") "-" "no_gcc") #t))
1712 "" +][+ ENDFOR lang_env_dependencies +]
1713
1714@if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1715 +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1716configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1717 ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1718@endif gcc-bootstrap
1719
1720@if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1721configure-target-[+module+]: maybe-all-target-libgcc[+
1722 ENDIF +][+ ENDFOR target_modules +]
1723@endif gcc-no-bootstrap
1724
1725[+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1726configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1727 ENDIF +][+ IF (lang-dep "cxx") +]
1728configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1729 ENDIF +]
1730[+ ENDFOR target_modules +]
1731
ef9db8d5 1732CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
0dffceed 1733GDB_TK = @GDB_TK@
ef9db8d5
DJ
1734INSTALL_GDB_TK = @INSTALL_GDB_TK@
1735configure-gdb: $(CONFIGURE_GDB_TK)
3589b69e 1736all-gdb: $(gdbnlmrequirements) $(GDB_TK)
ef9db8d5 1737install-gdb: $(INSTALL_GDB_TK)
95ddd785 1738
4977bab6
ZW
1739# Serialization dependencies. Host configures don't work well in parallel to
1740# each other, due to contention over config.cache. Target configures and
1741# build configures are similar.
1742@serialization_dependencies@
95ddd785 1743
4977bab6
ZW
1744# --------------------------------
1745# Regenerating top level configury
1746# --------------------------------
95ddd785
NN
1747
1748# Rebuilding Makefile.in, using autogen.
e245b0ea 1749AUTOGEN = autogen
ee03dc5e 1750$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
e245b0ea 1751 cd $(srcdir) && $(AUTOGEN) Makefile.def
95ddd785 1752
671aa708 1753# Rebuilding Makefile.
e245b0ea
AO
1754Makefile: $(srcdir)/Makefile.in config.status
1755 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1756
191dd2c9 1757config.status: configure
e75f9147 1758 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
95ddd785 1759
671aa708 1760# Rebuilding configure.
e245b0ea 1761AUTOCONF = autoconf
18c04407
RW
1762$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
1763 $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4
e245b0ea 1764 cd $(srcdir) && $(AUTOCONF)
95ddd785 1765
93c834b7
NN
1766# ------------------------------
1767# Special directives to GNU Make
1768# ------------------------------
1769
93c834b7
NN
1770# Don't pass command-line variables to submakes.
1771.NOEXPORT:
1772MAKEOVERRIDES=
1773
95ddd785 1774# end of Makefile.in