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