1130561Sobrien[+ AutoGen5 template -*- Mode: Makefile -*-
2130561Sobrienin
3130561Sobrien+]
4130561Sobrien
5130561Sobrien# Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
6130561Sobrien#
7130561Sobrien# Makefile for directory with subdirs to build.
8130561Sobrien#   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
9218822Sdim#   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
10130561Sobrien#
11130561Sobrien# This file is free software; you can redistribute it and/or modify
12130561Sobrien# it under the terms of the GNU General Public License as published by
13130561Sobrien# the Free Software Foundation; either version 2 of the License, or
14130561Sobrien# (at your option) any later version.
15130561Sobrien# 
16130561Sobrien# This program is distributed in the hope that it will be useful,
17130561Sobrien# but WITHOUT ANY WARRANTY; without even the implied warranty of
18130561Sobrien# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19130561Sobrien# GNU General Public License for more details.
20130561Sobrien# 
21130561Sobrien# You should have received a copy of the GNU General Public License
22130561Sobrien# along with this program; if not, write to the Free Software
23218822Sdim# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24130561Sobrien#
25130561Sobrien
26130561Sobrien# -------------------------------
27130561Sobrien# Standard Autoconf-set variables
28130561Sobrien# -------------------------------
29130561SobrienVPATH=@srcdir@
30130561Sobrien
31218822Sdimbuild_alias=@build_noncanonical@
32218822Sdimbuild_vendor=@build_vendor@
33218822Sdimbuild_os=@build_os@
34130561Sobrienbuild=@build@
35218822Sdimhost_alias=@host_noncanonical@
36218822Sdimhost_vendor=@host_vendor@
37218822Sdimhost_os=@host_os@
38130561Sobrienhost=@host@
39218822Sdimtarget_alias=@target_noncanonical@
40218822Sdimtarget_vendor=@target_vendor@
41218822Sdimtarget_os=@target_os@
42130561Sobrientarget=@target@
43130561Sobrien
44130561Sobrienprogram_transform_name = @program_transform_name@
45130561Sobrien
46130561Sobrienprefix = @prefix@
47130561Sobrienexec_prefix = @exec_prefix@
48130561Sobrien
49130561Sobriensrcdir = @srcdir@
50130561Sobrien
51130561Sobrienbindir = @bindir@
52130561Sobriensbindir = @sbindir@
53130561Sobrienlibexecdir = @libexecdir@
54130561Sobriendatadir = @datadir@
55130561Sobriensysconfdir = @sysconfdir@
56130561Sobriensharedstatedir = @sharedstatedir@
57130561Sobrienlocalstatedir = @localstatedir@
58130561Sobrienlibdir = @libdir@
59130561Sobrienincludedir = @includedir@
60130561Sobrienoldincludedir = @oldincludedir@
61130561Sobrieninfodir = @infodir@
62218822Sdimdatarootdir = @datarootdir@
63218822Sdimdocdir = @docdir@
64218822Sdimpdfdir = @pdfdir@
65218822Sdimhtmldir = @htmldir@
66130561Sobrienmandir = @mandir@
67130561Sobrienman1dir = $(mandir)/man1
68130561Sobrienman2dir = $(mandir)/man2
69130561Sobrienman3dir = $(mandir)/man3
70130561Sobrienman4dir = $(mandir)/man4
71130561Sobrienman5dir = $(mandir)/man5
72130561Sobrienman6dir = $(mandir)/man6
73130561Sobrienman7dir = $(mandir)/man7
74130561Sobrienman8dir = $(mandir)/man8
75130561Sobrienman9dir = $(mandir)/man9
76130561Sobrien
77130561SobrienINSTALL = @INSTALL@
78130561SobrienINSTALL_PROGRAM = @INSTALL_PROGRAM@
79130561SobrienINSTALL_SCRIPT = @INSTALL_SCRIPT@
80130561SobrienINSTALL_DATA = @INSTALL_DATA@
81218822SdimLN = @LN@
82218822SdimLN_S = @LN_S@
83218822SdimMAINT = @MAINT@
84218822SdimMAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
85218822SdimMAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
86130561Sobrien
87130561Sobrien# -------------------------------------------------
88130561Sobrien# Miscellaneous non-standard autoconf-set variables
89130561Sobrien# -------------------------------------------------
90130561Sobrien
91130561Sobrien# The gcc driver likes to know the arguments it was configured with.
92130561SobrienTOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
93130561Sobrien
94130561Sobrientooldir = @tooldir@
95130561Sobrienbuild_tooldir = @build_tooldir@
96130561Sobrien
97130561SobrienGDB_NLM_DEPS = 
98130561Sobrien
99130561Sobrien# This is the name of the environment variable used for the path to
100130561Sobrien# the libraries.
101130561SobrienRPATH_ENVVAR = @RPATH_ENVVAR@
102130561Sobrien
103130561Sobrien# Build programs are put under this directory.
104130561SobrienBUILD_SUBDIR = @build_subdir@
105130561Sobrien# This is set by the configure script to the arguments to use when configuring
106130561Sobrien# directories built for the build system.
107218822SdimBUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
108130561Sobrien
109218822Sdim# This is the list of variables to export in the environment when
110218822Sdim# configuring any subdirectory.  It must also be exported whenever
111218822Sdim# recursing into a build directory in case that directory's Makefile
112218822Sdim# re-runs configure.
113218822SdimBASE_EXPORTS = \
114218822Sdim	FLEX="$(FLEX)"; export FLEX; \
115218822Sdim	LEX="$(LEX)"; export LEX; \
116218822Sdim	BISON="$(BISON)"; export BISON; \
117218822Sdim	YACC="$(YACC)"; export YACC; \
118218822Sdim	M4="$(M4)"; export M4; \
119218822Sdim	MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
120218822Sdim
121218822Sdim# This is the list of variables to export in the environment when
122218822Sdim# configuring subdirectories for the build system.
123218822SdimBUILD_EXPORTS = \
124218822Sdim	$(BASE_EXPORTS) \
125218822Sdim	AR="$(AR_FOR_BUILD)"; export AR; \
126218822Sdim	AS="$(AS_FOR_BUILD)"; export AS; \
127218822Sdim	CC="$(CC_FOR_BUILD)"; export CC; \
128218822Sdim	CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
129218822Sdim	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
130218822Sdim	CXX="$(CXX_FOR_BUILD)"; export CXX; \
131218822Sdim	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
132218822Sdim	GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
133218822Sdim	GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
134218822Sdim	DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
135218822Sdim	LD="$(LD_FOR_BUILD)"; export LD; \
136218822Sdim	LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
137218822Sdim	NM="$(NM_FOR_BUILD)"; export NM; \
138218822Sdim	RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
139218822Sdim	WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES;
140218822Sdim
141130561Sobrien# This is the list of directories to built for the host system.
142130561SobrienSUBDIRS = @configdirs@
143130561Sobrien# This is set by the configure script to the arguments to use when configuring
144130561Sobrien# directories built for the host system.
145130561SobrienHOST_CONFIGARGS = @host_configargs@
146218822Sdim# Host programs are put under this directory, which is . except if building
147218822Sdim# with srcdir=..
148218822SdimHOST_SUBDIR = @host_subdir@
149218822Sdim# This is the list of variables to export in the environment when
150218822Sdim# configuring subdirectories for the host system.  We need to pass
151218822Sdim# some to the GCC configure because of its hybrid host/target nature.
152218822SdimHOST_EXPORTS = \
153218822Sdim	$(BASE_EXPORTS) \
154218822Sdim	CC="$(CC)"; export CC; \
155218822Sdim	CFLAGS="$(CFLAGS)"; export CFLAGS; \
156218822Sdim	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
157218822Sdim	CXX="$(CXX)"; export CXX; \
158218822Sdim	CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
159218822Sdim	AR="$(AR)"; export AR; \
160218822Sdim	AS="$(AS)"; export AS; \
161218822Sdim	CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
162218822Sdim	DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
163218822Sdim	LD="$(LD)"; export LD; \
164218822Sdim	LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
165218822Sdim	NM="$(NM)"; export NM; \
166218822Sdim	RANLIB="$(RANLIB)"; export RANLIB; \
167218822Sdim	WINDRES="$(WINDRES)"; export WINDRES; \
168218822Sdim	OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
169218822Sdim	OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
170218822Sdim	AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
171218822Sdim	AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
172218822Sdim	GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
173218822Sdim	LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
174218822Sdim	NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
175218822Sdim	OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
176218822Sdim	RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
177218822Sdim	TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
178218822Sdim	GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
179218822Sdim	GMPINC="$(HOST_GMPINC)"; export GMPINC; \
180218822Sdim@if gcc-bootstrap
181218822Sdim	$(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
182218822Sdim@endif gcc-bootstrap
183218822Sdim	$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
184130561Sobrien
185218822Sdim# Similar, for later GCC stages.
186218822SdimPOSTSTAGE1_HOST_EXPORTS = \
187218822Sdim	$(HOST_EXPORTS) \
188218822Sdim	CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
189218822Sdim	  -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
190218822Sdim	CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \
191218822Sdim	  $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
192218822Sdim	  -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
193218822Sdim	  -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
194218822Sdim	LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
195218822Sdim
196130561Sobrien# Target libraries are put under this directory:
197130561SobrienTARGET_SUBDIR = @target_subdir@
198130561Sobrien# This is set by the configure script to the arguments to use when configuring
199130561Sobrien# directories built for the target.
200218822SdimTARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
201218822Sdim# This is the list of variables to export in the environment when
202218822Sdim# configuring subdirectories for the host system.
203218822SdimBASE_TARGET_EXPORTS = \
204218822Sdim	$(BASE_EXPORTS) \
205218822Sdim	AR="$(AR_FOR_TARGET)"; export AR; \
206218822Sdim	AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
207218822Sdim	CC="$(CC_FOR_TARGET)"; export CC; \
208218822Sdim	CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
209218822Sdim	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
210218822Sdim	CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
211218822Sdim	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
212218822Sdim	GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
213218822Sdim	GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
214218822Sdim	DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
215218822Sdim	LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
216218822Sdim	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
217218822Sdim	LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
218218822Sdim	NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
219218822Sdim	OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
220218822Sdim	RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
221218822Sdim	STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
222218822Sdim	WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
223218822Sdim	$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
224130561Sobrien
225218822SdimRAW_CXX_TARGET_EXPORTS = \
226218822Sdim	$(BASE_TARGET_EXPORTS) \
227218822Sdim	CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
228218822Sdim	CXX="$(RAW_CXX_FOR_TARGET)"; export CXX;
229218822Sdim
230218822SdimNORMAL_TARGET_EXPORTS = \
231218822Sdim	$(BASE_TARGET_EXPORTS) \
232218822Sdim	CXX="$(CXX_FOR_TARGET)"; export CXX;
233218822Sdim
234218822Sdim# Where to find GMP
235218822SdimHOST_GMPLIBS = @gmplibs@
236218822SdimHOST_GMPINC = @gmpinc@
237218822Sdim
238130561Sobrien# ----------------------------------------------
239130561Sobrien# Programs producing files for the BUILD machine
240130561Sobrien# ----------------------------------------------
241130561Sobrien
242130561SobrienSHELL = @config_shell@
243130561Sobrien
244130561Sobrien# pwd command to use.  Allow user to override default by setting PWDCMD in
245130561Sobrien# the environment to account for automounters.  The make variable must not
246130561Sobrien# be called PWDCMD, otherwise the value set here is passed to make
247130561Sobrien# subprocesses and overrides the setting from the user's environment.
248130561Sobrien# Don't use PWD since it is a common shell environment variable and we
249130561Sobrien# don't want to corrupt it.
250130561SobrienPWD_COMMAND = $${PWDCMD-pwd}
251130561Sobrien
252130561Sobrien# compilers to use to create programs which must be run in the build
253130561Sobrien# environment.
254130561SobrienCC_FOR_BUILD = @CC_FOR_BUILD@
255130561SobrienCFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
256130561Sobrien
257130561SobrienCXX_FOR_BUILD = $(CXX)
258130561Sobrien
259130561Sobrien# Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
260130561Sobrien# here so that they can be overridden by Makefile fragments.
261130561SobrienBUILD_PREFIX = @BUILD_PREFIX@
262130561SobrienBUILD_PREFIX_1 = @BUILD_PREFIX_1@
263130561Sobrien
264218822Sdim# Flags to pass to stage2 and later makes.  They are defined
265218822Sdim# here so that they can be overridden by Makefile fragments.
266218822SdimBOOT_CFLAGS= -g -O2
267218822SdimBOOT_LDFLAGS=
268130561Sobrien
269218822SdimBISON = @BISON@
270218822SdimYACC = @YACC@
271218822SdimFLEX = @FLEX@
272218822SdimLEX = @LEX@
273218822SdimM4 = @M4@
274218822SdimMAKEINFO = @MAKEINFO@
275218822SdimEXPECT = @EXPECT@
276218822SdimRUNTEST = @RUNTEST@
277130561Sobrien
278130561Sobrien# This just becomes part of the MAKEINFO definition passed down to
279130561Sobrien# sub-makes.  It lets flags be given on the command line while still
280130561Sobrien# using the makeinfo from the object tree.
281130561Sobrien# (Default to avoid splitting info files by setting the threshold high.)
282130561SobrienMAKEINFOFLAGS = --split-size=5000000
283130561Sobrien
284130561Sobrien# ---------------------------------------------
285130561Sobrien# Programs producing files for the HOST machine
286130561Sobrien# ---------------------------------------------
287130561Sobrien
288130561SobrienAS = @AS@
289130561SobrienAR = @AR@
290243933SeadlerARFLAGS = @ARFLAGS@
291130561SobrienCC = @CC@
292130561SobrienCXX = @CXX@
293130561SobrienDLLTOOL = @DLLTOOL@
294218822SdimLD = @LD@
295218822SdimLIPO = @LIPO@
296130561SobrienNM = @NM@
297218822SdimOBJDUMP = @OBJDUMP@
298130561SobrienRANLIB = @RANLIB@
299218822SdimSTRIP = @STRIP@
300130561SobrienWINDRES = @WINDRES@
301130561Sobrien
302218822SdimGNATBIND = @GNATBIND@
303218822SdimGNATMAKE = @GNATMAKE@
304218822Sdim
305218822SdimCFLAGS = @CFLAGS@
306218822SdimLDFLAGS = @LDFLAGS@
307218822SdimLIBCFLAGS = $(CFLAGS)
308218822SdimCXXFLAGS = @CXXFLAGS@
309218822SdimLIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
310130561SobrienPICFLAG = 
311130561Sobrien
312218822Sdim# Only build the C compiler for stage1, because that is the only one that
313218822Sdim# we can guarantee will build with the native compiler, and also it is the
314218822Sdim# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
315218822Sdim# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
316218822Sdim# overrideable (for a bootstrap build stage1 also builds gcc.info).
317218822Sdim
318218822SdimSTAGE1_CFLAGS=@stage1_cflags@
319218822SdimSTAGE1_CHECKING=@stage1_checking@
320218822SdimSTAGE1_LANGUAGES=@stage1_languages@
321218822Sdim
322130561Sobrien# -----------------------------------------------
323130561Sobrien# Programs producing files for the TARGET machine
324130561Sobrien# -----------------------------------------------
325130561Sobrien
326130561SobrienFLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
327130561Sobrien
328130561SobrienAR_FOR_TARGET=@AR_FOR_TARGET@
329130561SobrienAS_FOR_TARGET=@AS_FOR_TARGET@
330218822SdimCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
331130561Sobrien
332130561Sobrien# If GCC_FOR_TARGET is not overriden on the command line, then this
333130561Sobrien# variable is passed down to the gcc Makefile, where it is used to
334130561Sobrien# build libgcc2.a.  We define it here so that it can itself be
335130561Sobrien# overridden on the command line.
336218822SdimGCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
337218822SdimCXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
338218822SdimRAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
339218822SdimGCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
340218822SdimGFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
341130561SobrienDLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
342130561SobrienLD_FOR_TARGET=@LD_FOR_TARGET@
343130561Sobrien
344218822SdimLIPO_FOR_TARGET=@LIPO_FOR_TARGET@
345130561SobrienNM_FOR_TARGET=@NM_FOR_TARGET@
346218822SdimOBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
347130561SobrienRANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
348218822SdimSTRIP_FOR_TARGET=@STRIP_FOR_TARGET@
349130561SobrienWINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
350130561Sobrien
351218822SdimCOMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
352218822SdimCOMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
353218822SdimCOMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
354218822Sdim
355218822Sdim# During gcc bootstrap, if we use some random cc for stage1 then
356218822Sdim# CFLAGS will be just -g.  We want to ensure that TARGET libraries
357218822Sdim# (which we know are built with gcc) are built with optimizations so
358218822Sdim# prepend -O2 when setting CFLAGS_FOR_TARGET.
359218822SdimCFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
360218822SdimSYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
361218822SdimCXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
362218822SdimLIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
363218822SdimLIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
364218822SdimLDFLAGS_FOR_TARGET = 
365130561SobrienPICFLAG_FOR_TARGET = 
366130561Sobrien
367130561Sobrien# ------------------------------------
368130561Sobrien# Miscellaneous targets and flag lists
369130561Sobrien# ------------------------------------
370130561Sobrien
371130561Sobrien# The first rule in the file had better be this one.  Don't put any above it.
372130561Sobrien# This lives here to allow makefile fragments to contain dependencies.
373218822Sdimall:
374130561Sobrien
375130561Sobrien#### host and target specific makefile fragments come in here.
376130561Sobrien@target_makefile_frag@
377130561Sobrien@alphaieee_frag@
378130561Sobrien@ospace_frag@
379130561Sobrien@host_makefile_frag@
380130561Sobrien###
381130561Sobrien
382218822Sdim# This is the list of directories that may be needed in RPATH_ENVVAR
383218822Sdim# so that prorgams built for the target machine work.
384218822SdimTARGET_LIB_PATH = [+ FOR target_modules +][+
385218822Sdim  IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
386218822Sdim  ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
387218822Sdim[+ FOR target_modules +][+ IF lib_path +]
388218822Sdim@if target-[+module+]
389218822SdimTARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
390218822Sdim@endif target-[+module+]
391218822Sdim[+ ENDIF lib_path +][+ ENDFOR target_modules +]
392218822Sdim
393218822Sdim
394218822Sdim# This is the list of directories that may be needed in RPATH_ENVVAR
395218822Sdim# so that programs built for the host machine work.
396218822SdimHOST_LIB_PATH = [+ FOR host_modules +][+
397218822Sdim  IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
398218822Sdim  ENDFOR host_modules +]
399218822Sdim
400218822Sdim# Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
401218822Sdim@if gcc
402218822SdimHOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
403218822Sdim@endif gcc
404218822Sdim
405218822Sdim[+ FOR host_modules +][+ IF lib_path +]
406218822Sdim@if [+module+]
407218822SdimHOST_LIB_PATH_[+module+] = \
408218822Sdim  $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
409218822Sdim  +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
410218822Sdim@endif [+module+]
411218822Sdim[+ ENDIF lib_path +][+ ENDFOR host_modules +]
412218822Sdim
413130561Sobrien# Flags to pass down to all sub-makes.
414218822SdimBASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
415218822Sdim	"`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
416218822Sdim	"[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +] \
417130561Sobrien	"CONFIG_SHELL=$(SHELL)" \
418130561Sobrien	"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" 
419130561Sobrien
420218822Sdim# We leave this in just in case, but it is not needed anymore.
421218822SdimRECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
422130561Sobrien
423130561Sobrien# Flags to pass down to most sub-makes, in which we're building with
424130561Sobrien# the host environment.
425130561SobrienEXTRA_HOST_FLAGS = \
426130561Sobrien	'AR=$(AR)' \
427130561Sobrien	'AS=$(AS)' \
428130561Sobrien	'CC=$(CC)' \
429130561Sobrien	'CXX=$(CXX)' \
430130561Sobrien	'DLLTOOL=$(DLLTOOL)' \
431130561Sobrien	'LD=$(LD)' \
432218822Sdim	'LIPO=$(LIPO)' \
433130561Sobrien	'NM=$(NM)' \
434218822Sdim	'OBJDUMP=$(OBJDUMP)' \
435130561Sobrien	'RANLIB=$(RANLIB)' \
436218822Sdim	'STRIP=$(STRIP)' \
437130561Sobrien	'WINDRES=$(WINDRES)'
438130561Sobrien
439130561SobrienFLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
440130561Sobrien
441130561Sobrien# Flags that are concerned with the location of the X11 include files
442130561Sobrien# and library files
443130561Sobrien#
444130561Sobrien# NOTE: until the top-level is getting the values via autoconf, it only
445130561Sobrien# causes problems to have this top-level Makefile overriding the autoconf-set
446130561Sobrien# values in child directories.  Only variables that don't conflict with
447130561Sobrien# autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
448130561Sobrien#
449130561SobrienX11_FLAGS_TO_PASS = \
450130561Sobrien	'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
451130561Sobrien	'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
452130561Sobrien
453218822Sdim# Flags to pass to stage2 and later makes.
454218822Sdim
455218822SdimPOSTSTAGE1_FLAGS_TO_PASS = \
456218822Sdim	CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
457218822Sdim	GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind" \
458218822Sdim	LDFLAGS="$(BOOT_LDFLAGS)" \
459218822Sdim	"`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
460218822Sdim
461130561Sobrien# Flags to pass down to makes which are built with the target environment.
462218822Sdim# The double $ decreases the length of the command line; those variables
463218822Sdim# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.  The
464218822Sdim# COMPILER_ prefixed variables are not passed down so we expand them here.
465130561SobrienEXTRA_TARGET_FLAGS = \
466130561Sobrien	'AR=$$(AR_FOR_TARGET)' \
467218822Sdim	'AS=$(COMPILER_AS_FOR_TARGET)' \
468130561Sobrien	'CC=$$(CC_FOR_TARGET)' \
469130561Sobrien	'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
470130561Sobrien	'CXX=$$(CXX_FOR_TARGET)' \
471130561Sobrien	'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
472130561Sobrien	'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
473218822Sdim	'LD=$(COMPILER_LD_FOR_TARGET)' \
474218822Sdim	'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
475130561Sobrien	'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
476130561Sobrien	'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
477218822Sdim	'NM=$(COMPILER_NM_FOR_TARGET)' \
478218822Sdim	'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
479130561Sobrien	'RANLIB=$$(RANLIB_FOR_TARGET)' \
480130561Sobrien	'WINDRES=$$(WINDRES_FOR_TARGET)'
481130561Sobrien
482130561SobrienTARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
483130561Sobrien
484130561Sobrien# Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
485130561Sobrien# unfortunately needs the native compiler and the target ar and
486130561Sobrien# ranlib.
487130561Sobrien# If any variables are added here, they must be added to do-*, below.
488130561Sobrien# The BUILD_* variables are a special case, which are used for the gcc
489130561Sobrien# cross-building scheme.
490130561SobrienEXTRA_GCC_FLAGS = \
491130561Sobrien	"GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
492218822Sdim	"`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
493218822Sdim	"`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
494218822Sdim	"`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
495218822Sdim	"`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
496218822Sdim	"`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
497130561Sobrien
498130561SobrienGCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
499130561Sobrien
500130561Sobrien.PHONY: configure-host
501218822Sdimconfigure-host: [+
502130561Sobrien  FOR host_modules +] \
503130561Sobrien    maybe-configure-[+module+][+
504130561Sobrien  ENDFOR host_modules +]
505130561Sobrien.PHONY: configure-target
506130561Sobrienconfigure-target: [+
507130561Sobrien  FOR target_modules +] \
508130561Sobrien    maybe-configure-target-[+module+][+
509130561Sobrien  ENDFOR target_modules +]
510130561Sobrien
511218822Sdim# The target built for a native non-bootstrap build.
512218822Sdim.PHONY: all
513218822Sdimall:
514218822Sdim@if gcc-bootstrap
515218822Sdim	[ -f stage_final ] || echo stage3 > stage_final
516218822Sdim	@r=`${PWD_COMMAND}`; export r; \
517218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
518218822Sdim	$(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
519218822Sdim@endif gcc-bootstrap
520218822Sdim	@: $(MAKE); $(unstage)
521218822Sdim	@r=`${PWD_COMMAND}`; export r; \
522218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
523218822Sdim	if [ -f stage_last ]; then \
524218822Sdim	  $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
525218822Sdim	else \
526218822Sdim	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
527218822Sdim	fi
528130561Sobrien
529218822Sdim.PHONY: all-build
530218822Sdim[+ FOR build_modules +]
531218822Sdimall-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
532218822Sdim
533130561Sobrien.PHONY: all-host
534218822Sdim[+ FOR host_modules +][+ IF bootstrap +]
535218822Sdim@if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
536218822Sdimall-host: maybe-all-[+module+][+ IF bootstrap +]
537218822Sdim@endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
538218822Sdim
539130561Sobrien.PHONY: all-target
540218822Sdim[+ FOR target_modules +][+ IF bootstrap +]
541218822Sdim@if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
542218822Sdimall-target: maybe-all-target-[+module+][+ IF bootstrap +]
543218822Sdim@endif target-[+module+]-no-bootstrap[+
544218822Sdim  ENDIF bootstrap +][+ ENDFOR target_modules +]
545130561Sobrien
546130561Sobrien# Do a target for all the subdirectories.  A ``make do-X'' will do a
547130561Sobrien# ``make X'' in all subdirectories (because, in general, there is a
548130561Sobrien# dependency (below) of X upon do-X, a ``make X'' will also do this,
549130561Sobrien# but it may do additional work as well).
550130561Sobrien[+ FOR recursive_targets +]
551130561Sobrien.PHONY: do-[+make_target+]
552218822Sdimdo-[+make_target+]:
553218822Sdim	@: $(MAKE); $(unstage)
554218822Sdim	@r=`${PWD_COMMAND}`; export r; \
555218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
556218822Sdim	$(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
557218822Sdim	  [+make_target+]-target
558130561Sobrien
559218822Sdim
560130561Sobrien.PHONY: [+make_target+]-host
561218822Sdim[+ FOR host_modules +]
562218822Sdim[+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
563130561Sobrien
564130561Sobrien.PHONY: [+make_target+]-target
565130561Sobrien[+ FOR target_modules +]
566218822Sdim[+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
567130561Sobrien[+ ENDFOR recursive_targets +]
568130561Sobrien
569130561Sobrien# Here are the targets which correspond to the do-X targets.
570130561Sobrien
571218822Sdim.PHONY: info installcheck dvi pdf html
572218822Sdim.PHONY: install-info install-pdf install-html
573130561Sobrien.PHONY: clean distclean mostlyclean maintainer-clean realclean
574130561Sobrien.PHONY: local-clean local-distclean local-maintainer-clean
575130561Sobrieninfo: do-info
576130561Sobrieninstallcheck: do-installcheck
577130561Sobriendvi: do-dvi
578218822Sdimpdf: do-pdf
579218822Sdimhtml: do-html
580130561Sobrien
581130561Sobrien# Make sure makeinfo is built before we do a `make info', if we're
582130561Sobrien# in fact building texinfo.
583130561Sobriendo-info: maybe-all-texinfo
584130561Sobrien
585130561Sobrieninstall-info: do-install-info dir.info
586130561Sobrien	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
587130561Sobrien	if [ -f dir.info ] ; then \
588130561Sobrien	  $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
589130561Sobrien	else true ; fi
590130561Sobrien
591218822Sdiminstall-pdf: do-install-pdf
592218822Sdim
593218822Sdiminstall-html: do-install-html
594218822Sdim
595130561Sobrienlocal-clean:
596130561Sobrien	-rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
597130561Sobrien
598130561Sobrienlocal-distclean:
599130561Sobrien	-rm -f Makefile config.status config.cache mh-frag mt-frag
600218822Sdim	-rm -f maybedep.tmp serdep.tmp
601130561Sobrien	-if [ "$(TARGET_SUBDIR)" != "." ]; then \
602130561Sobrien	  rm -rf $(TARGET_SUBDIR); \
603130561Sobrien	else true; fi
604130561Sobrien	-rm -rf $(BUILD_SUBDIR)
605218822Sdim	-if [ "$(HOST_SUBDIR)" != "." ]; then \
606218822Sdim	  rm -rf $(HOST_SUBDIR); \
607218822Sdim	else true; fi
608130561Sobrien	-rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
609130561Sobrien	-rm -f texinfo/doc/Makefile texinfo/po/POTFILES
610130561Sobrien	-rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
611130561Sobrien	-rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
612130561Sobrien	-rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
613130561Sobrien
614130561Sobrienlocal-maintainer-clean:
615130561Sobrien	@echo "This command is intended for maintainers to use;"
616130561Sobrien	@echo "it deletes files that may require special tools to rebuild."
617130561Sobrien
618130561Sobrienclean: do-clean local-clean
619130561Sobrienmostlyclean: do-mostlyclean local-clean
620130561Sobriendistclean: do-distclean local-clean local-distclean
621130561Sobrienmaintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
622130561Sobrienmaintainer-clean: local-distclean
623130561Sobrienrealclean: maintainer-clean
624130561Sobrien
625130561Sobrien# Check target.
626130561Sobrien
627130561Sobrien.PHONY: check do-check
628130561Sobriencheck: do-check
629130561Sobrien
630130561Sobrien# Only include modules actually being configured and built.
631218822Sdim.PHONY: check-host
632218822Sdimcheck-host: [+
633130561Sobrien  FOR host_modules +] \
634130561Sobrien    maybe-check-[+module+][+
635218822Sdim  ENDFOR host_modules +]
636218822Sdim
637218822Sdim.PHONY: check-target
638218822Sdimcheck-target: [+
639130561Sobrien  FOR target_modules +] \
640130561Sobrien    maybe-check-target-[+module+][+
641130561Sobrien  ENDFOR target_modules +]
642130561Sobrien
643218822Sdimdo-check:
644218822Sdim	@: $(MAKE); $(unstage)
645218822Sdim	@r=`${PWD_COMMAND}`; export r; \
646218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
647218822Sdim	$(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
648218822Sdim
649130561Sobrien# Automated reporting of test results.
650130561Sobrien
651130561Sobrienwarning.log: build.log
652130561Sobrien	$(srcdir)/contrib/warn_summary build.log > $@
653130561Sobrien
654130561Sobrienmail-report.log:
655130561Sobrien	if test x'$(BOOT_CFLAGS)' != x''; then \
656130561Sobrien	    BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
657130561Sobrien	fi; \
658130561Sobrien	$(srcdir)/contrib/test_summary -t >$@
659130561Sobrien	chmod +x $@
660130561Sobrien	echo If you really want to send e-mail, run ./$@ now
661130561Sobrien
662130561Sobrienmail-report-with-warnings.log: warning.log
663130561Sobrien	if test x'$(BOOT_CFLAGS)' != x''; then \
664130561Sobrien	    BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
665130561Sobrien	fi; \
666130561Sobrien	$(srcdir)/contrib/test_summary -t -i warning.log >$@
667130561Sobrien	chmod +x $@
668130561Sobrien	echo If you really want to send e-mail, run ./$@ now
669130561Sobrien
670130561Sobrien# Installation targets.
671130561Sobrien
672130561Sobrien.PHONY: install uninstall
673218822Sdiminstall:
674218822Sdim	@: $(MAKE); $(unstage)
675218822Sdim	@r=`${PWD_COMMAND}`; export r; \
676218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
677218822Sdim	$(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
678130561Sobrien
679130561Sobrien.PHONY: install-host-nogcc
680130561Sobrieninstall-host-nogcc: [+
681218822Sdim  FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
682218822Sdim    maybe-install-[+module+][+ ENDIF +][+
683130561Sobrien  ENDFOR host_modules +]
684130561Sobrien
685130561Sobrien.PHONY: install-host
686218822Sdiminstall-host: [+
687130561Sobrien  FOR host_modules +] \
688130561Sobrien    maybe-install-[+module+][+
689130561Sobrien  ENDFOR host_modules +]
690130561Sobrien
691130561Sobrien.PHONY: install-target
692130561Sobrieninstall-target: [+
693130561Sobrien  FOR target_modules +] \
694130561Sobrien    maybe-install-target-[+module+][+
695130561Sobrien  ENDFOR target_modules +]
696130561Sobrien
697130561Sobrienuninstall:
698130561Sobrien	@echo "the uninstall target is not supported in this tree"
699130561Sobrien
700130561Sobrien.PHONY: install.all
701130561Sobrieninstall.all: install-no-fixedincludes
702130561Sobrien	@if [ -f ./gcc/Makefile ] ; then \
703130561Sobrien		r=`${PWD_COMMAND}` ; export r ; \
704218822Sdim		s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
705218822Sdim		$(HOST_EXPORTS) \
706130561Sobrien		(cd ./gcc && \
707130561Sobrien		$(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
708130561Sobrien	else \
709130561Sobrien		true ; \
710130561Sobrien	fi
711130561Sobrien
712130561Sobrien# install-no-fixedincludes is used because Cygnus can not distribute
713130561Sobrien# the fixed header files.
714130561Sobrien.PHONY: install-no-fixedincludes
715130561Sobrieninstall-no-fixedincludes: installdirs install-host-nogcc \
716130561Sobrien	install-target gcc-no-fixedincludes
717130561Sobrien
718130561Sobrien### other supporting targets
719130561Sobrien
720130561SobrienMAKEDIRS= \
721130561Sobrien	$(DESTDIR)$(prefix) \
722130561Sobrien	$(DESTDIR)$(exec_prefix)
723130561Sobrien.PHONY: installdirs
724130561Sobrieninstalldirs: mkinstalldirs
725130561Sobrien	$(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
726130561Sobrien
727130561Sobriendir.info: do-install-info
728130561Sobrien	if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
729130561Sobrien	  $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
730130561Sobrien	  mv -f dir.info.new dir.info ; \
731130561Sobrien	else true ; \
732130561Sobrien	fi
733130561Sobrien
734130561Sobriendist:
735130561Sobrien	@echo "Building a full distribution of this tree isn't done"
736130561Sobrien	@echo "via 'make dist'.  Check out the etc/ subdirectory" 
737130561Sobrien
738130561Sobrienetags tags: TAGS
739130561Sobrien
740130561Sobrien# Right now this just builds TAGS in each subdirectory.  emacs19 has the
741130561Sobrien# ability to use several tags files at once, so there is probably no need
742130561Sobrien# to combine them into one big TAGS file (like CVS 1.3 does).  We could
743130561Sobrien# (if we felt like it) have this Makefile write a piece of elisp which
744130561Sobrien# the user could load to tell emacs19 where all the TAGS files we just
745130561Sobrien# built are.
746130561SobrienTAGS: do-TAGS
747130561Sobrien
748218822Sdim# ------------------------------------
749218822Sdim# Macros for configure and all targets
750218822Sdim# ------------------------------------
751218822Sdim
752218822Sdim[+ DEFINE configure +]
753218822Sdim.PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
754218822Sdimmaybe-configure-[+prefix+][+module+]:
755218822Sdim@if gcc-bootstrap
756218822Sdimconfigure-[+prefix+][+module+]: stage_current
757218822Sdim@endif gcc-bootstrap
758218822Sdim@if [+prefix+][+module+]
759218822Sdimmaybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
760218822Sdimconfigure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
761218822Sdim	@: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
762218822Sdim	@r=`${PWD_COMMAND}`; export r; \
763130561Sobrien	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
764218822Sdim	[+ IF check_multilibs
765218822Sdim	+]echo "Checking multilib configuration for [+module+]..."; \
766218822Sdim	$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
767218822Sdim	$(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
768218822Sdim	if test -r [+subdir+]/[+module+]/multilib.out; then \
769218822Sdim	  if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
770218822Sdim	    rm -f [+subdir+]/[+module+]/multilib.tmp; \
771218822Sdim	  else \
772218822Sdim	    rm -f [+subdir+]/[+module+]/Makefile; \
773218822Sdim	    mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
774218822Sdim	  fi; \
775218822Sdim	else \
776218822Sdim	  mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
777218822Sdim	fi; \
778218822Sdim	[+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
779218822Sdim	$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
780218822Sdim	[+exports+] \
781218822Sdim	echo Configuring in [+subdir+]/[+module+]; \
782218822Sdim	cd "[+subdir+]/[+module+]" || exit 1; \
783130561Sobrien	case $(srcdir) in \
784218822Sdim	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
785218822Sdim	  *) topdir=`echo [+subdir+]/[+module+]/ | \
786218822Sdim		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
787130561Sobrien	esac; \
788218822Sdim	srcdiroption="--srcdir=$${topdir}/[+module+]"; \
789218822Sdim	libsrcdir="$$s/[+module+]"; \
790218822Sdim	[+ IF no-config-site +]rm -f no-such-file || : ; \
791218822Sdim	CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
792218822Sdim	  [+args+] --build=${build_alias} --host=[+host_alias+] \
793218822Sdim	  --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
794218822Sdim	  || exit 1
795218822Sdim@endif [+prefix+][+module+]
796218822Sdim
797218822Sdim[+ IF bootstrap +]
798218822Sdim[+ FOR bootstrap_stage +]
799218822Sdim.PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
800218822Sdimmaybe-configure-stage[+id+]-[+prefix+][+module+]:
801218822Sdim@if [+prefix+][+module+]-bootstrap
802218822Sdimmaybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
803218822Sdimconfigure-stage[+id+]-[+prefix+][+module+]:
804218822Sdim	@[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
805218822Sdim	@$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
806218822Sdim	@r=`${PWD_COMMAND}`; export r; \
807218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
808218822Sdim	[+ IF check_multilibs
809218822Sdim	+]echo "Checking multilib configuration for [+module+]..."; \
810218822Sdim	$(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
811218822Sdim	if test -r [+subdir+]/[+module+]/multilib.out; then \
812218822Sdim	  if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
813218822Sdim	    rm -f [+subdir+]/[+module+]/multilib.tmp; \
814130561Sobrien	  else \
815218822Sdim	    rm -f [+subdir+]/[+module+]/Makefile; \
816218822Sdim	    mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
817130561Sobrien	  fi; \
818130561Sobrien	else \
819218822Sdim	  mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
820130561Sobrien	fi; \
821218822Sdim	[+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
822218822Sdim	[+exports+][+ IF prev +] \
823218822Sdim	[+poststage1_exports+][+ ENDIF prev +] \
824218822Sdim	CFLAGS="[+stage_cflags+]"; export CFLAGS; \
825218822Sdim	LIBCFLAGS="[+stage_cflags+]"; export LIBCFLAGS; \
826218822Sdim	echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
827218822Sdim	$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
828218822Sdim	cd [+subdir+]/[+module+] || exit 1; \
829218822Sdim	case $(srcdir) in \
830218822Sdim	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
831218822Sdim	  *) topdir=`echo [+subdir+]/[+module+]/ | \
832218822Sdim		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
833218822Sdim	esac; \
834218822Sdim	srcdiroption="--srcdir=$${topdir}/[+module+]"; \
835218822Sdim	libsrcdir="$$s/[+module+]"; \
836218822Sdim	$(SHELL) $${libsrcdir}/configure \
837218822Sdim	  [+args+] --build=${build_alias} --host=[+host_alias+] \
838218822Sdim	  --target=[+target_alias+] $${srcdiroption} \
839218822Sdim	  [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
840218822Sdim	  [+stage_configure_flags+] [+extra_configure_flags+]
841218822Sdim@endif [+prefix+][+module+]-bootstrap
842218822Sdim[+ ENDFOR bootstrap_stage +]
843218822Sdim[+ ENDIF bootstrap +]
844218822Sdim[+ ENDDEF +]
845130561Sobrien
846218822Sdim[+ DEFINE all +]
847218822Sdim.PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
848218822Sdimmaybe-all-[+prefix+][+module+]:
849218822Sdim@if gcc-bootstrap
850218822Sdimall-[+prefix+][+module+]: stage_current
851218822Sdim@endif gcc-bootstrap
852218822Sdim@if [+prefix+][+module+]
853218822SdimTARGET-[+prefix+][+module+]=[+
854218822Sdim  IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
855218822Sdimmaybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
856218822Sdimall-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
857218822Sdim	@: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
858130561Sobrien	@r=`${PWD_COMMAND}`; export r; \
859130561Sobrien	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
860218822Sdim	[+exports+] \
861218822Sdim	(cd [+subdir+]/[+module+] && \
862218822Sdim	  $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
863218822Sdim@endif [+prefix+][+module+]
864130561Sobrien
865218822Sdim[+ IF bootstrap +]
866218822Sdim[+ FOR bootstrap_stage +]
867218822Sdim.PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
868218822Sdim.PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
869218822Sdimmaybe-all-stage[+id+]-[+prefix+][+module+]:
870218822Sdimmaybe-clean-stage[+id+]-[+prefix+][+module+]:
871218822Sdim@if [+prefix+][+module+]-bootstrap
872218822Sdimmaybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
873218822Sdimall-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
874218822SdimTARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
875218822Sdimall-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
876218822Sdim	@[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
877218822Sdim	@r=`${PWD_COMMAND}`; export r; \
878218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
879218822Sdim	[+exports+][+ IF prev +] \
880218822Sdim	[+poststage1_exports+][+ ENDIF prev +] \
881218822Sdim	cd [+subdir+]/[+module+] && \
882218822Sdim	$(MAKE) [+args+] \
883218822Sdim		CFLAGS="[+stage_cflags+]" LIBCFLAGS="[+stage_cflags+]" [+
884218822Sdim		IF prev +][+poststage1_args+][+ ENDIF prev
885218822Sdim		+] [+extra_make_flags+] \
886218822Sdim		$(TARGET-stage[+id+]-[+prefix+][+module+])
887218822Sdim
888218822Sdimmaybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
889218822Sdimclean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
890218822Sdimclean-stage[+id+]-[+prefix+][+module+]:
891218822Sdim	@if [ $(current_stage) = stage[+id+] ]; then \
892218822Sdim	  [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
893218822Sdim	else \
894218822Sdim	  [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
895218822Sdim	  $(MAKE) stage[+id+]-start; \
896218822Sdim	fi; \
897218822Sdim	cd [+subdir+]/[+module+] && \
898218822Sdim	$(MAKE) [+args+] [+ IF prev +] \
899218822Sdim		[+poststage1_args+] [+ ENDIF prev +] \
900218822Sdim		[+extra_make_flags+] clean
901218822Sdim@endif [+prefix+][+module+]-bootstrap
902218822Sdim
903218822Sdim[+ ENDFOR bootstrap_stage +]
904218822Sdim[+ ENDIF bootstrap +]
905218822Sdim[+ ENDDEF +]
906218822Sdim
907130561Sobrien# --------------------------------------
908218822Sdim# Modules which run on the build machine
909218822Sdim# --------------------------------------
910218822Sdim[+ FOR build_modules +]
911218822Sdim[+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
912218822Sdim	     host_alias=(get "host" "${build_alias}")
913218822Sdim	     target_alias=(get "target" "${target_alias}")
914218822Sdim	     args="$(BUILD_CONFIGARGS)" no-config-site=true +]
915218822Sdim
916218822Sdim[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
917218822Sdim[+ ENDFOR build_module +]
918218822Sdim
919218822Sdim# --------------------------------------
920130561Sobrien# Modules which run on the host machine
921130561Sobrien# --------------------------------------
922130561Sobrien[+ FOR host_modules +]
923218822Sdim[+ configure prefix="" subdir="$(HOST_SUBDIR)"
924218822Sdim	     exports="$(HOST_EXPORTS)"
925218822Sdim	     poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
926218822Sdim	     host_alias=(get "host" "${host_alias}")
927218822Sdim	     target_alias=(get "target" "${target_alias}")
928218822Sdim	     args="$(HOST_CONFIGARGS)" +]
929130561Sobrien
930218822Sdim[+ all prefix="" subdir="$(HOST_SUBDIR)"
931218822Sdim       exports="$(HOST_EXPORTS)"
932218822Sdim       poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
933218822Sdim       args="$(FLAGS_TO_PASS)"
934218822Sdim       poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
935130561Sobrien
936130561Sobrien.PHONY: check-[+module+] maybe-check-[+module+]
937130561Sobrienmaybe-check-[+module+]:
938218822Sdim@if [+module+]
939218822Sdimmaybe-check-[+module+]: check-[+module+]
940130561Sobrien[+ IF no_check +]
941130561Sobriencheck-[+module+]:
942130561Sobrien[+ ELIF no_check_cross +]
943130561Sobrien# This module is only tested in a native toolchain.
944130561Sobriencheck-[+module+]:
945218822Sdim	@: $(MAKE); $(unstage)
946130561Sobrien	@if [ '$(host)' = '$(target)' ] ; then \
947130561Sobrien	  r=`${PWD_COMMAND}`; export r; \
948130561Sobrien	  s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
949218822Sdim	  $(HOST_EXPORTS) \
950218822Sdim	  (cd $(HOST_SUBDIR)/[+module+] && \
951218822Sdim	    $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
952130561Sobrien	fi
953130561Sobrien[+ ELSE check +]
954130561Sobriencheck-[+module+]:
955218822Sdim	@: $(MAKE); $(unstage)
956130561Sobrien	@r=`${PWD_COMMAND}`; export r; \
957130561Sobrien	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
958218822Sdim	$(HOST_EXPORTS) \
959218822Sdim	(cd $(HOST_SUBDIR)/[+module+] && \
960218822Sdim	  $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
961130561Sobrien[+ ENDIF no_check +]
962218822Sdim@endif [+module+]
963130561Sobrien
964130561Sobrien.PHONY: install-[+module+] maybe-install-[+module+]
965130561Sobrienmaybe-install-[+module+]:
966218822Sdim@if [+module+]
967218822Sdimmaybe-install-[+module+]: install-[+module+]
968130561Sobrien[+ IF no_install +]
969130561Sobrieninstall-[+module+]:
970130561Sobrien[+ ELSE install +]
971130561Sobrieninstall-[+module+]: installdirs
972218822Sdim	@: $(MAKE); $(unstage)
973130561Sobrien	@r=`${PWD_COMMAND}`; export r; \
974130561Sobrien	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
975218822Sdim	$(HOST_EXPORTS) \
976218822Sdim	(cd $(HOST_SUBDIR)/[+module+] && \
977218822Sdim	  $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
978130561Sobrien[+ ENDIF no_install +]
979218822Sdim@endif [+module+]
980218822Sdim
981218822Sdim# Other targets (info, dvi, pdf, etc.)
982218822Sdim[+ FOR recursive_targets +]
983218822Sdim.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
984218822Sdimmaybe-[+make_target+]-[+module+]:
985218822Sdim@if [+module+]
986218822Sdimmaybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
987218822Sdim[+ IF (match-value? = "missing" (get "make_target") ) +]
988218822Sdim# [+module+] doesn't support [+make_target+].
989218822Sdim[+make_target+]-[+module+]:
990218822Sdim[+ ELSE +]
991218822Sdim[+make_target+]-[+module+]: [+
992218822Sdim  FOR depend +]\
993218822Sdim    [+depend+]-[+module+] [+
994218822Sdim  ENDFOR depend +]
995218822Sdim	@[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
996218822Sdim	@[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
997218822Sdim	r=`${PWD_COMMAND}`; export r; \
998218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
999218822Sdim	$(HOST_EXPORTS) \
1000218822Sdim	for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1001218822Sdim	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1002218822Sdim	done; \
1003218822Sdim	echo "Doing [+make_target+] in [+module+]" ; \
1004218822Sdim	(cd $(HOST_SUBDIR)/[+module+] && \
1005218822Sdim	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1006218822Sdim	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1007218822Sdim	          "RANLIB=$${RANLIB}" \
1008218822Sdim	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
1009218822Sdim	          [+make_target+]) \
1010218822Sdim	  || exit 1
1011218822Sdim[+ ENDIF +]
1012218822Sdim@endif [+module+]
1013218822Sdim[+ ENDFOR recursive_targets +]
1014130561Sobrien[+ ENDFOR host_modules +]
1015130561Sobrien
1016130561Sobrien# ---------------------------------------
1017130561Sobrien# Modules which run on the target machine
1018130561Sobrien# ---------------------------------------
1019130561Sobrien[+ FOR target_modules +]
1020130561Sobrien
1021218822Sdim[+ IF raw_cxx +]
1022218822Sdim[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1023218822Sdim	     check_multilibs=true
1024218822Sdim	     exports="$(RAW_CXX_TARGET_EXPORTS)"
1025218822Sdim	     host_alias=(get "host" "${target_alias}")
1026218822Sdim	     target_alias=(get "target" "${target_alias}")
1027218822Sdim	     args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1028130561Sobrien
1029218822Sdim[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1030218822Sdim       exports="$(RAW_CXX_TARGET_EXPORTS)"
1031218822Sdim       args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1032218822Sdim[+ ELSE +]
1033218822Sdim[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1034218822Sdim	     check_multilibs=true
1035218822Sdim	     exports="$(NORMAL_TARGET_EXPORTS)"
1036218822Sdim	     host_alias=(get "host" "${target_alias}")
1037218822Sdim	     target_alias=(get "target" "${target_alias}")
1038218822Sdim	     args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1039130561Sobrien
1040218822Sdim[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1041218822Sdim       exports="$(NORMAL_TARGET_EXPORTS)"
1042218822Sdim       args="$(TARGET_FLAGS_TO_PASS)" +]
1043218822Sdim[+ ENDIF +]
1044130561Sobrien
1045130561Sobrien.PHONY: check-target-[+module+] maybe-check-target-[+module+]
1046130561Sobrienmaybe-check-target-[+module+]:
1047218822Sdim@if target-[+module+]
1048218822Sdimmaybe-check-target-[+module+]: check-target-[+module+]
1049130561Sobrien[+ IF no_check +]
1050130561Sobrien# Dummy target for uncheckable module.
1051130561Sobriencheck-target-[+module+]:
1052130561Sobrien[+ ELSE check +]
1053130561Sobriencheck-target-[+module+]:
1054218822Sdim	@: $(MAKE); $(unstage)
1055130561Sobrien	@r=`${PWD_COMMAND}`; export r; \
1056218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1057218822SdimIF raw_cxx +]
1058218822Sdim	$(RAW_CXX_TARGET_EXPORTS) \[+
1059218822SdimELSE normal_cxx +]
1060218822Sdim	$(NORMAL_TARGET_EXPORTS) \[+
1061218822SdimENDIF raw_cxx +]
1062130561Sobrien	(cd $(TARGET_SUBDIR)/[+module+] && \
1063130561Sobrien	  $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1064130561Sobrien	    IF raw_cxx 
1065130561Sobrien	      +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1066130561Sobrien	    ENDIF raw_cxx 
1067218822Sdim	  +] [+extra_make_flags+] check)
1068130561Sobrien[+ ENDIF no_check +]
1069218822Sdim@endif target-[+module+]
1070130561Sobrien
1071130561Sobrien.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1072130561Sobrienmaybe-install-target-[+module+]:
1073218822Sdim@if target-[+module+]
1074218822Sdimmaybe-install-target-[+module+]: install-target-[+module+]
1075130561Sobrien[+ IF no_install +]
1076130561Sobrien# Dummy target for uninstallable.
1077130561Sobrieninstall-target-[+module+]:
1078130561Sobrien[+ ELSE install +]
1079130561Sobrieninstall-target-[+module+]: installdirs
1080218822Sdim	@: $(MAKE); $(unstage)
1081130561Sobrien	@r=`${PWD_COMMAND}`; export r; \
1082218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1083218822SdimIF raw_cxx +]
1084218822Sdim	$(RAW_CXX_TARGET_EXPORTS) \[+
1085218822SdimELSE normal_cxx +]
1086218822Sdim	$(NORMAL_TARGET_EXPORTS) \[+
1087218822SdimENDIF raw_cxx +]
1088130561Sobrien	(cd $(TARGET_SUBDIR)/[+module+] && \
1089218822Sdim	  $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1090130561Sobrien[+ ENDIF no_install +]
1091218822Sdim@endif target-[+module+]
1092218822Sdim
1093218822Sdim# Other targets (info, dvi, pdf, etc.)
1094218822Sdim[+ FOR recursive_targets +]
1095218822Sdim.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1096218822Sdimmaybe-[+make_target+]-target-[+module+]:
1097218822Sdim@if target-[+module+]
1098218822Sdimmaybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1099218822Sdim[+ IF (match-value? = "missing" (get "make_target") ) +]
1100218822Sdim# [+module+] doesn't support [+make_target+].
1101218822Sdim[+make_target+]-target-[+module+]:
1102218822Sdim[+ ELSE +]
1103218822Sdim[+make_target+]-target-[+module+]: [+
1104218822Sdim  FOR depend +]\
1105218822Sdim    [+depend+]-target-[+module+] [+
1106218822Sdim  ENDFOR depend +]
1107218822Sdim	@: $(MAKE); $(unstage)
1108218822Sdim	@[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1109218822Sdim	r=`${PWD_COMMAND}`; export r; \
1110218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1111218822SdimIF raw_cxx +]
1112218822Sdim	$(RAW_CXX_TARGET_EXPORTS) \[+
1113218822SdimELSE normal_cxx +]
1114218822Sdim	$(NORMAL_TARGET_EXPORTS) \[+
1115218822SdimENDIF raw_cxx +]
1116218822Sdim	echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1117218822Sdim	for flag in $(EXTRA_TARGET_FLAGS); do \
1118218822Sdim	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1119218822Sdim	done; \
1120218822Sdim	(cd $(TARGET_SUBDIR)/[+module+] && \
1121218822Sdim	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1122218822Sdim	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1123218822Sdim	          "RANLIB=$${RANLIB}" \
1124218822Sdim	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
1125218822Sdim	          [+extra_make_flags+] [+make_target+]) \
1126218822Sdim	  || exit 1
1127218822Sdim[+ ENDIF +]
1128218822Sdim@endif target-[+module+]
1129218822Sdim[+ ENDFOR recursive_targets +]
1130130561Sobrien[+ ENDFOR target_modules +]
1131130561Sobrien
1132130561Sobrien# ----------
1133130561Sobrien# GCC module
1134130561Sobrien# ----------
1135130561Sobrien
1136218822Sdim@if gcc-no-bootstrap
1137130561Sobrien.PHONY: cross
1138218822Sdimcross: all-build all-gas all-ld
1139130561Sobrien	@r=`${PWD_COMMAND}`; export r; \
1140130561Sobrien	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1141218822Sdim	$(HOST_EXPORTS) \
1142130561Sobrien	echo "Building the C and C++ compiler"; \
1143130561Sobrien	cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1144130561Sobrien	@r=`${PWD_COMMAND}`; export r; \
1145130561Sobrien	s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1146130561Sobrien	echo "Building runtime libraries"; \
1147218822Sdim	$(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1148218822Sdim@endif gcc-no-bootstrap
1149130561Sobrien
1150218822Sdim@if gcc
1151130561Sobrien.PHONY: check-gcc-c++
1152130561Sobriencheck-gcc-c++:
1153130561Sobrien	@if [ -f ./gcc/Makefile ] ; then \
1154130561Sobrien	  r=`${PWD_COMMAND}`; export r; \
1155130561Sobrien	  s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1156218822Sdim	  $(HOST_EXPORTS) \
1157130561Sobrien	  (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
1158130561Sobrien	else \
1159130561Sobrien	  true; \
1160130561Sobrien	fi
1161130561Sobrien
1162130561Sobrien.PHONY: check-c++
1163130561Sobriencheck-c++: check-target-libstdc++-v3 check-gcc-c++
1164130561Sobrien
1165130561Sobrien# Install the gcc headers files, but not the fixed include files,
1166130561Sobrien# which Cygnus is not allowed to distribute.  This rule is very
1167130561Sobrien# dependent on the workings of the gcc Makefile.in.
1168130561Sobrien.PHONY: gcc-no-fixedincludes
1169130561Sobriengcc-no-fixedincludes:
1170130561Sobrien	@if [ -f ./gcc/Makefile ]; then \
1171130561Sobrien	  rm -rf gcc/tmp-include; \
1172130561Sobrien	  mv gcc/include gcc/tmp-include 2>/dev/null; \
1173130561Sobrien	  mkdir gcc/include; \
1174130561Sobrien	  cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1175130561Sobrien	  touch gcc/stmp-fixinc gcc/include/fixed; \
1176130561Sobrien	  rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1177130561Sobrien	  r=`${PWD_COMMAND}`; export r; \
1178130561Sobrien	  s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1179218822Sdim	  $(HOST_EXPORTS) \
1180130561Sobrien	  (cd ./gcc && \
1181130561Sobrien	   $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1182130561Sobrien	  rm -rf gcc/include; \
1183130561Sobrien	  mv gcc/tmp-include gcc/include 2>/dev/null; \
1184130561Sobrien	else true; fi
1185218822Sdim@endif gcc
1186130561Sobrien
1187218822Sdim# ---------------------
1188218822Sdim# GCC bootstrap support
1189218822Sdim# ---------------------
1190218822Sdim
1191218822Sdim# We track the current stage (the one in 'gcc') in the stage_current file.
1192218822Sdim# stage_last instead tracks the stage that was built last.  These targets
1193218822Sdim# are dummy when toplevel bootstrap is not active.
1194218822Sdim
1195218822Sdim# While making host and target tools, symlinks to the final stage must be
1196218822Sdim# there, so $(unstage) should be run at various points.  To avoid excessive
1197218822Sdim# recursive invocations of make, we "inline" them using a variable.  These
1198218822Sdim# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1199218822Sdim# to avoid warnings from the GNU Make job server.
1200218822Sdim
1201218822Sdimunstage = :
1202218822Sdimstage = :
1203218822Sdimcurrent_stage = ""
1204218822Sdim
1205218822Sdim@if gcc-bootstrap
1206218822Sdimunstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1207218822Sdimstage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1208218822Sdimcurrent_stage = "`cat stage_current 2> /dev/null`"
1209218822Sdim@endif gcc-bootstrap
1210218822Sdim
1211218822Sdim.PHONY: unstage stage
1212218822Sdimunstage:
1213218822Sdim	@: $(MAKE); $(unstage)
1214218822Sdimstage:
1215218822Sdim	@: $(MAKE); $(stage)
1216218822Sdim
1217218822Sdim# Disable commands for lean bootstrap.
1218218822SdimLEAN = false
1219218822Sdim
1220218822Sdim# We name the build directories for the various stages "stage1-gcc",
1221218822Sdim# "stage2-gcc","stage3-gcc", etc.
1222218822Sdim
1223218822Sdim# Since the 'compare' process will fail (on debugging information) if any
1224218822Sdim# directory names are different, we need to link the gcc directory for
1225218822Sdim# the previous stage to a constant name ('prev-gcc'), and to make the name of
1226218822Sdim# the build directories constant as well. For the latter, we use naked names
1227218822Sdim# like 'gcc', because the scripts in that directory assume it.  We use
1228218822Sdim# mv on platforms where symlinks to directories do not work or are not
1229218822Sdim# reliable.
1230218822Sdim
1231218822Sdim# 'touch' doesn't work right on some platforms.
1232218822SdimSTAMP = echo timestamp > 
1233218822Sdim
1234218822Sdim# We only want to compare .o files, so set this!
1235218822Sdimobjext = .o
1236218822Sdim
1237218822Sdim[+ FOR bootstrap-stage +]
1238218822Sdim.PHONY: stage[+id+]-start stage[+id+]-end
1239218822Sdim
1240218822Sdimstage[+id+]-start::
1241218822Sdim	@: $(MAKE); $(stage); \
1242218822Sdim	echo stage[+id+] > stage_current ; \
1243218822Sdim	echo stage[+id+] > stage_last; \
1244218822Sdim	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1245218822Sdim   FOR host_modules +][+ IF bootstrap +]
1246218822Sdim@if [+ module +]
1247218822Sdim	@cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1248218822Sdim	  mkdir stage[+id+]-[+module+]; \
1249218822Sdim	mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1250218822Sdim	mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1251218822Sdim@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1252218822Sdim	@[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1253218822Sdim	  mkdir stage[+id+]-$(TARGET_SUBDIR); \
1254218822Sdim	mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1255218822Sdim	mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1256218822Sdim
1257218822Sdimstage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1258218822Sdim@if [+ module +]
1259218822Sdim	@if test -d $(HOST_SUBDIR)/[+module+] ; then \
1260218822Sdim	  cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1261218822Sdim	  mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
1262218822Sdim	fi
1263218822Sdim@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1264218822Sdim	@if test -d $(TARGET_SUBDIR) ; then \
1265218822Sdim	  mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1266218822Sdim	  mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
1267218822Sdim	fi
1268218822Sdim	rm -f stage_current
1269218822Sdim
1270218822Sdim# Bubble a bug fix through all the stages up to stage [+id+].  They are
1271218822Sdim# remade, but not reconfigured.  The next stage (if any) will not be
1272218822Sdim# reconfigured as well.
1273218822Sdim.PHONY: stage[+id+]-bubble
1274218822Sdimstage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1275218822Sdim	@r=`${PWD_COMMAND}`; export r; \
1276218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1277218822Sdim	if test -f stage[+id+]-lean [+
1278218822Sdim	  IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1279218822Sdim	  echo Skipping rebuild of stage[+id+] ; \
1280218822Sdim	else \
1281218822Sdim	  $(MAKE) stage[+id+]-start; \[+IF lean +]
1282218822Sdim	  if $(LEAN); then \
1283218822Sdim	    rm -rf stage[+lean+]-* ; \
1284218822Sdim	    $(STAMP) stage[+lean+]-lean ; \
1285218822Sdim	  fi; \[+ ENDIF lean +]
1286218822Sdim	  $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1287218822Sdim	fi[+ IF compare-target +]
1288218822Sdim	$(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1289218822Sdim
1290218822Sdim.PHONY: all-stage[+id+] clean-stage[+id+]
1291218822Sdimdo-clean: clean-stage[+id+]
1292218822Sdim
1293218822Sdim# FIXME: Will not need to be conditional when toplevel bootstrap is the
1294218822Sdim# only possibility, but now it conflicts with no-bootstrap rules
1295218822Sdim@if gcc-bootstrap
1296218822Sdim[+ IF compare-target +]
1297218822Sdim[+compare-target+]:
1298218822Sdim	@r=`${PWD_COMMAND}`; export r; \
1299218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1300218822Sdim	if test -f stage[+prev+]-lean; then \
1301218822Sdim	  echo Cannot compare object files as stage [+prev+] was deleted. ; \
1302218822Sdim	  exit 0 ; \
1303218822Sdim	fi; \
1304218822Sdim	: $(MAKE); $(stage); \
1305218822Sdim	rm -f .bad_compare ; \
1306218822Sdim	echo Comparing stages [+prev+] and [+id+] ; \
1307218822Sdim	cd stage[+id+]-gcc; \
1308218822Sdim	files=`find . -name "*$(objext)" -print` ; \
1309218822Sdim	cd .. ; \
1310218822Sdim	for file in $${files} ; do \
1311218822Sdim	  f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
1312218822Sdim	  @do_compare@ > /dev/null 2>&1; \
1313218822Sdim	  if test $$? -eq 1; then \
1314218822Sdim	    case $$file in \
1315218822Sdim	      ./cc*-checksum$(objext) | ./libgcc/* ) \
1316218822Sdim	        echo warning: $$file differs ;; \
1317218822Sdim	      *) \
1318218822Sdim	        echo $$file differs >> .bad_compare ;; \
1319218822Sdim	    esac ; \
1320218822Sdim	  fi ; \
1321218822Sdim	done ; \
1322218822Sdim	if [ -f .bad_compare ]; then \
1323218822Sdim	  echo "Bootstrap comparison failure!"; \
1324218822Sdim	  cat .bad_compare; \
1325218822Sdim	  exit 1; \
1326218822Sdim	else \
1327218822Sdim	  echo Comparison successful.; \
1328218822Sdim	fi ; \
1329218822Sdim	$(STAMP) [+compare-target+][+ IF prev +]
1330218822Sdim	if $(LEAN); then \
1331218822Sdim	  rm -rf stage[+prev+]-*; \
1332218822Sdim	  $(STAMP) stage[+prev+]-lean; \
1333218822Sdim	fi[+ ENDIF prev +]
1334218822Sdim[+ ENDIF compare-target +]
1335218822Sdim
1336218822Sdim[+ IF bootstrap-target +]
1337218822Sdim.PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1338218822Sdim[+bootstrap-target+]:
1339218822Sdim	echo stage[+id+] > stage_final
1340218822Sdim	@r=`${PWD_COMMAND}`; export r; \
1341218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1342218822Sdim	$(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1343218822Sdim	@: $(MAKE); $(unstage)
1344218822Sdim	@r=`${PWD_COMMAND}`; export r; \
1345218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1346218822Sdim	$(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1347218822Sdim
1348218822Sdim[+bootstrap-target+]-lean:
1349218822Sdim	echo stage[+id+] > stage_final
1350218822Sdim	@r=`${PWD_COMMAND}`; export r; \
1351218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1352218822Sdim	$(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1353218822Sdim	@: $(MAKE); $(unstage)
1354218822Sdim	@r=`${PWD_COMMAND}`; export r; \
1355218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1356218822Sdim	$(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1357218822Sdim[+ ENDIF bootstrap-target +]
1358218822Sdim
1359218822Sdim# Rules to wipe a stage and all the following ones, also used for cleanstrap
1360218822Sdim[+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1361218822Sdim.PHONY: distclean-stage[+id+]
1362218822Sdimdistclean-stage[+id+]::
1363218822Sdim	@: $(MAKE); $(stage)
1364218822Sdim	@test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1365218822Sdim	rm -rf stage[+id+]-* [+
1366218822Sdim	  IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1367218822Sdim
1368218822Sdim[+ IF cleanstrap-target +]
1369218822Sdim.PHONY: [+cleanstrap-target+]
1370218822Sdim[+cleanstrap-target+]: do-distclean local-clean
1371218822Sdim	echo stage[+id+] > stage_final
1372218822Sdim	@r=`${PWD_COMMAND}`; export r; \
1373218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1374218822Sdim	$(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1375218822Sdim	@: $(MAKE); $(unstage)
1376218822Sdim	@r=`${PWD_COMMAND}`; export r; \
1377218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1378218822Sdim	$(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1379218822Sdim[+ ENDIF cleanstrap-target +]
1380218822Sdim@endif gcc-bootstrap
1381218822Sdim
1382218822Sdim[+ ENDFOR bootstrap-stage +]
1383218822Sdim
1384218822Sdimstageprofile-end::
1385218822Sdim	$(MAKE) distclean-stagefeedback
1386218822Sdim
1387218822Sdimstagefeedback-start::
1388218822Sdim	@r=`${PWD_COMMAND}`; export r; \
1389218822Sdim	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1390218822Sdim	for i in prev-*; do \
1391218822Sdim	  j=`echo $$i | sed s/^prev-//` ; \
1392218822Sdim	  cd $$r/$$i && \
1393218822Sdim	  { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1394218822Sdim	  { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1395218822Sdim	done
1396218822Sdim
1397218822Sdim@if gcc-bootstrap
1398218822Sdimdo-distclean: distclean-stage1
1399218822Sdim
1400218822Sdim# Provide a GCC build when we're building target libraries.  This does
1401218822Sdim# not work as a dependency, just as the minimum necessary to avoid errors.
1402218822Sdimstage_last:
1403218822Sdim	$(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1404218822Sdim
1405218822Sdim# Same as unstage, but not phony and defaulting to stage1-start.  We place
1406218822Sdim# it in the dependency so that for example `make -j3 all-gcc' works.
1407218822Sdimstage_current:
1408218822Sdim	@if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1409218822Sdim
1410218822Sdim.PHONY: restrap
1411218822Sdimrestrap:
1412218822Sdim	@: $(MAKE); $(stage)
1413218822Sdim	rm -rf stage1-$(TARGET_SUBDIR) [+ FOR bootstrap-stage +][+ IF prev
1414218822Sdim	  +]stage[+id+]-* [+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1415218822Sdim	$(MAKE) $(RECURSE_FLAGS_TO_PASS) all
1416218822Sdim@endif gcc-bootstrap
1417218822Sdim
1418130561Sobrien# --------------------------------------
1419130561Sobrien# Dependencies between different modules
1420130561Sobrien# --------------------------------------
1421130561Sobrien
1422218822Sdim# Generic dependencies for target modules on host stuff, especially gcc
1423218822Sdim@if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1424218822Sdim  +][+ FOR bootstrap_stage +]
1425218822Sdimconfigure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1426218822Sdim  ENDFOR +][+ ELSE bootstrap +]
1427218822Sdimconfigure-target-[+module+]: stage_last[+
1428218822Sdim  ENDIF bootstrap +][+ ENDFOR target_modules +]
1429218822Sdim@endif gcc-bootstrap
1430218822Sdim
1431218822Sdim@if gcc-no-bootstrap[+ FOR target_modules +]
1432218822Sdimconfigure-target-[+module+]: maybe-all-gcc[+
1433218822Sdim  ENDFOR target_modules +]
1434218822Sdim@endif gcc-no-bootstrap
1435218822Sdim
1436218822Sdim
1437130561Sobrien# There are two types of dependencies here: 'hard' dependencies, where one
1438130561Sobrien# module simply won't build without the other; and 'soft' dependencies, where
1439130561Sobrien# if the depended-on module is missing, the depending module will do without
1440130561Sobrien# or find a substitute somewhere (perhaps installed).  Soft dependencies
1441218822Sdim# are made here to depend on a 'maybe-' target.  If you're not sure,
1442130561Sobrien# it's safer to use a soft dependency.
1443130561Sobrien
1444218822Sdim[+ ;; These Scheme functions build the bulk of the dependencies.
1445218822Sdim   ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1446218822Sdim   ;; where "maybe-" is only included if HARD is true, and all-gcc
1447218822Sdim   ;; is taken from VAR-NAME.
1448218822Sdim   (define dep-target (lambda (module-kind var-name hard)
1449218822Sdim      (string-append
1450218822Sdim         (if hard "" "maybe-")
1451218822Sdim         (dep-subtarget var-name)
1452218822Sdim         module-kind
1453218822Sdim         (dep-module var-name)
1454218822Sdim      )))
1455130561Sobrien
1456218822Sdim   ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1457218822Sdim   (define make-dep (lambda (module-kind on-kind)
1458218822Sdim      (string-append
1459218822Sdim         (dep-target module-kind "module" #t) ": "
1460218822Sdim         (dep-target on-kind "on" (exist? "hard")))))
1461130561Sobrien
1462218822Sdim   ;; dep-subtarget extracts everything up to the first dash in the given
1463218822Sdim   ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1464218822Sdim   (define dep-subtarget (lambda (var-name)
1465218822Sdim      (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1466130561Sobrien
1467218822Sdim   ;; dep-module extracts everything up to the first dash in the given
1468218822Sdim   ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1469218822Sdim   (define dep-module (lambda (var-name)
1470218822Sdim      (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1471130561Sobrien
1472218822Sdim   ;; dep-stage builds a string for the prefix of a bootstrap stage.
1473218822Sdim   (define dep-stage (lambda ()
1474218822Sdim      (string-append
1475218822Sdim	 "stage"
1476218822Sdim	 (get "id")
1477218822Sdim	 "-")))
1478130561Sobrien
1479218822Sdim   ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1480218822Sdim   ;; but is written in Scheme.
1481218822Sdim   (define dep-maybe (lambda ()
1482218822Sdim      (if (exist? "hard") "" "maybe-")))
1483130561Sobrien
1484218822Sdim   ;; dep-kind returns "normal" if the dependency is on an "install" target,
1485218822Sdim   ;; or if either module is not bootstrapped.  It returns "bootstrap" for
1486218822Sdim   ;; configure or build dependencies between bootstrapped modules; it returns
1487218822Sdim   ;; "prebootstrap" for configure or build dependencies of bootstrapped
1488218822Sdim   ;; modules on a build module (e.g. all-gcc on all-build-bison).  All this
1489218822Sdim   ;; is only necessary for host modules.
1490218822Sdim   (define dep-kind (lambda ()
1491218822Sdim      (if (and (hash-ref boot-modules (dep-module "module"))
1492218822Sdim	       (=* (dep-module "on") "build-"))
1493218822Sdim	  "prebootstrap"
1494130561Sobrien
1495218822Sdim	  (if (or (= (dep-subtarget "on") "install-")
1496218822Sdim		  (not (hash-ref boot-modules (dep-module "module")))
1497218822Sdim		  (not (hash-ref boot-modules (dep-module "on"))))
1498218822Sdim              "normal"
1499218822Sdim	      "bootstrap"))))
1500130561Sobrien
1501218822Sdim   ;; We now build the hash table that is used by dep-kind.
1502218822Sdim   (define boot-modules (make-hash-table 113))
1503218822Sdim+]
1504130561Sobrien
1505218822Sdim[+ FOR host_modules +][+
1506218822Sdim   (if (exist? "bootstrap")
1507218822Sdim       (hash-create-handle! boot-modules (get "module") #t))
1508218822Sdim   "" +][+ ENDFOR host_modules +]
1509218822Sdim[+ FOR target_modules +][+
1510218822Sdim   (if (exist? "bootstrap")
1511218822Sdim       (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1512218822Sdim   "" +][+ ENDFOR target_modules +]
1513130561Sobrien
1514218822Sdim# With all the machinery above in place, it is pretty easy to generate
1515218822Sdim# dependencies.  Host dependencies are a bit more complex because we have
1516218822Sdim# to check for bootstrap/prebootstrap dependencies.  To resolve
1517218822Sdim# prebootstrap dependencies, prebootstrap modules are gathered in
1518218822Sdim# a hash table.
1519218822Sdim[+ FOR dependencies +][+ (make-dep "" "") +]
1520218822Sdim[+ CASE (dep-kind) +]
1521218822Sdim[+ == "prebootstrap"
1522218822Sdim     +][+ FOR bootstrap_stage +]
1523218822Sdim[+ (make-dep (dep-stage) "") +][+
1524218822Sdim       ENDFOR bootstrap_stage +]
1525218822Sdim[+ == "bootstrap"
1526218822Sdim     +][+ FOR bootstrap_stage +]
1527218822Sdim[+ (make-dep (dep-stage) (dep-stage)) +][+
1528218822Sdim       ENDFOR bootstrap_stage +]
1529218822Sdim[+ ESAC +][+
1530218822SdimENDFOR dependencies +]
1531218822Sdim
1532218822Sdim# Dependencies for target modules on other target modules are
1533218822Sdim# described by lang_env_dependencies; the defaults apply to anything
1534218822Sdim# not mentioned there.
1535218822Sdim[+
1536218822Sdim   ;; Predicate for whether LANG was specified in lang_env_dependencies.
1537218822Sdim   (define lang-dep (lambda (lang)
1538218822Sdim      (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1539218822Sdim
1540218822Sdim   ;; Build the hash table we will need.
1541218822Sdim   (define lang-env-deps (make-hash-table 7))
1542218822Sdim+][+ FOR lang_env_dependencies +][+
1543218822Sdim   (if (exist? "cxx")
1544218822Sdim       (hash-create-handle! lang-env-deps
1545218822Sdim	  (string-append (get "module") "-" "cxx") #t))
1546218822Sdim
1547218822Sdim   (if (exist? "no_c")
1548218822Sdim       (hash-create-handle! lang-env-deps
1549218822Sdim	  (string-append (get "module") "-" "no_c") #t))
1550218822Sdim
1551218822Sdim   (if (exist? "no_gcc")
1552218822Sdim       (hash-create-handle! lang-env-deps
1553218822Sdim	  (string-append (get "module") "-" "no_gcc") #t))
1554218822Sdim   "" +][+ ENDFOR lang_env_dependencies +]
1555218822Sdim
1556218822Sdim@if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1557218822Sdim  +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1558218822Sdimconfigure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1559218822Sdim  ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1560218822Sdim@endif gcc-bootstrap
1561218822Sdim
1562218822Sdim@if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1563218822Sdimconfigure-target-[+module+]: maybe-all-target-libgcc[+
1564218822Sdim  ENDIF +][+ ENDFOR target_modules +]
1565218822Sdim@endif gcc-no-bootstrap
1566218822Sdim
1567218822Sdim[+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1568218822Sdimconfigure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1569218822Sdim  ENDIF +][+ IF (lang-dep "cxx") +]
1570218822Sdimconfigure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1571218822Sdim  ENDIF +]
1572218822Sdim[+ ENDFOR target_modules +]
1573218822Sdim
1574218822SdimCONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
1575218822SdimGDB_TK = @GDB_TK@
1576218822SdimINSTALL_GDB_TK = @INSTALL_GDB_TK@
1577218822Sdimconfigure-gdb: $(CONFIGURE_GDB_TK)
1578218822Sdimall-gdb: $(gdbnlmrequirements) $(GDB_TK)
1579218822Sdiminstall-gdb: $(INSTALL_GDB_TK)
1580218822Sdim
1581130561Sobrien# Serialization dependencies.  Host configures don't work well in parallel to
1582130561Sobrien# each other, due to contention over config.cache.  Target configures and 
1583130561Sobrien# build configures are similar.
1584130561Sobrien@serialization_dependencies@
1585130561Sobrien
1586130561Sobrien# --------------------------------
1587130561Sobrien# Regenerating top level configury
1588130561Sobrien# --------------------------------
1589130561Sobrien
1590130561Sobrien# Rebuilding Makefile.in, using autogen.
1591130561SobrienAUTOGEN = autogen
1592130561Sobrien$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1593130561Sobrien	cd $(srcdir) && $(AUTOGEN) Makefile.def
1594130561Sobrien
1595130561Sobrien# Rebuilding Makefile.
1596130561SobrienMakefile: $(srcdir)/Makefile.in config.status
1597130561Sobrien	CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1598130561Sobrien
1599218822Sdimconfig.status: configure
1600130561Sobrien	CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
1601130561Sobrien
1602130561Sobrien# Rebuilding configure.
1603130561SobrienAUTOCONF = autoconf
1604218822Sdim$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4
1605130561Sobrien	cd $(srcdir) && $(AUTOCONF)
1606130561Sobrien
1607130561Sobrien# ------------------------------
1608130561Sobrien# Special directives to GNU Make
1609130561Sobrien# ------------------------------
1610130561Sobrien
1611130561Sobrien# Don't pass command-line variables to submakes.
1612130561Sobrien.NOEXPORT:
1613130561SobrienMAKEOVERRIDES=
1614130561Sobrien
1615130561Sobrien# end of Makefile.in
1616