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