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