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