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