OSDN Git Service

* g++.dg/vect/vect.exp: Skip PowerPC targets not supporting
[pf3gnuchains/gcc-fork.git] / Makefile.tpl
1 [+ AutoGen5 template -*- Mode: Makefile -*-
2 in
3 +]
4
5 # Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
6 #
7 # Makefile for directory with subdirs to build.
8 #   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
9 #   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
10 #
11 # This file is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
15
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #
25
26 # -------------------------------
27 # Standard Autoconf-set variables
28 # -------------------------------
29 VPATH=@srcdir@
30
31 build_alias=@build_alias@
32 build=@build@
33 host_alias=@host_alias@
34 host=@host@
35 target_alias=@target_alias@
36 target=@target@
37
38 program_transform_name = @program_transform_name@
39
40 prefix = @prefix@
41 exec_prefix = @exec_prefix@
42
43 srcdir = @srcdir@
44
45 bindir = @bindir@
46 sbindir = @sbindir@
47 libexecdir = @libexecdir@
48 datadir = @datadir@
49 sysconfdir = @sysconfdir@
50 sharedstatedir = @sharedstatedir@
51 localstatedir = @localstatedir@
52 libdir = @libdir@
53 includedir = @includedir@
54 oldincludedir = @oldincludedir@
55 infodir = @infodir@
56 datarootdir = @datarootdir@
57 docdir = @docdir@
58 htmldir = @htmldir@
59 mandir = @mandir@
60 man1dir = $(mandir)/man1
61 man2dir = $(mandir)/man2
62 man3dir = $(mandir)/man3
63 man4dir = $(mandir)/man4
64 man5dir = $(mandir)/man5
65 man6dir = $(mandir)/man6
66 man7dir = $(mandir)/man7
67 man8dir = $(mandir)/man8
68 man9dir = $(mandir)/man9
69
70 INSTALL = @INSTALL@
71 INSTALL_PROGRAM = @INSTALL_PROGRAM@
72 INSTALL_SCRIPT = @INSTALL_SCRIPT@
73 INSTALL_DATA = @INSTALL_DATA@
74 LN = @LN@
75 LN_S = @LN_S@
76 MAINT = @MAINT@
77 MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
78 MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
79
80 # -------------------------------------------------
81 # Miscellaneous non-standard autoconf-set variables
82 # -------------------------------------------------
83
84 # The gcc driver likes to know the arguments it was configured with.
85 TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
86
87 tooldir = @tooldir@
88 build_tooldir = @build_tooldir@
89
90 GDB_NLM_DEPS = 
91
92 # This is the name of the environment variable used for the path to
93 # the libraries.
94 RPATH_ENVVAR = @RPATH_ENVVAR@
95
96 # Build programs are put under this directory.
97 BUILD_SUBDIR = @build_subdir@
98 # This is set by the configure script to the arguments to use when configuring
99 # directories built for the build system.
100 BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
101
102 # This is the list of variables to export in the environment when
103 # configuring any subdirectory.  It must also be exported whenever
104 # recursing into a build directory in case that directory's Makefile
105 # re-runs configure.
106 BASE_EXPORTS = \
107         FLEX="$(FLEX)"; export FLEX; \
108         LEX="$(LEX)"; export LEX; \
109         BISON="$(BISON)"; export BISON; \
110         YACC="$(YACC)"; export YACC; \
111         M4="$(M4)"; export M4; \
112         MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
113
114 # This is the list of variables to export in the environment when
115 # configuring subdirectories for the build system.
116 BUILD_EXPORTS = \
117         $(BASE_EXPORTS) \
118         AR="$(AR_FOR_BUILD)"; export AR; \
119         AS="$(AS_FOR_BUILD)"; export AS; \
120         CC="$(CC_FOR_BUILD)"; export CC; \
121         CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
122         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
123         CXX="$(CXX_FOR_BUILD)"; export CXX; \
124         CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
125         GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
126         GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
127         DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
128         LD="$(LD_FOR_BUILD)"; export LD; \
129         LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
130         NM="$(NM_FOR_BUILD)"; export NM; \
131         RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
132         WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES;
133
134 # This is the list of directories to built for the host system.
135 SUBDIRS = @configdirs@
136 # This is set by the configure script to the arguments to use when configuring
137 # directories built for the host system.
138 HOST_CONFIGARGS = @host_configargs@
139 # Host programs are put under this directory, which is . except if building
140 # with srcdir=..
141 HOST_SUBDIR = @host_subdir@
142 # This is the list of variables to export in the environment when
143 # configuring subdirectories for the host system.  We need to pass
144 # some to the GCC configure because of its hybrid host/target nature.
145 HOST_EXPORTS = \
146         $(BASE_EXPORTS) \
147         CC="$(CC)"; export CC; \
148         CFLAGS="$(CFLAGS)"; export CFLAGS; \
149         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
150         CXX="$(CXX)"; export CXX; \
151         CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
152         AR="$(AR)"; export AR; \
153         AS="$(AS)"; export AS; \
154         CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
155         DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
156         LD="$(LD)"; export LD; \
157         LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
158         NM="$(NM)"; export NM; \
159         RANLIB="$(RANLIB)"; export RANLIB; \
160         WINDRES="$(WINDRES)"; export WINDRES; \
161         OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
162         OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
163         AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
164         AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
165         GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
166         LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
167         NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
168         OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
169         RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
170         TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
171         GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
172         GMPINC="$(HOST_GMPINC)"; export GMPINC; \
173 @if gcc-bootstrap
174         $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
175 @endif gcc-bootstrap
176         $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
177
178 # Similar, for later GCC stages.
179 POSTSTAGE1_HOST_EXPORTS = \
180         $(HOST_EXPORTS) \
181         CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
182           -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
183         CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \
184           $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
185           -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
186           -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
187         CFLAGS="$(BOOT_CFLAGS)"; export CFLAGS; \
188         LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
189
190 # Target libraries are put under this directory:
191 TARGET_SUBDIR = @target_subdir@
192 # This is set by the configure script to the arguments to use when configuring
193 # directories built for the target.
194 TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
195 # This is the list of variables to export in the environment when
196 # configuring subdirectories for the host system.
197 BASE_TARGET_EXPORTS = \
198         $(BASE_EXPORTS) \
199         AR="$(AR_FOR_TARGET)"; export AR; \
200         AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
201         CC="$(CC_FOR_TARGET)"; export CC; \
202         CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
203         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
204         CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
205         CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
206         GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
207         GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
208         DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
209         LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
210         LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
211         LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
212         NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
213         OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
214         RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
215         STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
216         WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
217         $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
218
219 RAW_CXX_TARGET_EXPORTS = \
220         $(BASE_TARGET_EXPORTS) \
221         CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
222         CXX="$(RAW_CXX_FOR_TARGET)"; export CXX;
223
224 NORMAL_TARGET_EXPORTS = \
225         $(BASE_TARGET_EXPORTS) \
226         CXX="$(CXX_FOR_TARGET)"; export CXX;
227
228 # Where to find GMP
229 HOST_GMPLIBS = @gmplibs@
230 HOST_GMPINC = @gmpinc@
231
232 # ----------------------------------------------
233 # Programs producing files for the BUILD machine
234 # ----------------------------------------------
235
236 SHELL = @config_shell@
237
238 # pwd command to use.  Allow user to override default by setting PWDCMD in
239 # the environment to account for automounters.  The make variable must not
240 # be called PWDCMD, otherwise the value set here is passed to make
241 # subprocesses and overrides the setting from the user's environment.
242 # Don't use PWD since it is a common shell environment variable and we
243 # don't want to corrupt it.
244 PWD_COMMAND = $${PWDCMD-pwd}
245
246 # compilers to use to create programs which must be run in the build
247 # environment.
248 CC_FOR_BUILD = @CC_FOR_BUILD@
249 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
250
251 CXX_FOR_BUILD = $(CXX)
252
253 # Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
254 # here so that they can be overridden by Makefile fragments.
255 BUILD_PREFIX = @BUILD_PREFIX@
256 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
257
258 # Flags to pass to stage2 and later makes.  They are defined
259 # here so that they can be overridden by Makefile fragments.
260 BOOT_CFLAGS= -g -O2
261 BOOT_LDFLAGS=
262
263 BISON = @BISON@
264 YACC = @YACC@
265 FLEX = @FLEX@
266 LEX = @LEX@
267 M4 = @M4@
268 MAKEINFO = @MAKEINFO@
269 EXPECT = @EXPECT@
270 RUNTEST = @RUNTEST@
271
272 # This just becomes part of the MAKEINFO definition passed down to
273 # sub-makes.  It lets flags be given on the command line while still
274 # using the makeinfo from the object tree.
275 # (Default to avoid splitting info files by setting the threshold high.)
276 MAKEINFOFLAGS = --split-size=5000000
277
278 # ---------------------------------------------
279 # Programs producing files for the HOST machine
280 # ---------------------------------------------
281
282 AS = @AS@
283 AR = @AR@
284 AR_FLAGS = rc
285 CC = @CC@
286 CXX = @CXX@
287 DLLTOOL = @DLLTOOL@
288 LD = @LD@
289 LIPO = @LIPO@
290 NM = @NM@
291 OBJDUMP = @OBJDUMP@
292 RANLIB = @RANLIB@
293 STRIP = @STRIP@
294 WINDRES = @WINDRES@
295
296 CFLAGS = @CFLAGS@
297 LDFLAGS = 
298 LIBCFLAGS = $(CFLAGS)
299 CXXFLAGS = @CXXFLAGS@
300 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
301 PICFLAG = 
302
303 # Only build the C compiler for stage1, because that is the only one that
304 # we can guarantee will build with the native compiler, and also it is the
305 # only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
306 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
307 # overrideable (for a bootstrap build stage1 also builds gcc.info).
308
309 STAGE1_CFLAGS=@stage1_cflags@
310 STAGE1_CHECKING=@stage1_checking@
311 STAGE1_LANGUAGES=@stage1_languages@
312
313 # -----------------------------------------------
314 # Programs producing files for the TARGET machine
315 # -----------------------------------------------
316
317 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
318
319 AR_FOR_TARGET=@AR_FOR_TARGET@
320 AS_FOR_TARGET=@AS_FOR_TARGET@
321 CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
322
323 # If GCC_FOR_TARGET is not overriden on the command line, then this
324 # variable is passed down to the gcc Makefile, where it is used to
325 # build libgcc2.a.  We define it here so that it can itself be
326 # overridden on the command line.
327 GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
328 CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
329 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
330 GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
331 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
332 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
333 LD_FOR_TARGET=@LD_FOR_TARGET@
334
335 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
336 NM_FOR_TARGET=@NM_FOR_TARGET@
337 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
338 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
339 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
340 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
341
342 COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
343 COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
344 COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
345
346 # During gcc bootstrap, if we use some random cc for stage1 then
347 # CFLAGS will be just -g.  We want to ensure that TARGET libraries
348 # (which we know are built with gcc) are built with optimizations so
349 # prepend -O2 when setting CFLAGS_FOR_TARGET.
350 CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
351 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
352 CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
353 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
354 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
355 LDFLAGS_FOR_TARGET = 
356 PICFLAG_FOR_TARGET = 
357
358 # ------------------------------------
359 # Miscellaneous targets and flag lists
360 # ------------------------------------
361
362 # The first rule in the file had better be this one.  Don't put any above it.
363 # This lives here to allow makefile fragments to contain dependencies.
364 all:
365
366 #### host and target specific makefile fragments come in here.
367 @target_makefile_frag@
368 @alphaieee_frag@
369 @ospace_frag@
370 @host_makefile_frag@
371 ###
372
373 # This is the list of directories that may be needed in RPATH_ENVVAR
374 # so that prorgams built for the target machine work.
375 TARGET_LIB_PATH = [+ FOR target_modules +][+
376   IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
377   ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
378 [+ FOR target_modules +][+ IF lib_path +]
379 @if target-[+module+]
380 TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
381 @endif target-[+module+]
382 [+ ENDIF lib_path +][+ ENDFOR target_modules +]
383
384
385 # This is the list of directories that may be needed in RPATH_ENVVAR
386 # so that programs built for the host machine work.
387 HOST_LIB_PATH = [+ FOR host_modules +][+
388   IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
389   ENDFOR host_modules +]
390
391 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
392 @if gcc
393 HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
394 @endif gcc
395
396 [+ FOR host_modules +][+ IF lib_path +]
397 @if [+module+]
398 HOST_LIB_PATH_[+module+] = \
399   $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
400   +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
401 @endif [+module+]
402 [+ ENDIF lib_path +][+ ENDFOR host_modules +]
403
404 # Flags to pass down to all sub-makes.
405 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
406         "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
407         "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +] \
408         "CONFIG_SHELL=$(SHELL)" \
409         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" 
410
411 # We leave this in just in case, but it is not needed anymore.
412 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
413
414 # Flags to pass down to most sub-makes, in which we're building with
415 # the host environment.
416 EXTRA_HOST_FLAGS = \
417         'AR=$(AR)' \
418         'AS=$(AS)' \
419         'CC=$(CC)' \
420         'CXX=$(CXX)' \
421         'DLLTOOL=$(DLLTOOL)' \
422         'LD=$(LD)' \
423         'LIPO=$(LIPO)' \
424         'NM=$(NM)' \
425         'OBJDUMP=$(OBJDUMP)' \
426         'RANLIB=$(RANLIB)' \
427         'STRIP=$(STRIP)' \
428         'WINDRES=$(WINDRES)'
429
430 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
431
432 # Flags that are concerned with the location of the X11 include files
433 # and library files
434 #
435 # NOTE: until the top-level is getting the values via autoconf, it only
436 # causes problems to have this top-level Makefile overriding the autoconf-set
437 # values in child directories.  Only variables that don't conflict with
438 # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
439 #
440 X11_FLAGS_TO_PASS = \
441         'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
442         'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
443
444 # Flags to pass to stage2 and later makes.
445
446 POSTSTAGE1_FLAGS_TO_PASS = \
447         CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
448         STAGE_PREFIX="$$r/$(HOST_SUBDIR)/prev-gcc/" \
449         CFLAGS="$(BOOT_CFLAGS)" \
450         LIBCFLAGS="$(BOOT_CFLAGS)" \
451         LDFLAGS="$(BOOT_LDFLAGS)" \
452         "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
453
454 # Flags to pass down to makes which are built with the target environment.
455 # The double $ decreases the length of the command line; those variables
456 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.  The
457 # COMPILER_ prefixed variables are not passed down so we expand them here.
458 EXTRA_TARGET_FLAGS = \
459         'AR=$$(AR_FOR_TARGET)' \
460         'AS=$(COMPILER_AS_FOR_TARGET)' \
461         'CC=$$(CC_FOR_TARGET)' \
462         'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
463         'CXX=$$(CXX_FOR_TARGET)' \
464         'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
465         'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
466         'LD=$(COMPILER_LD_FOR_TARGET)' \
467         'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
468         'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
469         'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
470         'NM=$(COMPILER_NM_FOR_TARGET)' \
471         'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
472         'RANLIB=$$(RANLIB_FOR_TARGET)' \
473         'WINDRES=$$(WINDRES_FOR_TARGET)'
474
475 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
476
477 # Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
478 # unfortunately needs the native compiler and the target ar and
479 # ranlib.
480 # If any variables are added here, they must be added to do-*, below.
481 # The BUILD_* variables are a special case, which are used for the gcc
482 # cross-building scheme.
483 EXTRA_GCC_FLAGS = \
484         "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
485         "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
486         "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
487         "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
488         "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
489         "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
490
491 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
492
493 .PHONY: configure-host
494 configure-host: [+
495   FOR host_modules +] \
496     maybe-configure-[+module+][+
497   ENDFOR host_modules +]
498 .PHONY: configure-target
499 configure-target: [+
500   FOR target_modules +] \
501     maybe-configure-target-[+module+][+
502   ENDFOR target_modules +]
503
504 # The target built for a native non-bootstrap build.
505 .PHONY: all
506 all:
507 @if gcc-bootstrap
508         [ -f stage_final ] || echo stage3 > stage_final
509         @r=`${PWD_COMMAND}`; export r; \
510         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
511         $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
512 @endif gcc-bootstrap
513         @: $(MAKE); $(unstage)
514         @r=`${PWD_COMMAND}`; export r; \
515         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
516         if [ -f stage_last ]; then \
517           $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
518         else \
519           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
520         fi
521
522 .PHONY: all-build
523 [+ FOR build_modules +]
524 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
525
526 .PHONY: all-host
527 [+ FOR host_modules +][+ IF bootstrap +]
528 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
529 all-host: maybe-all-[+module+][+ IF bootstrap +]
530 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
531
532 .PHONY: all-target
533 [+ FOR target_modules +][+ IF bootstrap +]
534 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
535 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
536 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR target_modules +]
537
538 # Do a target for all the subdirectories.  A ``make do-X'' will do a
539 # ``make X'' in all subdirectories (because, in general, there is a
540 # dependency (below) of X upon do-X, a ``make X'' will also do this,
541 # but it may do additional work as well).
542 [+ FOR recursive_targets +]
543 .PHONY: do-[+make_target+]
544 do-[+make_target+]:
545         @: $(MAKE); $(unstage)
546         @r=`${PWD_COMMAND}`; export r; \
547         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
548         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
549           [+make_target+]-target
550
551
552 .PHONY: [+make_target+]-host
553 [+ FOR host_modules +]
554 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
555
556 .PHONY: [+make_target+]-target
557 [+ FOR target_modules +]
558 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
559 [+ ENDFOR recursive_targets +]
560
561 # Here are the targets which correspond to the do-X targets.
562
563 .PHONY: info installcheck dvi pdf html install-info install-html
564 .PHONY: clean distclean mostlyclean maintainer-clean realclean
565 .PHONY: local-clean local-distclean local-maintainer-clean
566 info: do-info
567 installcheck: do-installcheck
568 dvi: do-dvi
569 pdf: do-pdf
570 html: do-html
571
572 # Make sure makeinfo is built before we do a `make info', if we're
573 # in fact building texinfo.
574 do-info: maybe-all-texinfo
575
576 install-info: do-install-info dir.info
577         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
578         if [ -f dir.info ] ; then \
579           $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
580         else true ; fi
581
582 install-html: do-install-html
583
584 local-clean:
585         -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
586
587 local-distclean:
588         -rm -f Makefile config.status config.cache mh-frag mt-frag
589         -rm -f maybedep.tmp serdep.tmp
590         -if [ "$(TARGET_SUBDIR)" != "." ]; then \
591           rm -rf $(TARGET_SUBDIR); \
592         else true; fi
593         -rm -rf $(BUILD_SUBDIR)
594         -if [ "$(HOST_SUBDIR)" != "." ]; then \
595           rm -rf $(HOST_SUBDIR); \
596         else true; fi
597         -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
598         -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
599         -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
600         -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
601         -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
602
603 local-maintainer-clean:
604         @echo "This command is intended for maintainers to use;"
605         @echo "it deletes files that may require special tools to rebuild."
606
607 clean: do-clean local-clean
608 mostlyclean: do-mostlyclean local-clean
609 distclean: do-distclean local-clean local-distclean
610 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
611 maintainer-clean: local-distclean
612 realclean: maintainer-clean
613
614 # Extra dependency for clean-target, owing to the mixed nature of gcc.
615 clean-target: clean-target-libgcc
616 clean-target-libgcc:
617         if test -f gcc/Makefile; then cd gcc && $(MAKE) $@; else :; fi
618
619 # Check target.
620
621 .PHONY: check do-check
622 check: do-check
623
624 # Only include modules actually being configured and built.
625 .PHONY: check-host
626 check-host: [+
627   FOR host_modules +] \
628     maybe-check-[+module+][+
629   ENDFOR host_modules +]
630
631 .PHONY: check-target
632 check-target: [+
633   FOR target_modules +] \
634     maybe-check-target-[+module+][+
635   ENDFOR target_modules +]
636
637 do-check:
638         @: $(MAKE); $(unstage)
639         @r=`${PWD_COMMAND}`; export r; \
640         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
641         $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
642
643 # Automated reporting of test results.
644
645 warning.log: build.log
646         $(srcdir)/contrib/warn_summary build.log > $@
647
648 mail-report.log:
649         if test x'$(BOOT_CFLAGS)' != x''; then \
650             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
651         fi; \
652         $(srcdir)/contrib/test_summary -t >$@
653         chmod +x $@
654         echo If you really want to send e-mail, run ./$@ now
655
656 mail-report-with-warnings.log: warning.log
657         if test x'$(BOOT_CFLAGS)' != x''; then \
658             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
659         fi; \
660         $(srcdir)/contrib/test_summary -t -i warning.log >$@
661         chmod +x $@
662         echo If you really want to send e-mail, run ./$@ now
663
664 # Installation targets.
665
666 .PHONY: install uninstall
667 install:
668         @: $(MAKE); $(unstage)
669         @r=`${PWD_COMMAND}`; export r; \
670         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
671         $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
672
673 .PHONY: install-host-nogcc
674 install-host-nogcc: [+
675   FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
676     maybe-install-[+module+][+ ENDIF +][+
677   ENDFOR host_modules +]
678
679 .PHONY: install-host
680 install-host: [+
681   FOR host_modules +] \
682     maybe-install-[+module+][+
683   ENDFOR host_modules +]
684
685 .PHONY: install-target
686 install-target: [+
687   FOR target_modules +] \
688     maybe-install-target-[+module+][+
689   ENDFOR target_modules +]
690
691 uninstall:
692         @echo "the uninstall target is not supported in this tree"
693
694 .PHONY: install.all
695 install.all: install-no-fixedincludes
696         @if [ -f ./gcc/Makefile ] ; then \
697                 r=`${PWD_COMMAND}` ; export r ; \
698                 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
699                 $(HOST_EXPORTS) \
700                 (cd ./gcc && \
701                 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
702         else \
703                 true ; \
704         fi
705
706 # install-no-fixedincludes is used because Cygnus can not distribute
707 # the fixed header files.
708 .PHONY: install-no-fixedincludes
709 install-no-fixedincludes: installdirs install-host-nogcc \
710         install-target gcc-no-fixedincludes
711
712 ### other supporting targets
713
714 MAKEDIRS= \
715         $(DESTDIR)$(prefix) \
716         $(DESTDIR)$(exec_prefix)
717 .PHONY: installdirs
718 installdirs: mkinstalldirs
719         $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
720
721 dir.info: do-install-info
722         if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
723           $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
724           mv -f dir.info.new dir.info ; \
725         else true ; \
726         fi
727
728 dist:
729         @echo "Building a full distribution of this tree isn't done"
730         @echo "via 'make dist'.  Check out the etc/ subdirectory" 
731
732 etags tags: TAGS
733
734 # Right now this just builds TAGS in each subdirectory.  emacs19 has the
735 # ability to use several tags files at once, so there is probably no need
736 # to combine them into one big TAGS file (like CVS 1.3 does).  We could
737 # (if we felt like it) have this Makefile write a piece of elisp which
738 # the user could load to tell emacs19 where all the TAGS files we just
739 # built are.
740 TAGS: do-TAGS
741
742 # ------------------------------------
743 # Macros for configure and all targets
744 # ------------------------------------
745
746 [+ DEFINE configure +]
747 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
748 maybe-configure-[+prefix+][+module+]:
749 @if gcc-bootstrap
750 configure-[+prefix+][+module+]: stage_current
751 @endif gcc-bootstrap
752 @if [+prefix+][+module+]
753 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
754 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
755         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
756         @r=`${PWD_COMMAND}`; export r; \
757         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
758         [+ IF check_multilibs
759         +]echo "Checking multilib configuration for [+module+]..."; \
760         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
761         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
762         if test -r [+subdir+]/[+module+]/multilib.out; then \
763           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
764             rm -f [+subdir+]/[+module+]/multilib.tmp; \
765           else \
766             rm -f [+subdir+]/[+module+]/Makefile; \
767             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
768           fi; \
769         else \
770           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
771         fi; \
772         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
773         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
774         [+exports+] \
775         echo Configuring in [+subdir+]/[+module+]; \
776         cd "[+subdir+]/[+module+]" || exit 1; \
777         case $(srcdir) in \
778           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
779           *) topdir=`echo [+subdir+]/[+module+]/ | \
780                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
781         esac; \
782         srcdiroption="--srcdir=$${topdir}/[+module+]"; \
783         libsrcdir="$$s/[+module+]"; \
784         [+ IF no-config-site +]rm -f no-such-file || : ; \
785         CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
786           [+args+] $${srcdiroption} [+extra_configure_flags+] \
787           || exit 1
788 @endif [+prefix+][+module+]
789
790 [+ IF bootstrap +]
791 [+ FOR bootstrap_stage +]
792 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
793 maybe-configure-stage[+id+]-[+prefix+][+module+]:
794 @if [+prefix+][+module+]-bootstrap
795 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
796 configure-stage[+id+]-[+prefix+][+module+]:
797         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
798         @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
799         @r=`${PWD_COMMAND}`; export r; \
800         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
801         [+ IF check_multilibs
802         +]echo "Checking multilib configuration for [+module+]..."; \
803         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
804         if test -r [+subdir+]/[+module+]/multilib.out; then \
805           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
806             rm -f [+subdir+]/[+module+]/multilib.tmp; \
807           else \
808             rm -f [+subdir+]/[+module+]/Makefile; \
809             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
810           fi; \
811         else \
812           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
813         fi; \
814         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
815         [+exports+][+ IF prev +] \
816         [+poststage1_exports+][+ ENDIF prev +] \
817         echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
818         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
819         cd [+subdir+]/[+module+] || exit 1; \
820         case $(srcdir) in \
821           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
822           *) topdir=`echo [+subdir+]/[+module+]/ | \
823                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
824         esac; \
825         srcdiroption="--srcdir=$${topdir}/[+module+]"; \
826         libsrcdir="$$s/[+module+]"; \
827         $(SHELL) $${libsrcdir}/configure \
828           [+args+] $${srcdiroption} \
829           [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
830           [+stage_configure_flags+] [+extra_configure_flags+]
831 @endif [+prefix+][+module+]-bootstrap
832 [+ ENDFOR bootstrap_stage +]
833 [+ ENDIF bootstrap +]
834 [+ ENDDEF +]
835
836 [+ DEFINE all +]
837 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
838 maybe-all-[+prefix+][+module+]:
839 @if gcc-bootstrap
840 all-[+prefix+][+module+]: stage_current
841 @endif gcc-bootstrap
842 @if [+prefix+][+module+]
843 TARGET-[+prefix+][+module+]=[+
844   IF target +][+target+][+ ELSE +]all[+ ENDIF target +]
845 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
846 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
847         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
848         @r=`${PWD_COMMAND}`; export r; \
849         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
850         [+exports+] \
851         (cd [+subdir+]/[+module+] && \
852           $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
853 @endif [+prefix+][+module+]
854
855 [+ IF bootstrap +]
856 [+ FOR bootstrap_stage +]
857 .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
858 .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
859 maybe-all-stage[+id+]-[+prefix+][+module+]:
860 maybe-clean-stage[+id+]-[+prefix+][+module+]:
861 @if [+prefix+][+module+]-bootstrap
862 maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
863 all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
864 TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
865 all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
866         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
867         @r=`${PWD_COMMAND}`; export r; \
868         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
869         [+exports+][+ IF prev +] \
870         [+poststage1_exports+][+ ENDIF prev +] \
871         cd [+subdir+]/[+module+] && \
872         $(MAKE) [+args+] [+ IF prev
873                 +][+poststage1_args+][+ ENDIF prev
874                 +] [+stage_make_flags+] [+extra_make_flags+] \
875                 $(TARGET-stage[+id+]-[+prefix+][+module+])
876
877 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
878 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
879 clean-stage[+id+]-[+prefix+][+module+]:
880         @if [ $(current_stage) = stage[+id+] ]; then \
881           [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
882         else \
883           [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
884           $(MAKE) stage[+id+]-start; \
885         fi; \
886         cd [+subdir+]/[+module+] && \
887         $(MAKE) [+args+] [+ IF prev +] \
888                 [+poststage1_args+] [+ ENDIF prev +] \
889                 [+stage_make_flags+] [+extra_make_flags+] clean
890 @endif [+prefix+][+module+]-bootstrap
891
892 [+ ENDFOR bootstrap_stage +]
893 [+ ENDIF bootstrap +]
894 [+ ENDDEF +]
895
896 # --------------------------------------
897 # Modules which run on the build machine
898 # --------------------------------------
899 [+ FOR build_modules +]
900 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
901              args="$(BUILD_CONFIGARGS)" no-config-site=true +]
902
903 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
904 [+ ENDFOR build_module +]
905
906 # --------------------------------------
907 # Modules which run on the host machine
908 # --------------------------------------
909 [+ FOR host_modules +]
910 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
911              exports="$(HOST_EXPORTS)"
912              poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
913              args="$(HOST_CONFIGARGS)" +]
914
915 [+ all prefix="" subdir="$(HOST_SUBDIR)"
916        exports="$(HOST_EXPORTS)"
917        poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
918        args="$(FLAGS_TO_PASS)"
919        poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
920
921 .PHONY: check-[+module+] maybe-check-[+module+]
922 maybe-check-[+module+]:
923 @if [+module+]
924 maybe-check-[+module+]: check-[+module+]
925 [+ IF no_check +]
926 check-[+module+]:
927 [+ ELIF no_check_cross +]
928 # This module is only tested in a native toolchain.
929 check-[+module+]:
930         @: $(MAKE); $(unstage)
931         @if [ '$(host)' = '$(target)' ] ; then \
932           r=`${PWD_COMMAND}`; export r; \
933           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
934           $(HOST_EXPORTS) \
935           (cd $(HOST_SUBDIR)/[+module+] && \
936             $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
937         fi
938 [+ ELSE check +]
939 check-[+module+]:
940         @: $(MAKE); $(unstage)
941         @r=`${PWD_COMMAND}`; export r; \
942         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
943         $(HOST_EXPORTS) \
944         (cd $(HOST_SUBDIR)/[+module+] && \
945           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
946 [+ ENDIF no_check +]
947 @endif [+module+]
948
949 .PHONY: install-[+module+] maybe-install-[+module+]
950 maybe-install-[+module+]:
951 @if [+module+]
952 maybe-install-[+module+]: install-[+module+]
953 [+ IF no_install +]
954 install-[+module+]:
955 [+ ELSE install +]
956 install-[+module+]: installdirs
957         @: $(MAKE); $(unstage)
958         @r=`${PWD_COMMAND}`; export r; \
959         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
960         $(HOST_EXPORTS) \
961         (cd $(HOST_SUBDIR)/[+module+] && \
962           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
963 [+ ENDIF no_install +]
964 @endif [+module+]
965
966 # Other targets (info, dvi, pdf, etc.)
967 [+ FOR recursive_targets +]
968 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
969 maybe-[+make_target+]-[+module+]:
970 @if [+module+]
971 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
972 [+ IF (match-value? = "missing" (get "make_target") ) +]
973 # [+module+] doesn't support [+make_target+].
974 [+make_target+]-[+module+]:
975 [+ ELSE +]
976 [+make_target+]-[+module+]: [+
977   FOR depend +]\
978     [+depend+]-[+module+] [+
979   ENDFOR depend +]
980         @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
981         @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
982         r=`${PWD_COMMAND}`; export r; \
983         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
984         $(HOST_EXPORTS) \
985         for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
986           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
987         done; \
988         echo "Doing [+make_target+] in [+module+]" ; \
989         (cd $(HOST_SUBDIR)/[+module+] && \
990           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
991                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
992                   "RANLIB=$${RANLIB}" \
993                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
994                   [+make_target+]) \
995           || exit 1
996 [+ ENDIF +]
997 @endif [+module+]
998 [+ ENDFOR recursive_targets +]
999 [+ ENDFOR host_modules +]
1000
1001 # ---------------------------------------
1002 # Modules which run on the target machine
1003 # ---------------------------------------
1004 [+ FOR target_modules +]
1005
1006 [+ IF raw_cxx +]
1007 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1008              check_multilibs=true
1009              exports="$(RAW_CXX_TARGET_EXPORTS)"
1010              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1011
1012 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1013        exports="$(RAW_CXX_TARGET_EXPORTS)"
1014        args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1015 [+ ELSE +]
1016 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1017              check_multilibs=true
1018              exports="$(NORMAL_TARGET_EXPORTS)"
1019              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1020
1021 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1022        exports="$(NORMAL_TARGET_EXPORTS)"
1023        args="$(TARGET_FLAGS_TO_PASS)" +]
1024 [+ ENDIF +]
1025
1026 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1027 maybe-check-target-[+module+]:
1028 @if target-[+module+]
1029 maybe-check-target-[+module+]: check-target-[+module+]
1030 [+ IF no_check +]
1031 # Dummy target for uncheckable module.
1032 check-target-[+module+]:
1033 [+ ELSE check +]
1034 check-target-[+module+]:
1035         @: $(MAKE); $(unstage)
1036         @r=`${PWD_COMMAND}`; export r; \
1037         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1038 IF raw_cxx +]
1039         $(RAW_CXX_TARGET_EXPORTS) \[+
1040 ELSE normal_cxx +]
1041         $(NORMAL_TARGET_EXPORTS) \[+
1042 ENDIF raw_cxx +]
1043         (cd $(TARGET_SUBDIR)/[+module+] && \
1044           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1045             IF raw_cxx 
1046               +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1047             ENDIF raw_cxx 
1048           +] [+extra_make_flags+] check)
1049 [+ ENDIF no_check +]
1050 @endif target-[+module+]
1051
1052 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1053 maybe-install-target-[+module+]:
1054 @if target-[+module+]
1055 maybe-install-target-[+module+]: install-target-[+module+]
1056 [+ IF no_install +]
1057 # Dummy target for uninstallable.
1058 install-target-[+module+]:
1059 [+ ELSE install +]
1060 install-target-[+module+]: installdirs
1061         @: $(MAKE); $(unstage)
1062         @r=`${PWD_COMMAND}`; export r; \
1063         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1064 IF raw_cxx +]
1065         $(RAW_CXX_TARGET_EXPORTS) \[+
1066 ELSE normal_cxx +]
1067         $(NORMAL_TARGET_EXPORTS) \[+
1068 ENDIF raw_cxx +]
1069         (cd $(TARGET_SUBDIR)/[+module+] && \
1070           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1071 [+ ENDIF no_install +]
1072 @endif target-[+module+]
1073
1074 # Other targets (info, dvi, pdf, etc.)
1075 [+ FOR recursive_targets +]
1076 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1077 maybe-[+make_target+]-target-[+module+]:
1078 @if target-[+module+]
1079 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1080 [+ IF (match-value? = "missing" (get "make_target") ) +]
1081 # [+module+] doesn't support [+make_target+].
1082 [+make_target+]-target-[+module+]:
1083 [+ ELSE +]
1084 [+make_target+]-target-[+module+]: [+
1085   FOR depend +]\
1086     [+depend+]-target-[+module+] [+
1087   ENDFOR depend +]
1088         @: $(MAKE); $(unstage)
1089         @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1090         r=`${PWD_COMMAND}`; export r; \
1091         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1092 IF raw_cxx +]
1093         $(RAW_CXX_TARGET_EXPORTS) \[+
1094 ELSE normal_cxx +]
1095         $(NORMAL_TARGET_EXPORTS) \[+
1096 ENDIF raw_cxx +]
1097         echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1098         for flag in $(EXTRA_TARGET_FLAGS); do \
1099           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1100         done; \
1101         (cd $(TARGET_SUBDIR)/[+module+] && \
1102           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1103                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1104                   "RANLIB=$${RANLIB}" \
1105                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
1106                   [+extra_make_flags+] [+make_target+]) \
1107           || exit 1
1108 [+ ENDIF +]
1109 @endif target-[+module+]
1110 [+ ENDFOR recursive_targets +]
1111 [+ ENDFOR target_modules +]
1112
1113 # ----------
1114 # GCC module
1115 # ----------
1116
1117 @if gcc-no-bootstrap
1118 .PHONY: cross
1119 cross: all-build all-gas all-ld
1120         @r=`${PWD_COMMAND}`; export r; \
1121         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1122         $(HOST_EXPORTS) \
1123         echo "Building the C and C++ compiler"; \
1124         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1125         @r=`${PWD_COMMAND}`; export r; \
1126         s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1127         echo "Building runtime libraries"; \
1128         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1129 @endif gcc-no-bootstrap
1130
1131 @if gcc
1132 .PHONY: check-gcc-c++
1133 check-gcc-c++:
1134         @if [ -f ./gcc/Makefile ] ; then \
1135           r=`${PWD_COMMAND}`; export r; \
1136           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1137           $(HOST_EXPORTS) \
1138           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
1139         else \
1140           true; \
1141         fi
1142
1143 .PHONY: check-c++
1144 check-c++: check-target-libstdc++-v3 check-gcc-c++
1145
1146 # Install the gcc headers files, but not the fixed include files,
1147 # which Cygnus is not allowed to distribute.  This rule is very
1148 # dependent on the workings of the gcc Makefile.in.
1149 .PHONY: gcc-no-fixedincludes
1150 gcc-no-fixedincludes:
1151         @if [ -f ./gcc/Makefile ]; then \
1152           rm -rf gcc/tmp-include; \
1153           mv gcc/include gcc/tmp-include 2>/dev/null; \
1154           mkdir gcc/include; \
1155           cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1156           touch gcc/stmp-fixinc gcc/include/fixed; \
1157           rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1158           r=`${PWD_COMMAND}`; export r; \
1159           s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1160           $(HOST_EXPORTS) \
1161           (cd ./gcc && \
1162            $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1163           rm -rf gcc/include; \
1164           mv gcc/tmp-include gcc/include 2>/dev/null; \
1165         else true; fi
1166 @endif gcc
1167
1168 # ---------------------
1169 # GCC bootstrap support
1170 # ---------------------
1171
1172 # We track the current stage (the one in 'gcc') in the stage_current file.
1173 # stage_last instead tracks the stage that was built last.  These targets
1174 # are dummy when toplevel bootstrap is not active.
1175
1176 # While making host and target tools, symlinks to the final stage must be
1177 # there, so $(unstage) should be run at various points.  To avoid excessive
1178 # recursive invocations of make, we "inline" them using a variable.  These
1179 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1180 # to avoid warnings from the GNU Make job server.
1181
1182 unstage = :
1183 stage = :
1184 current_stage = ""
1185
1186 @if gcc-bootstrap
1187 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1188 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1189 current_stage = "`cat stage_current 2> /dev/null`"
1190 @endif gcc-bootstrap
1191
1192 .PHONY: unstage stage
1193 unstage:
1194         @: $(MAKE); $(unstage)
1195 stage:
1196         @: $(MAKE); $(stage)
1197
1198 # Disable commands for lean bootstrap.
1199 LEAN = false
1200
1201 # We name the build directories for the various stages "stage1-gcc",
1202 # "stage2-gcc","stage3-gcc", etc.
1203
1204 # Since the 'compare' process will fail (on debugging information) if any
1205 # directory names are different, we need to link the gcc directory for
1206 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1207 # the build directories constant as well. For the latter, we use naked names
1208 # like 'gcc', because the scripts in that directory assume it.  We use
1209 # mv on platforms where symlinks to directories do not work or are not
1210 # reliable.
1211
1212 # 'touch' doesn't work right on some platforms.
1213 STAMP = echo timestamp > 
1214
1215 # We only want to compare .o files, so set this!
1216 objext = .o
1217
1218 [+ FOR bootstrap-stage +]
1219 .PHONY: stage[+id+]-start stage[+id+]-end
1220
1221 stage[+id+]-start::
1222         @: $(MAKE); $(stage); \
1223         echo stage[+id+] > stage_current ; \
1224         echo stage[+id+] > stage_last; \
1225         $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1226    FOR host_modules +][+ IF bootstrap +]
1227 @if [+ module +]
1228         @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1229           mkdir stage[+id+]-[+module+]; \
1230         mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1231         mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1232 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1233         @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1234           mkdir stage[+id+]-$(TARGET_SUBDIR); \
1235         mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1236         mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1237
1238 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1239 @if [+ module +]
1240         @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1241           cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1242           mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
1243         fi
1244 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1245         @if test -d $(TARGET_SUBDIR) ; then \
1246           mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1247           mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
1248         fi
1249         rm -f stage_current
1250
1251 # Bubble a bugfix through all the stages up to stage [+id+].  They are
1252 # remade, but not reconfigured.  The next stage (if any) will not be
1253 # reconfigured as well.
1254 .PHONY: stage[+id+]-bubble
1255 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1256         @r=`${PWD_COMMAND}`; export r; \
1257         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1258         if test -f stage[+id+]-lean [+
1259           IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1260           echo Skipping rebuild of stage[+id+] ; \
1261         else \
1262           $(MAKE) stage[+id+]-start; \[+IF lean +]
1263           if $(LEAN); then \
1264             rm -rf stage[+lean+]-* ; \
1265             $(STAMP) stage[+lean+]-lean ; \
1266           fi; \[+ ENDIF lean +]
1267           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1268         fi[+ IF compare-target +]
1269         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1270
1271 .PHONY: all-stage[+id+] clean-stage[+id+]
1272 do-clean: clean-stage[+id+]
1273
1274 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1275 # only possibility, but now it conflicts with no-bootstrap rules
1276 @if gcc-bootstrap
1277 [+ IF compare-target +]
1278 [+compare-target+]:
1279         @r=`${PWD_COMMAND}`; export r; \
1280         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1281         if test -f stage[+prev+]-lean; then \
1282           echo Cannot compare object files as stage [+prev+] was deleted. ; \
1283           exit 0 ; \
1284         fi; \
1285         : $(MAKE); $(stage); \
1286         rm -f .bad_compare ; \
1287         echo Comparing stages [+prev+] and [+id+] ; \
1288         cd stage[+id+]-gcc; \
1289         files=`find . -name "*$(objext)" -print` ; \
1290         cd .. ; \
1291         for file in $${files} ; do \
1292           f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
1293           @do_compare@ > /dev/null 2>&1; \
1294           if test $$? -eq 1; then \
1295             case $$file in \
1296               ./cc*-checksum$(objext) | ./libgcc/* ) \
1297                 echo warning: $$file differs ;; \
1298               *) \
1299                 echo $$file differs >> .bad_compare ;; \
1300             esac ; \
1301           fi ; \
1302         done ; \
1303         if [ -f .bad_compare ]; then \
1304           echo "Bootstrap comparison failure!"; \
1305           cat .bad_compare; \
1306           exit 1; \
1307         else \
1308           echo Comparison successful.; \
1309         fi ; \
1310         $(STAMP) [+compare-target+][+ IF prev +]
1311         if $(LEAN); then \
1312           rm -rf stage[+prev+]-*; \
1313           $(STAMP) stage[+prev+]-lean; \
1314         fi[+ ENDIF prev +]
1315 [+ ENDIF compare-target +]
1316
1317 [+ IF bootstrap-target +]
1318 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1319 [+bootstrap-target+]:
1320         echo stage[+id+] > stage_final
1321         @r=`${PWD_COMMAND}`; export r; \
1322         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1323         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1324         @: $(MAKE); $(unstage)
1325         @r=`${PWD_COMMAND}`; export r; \
1326         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1327         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1328
1329 [+bootstrap-target+]-lean:
1330         echo stage[+id+] > stage_final
1331         @r=`${PWD_COMMAND}`; export r; \
1332         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1333         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1334         @: $(MAKE); $(unstage)
1335         @r=`${PWD_COMMAND}`; export r; \
1336         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1337         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1338 [+ ENDIF bootstrap-target +]
1339
1340 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1341 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1342 .PHONY: distclean-stage[+id+]
1343 distclean-stage[+id+]::
1344         @: $(MAKE); $(stage)
1345         rm -rf stage[+id+]-* [+
1346           IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1347
1348 [+ IF cleanstrap-target +]
1349 .PHONY: [+cleanstrap-target+]
1350 [+cleanstrap-target+]: distclean [+bootstrap-target+]
1351 [+ ENDIF cleanstrap-target +]
1352 @endif gcc-bootstrap
1353
1354 [+ ENDFOR bootstrap-stage +]
1355
1356 stageprofile-end::
1357         $(MAKE) distclean-stagefeedback
1358
1359 stagefeedback-start::
1360         @r=`${PWD_COMMAND}`; export r; \
1361         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1362         for i in prev-*; do \
1363           j=`echo $$i | sed s/^prev-//` ; \
1364           cd $$r/$$i && \
1365           { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1366           { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1367         done
1368
1369 @if gcc-bootstrap
1370 do-distclean: distclean-stage1
1371
1372 # Provide a GCC build when we're building target libraries.  This does
1373 # not work as a dependency, just as the minimum necessary to avoid errors.
1374 stage_last:
1375         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1376
1377 # Same as unstage, but not phony and defaulting to stage1-start.  We place
1378 # it in the dependency so that for example `make -j3 all-gcc' works.
1379 stage_current:
1380         @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1381
1382 .PHONY: restrap
1383 restrap:
1384         @: $(MAKE); $(stage)
1385         rm -rf stage1-$(TARGET_SUBDIR) [+ FOR bootstrap-stage +][+ IF prev
1386           +]stage[+id+]-* [+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1387         $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
1388 @endif gcc-bootstrap
1389
1390 # --------------------------------------
1391 # Dependencies between different modules
1392 # --------------------------------------
1393
1394 # Generic dependencies for target modules on host stuff, especially gcc
1395 @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1396   +][+ FOR bootstrap_stage +]
1397 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1398   ENDFOR +][+ ELSE bootstrap +]
1399 configure-target-[+module+]: stage_last[+
1400   ENDIF bootstrap +][+ ENDFOR target_modules +]
1401 @endif gcc-bootstrap
1402
1403 @if gcc-no-bootstrap[+ FOR target_modules +][+ IF bootstrap
1404   +][+ ELSE +]
1405 configure-target-[+module+]: maybe-all-gcc[+
1406   ENDIF bootstrap +][+ ENDFOR target_modules +]
1407 @endif gcc-no-bootstrap
1408
1409
1410 [+ FOR lang_env_dependencies +]
1411 configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss
1412 [+ IF cxx +]configure-target-[+module+]: maybe-all-target-libstdc++-v3
1413 [+ ENDIF cxx +][+ ENDFOR lang_env_dependencies +]
1414
1415 # There are two types of dependencies here: 'hard' dependencies, where one
1416 # module simply won't build without the other; and 'soft' dependencies, where
1417 # if the depended-on module is missing, the depending module will do without
1418 # or find a substitute somewhere (perhaps installed).  Soft dependencies
1419 # are made here to depend on a 'maybe-' target.  If you're not sure,
1420 # it's safer to use a soft dependency.
1421
1422 [+ ;; These Scheme functions build the bulk of the dependencies.
1423    ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1424    ;; where "maybe-" is only included if HARD is true, and all-gcc
1425    ;; is taken from VAR-NAME.
1426    (define dep-target (lambda (module-kind var-name hard)
1427       (string-append
1428          (if hard "" "maybe-")
1429          (dep-subtarget var-name)
1430          module-kind
1431          (dep-module var-name)
1432       )))
1433
1434    ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1435    (define make-dep (lambda (module-kind on-kind)
1436       (string-append
1437          (dep-target module-kind "module" #t) ": "
1438          (dep-target on-kind "on" (exist? "hard")))))
1439
1440    ;; dep-subtarget extracts everything up to the first dash in the given
1441    ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1442    (define dep-subtarget (lambda (var-name)
1443       (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1444
1445    ;; dep-module extracts everything up to the first dash in the given
1446    ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1447    (define dep-module (lambda (var-name)
1448       (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1449
1450    ;; dep-stage builds a string for the prefix of a bootstrap stage.
1451    (define dep-stage (lambda ()
1452       (string-append
1453          "stage"
1454          (get "id")
1455          "-")))
1456
1457    ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1458    ;; but is written in Scheme.
1459    (define dep-maybe (lambda ()
1460       (if (exist? "hard") "" "maybe-")))
1461
1462    ;; dep-kind returns "normal" if the dependency is on an "install" target,
1463    ;; or if either module is not bootstrapped.  It returns "bootstrap" for
1464    ;; configure or build dependencies between bootstrapped modules; it returns
1465    ;; "prebootstrap" for configure or build dependencies of bootstrapped
1466    ;; modules on a build module (e.g. all-gcc on all-build-bison).  All this
1467    ;; is only necessary for host modules.
1468    (define dep-kind (lambda ()
1469       (if (and (hash-ref boot-modules (dep-module "module"))
1470                (=* (dep-module "on") "build-"))
1471           "prebootstrap"
1472
1473           (if (or (= (dep-subtarget "on") "install-")
1474                   (not (hash-ref boot-modules (dep-module "module")))
1475                   (not (hash-ref boot-modules (dep-module "on"))))
1476               "normal"
1477               "bootstrap"))))
1478
1479    ;; We now build the hash table that is used by dep-kind.
1480    (define boot-modules (make-hash-table 113))
1481 +]
1482
1483 [+ FOR host_modules +][+
1484    (if (exist? "bootstrap")
1485        (hash-create-handle! boot-modules (get "module") #t))
1486    "" +][+ ENDFOR host_modules +]
1487 [+ FOR target_modules +][+
1488    (if (exist? "bootstrap")
1489        (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1490    "" +][+ ENDFOR target_modules +]
1491
1492 # With all the machinery above in place, it is pretty easy to generate
1493 # dependencies.  Host dependencies are a bit more complex because we have
1494 # to check for bootstrap/prebootstrap dependencies.  To resolve
1495 # prebootstrap dependencies, prebootstrap modules are gathered in
1496 # a hash table.
1497 [+ FOR dependencies +][+ (make-dep "" "") +]
1498 [+ CASE (dep-kind) +]
1499 [+ == "prebootstrap"
1500      +][+ FOR bootstrap_stage +]
1501 [+ (make-dep (dep-stage) "") +][+
1502        ENDFOR bootstrap_stage +]
1503 [+ == "bootstrap"
1504      +][+ FOR bootstrap_stage +]
1505 [+ (make-dep (dep-stage) (dep-stage)) +][+
1506        ENDFOR bootstrap_stage +]
1507 [+ ESAC +][+
1508 ENDFOR dependencies +]
1509
1510 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
1511 GDB_TK = @GDB_TK@
1512 INSTALL_GDB_TK = @INSTALL_GDB_TK@
1513 configure-gdb: $(CONFIGURE_GDB_TK)
1514 all-gdb: $(gdbnlmrequirements) $(GDB_TK)
1515 install-gdb: $(INSTALL_GDB_TK)
1516
1517 # Serialization dependencies.  Host configures don't work well in parallel to
1518 # each other, due to contention over config.cache.  Target configures and 
1519 # build configures are similar.
1520 @serialization_dependencies@
1521
1522 # --------------------------------
1523 # Regenerating top level configury
1524 # --------------------------------
1525
1526 # Rebuilding Makefile.in, using autogen.
1527 AUTOGEN = autogen
1528 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1529         cd $(srcdir) && $(AUTOGEN) Makefile.def
1530
1531 # Rebuilding Makefile.
1532 Makefile: $(srcdir)/Makefile.in config.status
1533         CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1534
1535 config.status: configure
1536         CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
1537
1538 # Rebuilding configure.
1539 AUTOCONF = autoconf
1540 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4
1541         cd $(srcdir) && $(AUTOCONF)
1542
1543 # ------------------------------
1544 # Special directives to GNU Make
1545 # ------------------------------
1546
1547 # Don't pass command-line variables to submakes.
1548 .NOEXPORT:
1549 MAKEOVERRIDES=
1550
1551 # end of Makefile.in