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