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