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