OSDN Git Service

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