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