ffi.h.in: Change void (*)() to void (*)(void).
[official-gcc.git] / Makefile.tpl
blob44c2bd88f9037ecf42250f18510e8566e25ffaa8
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 test ! -f stage_last || 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
633         && :
635 .PHONY: all-build
636 [+ FOR build_modules +]
637 all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
639 .PHONY: all-host
640 [+ FOR host_modules +][+ IF bootstrap +]
641 @if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
642 all-host: maybe-all-[+module+][+ IF bootstrap +]
643 @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
645 .PHONY: all-target
646 [+ FOR target_modules +][+ IF bootstrap +]
647 @if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
648 all-target: maybe-all-target-[+module+][+ IF bootstrap +]
649 @endif target-[+module+]-no-bootstrap[+
650   ENDIF bootstrap +][+ ENDFOR target_modules +]
652 # Do a target for all the subdirectories.  A ``make do-X'' will do a
653 # ``make X'' in all subdirectories (because, in general, there is a
654 # dependency (below) of X upon do-X, a ``make X'' will also do this,
655 # but it may do additional work as well).
656 [+ FOR recursive_targets +]
657 .PHONY: do-[+make_target+]
658 do-[+make_target+]:
659         @: $(MAKE); $(unstage)
660         @r=`${PWD_COMMAND}`; export r; \
661         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
662         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
663           [+make_target+]-target
666 .PHONY: [+make_target+]-host
667 [+ FOR host_modules +]
668 [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
670 .PHONY: [+make_target+]-target
671 [+ FOR target_modules +]
672 [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
673 [+ ENDFOR recursive_targets +]
675 # Here are the targets which correspond to the do-X targets.
677 .PHONY: info installcheck dvi pdf html
678 .PHONY: install-info install-pdf install-html
679 .PHONY: clean distclean mostlyclean maintainer-clean realclean
680 .PHONY: local-clean local-distclean local-maintainer-clean
681 info: do-info
682 installcheck: do-installcheck
683 dvi: do-dvi
684 pdf: do-pdf
685 html: do-html
687 # Make sure makeinfo is built before we do a `make info', if we're
688 # in fact building texinfo.
689 do-info: maybe-all-texinfo
691 install-info: do-install-info dir.info
692         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
693         if [ -f dir.info ] ; then \
694           $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
695         else true ; fi
697 install-pdf: do-install-pdf
699 install-html: do-install-html
701 local-clean:
702         -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
704 local-distclean:
705         -rm -f Makefile config.status config.cache mh-frag mt-frag
706         -rm -f maybedep.tmp serdep.tmp
707         -if [ "$(TARGET_SUBDIR)" != "." ]; then \
708           rm -rf $(TARGET_SUBDIR); \
709         else true; fi
710         -rm -rf $(BUILD_SUBDIR)
711         -if [ "$(HOST_SUBDIR)" != "." ]; then \
712           rm -rf $(HOST_SUBDIR); \
713         else true; fi
714         -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
715         -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
716         -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
717         -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
718         -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
720 local-maintainer-clean:
721         @echo "This command is intended for maintainers to use;"
722         @echo "it deletes files that may require special tools to rebuild."
724 clean: do-clean local-clean
725 mostlyclean: do-mostlyclean local-clean
726 distclean: do-distclean local-clean local-distclean
727 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
728 maintainer-clean: local-distclean
729 realclean: maintainer-clean
731 # Check target.
733 .PHONY: check do-check
734 check: do-check
736 # Only include modules actually being configured and built.
737 .PHONY: check-host
738 check-host: [+
739   FOR host_modules +] \
740     maybe-check-[+module+][+
741   ENDFOR host_modules +]
743 .PHONY: check-target
744 check-target: [+
745   FOR target_modules +] \
746     maybe-check-target-[+module+][+
747   ENDFOR target_modules +]
749 do-check:
750         @: $(MAKE); $(unstage)
751         @r=`${PWD_COMMAND}`; export r; \
752         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
753         $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
755 # Automated reporting of test results.
757 warning.log: build.log
758         $(srcdir)/contrib/warn_summary build.log > $@
760 mail-report.log:
761         if test x'$(BOOT_CFLAGS)' != x''; then \
762             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
763         fi; \
764         $(srcdir)/contrib/test_summary -t >$@
765         chmod +x $@
766         echo If you really want to send e-mail, run ./$@ now
768 mail-report-with-warnings.log: warning.log
769         if test x'$(BOOT_CFLAGS)' != x''; then \
770             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
771         fi; \
772         $(srcdir)/contrib/test_summary -t -i warning.log >$@
773         chmod +x $@
774         echo If you really want to send e-mail, run ./$@ now
776 # Installation targets.
778 .PHONY: install uninstall
779 install:
780         @: $(MAKE); $(unstage)
781         @r=`${PWD_COMMAND}`; export r; \
782         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
783         $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
785 .PHONY: install-host-nogcc
786 install-host-nogcc: [+
787   FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
788     maybe-install-[+module+][+ ENDIF +][+
789   ENDFOR host_modules +]
791 .PHONY: install-host
792 install-host: [+
793   FOR host_modules +] \
794     maybe-install-[+module+][+
795   ENDFOR host_modules +]
797 .PHONY: install-target
798 install-target: [+
799   FOR target_modules +] \
800     maybe-install-target-[+module+][+
801   ENDFOR target_modules +]
803 uninstall:
804         @echo "the uninstall target is not supported in this tree"
806 .PHONY: install.all
807 install.all: install-no-fixedincludes
808         @if [ -f ./gcc/Makefile ] ; then \
809                 r=`${PWD_COMMAND}` ; export r ; \
810                 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
811                 $(HOST_EXPORTS) \
812                 (cd ./gcc && \
813                 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
814         else \
815                 true ; \
816         fi
818 # install-no-fixedincludes is used because Cygnus can not distribute
819 # the fixed header files.
820 .PHONY: install-no-fixedincludes
821 install-no-fixedincludes: installdirs install-host-nogcc \
822         install-target gcc-no-fixedincludes
824 ### other supporting targets
826 MAKEDIRS= \
827         $(DESTDIR)$(prefix) \
828         $(DESTDIR)$(exec_prefix)
829 .PHONY: installdirs
830 installdirs: mkinstalldirs
831         $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
833 dir.info: do-install-info
834         if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
835           $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
836           mv -f dir.info.new dir.info ; \
837         else true ; \
838         fi
840 dist:
841         @echo "Building a full distribution of this tree isn't done"
842         @echo "via 'make dist'.  Check out the etc/ subdirectory" 
844 etags tags: TAGS
846 # Right now this just builds TAGS in each subdirectory.  emacs19 has the
847 # ability to use several tags files at once, so there is probably no need
848 # to combine them into one big TAGS file (like CVS 1.3 does).  We could
849 # (if we felt like it) have this Makefile write a piece of elisp which
850 # the user could load to tell emacs19 where all the TAGS files we just
851 # built are.
852 TAGS: do-TAGS
854 # ------------------------------------
855 # Macros for configure and all targets
856 # ------------------------------------
858 [+ DEFINE configure +]
859 .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
860 maybe-configure-[+prefix+][+module+]:
861 @if gcc-bootstrap
862 configure-[+prefix+][+module+]: stage_current
863 @endif gcc-bootstrap
864 @if [+prefix+][+module+]
865 maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
866 configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
867         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
868         @r=`${PWD_COMMAND}`; export r; \
869         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
870         [+ IF check_multilibs
871         +]echo "Checking multilib configuration for [+module+]..."; \
872         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
873         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
874         if test -r [+subdir+]/[+module+]/multilib.out; then \
875           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
876             rm -f [+subdir+]/[+module+]/multilib.tmp; \
877           else \
878             rm -f [+subdir+]/[+module+]/Makefile; \
879             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
880           fi; \
881         else \
882           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
883         fi; \
884         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
885         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
886         [+exports+] \
887         echo Configuring in [+subdir+]/[+module+]; \
888         cd "[+subdir+]/[+module+]" || exit 1; \
889         case $(srcdir) in \
890           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
891           *) topdir=`echo [+subdir+]/[+module+]/ | \
892                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
893         esac; \
894         srcdiroption="--srcdir=$${topdir}/[+module+]"; \
895         libsrcdir="$$s/[+module+]"; \
896         [+ IF no-config-site +]rm -f no-such-file || : ; \
897         CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
898           [+args+] --build=${build_alias} --host=[+host_alias+] \
899           --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
900           || exit 1
901 @endif [+prefix+][+module+]
903 [+ IF bootstrap +]
904 [+ FOR bootstrap_stage +]
905 .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
906 maybe-configure-stage[+id+]-[+prefix+][+module+]:
907 @if [+prefix+][+module+]-bootstrap
908 maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
909 configure-stage[+id+]-[+prefix+][+module+]:
910         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
911         @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
912         @r=`${PWD_COMMAND}`; export r; \
913         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
914         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
915         [+ IF check_multilibs
916         +]echo "Checking multilib configuration for [+module+]..."; \
917         $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
918         if test -r [+subdir+]/[+module+]/multilib.out; then \
919           if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
920             rm -f [+subdir+]/[+module+]/multilib.tmp; \
921           else \
922             rm -f [+subdir+]/[+module+]/Makefile; \
923             mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
924           fi; \
925         else \
926           mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
927         fi; \
928         [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
929         [+exports+][+ IF prev +] \
930         [+poststage1_exports+][+ ENDIF prev +][+ IF prefix +] \
931         CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
932         CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
933         LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;[+ ELSE prefix +] \
934         CFLAGS="$(STAGE[+id+]_CFLAGS)"; export CFLAGS; \
935         CXXFLAGS="$(STAGE[+id+]_CFLAGS)"; export CXXFLAGS;[+ IF prev +] \
936         LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
937         LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +]; export LIBCFLAGS;[+ ENDIF prefix +] \
938         echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
939         $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
940         cd [+subdir+]/[+module+] || exit 1; \
941         case $(srcdir) in \
942           /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
943           *) topdir=`echo [+subdir+]/[+module+]/ | \
944                 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
945         esac; \
946         srcdiroption="--srcdir=$${topdir}/[+module+]"; \
947         libsrcdir="$$s/[+module+]"; \
948         $(SHELL) $${libsrcdir}/configure \
949           [+args+] --build=${build_alias} --host=[+host_alias+] \
950           --target=[+target_alias+] $${srcdiroption} [+ IF prev +]\
951           --with-build-libsubdir=$(HOST_SUBDIR) [+ ENDIF prev +]\
952           $(STAGE[+id+]_CONFIGURE_FLAGS)[+ IF extra_configure_flags +] \
953           [+extra_configure_flags+][+ ENDIF extra_configure_flags +]
954 @endif [+prefix+][+module+]-bootstrap
955 [+ ENDFOR bootstrap_stage +]
956 [+ ENDIF bootstrap +]
957 [+ ENDDEF +]
959 [+ DEFINE all +]
960 .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
961 maybe-all-[+prefix+][+module+]:
962 @if gcc-bootstrap
963 all-[+prefix+][+module+]: stage_current
964 @endif gcc-bootstrap
965 @if [+prefix+][+module+]
966 TARGET-[+prefix+][+module+]=[+
967   IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
968 maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
969 all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
970         @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
971         @r=`${PWD_COMMAND}`; export r; \
972         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
973         [+exports+] \
974         (cd [+subdir+]/[+module+] && \
975           $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+extra_make_flags+] \
976                 $(TARGET-[+prefix+][+module+]))
977 @endif [+prefix+][+module+]
979 [+ IF bootstrap +]
980 [+ FOR bootstrap_stage +]
981 .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
982 .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
983 maybe-all-stage[+id+]-[+prefix+][+module+]:
984 maybe-clean-stage[+id+]-[+prefix+][+module+]:
985 @if [+prefix+][+module+]-bootstrap
986 maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
987 all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
988 TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
989 all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
990         @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
991         @r=`${PWD_COMMAND}`; export r; \
992         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
993         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
994         [+exports+][+ IF prev +] \
995         [+poststage1_exports+][+ ENDIF prev +] \
996         cd [+subdir+]/[+module+] && \
997         $(MAKE) $(BASE_FLAGS_TO_PASS)[+ IF prefix +] \
998                 CFLAGS="$(CFLAGS_FOR_TARGET)" \
999                 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
1000                 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"[+ ELSE prefix +] \
1001                 CFLAGS="$(STAGE[+id+]_CFLAGS)" \
1002                 CXXFLAGS="$(STAGE[+id+]_CFLAGS)"[+ IF prev +] \
1003                 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1004                 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +][+ ENDIF prefix +] \
1005                 CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
1006                 CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
1007                 LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
1008                 [+args+] [+
1009                 IF prev +][+poststage1_args+][+ ENDIF prev
1010                 +] [+extra_make_flags+] \
1011                 TFLAGS="$(STAGE[+id+]_TFLAGS)" \
1012                 $(TARGET-stage[+id+]-[+prefix+][+module+])
1014 maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
1015 clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
1016 clean-stage[+id+]-[+prefix+][+module+]:
1017         @if [ $(current_stage) = stage[+id+] ]; then \
1018           [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
1019         else \
1020           [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
1021           $(MAKE) stage[+id+]-start; \
1022         fi; \
1023         cd [+subdir+]/[+module+] && \
1024         $(MAKE) [+args+] [+ IF prev +] \
1025                 [+poststage1_args+] [+ ENDIF prev +] \
1026                 [+extra_make_flags+] clean
1027 @endif [+prefix+][+module+]-bootstrap
1029 [+ ENDFOR bootstrap_stage +]
1030 [+ ENDIF bootstrap +]
1031 [+ ENDDEF +]
1033 # --------------------------------------
1034 # Modules which run on the build machine
1035 # --------------------------------------
1036 [+ FOR build_modules +]
1037 [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1038              host_alias=(get "host" "${build_alias}")
1039              target_alias=(get "target" "${target_alias}")
1040              args="$(BUILD_CONFIGARGS)" no-config-site=true +]
1042 [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1043              args="$(EXTRA_BUILD_FLAGS)" +]
1044 [+ ENDFOR build_module +]
1046 # --------------------------------------
1047 # Modules which run on the host machine
1048 # --------------------------------------
1049 [+ FOR host_modules +]
1050 [+ configure prefix="" subdir="$(HOST_SUBDIR)"
1051              exports="$(HOST_EXPORTS)"
1052              poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1053              host_alias=(get "host" "${host_alias}")
1054              target_alias=(get "target" "${target_alias}")
1055              args="$(HOST_CONFIGARGS)" +]
1057 [+ all prefix="" subdir="$(HOST_SUBDIR)"
1058        exports="$(HOST_EXPORTS)"
1059        poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1060        args="$(EXTRA_HOST_FLAGS)"
1061        poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
1063 .PHONY: check-[+module+] maybe-check-[+module+]
1064 maybe-check-[+module+]:
1065 @if [+module+]
1066 maybe-check-[+module+]: check-[+module+]
1067 [+ IF no_check +]
1068 check-[+module+]:
1069 [+ ELIF no_check_cross +]
1070 # This module is only tested in a native toolchain.
1071 check-[+module+]:
1072         @: $(MAKE); $(unstage)
1073         @if [ '$(host)' = '$(target)' ] ; then \
1074           r=`${PWD_COMMAND}`; export r; \
1075           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1076           $(HOST_EXPORTS) \
1077           (cd $(HOST_SUBDIR)/[+module+] && \
1078             $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
1079         fi
1080 [+ ELSE check +]
1081 check-[+module+]:
1082         @: $(MAKE); $(unstage)
1083         @r=`${PWD_COMMAND}`; export r; \
1084         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1085         $(HOST_EXPORTS) \
1086         (cd $(HOST_SUBDIR)/[+module+] && \
1087           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
1088 [+ ENDIF no_check +]
1089 @endif [+module+]
1091 .PHONY: install-[+module+] maybe-install-[+module+]
1092 maybe-install-[+module+]:
1093 @if [+module+]
1094 maybe-install-[+module+]: install-[+module+]
1095 [+ IF no_install +]
1096 install-[+module+]:
1097 [+ ELSE install +]
1098 install-[+module+]: installdirs
1099         @: $(MAKE); $(unstage)
1100         @r=`${PWD_COMMAND}`; export r; \
1101         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1102         $(HOST_EXPORTS) \
1103         (cd $(HOST_SUBDIR)/[+module+] && \
1104           $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
1105 [+ ENDIF no_install +]
1106 @endif [+module+]
1108 # Other targets (info, dvi, pdf, etc.)
1109 [+ FOR recursive_targets +]
1110 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1111 maybe-[+make_target+]-[+module+]:
1112 @if [+module+]
1113 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
1114 [+ IF (match-value? = "missing" (get "make_target") ) +]
1115 # [+module+] doesn't support [+make_target+].
1116 [+make_target+]-[+module+]:
1117 [+ ELSE +]
1118 [+make_target+]-[+module+]: [+
1119   FOR depend +]\
1120     [+depend+]-[+module+] [+
1121   ENDFOR depend +]
1122         @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1123         @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
1124         r=`${PWD_COMMAND}`; export r; \
1125         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1126         $(HOST_EXPORTS) \
1127         for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
1128           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1129         done; \
1130         echo "Doing [+make_target+] in [+module+]" ; \
1131         (cd $(HOST_SUBDIR)/[+module+] && \
1132           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1133                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1134                   "RANLIB=$${RANLIB}" \
1135                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1136                   [+make_target+]) \
1137           || exit 1
1138 [+ ENDIF +]
1139 @endif [+module+]
1140 [+ ENDFOR recursive_targets +]
1141 [+ ENDFOR host_modules +]
1143 # ---------------------------------------
1144 # Modules which run on the target machine
1145 # ---------------------------------------
1146 [+ FOR target_modules +]
1148 [+ IF raw_cxx +]
1149 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1150              check_multilibs=true
1151              exports="$(RAW_CXX_TARGET_EXPORTS)"
1152              host_alias=(get "host" "${target_alias}")
1153              target_alias=(get "target" "${target_alias}")
1154              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1156 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1157        exports="$(RAW_CXX_TARGET_EXPORTS)"
1158        args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1159 [+ ELSE +]
1160 [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
1161              check_multilibs=true
1162              exports="$(NORMAL_TARGET_EXPORTS)"
1163              host_alias=(get "host" "${target_alias}")
1164              target_alias=(get "target" "${target_alias}")
1165              args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1167 [+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1168        exports="$(NORMAL_TARGET_EXPORTS)"
1169        args="$(EXTRA_TARGET_FLAGS)" +]
1170 [+ ENDIF +]
1172 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1173 maybe-check-target-[+module+]:
1174 @if target-[+module+]
1175 maybe-check-target-[+module+]: check-target-[+module+]
1176 [+ IF no_check +]
1177 # Dummy target for uncheckable module.
1178 check-target-[+module+]:
1179 [+ ELSE check +]
1180 check-target-[+module+]:
1181         @: $(MAKE); $(unstage)
1182         @r=`${PWD_COMMAND}`; export r; \
1183         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1184 IF raw_cxx +]
1185         $(RAW_CXX_TARGET_EXPORTS) \[+
1186 ELSE normal_cxx +]
1187         $(NORMAL_TARGET_EXPORTS) \[+
1188 ENDIF raw_cxx +]
1189         (cd $(TARGET_SUBDIR)/[+module+] && \
1190           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1191             IF raw_cxx 
1192               +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1193             ENDIF raw_cxx 
1194           +] [+extra_make_flags+] check)
1195 [+ ENDIF no_check +]
1196 @endif target-[+module+]
1198 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1199 maybe-install-target-[+module+]:
1200 @if target-[+module+]
1201 maybe-install-target-[+module+]: install-target-[+module+]
1202 [+ IF no_install +]
1203 # Dummy target for uninstallable.
1204 install-target-[+module+]:
1205 [+ ELSE install +]
1206 install-target-[+module+]: installdirs
1207         @: $(MAKE); $(unstage)
1208         @r=`${PWD_COMMAND}`; export r; \
1209         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1210 IF raw_cxx +]
1211         $(RAW_CXX_TARGET_EXPORTS) \[+
1212 ELSE normal_cxx +]
1213         $(NORMAL_TARGET_EXPORTS) \[+
1214 ENDIF raw_cxx +]
1215         (cd $(TARGET_SUBDIR)/[+module+] && \
1216           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1217 [+ ENDIF no_install +]
1218 @endif target-[+module+]
1220 # Other targets (info, dvi, pdf, etc.)
1221 [+ FOR recursive_targets +]
1222 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1223 maybe-[+make_target+]-target-[+module+]:
1224 @if target-[+module+]
1225 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1226 [+ IF (match-value? = "missing" (get "make_target") ) +]
1227 # [+module+] doesn't support [+make_target+].
1228 [+make_target+]-target-[+module+]:
1229 [+ ELSE +]
1230 [+make_target+]-target-[+module+]: [+
1231   FOR depend +]\
1232     [+depend+]-target-[+module+] [+
1233   ENDFOR depend +]
1234         @: $(MAKE); $(unstage)
1235         @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1236         r=`${PWD_COMMAND}`; export r; \
1237         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
1238 IF raw_cxx +]
1239         $(RAW_CXX_TARGET_EXPORTS) \[+
1240 ELSE normal_cxx +]
1241         $(NORMAL_TARGET_EXPORTS) \[+
1242 ENDIF raw_cxx +]
1243         echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1244         for flag in $(EXTRA_TARGET_FLAGS); do \
1245           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1246         done; \
1247         (cd $(TARGET_SUBDIR)/[+module+] && \
1248           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1249                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1250                   "RANLIB=$${RANLIB}" \
1251                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
1252                   [+extra_make_flags+] [+make_target+]) \
1253           || exit 1
1254 [+ ENDIF +]
1255 @endif target-[+module+]
1256 [+ ENDFOR recursive_targets +]
1257 [+ ENDFOR target_modules +]
1259 # ----------
1260 # GCC module
1261 # ----------
1263 @if gcc-no-bootstrap
1264 .PHONY: cross
1265 cross: all-build all-gas all-ld
1266         @r=`${PWD_COMMAND}`; export r; \
1267         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1268         $(HOST_EXPORTS) \
1269         echo "Building the C and C++ compiler"; \
1270         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1271         @r=`${PWD_COMMAND}`; export r; \
1272         s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1273         echo "Building runtime libraries"; \
1274         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1275 @endif gcc-no-bootstrap
1277 @if gcc
1278 [+ FOR languages +]
1279 .PHONY: check-gcc-[+language+] check-[+language+]
1280 check-gcc-[+language+]:
1281         r=`${PWD_COMMAND}`; export r; \
1282         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1283         $(HOST_EXPORTS) \
1284         (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]);
1285 check-[+language+]: check-gcc-[+language+][+ IF lib-check-target +] [+ lib-check-target +][+ ENDIF lib-check-target +]
1286 [+ ENDFOR languages +]
1288 # Install the gcc headers files, but not the fixed include files,
1289 # which Cygnus is not allowed to distribute.  This rule is very
1290 # dependent on the workings of the gcc Makefile.in.
1291 .PHONY: gcc-no-fixedincludes
1292 gcc-no-fixedincludes:
1293         @if [ -f ./gcc/Makefile ]; then \
1294           rm -rf gcc/tmp-include; \
1295           mv gcc/include gcc/tmp-include 2>/dev/null; \
1296           mkdir gcc/include; \
1297           cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1298           touch gcc/stmp-fixinc gcc/include/fixed; \
1299           rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1300           r=`${PWD_COMMAND}`; export r; \
1301           s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1302           $(HOST_EXPORTS) \
1303           (cd ./gcc && \
1304            $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1305           rm -rf gcc/include; \
1306           mv gcc/tmp-include gcc/include 2>/dev/null; \
1307         else true; fi
1308 @endif gcc
1310 # ---------------------
1311 # GCC bootstrap support
1312 # ---------------------
1314 # We track the current stage (the one in 'gcc') in the stage_current file.
1315 # stage_last instead tracks the stage that was built last.  These targets
1316 # are dummy when toplevel bootstrap is not active.
1318 # While making host and target tools, symlinks to the final stage must be
1319 # there, so $(unstage) should be run at various points.  To avoid excessive
1320 # recursive invocations of make, we "inline" them using a variable.  These
1321 # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1322 # to avoid warnings from the GNU Make job server.
1324 unstage = :
1325 stage = :
1326 current_stage = ""
1328 @if gcc-bootstrap
1329 unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
1330 stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
1331 current_stage = "`cat stage_current 2> /dev/null`"
1332 @endif gcc-bootstrap
1334 .PHONY: unstage stage
1335 unstage:
1336         @: $(MAKE); $(unstage)
1337 stage:
1338         @: $(MAKE); $(stage)
1340 # Disable commands for lean bootstrap.
1341 LEAN = false
1343 # We name the build directories for the various stages "stage1-gcc",
1344 # "stage2-gcc","stage3-gcc", etc.
1346 # Since the 'compare' process will fail (on debugging information) if any
1347 # directory names are different, we need to link the gcc directory for
1348 # the previous stage to a constant name ('prev-gcc'), and to make the name of
1349 # the build directories constant as well. For the latter, we use naked names
1350 # like 'gcc', because the scripts in that directory assume it.  We use
1351 # mv on platforms where symlinks to directories do not work or are not
1352 # reliable.
1354 # 'touch' doesn't work right on some platforms.
1355 STAMP = echo timestamp > 
1357 # We only want to compare .o files, so set this!
1358 objext = .o
1360 [+ FOR bootstrap-stage +]
1361 .PHONY: stage[+id+]-start stage[+id+]-end
1363 stage[+id+]-start::
1364         @: $(MAKE); $(stage); \
1365         echo stage[+id+] > stage_current ; \
1366         echo stage[+id+] > stage_last; \
1367         $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
1368    FOR host_modules +][+ IF bootstrap +]
1369 @if [+ module +]
1370         @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1371           mkdir stage[+id+]-[+module+]; \
1372         mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1373         mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
1374 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1375         @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1376           mkdir stage[+id+]-$(TARGET_SUBDIR); \
1377         mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1378         mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
1380 stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
1381 @if [+ module +]
1382         @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1383           cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1384           mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
1385         fi
1386 @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1387         @if test -d $(TARGET_SUBDIR) ; then \
1388           mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1389           mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
1390         fi
1391         rm -f stage_current
1393 # Bubble a bug fix through all the stages up to stage [+id+].  They are
1394 # remade, but not reconfigured.  The next stage (if any) will not be
1395 # reconfigured either.
1396 .PHONY: stage[+id+]-bubble
1397 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1398         @r=`${PWD_COMMAND}`; export r; \
1399         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1400         if test -f stage[+id+]-lean [+
1401           IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1402           echo Skipping rebuild of stage[+id+] ; \
1403         else \
1404           $(MAKE) stage[+id+]-start; \[+IF lean +]
1405           if $(LEAN); then \
1406             rm -rf stage[+lean+]-* ; \
1407             $(STAMP) stage[+lean+]-lean ; \
1408           fi; \[+ ENDIF lean +]
1409           $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
1410         fi[+ IF compare-target +]
1411         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
1413 .PHONY: all-stage[+id+] clean-stage[+id+]
1414 do-clean: clean-stage[+id+]
1416 # FIXME: Will not need to be conditional when toplevel bootstrap is the
1417 # only possibility, but now it conflicts with no-bootstrap rules
1418 @if gcc-bootstrap
1419 [+ IF compare-target +]
1420 [+compare-target+]:
1421         @r=`${PWD_COMMAND}`; export r; \
1422         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1423         if test -f stage[+prev+]-lean; then \
1424           echo Cannot compare object files as stage [+prev+] was deleted. ; \
1425           exit 0 ; \
1426         fi; \
1427         : $(MAKE); $(stage); \
1428         rm -f .bad_compare ; \
1429         echo Comparing stages [+prev+] and [+id+] ; \
1430         sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \
1431         files=`find stage[+id+]-* -name "*$(objext)" -print | \
1432                  sed -n s,^stage$$sed-,,p` ; \
1433         for file in $${files} ; do \
1434           f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \
1435           if test ! -f $$f1; then continue; fi; \
1436           $(do-[+compare-target+]) > /dev/null 2>&1; \
1437           if test $$? -eq 1; then \
1438             case $$file in \
1439               gcc/cc*-checksum$(objext) | ./libgcc/* | ./gcc/ada/*tools/*) \
1440                 echo warning: $$file differs ;; \
1441               *) \
1442                 echo $$file differs >> .bad_compare ;; \
1443             esac ; \
1444           fi ; \
1445         done ; \
1446         if [ -f .bad_compare ]; then \
1447           echo "Bootstrap comparison failure!"; \
1448           cat .bad_compare; \
1449           exit 1; \
1450         else \
1451           echo Comparison successful.; \
1452         fi ; \
1453         $(STAMP) [+compare-target+][+ IF prev +]
1454         if $(LEAN); then \
1455           rm -rf stage[+prev+]-*; \
1456           $(STAMP) stage[+prev+]-lean; \
1457         fi[+ ENDIF prev +]
1458 [+ ENDIF compare-target +]
1460 [+ IF bootstrap-target +]
1461 .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
1462 [+bootstrap-target+]:
1463         echo stage[+id+] > stage_final
1464         @r=`${PWD_COMMAND}`; export r; \
1465         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1466         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1467         @: $(MAKE); $(unstage)
1468         @r=`${PWD_COMMAND}`; export r; \
1469         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1470         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1471         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1473 [+bootstrap-target+]-lean:
1474         echo stage[+id+] > stage_final
1475         @r=`${PWD_COMMAND}`; export r; \
1476         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1477         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1478         @: $(MAKE); $(unstage)
1479         @r=`${PWD_COMMAND}`; export r; \
1480         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1481         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1482         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1483 [+ ENDIF bootstrap-target +]
1485 # Rules to wipe a stage and all the following ones, also used for cleanstrap
1486 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1487 .PHONY: distclean-stage[+id+]
1488 distclean-stage[+id+]::
1489         @: $(MAKE); $(stage)
1490         @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
1491         rm -rf stage[+id+]-* [+
1492           IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1494 [+ IF cleanstrap-target +]
1495 .PHONY: [+cleanstrap-target+]
1496 [+cleanstrap-target+]: do-distclean local-clean
1497         echo stage[+id+] > stage_final
1498         @r=`${PWD_COMMAND}`; export r; \
1499         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1500         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1501         @: $(MAKE); $(unstage)
1502         @r=`${PWD_COMMAND}`; export r; \
1503         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1504         TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
1505         $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
1506 [+ ENDIF cleanstrap-target +]
1507 @endif gcc-bootstrap
1509 [+ ENDFOR bootstrap-stage +]
1511 stageprofile-end::
1512         $(MAKE) distclean-stagefeedback
1514 stagefeedback-start::
1515         @r=`${PWD_COMMAND}`; export r; \
1516         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1517         for i in prev-*; do \
1518           j=`echo $$i | sed s/^prev-//` ; \
1519           cd $$r/$$i && \
1520           { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1521           { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1522         done
1524 @if gcc-bootstrap
1525 do-distclean: distclean-stage1
1527 # Provide a GCC build when we're building target libraries.  This does
1528 # not work as a dependency, just as the minimum necessary to avoid errors.
1529 stage_last:
1530         @r=`${PWD_COMMAND}`; export r; \
1531         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1532         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
1534 # Same as unstage, but not phony and defaulting to stage1-start.  We place
1535 # it in the dependency so that for example `make -j3 all-gcc' works.
1536 stage_current:
1537         @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1539 .PHONY: restrap
1540 restrap::
1541         @: $(MAKE); $(stage)
1542         rm -rf stage1-$(TARGET_SUBDIR)[+ FOR bootstrap-stage +][+ IF prev
1543           +] stage[+id+]-*[+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1544 restrap:: all
1545 @endif gcc-bootstrap
1547 # --------------------------------------
1548 # Dependencies between different modules
1549 # --------------------------------------
1551 # Generic dependencies for target modules on host stuff, especially gcc
1552 @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1553   +][+ FOR bootstrap_stage +]
1554 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1555   ENDFOR +][+ ELSE bootstrap +]
1556 configure-target-[+module+]: stage_last[+
1557   ENDIF bootstrap +][+ ENDFOR target_modules +]
1558 @endif gcc-bootstrap
1560 @if gcc-no-bootstrap[+ FOR target_modules +]
1561 configure-target-[+module+]: maybe-all-gcc[+
1562   ENDFOR target_modules +]
1563 @endif gcc-no-bootstrap
1566 # There are two types of dependencies here: 'hard' dependencies, where one
1567 # module simply won't build without the other; and 'soft' dependencies, where
1568 # if the depended-on module is missing, the depending module will do without
1569 # or find a substitute somewhere (perhaps installed).  Soft dependencies
1570 # are made here to depend on a 'maybe-' target.  If you're not sure,
1571 # it's safer to use a soft dependency.
1573 [+ ;; These Scheme functions build the bulk of the dependencies.
1574    ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1575    ;; where "maybe-" is only included if HARD is not true, and all-gcc
1576    ;; is taken from VAR-NAME.
1577    (define dep-target (lambda (module-kind var-name hard)
1578       (string-append
1579          (if hard "" "maybe-")
1580          (dep-subtarget var-name)
1581          module-kind
1582          (dep-module var-name)
1583       )))
1585    ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
1586    (define make-dep (lambda (module-kind on-kind)
1587       (string-append
1588          (dep-target module-kind "module" #t) ": "
1589          (dep-target on-kind "on" (exist? "hard")))))
1591    ;; dep-subtarget extracts everything up to the first dash in the given
1592    ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1593    (define dep-subtarget (lambda (var-name)
1594       (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1596    ;; dep-module extracts everything up to the first dash in the given
1597    ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1598    (define dep-module (lambda (var-name)
1599       (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1601    ;; dep-stage builds a string for the prefix of a bootstrap stage.
1602    (define dep-stage (lambda ()
1603       (string-append
1604          "stage"
1605          (get "id")
1606          "-")))
1608    ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1609    ;; but is written in Scheme.
1610    (define dep-maybe (lambda ()
1611       (if (exist? "hard") "" "maybe-")))
1613    ;; dep-kind returns "normal" if the dependency is on an "install" target,
1614    ;; or if either module is not bootstrapped.  It returns "bootstrap" for
1615    ;; configure or build dependencies between bootstrapped modules; it returns
1616    ;; "prebootstrap" for configure or build dependencies of bootstrapped
1617    ;; modules on a build module (e.g. all-gcc on all-build-bison).  All this
1618    ;; is only necessary for host modules.
1619    (define dep-kind (lambda ()
1620       (if (and (hash-ref boot-modules (dep-module "module"))
1621                (=* (dep-module "on") "build-"))
1622           "prebootstrap"
1624           (if (or (= (dep-subtarget "on") "install-")
1625                   (not (hash-ref boot-modules (dep-module "module")))
1626                   (not (hash-ref boot-modules (dep-module "on"))))
1627               "normal"
1628               "bootstrap"))))
1630    ;; We now build the hash table that is used by dep-kind.
1631    (define boot-modules (make-hash-table 113))
1634 [+ FOR host_modules +][+
1635    (if (exist? "bootstrap")
1636        (hash-create-handle! boot-modules (get "module") #t))
1637    "" +][+ ENDFOR host_modules +]
1638 [+ FOR target_modules +][+
1639    (if (exist? "bootstrap")
1640        (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1641    "" +][+ ENDFOR target_modules +]
1643 # With all the machinery above in place, it is pretty easy to generate
1644 # dependencies.  Host dependencies are a bit more complex because we have
1645 # to check for bootstrap/prebootstrap dependencies.  To resolve
1646 # prebootstrap dependencies, prebootstrap modules are gathered in
1647 # a hash table.
1648 [+ FOR dependencies +][+ (make-dep "" "") +]
1649 [+ CASE (dep-kind) +]
1650 [+ == "prebootstrap"
1651      +][+ FOR bootstrap_stage +]
1652 [+ (make-dep (dep-stage) "") +][+
1653        ENDFOR bootstrap_stage +]
1654 [+ == "bootstrap"
1655      +][+ FOR bootstrap_stage +]
1656 [+ (make-dep (dep-stage) (dep-stage)) +][+
1657        ENDFOR bootstrap_stage +]
1658 [+ ESAC +][+
1659 ENDFOR dependencies +]
1661 # Dependencies for target modules on other target modules are
1662 # described by lang_env_dependencies; the defaults apply to anything
1663 # not mentioned there.
1665    ;; Predicate for whether LANG was specified in lang_env_dependencies.
1666    (define lang-dep (lambda (lang)
1667       (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1669    ;; Build the hash table we will need.
1670    (define lang-env-deps (make-hash-table 7))
1671 +][+ FOR lang_env_dependencies +][+
1672    (if (exist? "cxx")
1673        (hash-create-handle! lang-env-deps
1674           (string-append (get "module") "-" "cxx") #t))
1676    (if (exist? "no_c")
1677        (hash-create-handle! lang-env-deps
1678           (string-append (get "module") "-" "no_c") #t))
1680    (if (exist? "no_gcc")
1681        (hash-create-handle! lang-env-deps
1682           (string-append (get "module") "-" "no_gcc") #t))
1683    "" +][+ ENDFOR lang_env_dependencies +]
1685 @if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1686   +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1687 configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1688   ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1689 @endif gcc-bootstrap
1691 @if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1692 configure-target-[+module+]: maybe-all-target-libgcc[+
1693   ENDIF +][+ ENDFOR target_modules +]
1694 @endif gcc-no-bootstrap
1696 [+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1697 configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1698   ENDIF +][+ IF (lang-dep "cxx") +]
1699 configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1700   ENDIF +]
1701 [+ ENDFOR target_modules +]
1703 CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
1704 GDB_TK = @GDB_TK@
1705 INSTALL_GDB_TK = @INSTALL_GDB_TK@
1706 configure-gdb: $(CONFIGURE_GDB_TK)
1707 all-gdb: $(gdbnlmrequirements) $(GDB_TK)
1708 install-gdb: $(INSTALL_GDB_TK)
1710 # Serialization dependencies.  Host configures don't work well in parallel to
1711 # each other, due to contention over config.cache.  Target configures and 
1712 # build configures are similar.
1713 @serialization_dependencies@
1715 # --------------------------------
1716 # Regenerating top level configury
1717 # --------------------------------
1719 # Rebuilding Makefile.in, using autogen.
1720 AUTOGEN = autogen
1721 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1722         cd $(srcdir) && $(AUTOGEN) Makefile.def
1724 # Rebuilding Makefile.
1725 Makefile: $(srcdir)/Makefile.in config.status
1726         CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1728 config.status: configure
1729         CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
1731 # Rebuilding configure.
1732 AUTOCONF = autoconf
1733 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
1734         $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4
1735         cd $(srcdir) && $(AUTOCONF)
1737 # ------------------------------
1738 # Special directives to GNU Make
1739 # ------------------------------
1741 # Don't pass command-line variables to submakes.
1742 .NOEXPORT:
1743 MAKEOVERRIDES=
1745 # end of Makefile.in