Mark ChangeLog
[official-gcc.git] / Makefile.tpl
blobf8164e4aaae2e04610c4c1f7fe634a4cc7384a7d
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=
282 BOOT_ADAFLAGS=-gnatpg -gnata
284 BISON = @BISON@
285 YACC = @YACC@
286 FLEX = @FLEX@
287 LEX = @LEX@
288 M4 = @M4@
289 MAKEINFO = @MAKEINFO@
290 EXPECT = @EXPECT@
291 RUNTEST = @RUNTEST@
293 # This just becomes part of the MAKEINFO definition passed down to
294 # sub-makes.  It lets flags be given on the command line while still
295 # using the makeinfo from the object tree.
296 # (Default to avoid splitting info files by setting the threshold high.)
297 MAKEINFOFLAGS = --split-size=5000000
299 # ---------------------------------------------
300 # Programs producing files for the HOST machine
301 # ---------------------------------------------
303 AS = @AS@
304 AR = @AR@
305 AR_FLAGS = rc
306 CC = @CC@
307 CXX = @CXX@
308 DLLTOOL = @DLLTOOL@
309 LD = @LD@
310 LIPO = @LIPO@
311 NM = @NM@
312 OBJDUMP = @OBJDUMP@
313 RANLIB = @RANLIB@
314 STRIP = @STRIP@
315 WINDRES = @WINDRES@
316 WINDMC = @WINDMC@
318 GNATBIND = @GNATBIND@
319 GNATMAKE = @GNATMAKE@
321 CFLAGS = @CFLAGS@
322 LDFLAGS = @LDFLAGS@
323 LIBCFLAGS = $(CFLAGS)
324 CXXFLAGS = @CXXFLAGS@
325 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
326 PICFLAG = 
328 # Only build the C compiler for stage1, because that is the only one that
329 # we can guarantee will build with the native compiler, and also it is the
330 # only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
331 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
332 # overrideable (for a bootstrap build stage1 also builds gcc.info).
334 STAGE1_CFLAGS=@stage1_cflags@
335 STAGE1_CHECKING=@stage1_checking@
336 STAGE1_LANGUAGES=@stage1_languages@
338 STAGE2_CFLAGS=$(BOOT_CFLAGS)
339 STAGE3_CFLAGS=$(BOOT_CFLAGS)
340 STAGE4_CFLAGS=$(BOOT_CFLAGS)
342 do-compare = @do_compare@
343 do-compare3 = $(do-compare)
344 do-compare-debug = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2
346 # -----------------------------------------------
347 # Programs producing files for the TARGET machine
348 # -----------------------------------------------
350 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
352 AR_FOR_TARGET=@AR_FOR_TARGET@
353 AS_FOR_TARGET=@AS_FOR_TARGET@
354 CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
356 # If GCC_FOR_TARGET is not overriden on the command line, then this
357 # variable is passed down to the gcc Makefile, where it is used to
358 # build libgcc2.a.  We define it here so that it can itself be
359 # overridden on the command line.
360 GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
361 CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
362 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
363 GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
364 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
365 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
366 LD_FOR_TARGET=@LD_FOR_TARGET@
368 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
369 NM_FOR_TARGET=@NM_FOR_TARGET@
370 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
371 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
372 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
373 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
374 WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
376 COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
377 COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
378 COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
380 # During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
381 # might be empty or "-g".  We don't require a C++ compiler, so CXXFLAGS
382 # might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
383 # We want to ensure that TARGET libraries (which we know are built with
384 # gcc) are built with "-O2 -g", so prepend those options when setting
385 # CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
386 CFLAGS_FOR_TARGET = -O2 -g $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) \
387         $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
388 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
389 DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
390 CXXFLAGS_FOR_TARGET = -O2 -g $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) \
391         $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
392 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
393 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
394 LDFLAGS_FOR_TARGET = 
395 PICFLAG_FOR_TARGET = 
397 # ------------------------------------
398 # Miscellaneous targets and flag lists
399 # ------------------------------------
401 # The first rule in the file had better be this one.  Don't put any above it.
402 # This lives here to allow makefile fragments to contain dependencies.
403 all:
405 #### host and target specific makefile fragments come in here.
406 @target_makefile_frag@
407 @alphaieee_frag@
408 @ospace_frag@
409 @host_makefile_frag@
412 # This is the list of directories that may be needed in RPATH_ENVVAR
413 # so that prorgams built for the target machine work.
414 TARGET_LIB_PATH = [+ FOR target_modules +][+
415   IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
416   ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
417 [+ FOR target_modules +][+ IF lib_path +]
418 @if target-[+module+]
419 TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
420 @endif target-[+module+]
421 [+ ENDIF lib_path +][+ ENDFOR target_modules +]
424 # This is the list of directories that may be needed in RPATH_ENVVAR
425 # so that programs built for the host machine work.
426 HOST_LIB_PATH = [+ FOR host_modules +][+
427   IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
428   ENDFOR host_modules +]
430 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
431 @if gcc
432 HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
433 @endif gcc
435 [+ FOR host_modules +][+ IF lib_path +]
436 @if [+module+]
437 HOST_LIB_PATH_[+module+] = \
438   $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
439   +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
440 @endif [+module+]
441 [+ ENDIF lib_path +][+ ENDFOR host_modules +]
443 # Flags to pass down to all sub-makes.
444 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
445         "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
446         "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +] \
447         "CONFIG_SHELL=$(SHELL)" \
448         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" 
450 # We leave this in just in case, but it is not needed anymore.
451 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
453 # Flags to pass down to most sub-makes, in which we're building with
454 # the host environment.
455 EXTRA_HOST_FLAGS = \
456         'AR=$(AR)' \
457         'AS=$(AS)' \
458         'CC=$(CC)' \
459         'CXX=$(CXX)' \
460         'DLLTOOL=$(DLLTOOL)' \
461         'LD=$(LD)' \
462         'LIPO=$(LIPO)' \
463         'NM=$(NM)' \
464         'OBJDUMP=$(OBJDUMP)' \
465         'RANLIB=$(RANLIB)' \
466         'STRIP=$(STRIP)' \
467         'WINDRES=$(WINDRES)' \
468         'WINDMC=$(WINDMC)'
470 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
472 # Flags that are concerned with the location of the X11 include files
473 # and library files
475 # NOTE: until the top-level is getting the values via autoconf, it only
476 # causes problems to have this top-level Makefile overriding the autoconf-set
477 # values in child directories.  Only variables that don't conflict with
478 # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
480 X11_FLAGS_TO_PASS = \
481         'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
482         'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
484 # Flags to pass to stage2 and later makes.
486 POSTSTAGE1_FLAGS_TO_PASS = \
487         CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
488         GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind" \
489         LDFLAGS="$(BOOT_LDFLAGS)" \
490         "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
492 # Flags to pass down to makes which are built with the target environment.
493 # The double $ decreases the length of the command line; those variables
494 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.  The
495 # COMPILER_ prefixed variables are not passed down so we expand them here.
496 EXTRA_TARGET_FLAGS = \
497         'AR=$$(AR_FOR_TARGET)' \
498         'AS=$(COMPILER_AS_FOR_TARGET)' \
499         'CC=$$(CC_FOR_TARGET)' \
500         'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
501         'CXX=$$(CXX_FOR_TARGET)' \
502         'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
503         'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
504         'LD=$(COMPILER_LD_FOR_TARGET)' \
505         'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
506         'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
507         'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
508         'NM=$(COMPILER_NM_FOR_TARGET)' \
509         'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
510         'RANLIB=$$(RANLIB_FOR_TARGET)' \
511         'WINDRES=$$(WINDRES_FOR_TARGET)' \
512         'WINDMC=$$(WINDMC_FOR_TARGET)'
514 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
516 # Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
517 # unfortunately needs the native compiler and the target ar and
518 # ranlib.
519 # If any variables are added here, they must be added to do-*, below.
520 # The BUILD_* variables are a special case, which are used for the gcc
521 # cross-building scheme.
522 EXTRA_GCC_FLAGS = \
523         "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
524         "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
525         "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
526         "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
527         "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
528         "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
530 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
532 .PHONY: configure-host
533 configure-host: [+
534   FOR host_modules +] \
535     maybe-configure-[+module+][+
536   ENDFOR host_modules +]
537 .PHONY: configure-target
538 configure-target: [+
539   FOR target_modules +] \
540     maybe-configure-target-[+module+][+
541   ENDFOR target_modules +]
543 # The target built for a native non-bootstrap build.
544 .PHONY: all
545 all:
546 @if gcc-bootstrap
547         [ -f stage_final ] || echo stage3 > stage_final
548         @r=`${PWD_COMMAND}`; export r; \
549         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
550         $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
551 @endif gcc-bootstrap
552         @: $(MAKE); $(unstage)
553         @r=`${PWD_COMMAND}`; export r; \
554         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
555         if [ -f stage_last ]; then \
556           $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
557         else \
558           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
559         fi
561 .PHONY: all-build
562 [+ FOR build_modules +]
563 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
565 .PHONY: all-host
566 [+ FOR host_modules +][+ IF bootstrap +]
567 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
568 all-host: maybe-all-[+module+][+ IF bootstrap +]
569 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
571 .PHONY: all-target
572 [+ FOR target_modules +][+ IF bootstrap +]
573 @if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
574 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
575 @endif target-[+module+]-no-bootstrap[+
576   ENDIF bootstrap +][+ ENDFOR target_modules +]
578 # Do a target for all the subdirectories.  A ``make do-X'' will do a
579 # ``make X'' in all subdirectories (because, in general, there is a
580 # dependency (below) of X upon do-X, a ``make X'' will also do this,
581 # but it may do additional work as well).
582 [+ FOR recursive_targets +]
583 .PHONY: do-[+make_target+]
584 do-[+make_target+]:
585         @: $(MAKE); $(unstage)
586         @r=`${PWD_COMMAND}`; export r; \
587         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
588         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
589           [+make_target+]-target
592 .PHONY: [+make_target+]-host
593 [+ FOR host_modules +]
594 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
596 .PHONY: [+make_target+]-target
597 [+ FOR target_modules +]
598 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
599 [+ ENDFOR recursive_targets +]
601 # Here are the targets which correspond to the do-X targets.
603 .PHONY: info installcheck dvi pdf html
604 .PHONY: install-info install-pdf install-html
605 .PHONY: clean distclean mostlyclean maintainer-clean realclean
606 .PHONY: local-clean local-distclean local-maintainer-clean
607 info: do-info
608 installcheck: do-installcheck
609 dvi: do-dvi
610 pdf: do-pdf
611 html: do-html
613 # Make sure makeinfo is built before we do a `make info', if we're
614 # in fact building texinfo.
615 do-info: maybe-all-texinfo
617 install-info: do-install-info dir.info
618         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
619         if [ -f dir.info ] ; then \
620           $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
621         else true ; fi
623 install-pdf: do-install-pdf
625 install-html: do-install-html
627 local-clean:
628         -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
630 local-distclean:
631         -rm -f Makefile config.status config.cache mh-frag mt-frag
632         -rm -f maybedep.tmp serdep.tmp
633         -if [ "$(TARGET_SUBDIR)" != "." ]; then \
634           rm -rf $(TARGET_SUBDIR); \
635         else true; fi
636         -rm -rf $(BUILD_SUBDIR)
637         -if [ "$(HOST_SUBDIR)" != "." ]; then \
638           rm -rf $(HOST_SUBDIR); \
639         else true; fi
640         -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
641         -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
642         -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
643         -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
644         -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
646 local-maintainer-clean:
647         @echo "This command is intended for maintainers to use;"
648         @echo "it deletes files that may require special tools to rebuild."
650 clean: do-clean local-clean
651 mostlyclean: do-mostlyclean local-clean
652 distclean: do-distclean local-clean local-distclean
653 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
654 maintainer-clean: local-distclean
655 realclean: maintainer-clean
657 # Check target.
659 .PHONY: check do-check
660 check: do-check
662 # Only include modules actually being configured and built.
663 .PHONY: check-host
664 check-host: [+
665   FOR host_modules +] \
666     maybe-check-[+module+][+
667   ENDFOR host_modules +]
669 .PHONY: check-target
670 check-target: [+
671   FOR target_modules +] \
672     maybe-check-target-[+module+][+
673   ENDFOR target_modules +]
675 do-check:
676         @: $(MAKE); $(unstage)
677         @r=`${PWD_COMMAND}`; export r; \
678         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
679         $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
681 # Automated reporting of test results.
683 warning.log: build.log
684         $(srcdir)/contrib/warn_summary build.log > $@
686 mail-report.log:
687         if test x'$(BOOT_CFLAGS)' != x''; then \
688             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
689         fi; \
690         $(srcdir)/contrib/test_summary -t >$@
691         chmod +x $@
692         echo If you really want to send e-mail, run ./$@ now
694 mail-report-with-warnings.log: warning.log
695         if test x'$(BOOT_CFLAGS)' != x''; then \
696             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
697         fi; \
698         $(srcdir)/contrib/test_summary -t -i warning.log >$@
699         chmod +x $@
700         echo If you really want to send e-mail, run ./$@ now
702 # Installation targets.
704 .PHONY: install uninstall
705 install:
706         @: $(MAKE); $(unstage)
707         @r=`${PWD_COMMAND}`; export r; \
708         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
709         $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
711 .PHONY: install-host-nogcc
712 install-host-nogcc: [+
713   FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
714     maybe-install-[+module+][+ ENDIF +][+
715   ENDFOR host_modules +]
717 .PHONY: install-host
718 install-host: [+
719   FOR host_modules +] \
720     maybe-install-[+module+][+
721   ENDFOR host_modules +]
723 .PHONY: install-target
724 install-target: [+
725   FOR target_modules +] \
726     maybe-install-target-[+module+][+
727   ENDFOR target_modules +]
729 uninstall:
730         @echo "the uninstall target is not supported in this tree"
732 .PHONY: install.all
733 install.all: install-no-fixedincludes
734         @if [ -f ./gcc/Makefile ] ; then \
735                 r=`${PWD_COMMAND}` ; export r ; \
736                 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
737                 $(HOST_EXPORTS) \
738                 (cd ./gcc && \
739                 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
740         else \
741                 true ; \
742         fi
744 # install-no-fixedincludes is used because Cygnus can not distribute
745 # the fixed header files.
746 .PHONY: install-no-fixedincludes
747 install-no-fixedincludes: installdirs install-host-nogcc \
748         install-target gcc-no-fixedincludes
750 ### other supporting targets
752 MAKEDIRS= \
753         $(DESTDIR)$(prefix) \
754         $(DESTDIR)$(exec_prefix)
755 .PHONY: installdirs
756 installdirs: mkinstalldirs
757         $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
759 dir.info: do-install-info
760         if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
761           $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
762           mv -f dir.info.new dir.info ; \
763         else true ; \
764         fi
766 dist:
767         @echo "Building a full distribution of this tree isn't done"
768         @echo "via 'make dist'.  Check out the etc/ subdirectory" 
770 etags tags: TAGS
772 # Right now this just builds TAGS in each subdirectory.  emacs19 has the
773 # ability to use several tags files at once, so there is probably no need
774 # to combine them into one big TAGS file (like CVS 1.3 does).  We could
775 # (if we felt like it) have this Makefile write a piece of elisp which
776 # the user could load to tell emacs19 where all the TAGS files we just
777 # built are.
778 TAGS: do-TAGS
780 # ------------------------------------
781 # Macros for configure and all targets
782 # ------------------------------------
784 [+ DEFINE configure +]
785 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
786 maybe-configure-[+prefix+][+module+]:
787 @if gcc-bootstrap
788 configure-[+prefix+][+module+]: stage_current
789 @endif gcc-bootstrap
790 @if [+prefix+][+module+]
791 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
792 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
793         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
794         @r=`${PWD_COMMAND}`; export r; \
795         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
796         [+ IF check_multilibs
797         +]echo "Checking multilib configuration for [+module+]..."; \
798         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
799         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
800         if test -r [+subdir+]/[+module+]/multilib.out; then \
801           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
802             rm -f [+subdir+]/[+module+]/multilib.tmp; \
803           else \
804             rm -f [+subdir+]/[+module+]/Makefile; \
805             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
806           fi; \
807         else \
808           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
809         fi; \
810         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
811         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
812         [+exports+] \
813         echo Configuring in [+subdir+]/[+module+]; \
814         cd "[+subdir+]/[+module+]" || exit 1; \
815         case $(srcdir) in \
816           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
817           *) topdir=`echo [+subdir+]/[+module+]/ | \
818                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
819         esac; \
820         srcdiroption="--srcdir=$${topdir}/[+module+]"; \
821         libsrcdir="$$s/[+module+]"; \
822         [+ IF no-config-site +]rm -f no-such-file || : ; \
823         CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
824           [+args+] --build=${build_alias} --host=[+host_alias+] \
825           --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
826           || exit 1
827 @endif [+prefix+][+module+]
829 [+ IF bootstrap +]
830 [+ FOR bootstrap_stage +]
831 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
832 maybe-configure-stage[+id+]-[+prefix+][+module+]:
833 @if [+prefix+][+module+]-bootstrap
834 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
835 configure-stage[+id+]-[+prefix+][+module+]:
836         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
837         @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
838         @r=`${PWD_COMMAND}`; export r; \
839         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
840         [+ IF check_multilibs
841         +]echo "Checking multilib configuration for [+module+]..."; \
842         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
843         if test -r [+subdir+]/[+module+]/multilib.out; then \
844           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
845             rm -f [+subdir+]/[+module+]/multilib.tmp; \
846           else \
847             rm -f [+subdir+]/[+module+]/Makefile; \
848             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
849           fi; \
850         else \
851           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
852         fi; \
853         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
854         [+exports+][+ IF prev +] \
855         [+poststage1_exports+][+ ENDIF prev +] \
856         CFLAGS="[+stage_cflags+]"; export CFLAGS; \
857         LIBCFLAGS="[+stage_cflags+]"; export LIBCFLAGS; \
858         echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
859         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
860         cd [+subdir+]/[+module+] || exit 1; \
861         case $(srcdir) in \
862           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
863           *) topdir=`echo [+subdir+]/[+module+]/ | \
864                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
865         esac; \
866         srcdiroption="--srcdir=$${topdir}/[+module+]"; \
867         libsrcdir="$$s/[+module+]"; \
868         $(SHELL) $${libsrcdir}/configure \
869           [+args+] --build=${build_alias} --host=[+host_alias+] \
870           --target=[+target_alias+] $${srcdiroption} \
871           [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
872           [+stage_configure_flags+] [+extra_configure_flags+]
873 @endif [+prefix+][+module+]-bootstrap
874 [+ ENDFOR bootstrap_stage +]
875 [+ ENDIF bootstrap +]
876 [+ ENDDEF +]
878 [+ DEFINE all +]
879 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
880 maybe-all-[+prefix+][+module+]:
881 @if gcc-bootstrap
882 all-[+prefix+][+module+]: stage_current
883 @endif gcc-bootstrap
884 @if [+prefix+][+module+]
885 TARGET-[+prefix+][+module+]=[+
886   IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
887 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
888 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
889         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
890         @r=`${PWD_COMMAND}`; export r; \
891         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
892         [+exports+] \
893         (cd [+subdir+]/[+module+] && \
894           $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
895 @endif [+prefix+][+module+]
897 [+ IF bootstrap +]
898 [+ FOR bootstrap_stage +]
899 .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
900 .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
901 maybe-all-stage[+id+]-[+prefix+][+module+]:
902 maybe-clean-stage[+id+]-[+prefix+][+module+]:
903 @if [+prefix+][+module+]-bootstrap
904 maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
905 all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
906 TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
907 all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
908         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
909         @r=`${PWD_COMMAND}`; export r; \
910         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
911         [+exports+][+ IF prev +] \
912         [+poststage1_exports+][+ ENDIF prev +] \
913         cd [+subdir+]/[+module+] && \
914         $(MAKE) [+args+] \
915                 CFLAGS="[+stage_cflags+]" LIBCFLAGS="[+stage_cflags+]" [+
916                 IF prev +][+poststage1_args+][+ ENDIF prev
917                 +] [+extra_make_flags+] \
918                 $(TARGET-stage[+id+]-[+prefix+][+module+])
920 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
921 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
922 clean-stage[+id+]-[+prefix+][+module+]:
923         @if [ $(current_stage) = stage[+id+] ]; then \
924           [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
925         else \
926           [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
927           $(MAKE) stage[+id+]-start; \
928         fi; \
929         cd [+subdir+]/[+module+] && \
930         $(MAKE) [+args+] [+ IF prev +] \
931                 [+poststage1_args+] [+ ENDIF prev +] \
932                 [+extra_make_flags+] clean
933 @endif [+prefix+][+module+]-bootstrap
935 [+ ENDFOR bootstrap_stage +]
936 [+ ENDIF bootstrap +]
937 [+ ENDDEF +]
939 # --------------------------------------
940 # Modules which run on the build machine
941 # --------------------------------------
942 [+ FOR build_modules +]
943 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
944              host_alias=(get "host" "${build_alias}")
945              target_alias=(get "target" "${target_alias}")
946              args="$(BUILD_CONFIGARGS)" no-config-site=true +]
948 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
949 [+ ENDFOR build_module +]
951 # --------------------------------------
952 # Modules which run on the host machine
953 # --------------------------------------
954 [+ FOR host_modules +]
955 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
956              exports="$(HOST_EXPORTS)"
957              poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
958              host_alias=(get "host" "${host_alias}")
959              target_alias=(get "target" "${target_alias}")
960              args="$(HOST_CONFIGARGS)" +]
962 [+ all prefix="" subdir="$(HOST_SUBDIR)"
963        exports="$(HOST_EXPORTS)"
964        poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
965        args="$(FLAGS_TO_PASS)"
966        poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
968 .PHONY: check-[+module+] maybe-check-[+module+]
969 maybe-check-[+module+]:
970 @if [+module+]
971 maybe-check-[+module+]: check-[+module+]
972 [+ IF no_check +]
973 check-[+module+]:
974 [+ ELIF no_check_cross +]
975 # This module is only tested in a native toolchain.
976 check-[+module+]:
977         @: $(MAKE); $(unstage)
978         @if [ '$(host)' = '$(target)' ] ; then \
979           r=`${PWD_COMMAND}`; export r; \
980           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
981           $(HOST_EXPORTS) \
982           (cd $(HOST_SUBDIR)/[+module+] && \
983             $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
984         fi
985 [+ ELSE check +]
986 check-[+module+]:
987         @: $(MAKE); $(unstage)
988         @r=`${PWD_COMMAND}`; export r; \
989         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
990         $(HOST_EXPORTS) \
991         (cd $(HOST_SUBDIR)/[+module+] && \
992           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
993 [+ ENDIF no_check +]
994 @endif [+module+]
996 .PHONY: install-[+module+] maybe-install-[+module+]
997 maybe-install-[+module+]:
998 @if [+module+]
999 maybe-install-[+module+]: install-[+module+]
1000 [+ IF no_install +]
1001 install-[+module+]:
1002 [+ ELSE install +]
1003 install-[+module+]: installdirs
1004         @: $(MAKE); $(unstage)
1005         @r=`${PWD_COMMAND}`; export r; \
1006         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1007         $(HOST_EXPORTS) \
1008         (cd $(HOST_SUBDIR)/[+module+] && \
1009           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
1010 [+ ENDIF no_install +]
1011 @endif [+module+]
1013 # Other targets (info, dvi, pdf, etc.)
1014 [+ FOR recursive_targets +]
1015 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1016 maybe-[+make_target+]-[+module+]:
1017 @if [+module+]
1018 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
1019 [+ IF (match-value? = "missing" (get "make_target") ) +]
1020 # [+module+] doesn't support [+make_target+].
1021 [+make_target+]-[+module+]:
1022 [+ ELSE +]
1023 [+make_target+]-[+module+]: [+
1024   FOR depend +]\
1025     [+depend+]-[+module+] [+
1026   ENDFOR depend +]
1027         @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1028         @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
1029         r=`${PWD_COMMAND}`; export r; \
1030         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1031         $(HOST_EXPORTS) \
1032         for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1033           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1034         done; \
1035         echo "Doing [+make_target+] in [+module+]" ; \
1036         (cd $(HOST_SUBDIR)/[+module+] && \
1037           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1038                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1039                   "RANLIB=$${RANLIB}" \
1040                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1041                   [+make_target+]) \
1042           || exit 1
1043 [+ ENDIF +]
1044 @endif [+module+]
1045 [+ ENDFOR recursive_targets +]
1046 [+ ENDFOR host_modules +]
1048 # ---------------------------------------
1049 # Modules which run on the target machine
1050 # ---------------------------------------
1051 [+ FOR target_modules +]
1053 [+ IF raw_cxx +]
1054 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1055              check_multilibs=true
1056              exports="$(RAW_CXX_TARGET_EXPORTS)"
1057              host_alias=(get "host" "${target_alias}")
1058              target_alias=(get "target" "${target_alias}")
1059              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1061 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1062        exports="$(RAW_CXX_TARGET_EXPORTS)"
1063        args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1064 [+ ELSE +]
1065 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1066              check_multilibs=true
1067              exports="$(NORMAL_TARGET_EXPORTS)"
1068              host_alias=(get "host" "${target_alias}")
1069              target_alias=(get "target" "${target_alias}")
1070              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1072 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1073        exports="$(NORMAL_TARGET_EXPORTS)"
1074        args="$(TARGET_FLAGS_TO_PASS)" +]
1075 [+ ENDIF +]
1077 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1078 maybe-check-target-[+module+]:
1079 @if target-[+module+]
1080 maybe-check-target-[+module+]: check-target-[+module+]
1081 [+ IF no_check +]
1082 # Dummy target for uncheckable module.
1083 check-target-[+module+]:
1084 [+ ELSE check +]
1085 check-target-[+module+]:
1086         @: $(MAKE); $(unstage)
1087         @r=`${PWD_COMMAND}`; export r; \
1088         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1089 IF raw_cxx +]
1090         $(RAW_CXX_TARGET_EXPORTS) \[+
1091 ELSE normal_cxx +]
1092         $(NORMAL_TARGET_EXPORTS) \[+
1093 ENDIF raw_cxx +]
1094         (cd $(TARGET_SUBDIR)/[+module+] && \
1095           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1096             IF raw_cxx 
1097               +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1098             ENDIF raw_cxx 
1099           +] [+extra_make_flags+] check)
1100 [+ ENDIF no_check +]
1101 @endif target-[+module+]
1103 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1104 maybe-install-target-[+module+]:
1105 @if target-[+module+]
1106 maybe-install-target-[+module+]: install-target-[+module+]
1107 [+ IF no_install +]
1108 # Dummy target for uninstallable.
1109 install-target-[+module+]:
1110 [+ ELSE install +]
1111 install-target-[+module+]: installdirs
1112         @: $(MAKE); $(unstage)
1113         @r=`${PWD_COMMAND}`; export r; \
1114         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1115 IF raw_cxx +]
1116         $(RAW_CXX_TARGET_EXPORTS) \[+
1117 ELSE normal_cxx +]
1118         $(NORMAL_TARGET_EXPORTS) \[+
1119 ENDIF raw_cxx +]
1120         (cd $(TARGET_SUBDIR)/[+module+] && \
1121           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1122 [+ ENDIF no_install +]
1123 @endif target-[+module+]
1125 # Other targets (info, dvi, pdf, etc.)
1126 [+ FOR recursive_targets +]
1127 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1128 maybe-[+make_target+]-target-[+module+]:
1129 @if target-[+module+]
1130 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1131 [+ IF (match-value? = "missing" (get "make_target") ) +]
1132 # [+module+] doesn't support [+make_target+].
1133 [+make_target+]-target-[+module+]:
1134 [+ ELSE +]
1135 [+make_target+]-target-[+module+]: [+
1136   FOR depend +]\
1137     [+depend+]-target-[+module+] [+
1138   ENDFOR depend +]
1139         @: $(MAKE); $(unstage)
1140         @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1141         r=`${PWD_COMMAND}`; export r; \
1142         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1143 IF raw_cxx +]
1144         $(RAW_CXX_TARGET_EXPORTS) \[+
1145 ELSE normal_cxx +]
1146         $(NORMAL_TARGET_EXPORTS) \[+
1147 ENDIF raw_cxx +]
1148         echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1149         for flag in $(EXTRA_TARGET_FLAGS); do \
1150           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1151         done; \
1152         (cd $(TARGET_SUBDIR)/[+module+] && \
1153           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1154                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1155                   "RANLIB=$${RANLIB}" \
1156                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1157                   [+extra_make_flags+] [+make_target+]) \
1158           || exit 1
1159 [+ ENDIF +]
1160 @endif target-[+module+]
1161 [+ ENDFOR recursive_targets +]
1162 [+ ENDFOR target_modules +]
1164 # ----------
1165 # GCC module
1166 # ----------
1168 @if gcc-no-bootstrap
1169 .PHONY: cross
1170 cross: all-build all-gas all-ld
1171         @r=`${PWD_COMMAND}`; export r; \
1172         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1173         $(HOST_EXPORTS) \
1174         echo "Building the C and C++ compiler"; \
1175         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1176         @r=`${PWD_COMMAND}`; export r; \
1177         s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1178         echo "Building runtime libraries"; \
1179         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1180 @endif gcc-no-bootstrap
1182 @if gcc
1183 .PHONY: check-gcc-c++
1184 check-gcc-c++:
1185         @if [ -f ./gcc/Makefile ] ; then \
1186           r=`${PWD_COMMAND}`; export r; \
1187           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1188           $(HOST_EXPORTS) \
1189           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
1190         else \
1191           true; \
1192         fi
1194 .PHONY: check-c++
1195 check-c++: check-target-libstdc++-v3 check-gcc-c++
1197 # Install the gcc headers files, but not the fixed include files,
1198 # which Cygnus is not allowed to distribute.  This rule is very
1199 # dependent on the workings of the gcc Makefile.in.
1200 .PHONY: gcc-no-fixedincludes
1201 gcc-no-fixedincludes:
1202         @if [ -f ./gcc/Makefile ]; then \
1203           rm -rf gcc/tmp-include; \
1204           mv gcc/include gcc/tmp-include 2>/dev/null; \
1205           mkdir gcc/include; \
1206           cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1207           touch gcc/stmp-fixinc gcc/include/fixed; \
1208           rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1209           r=`${PWD_COMMAND}`; export r; \
1210           s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1211           $(HOST_EXPORTS) \
1212           (cd ./gcc && \
1213            $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1214           rm -rf gcc/include; \
1215           mv gcc/tmp-include gcc/include 2>/dev/null; \
1216         else true; fi
1217 @endif gcc
1219 # ---------------------
1220 # GCC bootstrap support
1221 # ---------------------
1223 # We track the current stage (the one in 'gcc') in the stage_current file.
1224 # stage_last instead tracks the stage that was built last.  These targets
1225 # are dummy when toplevel bootstrap is not active.
1227 # While making host and target tools, symlinks to the final stage must be
1228 # there, so $(unstage) should be run at various points.  To avoid excessive
1229 # recursive invocations of make, we "inline" them using a variable.  These
1230 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1231 # to avoid warnings from the GNU Make job server.
1233 unstage = :
1234 stage = :
1235 current_stage = ""
1237 @if gcc-bootstrap
1238 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1239 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1240 current_stage = "`cat stage_current 2> /dev/null`"
1241 @endif gcc-bootstrap
1243 .PHONY: unstage stage
1244 unstage:
1245         @: $(MAKE); $(unstage)
1246 stage:
1247         @: $(MAKE); $(stage)
1249 # Disable commands for lean bootstrap.
1250 LEAN = false
1252 # We name the build directories for the various stages "stage1-gcc",
1253 # "stage2-gcc","stage3-gcc", etc.
1255 # Since the 'compare' process will fail (on debugging information) if any
1256 # directory names are different, we need to link the gcc directory for
1257 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1258 # the build directories constant as well. For the latter, we use naked names
1259 # like 'gcc', because the scripts in that directory assume it.  We use
1260 # mv on platforms where symlinks to directories do not work or are not
1261 # reliable.
1263 # 'touch' doesn't work right on some platforms.
1264 STAMP = echo timestamp > 
1266 # We only want to compare .o files, so set this!
1267 objext = .o
1269 [+ FOR bootstrap-stage +]
1270 .PHONY: stage[+id+]-start stage[+id+]-end
1272 stage[+id+]-start::
1273         @: $(MAKE); $(stage); \
1274         echo stage[+id+] > stage_current ; \
1275         echo stage[+id+] > stage_last; \
1276         $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1277    FOR host_modules +][+ IF bootstrap +]
1278 @if [+ module +]
1279         @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1280           mkdir stage[+id+]-[+module+]; \
1281         mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1282         mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1283 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1284         @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1285           mkdir stage[+id+]-$(TARGET_SUBDIR); \
1286         mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1287         mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1289 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1290 @if [+ module +]
1291         @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1292           cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1293           mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
1294         fi
1295 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1296         @if test -d $(TARGET_SUBDIR) ; then \
1297           mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1298           mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
1299         fi
1300         rm -f stage_current
1302 # Bubble a bug fix through all the stages up to stage [+id+].  They are
1303 # remade, but not reconfigured.  The next stage (if any) will not be
1304 # reconfigured as well.
1305 .PHONY: stage[+id+]-bubble
1306 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1307         @r=`${PWD_COMMAND}`; export r; \
1308         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1309         if test -f stage[+id+]-lean [+
1310           IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1311           echo Skipping rebuild of stage[+id+] ; \
1312         else \
1313           $(MAKE) stage[+id+]-start; \[+IF lean +]
1314           if $(LEAN); then \
1315             rm -rf stage[+lean+]-* ; \
1316             $(STAMP) stage[+lean+]-lean ; \
1317           fi; \[+ ENDIF lean +]
1318           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1319         fi[+ IF compare-target +]
1320         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1322 .PHONY: all-stage[+id+] clean-stage[+id+]
1323 do-clean: clean-stage[+id+]
1325 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1326 # only possibility, but now it conflicts with no-bootstrap rules
1327 @if gcc-bootstrap
1328 [+ IF compare-target +]
1329 [+compare-target+]:
1330         @r=`${PWD_COMMAND}`; export r; \
1331         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1332         if test -f stage[+prev+]-lean; then \
1333           echo Cannot compare object files as stage [+prev+] was deleted. ; \
1334           exit 0 ; \
1335         fi; \
1336         : $(MAKE); $(stage); \
1337         rm -f .bad_compare ; \
1338         echo Comparing stages [+prev+] and [+id+] ; \
1339         cd stage[+id+]-gcc; \
1340         files=`find . -name "*$(objext)" -print` ; \
1341         cd .. ; \
1342         for file in $${files} ; do \
1343           f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
1344           $(do-[+compare-target+]) > /dev/null 2>&1; \
1345           if test $$? -eq 1; then \
1346             case $$file in \
1347               ./cc*-checksum$(objext) | ./libgcc/* ) \
1348                 echo warning: $$file differs ;; \
1349               *) \
1350                 echo $$file differs >> .bad_compare ;; \
1351             esac ; \
1352           fi ; \
1353         done ; \
1354         if [ -f .bad_compare ]; then \
1355           echo "Bootstrap comparison failure!"; \
1356           cat .bad_compare; \
1357           exit 1; \
1358         else \
1359           echo Comparison successful.; \
1360         fi ; \
1361         $(STAMP) [+compare-target+][+ IF prev +]
1362         if $(LEAN); then \
1363           rm -rf stage[+prev+]-*; \
1364           $(STAMP) stage[+prev+]-lean; \
1365         fi[+ ENDIF prev +]
1366 [+ ENDIF compare-target +]
1368 [+ IF bootstrap-target +]
1369 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1370 [+bootstrap-target+]:
1371         echo stage[+id+] > stage_final
1372         @r=`${PWD_COMMAND}`; export r; \
1373         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1374         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1375         @: $(MAKE); $(unstage)
1376         @r=`${PWD_COMMAND}`; export r; \
1377         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1378         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1380 [+bootstrap-target+]-lean:
1381         echo stage[+id+] > stage_final
1382         @r=`${PWD_COMMAND}`; export r; \
1383         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1384         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1385         @: $(MAKE); $(unstage)
1386         @r=`${PWD_COMMAND}`; export r; \
1387         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1388         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1389 [+ ENDIF bootstrap-target +]
1391 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1392 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1393 .PHONY: distclean-stage[+id+]
1394 distclean-stage[+id+]::
1395         @: $(MAKE); $(stage)
1396         @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1397         rm -rf stage[+id+]-* [+
1398           IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1400 [+ IF cleanstrap-target +]
1401 .PHONY: [+cleanstrap-target+]
1402 [+cleanstrap-target+]: do-distclean local-clean
1403         echo stage[+id+] > stage_final
1404         @r=`${PWD_COMMAND}`; export r; \
1405         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1406         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1407         @: $(MAKE); $(unstage)
1408         @r=`${PWD_COMMAND}`; export r; \
1409         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1410         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1411 [+ ENDIF cleanstrap-target +]
1412 @endif gcc-bootstrap
1414 [+ ENDFOR bootstrap-stage +]
1416 stageprofile-end::
1417         $(MAKE) distclean-stagefeedback
1419 stagefeedback-start::
1420         @r=`${PWD_COMMAND}`; export r; \
1421         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1422         for i in prev-*; do \
1423           j=`echo $$i | sed s/^prev-//` ; \
1424           cd $$r/$$i && \
1425           { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1426           { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1427         done
1429 @if gcc-bootstrap
1430 do-distclean: distclean-stage1
1432 # Provide a GCC build when we're building target libraries.  This does
1433 # not work as a dependency, just as the minimum necessary to avoid errors.
1434 stage_last:
1435         @r=`${PWD_COMMAND}`; export r; \
1436         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1437         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1439 # Same as unstage, but not phony and defaulting to stage1-start.  We place
1440 # it in the dependency so that for example `make -j3 all-gcc' works.
1441 stage_current:
1442         @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1444 .PHONY: restrap
1445 restrap:
1446         @: $(MAKE); $(stage)
1447         rm -rf stage1-$(TARGET_SUBDIR) [+ FOR bootstrap-stage +][+ IF prev
1448           +]stage[+id+]-* [+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1449         $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
1450 @endif gcc-bootstrap
1452 # --------------------------------------
1453 # Dependencies between different modules
1454 # --------------------------------------
1456 # Generic dependencies for target modules on host stuff, especially gcc
1457 @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1458   +][+ FOR bootstrap_stage +]
1459 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1460   ENDFOR +][+ ELSE bootstrap +]
1461 configure-target-[+module+]: stage_last[+
1462   ENDIF bootstrap +][+ ENDFOR target_modules +]
1463 @endif gcc-bootstrap
1465 @if gcc-no-bootstrap[+ FOR target_modules +]
1466 configure-target-[+module+]: maybe-all-gcc[+
1467   ENDFOR target_modules +]
1468 @endif gcc-no-bootstrap
1471 # There are two types of dependencies here: 'hard' dependencies, where one
1472 # module simply won't build without the other; and 'soft' dependencies, where
1473 # if the depended-on module is missing, the depending module will do without
1474 # or find a substitute somewhere (perhaps installed).  Soft dependencies
1475 # are made here to depend on a 'maybe-' target.  If you're not sure,
1476 # it's safer to use a soft dependency.
1478 [+ ;; These Scheme functions build the bulk of the dependencies.
1479    ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1480    ;; where "maybe-" is only included if HARD is true, and all-gcc
1481    ;; is taken from VAR-NAME.
1482    (define dep-target (lambda (module-kind var-name hard)
1483       (string-append
1484          (if hard "" "maybe-")
1485          (dep-subtarget var-name)
1486          module-kind
1487          (dep-module var-name)
1488       )))
1490    ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1491    (define make-dep (lambda (module-kind on-kind)
1492       (string-append
1493          (dep-target module-kind "module" #t) ": "
1494          (dep-target on-kind "on" (exist? "hard")))))
1496    ;; dep-subtarget extracts everything up to the first dash in the given
1497    ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1498    (define dep-subtarget (lambda (var-name)
1499       (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1501    ;; dep-module extracts everything up to the first dash in the given
1502    ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1503    (define dep-module (lambda (var-name)
1504       (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1506    ;; dep-stage builds a string for the prefix of a bootstrap stage.
1507    (define dep-stage (lambda ()
1508       (string-append
1509          "stage"
1510          (get "id")
1511          "-")))
1513    ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1514    ;; but is written in Scheme.
1515    (define dep-maybe (lambda ()
1516       (if (exist? "hard") "" "maybe-")))
1518    ;; dep-kind returns "normal" if the dependency is on an "install" target,
1519    ;; or if either module is not bootstrapped.  It returns "bootstrap" for
1520    ;; configure or build dependencies between bootstrapped modules; it returns
1521    ;; "prebootstrap" for configure or build dependencies of bootstrapped
1522    ;; modules on a build module (e.g. all-gcc on all-build-bison).  All this
1523    ;; is only necessary for host modules.
1524    (define dep-kind (lambda ()
1525       (if (and (hash-ref boot-modules (dep-module "module"))
1526                (=* (dep-module "on") "build-"))
1527           "prebootstrap"
1529           (if (or (= (dep-subtarget "on") "install-")
1530                   (not (hash-ref boot-modules (dep-module "module")))
1531                   (not (hash-ref boot-modules (dep-module "on"))))
1532               "normal"
1533               "bootstrap"))))
1535    ;; We now build the hash table that is used by dep-kind.
1536    (define boot-modules (make-hash-table 113))
1539 [+ FOR host_modules +][+
1540    (if (exist? "bootstrap")
1541        (hash-create-handle! boot-modules (get "module") #t))
1542    "" +][+ ENDFOR host_modules +]
1543 [+ FOR target_modules +][+
1544    (if (exist? "bootstrap")
1545        (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1546    "" +][+ ENDFOR target_modules +]
1548 # With all the machinery above in place, it is pretty easy to generate
1549 # dependencies.  Host dependencies are a bit more complex because we have
1550 # to check for bootstrap/prebootstrap dependencies.  To resolve
1551 # prebootstrap dependencies, prebootstrap modules are gathered in
1552 # a hash table.
1553 [+ FOR dependencies +][+ (make-dep "" "") +]
1554 [+ CASE (dep-kind) +]
1555 [+ == "prebootstrap"
1556      +][+ FOR bootstrap_stage +]
1557 [+ (make-dep (dep-stage) "") +][+
1558        ENDFOR bootstrap_stage +]
1559 [+ == "bootstrap"
1560      +][+ FOR bootstrap_stage +]
1561 [+ (make-dep (dep-stage) (dep-stage)) +][+
1562        ENDFOR bootstrap_stage +]
1563 [+ ESAC +][+
1564 ENDFOR dependencies +]
1566 # Dependencies for target modules on other target modules are
1567 # described by lang_env_dependencies; the defaults apply to anything
1568 # not mentioned there.
1570    ;; Predicate for whether LANG was specified in lang_env_dependencies.
1571    (define lang-dep (lambda (lang)
1572       (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1574    ;; Build the hash table we will need.
1575    (define lang-env-deps (make-hash-table 7))
1576 +][+ FOR lang_env_dependencies +][+
1577    (if (exist? "cxx")
1578        (hash-create-handle! lang-env-deps
1579           (string-append (get "module") "-" "cxx") #t))
1581    (if (exist? "no_c")
1582        (hash-create-handle! lang-env-deps
1583           (string-append (get "module") "-" "no_c") #t))
1585    (if (exist? "no_gcc")
1586        (hash-create-handle! lang-env-deps
1587           (string-append (get "module") "-" "no_gcc") #t))
1588    "" +][+ ENDFOR lang_env_dependencies +]
1590 @if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1591   +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1592 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1593   ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1594 @endif gcc-bootstrap
1596 @if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1597 configure-target-[+module+]: maybe-all-target-libgcc[+
1598   ENDIF +][+ ENDFOR target_modules +]
1599 @endif gcc-no-bootstrap
1601 [+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1602 configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1603   ENDIF +][+ IF (lang-dep "cxx") +]
1604 configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1605   ENDIF +]
1606 [+ ENDFOR target_modules +]
1608 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
1609 GDB_TK = @GDB_TK@
1610 INSTALL_GDB_TK = @INSTALL_GDB_TK@
1611 configure-gdb: $(CONFIGURE_GDB_TK)
1612 all-gdb: $(gdbnlmrequirements) $(GDB_TK)
1613 install-gdb: $(INSTALL_GDB_TK)
1615 # Serialization dependencies.  Host configures don't work well in parallel to
1616 # each other, due to contention over config.cache.  Target configures and 
1617 # build configures are similar.
1618 @serialization_dependencies@
1620 # --------------------------------
1621 # Regenerating top level configury
1622 # --------------------------------
1624 # Rebuilding Makefile.in, using autogen.
1625 AUTOGEN = autogen
1626 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1627         cd $(srcdir) && $(AUTOGEN) Makefile.def
1629 # Rebuilding Makefile.
1630 Makefile: $(srcdir)/Makefile.in config.status
1631         CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1633 config.status: configure
1634         CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
1636 # Rebuilding configure.
1637 AUTOCONF = autoconf
1638 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4
1639         cd $(srcdir) && $(AUTOCONF)
1641 # ------------------------------
1642 # Special directives to GNU Make
1643 # ------------------------------
1645 # Don't pass command-line variables to submakes.
1646 .NOEXPORT:
1647 MAKEOVERRIDES=
1649 # end of Makefile.in