2008-03-27 Paolo Bonzini <bonzini@gnu.org>
[binutils.git] / Makefile.tpl
blob95441f5bc4361fa7254eaa5c062eed2df28f8a3e
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) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CFLAGS; \
211         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
212         CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
213         CXXFLAGS="$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_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
326 # Only build the C compiler for stage1, because that is the only one that
327 # we can guarantee will build with the native compiler, and also it is the
328 # only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
329 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
330 # overrideable (for a bootstrap build stage1 also builds gcc.info).
332 STAGE1_CHECKING=@stage1_checking@
333 STAGE1_LANGUAGES=@stage1_languages@
335 STAGE1_CFLAGS=@stage1_cflags@
336 STAGE2_CFLAGS=$(BOOT_CFLAGS)
337 STAGE3_CFLAGS=$(BOOT_CFLAGS)
338 STAGE4_CFLAGS=$(BOOT_CFLAGS)
340 STAGE1_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
341 STAGE2_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
342 STAGE3_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
343 STAGE4_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
345 do-compare = @do_compare@
346 do-compare3 = $(do-compare)
347 do-compare-debug = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2
349 # -----------------------------------------------
350 # Programs producing files for the TARGET machine
351 # -----------------------------------------------
353 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
355 AR_FOR_TARGET=@AR_FOR_TARGET@
356 AS_FOR_TARGET=@AS_FOR_TARGET@
357 CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
359 # If GCC_FOR_TARGET is not overriden on the command line, then this
360 # variable is passed down to the gcc Makefile, where it is used to
361 # build libgcc2.a.  We define it here so that it can itself be
362 # overridden on the command line.
363 GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
364 CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
365 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
366 GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
367 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
368 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
369 LD_FOR_TARGET=@LD_FOR_TARGET@
371 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
372 NM_FOR_TARGET=@NM_FOR_TARGET@
373 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
374 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
375 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
376 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
377 WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
379 COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
380 COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
381 COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
383 CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
384 CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
385 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
386 DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
388 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
389 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
390 LDFLAGS_FOR_TARGET = 
392 # ------------------------------------
393 # Miscellaneous targets and flag lists
394 # ------------------------------------
396 # The first rule in the file had better be this one.  Don't put any above it.
397 # This lives here to allow makefile fragments to contain dependencies.
398 all:
400 #### host and target specific makefile fragments come in here.
401 @target_makefile_frag@
402 @alphaieee_frag@
403 @ospace_frag@
404 @host_makefile_frag@
407 # This is the list of directories that may be needed in RPATH_ENVVAR
408 # so that prorgams built for the target machine work.
409 TARGET_LIB_PATH = [+ FOR target_modules +][+
410   IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
411   ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
412 [+ FOR target_modules +][+ IF lib_path +]
413 @if target-[+module+]
414 TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
415 @endif target-[+module+]
416 [+ ENDIF lib_path +][+ ENDFOR target_modules +]
419 # This is the list of directories that may be needed in RPATH_ENVVAR
420 # so that programs built for the host machine work.
421 HOST_LIB_PATH = [+ FOR host_modules +][+
422   IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
423   ENDFOR host_modules +]
425 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
426 @if gcc
427 HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
428 @endif gcc
430 [+ FOR host_modules +][+ IF lib_path +]
431 @if [+module+]
432 HOST_LIB_PATH_[+module+] = \
433   $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
434   +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
435 @endif [+module+]
436 [+ ENDIF lib_path +][+ ENDFOR host_modules +]
438 # Flags to pass down to all sub-makes.
439 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
440         "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
441         "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +] \
442         "CONFIG_SHELL=$(SHELL)" \
443         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" 
445 # We leave this in just in case, but it is not needed anymore.
446 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
448 # Flags to pass down to most sub-makes, in which we're building with
449 # the host environment.
450 EXTRA_HOST_FLAGS = \
451         'AR=$(AR)' \
452         'AS=$(AS)' \
453         'CC=$(CC)' \
454         'CXX=$(CXX)' \
455         'DLLTOOL=$(DLLTOOL)' \
456         'LD=$(LD)' \
457         'LIPO=$(LIPO)' \
458         'NM=$(NM)' \
459         'OBJDUMP=$(OBJDUMP)' \
460         'RANLIB=$(RANLIB)' \
461         'STRIP=$(STRIP)' \
462         'WINDRES=$(WINDRES)' \
463         'WINDMC=$(WINDMC)'
465 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
467 # Flags that are concerned with the location of the X11 include files
468 # and library files
470 # NOTE: until the top-level is getting the values via autoconf, it only
471 # causes problems to have this top-level Makefile overriding the autoconf-set
472 # values in child directories.  Only variables that don't conflict with
473 # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
475 X11_FLAGS_TO_PASS = \
476         'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
477         'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
479 # Flags to pass to stage2 and later makes.
481 POSTSTAGE1_FLAGS_TO_PASS = \
482         CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
483         GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind" \
484         LDFLAGS="$(BOOT_LDFLAGS)" \
485         "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
487 # Flags to pass down to makes which are built with the target environment.
488 # The double $ decreases the length of the command line; those variables
489 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.  The
490 # *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
491 # so we expand them here.
492 EXTRA_TARGET_FLAGS = \
493         'AR=$$(AR_FOR_TARGET)' \
494         'AS=$(COMPILER_AS_FOR_TARGET)' \
495         'CC=$$(CC_FOR_TARGET)' \
496         'CFLAGS=$$(CFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
497         'CXX=$$(CXX_FOR_TARGET)' \
498         'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
499         'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
500         'LD=$(COMPILER_LD_FOR_TARGET)' \
501         'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
502         'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
503         'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
504         'NM=$(COMPILER_NM_FOR_TARGET)' \
505         'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
506         'RANLIB=$$(RANLIB_FOR_TARGET)' \
507         'WINDRES=$$(WINDRES_FOR_TARGET)' \
508         'WINDMC=$$(WINDMC_FOR_TARGET)'
510 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
512 # Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
513 # unfortunately needs the native compiler and the target ar and
514 # ranlib.
515 # If any variables are added here, they must be added to do-*, below.
516 # The BUILD_* variables are a special case, which are used for the gcc
517 # cross-building scheme.
518 EXTRA_GCC_FLAGS = \
519         "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
520         "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
521         "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
522         "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
523         "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
524         "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
526 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
528 .PHONY: configure-host
529 configure-host: [+
530   FOR host_modules +] \
531     maybe-configure-[+module+][+
532   ENDFOR host_modules +]
533 .PHONY: configure-target
534 configure-target: [+
535   FOR target_modules +] \
536     maybe-configure-target-[+module+][+
537   ENDFOR target_modules +]
539 # The target built for a native non-bootstrap build.
540 .PHONY: all
541 all:
542 @if gcc-bootstrap
543         [ -f stage_final ] || echo stage3 > stage_final
544         @r=`${PWD_COMMAND}`; export r; \
545         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
546         $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
547 @endif gcc-bootstrap
548         @: $(MAKE); $(unstage)
549         @r=`${PWD_COMMAND}`; export r; \
550         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
551         if [ -f stage_last ]; then \
552           $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
553         else \
554           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
555         fi
557 .PHONY: all-build
558 [+ FOR build_modules +]
559 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
561 .PHONY: all-host
562 [+ FOR host_modules +][+ IF bootstrap +]
563 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
564 all-host: maybe-all-[+module+][+ IF bootstrap +]
565 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
567 .PHONY: all-target
568 [+ FOR target_modules +][+ IF bootstrap +]
569 @if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
570 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
571 @endif target-[+module+]-no-bootstrap[+
572   ENDIF bootstrap +][+ ENDFOR target_modules +]
574 # Do a target for all the subdirectories.  A ``make do-X'' will do a
575 # ``make X'' in all subdirectories (because, in general, there is a
576 # dependency (below) of X upon do-X, a ``make X'' will also do this,
577 # but it may do additional work as well).
578 [+ FOR recursive_targets +]
579 .PHONY: do-[+make_target+]
580 do-[+make_target+]:
581         @: $(MAKE); $(unstage)
582         @r=`${PWD_COMMAND}`; export r; \
583         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
584         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
585           [+make_target+]-target
588 .PHONY: [+make_target+]-host
589 [+ FOR host_modules +]
590 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
592 .PHONY: [+make_target+]-target
593 [+ FOR target_modules +]
594 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
595 [+ ENDFOR recursive_targets +]
597 # Here are the targets which correspond to the do-X targets.
599 .PHONY: info installcheck dvi pdf html
600 .PHONY: install-info install-pdf install-html
601 .PHONY: clean distclean mostlyclean maintainer-clean realclean
602 .PHONY: local-clean local-distclean local-maintainer-clean
603 info: do-info
604 installcheck: do-installcheck
605 dvi: do-dvi
606 pdf: do-pdf
607 html: do-html
609 # Make sure makeinfo is built before we do a `make info', if we're
610 # in fact building texinfo.
611 do-info: maybe-all-texinfo
613 install-info: do-install-info dir.info
614         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
615         if [ -f dir.info ] ; then \
616           $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
617         else true ; fi
619 install-pdf: do-install-pdf
621 install-html: do-install-html
623 local-clean:
624         -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
626 local-distclean:
627         -rm -f Makefile config.status config.cache mh-frag mt-frag
628         -rm -f maybedep.tmp serdep.tmp
629         -if [ "$(TARGET_SUBDIR)" != "." ]; then \
630           rm -rf $(TARGET_SUBDIR); \
631         else true; fi
632         -rm -rf $(BUILD_SUBDIR)
633         -if [ "$(HOST_SUBDIR)" != "." ]; then \
634           rm -rf $(HOST_SUBDIR); \
635         else true; fi
636         -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
637         -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
638         -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
639         -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
640         -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
642 local-maintainer-clean:
643         @echo "This command is intended for maintainers to use;"
644         @echo "it deletes files that may require special tools to rebuild."
646 clean: do-clean local-clean
647 mostlyclean: do-mostlyclean local-clean
648 distclean: do-distclean local-clean local-distclean
649 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
650 maintainer-clean: local-distclean
651 realclean: maintainer-clean
653 # Check target.
655 .PHONY: check do-check
656 check: do-check
658 # Only include modules actually being configured and built.
659 .PHONY: check-host
660 check-host: [+
661   FOR host_modules +] \
662     maybe-check-[+module+][+
663   ENDFOR host_modules +]
665 .PHONY: check-target
666 check-target: [+
667   FOR target_modules +] \
668     maybe-check-target-[+module+][+
669   ENDFOR target_modules +]
671 do-check:
672         @: $(MAKE); $(unstage)
673         @r=`${PWD_COMMAND}`; export r; \
674         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
675         $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
677 # Automated reporting of test results.
679 warning.log: build.log
680         $(srcdir)/contrib/warn_summary build.log > $@
682 mail-report.log:
683         if test x'$(BOOT_CFLAGS)' != x''; then \
684             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
685         fi; \
686         $(srcdir)/contrib/test_summary -t >$@
687         chmod +x $@
688         echo If you really want to send e-mail, run ./$@ now
690 mail-report-with-warnings.log: warning.log
691         if test x'$(BOOT_CFLAGS)' != x''; then \
692             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
693         fi; \
694         $(srcdir)/contrib/test_summary -t -i warning.log >$@
695         chmod +x $@
696         echo If you really want to send e-mail, run ./$@ now
698 # Installation targets.
700 .PHONY: install uninstall
701 install:
702         @: $(MAKE); $(unstage)
703         @r=`${PWD_COMMAND}`; export r; \
704         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
705         $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
707 .PHONY: install-host-nogcc
708 install-host-nogcc: [+
709   FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
710     maybe-install-[+module+][+ ENDIF +][+
711   ENDFOR host_modules +]
713 .PHONY: install-host
714 install-host: [+
715   FOR host_modules +] \
716     maybe-install-[+module+][+
717   ENDFOR host_modules +]
719 .PHONY: install-target
720 install-target: [+
721   FOR target_modules +] \
722     maybe-install-target-[+module+][+
723   ENDFOR target_modules +]
725 uninstall:
726         @echo "the uninstall target is not supported in this tree"
728 .PHONY: install.all
729 install.all: install-no-fixedincludes
730         @if [ -f ./gcc/Makefile ] ; then \
731                 r=`${PWD_COMMAND}` ; export r ; \
732                 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
733                 $(HOST_EXPORTS) \
734                 (cd ./gcc && \
735                 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
736         else \
737                 true ; \
738         fi
740 # install-no-fixedincludes is used because Cygnus can not distribute
741 # the fixed header files.
742 .PHONY: install-no-fixedincludes
743 install-no-fixedincludes: installdirs install-host-nogcc \
744         install-target gcc-no-fixedincludes
746 ### other supporting targets
748 MAKEDIRS= \
749         $(DESTDIR)$(prefix) \
750         $(DESTDIR)$(exec_prefix)
751 .PHONY: installdirs
752 installdirs: mkinstalldirs
753         $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
755 dir.info: do-install-info
756         if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
757           $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
758           mv -f dir.info.new dir.info ; \
759         else true ; \
760         fi
762 dist:
763         @echo "Building a full distribution of this tree isn't done"
764         @echo "via 'make dist'.  Check out the etc/ subdirectory" 
766 etags tags: TAGS
768 # Right now this just builds TAGS in each subdirectory.  emacs19 has the
769 # ability to use several tags files at once, so there is probably no need
770 # to combine them into one big TAGS file (like CVS 1.3 does).  We could
771 # (if we felt like it) have this Makefile write a piece of elisp which
772 # the user could load to tell emacs19 where all the TAGS files we just
773 # built are.
774 TAGS: do-TAGS
776 # ------------------------------------
777 # Macros for configure and all targets
778 # ------------------------------------
780 [+ DEFINE configure +]
781 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
782 maybe-configure-[+prefix+][+module+]:
783 @if gcc-bootstrap
784 configure-[+prefix+][+module+]: stage_current
785 @endif gcc-bootstrap
786 @if [+prefix+][+module+]
787 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
788 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
789         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
790         @r=`${PWD_COMMAND}`; export r; \
791         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
792         [+ IF check_multilibs
793         +]echo "Checking multilib configuration for [+module+]..."; \
794         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
795         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
796         if test -r [+subdir+]/[+module+]/multilib.out; then \
797           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
798             rm -f [+subdir+]/[+module+]/multilib.tmp; \
799           else \
800             rm -f [+subdir+]/[+module+]/Makefile; \
801             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
802           fi; \
803         else \
804           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
805         fi; \
806         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
807         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
808         [+exports+] \
809         echo Configuring in [+subdir+]/[+module+]; \
810         cd "[+subdir+]/[+module+]" || exit 1; \
811         case $(srcdir) in \
812           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
813           *) topdir=`echo [+subdir+]/[+module+]/ | \
814                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
815         esac; \
816         srcdiroption="--srcdir=$${topdir}/[+module+]"; \
817         libsrcdir="$$s/[+module+]"; \
818         [+ IF no-config-site +]rm -f no-such-file || : ; \
819         CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
820           [+args+] --build=${build_alias} --host=[+host_alias+] \
821           --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
822           || exit 1
823 @endif [+prefix+][+module+]
825 [+ IF bootstrap +]
826 [+ FOR bootstrap_stage +]
827 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
828 maybe-configure-stage[+id+]-[+prefix+][+module+]:
829 @if [+prefix+][+module+]-bootstrap
830 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
831 configure-stage[+id+]-[+prefix+][+module+]:
832         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
833         @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
834         @r=`${PWD_COMMAND}`; export r; \
835         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
836         [+ IF check_multilibs
837         +]echo "Checking multilib configuration for [+module+]..."; \
838         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
839         if test -r [+subdir+]/[+module+]/multilib.out; then \
840           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
841             rm -f [+subdir+]/[+module+]/multilib.tmp; \
842           else \
843             rm -f [+subdir+]/[+module+]/Makefile; \
844             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
845           fi; \
846         else \
847           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
848         fi; \
849         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
850         [+exports+][+ IF prev +] \
851         [+poststage1_exports+][+ ENDIF prev +] [+ IF prefix +] \
852         CFLAGS="[+stage_libcflags+] $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CFLAGS; \
853         CXXFLAGS="[+stage_libcflags+] $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CXXFLAGS; [+ ELSE +] \
854         CFLAGS="[+stage_cflags+]"; export CFLAGS; \
855         CXXFLAGS="[+stage_cflags+]"; export CXXFLAGS; [+ ENDIF +] \
856         echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
857         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
858         cd [+subdir+]/[+module+] || exit 1; \
859         case $(srcdir) in \
860           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
861           *) topdir=`echo [+subdir+]/[+module+]/ | \
862                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
863         esac; \
864         srcdiroption="--srcdir=$${topdir}/[+module+]"; \
865         libsrcdir="$$s/[+module+]"; \
866         $(SHELL) $${libsrcdir}/configure \
867           [+args+] --build=${build_alias} --host=[+host_alias+] \
868           --target=[+target_alias+] $${srcdiroption} \
869           [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
870           [+stage_configure_flags+] [+extra_configure_flags+]
871 @endif [+prefix+][+module+]-bootstrap
872 [+ ENDFOR bootstrap_stage +]
873 [+ ENDIF bootstrap +]
874 [+ ENDDEF +]
876 [+ DEFINE all +]
877 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
878 maybe-all-[+prefix+][+module+]:
879 @if gcc-bootstrap
880 all-[+prefix+][+module+]: stage_current
881 @endif gcc-bootstrap
882 @if [+prefix+][+module+]
883 TARGET-[+prefix+][+module+]=[+
884   IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
885 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
886 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
887         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
888         @r=`${PWD_COMMAND}`; export r; \
889         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
890         [+exports+] \
891         (cd [+subdir+]/[+module+] && \
892           $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+extra_make_flags+] \
893                 $(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) $(BASE_FLAGS_TO_PASS) \
914                 CFLAGS="[+stage_cflags+]" CXXFLAGS="[+stage_cflags+]" \
915                 LIBCFLAGS="[+stage_libcflags+]" \
916                 CFLAGS_FOR_TARGET="[+stage_libcflags+]" \
917                 CXXFLAGS_FOR_TARGET="[+stage_libcflags+]" [+args+] [+
918                 IF prev +][+poststage1_args+][+ ENDIF prev
919                 +] [+extra_make_flags+] \
920                 $(TARGET-stage[+id+]-[+prefix+][+module+])
922 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
923 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
924 clean-stage[+id+]-[+prefix+][+module+]:
925         @if [ $(current_stage) = stage[+id+] ]; then \
926           [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
927         else \
928           [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
929           $(MAKE) stage[+id+]-start; \
930         fi; \
931         cd [+subdir+]/[+module+] && \
932         $(MAKE) [+args+] [+ IF prev +] \
933                 [+poststage1_args+] [+ ENDIF prev +] \
934                 [+extra_make_flags+] clean
935 @endif [+prefix+][+module+]-bootstrap
937 [+ ENDFOR bootstrap_stage +]
938 [+ ENDIF bootstrap +]
939 [+ ENDDEF +]
941 # --------------------------------------
942 # Modules which run on the build machine
943 # --------------------------------------
944 [+ FOR build_modules +]
945 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
946              host_alias=(get "host" "${build_alias}")
947              target_alias=(get "target" "${target_alias}")
948              args="$(BUILD_CONFIGARGS)" no-config-site=true +]
950 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
951 [+ ENDFOR build_module +]
953 # --------------------------------------
954 # Modules which run on the host machine
955 # --------------------------------------
956 [+ FOR host_modules +]
957 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
958              exports="$(HOST_EXPORTS)"
959              poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
960              host_alias=(get "host" "${host_alias}")
961              target_alias=(get "target" "${target_alias}")
962              args="$(HOST_CONFIGARGS)" +]
964 [+ all prefix="" subdir="$(HOST_SUBDIR)"
965        exports="$(HOST_EXPORTS)"
966        poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
967        args="$(EXTRA_HOST_FLAGS)"
968        poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
970 .PHONY: check-[+module+] maybe-check-[+module+]
971 maybe-check-[+module+]:
972 @if [+module+]
973 maybe-check-[+module+]: check-[+module+]
974 [+ IF no_check +]
975 check-[+module+]:
976 [+ ELIF no_check_cross +]
977 # This module is only tested in a native toolchain.
978 check-[+module+]:
979         @: $(MAKE); $(unstage)
980         @if [ '$(host)' = '$(target)' ] ; then \
981           r=`${PWD_COMMAND}`; export r; \
982           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
983           $(HOST_EXPORTS) \
984           (cd $(HOST_SUBDIR)/[+module+] && \
985             $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
986         fi
987 [+ ELSE check +]
988 check-[+module+]:
989         @: $(MAKE); $(unstage)
990         @r=`${PWD_COMMAND}`; export r; \
991         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
992         $(HOST_EXPORTS) \
993         (cd $(HOST_SUBDIR)/[+module+] && \
994           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
995 [+ ENDIF no_check +]
996 @endif [+module+]
998 .PHONY: install-[+module+] maybe-install-[+module+]
999 maybe-install-[+module+]:
1000 @if [+module+]
1001 maybe-install-[+module+]: install-[+module+]
1002 [+ IF no_install +]
1003 install-[+module+]:
1004 [+ ELSE install +]
1005 install-[+module+]: installdirs
1006         @: $(MAKE); $(unstage)
1007         @r=`${PWD_COMMAND}`; export r; \
1008         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1009         $(HOST_EXPORTS) \
1010         (cd $(HOST_SUBDIR)/[+module+] && \
1011           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
1012 [+ ENDIF no_install +]
1013 @endif [+module+]
1015 # Other targets (info, dvi, pdf, etc.)
1016 [+ FOR recursive_targets +]
1017 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1018 maybe-[+make_target+]-[+module+]:
1019 @if [+module+]
1020 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
1021 [+ IF (match-value? = "missing" (get "make_target") ) +]
1022 # [+module+] doesn't support [+make_target+].
1023 [+make_target+]-[+module+]:
1024 [+ ELSE +]
1025 [+make_target+]-[+module+]: [+
1026   FOR depend +]\
1027     [+depend+]-[+module+] [+
1028   ENDFOR depend +]
1029         @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1030         @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
1031         r=`${PWD_COMMAND}`; export r; \
1032         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1033         $(HOST_EXPORTS) \
1034         for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1035           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1036         done; \
1037         echo "Doing [+make_target+] in [+module+]" ; \
1038         (cd $(HOST_SUBDIR)/[+module+] && \
1039           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1040                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1041                   "RANLIB=$${RANLIB}" \
1042                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1043                   [+make_target+]) \
1044           || exit 1
1045 [+ ENDIF +]
1046 @endif [+module+]
1047 [+ ENDFOR recursive_targets +]
1048 [+ ENDFOR host_modules +]
1050 # ---------------------------------------
1051 # Modules which run on the target machine
1052 # ---------------------------------------
1053 [+ FOR target_modules +]
1055 [+ IF raw_cxx +]
1056 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1057              check_multilibs=true
1058              exports="$(RAW_CXX_TARGET_EXPORTS)"
1059              host_alias=(get "host" "${target_alias}")
1060              target_alias=(get "target" "${target_alias}")
1061              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1063 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1064        exports="$(RAW_CXX_TARGET_EXPORTS)"
1065        args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1066 [+ ELSE +]
1067 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1068              check_multilibs=true
1069              exports="$(NORMAL_TARGET_EXPORTS)"
1070              host_alias=(get "host" "${target_alias}")
1071              target_alias=(get "target" "${target_alias}")
1072              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1074 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1075        exports="$(NORMAL_TARGET_EXPORTS)"
1076        args="$(EXTRA_TARGET_FLAGS)" +]
1077 [+ ENDIF +]
1079 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1080 maybe-check-target-[+module+]:
1081 @if target-[+module+]
1082 maybe-check-target-[+module+]: check-target-[+module+]
1083 [+ IF no_check +]
1084 # Dummy target for uncheckable module.
1085 check-target-[+module+]:
1086 [+ ELSE check +]
1087 check-target-[+module+]:
1088         @: $(MAKE); $(unstage)
1089         @r=`${PWD_COMMAND}`; export r; \
1090         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1091 IF raw_cxx +]
1092         $(RAW_CXX_TARGET_EXPORTS) \[+
1093 ELSE normal_cxx +]
1094         $(NORMAL_TARGET_EXPORTS) \[+
1095 ENDIF raw_cxx +]
1096         (cd $(TARGET_SUBDIR)/[+module+] && \
1097           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1098             IF raw_cxx 
1099               +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1100             ENDIF raw_cxx 
1101           +] [+extra_make_flags+] check)
1102 [+ ENDIF no_check +]
1103 @endif target-[+module+]
1105 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1106 maybe-install-target-[+module+]:
1107 @if target-[+module+]
1108 maybe-install-target-[+module+]: install-target-[+module+]
1109 [+ IF no_install +]
1110 # Dummy target for uninstallable.
1111 install-target-[+module+]:
1112 [+ ELSE install +]
1113 install-target-[+module+]: installdirs
1114         @: $(MAKE); $(unstage)
1115         @r=`${PWD_COMMAND}`; export r; \
1116         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1117 IF raw_cxx +]
1118         $(RAW_CXX_TARGET_EXPORTS) \[+
1119 ELSE normal_cxx +]
1120         $(NORMAL_TARGET_EXPORTS) \[+
1121 ENDIF raw_cxx +]
1122         (cd $(TARGET_SUBDIR)/[+module+] && \
1123           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1124 [+ ENDIF no_install +]
1125 @endif target-[+module+]
1127 # Other targets (info, dvi, pdf, etc.)
1128 [+ FOR recursive_targets +]
1129 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1130 maybe-[+make_target+]-target-[+module+]:
1131 @if target-[+module+]
1132 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1133 [+ IF (match-value? = "missing" (get "make_target") ) +]
1134 # [+module+] doesn't support [+make_target+].
1135 [+make_target+]-target-[+module+]:
1136 [+ ELSE +]
1137 [+make_target+]-target-[+module+]: [+
1138   FOR depend +]\
1139     [+depend+]-target-[+module+] [+
1140   ENDFOR depend +]
1141         @: $(MAKE); $(unstage)
1142         @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1143         r=`${PWD_COMMAND}`; export r; \
1144         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1145 IF raw_cxx +]
1146         $(RAW_CXX_TARGET_EXPORTS) \[+
1147 ELSE normal_cxx +]
1148         $(NORMAL_TARGET_EXPORTS) \[+
1149 ENDIF raw_cxx +]
1150         echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1151         for flag in $(EXTRA_TARGET_FLAGS); do \
1152           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1153         done; \
1154         (cd $(TARGET_SUBDIR)/[+module+] && \
1155           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1156                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1157                   "RANLIB=$${RANLIB}" \
1158                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1159                   [+extra_make_flags+] [+make_target+]) \
1160           || exit 1
1161 [+ ENDIF +]
1162 @endif target-[+module+]
1163 [+ ENDFOR recursive_targets +]
1164 [+ ENDFOR target_modules +]
1166 # ----------
1167 # GCC module
1168 # ----------
1170 @if gcc-no-bootstrap
1171 .PHONY: cross
1172 cross: all-build all-gas all-ld
1173         @r=`${PWD_COMMAND}`; export r; \
1174         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1175         $(HOST_EXPORTS) \
1176         echo "Building the C and C++ compiler"; \
1177         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1178         @r=`${PWD_COMMAND}`; export r; \
1179         s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1180         echo "Building runtime libraries"; \
1181         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1182 @endif gcc-no-bootstrap
1184 @if gcc
1185 .PHONY: check-gcc-c++
1186 check-gcc-c++:
1187         @if [ -f ./gcc/Makefile ] ; then \
1188           r=`${PWD_COMMAND}`; export r; \
1189           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1190           $(HOST_EXPORTS) \
1191           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
1192         else \
1193           true; \
1194         fi
1196 .PHONY: check-c++
1197 check-c++: check-target-libstdc++-v3 check-gcc-c++
1199 # Install the gcc headers files, but not the fixed include files,
1200 # which Cygnus is not allowed to distribute.  This rule is very
1201 # dependent on the workings of the gcc Makefile.in.
1202 .PHONY: gcc-no-fixedincludes
1203 gcc-no-fixedincludes:
1204         @if [ -f ./gcc/Makefile ]; then \
1205           rm -rf gcc/tmp-include; \
1206           mv gcc/include gcc/tmp-include 2>/dev/null; \
1207           mkdir gcc/include; \
1208           cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1209           touch gcc/stmp-fixinc gcc/include/fixed; \
1210           rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1211           r=`${PWD_COMMAND}`; export r; \
1212           s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1213           $(HOST_EXPORTS) \
1214           (cd ./gcc && \
1215            $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1216           rm -rf gcc/include; \
1217           mv gcc/tmp-include gcc/include 2>/dev/null; \
1218         else true; fi
1219 @endif gcc
1221 # ---------------------
1222 # GCC bootstrap support
1223 # ---------------------
1225 # We track the current stage (the one in 'gcc') in the stage_current file.
1226 # stage_last instead tracks the stage that was built last.  These targets
1227 # are dummy when toplevel bootstrap is not active.
1229 # While making host and target tools, symlinks to the final stage must be
1230 # there, so $(unstage) should be run at various points.  To avoid excessive
1231 # recursive invocations of make, we "inline" them using a variable.  These
1232 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1233 # to avoid warnings from the GNU Make job server.
1235 unstage = :
1236 stage = :
1237 current_stage = ""
1239 @if gcc-bootstrap
1240 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1241 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1242 current_stage = "`cat stage_current 2> /dev/null`"
1243 @endif gcc-bootstrap
1245 .PHONY: unstage stage
1246 unstage:
1247         @: $(MAKE); $(unstage)
1248 stage:
1249         @: $(MAKE); $(stage)
1251 # Disable commands for lean bootstrap.
1252 LEAN = false
1254 # We name the build directories for the various stages "stage1-gcc",
1255 # "stage2-gcc","stage3-gcc", etc.
1257 # Since the 'compare' process will fail (on debugging information) if any
1258 # directory names are different, we need to link the gcc directory for
1259 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1260 # the build directories constant as well. For the latter, we use naked names
1261 # like 'gcc', because the scripts in that directory assume it.  We use
1262 # mv on platforms where symlinks to directories do not work or are not
1263 # reliable.
1265 # 'touch' doesn't work right on some platforms.
1266 STAMP = echo timestamp > 
1268 # We only want to compare .o files, so set this!
1269 objext = .o
1271 [+ FOR bootstrap-stage +]
1272 .PHONY: stage[+id+]-start stage[+id+]-end
1274 stage[+id+]-start::
1275         @: $(MAKE); $(stage); \
1276         echo stage[+id+] > stage_current ; \
1277         echo stage[+id+] > stage_last; \
1278         $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1279    FOR host_modules +][+ IF bootstrap +]
1280 @if [+ module +]
1281         @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1282           mkdir stage[+id+]-[+module+]; \
1283         mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1284         mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1285 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1286         @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1287           mkdir stage[+id+]-$(TARGET_SUBDIR); \
1288         mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1289         mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1291 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1292 @if [+ module +]
1293         @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1294           cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1295           mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
1296         fi
1297 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1298         @if test -d $(TARGET_SUBDIR) ; then \
1299           mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1300           mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
1301         fi
1302         rm -f stage_current
1304 # Bubble a bug fix through all the stages up to stage [+id+].  They are
1305 # remade, but not reconfigured.  The next stage (if any) will not be
1306 # reconfigured as well.
1307 .PHONY: stage[+id+]-bubble
1308 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1309         @r=`${PWD_COMMAND}`; export r; \
1310         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1311         if test -f stage[+id+]-lean [+
1312           IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1313           echo Skipping rebuild of stage[+id+] ; \
1314         else \
1315           $(MAKE) stage[+id+]-start; \[+IF lean +]
1316           if $(LEAN); then \
1317             rm -rf stage[+lean+]-* ; \
1318             $(STAMP) stage[+lean+]-lean ; \
1319           fi; \[+ ENDIF lean +]
1320           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1321         fi[+ IF compare-target +]
1322         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1324 .PHONY: all-stage[+id+] clean-stage[+id+]
1325 do-clean: clean-stage[+id+]
1327 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1328 # only possibility, but now it conflicts with no-bootstrap rules
1329 @if gcc-bootstrap
1330 [+ IF compare-target +]
1331 [+compare-target+]:
1332         @r=`${PWD_COMMAND}`; export r; \
1333         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1334         if test -f stage[+prev+]-lean; then \
1335           echo Cannot compare object files as stage [+prev+] was deleted. ; \
1336           exit 0 ; \
1337         fi; \
1338         : $(MAKE); $(stage); \
1339         rm -f .bad_compare ; \
1340         echo Comparing stages [+prev+] and [+id+] ; \
1341         cd stage[+id+]-gcc; \
1342         files=`find . -name "*$(objext)" -print` ; \
1343         cd .. ; \
1344         for file in $${files} ; do \
1345           f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
1346           $(do-[+compare-target+]) > /dev/null 2>&1; \
1347           if test $$? -eq 1; then \
1348             case $$file in \
1349               ./cc*-checksum$(objext) | ./libgcc/* ) \
1350                 echo warning: $$file differs ;; \
1351               *) \
1352                 echo $$file differs >> .bad_compare ;; \
1353             esac ; \
1354           fi ; \
1355         done ; \
1356         if [ -f .bad_compare ]; then \
1357           echo "Bootstrap comparison failure!"; \
1358           cat .bad_compare; \
1359           exit 1; \
1360         else \
1361           echo Comparison successful.; \
1362         fi ; \
1363         $(STAMP) [+compare-target+][+ IF prev +]
1364         if $(LEAN); then \
1365           rm -rf stage[+prev+]-*; \
1366           $(STAMP) stage[+prev+]-lean; \
1367         fi[+ ENDIF prev +]
1368 [+ ENDIF compare-target +]
1370 [+ IF bootstrap-target +]
1371 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1372 [+bootstrap-target+]:
1373         echo stage[+id+] > stage_final
1374         @r=`${PWD_COMMAND}`; export r; \
1375         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1376         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1377         @: $(MAKE); $(unstage)
1378         @r=`${PWD_COMMAND}`; export r; \
1379         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1380         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1382 [+bootstrap-target+]-lean:
1383         echo stage[+id+] > stage_final
1384         @r=`${PWD_COMMAND}`; export r; \
1385         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1386         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1387         @: $(MAKE); $(unstage)
1388         @r=`${PWD_COMMAND}`; export r; \
1389         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1390         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1391 [+ ENDIF bootstrap-target +]
1393 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1394 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1395 .PHONY: distclean-stage[+id+]
1396 distclean-stage[+id+]::
1397         @: $(MAKE); $(stage)
1398         @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1399         rm -rf stage[+id+]-* [+
1400           IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1402 [+ IF cleanstrap-target +]
1403 .PHONY: [+cleanstrap-target+]
1404 [+cleanstrap-target+]: do-distclean local-clean
1405         echo stage[+id+] > stage_final
1406         @r=`${PWD_COMMAND}`; export r; \
1407         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1408         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1409         @: $(MAKE); $(unstage)
1410         @r=`${PWD_COMMAND}`; export r; \
1411         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1412         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1413 [+ ENDIF cleanstrap-target +]
1414 @endif gcc-bootstrap
1416 [+ ENDFOR bootstrap-stage +]
1418 stageprofile-end::
1419         $(MAKE) distclean-stagefeedback
1421 stagefeedback-start::
1422         @r=`${PWD_COMMAND}`; export r; \
1423         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1424         for i in prev-*; do \
1425           j=`echo $$i | sed s/^prev-//` ; \
1426           cd $$r/$$i && \
1427           { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1428           { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1429         done
1431 @if gcc-bootstrap
1432 do-distclean: distclean-stage1
1434 # Provide a GCC build when we're building target libraries.  This does
1435 # not work as a dependency, just as the minimum necessary to avoid errors.
1436 stage_last:
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