OSDN Git Service

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