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