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