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