150397Sobrien[+ AutoGen5 template -*- Mode: Makefile -*-
2169689Skanin
3132718Skan+]
450397Sobrien
5132718Skan# Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
650397Sobrien#
7132718Skan# Makefile for directory with subdirs to build.
850397Sobrien#   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
950397Sobrien#   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
1050397Sobrien#
1150397Sobrien# This file is free software; you can redistribute it and/or modify
12132718Skan# it under the terms of the GNU General Public License as published by
1350397Sobrien# the Free Software Foundation; either version 2 of the License, or
1450397Sobrien# (at your option) any later version.
1550397Sobrien# 
1650397Sobrien# This program is distributed in the hope that it will be useful,
1750397Sobrien# but WITHOUT ANY WARRANTY; without even the implied warranty of
18132718Skan# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19169689Skan# GNU General Public License for more details.
20169689Skan# 
2150397Sobrien# You should have received a copy of the GNU General Public License
2250397Sobrien# along with this program; if not, write to the Free Software
2350397Sobrien# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24132718Skan#
25132718Skan
2650397Sobrien# -------------------------------
2750397Sobrien# Standard Autoconf-set variables
2890075Sobrien# -------------------------------
2950397SobrienVPATH=@srcdir@
3050397Sobrien
3150397Sobrienbuild_alias=@build_noncanonical@
3250397Sobrienbuild_vendor=@build_vendor@
3350397Sobrienbuild_os=@build_os@
3450397Sobrienbuild=@build@
3550397Sobrienhost_alias=@host_noncanonical@
36117395Skanhost_vendor=@host_vendor@
3752284Sobrienhost_os=@host_os@
3850397Sobrienhost=@host@
39132718Skantarget_alias=@target_noncanonical@
4050397Sobrientarget_vendor=@target_vendor@
4150397Sobrientarget_os=@target_os@
42132718Skantarget=@target@
4350397Sobrien
4450397Sobrienprogram_transform_name = @program_transform_name@
4550397Sobrien
4650397Sobrienprefix = @prefix@
4750397Sobrienexec_prefix = @exec_prefix@
4890075Sobrien
4950397Sobriensrcdir = @srcdir@
5050397Sobrien
5150397Sobrienbindir = @bindir@
5250397Sobriensbindir = @sbindir@
5350397Sobrienlibexecdir = @libexecdir@
5450397Sobriendatadir = @datadir@
5550397Sobriensysconfdir = @sysconfdir@
5650397Sobriensharedstatedir = @sharedstatedir@
5750397Sobrienlocalstatedir = @localstatedir@
5852284Sobrienlibdir = @libdir@
5950397Sobrienincludedir = @includedir@
6052284Sobrienoldincludedir = @oldincludedir@
6150397Sobrieninfodir = @infodir@
6250397Sobriendatarootdir = @datarootdir@
63132718Skandocdir = @docdir@
64132718Skanpdfdir = @pdfdir@
65132718Skanhtmldir = @htmldir@
6650397Sobrienmandir = @mandir@
6750397Sobrienman1dir = $(mandir)/man1
68132718Skanman2dir = $(mandir)/man2
6952284Sobrienman3dir = $(mandir)/man3
7050397Sobrienman4dir = $(mandir)/man4
71132718Skanman5dir = $(mandir)/man5
72117395Skanman6dir = $(mandir)/man6
7350397Sobrienman7dir = $(mandir)/man7
7450397Sobrienman8dir = $(mandir)/man8
7550397Sobrienman9dir = $(mandir)/man9
7650397Sobrien
7750397SobrienINSTALL = @INSTALL@
7850397SobrienINSTALL_PROGRAM = @INSTALL_PROGRAM@
7950397SobrienINSTALL_SCRIPT = @INSTALL_SCRIPT@
8050397SobrienINSTALL_DATA = @INSTALL_DATA@
81169689SkanLN = @LN@
82169689SkanLN_S = @LN_S@
83169689SkanMAINT = @MAINT@
8450397SobrienMAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
8550397SobrienMAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
8650397Sobrien
8750397Sobrien# -------------------------------------------------
8850397Sobrien# Miscellaneous non-standard autoconf-set variables
89169689Skan# -------------------------------------------------
90169689Skan
9152284Sobrien# The gcc driver likes to know the arguments it was configured with.
9250397SobrienTOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
9350397Sobrien
94169689Skantooldir = @tooldir@
9550397Sobrienbuild_tooldir = @build_tooldir@
96169689Skan
97169689SkanGDB_NLM_DEPS = 
98169689Skan
99169689Skan# This is the name of the environment variable used for the path to
100169689Skan# the libraries.
101169689SkanRPATH_ENVVAR = @RPATH_ENVVAR@
102169689Skan
10350397Sobrien# Build programs are put under this directory.
104169689SkanBUILD_SUBDIR = @build_subdir@
105169689Skan# This is set by the configure script to the arguments to use when configuring
106169689Skan# directories built for the build system.
107169689SkanBUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
108169689Skan
109169689Skan# This is the list of variables to export in the environment when
110169689Skan# configuring any subdirectory.  It must also be exported whenever
111169689Skan# recursing into a build directory in case that directory's Makefile
112169689Skan# re-runs configure.
11350397SobrienBASE_EXPORTS = \
114117395Skan	FLEX="$(FLEX)"; export FLEX; \
11550397Sobrien	LEX="$(LEX)"; export LEX; \
11650397Sobrien	BISON="$(BISON)"; export BISON; \
11750397Sobrien	YACC="$(YACC)"; export YACC; \
11850397Sobrien	M4="$(M4)"; export M4; \
11950397Sobrien	MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
12050397Sobrien
12150397Sobrien# This is the list of variables to export in the environment when
12250397Sobrien# configuring subdirectories for the build system.
12350397SobrienBUILD_EXPORTS = \
12450397Sobrien	$(BASE_EXPORTS) \
125132718Skan	AR="$(AR_FOR_BUILD)"; export AR; \
12650397Sobrien	AS="$(AS_FOR_BUILD)"; export AS; \
127132718Skan	CC="$(CC_FOR_BUILD)"; export CC; \
128132718Skan	CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
129132718Skan	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
130132718Skan	CXX="$(CXX_FOR_BUILD)"; export CXX; \
13152284Sobrien	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
132132718Skan	GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
13350397Sobrien	GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
13452284Sobrien	DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
13552284Sobrien	LD="$(LD_FOR_BUILD)"; export LD; \
13652284Sobrien	LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
137169689Skan	NM="$(NM_FOR_BUILD)"; export NM; \
13850397Sobrien	RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
13952284Sobrien	WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES;
14052284Sobrien
14152284Sobrien# This is the list of directories to built for the host system.
14252284SobrienSUBDIRS = @configdirs@
14352284Sobrien# This is set by the configure script to the arguments to use when configuring
14452284Sobrien# directories built for the host system.
14552284SobrienHOST_CONFIGARGS = @host_configargs@
14652284Sobrien# Host programs are put under this directory, which is . except if building
14750397Sobrien# with srcdir=..
14850397SobrienHOST_SUBDIR = @host_subdir@
14952284Sobrien# This is the list of variables to export in the environment when
15050397Sobrien# configuring subdirectories for the host system.  We need to pass
15152284Sobrien# some to the GCC configure because of its hybrid host/target nature.
15250397SobrienHOST_EXPORTS = \
15350397Sobrien	$(BASE_EXPORTS) \
15450397Sobrien	CC="$(CC)"; export CC; \
15550397Sobrien	CFLAGS="$(CFLAGS)"; export CFLAGS; \
156132718Skan	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
157169689Skan	CXX="$(CXX)"; export CXX; \
158132718Skan	CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
15950397Sobrien	AR="$(AR)"; export AR; \
16050397Sobrien	AS="$(AS)"; export AS; \
16150397Sobrien	CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
162117395Skan	DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
163117395Skan	LD="$(LD)"; export LD; \
164117395Skan	LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
165132718Skan	NM="$(NM)"; export NM; \
16650397Sobrien	RANLIB="$(RANLIB)"; export RANLIB; \
16750397Sobrien	WINDRES="$(WINDRES)"; export WINDRES; \
16850397Sobrien	OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
16950397Sobrien	OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
17050397Sobrien	AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
17152284Sobrien	AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
172169689Skan	GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
173169689Skan	LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
174169689Skan	NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
175132718Skan	OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
176117395Skan	RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
177117395Skan	TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
17850397Sobrien	GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
179132718Skan	GMPINC="$(HOST_GMPINC)"; export GMPINC; \
18050397Sobrien@if gcc-bootstrap
18152284Sobrien	$(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
182169689Skan@endif gcc-bootstrap
18352284Sobrien	$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
18452284Sobrien
18550397Sobrien# Similar, for later GCC stages.
18650397SobrienPOSTSTAGE1_HOST_EXPORTS = \
18750397Sobrien	$(HOST_EXPORTS) \
18850397Sobrien	CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
18950397Sobrien	  -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
19050397Sobrien	CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \
19150397Sobrien	  $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
19250397Sobrien	  -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
19350397Sobrien	  -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
19450397Sobrien	LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
195132718Skan
19650397Sobrien# Target libraries are put under this directory:
197132718SkanTARGET_SUBDIR = @target_subdir@
198132718Skan# This is set by the configure script to the arguments to use when configuring
199132718Skan# directories built for the target.
200132718SkanTARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
20150397Sobrien# This is the list of variables to export in the environment when
202132718Skan# configuring subdirectories for the host system.
20350397SobrienBASE_TARGET_EXPORTS = \
20450397Sobrien	$(BASE_EXPORTS) \
20550397Sobrien	AR="$(AR_FOR_TARGET)"; export AR; \
206169689Skan	AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
207169689Skan	CC="$(CC_FOR_TARGET)"; export CC; \
208169689Skan	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
209169689Skan	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
210169689Skan	CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
211169689Skan	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
212169689Skan	GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
213169689Skan	GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
214169689Skan	DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
215169689Skan	LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
216169689Skan	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
217169689Skan	LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
218169689Skan	NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
219169689Skan	OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
220169689Skan	RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
221169689Skan	STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
222169689Skan	WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
223169689Skan	$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
224169689Skan
225169689SkanRAW_CXX_TARGET_EXPORTS = \
226169689Skan	$(BASE_TARGET_EXPORTS) \
227169689Skan	CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
228169689Skan	CXX="$(RAW_CXX_FOR_TARGET)"; export CXX;
229169689Skan
230169689SkanNORMAL_TARGET_EXPORTS = \
23190075Sobrien	$(BASE_TARGET_EXPORTS) \
23250397Sobrien	CXX="$(CXX_FOR_TARGET)"; export CXX;
233169689Skan
23450397Sobrien# Where to find GMP
23550397SobrienHOST_GMPLIBS = @gmplibs@
23652284SobrienHOST_GMPINC = @gmpinc@
237169689Skan
23850397Sobrien# ----------------------------------------------
23950397Sobrien# Programs producing files for the BUILD machine
24050397Sobrien# ----------------------------------------------
241117395Skan
242117395SkanSHELL = @config_shell@
243117395Skan
244117395Skan# pwd command to use.  Allow user to override default by setting PWDCMD in
245117395Skan# the environment to account for automounters.  The make variable must not
246117395Skan# be called PWDCMD, otherwise the value set here is passed to make
247117395Skan# subprocesses and overrides the setting from the user's environment.
248117395Skan# Don't use PWD since it is a common shell environment variable and we
249169689Skan# don't want to corrupt it.
250117395SkanPWD_COMMAND = $${PWDCMD-pwd}
251117395Skan
252117395Skan# compilers to use to create programs which must be run in the build
253117395Skan# environment.
25452284SobrienCC_FOR_BUILD = @CC_FOR_BUILD@
25550397SobrienCFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
256132718Skan
257169689SkanCXX_FOR_BUILD = $(CXX)
258132718Skan
25950397Sobrien# Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
26050397Sobrien# here so that they can be overridden by Makefile fragments.
26150397SobrienBUILD_PREFIX = @BUILD_PREFIX@
26290075SobrienBUILD_PREFIX_1 = @BUILD_PREFIX_1@
26390075Sobrien
26490075Sobrien# Flags to pass to stage2 and later makes.  They are defined
26590075Sobrien# here so that they can be overridden by Makefile fragments.
26690075SobrienBOOT_CFLAGS= -g -O2
267117395SkanBOOT_LDFLAGS=
268169689Skan
26990075SobrienBISON = @BISON@
27090075SobrienYACC = @YACC@
27190075SobrienFLEX = @FLEX@
272169689SkanLEX = @LEX@
273169689SkanM4 = @M4@
274169689SkanMAKEINFO = @MAKEINFO@
275169689SkanEXPECT = @EXPECT@
276169689SkanRUNTEST = @RUNTEST@
277169689Skan
278169689Skan# This just becomes part of the MAKEINFO definition passed down to
279169689Skan# sub-makes.  It lets flags be given on the command line while still
280169689Skan# using the makeinfo from the object tree.
281169689Skan# (Default to avoid splitting info files by setting the threshold high.)
282169689SkanMAKEINFOFLAGS = --split-size=5000000
283169689Skan
284169689Skan# ---------------------------------------------
285169689Skan# Programs producing files for the HOST machine
286169689Skan# ---------------------------------------------
287169689Skan
288169689SkanAS = @AS@
289169689SkanAR = @AR@
290169689SkanARFLAGS = @ARFLAGS@
291169689SkanCC = @CC@
292169689SkanCXX = @CXX@
293169689SkanDLLTOOL = @DLLTOOL@
294169689SkanLD = @LD@
295169689SkanLIPO = @LIPO@
296169689SkanNM = @NM@
297169689SkanOBJDUMP = @OBJDUMP@
298169689SkanRANLIB = @RANLIB@
299169689SkanSTRIP = @STRIP@
300169689SkanWINDRES = @WINDRES@
301169689Skan
302169689SkanGNATBIND = @GNATBIND@
303169689SkanGNATMAKE = @GNATMAKE@
304169689Skan
305169689SkanCFLAGS = @CFLAGS@
306169689SkanLDFLAGS = @LDFLAGS@
307169689SkanLIBCFLAGS = $(CFLAGS)
308169689SkanCXXFLAGS = @CXXFLAGS@
309169689SkanLIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
310169689SkanPICFLAG = 
311169689Skan
312169689Skan# Only build the C compiler for stage1, because that is the only one that
313169689Skan# we can guarantee will build with the native compiler, and also it is the
314169689Skan# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
315169689Skan# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
316169689Skan# overrideable (for a bootstrap build stage1 also builds gcc.info).
317169689Skan
318169689SkanSTAGE1_CFLAGS=@stage1_cflags@
319169689SkanSTAGE1_CHECKING=@stage1_checking@
320169689SkanSTAGE1_LANGUAGES=@stage1_languages@
321169689Skan
322169689Skan# -----------------------------------------------
323169689Skan# Programs producing files for the TARGET machine
324169689Skan# -----------------------------------------------
325169689Skan
326169689SkanFLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
327169689Skan
328169689SkanAR_FOR_TARGET=@AR_FOR_TARGET@
329169689SkanAS_FOR_TARGET=@AS_FOR_TARGET@
330169689SkanCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
331169689Skan
332169689Skan# If GCC_FOR_TARGET is not overriden on the command line, then this
333169689Skan# variable is passed down to the gcc Makefile, where it is used to
334169689Skan# build libgcc2.a.  We define it here so that it can itself be
335169689Skan# overridden on the command line.
336169689SkanGCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
33790075SobrienCXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
33890075SobrienRAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
33990075SobrienGCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
34090075SobrienGFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
341169689SkanDLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
34290075SobrienLD_FOR_TARGET=@LD_FOR_TARGET@
34390075Sobrien
34490075SobrienLIPO_FOR_TARGET=@LIPO_FOR_TARGET@
34590075SobrienNM_FOR_TARGET=@NM_FOR_TARGET@
34690075SobrienOBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
347169689SkanRANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
34890075SobrienSTRIP_FOR_TARGET=@STRIP_FOR_TARGET@
34990075SobrienWINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
350169689Skan
351169689SkanCOMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
35250397SobrienCOMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
35350397SobrienCOMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
354169689Skan
355169689Skan# During gcc bootstrap, if we use some random cc for stage1 then
356169689Skan# CFLAGS will be just -g.  We want to ensure that TARGET libraries
357132718Skan# (which we know are built with gcc) are built with optimizations so
358132718Skan# prepend -O2 when setting CFLAGS_FOR_TARGET.
359132718SkanCFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
360132718SkanSYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
36150397SobrienCXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
362132718SkanLIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
363132718SkanLIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
364132718SkanLDFLAGS_FOR_TARGET = 
365132718SkanPICFLAG_FOR_TARGET = 
366132718Skan
367132718Skan# ------------------------------------
368132718Skan# Miscellaneous targets and flag lists
369169689Skan# ------------------------------------
370132718Skan
371132718Skan# The first rule in the file had better be this one.  Don't put any above it.
372132718Skan# This lives here to allow makefile fragments to contain dependencies.
373132718Skanall:
374132718Skan
375132718Skan#### host and target specific makefile fragments come in here.
376132718Skan@target_makefile_frag@
377132718Skan@alphaieee_frag@
378169689Skan@ospace_frag@
379132718Skan@host_makefile_frag@
380132718Skan###
381132718Skan
382132718Skan# This is the list of directories that may be needed in RPATH_ENVVAR
383169689Skan# so that prorgams built for the target machine work.
384169689SkanTARGET_LIB_PATH = [+ FOR target_modules +][+
385132718Skan  IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
386117395Skan  ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
387117395Skan[+ FOR target_modules +][+ IF lib_path +]
38850397Sobrien@if target-[+module+]
38950397SobrienTARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
390169689Skan@endif target-[+module+]
39152284Sobrien[+ ENDIF lib_path +][+ ENDFOR target_modules +]
39252284Sobrien
39352284Sobrien
394169689Skan# This is the list of directories that may be needed in RPATH_ENVVAR
395169689Skan# so that programs built for the host machine work.
39650397SobrienHOST_LIB_PATH = [+ FOR host_modules +][+
39750397Sobrien  IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
39850397Sobrien  ENDFOR host_modules +]
399169689Skan
400169689Skan# Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
401169689Skan@if gcc
402169689SkanHOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
403169689Skan@endif gcc
404169689Skan
40550397Sobrien[+ FOR host_modules +][+ IF lib_path +]
40650397Sobrien@if [+module+]
407132718SkanHOST_LIB_PATH_[+module+] = \
408169689Skan  $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
409169689Skan  +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
41050397Sobrien@endif [+module+]
411169689Skan[+ ENDIF lib_path +][+ ENDFOR host_modules +]
412169689Skan
413169689Skan# Flags to pass down to all sub-makes.
41450397SobrienBASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
41550397Sobrien	"`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
41650397Sobrien	"[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +] \
41750397Sobrien	"CONFIG_SHELL=$(SHELL)" \
41850397Sobrien	"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" 
41950397Sobrien
42050397Sobrien# We leave this in just in case, but it is not needed anymore.
42150397SobrienRECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
42250397Sobrien
42350397Sobrien# Flags to pass down to most sub-makes, in which we're building with
42450397Sobrien# the host environment.
42550397SobrienEXTRA_HOST_FLAGS = \
426132718Skan	'AR=$(AR)' \
427132718Skan	'AS=$(AS)' \
428132718Skan	'CC=$(CC)' \
429132718Skan	'CXX=$(CXX)' \
430132718Skan	'DLLTOOL=$(DLLTOOL)' \
431132718Skan	'LD=$(LD)' \
432132718Skan	'LIPO=$(LIPO)' \
433132718Skan	'NM=$(NM)' \
434132718Skan	'OBJDUMP=$(OBJDUMP)' \
435132718Skan	'RANLIB=$(RANLIB)' \
436132718Skan	'STRIP=$(STRIP)' \
437132718Skan	'WINDRES=$(WINDRES)'
438132718Skan
439132718SkanFLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
440132718Skan
441132718Skan# Flags that are concerned with the location of the X11 include files
442132718Skan# and library files
443132718Skan#
444132718Skan# NOTE: until the top-level is getting the values via autoconf, it only
445132718Skan# causes problems to have this top-level Makefile overriding the autoconf-set
446132718Skan# values in child directories.  Only variables that don't conflict with
447132718Skan# autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
448132718Skan#
449132718SkanX11_FLAGS_TO_PASS = \
45050397Sobrien	'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
45150397Sobrien	'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
45250397Sobrien
45350397Sobrien# Flags to pass to stage2 and later makes.
45450397Sobrien
455132718SkanPOSTSTAGE1_FLAGS_TO_PASS = \
45652284Sobrien	CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
45750397Sobrien	GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind" \
458169689Skan	LDFLAGS="$(BOOT_LDFLAGS)" \
45950397Sobrien	"`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
460132718Skan
461132718Skan# Flags to pass down to makes which are built with the target environment.
462132718Skan# The double $ decreases the length of the command line; those variables
463132718Skan# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.  The
464132718Skan# COMPILER_ prefixed variables are not passed down so we expand them here.
465132718SkanEXTRA_TARGET_FLAGS = \
46650397Sobrien	'AR=$$(AR_FOR_TARGET)' \
46752284Sobrien	'AS=$(COMPILER_AS_FOR_TARGET)' \
46852284Sobrien	'CC=$$(CC_FOR_TARGET)' \
46952284Sobrien	'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
470132718Skan	'CXX=$$(CXX_FOR_TARGET)' \
471132718Skan	'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
472132718Skan	'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
47352284Sobrien	'LD=$(COMPILER_LD_FOR_TARGET)' \
474132718Skan	'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
475132718Skan	'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
476132718Skan	'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
477132718Skan	'NM=$(COMPILER_NM_FOR_TARGET)' \
478132718Skan	'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
479132718Skan	'RANLIB=$$(RANLIB_FOR_TARGET)' \
480132718Skan	'WINDRES=$$(WINDRES_FOR_TARGET)'
481169689Skan
482132718SkanTARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
483169689Skan
484169689Skan# Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
485169689Skan# unfortunately needs the native compiler and the target ar and
486169689Skan# ranlib.
48750397Sobrien# If any variables are added here, they must be added to do-*, below.
488132718Skan# The BUILD_* variables are a special case, which are used for the gcc
489132718Skan# cross-building scheme.
490132718SkanEXTRA_GCC_FLAGS = \
49152284Sobrien	"GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
492132718Skan	"`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
49350397Sobrien	"`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
49450397Sobrien	"`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
495169689Skan	"`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
49652284Sobrien	"`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
49750397Sobrien
49850397SobrienGCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
49950397Sobrien
50050397Sobrien.PHONY: configure-host
50150397Sobrienconfigure-host: [+
502132718Skan  FOR host_modules +] \
503132718Skan    maybe-configure-[+module+][+
50450397Sobrien  ENDFOR host_modules +]
50550397Sobrien.PHONY: configure-target
50650397Sobrienconfigure-target: [+
50750397Sobrien  FOR target_modules +] \
50850397Sobrien    maybe-configure-target-[+module+][+
50950397Sobrien  ENDFOR target_modules +]
51090075Sobrien
51150397Sobrien# The target built for a native non-bootstrap build.
51250397Sobrien.PHONY: all
51350397Sobrienall:
51490075Sobrien@if gcc-bootstrap
51590075Sobrien	[ -f stage_final ] || echo stage3 > stage_final
51690075Sobrien	@r=`${PWD_COMMAND}`; export r; \
51790075Sobrien	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
51890075Sobrien	$(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
51990075Sobrien@endif gcc-bootstrap
52090075Sobrien	@: $(MAKE); $(unstage)
52190075Sobrien	@r=`${PWD_COMMAND}`; export r; \
52290075Sobrien	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
52390075Sobrien	if [ -f stage_last ]; then \
52490075Sobrien	  $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
52590075Sobrien	else \
52690075Sobrien	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
52790075Sobrien	fi
528169689Skan
52990075Sobrien.PHONY: all-build
53090075Sobrien[+ FOR build_modules +]
53190075Sobrienall-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
53290075Sobrien
533117395Skan.PHONY: all-host
534169689Skan[+ FOR host_modules +][+ IF bootstrap +]
53590075Sobrien@if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
53690075Sobrienall-host: maybe-all-[+module+][+ IF bootstrap +]
53790075Sobrien@endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
538169689Skan
539169689Skan.PHONY: all-target
540169689Skan[+ FOR target_modules +][+ IF bootstrap +]
54190075Sobrien@if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
542169689Skanall-target: maybe-all-target-[+module+][+ IF bootstrap +]
54390075Sobrien@endif target-[+module+]-no-bootstrap[+
544169689Skan  ENDIF bootstrap +][+ ENDFOR target_modules +]
54590075Sobrien
54690075Sobrien# Do a target for all the subdirectories.  A ``make do-X'' will do a
54750397Sobrien# ``make X'' in all subdirectories (because, in general, there is a
54890075Sobrien# dependency (below) of X upon do-X, a ``make X'' will also do this,
54950397Sobrien# but it may do additional work as well).
55050397Sobrien[+ FOR recursive_targets +]
551169689Skan.PHONY: do-[+make_target+]
552169689Skando-[+make_target+]:
55350397Sobrien	@: $(MAKE); $(unstage)
55450397Sobrien	@r=`${PWD_COMMAND}`; export r; \
555169689Skan	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
556169689Skan	$(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
557169689Skan	  [+make_target+]-target
558169689Skan
55950397Sobrien
56050397Sobrien.PHONY: [+make_target+]-host
56150397Sobrien[+ FOR host_modules +]
56250397Sobrien[+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
56350397Sobrien
564132718Skan.PHONY: [+make_target+]-target
565132718Skan[+ FOR target_modules +]
566169689Skan[+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
567169689Skan[+ ENDFOR recursive_targets +]
568132718Skan
569132718Skan# Here are the targets which correspond to the do-X targets.
57050397Sobrien
57150397Sobrien.PHONY: info installcheck dvi pdf html
57252284Sobrien.PHONY: install-info install-pdf install-html
57352284Sobrien.PHONY: clean distclean mostlyclean maintainer-clean realclean
57452284Sobrien.PHONY: local-clean local-distclean local-maintainer-clean
57552284Sobrieninfo: do-info
57652284Sobrieninstallcheck: do-installcheck
57752284Sobriendvi: do-dvi
57890075Sobrienpdf: do-pdf
57950397Sobrienhtml: do-html
58050397Sobrien
58150397Sobrien# Make sure makeinfo is built before we do a `make info', if we're
582# in fact building texinfo.
583do-info: maybe-all-texinfo
584
585install-info: do-install-info dir.info
586	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
587	if [ -f dir.info ] ; then \
588	  $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
589	else true ; fi
590
591install-pdf: do-install-pdf
592
593install-html: do-install-html
594
595local-clean:
596	-rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
597
598local-distclean:
599	-rm -f Makefile config.status config.cache mh-frag mt-frag
600	-rm -f maybedep.tmp serdep.tmp
601	-if [ "$(TARGET_SUBDIR)" != "." ]; then \
602	  rm -rf $(TARGET_SUBDIR); \
603	else true; fi
604	-rm -rf $(BUILD_SUBDIR)
605	-if [ "$(HOST_SUBDIR)" != "." ]; then \
606	  rm -rf $(HOST_SUBDIR); \
607	else true; fi
608	-rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
609	-rm -f texinfo/doc/Makefile texinfo/po/POTFILES
610	-rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
611	-rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
612	-rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
613
614local-maintainer-clean:
615	@echo "This command is intended for maintainers to use;"
616	@echo "it deletes files that may require special tools to rebuild."
617
618clean: do-clean local-clean
619mostlyclean: do-mostlyclean local-clean
620distclean: do-distclean local-clean local-distclean
621maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
622maintainer-clean: local-distclean
623realclean: maintainer-clean
624
625# Check target.
626
627.PHONY: check do-check
628check: do-check
629
630# Only include modules actually being configured and built.
631.PHONY: check-host
632check-host: [+
633  FOR host_modules +] \
634    maybe-check-[+module+][+
635  ENDFOR host_modules +]
636
637.PHONY: check-target
638check-target: [+
639  FOR target_modules +] \
640    maybe-check-target-[+module+][+
641  ENDFOR target_modules +]
642
643do-check:
644	@: $(MAKE); $(unstage)
645	@r=`${PWD_COMMAND}`; export r; \
646	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
647	$(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
648
649# Automated reporting of test results.
650
651warning.log: build.log
652	$(srcdir)/contrib/warn_summary build.log > $@
653
654mail-report.log:
655	if test x'$(BOOT_CFLAGS)' != x''; then \
656	    BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
657	fi; \
658	$(srcdir)/contrib/test_summary -t >$@
659	chmod +x $@
660	echo If you really want to send e-mail, run ./$@ now
661
662mail-report-with-warnings.log: warning.log
663	if test x'$(BOOT_CFLAGS)' != x''; then \
664	    BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
665	fi; \
666	$(srcdir)/contrib/test_summary -t -i warning.log >$@
667	chmod +x $@
668	echo If you really want to send e-mail, run ./$@ now
669
670# Installation targets.
671
672.PHONY: install uninstall
673install:
674	@: $(MAKE); $(unstage)
675	@r=`${PWD_COMMAND}`; export r; \
676	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
677	$(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
678
679.PHONY: install-host-nogcc
680install-host-nogcc: [+
681  FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
682    maybe-install-[+module+][+ ENDIF +][+
683  ENDFOR host_modules +]
684
685.PHONY: install-host
686install-host: [+
687  FOR host_modules +] \
688    maybe-install-[+module+][+
689  ENDFOR host_modules +]
690
691.PHONY: install-target
692install-target: [+
693  FOR target_modules +] \
694    maybe-install-target-[+module+][+
695  ENDFOR target_modules +]
696
697uninstall:
698	@echo "the uninstall target is not supported in this tree"
699
700.PHONY: install.all
701install.all: install-no-fixedincludes
702	@if [ -f ./gcc/Makefile ] ; then \
703		r=`${PWD_COMMAND}` ; export r ; \
704		s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
705		$(HOST_EXPORTS) \
706		(cd ./gcc && \
707		$(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
708	else \
709		true ; \
710	fi
711
712# install-no-fixedincludes is used because Cygnus can not distribute
713# the fixed header files.
714.PHONY: install-no-fixedincludes
715install-no-fixedincludes: installdirs install-host-nogcc \
716	install-target gcc-no-fixedincludes
717
718### other supporting targets
719
720MAKEDIRS= \
721	$(DESTDIR)$(prefix) \
722	$(DESTDIR)$(exec_prefix)
723.PHONY: installdirs
724installdirs: mkinstalldirs
725	$(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
726
727dir.info: do-install-info
728	if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
729	  $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
730	  mv -f dir.info.new dir.info ; \
731	else true ; \
732	fi
733
734dist:
735	@echo "Building a full distribution of this tree isn't done"
736	@echo "via 'make dist'.  Check out the etc/ subdirectory" 
737
738etags tags: TAGS
739
740# Right now this just builds TAGS in each subdirectory.  emacs19 has the
741# ability to use several tags files at once, so there is probably no need
742# to combine them into one big TAGS file (like CVS 1.3 does).  We could
743# (if we felt like it) have this Makefile write a piece of elisp which
744# the user could load to tell emacs19 where all the TAGS files we just
745# built are.
746TAGS: do-TAGS
747
748# ------------------------------------
749# Macros for configure and all targets
750# ------------------------------------
751
752[+ DEFINE configure +]
753.PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
754maybe-configure-[+prefix+][+module+]:
755@if gcc-bootstrap
756configure-[+prefix+][+module+]: stage_current
757@endif gcc-bootstrap
758@if [+prefix+][+module+]
759maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
760configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
761	@: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
762	@r=`${PWD_COMMAND}`; export r; \
763	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
764	[+ IF check_multilibs
765	+]echo "Checking multilib configuration for [+module+]..."; \
766	$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
767	$(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
768	if test -r [+subdir+]/[+module+]/multilib.out; then \
769	  if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
770	    rm -f [+subdir+]/[+module+]/multilib.tmp; \
771	  else \
772	    rm -f [+subdir+]/[+module+]/Makefile; \
773	    mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
774	  fi; \
775	else \
776	  mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
777	fi; \
778	[+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
779	$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
780	[+exports+] \
781	echo Configuring in [+subdir+]/[+module+]; \
782	cd "[+subdir+]/[+module+]" || exit 1; \
783	case $(srcdir) in \
784	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
785	  *) topdir=`echo [+subdir+]/[+module+]/ | \
786		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
787	esac; \
788	srcdiroption="--srcdir=$${topdir}/[+module+]"; \
789	libsrcdir="$$s/[+module+]"; \
790	[+ IF no-config-site +]rm -f no-such-file || : ; \
791	CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
792	  [+args+] --build=${build_alias} --host=[+host_alias+] \
793	  --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
794	  || exit 1
795@endif [+prefix+][+module+]
796
797[+ IF bootstrap +]
798[+ FOR bootstrap_stage +]
799.PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
800maybe-configure-stage[+id+]-[+prefix+][+module+]:
801@if [+prefix+][+module+]-bootstrap
802maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
803configure-stage[+id+]-[+prefix+][+module+]:
804	@[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
805	@$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
806	@r=`${PWD_COMMAND}`; export r; \
807	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
808	[+ IF check_multilibs
809	+]echo "Checking multilib configuration for [+module+]..."; \
810	$(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
811	if test -r [+subdir+]/[+module+]/multilib.out; then \
812	  if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
813	    rm -f [+subdir+]/[+module+]/multilib.tmp; \
814	  else \
815	    rm -f [+subdir+]/[+module+]/Makefile; \
816	    mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
817	  fi; \
818	else \
819	  mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
820	fi; \
821	[+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
822	[+exports+][+ IF prev +] \
823	[+poststage1_exports+][+ ENDIF prev +] \
824	CFLAGS="[+stage_cflags+]"; export CFLAGS; \
825	LIBCFLAGS="[+stage_cflags+]"; export LIBCFLAGS; \
826	echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
827	$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
828	cd [+subdir+]/[+module+] || exit 1; \
829	case $(srcdir) in \
830	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
831	  *) topdir=`echo [+subdir+]/[+module+]/ | \
832		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
833	esac; \
834	srcdiroption="--srcdir=$${topdir}/[+module+]"; \
835	libsrcdir="$$s/[+module+]"; \
836	$(SHELL) $${libsrcdir}/configure \
837	  [+args+] --build=${build_alias} --host=[+host_alias+] \
838	  --target=[+target_alias+] $${srcdiroption} \
839	  [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
840	  [+stage_configure_flags+] [+extra_configure_flags+]
841@endif [+prefix+][+module+]-bootstrap
842[+ ENDFOR bootstrap_stage +]
843[+ ENDIF bootstrap +]
844[+ ENDDEF +]
845
846[+ DEFINE all +]
847.PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
848maybe-all-[+prefix+][+module+]:
849@if gcc-bootstrap
850all-[+prefix+][+module+]: stage_current
851@endif gcc-bootstrap
852@if [+prefix+][+module+]
853TARGET-[+prefix+][+module+]=[+
854  IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
855maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
856all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
857	@: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
858	@r=`${PWD_COMMAND}`; export r; \
859	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
860	[+exports+] \
861	(cd [+subdir+]/[+module+] && \
862	  $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
863@endif [+prefix+][+module+]
864
865[+ IF bootstrap +]
866[+ FOR bootstrap_stage +]
867.PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
868.PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
869maybe-all-stage[+id+]-[+prefix+][+module+]:
870maybe-clean-stage[+id+]-[+prefix+][+module+]:
871@if [+prefix+][+module+]-bootstrap
872maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
873all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
874TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
875all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
876	@[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
877	@r=`${PWD_COMMAND}`; export r; \
878	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
879	[+exports+][+ IF prev +] \
880	[+poststage1_exports+][+ ENDIF prev +] \
881	cd [+subdir+]/[+module+] && \
882	$(MAKE) [+args+] \
883		CFLAGS="[+stage_cflags+]" LIBCFLAGS="[+stage_cflags+]" [+
884		IF prev +][+poststage1_args+][+ ENDIF prev
885		+] [+extra_make_flags+] \
886		$(TARGET-stage[+id+]-[+prefix+][+module+])
887
888maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
889clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
890clean-stage[+id+]-[+prefix+][+module+]:
891	@if [ $(current_stage) = stage[+id+] ]; then \
892	  [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
893	else \
894	  [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
895	  $(MAKE) stage[+id+]-start; \
896	fi; \
897	cd [+subdir+]/[+module+] && \
898	$(MAKE) [+args+] [+ IF prev +] \
899		[+poststage1_args+] [+ ENDIF prev +] \
900		[+extra_make_flags+] clean
901@endif [+prefix+][+module+]-bootstrap
902
903[+ ENDFOR bootstrap_stage +]
904[+ ENDIF bootstrap +]
905[+ ENDDEF +]
906
907# --------------------------------------
908# Modules which run on the build machine
909# --------------------------------------
910[+ FOR build_modules +]
911[+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
912	     host_alias=(get "host" "${build_alias}")
913	     target_alias=(get "target" "${target_alias}")
914	     args="$(BUILD_CONFIGARGS)" no-config-site=true +]
915
916[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
917[+ ENDFOR build_module +]
918
919# --------------------------------------
920# Modules which run on the host machine
921# --------------------------------------
922[+ FOR host_modules +]
923[+ configure prefix="" subdir="$(HOST_SUBDIR)"
924	     exports="$(HOST_EXPORTS)"
925	     poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
926	     host_alias=(get "host" "${host_alias}")
927	     target_alias=(get "target" "${target_alias}")
928	     args="$(HOST_CONFIGARGS)" +]
929
930[+ all prefix="" subdir="$(HOST_SUBDIR)"
931       exports="$(HOST_EXPORTS)"
932       poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
933       args="$(FLAGS_TO_PASS)"
934       poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
935
936.PHONY: check-[+module+] maybe-check-[+module+]
937maybe-check-[+module+]:
938@if [+module+]
939maybe-check-[+module+]: check-[+module+]
940[+ IF no_check +]
941check-[+module+]:
942[+ ELIF no_check_cross +]
943# This module is only tested in a native toolchain.
944check-[+module+]:
945	@: $(MAKE); $(unstage)
946	@if [ '$(host)' = '$(target)' ] ; then \
947	  r=`${PWD_COMMAND}`; export r; \
948	  s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
949	  $(HOST_EXPORTS) \
950	  (cd $(HOST_SUBDIR)/[+module+] && \
951	    $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
952	fi
953[+ ELSE check +]
954check-[+module+]:
955	@: $(MAKE); $(unstage)
956	@r=`${PWD_COMMAND}`; export r; \
957	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
958	$(HOST_EXPORTS) \
959	(cd $(HOST_SUBDIR)/[+module+] && \
960	  $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
961[+ ENDIF no_check +]
962@endif [+module+]
963
964.PHONY: install-[+module+] maybe-install-[+module+]
965maybe-install-[+module+]:
966@if [+module+]
967maybe-install-[+module+]: install-[+module+]
968[+ IF no_install +]
969install-[+module+]:
970[+ ELSE install +]
971install-[+module+]: installdirs
972	@: $(MAKE); $(unstage)
973	@r=`${PWD_COMMAND}`; export r; \
974	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
975	$(HOST_EXPORTS) \
976	(cd $(HOST_SUBDIR)/[+module+] && \
977	  $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
978[+ ENDIF no_install +]
979@endif [+module+]
980
981# Other targets (info, dvi, pdf, etc.)
982[+ FOR recursive_targets +]
983.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
984maybe-[+make_target+]-[+module+]:
985@if [+module+]
986maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
987[+ IF (match-value? = "missing" (get "make_target") ) +]
988# [+module+] doesn't support [+make_target+].
989[+make_target+]-[+module+]:
990[+ ELSE +]
991[+make_target+]-[+module+]: [+
992  FOR depend +]\
993    [+depend+]-[+module+] [+
994  ENDFOR depend +]
995	@[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
996	@[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
997	r=`${PWD_COMMAND}`; export r; \
998	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
999	$(HOST_EXPORTS) \
1000	for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1001	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1002	done; \
1003	echo "Doing [+make_target+] in [+module+]" ; \
1004	(cd $(HOST_SUBDIR)/[+module+] && \
1005	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1006	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1007	          "RANLIB=$${RANLIB}" \
1008	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
1009	          [+make_target+]) \
1010	  || exit 1
1011[+ ENDIF +]
1012@endif [+module+]
1013[+ ENDFOR recursive_targets +]
1014[+ ENDFOR host_modules +]
1015
1016# ---------------------------------------
1017# Modules which run on the target machine
1018# ---------------------------------------
1019[+ FOR target_modules +]
1020
1021[+ IF raw_cxx +]
1022[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1023	     check_multilibs=true
1024	     exports="$(RAW_CXX_TARGET_EXPORTS)"
1025	     host_alias=(get "host" "${target_alias}")
1026	     target_alias=(get "target" "${target_alias}")
1027	     args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1028
1029[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1030       exports="$(RAW_CXX_TARGET_EXPORTS)"
1031       args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1032[+ ELSE +]
1033[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1034	     check_multilibs=true
1035	     exports="$(NORMAL_TARGET_EXPORTS)"
1036	     host_alias=(get "host" "${target_alias}")
1037	     target_alias=(get "target" "${target_alias}")
1038	     args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1039
1040[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1041       exports="$(NORMAL_TARGET_EXPORTS)"
1042       args="$(TARGET_FLAGS_TO_PASS)" +]
1043[+ ENDIF +]
1044
1045.PHONY: check-target-[+module+] maybe-check-target-[+module+]
1046maybe-check-target-[+module+]:
1047@if target-[+module+]
1048maybe-check-target-[+module+]: check-target-[+module+]
1049[+ IF no_check +]
1050# Dummy target for uncheckable module.
1051check-target-[+module+]:
1052[+ ELSE check +]
1053check-target-[+module+]:
1054	@: $(MAKE); $(unstage)
1055	@r=`${PWD_COMMAND}`; export r; \
1056	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1057IF raw_cxx +]
1058	$(RAW_CXX_TARGET_EXPORTS) \[+
1059ELSE normal_cxx +]
1060	$(NORMAL_TARGET_EXPORTS) \[+
1061ENDIF raw_cxx +]
1062	(cd $(TARGET_SUBDIR)/[+module+] && \
1063	  $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1064	    IF raw_cxx 
1065	      +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1066	    ENDIF raw_cxx 
1067	  +] [+extra_make_flags+] check)
1068[+ ENDIF no_check +]
1069@endif target-[+module+]
1070
1071.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1072maybe-install-target-[+module+]:
1073@if target-[+module+]
1074maybe-install-target-[+module+]: install-target-[+module+]
1075[+ IF no_install +]
1076# Dummy target for uninstallable.
1077install-target-[+module+]:
1078[+ ELSE install +]
1079install-target-[+module+]: installdirs
1080	@: $(MAKE); $(unstage)
1081	@r=`${PWD_COMMAND}`; export r; \
1082	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1083IF raw_cxx +]
1084	$(RAW_CXX_TARGET_EXPORTS) \[+
1085ELSE normal_cxx +]
1086	$(NORMAL_TARGET_EXPORTS) \[+
1087ENDIF raw_cxx +]
1088	(cd $(TARGET_SUBDIR)/[+module+] && \
1089	  $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1090[+ ENDIF no_install +]
1091@endif target-[+module+]
1092
1093# Other targets (info, dvi, pdf, etc.)
1094[+ FOR recursive_targets +]
1095.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1096maybe-[+make_target+]-target-[+module+]:
1097@if target-[+module+]
1098maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1099[+ IF (match-value? = "missing" (get "make_target") ) +]
1100# [+module+] doesn't support [+make_target+].
1101[+make_target+]-target-[+module+]:
1102[+ ELSE +]
1103[+make_target+]-target-[+module+]: [+
1104  FOR depend +]\
1105    [+depend+]-target-[+module+] [+
1106  ENDFOR depend +]
1107	@: $(MAKE); $(unstage)
1108	@[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1109	r=`${PWD_COMMAND}`; export r; \
1110	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1111IF raw_cxx +]
1112	$(RAW_CXX_TARGET_EXPORTS) \[+
1113ELSE normal_cxx +]
1114	$(NORMAL_TARGET_EXPORTS) \[+
1115ENDIF raw_cxx +]
1116	echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1117	for flag in $(EXTRA_TARGET_FLAGS); do \
1118	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1119	done; \
1120	(cd $(TARGET_SUBDIR)/[+module+] && \
1121	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1122	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1123	          "RANLIB=$${RANLIB}" \
1124	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
1125	          [+extra_make_flags+] [+make_target+]) \
1126	  || exit 1
1127[+ ENDIF +]
1128@endif target-[+module+]
1129[+ ENDFOR recursive_targets +]
1130[+ ENDFOR target_modules +]
1131
1132# ----------
1133# GCC module
1134# ----------
1135
1136@if gcc-no-bootstrap
1137.PHONY: cross
1138cross: all-build all-gas all-ld
1139	@r=`${PWD_COMMAND}`; export r; \
1140	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1141	$(HOST_EXPORTS) \
1142	echo "Building the C and C++ compiler"; \
1143	cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1144	@r=`${PWD_COMMAND}`; export r; \
1145	s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1146	echo "Building runtime libraries"; \
1147	$(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1148@endif gcc-no-bootstrap
1149
1150@if gcc
1151.PHONY: check-gcc-c++
1152check-gcc-c++:
1153	@if [ -f ./gcc/Makefile ] ; then \
1154	  r=`${PWD_COMMAND}`; export r; \
1155	  s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1156	  $(HOST_EXPORTS) \
1157	  (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
1158	else \
1159	  true; \
1160	fi
1161
1162.PHONY: check-c++
1163check-c++: check-target-libstdc++-v3 check-gcc-c++
1164
1165# Install the gcc headers files, but not the fixed include files,
1166# which Cygnus is not allowed to distribute.  This rule is very
1167# dependent on the workings of the gcc Makefile.in.
1168.PHONY: gcc-no-fixedincludes
1169gcc-no-fixedincludes:
1170	@if [ -f ./gcc/Makefile ]; then \
1171	  rm -rf gcc/tmp-include; \
1172	  mv gcc/include gcc/tmp-include 2>/dev/null; \
1173	  mkdir gcc/include; \
1174	  cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1175	  touch gcc/stmp-fixinc gcc/include/fixed; \
1176	  rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1177	  r=`${PWD_COMMAND}`; export r; \
1178	  s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1179	  $(HOST_EXPORTS) \
1180	  (cd ./gcc && \
1181	   $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1182	  rm -rf gcc/include; \
1183	  mv gcc/tmp-include gcc/include 2>/dev/null; \
1184	else true; fi
1185@endif gcc
1186
1187# ---------------------
1188# GCC bootstrap support
1189# ---------------------
1190
1191# We track the current stage (the one in 'gcc') in the stage_current file.
1192# stage_last instead tracks the stage that was built last.  These targets
1193# are dummy when toplevel bootstrap is not active.
1194
1195# While making host and target tools, symlinks to the final stage must be
1196# there, so $(unstage) should be run at various points.  To avoid excessive
1197# recursive invocations of make, we "inline" them using a variable.  These
1198# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1199# to avoid warnings from the GNU Make job server.
1200
1201unstage = :
1202stage = :
1203current_stage = ""
1204
1205@if gcc-bootstrap
1206unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1207stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1208current_stage = "`cat stage_current 2> /dev/null`"
1209@endif gcc-bootstrap
1210
1211.PHONY: unstage stage
1212unstage:
1213	@: $(MAKE); $(unstage)
1214stage:
1215	@: $(MAKE); $(stage)
1216
1217# Disable commands for lean bootstrap.
1218LEAN = false
1219
1220# We name the build directories for the various stages "stage1-gcc",
1221# "stage2-gcc","stage3-gcc", etc.
1222
1223# Since the 'compare' process will fail (on debugging information) if any
1224# directory names are different, we need to link the gcc directory for
1225# the previous stage to a constant name ('prev-gcc'), and to make the name of
1226# the build directories constant as well. For the latter, we use naked names
1227# like 'gcc', because the scripts in that directory assume it.  We use
1228# mv on platforms where symlinks to directories do not work or are not
1229# reliable.
1230
1231# 'touch' doesn't work right on some platforms.
1232STAMP = echo timestamp > 
1233
1234# We only want to compare .o files, so set this!
1235objext = .o
1236
1237[+ FOR bootstrap-stage +]
1238.PHONY: stage[+id+]-start stage[+id+]-end
1239
1240stage[+id+]-start::
1241	@: $(MAKE); $(stage); \
1242	echo stage[+id+] > stage_current ; \
1243	echo stage[+id+] > stage_last; \
1244	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1245   FOR host_modules +][+ IF bootstrap +]
1246@if [+ module +]
1247	@cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1248	  mkdir stage[+id+]-[+module+]; \
1249	mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1250	mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1251@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1252	@[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1253	  mkdir stage[+id+]-$(TARGET_SUBDIR); \
1254	mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1255	mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1256
1257stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1258@if [+ module +]
1259	@if test -d $(HOST_SUBDIR)/[+module+] ; then \
1260	  cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1261	  mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
1262	fi
1263@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1264	@if test -d $(TARGET_SUBDIR) ; then \
1265	  mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1266	  mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
1267	fi
1268	rm -f stage_current
1269
1270# Bubble a bug fix through all the stages up to stage [+id+].  They are
1271# remade, but not reconfigured.  The next stage (if any) will not be
1272# reconfigured as well.
1273.PHONY: stage[+id+]-bubble
1274stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1275	@r=`${PWD_COMMAND}`; export r; \
1276	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1277	if test -f stage[+id+]-lean [+
1278	  IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1279	  echo Skipping rebuild of stage[+id+] ; \
1280	else \
1281	  $(MAKE) stage[+id+]-start; \[+IF lean +]
1282	  if $(LEAN); then \
1283	    rm -rf stage[+lean+]-* ; \
1284	    $(STAMP) stage[+lean+]-lean ; \
1285	  fi; \[+ ENDIF lean +]
1286	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1287	fi[+ IF compare-target +]
1288	$(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1289
1290.PHONY: all-stage[+id+] clean-stage[+id+]
1291do-clean: clean-stage[+id+]
1292
1293# FIXME: Will not need to be conditional when toplevel bootstrap is the
1294# only possibility, but now it conflicts with no-bootstrap rules
1295@if gcc-bootstrap
1296[+ IF compare-target +]
1297[+compare-target+]:
1298	@r=`${PWD_COMMAND}`; export r; \
1299	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1300	if test -f stage[+prev+]-lean; then \
1301	  echo Cannot compare object files as stage [+prev+] was deleted. ; \
1302	  exit 0 ; \
1303	fi; \
1304	: $(MAKE); $(stage); \
1305	rm -f .bad_compare ; \
1306	echo Comparing stages [+prev+] and [+id+] ; \
1307	cd stage[+id+]-gcc; \
1308	files=`find . -name "*$(objext)" -print` ; \
1309	cd .. ; \
1310	for file in $${files} ; do \
1311	  f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
1312	  @do_compare@ > /dev/null 2>&1; \
1313	  if test $$? -eq 1; then \
1314	    case $$file in \
1315	      ./cc*-checksum$(objext) | ./libgcc/* ) \
1316	        echo warning: $$file differs ;; \
1317	      *) \
1318	        echo $$file differs >> .bad_compare ;; \
1319	    esac ; \
1320	  fi ; \
1321	done ; \
1322	if [ -f .bad_compare ]; then \
1323	  echo "Bootstrap comparison failure!"; \
1324	  cat .bad_compare; \
1325	  exit 1; \
1326	else \
1327	  echo Comparison successful.; \
1328	fi ; \
1329	$(STAMP) [+compare-target+][+ IF prev +]
1330	if $(LEAN); then \
1331	  rm -rf stage[+prev+]-*; \
1332	  $(STAMP) stage[+prev+]-lean; \
1333	fi[+ ENDIF prev +]
1334[+ ENDIF compare-target +]
1335
1336[+ IF bootstrap-target +]
1337.PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1338[+bootstrap-target+]:
1339	echo stage[+id+] > stage_final
1340	@r=`${PWD_COMMAND}`; export r; \
1341	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1342	$(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1343	@: $(MAKE); $(unstage)
1344	@r=`${PWD_COMMAND}`; export r; \
1345	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1346	$(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1347
1348[+bootstrap-target+]-lean:
1349	echo stage[+id+] > stage_final
1350	@r=`${PWD_COMMAND}`; export r; \
1351	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1352	$(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1353	@: $(MAKE); $(unstage)
1354	@r=`${PWD_COMMAND}`; export r; \
1355	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1356	$(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1357[+ ENDIF bootstrap-target +]
1358
1359# Rules to wipe a stage and all the following ones, also used for cleanstrap
1360[+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1361.PHONY: distclean-stage[+id+]
1362distclean-stage[+id+]::
1363	@: $(MAKE); $(stage)
1364	@test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1365	rm -rf stage[+id+]-* [+
1366	  IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1367
1368[+ IF cleanstrap-target +]
1369.PHONY: [+cleanstrap-target+]
1370[+cleanstrap-target+]: do-distclean local-clean
1371	echo stage[+id+] > stage_final
1372	@r=`${PWD_COMMAND}`; export r; \
1373	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1374	$(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1375	@: $(MAKE); $(unstage)
1376	@r=`${PWD_COMMAND}`; export r; \
1377	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1378	$(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1379[+ ENDIF cleanstrap-target +]
1380@endif gcc-bootstrap
1381
1382[+ ENDFOR bootstrap-stage +]
1383
1384stageprofile-end::
1385	$(MAKE) distclean-stagefeedback
1386
1387stagefeedback-start::
1388	@r=`${PWD_COMMAND}`; export r; \
1389	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1390	for i in prev-*; do \
1391	  j=`echo $$i | sed s/^prev-//` ; \
1392	  cd $$r/$$i && \
1393	  { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1394	  { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1395	done
1396
1397@if gcc-bootstrap
1398do-distclean: distclean-stage1
1399
1400# Provide a GCC build when we're building target libraries.  This does
1401# not work as a dependency, just as the minimum necessary to avoid errors.
1402stage_last:
1403	$(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1404
1405# Same as unstage, but not phony and defaulting to stage1-start.  We place
1406# it in the dependency so that for example `make -j3 all-gcc' works.
1407stage_current:
1408	@if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1409
1410.PHONY: restrap
1411restrap:
1412	@: $(MAKE); $(stage)
1413	rm -rf stage1-$(TARGET_SUBDIR) [+ FOR bootstrap-stage +][+ IF prev
1414	  +]stage[+id+]-* [+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1415	$(MAKE) $(RECURSE_FLAGS_TO_PASS) all
1416@endif gcc-bootstrap
1417
1418# --------------------------------------
1419# Dependencies between different modules
1420# --------------------------------------
1421
1422# Generic dependencies for target modules on host stuff, especially gcc
1423@if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1424  +][+ FOR bootstrap_stage +]
1425configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1426  ENDFOR +][+ ELSE bootstrap +]
1427configure-target-[+module+]: stage_last[+
1428  ENDIF bootstrap +][+ ENDFOR target_modules +]
1429@endif gcc-bootstrap
1430
1431@if gcc-no-bootstrap[+ FOR target_modules +]
1432configure-target-[+module+]: maybe-all-gcc[+
1433  ENDFOR target_modules +]
1434@endif gcc-no-bootstrap
1435
1436
1437# There are two types of dependencies here: 'hard' dependencies, where one
1438# module simply won't build without the other; and 'soft' dependencies, where
1439# if the depended-on module is missing, the depending module will do without
1440# or find a substitute somewhere (perhaps installed).  Soft dependencies
1441# are made here to depend on a 'maybe-' target.  If you're not sure,
1442# it's safer to use a soft dependency.
1443
1444[+ ;; These Scheme functions build the bulk of the dependencies.
1445   ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1446   ;; where "maybe-" is only included if HARD is true, and all-gcc
1447   ;; is taken from VAR-NAME.
1448   (define dep-target (lambda (module-kind var-name hard)
1449      (string-append
1450         (if hard "" "maybe-")
1451         (dep-subtarget var-name)
1452         module-kind
1453         (dep-module var-name)
1454      )))
1455
1456   ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1457   (define make-dep (lambda (module-kind on-kind)
1458      (string-append
1459         (dep-target module-kind "module" #t) ": "
1460         (dep-target on-kind "on" (exist? "hard")))))
1461
1462   ;; dep-subtarget extracts everything up to the first dash in the given
1463   ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1464   (define dep-subtarget (lambda (var-name)
1465      (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1466
1467   ;; dep-module extracts everything up to the first dash in the given
1468   ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1469   (define dep-module (lambda (var-name)
1470      (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1471
1472   ;; dep-stage builds a string for the prefix of a bootstrap stage.
1473   (define dep-stage (lambda ()
1474      (string-append
1475	 "stage"
1476	 (get "id")
1477	 "-")))
1478
1479   ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1480   ;; but is written in Scheme.
1481   (define dep-maybe (lambda ()
1482      (if (exist? "hard") "" "maybe-")))
1483
1484   ;; dep-kind returns "normal" if the dependency is on an "install" target,
1485   ;; or if either module is not bootstrapped.  It returns "bootstrap" for
1486   ;; configure or build dependencies between bootstrapped modules; it returns
1487   ;; "prebootstrap" for configure or build dependencies of bootstrapped
1488   ;; modules on a build module (e.g. all-gcc on all-build-bison).  All this
1489   ;; is only necessary for host modules.
1490   (define dep-kind (lambda ()
1491      (if (and (hash-ref boot-modules (dep-module "module"))
1492	       (=* (dep-module "on") "build-"))
1493	  "prebootstrap"
1494
1495	  (if (or (= (dep-subtarget "on") "install-")
1496		  (not (hash-ref boot-modules (dep-module "module")))
1497		  (not (hash-ref boot-modules (dep-module "on"))))
1498              "normal"
1499	      "bootstrap"))))
1500
1501   ;; We now build the hash table that is used by dep-kind.
1502   (define boot-modules (make-hash-table 113))
1503+]
1504
1505[+ FOR host_modules +][+
1506   (if (exist? "bootstrap")
1507       (hash-create-handle! boot-modules (get "module") #t))
1508   "" +][+ ENDFOR host_modules +]
1509[+ FOR target_modules +][+
1510   (if (exist? "bootstrap")
1511       (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1512   "" +][+ ENDFOR target_modules +]
1513
1514# With all the machinery above in place, it is pretty easy to generate
1515# dependencies.  Host dependencies are a bit more complex because we have
1516# to check for bootstrap/prebootstrap dependencies.  To resolve
1517# prebootstrap dependencies, prebootstrap modules are gathered in
1518# a hash table.
1519[+ FOR dependencies +][+ (make-dep "" "") +]
1520[+ CASE (dep-kind) +]
1521[+ == "prebootstrap"
1522     +][+ FOR bootstrap_stage +]
1523[+ (make-dep (dep-stage) "") +][+
1524       ENDFOR bootstrap_stage +]
1525[+ == "bootstrap"
1526     +][+ FOR bootstrap_stage +]
1527[+ (make-dep (dep-stage) (dep-stage)) +][+
1528       ENDFOR bootstrap_stage +]
1529[+ ESAC +][+
1530ENDFOR dependencies +]
1531
1532# Dependencies for target modules on other target modules are
1533# described by lang_env_dependencies; the defaults apply to anything
1534# not mentioned there.
1535[+
1536   ;; Predicate for whether LANG was specified in lang_env_dependencies.
1537   (define lang-dep (lambda (lang)
1538      (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1539
1540   ;; Build the hash table we will need.
1541   (define lang-env-deps (make-hash-table 7))
1542+][+ FOR lang_env_dependencies +][+
1543   (if (exist? "cxx")
1544       (hash-create-handle! lang-env-deps
1545	  (string-append (get "module") "-" "cxx") #t))
1546
1547   (if (exist? "no_c")
1548       (hash-create-handle! lang-env-deps
1549	  (string-append (get "module") "-" "no_c") #t))
1550
1551   (if (exist? "no_gcc")
1552       (hash-create-handle! lang-env-deps
1553	  (string-append (get "module") "-" "no_gcc") #t))
1554   "" +][+ ENDFOR lang_env_dependencies +]
1555
1556@if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1557  +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1558configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1559  ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1560@endif gcc-bootstrap
1561
1562@if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1563configure-target-[+module+]: maybe-all-target-libgcc[+
1564  ENDIF +][+ ENDFOR target_modules +]
1565@endif gcc-no-bootstrap
1566
1567[+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1568configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1569  ENDIF +][+ IF (lang-dep "cxx") +]
1570configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1571  ENDIF +]
1572[+ ENDFOR target_modules +]
1573
1574CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
1575GDB_TK = @GDB_TK@
1576INSTALL_GDB_TK = @INSTALL_GDB_TK@
1577configure-gdb: $(CONFIGURE_GDB_TK)
1578all-gdb: $(gdbnlmrequirements) $(GDB_TK)
1579install-gdb: $(INSTALL_GDB_TK)
1580
1581# Serialization dependencies.  Host configures don't work well in parallel to
1582# each other, due to contention over config.cache.  Target configures and 
1583# build configures are similar.
1584@serialization_dependencies@
1585
1586# --------------------------------
1587# Regenerating top level configury
1588# --------------------------------
1589
1590# Rebuilding Makefile.in, using autogen.
1591AUTOGEN = autogen
1592$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1593	cd $(srcdir) && $(AUTOGEN) Makefile.def
1594
1595# Rebuilding Makefile.
1596Makefile: $(srcdir)/Makefile.in config.status
1597	CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1598
1599config.status: configure
1600	CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
1601
1602# Rebuilding configure.
1603AUTOCONF = autoconf
1604$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4
1605	cd $(srcdir) && $(AUTOCONF)
1606
1607# ------------------------------
1608# Special directives to GNU Make
1609# ------------------------------
1610
1611# Don't pass command-line variables to submakes.
1612.NOEXPORT:
1613MAKEOVERRIDES=
1614
1615# end of Makefile.in
1616