bfd/
[binutils.git] / Makefile.tpl
blob967b5b0ad564eb340f65213037d0e9493839fd65
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 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 # -------------------------------
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 datarootdir = @datarootdir@
57 docdir = @docdir@
58 htmldir = @htmldir@
59 mandir = @mandir@
60 man1dir = $(mandir)/man1
61 man2dir = $(mandir)/man2
62 man3dir = $(mandir)/man3
63 man4dir = $(mandir)/man4
64 man5dir = $(mandir)/man5
65 man6dir = $(mandir)/man6
66 man7dir = $(mandir)/man7
67 man8dir = $(mandir)/man8
68 man9dir = $(mandir)/man9
70 INSTALL = @INSTALL@
71 INSTALL_PROGRAM = @INSTALL_PROGRAM@
72 INSTALL_SCRIPT = @INSTALL_SCRIPT@
73 INSTALL_DATA = @INSTALL_DATA@
74 LN = @LN@
75 LN_S = @LN_S@
76 MAINT = @MAINT@
77 MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
78 MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
80 # -------------------------------------------------
81 # Miscellaneous non-standard autoconf-set variables
82 # -------------------------------------------------
84 # The gcc driver likes to know the arguments it was configured with.
85 TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
87 tooldir = @tooldir@
88 build_tooldir = @build_tooldir@
90 GDB_NLM_DEPS = 
92 # This is the name of the environment variable used for the path to
93 # the libraries.
94 RPATH_ENVVAR = @RPATH_ENVVAR@
96 # Build programs are put under this directory.
97 BUILD_SUBDIR = @build_subdir@
98 # This is set by the configure script to the arguments to use when configuring
99 # directories built for the build system.
100 BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
102 # This is the list of variables to export in the environment when
103 # configuring any subdirectory.  It must also be exported whenever
104 # recursing into a build directory in case that directory's Makefile
105 # re-runs configure.
106 BASE_EXPORTS = \
107         FLEX="$(FLEX)"; export FLEX; \
108         LEX="$(LEX)"; export LEX; \
109         BISON="$(BISON)"; export BISON; \
110         YACC="$(YACC)"; export YACC; \
111         M4="$(M4)"; export M4; \
112         MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
114 # This is the list of variables to export in the environment when
115 # configuring subdirectories for the build system.
116 BUILD_EXPORTS = \
117         $(BASE_EXPORTS) \
118         AR="$(AR_FOR_BUILD)"; export AR; \
119         AS="$(AS_FOR_BUILD)"; export AS; \
120         CC="$(CC_FOR_BUILD)"; export CC; \
121         CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
122         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
123         CXX="$(CXX_FOR_BUILD)"; export CXX; \
124         CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
125         GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
126         GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
127         DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
128         LD="$(LD_FOR_BUILD)"; export LD; \
129         LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
130         NM="$(NM_FOR_BUILD)"; export NM; \
131         RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
132         WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES;
134 # This is the list of directories to built for the host system.
135 SUBDIRS = @configdirs@
136 # This is set by the configure script to the arguments to use when configuring
137 # directories built for the host system.
138 HOST_CONFIGARGS = @host_configargs@
139 # Host programs are put under this directory, which is . except if building
140 # with srcdir=..
141 HOST_SUBDIR = @host_subdir@
142 # This is the list of variables to export in the environment when
143 # configuring subdirectories for the host system.  We need to pass
144 # some to the GCC configure because of its hybrid host/target nature.
145 HOST_EXPORTS = \
146         $(BASE_EXPORTS) \
147         CC="$(CC)"; export CC; \
148         CFLAGS="$(CFLAGS)"; export CFLAGS; \
149         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
150         CXX="$(CXX)"; export CXX; \
151         CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
152         AR="$(AR)"; export AR; \
153         AS="$(AS)"; export AS; \
154         CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
155         DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
156         LD="$(LD)"; export LD; \
157         LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
158         NM="$(NM)"; export NM; \
159         RANLIB="$(RANLIB)"; export RANLIB; \
160         WINDRES="$(WINDRES)"; export WINDRES; \
161         OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
162         OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
163         AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
164         AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
165         GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
166         LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
167         NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
168         OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
169         RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
170         TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
171         GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
172         GMPINC="$(HOST_GMPINC)"; export GMPINC; \
173 @if gcc-bootstrap
174         $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
175 @endif gcc-bootstrap
176         $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
178 # Similar, for later GCC stages.
179 POSTSTAGE1_HOST_EXPORTS = \
180         $(HOST_EXPORTS) \
181         CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
182           -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
183         CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \
184           $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
185           -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
186           -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
187         CFLAGS="$(BOOT_CFLAGS)"; export CFLAGS; \
188         LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
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@ --with-target-subdir="$(TARGET_SUBDIR)"
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="$(COMPILER_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="$(COMPILER_LD_FOR_TARGET)"; export LD; \
210         LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
211         LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
212         NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
213         OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
214         RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
215         STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
216         WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
217         $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
219 RAW_CXX_TARGET_EXPORTS = \
220         $(BASE_TARGET_EXPORTS) \
221         CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
222         CXX="$(RAW_CXX_FOR_TARGET)"; export CXX;
224 NORMAL_TARGET_EXPORTS = \
225         $(BASE_TARGET_EXPORTS) \
226         CXX="$(CXX_FOR_TARGET)"; export CXX;
228 # Where to find GMP
229 HOST_GMPLIBS = @gmplibs@
230 HOST_GMPINC = @gmpinc@
232 # ----------------------------------------------
233 # Programs producing files for the BUILD machine
234 # ----------------------------------------------
236 SHELL = @config_shell@
238 # pwd command to use.  Allow user to override default by setting PWDCMD in
239 # the environment to account for automounters.  The make variable must not
240 # be called PWDCMD, otherwise the value set here is passed to make
241 # subprocesses and overrides the setting from the user's environment.
242 # Don't use PWD since it is a common shell environment variable and we
243 # don't want to corrupt it.
244 PWD_COMMAND = $${PWDCMD-pwd}
246 # compilers to use to create programs which must be run in the build
247 # environment.
248 CC_FOR_BUILD = @CC_FOR_BUILD@
249 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
251 CXX_FOR_BUILD = $(CXX)
253 # Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
254 # here so that they can be overridden by Makefile fragments.
255 BUILD_PREFIX = @BUILD_PREFIX@
256 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
258 # Flags to pass to stage2 and later makes.  They are defined
259 # here so that they can be overridden by Makefile fragments.
260 BOOT_CFLAGS= -g -O2
261 BOOT_LDFLAGS=
263 BISON = @BISON@
264 YACC = @YACC@
265 FLEX = @FLEX@
266 LEX = @LEX@
267 M4 = @M4@
268 MAKEINFO = @MAKEINFO@
269 EXPECT = @EXPECT@
270 RUNTEST = @RUNTEST@
272 # This just becomes part of the MAKEINFO definition passed down to
273 # sub-makes.  It lets flags be given on the command line while still
274 # using the makeinfo from the object tree.
275 # (Default to avoid splitting info files by setting the threshold high.)
276 MAKEINFOFLAGS = --split-size=5000000
278 # ---------------------------------------------
279 # Programs producing files for the HOST machine
280 # ---------------------------------------------
282 AS = @AS@
283 AR = @AR@
284 AR_FLAGS = rc
285 CC = @CC@
286 CXX = @CXX@
287 DLLTOOL = @DLLTOOL@
288 LD = @LD@
289 LIPO = @LIPO@
290 NM = @NM@
291 OBJDUMP = @OBJDUMP@
292 RANLIB = @RANLIB@
293 STRIP = @STRIP@
294 WINDRES = @WINDRES@
296 CFLAGS = @CFLAGS@
297 LDFLAGS = 
298 LIBCFLAGS = $(CFLAGS)
299 CXXFLAGS = @CXXFLAGS@
300 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
301 PICFLAG = 
303 # -----------------------------------------------
304 # Programs producing files for the TARGET machine
305 # -----------------------------------------------
307 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
309 AR_FOR_TARGET=@AR_FOR_TARGET@
310 AS_FOR_TARGET=@AS_FOR_TARGET@
311 CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
313 # If GCC_FOR_TARGET is not overriden on the command line, then this
314 # variable is passed down to the gcc Makefile, where it is used to
315 # build libgcc2.a.  We define it here so that it can itself be
316 # overridden on the command line.
317 GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
318 CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
319 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
320 GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
321 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
322 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
323 LD_FOR_TARGET=@LD_FOR_TARGET@
325 LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
326 NM_FOR_TARGET=@NM_FOR_TARGET@
327 OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
328 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
329 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
330 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
332 COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
333 COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
334 COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
336 # During gcc bootstrap, if we use some random cc for stage1 then
337 # CFLAGS will be just -g.  We want to ensure that TARGET libraries
338 # (which we know are built with gcc) are built with optimizations so
339 # prepend -O2 when setting CFLAGS_FOR_TARGET.
340 CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
341 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
342 CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
343 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
344 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
345 LDFLAGS_FOR_TARGET = 
346 PICFLAG_FOR_TARGET = 
348 # ------------------------------------
349 # Miscellaneous targets and flag lists
350 # ------------------------------------
352 # The first rule in the file had better be this one.  Don't put any above it.
353 # This lives here to allow makefile fragments to contain dependencies.
354 all:
356 #### host and target specific makefile fragments come in here.
357 @target_makefile_frag@
358 @alphaieee_frag@
359 @ospace_frag@
360 @host_makefile_frag@
363 # This is the list of directories that may be needed in RPATH_ENVVAR
364 # so that prorgams built for the target machine work.
365 TARGET_LIB_PATH = [+ FOR target_modules +][+
366   IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
367   ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
368 [+ FOR target_modules +][+ IF lib_path +]
369 @if target-[+module+]
370 TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
371 @endif target-[+module+]
372 [+ ENDIF lib_path +][+ ENDFOR target_modules +]
375 # This is the list of directories that may be needed in RPATH_ENVVAR
376 # so that programs built for the host machine work.
377 HOST_LIB_PATH = [+ FOR host_modules +][+
378   IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
379   ENDFOR host_modules +]
381 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
382 @if gcc
383 HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
384 @endif gcc
386 [+ FOR host_modules +][+ IF lib_path +]
387 @if [+module+]
388 HOST_LIB_PATH_[+module+] = \
389   $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
390   +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
391 @endif [+module+]
392 [+ ENDIF lib_path +][+ ENDFOR host_modules +]
394 # Flags to pass down to all sub-makes.
395 BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
396         "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
397         "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +] \
398         "CONFIG_SHELL=$(SHELL)" \
399         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" 
401 # We leave this in just in case, but it is not needed anymore.
402 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
404 # Flags to pass down to most sub-makes, in which we're building with
405 # the host environment.
406 EXTRA_HOST_FLAGS = \
407         'AR=$(AR)' \
408         'AS=$(AS)' \
409         'CC=$(CC)' \
410         'CXX=$(CXX)' \
411         'DLLTOOL=$(DLLTOOL)' \
412         'LD=$(LD)' \
413         'LIPO=$(LIPO)' \
414         'NM=$(NM)' \
415         'OBJDUMP=$(OBJDUMP)' \
416         'RANLIB=$(RANLIB)' \
417         'STRIP=$(STRIP)' \
418         'WINDRES=$(WINDRES)'
420 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
422 # Flags that are concerned with the location of the X11 include files
423 # and library files
425 # NOTE: until the top-level is getting the values via autoconf, it only
426 # causes problems to have this top-level Makefile overriding the autoconf-set
427 # values in child directories.  Only variables that don't conflict with
428 # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
430 X11_FLAGS_TO_PASS = \
431         'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
432         'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
434 # Flags to pass down to makes which are built with the target environment.
435 # The double $ decreases the length of the command line; those variables
436 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.  The
437 # COMPILER_ prefixed variables are not passed down so we expand them here.
438 EXTRA_TARGET_FLAGS = \
439         'AR=$$(AR_FOR_TARGET)' \
440         'AS=$(COMPILER_AS_FOR_TARGET)' \
441         'CC=$$(CC_FOR_TARGET)' \
442         'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
443         'CXX=$$(CXX_FOR_TARGET)' \
444         'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
445         'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
446         'LD=$(COMPILER_LD_FOR_TARGET)' \
447         'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
448         'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
449         'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
450         'NM=$(COMPILER_NM_FOR_TARGET)' \
451         'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
452         'RANLIB=$$(RANLIB_FOR_TARGET)' \
453         'WINDRES=$$(WINDRES_FOR_TARGET)'
455 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
457 # Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
458 # unfortunately needs the native compiler and the target ar and
459 # ranlib.
460 # If any variables are added here, they must be added to do-*, below.
461 # The BUILD_* variables are a special case, which are used for the gcc
462 # cross-building scheme.
463 EXTRA_GCC_FLAGS = \
464         "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
465         "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
466         "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
467         "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
468         "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
469         "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
471 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
473 .PHONY: configure-host
474 configure-host: [+
475   FOR host_modules +] \
476     maybe-configure-[+module+][+
477   ENDFOR host_modules +]
478 .PHONY: configure-target
479 configure-target: [+
480   FOR target_modules +] \
481     maybe-configure-target-[+module+][+
482   ENDFOR target_modules +]
484 # The target built for a native non-bootstrap build.
485 .PHONY: all
486 all:
487 @if gcc-bootstrap
488         [ -f stage_final ] || echo stage3 > stage_final
489         @r=`${PWD_COMMAND}`; export r; \
490         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
491         $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
492 @endif gcc-bootstrap
493         @: $(MAKE); $(unstage)
494         @r=`${PWD_COMMAND}`; export r; \
495         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
496         if [ -f stage_last ]; then \
497           $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
498         else \
499           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
500         fi
502 .PHONY: all-build
503 [+ FOR build_modules +]
504 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
506 .PHONY: all-host
507 [+ FOR host_modules +][+ IF bootstrap +]
508 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
509 all-host: maybe-all-[+module+][+ IF bootstrap +]
510 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
512 .PHONY: all-target
513 [+ FOR target_modules +][+ IF bootstrap +]
514 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
515 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
516 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR target_modules +]
518 # Do a target for all the subdirectories.  A ``make do-X'' will do a
519 # ``make X'' in all subdirectories (because, in general, there is a
520 # dependency (below) of X upon do-X, a ``make X'' will also do this,
521 # but it may do additional work as well).
522 [+ FOR recursive_targets +]
523 .PHONY: do-[+make_target+]
524 do-[+make_target+]:
525         @: $(MAKE); $(unstage)
526         @r=`${PWD_COMMAND}`; export r; \
527         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
528         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
529           [+make_target+]-target
532 .PHONY: [+make_target+]-host
533 [+ FOR host_modules +]
534 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
536 .PHONY: [+make_target+]-target
537 [+ FOR target_modules +]
538 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
539 [+ ENDFOR recursive_targets +]
541 # Here are the targets which correspond to the do-X targets.
543 .PHONY: info installcheck dvi pdf html install-info install-html
544 .PHONY: clean distclean mostlyclean maintainer-clean realclean
545 .PHONY: local-clean local-distclean local-maintainer-clean
546 info: do-info
547 installcheck: do-installcheck
548 dvi: do-dvi
549 pdf: do-pdf
550 html: do-html
552 # Make sure makeinfo is built before we do a `make info', if we're
553 # in fact building texinfo.
554 do-info: maybe-all-texinfo
556 install-info: do-install-info dir.info
557         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
558         if [ -f dir.info ] ; then \
559           $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
560         else true ; fi
562 install-html: do-install-html
564 local-clean:
565         -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
567 local-distclean:
568         -rm -f Makefile config.status config.cache mh-frag mt-frag
569         -rm -f maybedep.tmp serdep.tmp
570         -if [ "$(TARGET_SUBDIR)" != "." ]; then \
571           rm -rf $(TARGET_SUBDIR); \
572         else true; fi
573         -rm -rf $(BUILD_SUBDIR)
574         -if [ "$(HOST_SUBDIR)" != "." ]; then \
575           rm -rf $(HOST_SUBDIR); \
576         else true; fi
577         -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
578         -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
579         -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
580         -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
581         -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
583 local-maintainer-clean:
584         @echo "This command is intended for maintainers to use;"
585         @echo "it deletes files that may require special tools to rebuild."
587 clean: do-clean local-clean
588 mostlyclean: do-mostlyclean local-clean
589 distclean: do-distclean local-clean local-distclean
590 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
591 maintainer-clean: local-distclean
592 realclean: maintainer-clean
594 # Extra dependency for clean-target, owing to the mixed nature of gcc.
595 clean-target: clean-target-libgcc
596 clean-target-libgcc:
597         if test -f gcc/Makefile; then cd gcc && $(MAKE) $@; else :; fi
599 # Check target.
601 .PHONY: check do-check
602 check: do-check
604 # Only include modules actually being configured and built.
605 .PHONY: check-host
606 check-host: [+
607   FOR host_modules +] \
608     maybe-check-[+module+][+
609   ENDFOR host_modules +]
611 .PHONY: check-target
612 check-target: [+
613   FOR target_modules +] \
614     maybe-check-target-[+module+][+
615   ENDFOR target_modules +]
617 do-check:
618         @: $(MAKE); $(unstage)
619         @r=`${PWD_COMMAND}`; export r; \
620         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
621         $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
623 # Automated reporting of test results.
625 warning.log: build.log
626         $(srcdir)/contrib/warn_summary build.log > $@
628 mail-report.log:
629         if test x'$(BOOT_CFLAGS)' != x''; then \
630             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
631         fi; \
632         $(srcdir)/contrib/test_summary -t >$@
633         chmod +x $@
634         echo If you really want to send e-mail, run ./$@ now
636 mail-report-with-warnings.log: warning.log
637         if test x'$(BOOT_CFLAGS)' != x''; then \
638             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
639         fi; \
640         $(srcdir)/contrib/test_summary -t -i warning.log >$@
641         chmod +x $@
642         echo If you really want to send e-mail, run ./$@ now
644 # Installation targets.
646 .PHONY: install uninstall
647 install:
648         @: $(MAKE); $(unstage)
649         @r=`${PWD_COMMAND}`; export r; \
650         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
651         $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
653 .PHONY: install-host-nogcc
654 install-host-nogcc: [+
655   FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
656     maybe-install-[+module+][+ ENDIF +][+
657   ENDFOR host_modules +]
659 .PHONY: install-host
660 install-host: [+
661   FOR host_modules +] \
662     maybe-install-[+module+][+
663   ENDFOR host_modules +]
665 .PHONY: install-target
666 install-target: [+
667   FOR target_modules +] \
668     maybe-install-target-[+module+][+
669   ENDFOR target_modules +]
671 uninstall:
672         @echo "the uninstall target is not supported in this tree"
674 .PHONY: install.all
675 install.all: install-no-fixedincludes
676         @if [ -f ./gcc/Makefile ] ; then \
677                 r=`${PWD_COMMAND}` ; export r ; \
678                 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
679                 $(HOST_EXPORTS) \
680                 (cd ./gcc && \
681                 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
682         else \
683                 true ; \
684         fi
686 # install-no-fixedincludes is used because Cygnus can not distribute
687 # the fixed header files.
688 .PHONY: install-no-fixedincludes
689 install-no-fixedincludes: installdirs install-host-nogcc \
690         install-target gcc-no-fixedincludes
692 ### other supporting targets
694 MAKEDIRS= \
695         $(DESTDIR)$(prefix) \
696         $(DESTDIR)$(exec_prefix)
697 .PHONY: installdirs
698 installdirs: mkinstalldirs
699         $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
701 dir.info: do-install-info
702         if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
703           $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
704           mv -f dir.info.new dir.info ; \
705         else true ; \
706         fi
708 dist:
709         @echo "Building a full distribution of this tree isn't done"
710         @echo "via 'make dist'.  Check out the etc/ subdirectory" 
712 etags tags: TAGS
714 # Right now this just builds TAGS in each subdirectory.  emacs19 has the
715 # ability to use several tags files at once, so there is probably no need
716 # to combine them into one big TAGS file (like CVS 1.3 does).  We could
717 # (if we felt like it) have this Makefile write a piece of elisp which
718 # the user could load to tell emacs19 where all the TAGS files we just
719 # built are.
720 TAGS: do-TAGS
722 # ------------------------------------
723 # Macros for configure and all targets
724 # ------------------------------------
726 [+ DEFINE configure +]
727 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
728 maybe-configure-[+prefix+][+module+]:
729 @if gcc-bootstrap
730 configure-[+prefix+][+module+]: stage_current
731 @endif gcc-bootstrap
732 @if [+prefix+][+module+]
733 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
734 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
735         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
736         @r=`${PWD_COMMAND}`; export r; \
737         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
738         [+ IF check_multilibs
739         +]echo "Checking multilib configuration for [+module+]..."; \
740         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
741         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
742         if test -r [+subdir+]/[+module+]/multilib.out; then \
743           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
744             rm -f [+subdir+]/[+module+]/multilib.tmp; \
745           else \
746             rm -f [+subdir+]/[+module+]/Makefile; \
747             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
748           fi; \
749         else \
750           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
751         fi; \
752         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
753         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
754         [+exports+] \
755         echo Configuring in [+subdir+]/[+module+]; \
756         cd "[+subdir+]/[+module+]" || exit 1; \
757         case $(srcdir) in \
758           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
759           *) topdir=`echo [+subdir+]/[+module+]/ | \
760                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
761         esac; \
762         srcdiroption="--srcdir=$${topdir}/[+module+]"; \
763         libsrcdir="$$s/[+module+]"; \
764         [+ IF no-config-site +]rm -f no-such-file || : ; \
765         CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
766           [+args+] $${srcdiroption} [+extra_configure_flags+] \
767           || exit 1
768 @endif [+prefix+][+module+]
770 [+ IF bootstrap +]
771 [+ FOR bootstrap_stage +]
772 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
773 maybe-configure-stage[+id+]-[+prefix+][+module+]:
774 @if [+prefix+][+module+]-bootstrap
775 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
776 configure-stage[+id+]-[+prefix+][+module+]:
777         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
778         @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
779         @r=`${PWD_COMMAND}`; export r; \
780         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
781         [+ IF check_multilibs
782         +]echo "Checking multilib configuration for [+module+]..."; \
783         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
784         if test -r [+subdir+]/[+module+]/multilib.out; then \
785           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
786             rm -f [+subdir+]/[+module+]/multilib.tmp; \
787           else \
788             rm -f [+subdir+]/[+module+]/Makefile; \
789             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
790           fi; \
791         else \
792           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
793         fi; \
794         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
795         [+exports+][+ IF prev +] \
796         [+poststage1_exports+][+ ENDIF prev +] \
797         echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
798         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
799         cd [+subdir+]/[+module+] || exit 1; \
800         case $(srcdir) in \
801           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
802           *) topdir=`echo [+subdir+]/[+module+]/ | \
803                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
804         esac; \
805         srcdiroption="--srcdir=$${topdir}/[+module+]"; \
806         libsrcdir="$$s/[+module+]"; \
807         $(SHELL) $${libsrcdir}/configure \
808           [+args+] $${srcdiroption} \
809           [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
810           [+stage_configure_flags+] [+extra_configure_flags+]
811 @endif [+prefix+][+module+]-bootstrap
812 [+ ENDFOR bootstrap_stage +]
813 [+ ENDIF bootstrap +]
814 [+ ENDDEF +]
816 [+ DEFINE all +]
817 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
818 maybe-all-[+prefix+][+module+]:
819 @if gcc-bootstrap
820 all-[+prefix+][+module+]: stage_current
821 @endif gcc-bootstrap
822 @if [+prefix+][+module+]
823 TARGET-[+prefix+][+module+]=[+
824   IF target +][+target+][+ ELSE +]all[+ ENDIF target +]
825 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
826 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
827         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
828         @r=`${PWD_COMMAND}`; export r; \
829         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
830         [+exports+] \
831         (cd [+subdir+]/[+module+] && \
832           $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
833 @endif [+prefix+][+module+]
835 [+ IF bootstrap +]
836 [+ FOR bootstrap_stage +]
837 .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
838 .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
839 maybe-all-stage[+id+]-[+prefix+][+module+]:
840 maybe-clean-stage[+id+]-[+prefix+][+module+]:
841 @if [+prefix+][+module+]-bootstrap
842 maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
843 all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
844 TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
845 all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
846         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
847         @r=`${PWD_COMMAND}`; export r; \
848         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
849         [+exports+][+ IF prev +] \
850         [+poststage1_exports+][+ ENDIF prev +] \
851         cd [+subdir+]/[+module+] && \
852         $(MAKE) [+args+] [+ IF prev
853                 +][+poststage1_args+][+ ENDIF prev
854                 +] [+stage_make_flags+] [+extra_make_flags+] \
855                 $(TARGET-stage[+id+]-[+prefix+][+module+])
857 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
858 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
859 clean-stage[+id+]-[+prefix+][+module+]:
860         @if [ $(current_stage) = stage[+id+] ]; then \
861           [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
862         else \
863           [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
864           $(MAKE) stage[+id+]-start; \
865         fi; \
866         cd [+subdir+]/[+module+] && \
867         $(MAKE) [+args+] [+ IF prev +] \
868                 [+poststage1_args+] [+ ENDIF prev +] \
869                 [+stage_make_flags+] [+extra_make_flags+] clean
870 @endif [+prefix+][+module+]-bootstrap
872 [+ ENDFOR bootstrap_stage +]
873 [+ ENDIF bootstrap +]
874 [+ ENDDEF +]
876 # --------------------------------------
877 # Modules which run on the build machine
878 # --------------------------------------
879 [+ FOR build_modules +]
880 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
881              args="$(BUILD_CONFIGARGS)" no-config-site=true +]
883 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
884 [+ ENDFOR build_module +]
886 # --------------------------------------
887 # Modules which run on the host machine
888 # --------------------------------------
889 [+ FOR host_modules +]
890 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
891              exports="$(HOST_EXPORTS)"
892              poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
893              args="$(HOST_CONFIGARGS)" +]
895 [+ all prefix="" subdir="$(HOST_SUBDIR)"
896        exports="$(HOST_EXPORTS)"
897        poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
898        args="$(FLAGS_TO_PASS)"
899        poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
901 .PHONY: check-[+module+] maybe-check-[+module+]
902 maybe-check-[+module+]:
903 @if [+module+]
904 maybe-check-[+module+]: check-[+module+]
905 [+ IF no_check +]
906 check-[+module+]:
907 [+ ELIF no_check_cross +]
908 # This module is only tested in a native toolchain.
909 check-[+module+]:
910         @: $(MAKE); $(unstage)
911         @if [ '$(host)' = '$(target)' ] ; then \
912           r=`${PWD_COMMAND}`; export r; \
913           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
914           $(HOST_EXPORTS) \
915           (cd $(HOST_SUBDIR)/[+module+] && \
916             $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
917         fi
918 [+ ELSE check +]
919 check-[+module+]:
920         @: $(MAKE); $(unstage)
921         @r=`${PWD_COMMAND}`; export r; \
922         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
923         $(HOST_EXPORTS) \
924         (cd $(HOST_SUBDIR)/[+module+] && \
925           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
926 [+ ENDIF no_check +]
927 @endif [+module+]
929 .PHONY: install-[+module+] maybe-install-[+module+]
930 maybe-install-[+module+]:
931 @if [+module+]
932 maybe-install-[+module+]: install-[+module+]
933 [+ IF no_install +]
934 install-[+module+]:
935 [+ ELSE install +]
936 install-[+module+]: installdirs
937         @: $(MAKE); $(unstage)
938         @r=`${PWD_COMMAND}`; export r; \
939         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
940         $(HOST_EXPORTS) \
941         (cd $(HOST_SUBDIR)/[+module+] && \
942           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
943 [+ ENDIF no_install +]
944 @endif [+module+]
946 # Other targets (info, dvi, pdf, etc.)
947 [+ FOR recursive_targets +]
948 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
949 maybe-[+make_target+]-[+module+]:
950 @if [+module+]
951 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
952 [+ IF (match-value? = "missing" (get "make_target") ) +]
953 # [+module+] doesn't support [+make_target+].
954 [+make_target+]-[+module+]:
955 [+ ELSE +]
956 [+make_target+]-[+module+]: [+
957   FOR depend +]\
958     [+depend+]-[+module+] [+
959   ENDFOR depend +]
960         @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
961         @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
962         r=`${PWD_COMMAND}`; export r; \
963         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
964         $(HOST_EXPORTS) \
965         for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
966           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
967         done; \
968         echo "Doing [+make_target+] in [+module+]" ; \
969         (cd $(HOST_SUBDIR)/[+module+] && \
970           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
971                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
972                   "RANLIB=$${RANLIB}" \
973                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
974                   [+make_target+]) \
975           || exit 1
976 [+ ENDIF +]
977 @endif [+module+]
978 [+ ENDFOR recursive_targets +]
979 [+ ENDFOR host_modules +]
981 # ---------------------------------------
982 # Modules which run on the target machine
983 # ---------------------------------------
984 [+ FOR target_modules +]
986 [+ IF raw_cxx +]
987 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
988              check_multilibs=true
989              exports="$(RAW_CXX_TARGET_EXPORTS)"
990              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
992 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
993        exports="$(RAW_CXX_TARGET_EXPORTS)"
994        args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
995 [+ ELSE +]
996 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
997              check_multilibs=true
998              exports="$(NORMAL_TARGET_EXPORTS)"
999              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1001 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1002        exports="$(NORMAL_TARGET_EXPORTS)"
1003        args="$(TARGET_FLAGS_TO_PASS)" +]
1004 [+ ENDIF +]
1006 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1007 maybe-check-target-[+module+]:
1008 @if target-[+module+]
1009 maybe-check-target-[+module+]: check-target-[+module+]
1010 [+ IF no_check +]
1011 # Dummy target for uncheckable module.
1012 check-target-[+module+]:
1013 [+ ELSE check +]
1014 check-target-[+module+]:
1015         @: $(MAKE); $(unstage)
1016         @r=`${PWD_COMMAND}`; export r; \
1017         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1018 IF raw_cxx +]
1019         $(RAW_CXX_TARGET_EXPORTS) \[+
1020 ELSE normal_cxx +]
1021         $(NORMAL_TARGET_EXPORTS) \[+
1022 ENDIF raw_cxx +]
1023         (cd $(TARGET_SUBDIR)/[+module+] && \
1024           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1025             IF raw_cxx 
1026               +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1027             ENDIF raw_cxx 
1028           +] [+extra_make_flags+] check)
1029 [+ ENDIF no_check +]
1030 @endif target-[+module+]
1032 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1033 maybe-install-target-[+module+]:
1034 @if target-[+module+]
1035 maybe-install-target-[+module+]: install-target-[+module+]
1036 [+ IF no_install +]
1037 # Dummy target for uninstallable.
1038 install-target-[+module+]:
1039 [+ ELSE install +]
1040 install-target-[+module+]: installdirs
1041         @: $(MAKE); $(unstage)
1042         @r=`${PWD_COMMAND}`; export r; \
1043         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1044 IF raw_cxx +]
1045         $(RAW_CXX_TARGET_EXPORTS) \[+
1046 ELSE normal_cxx +]
1047         $(NORMAL_TARGET_EXPORTS) \[+
1048 ENDIF raw_cxx +]
1049         (cd $(TARGET_SUBDIR)/[+module+] && \
1050           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1051 [+ ENDIF no_install +]
1052 @endif target-[+module+]
1054 # Other targets (info, dvi, pdf, etc.)
1055 [+ FOR recursive_targets +]
1056 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1057 maybe-[+make_target+]-target-[+module+]:
1058 @if target-[+module+]
1059 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1060 [+ IF (match-value? = "missing" (get "make_target") ) +]
1061 # [+module+] doesn't support [+make_target+].
1062 [+make_target+]-target-[+module+]:
1063 [+ ELSE +]
1064 [+make_target+]-target-[+module+]: [+
1065   FOR depend +]\
1066     [+depend+]-target-[+module+] [+
1067   ENDFOR depend +]
1068         @: $(MAKE); $(unstage)
1069         @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1070         r=`${PWD_COMMAND}`; export r; \
1071         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1072 IF raw_cxx +]
1073         $(RAW_CXX_TARGET_EXPORTS) \[+
1074 ELSE normal_cxx +]
1075         $(NORMAL_TARGET_EXPORTS) \[+
1076 ENDIF raw_cxx +]
1077         echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1078         for flag in $(EXTRA_TARGET_FLAGS); do \
1079           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1080         done; \
1081         (cd $(TARGET_SUBDIR)/[+module+] && \
1082           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1083                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1084                   "RANLIB=$${RANLIB}" \
1085                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
1086                   [+extra_make_flags+] [+make_target+]) \
1087           || exit 1
1088 [+ ENDIF +]
1089 @endif target-[+module+]
1090 [+ ENDFOR recursive_targets +]
1091 [+ ENDFOR target_modules +]
1093 # ----------
1094 # GCC module
1095 # ----------
1097 @if gcc-no-bootstrap
1098 # GCC has some more recursive targets, which trigger the old
1099 # (but still current, until the toplevel bootstrap project
1100 # is finished) compiler bootstrapping rules.
1102 GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
1103 .PHONY: $(GCC_STRAP_TARGETS)
1104 $(GCC_STRAP_TARGETS): all-prebootstrap configure-gcc
1105         @r=`${PWD_COMMAND}`; export r; \
1106         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1107         $(HOST_EXPORTS) \
1108         echo "Bootstrapping the compiler"; \
1109         $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
1110         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
1111         @r=`${PWD_COMMAND}`; export r; \
1112         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1113         case "$@" in \
1114           *bootstrap4-lean ) \
1115             msg="Comparing stage3 and stage4 of the compiler"; \
1116             compare=compare3-lean ;; \
1117           *bootstrap4 ) \
1118             msg="Comparing stage3 and stage4 of the compiler"; \
1119             compare=compare3 ;; \
1120           *-lean ) \
1121             msg="Comparing stage2 and stage3 of the compiler"; \
1122             compare=compare-lean ;; \
1123           * ) \
1124             msg="Comparing stage2 and stage3 of the compiler"; \
1125             compare=compare ;; \
1126         esac; \
1127         $(HOST_EXPORTS) \
1128         echo "$$msg"; \
1129         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
1130         @r=`${PWD_COMMAND}`; export r; \
1131         s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1132         echo "Building runtime libraries"; \
1133         $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
1135 profiledbootstrap: all-prebootstrap configure-gcc
1136         @r=`${PWD_COMMAND}`; export r; \
1137         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1138         $(HOST_EXPORTS) \
1139         $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
1140         echo "Bootstrapping training compiler"; \
1141         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build
1142         @r=`${PWD_COMMAND}`; export r; \
1143         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1144         $(HOST_EXPORTS) \
1145         echo "Building feedback based compiler"; \
1146         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build
1147         @r=`${PWD_COMMAND}`; export r; \
1148         s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1149         echo "Building runtime libraries"; \
1150         $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
1152 .PHONY: cross
1153 cross: all-build all-gas all-ld
1154         @r=`${PWD_COMMAND}`; export r; \
1155         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1156         $(HOST_EXPORTS) \
1157         echo "Building the C and C++ compiler"; \
1158         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1159         @r=`${PWD_COMMAND}`; export r; \
1160         s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1161         echo "Building runtime libraries"; \
1162         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1163 @endif gcc-no-bootstrap
1165 @if gcc
1166 .PHONY: check-gcc-c++
1167 check-gcc-c++:
1168         @if [ -f ./gcc/Makefile ] ; then \
1169           r=`${PWD_COMMAND}`; export r; \
1170           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1171           $(HOST_EXPORTS) \
1172           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
1173         else \
1174           true; \
1175         fi
1177 .PHONY: check-c++
1178 check-c++: check-target-libstdc++-v3 check-gcc-c++
1180 # Install the gcc headers files, but not the fixed include files,
1181 # which Cygnus is not allowed to distribute.  This rule is very
1182 # dependent on the workings of the gcc Makefile.in.
1183 .PHONY: gcc-no-fixedincludes
1184 gcc-no-fixedincludes:
1185         @if [ -f ./gcc/Makefile ]; then \
1186           rm -rf gcc/tmp-include; \
1187           mv gcc/include gcc/tmp-include 2>/dev/null; \
1188           mkdir gcc/include; \
1189           cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1190           touch gcc/stmp-fixinc gcc/include/fixed; \
1191           rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1192           r=`${PWD_COMMAND}`; export r; \
1193           s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1194           $(HOST_EXPORTS) \
1195           (cd ./gcc && \
1196            $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1197           rm -rf gcc/include; \
1198           mv gcc/tmp-include gcc/include 2>/dev/null; \
1199         else true; fi
1200 @endif gcc
1202 # ---------------------
1203 # GCC bootstrap support
1204 # ---------------------
1206 # We track the current stage (the one in 'gcc') in the stage_current file.
1207 # stage_last instead tracks the stage that was built last.  These targets
1208 # are dummy when toplevel bootstrap is not active.
1210 # While making host and target tools, symlinks to the final stage must be
1211 # there, so $(unstage) should be run at various points.  To avoid excessive
1212 # recursive invocations of make, we "inline" them using a variable.  These
1213 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1214 # to avoid warnings from the GNU Make job server.
1216 unstage = :
1217 stage = :
1218 current_stage = ""
1220 @if gcc-bootstrap
1221 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1222 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1223 current_stage = "`cat stage_current 2> /dev/null`"
1224 @endif gcc-bootstrap
1226 .PHONY: unstage stage
1227 unstage:
1228         @: $(MAKE); $(unstage)
1229 stage:
1230         @: $(MAKE); $(stage)
1232 # Disable commands for lean bootstrap.
1233 LEAN = false
1235 # We name the build directories for the various stages "stage1-gcc",
1236 # "stage2-gcc","stage3-gcc", etc.
1238 # Since the 'compare' process will fail (on debugging information) if any
1239 # directory names are different, we need to link the gcc directory for
1240 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1241 # the build directories constant as well. For the latter, we use naked names
1242 # like 'gcc', because the scripts in that directory assume it.  We use
1243 # mv on platforms where symlinks to directories do not work or are not
1244 # reliable.
1246 # 'touch' doesn't work right on some platforms.
1247 STAMP = echo timestamp > 
1249 # Only build the C compiler for stage1, because that is the only one that
1250 # we can guarantee will build with the native compiler, and also it is the
1251 # only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
1252 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
1253 # overrideable (for a bootstrap build stage1 also builds gcc.info).
1255 STAGE1_CFLAGS=@stage1_cflags@
1256 STAGE1_LANGUAGES=@stage1_languages@
1258 # We only want to compare .o files, so set this!
1259 objext = .o
1261 # Flags to pass to stage2 and later makes.
1262 POSTSTAGE1_FLAGS_TO_PASS = \
1263         CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
1264         STAGE_PREFIX="$$r/$(HOST_SUBDIR)/prev-gcc/" \
1265         CFLAGS="$(BOOT_CFLAGS)" \
1266         LIBCFLAGS="$(BOOT_CFLAGS)" \
1267         LDFLAGS="$(BOOT_LDFLAGS)" \
1268         "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
1270 # For stage 1:
1271 # * We force-disable intermodule optimizations, even if
1272 #   --enable-intermodule was passed, since the installed compiler probably
1273 #   can't handle them.  Luckily, autoconf always respects
1274 #   the last argument when conflicting --enable arguments are passed.
1275 # * Likewise, we force-disable coverage flags, since the installed compiler
1276 #   probably has never heard of them.
1277 # * We build only C (and possibly Ada).
1279 [+ FOR bootstrap-stage +]
1280 .PHONY: stage[+id+]-start stage[+id+]-end
1282 stage[+id+]-start::
1283         @: $(MAKE); $(stage); \
1284         echo stage[+id+] > stage_current ; \
1285         echo stage[+id+] > stage_last; \
1286         $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1287    FOR host_modules +][+ IF bootstrap +]
1288 @if [+ module +]
1289         @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1290           mkdir stage[+id+]-[+module+]; \
1291         mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1292         mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1293 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1294         @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1295           mkdir stage[+id+]-$(TARGET_SUBDIR); \
1296         mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1297         mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1299 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1300 @if [+ module +]
1301         @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1302           cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1303           mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
1304         fi
1305 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1306         @if test -d $(TARGET_SUBDIR) ; then \
1307           mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1308           mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
1309         fi
1310         rm -f stage_current
1312 # Bubble a bugfix through all the stages up to stage [+id+].  They are
1313 # remade, but not reconfigured.  The next stage (if any) will not be
1314 # reconfigured as well.
1315 .PHONY: stage[+id+]-bubble
1316 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1317         @r=`${PWD_COMMAND}`; export r; \
1318         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1319         if test -f stage[+id+]-lean [+
1320           IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1321           echo Skipping rebuild of stage[+id+] ; \
1322         else \
1323           $(MAKE) stage[+id+]-start; \[+IF lean +]
1324           if $(LEAN); then \
1325             rm -rf stage[+lean+]-* ; \
1326             $(STAMP) stage[+lean+]-lean ; \
1327           fi; \[+ ENDIF lean +]
1328           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1329         fi[+ IF compare-target +]
1330         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1332 .PHONY: all-stage[+id+] clean-stage[+id+]
1333 do-clean: clean-stage[+id+]
1335 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1336 # only possibility, but now it conflicts with no-bootstrap rules
1337 @if gcc-bootstrap
1338 [+ IF compare-target +]
1339 [+compare-target+]:
1340         @r=`${PWD_COMMAND}`; export r; \
1341         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1342         if test -f stage[+prev+]-lean; then \
1343           echo Cannot compare object files as stage [+prev+] was deleted. ; \
1344           exit 0 ; \
1345         fi; \
1346         : $(MAKE); $(stage); \
1347         rm -f .bad_compare ; \
1348         echo Comparing stages [+prev+] and [+id+] ; \
1349         cd stage[+id+]-gcc; \
1350         files=`find . -name "*$(objext)" -print` ; \
1351         cd .. ; \
1352         for file in $${files} ; do \
1353           f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
1354           @do_compare@ > /dev/null 2>&1; \
1355           if test $$? -eq 1; then \
1356             case $$file in \
1357               ./cc*-checksum$(objext) | ./libgcc/* ) \
1358                 echo warning: $$file differs ;; \
1359               *) \
1360                 echo $$file differs >> .bad_compare ;; \
1361             esac ; \
1362           fi ; \
1363         done ; \
1364         if [ -f .bad_compare ]; then \
1365           echo "Bootstrap comparison failure!"; \
1366           cat .bad_compare; \
1367           exit 1; \
1368         else \
1369           echo Comparison successful.; \
1370         fi ; \
1371         $(STAMP) [+compare-target+][+ IF prev +]
1372         if $(LEAN); then \
1373           rm -rf stage[+prev+]-*; \
1374           $(STAMP) stage[+prev+]-lean; \
1375         fi[+ ENDIF prev +]
1376 [+ ENDIF compare-target +]
1378 [+ IF bootstrap-target +]
1379 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1380 [+bootstrap-target+]:
1381         echo stage[+id+] > stage_final
1382         @r=`${PWD_COMMAND}`; export r; \
1383         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1384         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1385         @: $(MAKE); $(unstage)
1386         @r=`${PWD_COMMAND}`; export r; \
1387         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1388         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1390 [+bootstrap-target+]-lean:
1391         echo stage[+id+] > stage_final
1392         @r=`${PWD_COMMAND}`; export r; \
1393         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1394         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1395         @: $(MAKE); $(unstage)
1396         @r=`${PWD_COMMAND}`; export r; \
1397         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1398         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1399 [+ ENDIF bootstrap-target +]
1401 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1402 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1403 .PHONY: distclean-stage[+id+]
1404 distclean-stage[+id+]::
1405         @: $(MAKE); $(stage)
1406         rm -rf stage[+id+]-* [+
1407           IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1409 [+ IF cleanstrap-target +]
1410 .PHONY: [+cleanstrap-target+]
1411 [+cleanstrap-target+]: distclean [+bootstrap-target+]
1412 [+ ENDIF cleanstrap-target +]
1413 @endif gcc-bootstrap
1415 [+ ENDFOR bootstrap-stage +]
1417 stageprofile-end::
1418         $(MAKE) distclean-stagefeedback
1420 stagefeedback-start::
1421         @r=`${PWD_COMMAND}`; export r; \
1422         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1423         for i in prev-*; do \
1424           j=`echo $$i | sed s/^prev-//` ; \
1425           cd $$r/$$i && \
1426           { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1427           { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1428         done
1430 @if gcc-bootstrap
1431 do-distclean: distclean-stage1
1433 # Provide a GCC build when we're building target libraries.  This does
1434 # not work as a dependency, just as the minimum necessary to avoid errors.
1435 stage_last:
1436         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1438 # Same as unstage, but not phony and defaulting to stage1-start.  We place
1439 # it in the dependency so that for example `make -j3 all-gcc' works.
1440 stage_current:
1441         @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1443 .PHONY: restrap
1444 restrap:
1445         @: $(MAKE); $(stage)
1446         rm -rf stage1-$(TARGET_SUBDIR) [+ FOR bootstrap-stage +][+ IF prev
1447           +]stage[+id+]-* [+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1448         $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
1449 @endif gcc-bootstrap
1451 # --------------------------------------
1452 # Dependencies between different modules
1453 # --------------------------------------
1455 # Generic dependencies for target modules on host stuff, especially gcc
1456 @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1457   +][+ FOR bootstrap_stage +]
1458 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1459   ENDFOR +][+ ELSE bootstrap +]
1460 configure-target-[+module+]: stage_last[+
1461   ENDIF bootstrap +][+ ENDFOR target_modules +]
1462 @endif gcc-bootstrap
1464 @if gcc-no-bootstrap[+ FOR target_modules +][+ IF bootstrap
1465   +][+ ELSE +]
1466 configure-target-[+module+]: maybe-all-gcc[+
1467   ENDIF bootstrap +][+ ENDFOR target_modules +]
1468 @endif gcc-no-bootstrap
1471 [+ FOR lang_env_dependencies +]
1472 configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss
1473 [+ IF cxx +]configure-target-[+module+]: maybe-all-target-libstdc++-v3
1474 [+ ENDIF cxx +][+ ENDFOR lang_env_dependencies +]
1476 # There are two types of dependencies here: 'hard' dependencies, where one
1477 # module simply won't build without the other; and 'soft' dependencies, where
1478 # if the depended-on module is missing, the depending module will do without
1479 # or find a substitute somewhere (perhaps installed).  Soft dependencies
1480 # are made here to depend on a 'maybe-' target.  If you're not sure,
1481 # it's safer to use a soft dependency.
1483 [+ ;; These Scheme functions build the bulk of the dependencies.
1484    ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1485    ;; where "maybe-" is only included if HARD is true, and all-gcc
1486    ;; is taken from VAR-NAME.
1487    (define dep-target (lambda (module-kind var-name hard)
1488       (string-append
1489          (if hard "" "maybe-")
1490          (dep-subtarget var-name)
1491          module-kind
1492          (dep-module var-name)
1493       )))
1495    ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1496    (define make-dep (lambda (module-kind on-kind)
1497       (string-append
1498          (dep-target module-kind "module" #t) ": "
1499          (dep-target on-kind "on" (exist? "hard")))))
1501    ;; dep-subtarget extracts everything up to the first dash in the given
1502    ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1503    (define dep-subtarget (lambda (var-name)
1504       (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1506    ;; dep-module extracts everything up to the first dash in the given
1507    ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1508    (define dep-module (lambda (var-name)
1509       (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1511    ;; dep-stage builds a string for the prefix of a bootstrap stage.
1512    (define dep-stage (lambda ()
1513       (string-append
1514          "stage"
1515          (get "id")
1516          "-")))
1518    ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1519    ;; but is written in Scheme.
1520    (define dep-maybe (lambda ()
1521       (if (exist? "hard") "" "maybe-")))
1523    ;; dep-kind returns "normal" if the dependency is on an "install" target,
1524    ;; or if either module is not bootstrapped.  It returns "bootstrap" for
1525    ;; configure or build dependencies between bootstrapped modules; it returns
1526    ;; "prebootstrap" for configure or build dependencies of bootstrapped
1527    ;; modules on a build module (e.g. all-gcc on all-build-bison).  All this
1528    ;; is only necessary for host modules.
1529    (define dep-kind (lambda ()
1530       (if (and (hash-ref boot-modules (dep-module "module"))
1531                (=* (dep-module "on") "build-"))
1532           "prebootstrap"
1534           (if (or (= (dep-subtarget "on") "install-")
1535                   (not (hash-ref boot-modules (dep-module "module")))
1536                   (not (hash-ref boot-modules (dep-module "on"))))
1537               "normal"
1538               "bootstrap"))))
1540    ;; We now build the hash table that is used by dep-kind.
1541    (define boot-modules (make-hash-table 113))
1544 [+ FOR host_modules +][+
1545    (if (exist? "bootstrap")
1546        (hash-create-handle! boot-modules (get "module") #t))
1547    "" +][+ ENDFOR host_modules +]
1548 [+ FOR target_modules +][+
1549    (if (exist? "bootstrap")
1550        (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1551    "" +][+ ENDFOR target_modules +]
1553 # With all the machinery above in place, it is pretty easy to generate
1554 # dependencies.  Host dependencies are a bit more complex because we have
1555 # to check for bootstrap/prebootstrap dependencies.  To resolve
1556 # prebootstrap dependencies, prebootstrap modules are gathered in
1557 # a hash table.
1558 [+ FOR dependencies +][+ (make-dep "" "") +]
1559 [+ CASE (dep-kind) +]
1560 [+ == "prebootstrap"
1561      +][+ FOR bootstrap_stage +]
1562 [+ (make-dep (dep-stage) "") +][+
1563        ENDFOR bootstrap_stage +]
1564 all-prebootstrap: [+ (dep-target "" "on" (exist? "hard")) +]
1565 [+ == "bootstrap"
1566      +][+ FOR bootstrap_stage +]
1567 [+ (make-dep (dep-stage) (dep-stage)) +][+
1568        ENDFOR bootstrap_stage +]
1569 [+ ESAC +][+
1570 ENDFOR dependencies +]
1572 # Non-toplevel bootstrap rules must depend on several packages, to be built
1573 # before gcc.  Another wart that will go away, hopefully soon.
1574 @if gcc-no-bootstrap
1575 [+ FOR host_modules +][+
1576    IF (and (not (= (get "module") "gcc"))
1577            (hash-ref boot-modules (get "module"))) +]
1578 all-prebootstrap: maybe-all-[+module+][+
1579    ENDIF +][+
1580 ENDFOR host_modules +]
1581 @endif gcc-no-bootstrap
1583 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
1584 GDB_TK = @GDB_TK@
1585 INSTALL_GDB_TK = @INSTALL_GDB_TK@
1586 configure-gdb: $(CONFIGURE_GDB_TK)
1587 all-gdb: $(gdbnlmrequirements) $(GDB_TK)
1588 install-gdb: $(INSTALL_GDB_TK)
1590 # Serialization dependencies.  Host configures don't work well in parallel to
1591 # each other, due to contention over config.cache.  Target configures and 
1592 # build configures are similar.
1593 @serialization_dependencies@
1595 # --------------------------------
1596 # Regenerating top level configury
1597 # --------------------------------
1599 # Rebuilding Makefile.in, using autogen.
1600 AUTOGEN = autogen
1601 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1602         cd $(srcdir) && $(AUTOGEN) Makefile.def
1604 # Rebuilding Makefile.
1605 Makefile: $(srcdir)/Makefile.in config.status
1606         CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1608 config.status: configure
1609         CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
1611 # Rebuilding configure.
1612 AUTOCONF = autoconf
1613 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4
1614         cd $(srcdir) && $(AUTOCONF)
1616 # ------------------------------
1617 # Special directives to GNU Make
1618 # ------------------------------
1620 # Don't pass command-line variables to submakes.
1621 .NOEXPORT:
1622 MAKEOVERRIDES=
1624 # end of Makefile.in