OSDN Git Service

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