Mention "PR ld/6741" in ChangeLog.
[binutils.git] / Makefile.tpl
blob9c72014295d5caa57e236f36bd8d0efab874fd89
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, 2005, 2006, 2007 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 # First, test for a proper version of make, but only where one is required.
28 @if gcc
29 ifeq (,$(.VARIABLES)) # The variable .VARIABLES, new with 3.80, is never empty.
30 $(error GNU make version 3.80 or newer is required.)
31 endif
32 @endif gcc
34 # -------------------------------
35 # Standard Autoconf-set variables
36 # -------------------------------
37 VPATH=@srcdir@
39 build_alias=@build_noncanonical@
40 build_vendor=@build_vendor@
41 build_os=@build_os@
42 build=@build@
43 host_alias=@host_noncanonical@
44 host_vendor=@host_vendor@
45 host_os=@host_os@
46 host=@host@
47 target_alias=@target_noncanonical@
48 target_vendor=@target_vendor@
49 target_os=@target_os@
50 target=@target@
52 program_transform_name = @program_transform_name@
54 prefix = @prefix@
55 exec_prefix = @exec_prefix@
57 srcdir = @srcdir@
59 bindir = @bindir@
60 sbindir = @sbindir@
61 libexecdir = @libexecdir@
62 datadir = @datadir@
63 sysconfdir = @sysconfdir@
64 sharedstatedir = @sharedstatedir@
65 localstatedir = @localstatedir@
66 libdir = @libdir@
67 includedir = @includedir@
68 oldincludedir = @oldincludedir@
69 infodir = @infodir@
70 datarootdir = @datarootdir@
71 docdir = @docdir@
72 pdfdir = @pdfdir@
73 htmldir = @htmldir@
74 mandir = @mandir@
75 man1dir = $(mandir)/man1
76 man2dir = $(mandir)/man2
77 man3dir = $(mandir)/man3
78 man4dir = $(mandir)/man4
79 man5dir = $(mandir)/man5
80 man6dir = $(mandir)/man6
81 man7dir = $(mandir)/man7
82 man8dir = $(mandir)/man8
83 man9dir = $(mandir)/man9
85 INSTALL = @INSTALL@
86 INSTALL_PROGRAM = @INSTALL_PROGRAM@
87 INSTALL_SCRIPT = @INSTALL_SCRIPT@
88 INSTALL_DATA = @INSTALL_DATA@
89 LN = @LN@
90 LN_S = @LN_S@
91 MAINT = @MAINT@
92 MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
93 MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
95 # -------------------------------------------------
96 # Miscellaneous non-standard autoconf-set variables
97 # -------------------------------------------------
99 # The gcc driver likes to know the arguments it was configured with.
100 TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
102 tooldir = @tooldir@
103 build_tooldir = @build_tooldir@
105 GDB_NLM_DEPS = 
107 # This is the name of the environment variable used for the path to
108 # the libraries.
109 RPATH_ENVVAR = @RPATH_ENVVAR@
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@ --with-build-subdir="$(BUILD_SUBDIR)"
117 # This is the list of variables to export in the environment when
118 # configuring any subdirectory.  It must also be exported whenever
119 # recursing into a build directory in case that directory's Makefile
120 # re-runs configure.
121 BASE_EXPORTS = \
122         FLEX="$(FLEX)"; export FLEX; \
123         LEX="$(LEX)"; export LEX; \
124         BISON="$(BISON)"; export BISON; \
125         YACC="$(YACC)"; export YACC; \
126         M4="$(M4)"; export M4; \
127         MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
129 # This is the list of variables to export in the environment when
130 # configuring subdirectories for the build system.
131 BUILD_EXPORTS = \
132         $(BASE_EXPORTS) \
133         AR="$(AR_FOR_BUILD)"; export AR; \
134         AS="$(AS_FOR_BUILD)"; export AS; \
135         CC="$(CC_FOR_BUILD)"; export CC; \
136         CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
137         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
138         CXX="$(CXX_FOR_BUILD)"; export CXX; \
139         CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
140         GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
141         GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
142         DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
143         LD="$(LD_FOR_BUILD)"; export LD; \
144         LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
145         NM="$(NM_FOR_BUILD)"; export NM; \
146         RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
147         WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
148         WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
150 # These variables must be set on the make command line for directories
151 # built for the build system to override those in BASE_FLAGS_TO_PASSS.
152 EXTRA_BUILD_FLAGS = \
153         CFLAGS="$(CFLAGS_FOR_BUILD)" \
154         LDFLAGS="$(LDFLAGS_FOR_BUILD)"
156 # This is the list of directories to built for the host system.
157 SUBDIRS = @configdirs@
158 # This is set by the configure script to the arguments to use when configuring
159 # directories built for the host system.
160 HOST_CONFIGARGS = @host_configargs@
161 # Host programs are put under this directory, which is . except if building
162 # with srcdir=..
163 HOST_SUBDIR = @host_subdir@
164 # This is the list of variables to export in the environment when
165 # configuring subdirectories for the host system.  We need to pass
166 # some to the GCC configure because of its hybrid host/target nature.
167 HOST_EXPORTS = \
168         $(BASE_EXPORTS) \
169         CC="$(CC)"; export CC; \
170         CFLAGS="$(CFLAGS)"; export CFLAGS; \
171         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
172         CXX="$(CXX)"; export CXX; \
173         CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
174         AR="$(AR)"; export AR; \
175         AS="$(AS)"; export AS; \
176         CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
177         DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
178         LD="$(LD)"; export LD; \
179         LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
180         NM="$(NM)"; export NM; \
181         RANLIB="$(RANLIB)"; export RANLIB; \
182         WINDRES="$(WINDRES)"; export WINDRES; \
183         WINDMC="$(WINDMC)"; export WINDMC; \
184         OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
185         OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
186         AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
187         AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
188         GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
189         LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
190         NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
191         OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
192         RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
193         TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
194         GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
195         GMPINC="$(HOST_GMPINC)"; export GMPINC; \
196 @if gcc-bootstrap
197         $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
198 @endif gcc-bootstrap
199         $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
201 # Similar, for later GCC stages.
202 POSTSTAGE1_HOST_EXPORTS = \
203         $(HOST_EXPORTS) \
204         CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
205           -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
206         CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \
207           $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
208           -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
209           -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
210         LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
212 # Target libraries are put under this directory:
213 TARGET_SUBDIR = @target_subdir@
214 # This is set by the configure script to the arguments to use when configuring
215 # directories built for the target.
216 TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
217 # This is the list of variables to export in the environment when
218 # configuring subdirectories for the host system.
219 BASE_TARGET_EXPORTS = \
220         $(BASE_EXPORTS) \
221         AR="$(AR_FOR_TARGET)"; export AR; \
222         AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
223         CC="$(CC_FOR_TARGET)"; export CC; \
224         CFLAGS="$(CFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CFLAGS; \
225         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
226         CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
227         CXXFLAGS="$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CXXFLAGS; \
228         GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
229         GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
230         DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
231         LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
232         LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
233         LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
234         NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
235         OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
236         RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
237         STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
238         WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
239         WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
240         $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
242 RAW_CXX_TARGET_EXPORTS = \
243         $(BASE_TARGET_EXPORTS) \
244         CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
245         CXX="$(RAW_CXX_FOR_TARGET)"; export CXX;
247 NORMAL_TARGET_EXPORTS = \
248         $(BASE_TARGET_EXPORTS) \
249         CXX="$(CXX_FOR_TARGET)"; export CXX;
251 # Where to find GMP
252 HOST_GMPLIBS = @gmplibs@
253 HOST_GMPINC = @gmpinc@
255 # ----------------------------------------------
256 # Programs producing files for the BUILD machine
257 # ----------------------------------------------
259 SHELL = @config_shell@
261 # pwd command to use.  Allow user to override default by setting PWDCMD in
262 # the environment to account for automounters.  The make variable must not
263 # be called PWDCMD, otherwise the value set here is passed to make
264 # subprocesses and overrides the setting from the user's environment.
265 # Don't use PWD since it is a common shell environment variable and we
266 # don't want to corrupt it.
267 PWD_COMMAND = $${PWDCMD-pwd}
269 # compilers to use to create programs which must be run in the build
270 # environment.
271 AR_FOR_BUILD = @AR_FOR_BUILD@
272 AS_FOR_BUILD = @AS_FOR_BUILD@
273 CC_FOR_BUILD = @CC_FOR_BUILD@
274 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
275 CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
276 CXX_FOR_BUILD = @CXX_FOR_BUILD@
277 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
278 GCJ_FOR_BUILD = @GCJ_FOR_BUILD@
279 GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
280 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
281 LD_FOR_BUILD = @LD_FOR_BUILD@
282 NM_FOR_BUILD = @NM_FOR_BUILD@
283 RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@
284 WINDMC_FOR_BUILD = @WINDMC_FOR_BUILD@
285 WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@
287 # Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
288 # here so that they can be overridden by Makefile fragments.
289 BUILD_PREFIX = @BUILD_PREFIX@
290 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
292 # Flags to pass to stage2 and later makes.  They are defined
293 # here so that they can be overridden by Makefile fragments.
294 BOOT_CFLAGS= -g -O2
295 BOOT_LDFLAGS=
297 BISON = @BISON@
298 YACC = @YACC@
299 FLEX = @FLEX@
300 LEX = @LEX@
301 M4 = @M4@
302 MAKEINFO = @MAKEINFO@
303 EXPECT = @EXPECT@
304 RUNTEST = @RUNTEST@
306 # This just becomes part of the MAKEINFO definition passed down to
307 # sub-makes.  It lets flags be given on the command line while still
308 # using the makeinfo from the object tree.
309 # (Default to avoid splitting info files by setting the threshold high.)
310 MAKEINFOFLAGS = --split-size=5000000
312 # ---------------------------------------------
313 # Programs producing files for the HOST machine
314 # ---------------------------------------------
316 AS = @AS@
317 AR = @AR@
318 AR_FLAGS = rc
319 CC = @CC@
320 CXX = @CXX@
321 DLLTOOL = @DLLTOOL@
322 LD = @LD@
323 LIPO = @LIPO@
324 NM = @NM@
325 OBJDUMP = @OBJDUMP@
326 RANLIB = @RANLIB@
327 STRIP = @STRIP@
328 WINDRES = @WINDRES@
329 WINDMC = @WINDMC@
331 GNATBIND = @GNATBIND@
332 GNATMAKE = @GNATMAKE@
334 CFLAGS = @CFLAGS@
335 LDFLAGS = @LDFLAGS@
336 LIBCFLAGS = $(CFLAGS)
337 CXXFLAGS = @CXXFLAGS@
338 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
340 # Only build the C compiler for stage1, because that is the only one that
341 # we can guarantee will build with the native compiler, and also it is the
342 # only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
343 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
344 # overrideable (for a bootstrap build stage1 also builds gcc.info).
346 STAGE1_CHECKING=@stage1_checking@
347 STAGE1_LANGUAGES=@stage1_languages@
349 STAGE1_CFLAGS=@stage1_cflags@
350 STAGE2_CFLAGS=$(BOOT_CFLAGS)
351 STAGE3_CFLAGS=$(BOOT_CFLAGS)
352 STAGE4_CFLAGS=$(BOOT_CFLAGS)
354 STAGE1_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
355 STAGE2_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
356 STAGE3_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
357 STAGE4_LIBCFLAGS=$(CFLAGS_FOR_TARGET)
359 do-compare = @do_compare@
360 do-compare3 = $(do-compare)
361 do-compare-debug = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2
363 # -----------------------------------------------
364 # Programs producing files for the TARGET machine
365 # -----------------------------------------------
367 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
369 AR_FOR_TARGET=@AR_FOR_TARGET@
370 AS_FOR_TARGET=@AS_FOR_TARGET@
371 CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
373 # If GCC_FOR_TARGET is not overriden on the command line, then this
374 # variable is passed down to the gcc Makefile, where it is used to
375 # build libgcc2.a.  We define it here so that it can itself be
376 # overridden on the command line.
377 GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
378 CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
379 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
380 GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
381 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
382 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
383 LD_FOR_TARGET=@LD_FOR_TARGET@
385 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
386 NM_FOR_TARGET=@NM_FOR_TARGET@
387 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
388 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
389 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
390 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
391 WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
393 COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
394 COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
395 COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
397 CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
398 CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
399 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
400 DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
402 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
403 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
404 LDFLAGS_FOR_TARGET = 
406 # ------------------------------------
407 # Miscellaneous targets and flag lists
408 # ------------------------------------
410 # The first rule in the file had better be this one.  Don't put any above it.
411 # This lives here to allow makefile fragments to contain dependencies.
412 all:
414 #### host and target specific makefile fragments come in here.
415 @target_makefile_frag@
416 @alphaieee_frag@
417 @ospace_frag@
418 @host_makefile_frag@
421 # This is the list of directories that may be needed in RPATH_ENVVAR
422 # so that prorgams built for the target machine work.
423 TARGET_LIB_PATH = [+ FOR target_modules +][+
424   IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
425   ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
426 [+ FOR target_modules +][+ IF lib_path +]
427 @if target-[+module+]
428 TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
429 @endif target-[+module+]
430 [+ ENDIF lib_path +][+ ENDFOR target_modules +]
433 # This is the list of directories that may be needed in RPATH_ENVVAR
434 # so that programs built for the host machine work.
435 HOST_LIB_PATH = [+ FOR host_modules +][+
436   IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
437   ENDFOR host_modules +]
439 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
440 @if gcc
441 HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
442 @endif gcc
444 [+ FOR host_modules +][+ IF lib_path +]
445 @if [+module+]
446 HOST_LIB_PATH_[+module+] = \
447   $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
448   +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
449 @endif [+module+]
450 [+ ENDIF lib_path +][+ ENDFOR host_modules +]
452 # Flags to pass down to all sub-makes.
453 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
454         "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
455         "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +] \
456         "CONFIG_SHELL=$(SHELL)" \
457         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" 
459 # We leave this in just in case, but it is not needed anymore.
460 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
462 # Flags to pass down to most sub-makes, in which we're building with
463 # the host environment.
464 EXTRA_HOST_FLAGS = \
465         'AR=$(AR)' \
466         'AS=$(AS)' \
467         'CC=$(CC)' \
468         'CXX=$(CXX)' \
469         'DLLTOOL=$(DLLTOOL)' \
470         'LD=$(LD)' \
471         'LIPO=$(LIPO)' \
472         'NM=$(NM)' \
473         'OBJDUMP=$(OBJDUMP)' \
474         'RANLIB=$(RANLIB)' \
475         'STRIP=$(STRIP)' \
476         'WINDRES=$(WINDRES)' \
477         'WINDMC=$(WINDMC)'
479 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
481 # Flags that are concerned with the location of the X11 include files
482 # and library files
484 # NOTE: until the top-level is getting the values via autoconf, it only
485 # causes problems to have this top-level Makefile overriding the autoconf-set
486 # values in child directories.  Only variables that don't conflict with
487 # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
489 X11_FLAGS_TO_PASS = \
490         'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
491         'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
493 # Flags to pass to stage2 and later makes.
495 POSTSTAGE1_FLAGS_TO_PASS = \
496         CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
497         GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind" \
498         LDFLAGS="$(BOOT_LDFLAGS)" \
499         "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
501 # Flags to pass down to makes which are built with the target environment.
502 # The double $ decreases the length of the command line; those variables
503 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.  The
504 # *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
505 # so we expand them here.
506 EXTRA_TARGET_FLAGS = \
507         'AR=$$(AR_FOR_TARGET)' \
508         'AS=$(COMPILER_AS_FOR_TARGET)' \
509         'CC=$$(CC_FOR_TARGET)' \
510         'CFLAGS=$$(CFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
511         'CXX=$$(CXX_FOR_TARGET)' \
512         'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
513         'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
514         'LD=$(COMPILER_LD_FOR_TARGET)' \
515         'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
516         'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
517         'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)' \
518         'NM=$(COMPILER_NM_FOR_TARGET)' \
519         'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
520         'RANLIB=$$(RANLIB_FOR_TARGET)' \
521         'WINDRES=$$(WINDRES_FOR_TARGET)' \
522         'WINDMC=$$(WINDMC_FOR_TARGET)'
524 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
526 # Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
527 # unfortunately needs the native compiler and the target ar and
528 # ranlib.
529 # If any variables are added here, they must be added to do-*, below.
530 # The BUILD_* variables are a special case, which are used for the gcc
531 # cross-building scheme.
532 EXTRA_GCC_FLAGS = \
533         "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
534         "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
535         "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
536         "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
537         "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
538         "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
540 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
542 .PHONY: configure-host
543 configure-host: [+
544   FOR host_modules +] \
545     maybe-configure-[+module+][+
546   ENDFOR host_modules +]
547 .PHONY: configure-target
548 configure-target: [+
549   FOR target_modules +] \
550     maybe-configure-target-[+module+][+
551   ENDFOR target_modules +]
553 # The target built for a native non-bootstrap build.
554 .PHONY: all
555 all:
556 @if gcc-bootstrap
557         [ -f stage_final ] || echo stage3 > stage_final
558         @r=`${PWD_COMMAND}`; export r; \
559         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
560         $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
561 @endif gcc-bootstrap
562         @: $(MAKE); $(unstage)
563         @r=`${PWD_COMMAND}`; export r; \
564         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
565         if [ -f stage_last ]; then \
566           $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
567         else \
568           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
569         fi
571 .PHONY: all-build
572 [+ FOR build_modules +]
573 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
575 .PHONY: all-host
576 [+ FOR host_modules +][+ IF bootstrap +]
577 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
578 all-host: maybe-all-[+module+][+ IF bootstrap +]
579 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
581 .PHONY: all-target
582 [+ FOR target_modules +][+ IF bootstrap +]
583 @if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
584 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
585 @endif target-[+module+]-no-bootstrap[+
586   ENDIF bootstrap +][+ ENDFOR target_modules +]
588 # Do a target for all the subdirectories.  A ``make do-X'' will do a
589 # ``make X'' in all subdirectories (because, in general, there is a
590 # dependency (below) of X upon do-X, a ``make X'' will also do this,
591 # but it may do additional work as well).
592 [+ FOR recursive_targets +]
593 .PHONY: do-[+make_target+]
594 do-[+make_target+]:
595         @: $(MAKE); $(unstage)
596         @r=`${PWD_COMMAND}`; export r; \
597         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
598         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
599           [+make_target+]-target
602 .PHONY: [+make_target+]-host
603 [+ FOR host_modules +]
604 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
606 .PHONY: [+make_target+]-target
607 [+ FOR target_modules +]
608 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
609 [+ ENDFOR recursive_targets +]
611 # Here are the targets which correspond to the do-X targets.
613 .PHONY: info installcheck dvi pdf html
614 .PHONY: install-info install-pdf install-html
615 .PHONY: clean distclean mostlyclean maintainer-clean realclean
616 .PHONY: local-clean local-distclean local-maintainer-clean
617 info: do-info
618 installcheck: do-installcheck
619 dvi: do-dvi
620 pdf: do-pdf
621 html: do-html
623 # Make sure makeinfo is built before we do a `make info', if we're
624 # in fact building texinfo.
625 do-info: maybe-all-texinfo
627 install-info: do-install-info dir.info
628         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
629         if [ -f dir.info ] ; then \
630           $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
631         else true ; fi
633 install-pdf: do-install-pdf
635 install-html: do-install-html
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 maybedep.tmp serdep.tmp
643         -if [ "$(TARGET_SUBDIR)" != "." ]; then \
644           rm -rf $(TARGET_SUBDIR); \
645         else true; fi
646         -rm -rf $(BUILD_SUBDIR)
647         -if [ "$(HOST_SUBDIR)" != "." ]; then \
648           rm -rf $(HOST_SUBDIR); \
649         else true; fi
650         -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
651         -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
652         -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
653         -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
654         -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
656 local-maintainer-clean:
657         @echo "This command is intended for maintainers to use;"
658         @echo "it deletes files that may require special tools to rebuild."
660 clean: do-clean local-clean
661 mostlyclean: do-mostlyclean local-clean
662 distclean: do-distclean local-clean local-distclean
663 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
664 maintainer-clean: local-distclean
665 realclean: maintainer-clean
667 # Check target.
669 .PHONY: check do-check
670 check: do-check
672 # Only include modules actually being configured and built.
673 .PHONY: check-host
674 check-host: [+
675   FOR host_modules +] \
676     maybe-check-[+module+][+
677   ENDFOR host_modules +]
679 .PHONY: check-target
680 check-target: [+
681   FOR target_modules +] \
682     maybe-check-target-[+module+][+
683   ENDFOR target_modules +]
685 do-check:
686         @: $(MAKE); $(unstage)
687         @r=`${PWD_COMMAND}`; export r; \
688         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
689         $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
691 # Automated reporting of test results.
693 warning.log: build.log
694         $(srcdir)/contrib/warn_summary build.log > $@
696 mail-report.log:
697         if test x'$(BOOT_CFLAGS)' != x''; then \
698             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
699         fi; \
700         $(srcdir)/contrib/test_summary -t >$@
701         chmod +x $@
702         echo If you really want to send e-mail, run ./$@ now
704 mail-report-with-warnings.log: warning.log
705         if test x'$(BOOT_CFLAGS)' != x''; then \
706             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
707         fi; \
708         $(srcdir)/contrib/test_summary -t -i warning.log >$@
709         chmod +x $@
710         echo If you really want to send e-mail, run ./$@ now
712 # Installation targets.
714 .PHONY: install uninstall
715 install:
716         @: $(MAKE); $(unstage)
717         @r=`${PWD_COMMAND}`; export r; \
718         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
719         $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
721 .PHONY: install-host-nogcc
722 install-host-nogcc: [+
723   FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
724     maybe-install-[+module+][+ ENDIF +][+
725   ENDFOR host_modules +]
727 .PHONY: install-host
728 install-host: [+
729   FOR host_modules +] \
730     maybe-install-[+module+][+
731   ENDFOR host_modules +]
733 .PHONY: install-target
734 install-target: [+
735   FOR target_modules +] \
736     maybe-install-target-[+module+][+
737   ENDFOR target_modules +]
739 uninstall:
740         @echo "the uninstall target is not supported in this tree"
742 .PHONY: install.all
743 install.all: install-no-fixedincludes
744         @if [ -f ./gcc/Makefile ] ; then \
745                 r=`${PWD_COMMAND}` ; export r ; \
746                 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
747                 $(HOST_EXPORTS) \
748                 (cd ./gcc && \
749                 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
750         else \
751                 true ; \
752         fi
754 # install-no-fixedincludes is used because Cygnus can not distribute
755 # the fixed header files.
756 .PHONY: install-no-fixedincludes
757 install-no-fixedincludes: installdirs install-host-nogcc \
758         install-target gcc-no-fixedincludes
760 ### other supporting targets
762 MAKEDIRS= \
763         $(DESTDIR)$(prefix) \
764         $(DESTDIR)$(exec_prefix)
765 .PHONY: installdirs
766 installdirs: mkinstalldirs
767         $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
769 dir.info: do-install-info
770         if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
771           $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
772           mv -f dir.info.new dir.info ; \
773         else true ; \
774         fi
776 dist:
777         @echo "Building a full distribution of this tree isn't done"
778         @echo "via 'make dist'.  Check out the etc/ subdirectory" 
780 etags tags: TAGS
782 # Right now this just builds TAGS in each subdirectory.  emacs19 has the
783 # ability to use several tags files at once, so there is probably no need
784 # to combine them into one big TAGS file (like CVS 1.3 does).  We could
785 # (if we felt like it) have this Makefile write a piece of elisp which
786 # the user could load to tell emacs19 where all the TAGS files we just
787 # built are.
788 TAGS: do-TAGS
790 # ------------------------------------
791 # Macros for configure and all targets
792 # ------------------------------------
794 [+ DEFINE configure +]
795 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
796 maybe-configure-[+prefix+][+module+]:
797 @if gcc-bootstrap
798 configure-[+prefix+][+module+]: stage_current
799 @endif gcc-bootstrap
800 @if [+prefix+][+module+]
801 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
802 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
803         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
804         @r=`${PWD_COMMAND}`; export r; \
805         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
806         [+ IF check_multilibs
807         +]echo "Checking multilib configuration for [+module+]..."; \
808         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
809         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
810         if test -r [+subdir+]/[+module+]/multilib.out; then \
811           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
812             rm -f [+subdir+]/[+module+]/multilib.tmp; \
813           else \
814             rm -f [+subdir+]/[+module+]/Makefile; \
815             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
816           fi; \
817         else \
818           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
819         fi; \
820         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
821         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
822         [+exports+] \
823         echo Configuring in [+subdir+]/[+module+]; \
824         cd "[+subdir+]/[+module+]" || exit 1; \
825         case $(srcdir) in \
826           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
827           *) topdir=`echo [+subdir+]/[+module+]/ | \
828                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
829         esac; \
830         srcdiroption="--srcdir=$${topdir}/[+module+]"; \
831         libsrcdir="$$s/[+module+]"; \
832         [+ IF no-config-site +]rm -f no-such-file || : ; \
833         CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
834           [+args+] --build=${build_alias} --host=[+host_alias+] \
835           --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
836           || exit 1
837 @endif [+prefix+][+module+]
839 [+ IF bootstrap +]
840 [+ FOR bootstrap_stage +]
841 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
842 maybe-configure-stage[+id+]-[+prefix+][+module+]:
843 @if [+prefix+][+module+]-bootstrap
844 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
845 configure-stage[+id+]-[+prefix+][+module+]:
846         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
847         @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
848         @r=`${PWD_COMMAND}`; export r; \
849         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
850         [+ IF check_multilibs
851         +]echo "Checking multilib configuration for [+module+]..."; \
852         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
853         if test -r [+subdir+]/[+module+]/multilib.out; then \
854           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
855             rm -f [+subdir+]/[+module+]/multilib.tmp; \
856           else \
857             rm -f [+subdir+]/[+module+]/Makefile; \
858             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
859           fi; \
860         else \
861           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
862         fi; \
863         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
864         [+exports+][+ IF prev +] \
865         [+poststage1_exports+][+ ENDIF prev +] [+ IF prefix +] \
866         CFLAGS="[+stage_libcflags+] $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CFLAGS; \
867         CXXFLAGS="[+stage_libcflags+] $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CXXFLAGS; [+ ELSE +] \
868         CFLAGS="[+stage_cflags+]"; export CFLAGS; \
869         CXXFLAGS="[+stage_cflags+]"; export CXXFLAGS; [+ ENDIF +] \
870         echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
871         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
872         cd [+subdir+]/[+module+] || exit 1; \
873         case $(srcdir) in \
874           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
875           *) topdir=`echo [+subdir+]/[+module+]/ | \
876                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
877         esac; \
878         srcdiroption="--srcdir=$${topdir}/[+module+]"; \
879         libsrcdir="$$s/[+module+]"; \
880         $(SHELL) $${libsrcdir}/configure \
881           [+args+] --build=${build_alias} --host=[+host_alias+] \
882           --target=[+target_alias+] $${srcdiroption} \
883           [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
884           [+stage_configure_flags+] [+extra_configure_flags+]
885 @endif [+prefix+][+module+]-bootstrap
886 [+ ENDFOR bootstrap_stage +]
887 [+ ENDIF bootstrap +]
888 [+ ENDDEF +]
890 [+ DEFINE all +]
891 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
892 maybe-all-[+prefix+][+module+]:
893 @if gcc-bootstrap
894 all-[+prefix+][+module+]: stage_current
895 @endif gcc-bootstrap
896 @if [+prefix+][+module+]
897 TARGET-[+prefix+][+module+]=[+
898   IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
899 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
900 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
901         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
902         @r=`${PWD_COMMAND}`; export r; \
903         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
904         [+exports+] \
905         (cd [+subdir+]/[+module+] && \
906           $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+extra_make_flags+] \
907                 $(TARGET-[+prefix+][+module+]))
908 @endif [+prefix+][+module+]
910 [+ IF bootstrap +]
911 [+ FOR bootstrap_stage +]
912 .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
913 .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
914 maybe-all-stage[+id+]-[+prefix+][+module+]:
915 maybe-clean-stage[+id+]-[+prefix+][+module+]:
916 @if [+prefix+][+module+]-bootstrap
917 maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
918 all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
919 TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
920 all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
921         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
922         @r=`${PWD_COMMAND}`; export r; \
923         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
924         [+exports+][+ IF prev +] \
925         [+poststage1_exports+][+ ENDIF prev +] \
926         cd [+subdir+]/[+module+] && \
927         $(MAKE) $(BASE_FLAGS_TO_PASS) \
928                 CFLAGS="[+stage_cflags+]" CXXFLAGS="[+stage_cflags+]" \
929                 LIBCFLAGS="[+stage_libcflags+]" \
930                 CFLAGS_FOR_TARGET="[+stage_libcflags+]" \
931                 CXXFLAGS_FOR_TARGET="[+stage_libcflags+]" [+args+] [+
932                 IF prev +][+poststage1_args+][+ ENDIF prev
933                 +] [+extra_make_flags+] \
934                 $(TARGET-stage[+id+]-[+prefix+][+module+])
936 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
937 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
938 clean-stage[+id+]-[+prefix+][+module+]:
939         @if [ $(current_stage) = stage[+id+] ]; then \
940           [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
941         else \
942           [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
943           $(MAKE) stage[+id+]-start; \
944         fi; \
945         cd [+subdir+]/[+module+] && \
946         $(MAKE) [+args+] [+ IF prev +] \
947                 [+poststage1_args+] [+ ENDIF prev +] \
948                 [+extra_make_flags+] clean
949 @endif [+prefix+][+module+]-bootstrap
951 [+ ENDFOR bootstrap_stage +]
952 [+ ENDIF bootstrap +]
953 [+ ENDDEF +]
955 # --------------------------------------
956 # Modules which run on the build machine
957 # --------------------------------------
958 [+ FOR build_modules +]
959 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
960              host_alias=(get "host" "${build_alias}")
961              target_alias=(get "target" "${target_alias}")
962              args="$(BUILD_CONFIGARGS)" no-config-site=true +]
964 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
965              args="$(EXTRA_BUILD_FLAGS)" +]
966 [+ ENDFOR build_module +]
968 # --------------------------------------
969 # Modules which run on the host machine
970 # --------------------------------------
971 [+ FOR host_modules +]
972 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
973              exports="$(HOST_EXPORTS)"
974              poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
975              host_alias=(get "host" "${host_alias}")
976              target_alias=(get "target" "${target_alias}")
977              args="$(HOST_CONFIGARGS)" +]
979 [+ all prefix="" subdir="$(HOST_SUBDIR)"
980        exports="$(HOST_EXPORTS)"
981        poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
982        args="$(EXTRA_HOST_FLAGS)"
983        poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
985 .PHONY: check-[+module+] maybe-check-[+module+]
986 maybe-check-[+module+]:
987 @if [+module+]
988 maybe-check-[+module+]: check-[+module+]
989 [+ IF no_check +]
990 check-[+module+]:
991 [+ ELIF no_check_cross +]
992 # This module is only tested in a native toolchain.
993 check-[+module+]:
994         @: $(MAKE); $(unstage)
995         @if [ '$(host)' = '$(target)' ] ; then \
996           r=`${PWD_COMMAND}`; export r; \
997           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
998           $(HOST_EXPORTS) \
999           (cd $(HOST_SUBDIR)/[+module+] && \
1000             $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
1001         fi
1002 [+ ELSE check +]
1003 check-[+module+]:
1004         @: $(MAKE); $(unstage)
1005         @r=`${PWD_COMMAND}`; export r; \
1006         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1007         $(HOST_EXPORTS) \
1008         (cd $(HOST_SUBDIR)/[+module+] && \
1009           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
1010 [+ ENDIF no_check +]
1011 @endif [+module+]
1013 .PHONY: install-[+module+] maybe-install-[+module+]
1014 maybe-install-[+module+]:
1015 @if [+module+]
1016 maybe-install-[+module+]: install-[+module+]
1017 [+ IF no_install +]
1018 install-[+module+]:
1019 [+ ELSE install +]
1020 install-[+module+]: installdirs
1021         @: $(MAKE); $(unstage)
1022         @r=`${PWD_COMMAND}`; export r; \
1023         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1024         $(HOST_EXPORTS) \
1025         (cd $(HOST_SUBDIR)/[+module+] && \
1026           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
1027 [+ ENDIF no_install +]
1028 @endif [+module+]
1030 # Other targets (info, dvi, pdf, etc.)
1031 [+ FOR recursive_targets +]
1032 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1033 maybe-[+make_target+]-[+module+]:
1034 @if [+module+]
1035 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
1036 [+ IF (match-value? = "missing" (get "make_target") ) +]
1037 # [+module+] doesn't support [+make_target+].
1038 [+make_target+]-[+module+]:
1039 [+ ELSE +]
1040 [+make_target+]-[+module+]: [+
1041   FOR depend +]\
1042     [+depend+]-[+module+] [+
1043   ENDFOR depend +]
1044         @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1045         @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
1046         r=`${PWD_COMMAND}`; export r; \
1047         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1048         $(HOST_EXPORTS) \
1049         for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1050           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1051         done; \
1052         echo "Doing [+make_target+] in [+module+]" ; \
1053         (cd $(HOST_SUBDIR)/[+module+] && \
1054           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1055                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1056                   "RANLIB=$${RANLIB}" \
1057                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1058                   [+make_target+]) \
1059           || exit 1
1060 [+ ENDIF +]
1061 @endif [+module+]
1062 [+ ENDFOR recursive_targets +]
1063 [+ ENDFOR host_modules +]
1065 # ---------------------------------------
1066 # Modules which run on the target machine
1067 # ---------------------------------------
1068 [+ FOR target_modules +]
1070 [+ IF raw_cxx +]
1071 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1072              check_multilibs=true
1073              exports="$(RAW_CXX_TARGET_EXPORTS)"
1074              host_alias=(get "host" "${target_alias}")
1075              target_alias=(get "target" "${target_alias}")
1076              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1078 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1079        exports="$(RAW_CXX_TARGET_EXPORTS)"
1080        args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1081 [+ ELSE +]
1082 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1083              check_multilibs=true
1084              exports="$(NORMAL_TARGET_EXPORTS)"
1085              host_alias=(get "host" "${target_alias}")
1086              target_alias=(get "target" "${target_alias}")
1087              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1089 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1090        exports="$(NORMAL_TARGET_EXPORTS)"
1091        args="$(EXTRA_TARGET_FLAGS)" +]
1092 [+ ENDIF +]
1094 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1095 maybe-check-target-[+module+]:
1096 @if target-[+module+]
1097 maybe-check-target-[+module+]: check-target-[+module+]
1098 [+ IF no_check +]
1099 # Dummy target for uncheckable module.
1100 check-target-[+module+]:
1101 [+ ELSE check +]
1102 check-target-[+module+]:
1103         @: $(MAKE); $(unstage)
1104         @r=`${PWD_COMMAND}`; export r; \
1105         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1106 IF raw_cxx +]
1107         $(RAW_CXX_TARGET_EXPORTS) \[+
1108 ELSE normal_cxx +]
1109         $(NORMAL_TARGET_EXPORTS) \[+
1110 ENDIF raw_cxx +]
1111         (cd $(TARGET_SUBDIR)/[+module+] && \
1112           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1113             IF raw_cxx 
1114               +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1115             ENDIF raw_cxx 
1116           +] [+extra_make_flags+] check)
1117 [+ ENDIF no_check +]
1118 @endif target-[+module+]
1120 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1121 maybe-install-target-[+module+]:
1122 @if target-[+module+]
1123 maybe-install-target-[+module+]: install-target-[+module+]
1124 [+ IF no_install +]
1125 # Dummy target for uninstallable.
1126 install-target-[+module+]:
1127 [+ ELSE install +]
1128 install-target-[+module+]: installdirs
1129         @: $(MAKE); $(unstage)
1130         @r=`${PWD_COMMAND}`; export r; \
1131         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1132 IF raw_cxx +]
1133         $(RAW_CXX_TARGET_EXPORTS) \[+
1134 ELSE normal_cxx +]
1135         $(NORMAL_TARGET_EXPORTS) \[+
1136 ENDIF raw_cxx +]
1137         (cd $(TARGET_SUBDIR)/[+module+] && \
1138           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1139 [+ ENDIF no_install +]
1140 @endif target-[+module+]
1142 # Other targets (info, dvi, pdf, etc.)
1143 [+ FOR recursive_targets +]
1144 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1145 maybe-[+make_target+]-target-[+module+]:
1146 @if target-[+module+]
1147 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1148 [+ IF (match-value? = "missing" (get "make_target") ) +]
1149 # [+module+] doesn't support [+make_target+].
1150 [+make_target+]-target-[+module+]:
1151 [+ ELSE +]
1152 [+make_target+]-target-[+module+]: [+
1153   FOR depend +]\
1154     [+depend+]-target-[+module+] [+
1155   ENDFOR depend +]
1156         @: $(MAKE); $(unstage)
1157         @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1158         r=`${PWD_COMMAND}`; export r; \
1159         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1160 IF raw_cxx +]
1161         $(RAW_CXX_TARGET_EXPORTS) \[+
1162 ELSE normal_cxx +]
1163         $(NORMAL_TARGET_EXPORTS) \[+
1164 ENDIF raw_cxx +]
1165         echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1166         for flag in $(EXTRA_TARGET_FLAGS); do \
1167           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1168         done; \
1169         (cd $(TARGET_SUBDIR)/[+module+] && \
1170           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1171                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1172                   "RANLIB=$${RANLIB}" \
1173                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1174                   [+extra_make_flags+] [+make_target+]) \
1175           || exit 1
1176 [+ ENDIF +]
1177 @endif target-[+module+]
1178 [+ ENDFOR recursive_targets +]
1179 [+ ENDFOR target_modules +]
1181 # ----------
1182 # GCC module
1183 # ----------
1185 @if gcc-no-bootstrap
1186 .PHONY: cross
1187 cross: all-build all-gas all-ld
1188         @r=`${PWD_COMMAND}`; export r; \
1189         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1190         $(HOST_EXPORTS) \
1191         echo "Building the C and C++ compiler"; \
1192         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1193         @r=`${PWD_COMMAND}`; export r; \
1194         s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1195         echo "Building runtime libraries"; \
1196         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1197 @endif gcc-no-bootstrap
1199 @if gcc
1200 .PHONY: check-gcc-c++
1201 check-gcc-c++:
1202         @if [ -f ./gcc/Makefile ] ; then \
1203           r=`${PWD_COMMAND}`; export r; \
1204           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1205           $(HOST_EXPORTS) \
1206           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
1207         else \
1208           true; \
1209         fi
1211 .PHONY: check-c++
1212 check-c++: check-target-libstdc++-v3 check-gcc-c++
1214 # Install the gcc headers files, but not the fixed include files,
1215 # which Cygnus is not allowed to distribute.  This rule is very
1216 # dependent on the workings of the gcc Makefile.in.
1217 .PHONY: gcc-no-fixedincludes
1218 gcc-no-fixedincludes:
1219         @if [ -f ./gcc/Makefile ]; then \
1220           rm -rf gcc/tmp-include; \
1221           mv gcc/include gcc/tmp-include 2>/dev/null; \
1222           mkdir gcc/include; \
1223           cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1224           touch gcc/stmp-fixinc gcc/include/fixed; \
1225           rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1226           r=`${PWD_COMMAND}`; export r; \
1227           s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1228           $(HOST_EXPORTS) \
1229           (cd ./gcc && \
1230            $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1231           rm -rf gcc/include; \
1232           mv gcc/tmp-include gcc/include 2>/dev/null; \
1233         else true; fi
1234 @endif gcc
1236 # ---------------------
1237 # GCC bootstrap support
1238 # ---------------------
1240 # We track the current stage (the one in 'gcc') in the stage_current file.
1241 # stage_last instead tracks the stage that was built last.  These targets
1242 # are dummy when toplevel bootstrap is not active.
1244 # While making host and target tools, symlinks to the final stage must be
1245 # there, so $(unstage) should be run at various points.  To avoid excessive
1246 # recursive invocations of make, we "inline" them using a variable.  These
1247 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1248 # to avoid warnings from the GNU Make job server.
1250 unstage = :
1251 stage = :
1252 current_stage = ""
1254 @if gcc-bootstrap
1255 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1256 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1257 current_stage = "`cat stage_current 2> /dev/null`"
1258 @endif gcc-bootstrap
1260 .PHONY: unstage stage
1261 unstage:
1262         @: $(MAKE); $(unstage)
1263 stage:
1264         @: $(MAKE); $(stage)
1266 # Disable commands for lean bootstrap.
1267 LEAN = false
1269 # We name the build directories for the various stages "stage1-gcc",
1270 # "stage2-gcc","stage3-gcc", etc.
1272 # Since the 'compare' process will fail (on debugging information) if any
1273 # directory names are different, we need to link the gcc directory for
1274 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1275 # the build directories constant as well. For the latter, we use naked names
1276 # like 'gcc', because the scripts in that directory assume it.  We use
1277 # mv on platforms where symlinks to directories do not work or are not
1278 # reliable.
1280 # 'touch' doesn't work right on some platforms.
1281 STAMP = echo timestamp > 
1283 # We only want to compare .o files, so set this!
1284 objext = .o
1286 [+ FOR bootstrap-stage +]
1287 .PHONY: stage[+id+]-start stage[+id+]-end
1289 stage[+id+]-start::
1290         @: $(MAKE); $(stage); \
1291         echo stage[+id+] > stage_current ; \
1292         echo stage[+id+] > stage_last; \
1293         $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1294    FOR host_modules +][+ IF bootstrap +]
1295 @if [+ module +]
1296         @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1297           mkdir stage[+id+]-[+module+]; \
1298         mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1299         mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1300 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1301         @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1302           mkdir stage[+id+]-$(TARGET_SUBDIR); \
1303         mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1304         mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1306 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1307 @if [+ module +]
1308         @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1309           cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1310           mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
1311         fi
1312 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1313         @if test -d $(TARGET_SUBDIR) ; then \
1314           mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1315           mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
1316         fi
1317         rm -f stage_current
1319 # Bubble a bug fix through all the stages up to stage [+id+].  They are
1320 # remade, but not reconfigured.  The next stage (if any) will not be
1321 # reconfigured either.
1322 .PHONY: stage[+id+]-bubble
1323 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1324         @r=`${PWD_COMMAND}`; export r; \
1325         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1326         if test -f stage[+id+]-lean [+
1327           IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1328           echo Skipping rebuild of stage[+id+] ; \
1329         else \
1330           $(MAKE) stage[+id+]-start; \[+IF lean +]
1331           if $(LEAN); then \
1332             rm -rf stage[+lean+]-* ; \
1333             $(STAMP) stage[+lean+]-lean ; \
1334           fi; \[+ ENDIF lean +]
1335           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1336         fi[+ IF compare-target +]
1337         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1339 .PHONY: all-stage[+id+] clean-stage[+id+]
1340 do-clean: clean-stage[+id+]
1342 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1343 # only possibility, but now it conflicts with no-bootstrap rules
1344 @if gcc-bootstrap
1345 [+ IF compare-target +]
1346 [+compare-target+]:
1347         @r=`${PWD_COMMAND}`; export r; \
1348         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1349         if test -f stage[+prev+]-lean; then \
1350           echo Cannot compare object files as stage [+prev+] was deleted. ; \
1351           exit 0 ; \
1352         fi; \
1353         : $(MAKE); $(stage); \
1354         rm -f .bad_compare ; \
1355         echo Comparing stages [+prev+] and [+id+] ; \
1356         cd stage[+id+]-gcc; \
1357         files=`find . -name "*$(objext)" -print` ; \
1358         cd .. ; \
1359         for file in $${files} ; do \
1360           f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
1361           $(do-[+compare-target+]) > /dev/null 2>&1; \
1362           if test $$? -eq 1; then \
1363             case $$file in \
1364               ./cc*-checksum$(objext) | ./libgcc/* ) \
1365                 echo warning: $$file differs ;; \
1366               *) \
1367                 echo $$file differs >> .bad_compare ;; \
1368             esac ; \
1369           fi ; \
1370         done ; \
1371         if [ -f .bad_compare ]; then \
1372           echo "Bootstrap comparison failure!"; \
1373           cat .bad_compare; \
1374           exit 1; \
1375         else \
1376           echo Comparison successful.; \
1377         fi ; \
1378         $(STAMP) [+compare-target+][+ IF prev +]
1379         if $(LEAN); then \
1380           rm -rf stage[+prev+]-*; \
1381           $(STAMP) stage[+prev+]-lean; \
1382         fi[+ ENDIF prev +]
1383 [+ ENDIF compare-target +]
1385 [+ IF bootstrap-target +]
1386 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1387 [+bootstrap-target+]:
1388         echo stage[+id+] > stage_final
1389         @r=`${PWD_COMMAND}`; export r; \
1390         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1391         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1392         @: $(MAKE); $(unstage)
1393         @r=`${PWD_COMMAND}`; export r; \
1394         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1395         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1397 [+bootstrap-target+]-lean:
1398         echo stage[+id+] > stage_final
1399         @r=`${PWD_COMMAND}`; export r; \
1400         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1401         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1402         @: $(MAKE); $(unstage)
1403         @r=`${PWD_COMMAND}`; export r; \
1404         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1405         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1406 [+ ENDIF bootstrap-target +]
1408 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1409 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1410 .PHONY: distclean-stage[+id+]
1411 distclean-stage[+id+]::
1412         @: $(MAKE); $(stage)
1413         @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1414         rm -rf stage[+id+]-* [+
1415           IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1417 [+ IF cleanstrap-target +]
1418 .PHONY: [+cleanstrap-target+]
1419 [+cleanstrap-target+]: do-distclean local-clean
1420         echo stage[+id+] > stage_final
1421         @r=`${PWD_COMMAND}`; export r; \
1422         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1423         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1424         @: $(MAKE); $(unstage)
1425         @r=`${PWD_COMMAND}`; export r; \
1426         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1427         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1428 [+ ENDIF cleanstrap-target +]
1429 @endif gcc-bootstrap
1431 [+ ENDFOR bootstrap-stage +]
1433 stageprofile-end::
1434         $(MAKE) distclean-stagefeedback
1436 stagefeedback-start::
1437         @r=`${PWD_COMMAND}`; export r; \
1438         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1439         for i in prev-*; do \
1440           j=`echo $$i | sed s/^prev-//` ; \
1441           cd $$r/$$i && \
1442           { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1443           { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1444         done
1446 @if gcc-bootstrap
1447 do-distclean: distclean-stage1
1449 # Provide a GCC build when we're building target libraries.  This does
1450 # not work as a dependency, just as the minimum necessary to avoid errors.
1451 stage_last:
1452         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1454 # Same as unstage, but not phony and defaulting to stage1-start.  We place
1455 # it in the dependency so that for example `make -j3 all-gcc' works.
1456 stage_current:
1457         @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1459 .PHONY: restrap
1460 restrap::
1461         @: $(MAKE); $(stage)
1462         rm -rf stage1-$(TARGET_SUBDIR) [+ FOR bootstrap-stage +][+ IF prev
1463           +]stage[+id+]-* [+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1464 restrap:: all
1465 @endif gcc-bootstrap
1467 # --------------------------------------
1468 # Dependencies between different modules
1469 # --------------------------------------
1471 # Generic dependencies for target modules on host stuff, especially gcc
1472 @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1473   +][+ FOR bootstrap_stage +]
1474 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1475   ENDFOR +][+ ELSE bootstrap +]
1476 configure-target-[+module+]: stage_last[+
1477   ENDIF bootstrap +][+ ENDFOR target_modules +]
1478 @endif gcc-bootstrap
1480 @if gcc-no-bootstrap[+ FOR target_modules +]
1481 configure-target-[+module+]: maybe-all-gcc[+
1482   ENDFOR target_modules +]
1483 @endif gcc-no-bootstrap
1486 # There are two types of dependencies here: 'hard' dependencies, where one
1487 # module simply won't build without the other; and 'soft' dependencies, where
1488 # if the depended-on module is missing, the depending module will do without
1489 # or find a substitute somewhere (perhaps installed).  Soft dependencies
1490 # are made here to depend on a 'maybe-' target.  If you're not sure,
1491 # it's safer to use a soft dependency.
1493 [+ ;; These Scheme functions build the bulk of the dependencies.
1494    ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1495    ;; where "maybe-" is only included if HARD is not true, and all-gcc
1496    ;; is taken from VAR-NAME.
1497    (define dep-target (lambda (module-kind var-name hard)
1498       (string-append
1499          (if hard "" "maybe-")
1500          (dep-subtarget var-name)
1501          module-kind
1502          (dep-module var-name)
1503       )))
1505    ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1506    (define make-dep (lambda (module-kind on-kind)
1507       (string-append
1508          (dep-target module-kind "module" #t) ": "
1509          (dep-target on-kind "on" (exist? "hard")))))
1511    ;; dep-subtarget extracts everything up to the first dash in the given
1512    ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1513    (define dep-subtarget (lambda (var-name)
1514       (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1516    ;; dep-module extracts everything up to the first dash in the given
1517    ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1518    (define dep-module (lambda (var-name)
1519       (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1521    ;; dep-stage builds a string for the prefix of a bootstrap stage.
1522    (define dep-stage (lambda ()
1523       (string-append
1524          "stage"
1525          (get "id")
1526          "-")))
1528    ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1529    ;; but is written in Scheme.
1530    (define dep-maybe (lambda ()
1531       (if (exist? "hard") "" "maybe-")))
1533    ;; dep-kind returns "normal" if the dependency is on an "install" target,
1534    ;; or if either module is not bootstrapped.  It returns "bootstrap" for
1535    ;; configure or build dependencies between bootstrapped modules; it returns
1536    ;; "prebootstrap" for configure or build dependencies of bootstrapped
1537    ;; modules on a build module (e.g. all-gcc on all-build-bison).  All this
1538    ;; is only necessary for host modules.
1539    (define dep-kind (lambda ()
1540       (if (and (hash-ref boot-modules (dep-module "module"))
1541                (=* (dep-module "on") "build-"))
1542           "prebootstrap"
1544           (if (or (= (dep-subtarget "on") "install-")
1545                   (not (hash-ref boot-modules (dep-module "module")))
1546                   (not (hash-ref boot-modules (dep-module "on"))))
1547               "normal"
1548               "bootstrap"))))
1550    ;; We now build the hash table that is used by dep-kind.
1551    (define boot-modules (make-hash-table 113))
1554 [+ FOR host_modules +][+
1555    (if (exist? "bootstrap")
1556        (hash-create-handle! boot-modules (get "module") #t))
1557    "" +][+ ENDFOR host_modules +]
1558 [+ FOR target_modules +][+
1559    (if (exist? "bootstrap")
1560        (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1561    "" +][+ ENDFOR target_modules +]
1563 # With all the machinery above in place, it is pretty easy to generate
1564 # dependencies.  Host dependencies are a bit more complex because we have
1565 # to check for bootstrap/prebootstrap dependencies.  To resolve
1566 # prebootstrap dependencies, prebootstrap modules are gathered in
1567 # a hash table.
1568 [+ FOR dependencies +][+ (make-dep "" "") +]
1569 [+ CASE (dep-kind) +]
1570 [+ == "prebootstrap"
1571      +][+ FOR bootstrap_stage +]
1572 [+ (make-dep (dep-stage) "") +][+
1573        ENDFOR bootstrap_stage +]
1574 [+ == "bootstrap"
1575      +][+ FOR bootstrap_stage +]
1576 [+ (make-dep (dep-stage) (dep-stage)) +][+
1577        ENDFOR bootstrap_stage +]
1578 [+ ESAC +][+
1579 ENDFOR dependencies +]
1581 # Dependencies for target modules on other target modules are
1582 # described by lang_env_dependencies; the defaults apply to anything
1583 # not mentioned there.
1585    ;; Predicate for whether LANG was specified in lang_env_dependencies.
1586    (define lang-dep (lambda (lang)
1587       (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1589    ;; Build the hash table we will need.
1590    (define lang-env-deps (make-hash-table 7))
1591 +][+ FOR lang_env_dependencies +][+
1592    (if (exist? "cxx")
1593        (hash-create-handle! lang-env-deps
1594           (string-append (get "module") "-" "cxx") #t))
1596    (if (exist? "no_c")
1597        (hash-create-handle! lang-env-deps
1598           (string-append (get "module") "-" "no_c") #t))
1600    (if (exist? "no_gcc")
1601        (hash-create-handle! lang-env-deps
1602           (string-append (get "module") "-" "no_gcc") #t))
1603    "" +][+ ENDFOR lang_env_dependencies +]
1605 @if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1606   +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1607 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1608   ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1609 @endif gcc-bootstrap
1611 @if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1612 configure-target-[+module+]: maybe-all-target-libgcc[+
1613   ENDIF +][+ ENDFOR target_modules +]
1614 @endif gcc-no-bootstrap
1616 [+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1617 configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1618   ENDIF +][+ IF (lang-dep "cxx") +]
1619 configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1620   ENDIF +]
1621 [+ ENDFOR target_modules +]
1623 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
1624 GDB_TK = @GDB_TK@
1625 INSTALL_GDB_TK = @INSTALL_GDB_TK@
1626 configure-gdb: $(CONFIGURE_GDB_TK)
1627 all-gdb: $(gdbnlmrequirements) $(GDB_TK)
1628 install-gdb: $(INSTALL_GDB_TK)
1630 # Serialization dependencies.  Host configures don't work well in parallel to
1631 # each other, due to contention over config.cache.  Target configures and 
1632 # build configures are similar.
1633 @serialization_dependencies@
1635 # --------------------------------
1636 # Regenerating top level configury
1637 # --------------------------------
1639 # Rebuilding Makefile.in, using autogen.
1640 AUTOGEN = autogen
1641 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1642         cd $(srcdir) && $(AUTOGEN) Makefile.def
1644 # Rebuilding Makefile.
1645 Makefile: $(srcdir)/Makefile.in config.status
1646         CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1648 config.status: configure
1649         CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
1651 # Rebuilding configure.
1652 AUTOCONF = autoconf
1653 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4
1654         cd $(srcdir) && $(AUTOCONF)
1656 # ------------------------------
1657 # Special directives to GNU Make
1658 # ------------------------------
1660 # Don't pass command-line variables to submakes.
1661 .NOEXPORT:
1662 MAKEOVERRIDES=
1664 # end of Makefile.in