* Makefile.def (host_modules): Set bootstrap=true for flex.
[external/binutils.git] / Makefile.tpl
1 [+ AutoGen5 template -*- Mode: Makefile -*-
2 in
3 +]
4
5 # Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
6 #
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 Free Software Foundation
10 #
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #
25
26 # -------------------------------
27 # Standard Autoconf-set variables
28 # -------------------------------
29 VPATH=@srcdir@
30
31 build_alias=@build_alias@
32 build=@build@
33 host_alias=@host_alias@
34 host=@host@
35 target_alias=@target_alias@
36 target=@target@
37
38 program_transform_name = @program_transform_name@
39
40 prefix = @prefix@
41 exec_prefix = @exec_prefix@
42
43 srcdir = @srcdir@
44
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
66
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@
73
74 # -------------------------------------------------
75 # Miscellaneous non-standard autoconf-set variables
76 # -------------------------------------------------
77
78 # The file containing GCC's version number.
79 gcc_version_trigger = @gcc_version_trigger@
80 gcc_version = @gcc_version@
81
82 # The gcc driver likes to know the arguments it was configured with.
83 TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
84
85 gxx_include_dir = @gxx_include_dir@
86 libstdcxx_incdir = @libstdcxx_incdir@
87
88 tooldir = @tooldir@
89 build_tooldir = @build_tooldir@
90
91 # Directory in which the compiler finds executables, libraries, etc.
92 libsubdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)
93 GDB_NLM_DEPS = 
94
95 # This is the name of the environment variable used for the path to
96 # the libraries.
97 RPATH_ENVVAR = @RPATH_ENVVAR@
98
99 # This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
100 # was used.
101 SET_LIB_PATH = @SET_LIB_PATH@
102
103 # configure.in sets SET_LIB_PATH to this if --enable-shared was used.
104 # Some platforms don't like blank entries, so we remove duplicate,
105 # leading and trailing colons.
106 REALLY_SET_LIB_PATH = \
107   $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
108
109 # This is the list of directories to be built for the build system.
110 BUILD_CONFIGDIRS = libiberty libbanshee
111 # Build programs are put under this directory.
112 BUILD_SUBDIR = @build_subdir@
113 # This is set by the configure script to the arguments to use when configuring
114 # directories built for the build system.
115 BUILD_CONFIGARGS = @build_configargs@
116
117 # This is the list of variables to export in the environment when
118 # configuring any subdirectory.  It must also be exported whenever
119 # recursing into a build directory in case that directory's Makefile
120 # re-runs configure.
121 BASE_EXPORTS = \
122         FLEX="$(FLEX)"; export FLEX; \
123         LEX="$(LEX)"; export LEX; \
124         BISON="$(BISON)"; export BISON; \
125         YACC="$(YACC)"; export YACC; \
126         M4="$(M4)"; export M4; \
127         MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
128
129 # This is the list of variables to export in the environment when
130 # configuring subdirectories for the build system.
131 BUILD_EXPORTS = \
132         $(BASE_EXPORTS) \
133         AR="$(AR_FOR_BUILD)"; export AR; \
134         AS="$(AS_FOR_BUILD)"; export AS; \
135         CC="$(CC_FOR_BUILD)"; export CC; \
136         CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
137         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
138         CXX="$(CXX_FOR_BUILD)"; export CXX; \
139         CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
140         GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
141         GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
142         DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
143         LD="$(LD_FOR_BUILD)"; export LD; \
144         LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
145         NM="$(NM_FOR_BUILD)"; export NM; \
146         RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
147         WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES;
148
149 # This is the list of directories to built for the host system.
150 SUBDIRS = @configdirs@
151 # This is set by the configure script to the arguments to use when configuring
152 # directories built for the host system.
153 HOST_CONFIGARGS = @host_configargs@
154 # This is the list of variables to export in the environment when
155 # configuring subdirectories for the host system.
156 HOST_EXPORTS = \
157         $(BASE_EXPORTS) \
158         CC="$(CC)"; export CC; \
159         CFLAGS="$(CFLAGS)"; export CFLAGS; \
160         CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
161         CXX="$(CXX)"; export CXX; \
162         CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
163         AR="$(AR)"; export AR; \
164         AS="$(AS)"; export AS; \
165         CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
166         DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
167         LD="$(LD)"; export LD; \
168         LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
169         NM="$(NM)"; export NM; \
170         RANLIB="$(RANLIB)"; export RANLIB; \
171         WINDRES="$(WINDRES)"; export WINDRES; \
172         OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
173         OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
174         TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
175         GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
176         GMPINC="$(HOST_GMPINC)"; export GMPINC;
177
178 # Similar, for later GCC stages.
179 STAGE_HOST_EXPORTS = \
180         $(HOST_EXPORTS) \
181         CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
182         CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC_FOR_BUILD;
183
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@
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="$(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="$(CFLAGS_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="$(LD_FOR_TARGET)"; export LD; \
207         LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
208         NM="$(NM_FOR_TARGET)"; export NM; \
209         RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
210         WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES;
211
212 RAW_CXX_TARGET_EXPORTS = \
213         $(BASE_TARGET_EXPORTS) \
214         CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
215         CXX="$(RAW_CXX_FOR_TARGET)"; export CXX;
216
217 NORMAL_TARGET_EXPORTS = \
218         $(BASE_TARGET_EXPORTS) \
219         CXX="$(CXX_FOR_TARGET)"; export CXX;
220
221 # Where to find GMP
222 HOST_GMPLIBS = @gmplibs@
223 HOST_GMPINC = @gmpinc@
224
225 # ----------------------------------------------
226 # Programs producing files for the BUILD machine
227 # ----------------------------------------------
228
229 SHELL = @config_shell@
230
231 # pwd command to use.  Allow user to override default by setting PWDCMD in
232 # the environment to account for automounters.  The make variable must not
233 # be called PWDCMD, otherwise the value set here is passed to make
234 # subprocesses and overrides the setting from the user's environment.
235 # Don't use PWD since it is a common shell environment variable and we
236 # don't want to corrupt it.
237 PWD_COMMAND = $${PWDCMD-pwd}
238
239 # compilers to use to create programs which must be run in the build
240 # environment.
241 CC_FOR_BUILD = @CC_FOR_BUILD@
242 CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
243
244 CXX_FOR_BUILD = $(CXX)
245
246 # Path to the build directory for a Canadian cross, empty otherwise.
247 BUILD_DIR_PREFIX = @BUILD_DIR_PREFIX@
248
249 # Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
250 # here so that they can be overridden by Makefile fragments.
251 BUILD_PREFIX = @BUILD_PREFIX@
252 BUILD_PREFIX_1 = @BUILD_PREFIX_1@
253
254 CONFIGURED_BISON = @CONFIGURED_BISON@
255 BISON = `if [ -f $$r/$(BUILD_DIR_PREFIX)/bison/bison ] ; then \
256             echo $$r/$(BUILD_DIR_PREFIX)/bison/bison -L $$s/bison/ ; \
257          else \
258             echo ${CONFIGURED_BISON} ; \
259          fi`
260
261 CONFIGURED_YACC = @CONFIGURED_YACC@
262 YACC = `if [ -f $$s/$(BUILD_DIR_PREFIX)/bison/bison ] ; then \
263             echo $$r/$(BUILD_DIR_PREFIX)/bison/bison -y -L $$s/bison/ ; \
264         elif [ -f $$s/$(BUILD_DIR_PREFIX)/byacc/byacc ] ; then \
265             echo $$r/$(BUILD_DIR_PREFIX)/byacc/byacc ; \
266         else \
267             echo ${CONFIGURED_YACC} ; \
268         fi`
269
270 CONFIGURED_FLEX = @CONFIGURED_FLEX@
271 FLEX = `if [ -f $$r/$(BUILD_DIR_PREFIX)/flex/flex ] ; \
272         then echo $$r/$(BUILD_DIR_PREFIX)/flex/flex ; \
273         else echo ${CONFIGURED_FLEX} ; fi`
274
275 CONFIGURED_LEX = @CONFIGURED_LEX@
276 LEX = `if [ -f $$r/$(BUILD_DIR_PREFIX)/flex/flex ] ; \
277         then echo $$r/$(BUILD_DIR_PREFIX)/flex/flex ; \
278         else echo ${CONFIGURED_LEX} ; fi`
279
280 CONFIGURED_M4 = @CONFIGURED_M4@
281 M4 = `if [ -f $$r/$(BUILD_DIR_PREFIX)/m4/m4 ] ; \
282         then echo $$r/$(BUILD_DIR_PREFIX)/m4/m4 ; \
283         else echo ${CONFIGURED_M4} ; fi`
284
285 # For an installed makeinfo, we require it to be from texinfo 4.2 or
286 # higher, else we use the "missing" dummy.  We also pass the subdirectory
287 # makeinfo even if only the Makefile is there, because Texinfo builds its
288 # manual when made, and it requires its own version.
289 CONFIGURED_MAKEINFO = @CONFIGURED_MAKEINFO@
290 MAKEINFO = `if [ -f $$r/$(BUILD_DIR_PREFIX)/texinfo/makeinfo/Makefile ] ; \
291         then echo $$r/$(BUILD_DIR_PREFIX)/texinfo/makeinfo/makeinfo ; \
292         else if (${CONFIGURED_MAKEINFO} --version \
293           | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])') >/dev/null 2>&1; \
294         then echo ${CONFIGURED_MAKEINFO}; else echo $$s/missing makeinfo; fi; fi`
295
296 # This just becomes part of the MAKEINFO definition passed down to
297 # sub-makes.  It lets flags be given on the command line while still
298 # using the makeinfo from the object tree.
299 # (Default to avoid splitting info files by setting the threshold high.)
300 MAKEINFOFLAGS = --split-size=5000000
301
302 EXPECT = `if [ -f $$r/expect/expect ] ; \
303         then echo $$r/expect/expect ; \
304         else echo expect ; fi`
305
306 RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \
307         then echo $$s/dejagnu/runtest ; \
308         else echo runtest ; fi`
309
310 # ---------------------------------------------
311 # Programs producing files for the HOST machine
312 # ---------------------------------------------
313
314 # This is the list of directories that may be needed in RPATH_ENVVAR
315 # so that programs built for the host machine work.
316 HOST_LIB_PATH = $$r/bfd:$$r/opcodes
317
318 AS = @AS@
319
320 AR = @AR@
321 AR_FLAGS = rc
322
323 CC = @CC@
324 CFLAGS = @CFLAGS@
325 LIBCFLAGS = $(CFLAGS)
326
327 CXX = @CXX@
328 CXXFLAGS = @CXXFLAGS@
329 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
330
331 DLLTOOL = @DLLTOOL@
332
333 NM = @NM@
334
335 LD = @LD@
336 LDFLAGS = 
337
338 RANLIB = @RANLIB@
339
340 WINDRES = @WINDRES@
341
342 PICFLAG = 
343
344 # -----------------------------------------------
345 # Programs producing files for the TARGET machine
346 # -----------------------------------------------
347
348 # This is the list of directories that may be needed in RPATH_ENVVAR
349 # so that prorgams built for the target machine work.
350 TARGET_LIB_PATH = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:$$r/$(TARGET_SUBDIR)/libmudflap/.libs
351
352 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
353
354 AR_FOR_TARGET=@AR_FOR_TARGET@
355 CONFIGURED_AR_FOR_TARGET=@CONFIGURED_AR_FOR_TARGET@
356 USUAL_AR_FOR_TARGET = ` \
357   if [ -f $$r/binutils/ar ] ; then \
358     echo $$r/binutils/ar ; \
359   else \
360     if [ '$(host)' = '$(target)' ] ; then \
361       echo $(AR); \
362     else \
363       echo $(CONFIGURED_AR_FOR_TARGET) ; \
364     fi; \
365   fi`
366
367 AS_FOR_TARGET=@AS_FOR_TARGET@
368 CONFIGURED_AS_FOR_TARGET=@CONFIGURED_AS_FOR_TARGET@
369 USUAL_AS_FOR_TARGET = ` \
370   if [ -f $$r/gas/as-new ] ; then \
371     echo $$r/gas/as-new ; \
372   elif [ -f $$r/gcc/xgcc ]; then \
373     $(CC_FOR_TARGET) -print-prog-name=as ; \
374   else \
375     if [ '$(host)' = '$(target)' ] ; then \
376       echo $(AS); \
377     else \
378       echo $(CONFIGURED_AS_FOR_TARGET) ; \
379     fi; \
380   fi`
381
382 CC_FOR_TARGET = @CC_FOR_TARGET@
383 # During gcc bootstrap, if we use some random cc for stage1 then
384 # CFLAGS will be just -g.  We want to ensure that TARGET libraries
385 # (which we know are built with gcc) are built with optimizations so
386 # prepend -O2 when setting CFLAGS_FOR_TARGET.
387 CFLAGS_FOR_TARGET = -O2 $(CFLAGS)
388 # If GCC_FOR_TARGET is not overriden on the command line, then this
389 # variable is passed down to the gcc Makefile, where it is used to
390 # build libgcc2.a.  We define it here so that it can itself be
391 # overridden on the command line.
392 GCC_FOR_TARGET=@GCC_FOR_TARGET@
393 USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET)
394 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
395
396 CXX_FOR_TARGET = @CXX_FOR_TARGET@
397 RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
398 CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
399 RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
400 CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
401 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
402
403 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
404 CONFIGURED_DLLTOOL_FOR_TARGET=@CONFIGURED_DLLTOOL_FOR_TARGET@
405 USUAL_DLLTOOL_FOR_TARGET = ` \
406   if [ -f $$r/binutils/dlltool ] ; then \
407     echo $$r/binutils/dlltool ; \
408   else \
409     if [ '$(host)' = '$(target)' ] ; then \
410       echo $(DLLTOOL); \
411     else \
412       echo $(CONFIGURED_DLLTOOL_FOR_TARGET) ; \
413     fi; \
414   fi`
415
416 GCJ_FOR_TARGET = @GCJ_FOR_TARGET@
417 GFORTRAN_FOR_TARGET = @GFORTRAN_FOR_TARGET@
418
419 LD_FOR_TARGET=@LD_FOR_TARGET@
420 CONFIGURED_LD_FOR_TARGET=@CONFIGURED_LD_FOR_TARGET@
421 USUAL_LD_FOR_TARGET = ` \
422   if [ -f $$r/ld/ld-new ] ; then \
423     echo $$r/ld/ld-new ; \
424   elif [ -f $$r/gcc/xgcc ]; then \
425     $(CC_FOR_TARGET) -print-prog-name=ld ; \
426   else \
427     if [ '$(host)' = '$(target)' ] ; then \
428       echo $(LD); \
429     else \
430       echo $(CONFIGURED_LD_FOR_TARGET) ; \
431     fi; \
432   fi`
433
434 LDFLAGS_FOR_TARGET = 
435
436 NM_FOR_TARGET=@NM_FOR_TARGET@
437 CONFIGURED_NM_FOR_TARGET=@CONFIGURED_NM_FOR_TARGET@
438 USUAL_NM_FOR_TARGET = ` \
439   if [ -f $$r/binutils/nm-new ] ; then \
440     echo $$r/binutils/nm-new ; \
441   elif [ -f $$r/gcc/xgcc ]; then \
442     $(CC_FOR_TARGET) -print-prog-name=nm ; \
443   else \
444     if [ '$(host)' = '$(target)' ] ; then \
445       echo $(NM); \
446     else \
447       echo $(CONFIGURED_NM_FOR_TARGET) ; \
448     fi; \
449   fi`
450
451 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
452 CONFIGURED_RANLIB_FOR_TARGET=@CONFIGURED_RANLIB_FOR_TARGET@
453 USUAL_RANLIB_FOR_TARGET = ` \
454   if [ -f $$r/binutils/ranlib ] ; then \
455     echo $$r/binutils/ranlib ; \
456   else \
457     if [ '$(host)' = '$(target)' ] ; then \
458       if [ x'$(RANLIB)' != x ]; then \
459          echo $(RANLIB); \
460       else \
461          echo ranlib; \
462       fi; \
463     else \
464       echo $(CONFIGURED_RANLIB_FOR_TARGET) ; \
465     fi; \
466   fi`
467
468 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
469 CONFIGURED_WINDRES_FOR_TARGET=@CONFIGURED_WINDRES_FOR_TARGET@
470 USUAL_WINDRES_FOR_TARGET = ` \
471   if [ -f $$r/binutils/windres ] ; then \
472     echo $$r/binutils/windres ; \
473   else \
474     if [ '$(host)' = '$(target)' ] ; then \
475       echo $(WINDRES); \
476     else \
477       echo $(CONFIGURED_WINDRES_FOR_TARGET) ; \
478     fi; \
479   fi`
480
481 PICFLAG_FOR_TARGET = 
482
483 # ------------------------------------
484 # Miscellaneous targets and flag lists
485 # ------------------------------------
486
487 # The first rule in the file had better be this one.  Don't put any above it.
488 # This lives here to allow makefile fragments to contain dependencies.
489 @default_target@:
490
491 #### host and target specific makefile fragments come in here.
492 @target_makefile_frag@
493 @alphaieee_frag@
494 @ospace_frag@
495 @host_makefile_frag@
496 ###
497
498 # Flags to pass down to all sub-makes.
499 BASE_FLAGS_TO_PASS = [+ FOR flags_to_pass +]\
500         "[+flag+]=$([+flag+])" [+ ENDFOR flags_to_pass +]\
501         "CONFIG_SHELL=$(SHELL)" \
502         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" 
503
504 # For any flags above that may contain shell code that varies from one
505 # target library to another.  When doing recursive invocations of the
506 # top-level Makefile, we don't want the outer make to evaluate them,
507 # so we pass these variables down unchanged.  They must not contain
508 # single nor double quotes.
509 RECURSE_FLAGS = \
510         CXX_FOR_TARGET='$(CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \
511         RAW_CXX_FOR_TARGET='$(RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \
512
513 RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS)
514
515 # Flags to pass down to most sub-makes, in which we're building with
516 # the host environment.
517 EXTRA_HOST_FLAGS = \
518         'AR=$(AR)' \
519         'AS=$(AS)' \
520         'CC=$(CC)' \
521         'CXX=$(CXX)' \
522         'DLLTOOL=$(DLLTOOL)' \
523         'LD=$(LD)' \
524         'NM=$(NM)' \
525         'RANLIB=$(RANLIB)' \
526         'WINDRES=$(WINDRES)'
527
528 FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
529
530 # Flags that are concerned with the location of the X11 include files
531 # and library files
532 #
533 # NOTE: until the top-level is getting the values via autoconf, it only
534 # causes problems to have this top-level Makefile overriding the autoconf-set
535 # values in child directories.  Only variables that don't conflict with
536 # autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
537 #
538 X11_FLAGS_TO_PASS = \
539         'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
540         'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
541
542 # Flags to pass down to makes which are built with the target environment.
543 # The double $ decreases the length of the command line; the variables
544 # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.
545 EXTRA_TARGET_FLAGS = \
546         'AR=$$(AR_FOR_TARGET)' \
547         'AS=$$(AS_FOR_TARGET)' \
548         'CC=$$(CC_FOR_TARGET)' \
549         'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
550         'CXX=$$(CXX_FOR_TARGET)' \
551         'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
552         'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
553         'LD=$$(LD_FOR_TARGET)' \
554         'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
555         'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
556         'NM=$$(NM_FOR_TARGET)' \
557         'RANLIB=$$(RANLIB_FOR_TARGET)' \
558         'WINDRES=$$(WINDRES_FOR_TARGET)'
559
560 TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
561
562 # Flags to pass down to gcc.  gcc builds a library, libgcc.a, so it
563 # unfortunately needs the native compiler and the target ar and
564 # ranlib.
565 # If any variables are added here, they must be added to do-*, below.
566 # The BUILD_* variables are a special case, which are used for the gcc
567 # cross-building scheme.
568 EXTRA_GCC_FLAGS = \
569         'BUILD_PREFIX=$(BUILD_PREFIX)' \
570         'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \
571         "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
572         "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
573         "`echo 'LANGUAGES=$(LANGUAGES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
574         "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
575         "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
576         "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
577         "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
578         "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
579         "`echo 'STAGE1_CFLAGS=$(STAGE1_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
580         "`echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
581         "`echo 'BOOT_ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
582
583 GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
584
585 .PHONY: configure-host
586 configure-host: maybe-configure-gcc [+
587   FOR host_modules +] \
588     maybe-configure-[+module+][+
589   ENDFOR host_modules +]
590 .PHONY: configure-target
591 configure-target: [+
592   FOR target_modules +] \
593     maybe-configure-target-[+module+][+
594   ENDFOR target_modules +]
595
596 # The target built for a native non-bootstrap build.
597 .PHONY: all
598 all: all-build all-host all-target
599
600 .PHONY: all-build
601 all-build: [+
602   FOR build_modules +] \
603     maybe-all-build-[+module+][+
604   ENDFOR build_modules +]
605 .PHONY: all-host
606 all-host: maybe-all-gcc [+
607   FOR host_modules +] \
608     maybe-all-[+module+][+
609   ENDFOR host_modules +]
610 .PHONY: all-target
611 all-target: [+
612   FOR target_modules +] \
613     maybe-all-target-[+module+][+
614   ENDFOR target_modules +]
615
616 # Do a target for all the subdirectories.  A ``make do-X'' will do a
617 # ``make X'' in all subdirectories (because, in general, there is a
618 # dependency (below) of X upon do-X, a ``make X'' will also do this,
619 # but it may do additional work as well).
620 [+ FOR recursive_targets +]
621 .PHONY: do-[+make_target+]
622 do-[+make_target+]: [+make_target+]-host [+make_target+]-target
623
624 .PHONY: [+make_target+]-host
625 [+make_target+]-host: maybe-[+make_target+]-gcc [+
626   FOR host_modules +] \
627     maybe-[+make_target+]-[+module+][+
628   ENDFOR host_modules +]
629
630 .PHONY: [+make_target+]-target
631 [+make_target+]-target: [+
632   FOR target_modules +] \
633     maybe-[+make_target+]-target-[+module+][+
634   ENDFOR target_modules +]
635 [+ ENDFOR recursive_targets +]
636
637 # Here are the targets which correspond to the do-X targets.
638
639 .PHONY: info installcheck dvi install-info
640 .PHONY: clean distclean mostlyclean maintainer-clean realclean
641 .PHONY: local-clean local-distclean local-maintainer-clean
642 info: do-info
643 installcheck: do-installcheck
644 dvi: do-dvi
645
646 # Make sure makeinfo is built before we do a `make info', if we're
647 # in fact building texinfo.
648 do-info: maybe-all-texinfo
649
650 install-info: do-install-info dir.info
651         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
652         if [ -f dir.info ] ; then \
653           $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
654         else true ; fi
655
656 local-clean:
657         -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
658
659 local-distclean:
660         -rm -f Makefile config.status config.cache mh-frag mt-frag
661         -rm -f multilib.out multilib.tmp maybedep.tmp serdep.tmp
662         -if [ "$(TARGET_SUBDIR)" != "." ]; then \
663           rm -rf $(TARGET_SUBDIR); \
664         else true; fi
665         -rm -rf $(BUILD_SUBDIR)
666         -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
667         -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
668         -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
669         -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
670         -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
671
672 local-maintainer-clean:
673         @echo "This command is intended for maintainers to use;"
674         @echo "it deletes files that may require special tools to rebuild."
675
676 clean: do-clean local-clean
677 mostlyclean: do-mostlyclean local-clean
678 distclean: do-distclean local-clean local-distclean
679 maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean 
680 maintainer-clean: local-distclean
681 realclean: maintainer-clean
682
683 # Extra dependency for clean-target, owing to the mixed nature of gcc
684 clean-target: clean-target-libgcc
685 clean-target-libgcc:
686         test ! -d gcc/libgcc || \
687         (cd gcc/libgcc && find . -type d -print) | \
688         while read d; do rm -f gcc/$$d/libgcc.a || : ; done
689         -rm -rf gcc/libgcc
690
691 # Check target.
692
693 .PHONY: check do-check
694 check: do-check
695
696 # Only include modules actually being configured and built.
697 do-check: maybe-check-gcc [+
698   FOR host_modules +] \
699     maybe-check-[+module+][+
700   ENDFOR host_modules +][+
701   FOR target_modules +] \
702     maybe-check-target-[+module+][+
703   ENDFOR target_modules +]
704
705 # Automated reporting of test results.
706
707 warning.log: build.log
708         $(srcdir)/contrib/warn_summary build.log > $@
709
710 mail-report.log:
711         if test x'$(BOOT_CFLAGS)' != x''; then \
712             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
713         fi; \
714         $(srcdir)/contrib/test_summary -t >$@
715         chmod +x $@
716         echo If you really want to send e-mail, run ./$@ now
717
718 mail-report-with-warnings.log: warning.log
719         if test x'$(BOOT_CFLAGS)' != x''; then \
720             BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
721         fi; \
722         $(srcdir)/contrib/test_summary -t -i warning.log >$@
723         chmod +x $@
724         echo If you really want to send e-mail, run ./$@ now
725
726 # Installation targets.
727
728 .PHONY: install uninstall
729 install: installdirs install-host install-target
730
731 .PHONY: install-host-nogcc
732 install-host-nogcc: [+
733   FOR host_modules +] \
734     maybe-install-[+module+][+
735   ENDFOR host_modules +]
736
737 .PHONY: install-host
738 install-host: maybe-install-gcc [+
739   FOR host_modules +] \
740     maybe-install-[+module+][+
741   ENDFOR host_modules +]
742
743 .PHONY: install-target
744 install-target: [+
745   FOR target_modules +] \
746     maybe-install-target-[+module+][+
747   ENDFOR target_modules +]
748
749 uninstall:
750         @echo "the uninstall target is not supported in this tree"
751
752 .PHONY: install.all
753 install.all: install-no-fixedincludes
754         @if [ -f ./gcc/Makefile ] ; then \
755                 r=`${PWD_COMMAND}` ; export r ; \
756                 $(SET_LIB_PATH) \
757                 $(HOST_EXPORTS) \
758                 (cd ./gcc && \
759                 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
760         else \
761                 true ; \
762         fi
763
764 # install-no-fixedincludes is used because Cygnus can not distribute
765 # the fixed header files.
766 .PHONY: install-no-fixedincludes
767 install-no-fixedincludes: installdirs install-host-nogcc \
768         install-target gcc-no-fixedincludes
769
770 ### other supporting targets
771
772 MAKEDIRS= \
773         $(DESTDIR)$(prefix) \
774         $(DESTDIR)$(exec_prefix)
775 .PHONY: installdirs
776 installdirs: mkinstalldirs
777         $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
778
779 dir.info: do-install-info
780         if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
781           $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
782           mv -f dir.info.new dir.info ; \
783         else true ; \
784         fi
785
786 dist:
787         @echo "Building a full distribution of this tree isn't done"
788         @echo "via 'make dist'.  Check out the etc/ subdirectory" 
789
790 etags tags: TAGS
791
792 # Right now this just builds TAGS in each subdirectory.  emacs19 has the
793 # ability to use several tags files at once, so there is probably no need
794 # to combine them into one big TAGS file (like CVS 1.3 does).  We could
795 # (if we felt like it) have this Makefile write a piece of elisp which
796 # the user could load to tell emacs19 where all the TAGS files we just
797 # built are.
798 TAGS: do-TAGS
799
800 # --------------------------------------
801 # Modules which run on the build machine
802 # --------------------------------------
803 [+ FOR build_modules +]
804 .PHONY: configure-build-[+module+] maybe-configure-build-[+module+]
805 maybe-configure-build-[+module+]:
806 @if build-[+module+]
807 maybe-configure-build-[+module+]: configure-build-[+module+]
808 configure-build-[+module+]:
809         @test ! -f $(BUILD_SUBDIR)/[+module+]/Makefile || exit 0; \
810         $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/[+module+] ; \
811         r=`${PWD_COMMAND}`; export r; \
812         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
813         $(BUILD_EXPORTS) \
814         echo Configuring in $(BUILD_SUBDIR)/[+module+]; \
815         cd "$(BUILD_SUBDIR)/[+module+]" || exit 1; \
816         case $(srcdir) in \
817           /* | [A-Za-z]:[\\/]*) \
818             topdir=$(srcdir) ;; \
819           *) \
820             case "$(BUILD_SUBDIR)" in \
821               .) topdir="../$(srcdir)" ;; \
822               *) topdir="../../$(srcdir)" ;; \
823             esac ;; \
824         esac; \
825         if [ "$(srcdir)" = "." ] ; then \
826           if [ "$(BUILD_SUBDIR)" != "." ] ; then \
827             if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \
828               if [ -f Makefile ]; then \
829                 if $(MAKE) distclean; then \
830                   true; \
831                 else \
832                   exit 1; \
833                 fi; \
834               else \
835                 true; \
836               fi; \
837             else \
838               exit 1; \
839             fi; \
840           else \
841             true; \
842           fi; \
843           srcdiroption="--srcdir=."; \
844           libsrcdir="."; \
845         else \
846           srcdiroption="--srcdir=$${topdir}/[+module+]"; \
847           libsrcdir="$$s/[+module+]"; \
848         fi; \
849         rm -f no-such-file || : ; \
850         CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
851           $(BUILD_CONFIGARGS) $${srcdiroption} \
852           --with-build-subdir="$(BUILD_SUBDIR)" [+extra_configure_flags+] \
853           || exit 1
854 @endif build-[+module+]
855
856 .PHONY: all-build-[+module+] maybe-all-build-[+module+]
857 maybe-all-build-[+module+]:
858 @if build-[+module+]
859 maybe-all-build-[+module+]: all-build-[+module+]
860 all-build-[+module+]: configure-build-[+module+]
861         @r=`${PWD_COMMAND}`; export r; \
862         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
863         $(BUILD_EXPORTS) \
864         (cd $(BUILD_SUBDIR)/[+module+] && $(MAKE) [+extra_make_flags+] all)
865 @endif build-[+module+]
866 [+ ENDFOR build_modules +]
867
868 # --------------------------------------
869 # Modules which run on the host machine
870 # --------------------------------------
871 [+ FOR host_modules +]
872 .PHONY: configure-[+module+] maybe-configure-[+module+]
873 maybe-configure-[+module+]:
874 @if [+module+]
875 maybe-configure-[+module+]: configure-[+module+]
876 configure-[+module+]:
877         @test ! -f [+module+]/Makefile || exit 0; \
878         [ -d [+module+] ] || mkdir [+module+]; \
879         r=`${PWD_COMMAND}`; export r; \
880         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
881         $(HOST_EXPORTS) \
882         echo Configuring in [+module+]; \
883         cd [+module+] || exit 1; \
884         case $(srcdir) in \
885           \.) \
886             srcdiroption="--srcdir=."; \
887             libsrcdir=".";; \
888           /* | [A-Za-z]:[\\/]*) \
889             srcdiroption="--srcdir=$(srcdir)/[+module+]"; \
890             libsrcdir="$$s/[+module+]";; \
891           *) \
892             srcdiroption="--srcdir=../$(srcdir)/[+module+]"; \
893             libsrcdir="$$s/[+module+]";; \
894         esac; \
895         $(SHELL) $${libsrcdir}/configure \
896           $(HOST_CONFIGARGS) $${srcdiroption} [+extra_configure_flags+] \
897           || exit 1
898 @endif [+module+]
899
900 .PHONY: all-[+module+] maybe-all-[+module+]
901 maybe-all-[+module+]:
902 @if [+module+]
903 maybe-all-[+module+]: all-[+module+]
904 all-[+module+]: configure-[+module+]
905         @r=`${PWD_COMMAND}`; export r; \
906         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
907         $(SET_LIB_PATH) \
908         $(HOST_EXPORTS) \
909         (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ 
910           IF with_x 
911             +] $(X11_FLAGS_TO_PASS)[+ 
912           ENDIF with_x +] [+extra_make_flags+] all)
913 @endif [+module+]
914
915 .PHONY: check-[+module+] maybe-check-[+module+]
916 maybe-check-[+module+]:
917 @if [+module+]
918 maybe-check-[+module+]: check-[+module+]
919 [+ IF no_check +]
920 check-[+module+]:
921 [+ ELIF no_check_cross +]
922 # This module is only tested in a native toolchain.
923 check-[+module+]:
924         @if [ '$(host)' = '$(target)' ] ; then \
925           r=`${PWD_COMMAND}`; export r; \
926           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
927           $(SET_LIB_PATH) \
928           $(HOST_EXPORTS) \
929           (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ 
930             IF with_x 
931               +] $(X11_FLAGS_TO_PASS)[+ 
932             ENDIF with_x +] [+extra_make_flags+] check); \
933         fi
934 [+ ELSE check +]
935 check-[+module+]:
936         @r=`${PWD_COMMAND}`; export r; \
937         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
938         $(SET_LIB_PATH) \
939         $(HOST_EXPORTS) \
940         (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ 
941           IF with_x 
942             +] $(X11_FLAGS_TO_PASS)[+ 
943           ENDIF with_x +] [+extra_make_flags+] check)
944 [+ ENDIF no_check +]
945 @endif [+module+]
946
947 .PHONY: install-[+module+] maybe-install-[+module+]
948 maybe-install-[+module+]:
949 @if [+module+]
950 maybe-install-[+module+]: install-[+module+]
951 [+ IF no_install +]
952 install-[+module+]:
953 [+ ELSE install +]
954 install-[+module+]: installdirs
955         @r=`${PWD_COMMAND}`; export r; \
956         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
957         $(SET_LIB_PATH) \
958         $(HOST_EXPORTS) \
959         (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ 
960           IF with_x 
961             +] $(X11_FLAGS_TO_PASS)[+ 
962           ENDIF with_x +] [+extra_make_flags+] install)
963 [+ ENDIF no_install +]
964 @endif [+module+]
965
966 # Other targets (info, dvi, etc.)
967 [+ FOR recursive_targets +]
968 .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
969 maybe-[+make_target+]-[+module+]:
970 @if [+module+]
971 maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
972 [+ IF (match-value? = "missing" (get "make_target") ) +]
973 # [+module+] doesn't support [+make_target+].
974 [+make_target+]-[+module+]:
975 [+ ELSE +]
976 [+make_target+]-[+module+]: [+
977   FOR depend +]\
978     [+depend+]-[+module+] [+
979   ENDFOR depend +]
980         @[ -f ./[+module+]/Makefile ] || exit 0; \
981         r=`${PWD_COMMAND}`; export r; \
982         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
983         $(SET_LIB_PATH) \
984         $(HOST_EXPORTS) \
985         for flag in $(EXTRA_HOST_FLAGS); do \
986           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
987         done; \
988         echo "Doing [+make_target+] in [+module+]" ; \
989         (cd [+module+] && \
990           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
991                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
992                   "RANLIB=$${RANLIB}" \
993                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
994                   [+extra_make_flags+] [+make_target+]) \
995           || exit 1
996 [+ ENDIF +]
997 @endif [+module+]
998 [+ ENDFOR recursive_targets +]
999 [+ ENDFOR host_modules +]
1000
1001 # ---------------------------------------
1002 # Modules which run on the target machine
1003 # ---------------------------------------
1004 [+ FOR target_modules +]
1005 .PHONY: configure-target-[+module+] maybe-configure-target-[+module+]
1006 maybe-configure-target-[+module+]:
1007 @if target-[+module+]
1008 maybe-configure-target-[+module+]: configure-target-[+module+]
1009
1010 # There's only one multilib.out.  Cleverer subdirs shouldn't need it copied.
1011 $(TARGET_SUBDIR)/[+module+]/multilib.out: multilib.out
1012         $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/[+module+] ; \
1013         rm -f $(TARGET_SUBDIR)/[+module+]/Makefile || : ; \
1014         cp multilib.out $(TARGET_SUBDIR)/[+module+]/multilib.out
1015
1016 configure-target-[+module+]: $(TARGET_SUBDIR)/[+module+]/multilib.out
1017         @test ! -f $(TARGET_SUBDIR)/[+module+]/Makefile || exit 0; \
1018         $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/[+module+] ; \
1019         r=`${PWD_COMMAND}`; export r; \
1020         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1021         $(SET_LIB_PATH) \[+
1022 IF raw_cxx +]
1023         $(RAW_CXX_TARGET_EXPORTS) \[+
1024 ELSE normal_cxx +]
1025         $(NORMAL_TARGET_EXPORTS) \[+
1026 ENDIF raw_cxx +]
1027         echo Configuring in $(TARGET_SUBDIR)/[+module+]; \
1028         cd "$(TARGET_SUBDIR)/[+module+]" || exit 1; \
1029         case $(srcdir) in \
1030           /* | [A-Za-z]:[\\/]*) \
1031             topdir=$(srcdir) ;; \
1032           *) \
1033             case "$(TARGET_SUBDIR)" in \
1034               .) topdir="../$(srcdir)" ;; \
1035               *) topdir="../../$(srcdir)" ;; \
1036             esac ;; \
1037         esac; \[+ IF stage +]
1038         if [ "$(srcdir)" = "." ] ; then \
1039           if [ "$(TARGET_SUBDIR)" != "." ] ; then \
1040             if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \
1041               if [ -f Makefile ]; then \
1042                 if $(MAKE) distclean; then \
1043                   true; \
1044                 else \
1045                   exit 1; \
1046                 fi; \
1047               else \
1048                 true; \
1049               fi; \
1050             else \
1051               exit 1; \
1052             fi; \
1053           else \
1054             true; \
1055           fi; \
1056           srcdiroption="--srcdir=."; \
1057           libsrcdir="."; \
1058         else \[+ ENDIF stage +]
1059           srcdiroption="--srcdir=$${topdir}/[+module+]"; \
1060           libsrcdir="$$s/[+module+]"; \[+ IF stage +]
1061         fi; \[+ ENDIF stage +]
1062         rm -f no-such-file || : ; \
1063         CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
1064           $(TARGET_CONFIGARGS) $${srcdiroption} \
1065           --with-target-subdir="$(TARGET_SUBDIR)" [+extra_configure_flags+] \
1066           || exit 1
1067 @endif target-[+module+]
1068
1069 .PHONY: all-target-[+module+] maybe-all-target-[+module+]
1070 maybe-all-target-[+module+]:
1071 @if target-[+module+]
1072 maybe-all-target-[+module+]: all-target-[+module+]
1073 all-target-[+module+]: configure-target-[+module+]
1074         @r=`${PWD_COMMAND}`; export r; \
1075         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1076         $(SET_LIB_PATH) \[+
1077 IF raw_cxx +]
1078         $(RAW_CXX_TARGET_EXPORTS) \[+
1079 ELSE normal_cxx +]
1080         $(NORMAL_TARGET_EXPORTS) \[+
1081 ENDIF raw_cxx +]
1082         (cd $(TARGET_SUBDIR)/[+module+] && \
1083           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1084             IF raw_cxx 
1085           +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1086             ENDIF raw_cxx 
1087           +] [+extra_make_flags+] all)
1088 @endif target-[+module+]
1089
1090 .PHONY: check-target-[+module+] maybe-check-target-[+module+]
1091 maybe-check-target-[+module+]:
1092 @if target-[+module+]
1093 maybe-check-target-[+module+]: check-target-[+module+]
1094 [+ IF no_check +]
1095 # Dummy target for uncheckable module.
1096 check-target-[+module+]:
1097 [+ ELSE check +]
1098 check-target-[+module+]:
1099         @r=`${PWD_COMMAND}`; export r; \
1100         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1101         $(SET_LIB_PATH) \[+
1102 IF raw_cxx +]
1103         $(RAW_CXX_TARGET_EXPORTS) \[+
1104 ELSE normal_cxx +]
1105         $(NORMAL_TARGET_EXPORTS) \[+
1106 ENDIF raw_cxx +]
1107         (cd $(TARGET_SUBDIR)/[+module+] && \
1108           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1109             IF raw_cxx 
1110               +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ 
1111             ENDIF raw_cxx 
1112           +] [+extra_make_flags+] check)
1113 [+ ENDIF no_check +]
1114 @endif target-[+module+]
1115
1116 .PHONY: install-target-[+module+] maybe-install-target-[+module+]
1117 maybe-install-target-[+module+]:
1118 @if target-[+module+]
1119 maybe-install-target-[+module+]: install-target-[+module+]
1120 [+ IF no_install +]
1121 # Dummy target for uninstallable.
1122 install-target-[+module+]:
1123 [+ ELSE install +]
1124 install-target-[+module+]: installdirs
1125         @r=`${PWD_COMMAND}`; export r; \
1126         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1127         $(SET_LIB_PATH) \[+
1128 IF raw_cxx +]
1129         $(RAW_CXX_TARGET_EXPORTS) \[+
1130 ELSE normal_cxx +]
1131         $(NORMAL_TARGET_EXPORTS) \[+
1132 ENDIF raw_cxx +]
1133         (cd $(TARGET_SUBDIR)/[+module+] && \
1134           $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
1135 [+ ENDIF no_install +]
1136 @endif target-[+module+]
1137
1138 # Other targets (info, dvi, etc.)
1139 [+ FOR recursive_targets +]
1140 .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1141 maybe-[+make_target+]-target-[+module+]:
1142 @if target-[+module+]
1143 maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
1144 [+ IF (match-value? = "missing" (get "make_target") ) +]
1145 # [+module+] doesn't support [+make_target+].
1146 [+make_target+]-target-[+module+]:
1147 [+ ELSE +]
1148 [+make_target+]-target-[+module+]: [+
1149   FOR depend +]\
1150     [+depend+]-target-[+module+] [+
1151   ENDFOR depend +]
1152         @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1153         r=`${PWD_COMMAND}`; export r; \
1154         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1155         $(SET_LIB_PATH) \[+
1156 IF raw_cxx +]
1157         $(RAW_CXX_TARGET_EXPORTS) \[+
1158 ELSE normal_cxx +]
1159         $(NORMAL_TARGET_EXPORTS) \[+
1160 ENDIF raw_cxx +]
1161         echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1162         for flag in $(EXTRA_TARGET_FLAGS); do \
1163           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1164         done; \
1165         (cd $(TARGET_SUBDIR)/[+module+] && \
1166           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1167                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1168                   "RANLIB=$${RANLIB}" \
1169                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
1170                   [+extra_make_flags+] [+make_target+]) \
1171           || exit 1
1172 [+ ENDIF +]
1173 @endif target-[+module+]
1174 [+ ENDFOR recursive_targets +]
1175 [+ ENDFOR target_modules +]
1176
1177 # ----------
1178 # GCC module
1179 # ----------
1180
1181 # Unfortunately, while gcc _should_ be a host module,
1182 # libgcc is a target module, and gen* programs are
1183 # build modules.  So GCC is a sort of hybrid.
1184
1185 # gcc is the only module which uses GCC_FLAGS_TO_PASS.
1186 # Don't use shared host config.cache, as it will confuse later
1187 # directories; GCC wants slightly different values for some
1188 # precious variables.  *sigh*
1189
1190 # We must skip configuring if toplevel bootstrap is going.
1191 .PHONY: configure-gcc maybe-configure-gcc
1192 maybe-configure-gcc:
1193 @if gcc
1194 maybe-configure-gcc: configure-gcc
1195 configure-gcc:
1196 @endif gcc
1197 @if gcc-no-bootstrap
1198         @test ! -f gcc/Makefile || exit 0; \
1199         [ -d gcc ] || mkdir gcc; \
1200         r=`${PWD_COMMAND}`; export r; \
1201         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1202         $(HOST_EXPORTS) \
1203         echo Configuring in gcc; \
1204         cd gcc || exit 1; \
1205         case $(srcdir) in \
1206           \.) \
1207             srcdiroption="--srcdir=."; \
1208             libsrcdir=".";; \
1209           /* | [A-Za-z]:[\\/]*) \
1210             srcdiroption="--srcdir=$(srcdir)/gcc"; \
1211             libsrcdir="$$s/gcc";; \
1212           *) \
1213             srcdiroption="--srcdir=../$(srcdir)/gcc"; \
1214             libsrcdir="$$s/gcc";; \
1215         esac; \
1216         $(SHELL) $${libsrcdir}/configure \
1217           $(HOST_CONFIGARGS) $${srcdiroption} \
1218           || exit 1
1219 @endif gcc-no-bootstrap
1220
1221 # Don't 'make all' in gcc if it's already been made by 'bootstrap'; that
1222 # causes trouble.  This wart will be fixed eventually by moving
1223 # the bootstrap behavior to this file.
1224 .PHONY: all-gcc maybe-all-gcc
1225 maybe-all-gcc:
1226 @if gcc
1227 maybe-all-gcc: all-gcc
1228 all-gcc: configure-gcc
1229 @endif gcc
1230 @if gcc-no-bootstrap
1231         r=`${PWD_COMMAND}`; export r; \
1232         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1233         $(SET_LIB_PATH) \
1234         $(HOST_EXPORTS) \
1235         if [ -f gcc/stage_last ] ; then \
1236           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) quickstrap); \
1237         else \
1238           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) all); \
1239         fi
1240
1241 # Building GCC uses some tools for rebuilding "source" files
1242 # like texinfo, bison/byacc, etc.  So we must depend on those.
1243 #
1244 # While building GCC, it may be necessary to run various target
1245 # programs like the assembler, linker, etc.  So we depend on
1246 # those too.
1247 #
1248 # In theory, on an SMP all those dependencies can be resolved
1249 # in parallel.
1250 #
1251 GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
1252 .PHONY: $(GCC_STRAP_TARGETS)
1253 $(GCC_STRAP_TARGETS): all-bootstrap configure-gcc
1254         @r=`${PWD_COMMAND}`; export r; \
1255         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1256         $(SET_LIB_PATH) \
1257         $(HOST_EXPORTS) \
1258         echo "Bootstrapping the compiler"; \
1259         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
1260         @r=`${PWD_COMMAND}`; export r; \
1261         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1262         case "$@" in \
1263           *bootstrap4-lean ) \
1264             msg="Comparing stage3 and stage4 of the compiler"; \
1265             compare=compare3-lean ;; \
1266           *bootstrap4 ) \
1267             msg="Comparing stage3 and stage4 of the compiler"; \
1268             compare=compare3 ;; \
1269           *-lean ) \
1270             msg="Comparing stage2 and stage3 of the compiler"; \
1271             compare=compare-lean ;; \
1272           * ) \
1273             msg="Comparing stage2 and stage3 of the compiler"; \
1274             compare=compare ;; \
1275         esac; \
1276         $(SET_LIB_PATH) \
1277         $(HOST_EXPORTS) \
1278         echo "$$msg"; \
1279         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
1280         @r=`${PWD_COMMAND}`; export r; \
1281         s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1282         $(SET_LIB_PATH) \
1283         echo "Building runtime libraries"; \
1284         $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
1285
1286 profiledbootstrap: all-bootstrap configure-gcc
1287         @r=`${PWD_COMMAND}`; export r; \
1288         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1289         $(SET_LIB_PATH) \
1290         $(HOST_EXPORTS) \
1291         echo "Bootstrapping the compiler"; \
1292         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build
1293         @r=`${PWD_COMMAND}`; export r; \
1294         s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1295         $(SET_LIB_PATH) \
1296         echo "Building runtime libraries and training compiler"; \
1297         $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
1298         @r=`${PWD_COMMAND}`; export r; \
1299         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1300         $(SET_LIB_PATH) \
1301         $(HOST_EXPORTS) \
1302         echo "Building feedback based compiler"; \
1303         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build
1304
1305 .PHONY: cross
1306 cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
1307         @r=`${PWD_COMMAND}`; export r; \
1308         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1309         $(SET_LIB_PATH) \
1310         $(HOST_EXPORTS) \
1311         echo "Building the C and C++ compiler"; \
1312         cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
1313         @r=`${PWD_COMMAND}`; export r; \
1314         s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1315         $(SET_LIB_PATH) \
1316         echo "Building runtime libraries"; \
1317         $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
1318 @endif gcc-no-bootstrap
1319
1320 .PHONY: check-gcc maybe-check-gcc
1321 maybe-check-gcc:
1322 @if gcc
1323 maybe-check-gcc: check-gcc
1324 check-gcc:
1325         @if [ -f ./gcc/Makefile ] ; then \
1326           r=`${PWD_COMMAND}`; export r; \
1327           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1328           $(SET_LIB_PATH) \
1329           $(HOST_EXPORTS) \
1330           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check); \
1331         else \
1332           true; \
1333         fi
1334
1335 .PHONY: check-gcc-c++
1336 check-gcc-c++:
1337         @if [ -f ./gcc/Makefile ] ; then \
1338           r=`${PWD_COMMAND}`; export r; \
1339           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1340           $(SET_LIB_PATH) \
1341           $(HOST_EXPORTS) \
1342           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
1343         else \
1344           true; \
1345         fi
1346
1347 .PHONY: check-c++
1348 check-c++: check-target-libstdc++-v3 check-gcc-c++
1349 @endif gcc
1350
1351 .PHONY: install-gcc maybe-install-gcc
1352 maybe-install-gcc:
1353 @if gcc
1354 maybe-install-gcc: install-gcc
1355 install-gcc:
1356         @if [ -f ./gcc/Makefile ] ; then \
1357           r=`${PWD_COMMAND}`; export r; \
1358           s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1359           $(SET_LIB_PATH) \
1360           $(HOST_EXPORTS) \
1361           (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1362         else \
1363           true; \
1364         fi
1365 @endif gcc
1366
1367 # Install the gcc headers files, but not the fixed include files,
1368 # which Cygnus is not allowed to distribute.  This rule is very
1369 # dependent on the workings of the gcc Makefile.in.
1370 .PHONY: gcc-no-fixedincludes
1371 gcc-no-fixedincludes:
1372         @if [ -f ./gcc/Makefile ]; then \
1373           rm -rf gcc/tmp-include; \
1374           mv gcc/include gcc/tmp-include 2>/dev/null; \
1375           mkdir gcc/include; \
1376           cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1377           touch gcc/stmp-fixinc gcc/include/fixed; \
1378           rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
1379           r=`${PWD_COMMAND}`; export r; \
1380           s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1381           $(SET_LIB_PATH) \
1382           $(HOST_EXPORTS) \
1383           (cd ./gcc && \
1384            $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1385           rm -rf gcc/include; \
1386           mv gcc/tmp-include gcc/include 2>/dev/null; \
1387         else true; fi
1388
1389 # Other targets (dvi, info, etc.)
1390 [+ FOR recursive_targets +]
1391 .PHONY: maybe-[+make_target+]-gcc [+make_target+]-gcc
1392 maybe-[+make_target+]-gcc:
1393 @if gcc
1394 maybe-[+make_target+]-gcc: [+make_target+]-gcc
1395 [+make_target+]-gcc: [+
1396   FOR depend +]\
1397     [+depend+]-gcc [+
1398   ENDFOR depend +]
1399         @[ -f ./gcc/Makefile ] || exit 0; \
1400         r=`${PWD_COMMAND}`; export r; \
1401         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1402         $(SET_LIB_PATH) \
1403         for flag in $(EXTRA_GCC_FLAGS); do \
1404           eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1405         done; \
1406         $(HOST_EXPORTS) \
1407         echo "Doing [+make_target+] in gcc" ; \
1408         (cd gcc && \
1409           $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1410                   "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1411                   "RANLIB=$${RANLIB}" \
1412                   "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
1413                   [+make_target+]) \
1414           || exit 1
1415 @endif gcc
1416
1417 [+ ENDFOR recursive_targets +]
1418
1419 @if gcc-bootstrap
1420 # ---------------------
1421 # GCC bootstrap support
1422 # ---------------------
1423
1424 # We track the current stage (the one in 'gcc') in the stage_last file.
1425 # We name the build directories for the various stages "stage1-gcc",
1426 # "stage2-gcc","stage3-gcc", etc.
1427
1428 # Since the 'compare' process will fail (on debugging information) if any
1429 # directory names are different, we need to link the gcc directory for
1430 # the previous stage to a constant name ('gcc-prev'), and to make the name of
1431 # the build directories constant as well. For the latter, we use naked names
1432 # like 'gcc', because the scripts in that directory assume it.  We use
1433 # mv on platforms where symlinks to directories do not work or are not
1434 # reliable.
1435
1436 # At the end of the bootstrap, a symlink to 'stage3-gcc' named 'gcc' must
1437 # be kept, so that libraries can find it.  Ick!
1438
1439 # It would be best to preinstall gcc into a staging area (and in the
1440 # future, gather there all prebootstrap packages).  This would allow
1441 # assemblers and linkers can be bootstrapped as well as the compiler
1442 # (both in a combined tree, or separately).  This however requires some
1443 # change to the gcc driver, again in order to avoid comparison failures.
1444
1445 # Bugs: This is almost certainly not parallel-make safe.
1446
1447 # 'touch' doesn't work right on some platforms.
1448 STAMP = echo timestamp > 
1449
1450 # Only build the C compiler for stage1, because that is the only one that
1451 # we can guarantee will build with the native compiler, and also it is the
1452 # only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
1453 # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
1454 # overrideable (for a bootstrap build stage1 also builds gcc.info).
1455
1456 STAGE1_CFLAGS=@stage1_cflags@
1457 STAGE1_LANGUAGES=@stage1_languages@
1458
1459 # We only want to compare .o files, so set this!
1460 objext = .o
1461
1462 # Real targets act phony if they depend on phony targets; this hack
1463 # prevents gratuitous rebuilding of stage 1.
1464 prebootstrap:
1465         $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-bootstrap
1466         $(STAMP) prebootstrap
1467
1468 # Flags to pass to stage2 and later makes.
1469 BOOT_CFLAGS= -g -O2
1470 POSTSTAGE1_FLAGS_TO_PASS = \
1471         CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
1472         STAGE_PREFIX=$$r/stage[+prev+]-gcc/ \
1473         CFLAGS="$(BOOT_CFLAGS)" \
1474         ADAC="\$$(CC)"
1475
1476 # For stage 1:
1477 # * We force-disable intermodule optimizations, even if
1478 #   --enable-intermodule was passed, since the installed compiler probably
1479 #   can't handle them.  Luckily, autoconf always respects
1480 #   the last argument when conflicting --enable arguments are passed.
1481 # * Likewise, we force-disable coverage flags, since the installed compiler
1482 #   probably has never heard of them.
1483 # * We build only C (and possibly Ada).
1484
1485 [+ FOR bootstrap-stage +]
1486 .PHONY: stage[+id+]-start stage[+id+]-end
1487
1488 stage[+id+]-start::
1489         [ -f stage_last ] && $(MAKE) `cat stage_last`-end || :
1490         echo stage[+id+] > stage_last ; \
1491         [ -d stage[+id+]-gcc ] || mkdir stage[+id+]-gcc; \
1492         set stage[+id+]-gcc gcc ; @CREATE_LINK_TO_DIR@ [+ IF prev +] ; \
1493         set stage[+prev+]-gcc prev-gcc ; @CREATE_LINK_TO_DIR@ [+ ENDIF prev +]
1494
1495 stage[+id+]-end::
1496         rm -f stage_last ; \
1497         set gcc stage[+id+]-gcc ; @UNDO_LINK_TO_DIR@ [+ IF prev +] ; \
1498         set prev-gcc stage[+prev+]-gcc ; @UNDO_LINK_TO_DIR@ [+ ENDIF prev +]
1499
1500 # Bubble a bugfix through all the stages up to stage [+id+].  They
1501 # are remade, but not reconfigured.  The next stage (if any) will not
1502 # be reconfigured as well.
1503 .PHONY: stage[+id+]-bubble
1504 stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
1505         @if [ -f all-stage[+id+]-gcc ] ; then \
1506           echo Remaking stage [+id+] ; \
1507           rm -f all-stage[+id+]-gcc ; \
1508         fi ; \
1509         $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]-gcc
1510
1511 [+ IF prev +]
1512 stage[+prev+]-bubble::
1513         @if [ -f configure-stage[+id+]-gcc ] ; then \
1514           $(STAMP) configure-stage[+id+]-gcc ; \
1515         fi
1516 [+ ENDIF prev +]
1517
1518 configure-stage[+id+]-gcc: [+ IF prev +] all-stage[+prev+]-gcc [+
1519           ELSE +] prebootstrap [+ ENDIF prev +]
1520         $(MAKE) stage[+id+]-start
1521         @if [ -f stage[+id+]-gcc/Makefile ] ; then \
1522           $(STAMP) configure-stage[+id+]-gcc ; \
1523           exit 0; \
1524         else \
1525           true ; \
1526         fi ; \
1527         r=`${PWD_COMMAND}`; export r; \
1528         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; [+ IF prev +] \
1529         $(STAGE_HOST_EXPORTS) [+ ELSE prev +] \
1530         $(HOST_EXPORTS) [+ ENDIF prev +] \
1531         echo Configuring stage [+id+] in gcc ; \
1532         cd gcc || exit 1; \
1533         case $(srcdir) in \
1534           \.) \
1535             srcdiroption="--srcdir=."; \
1536             libsrcdir=".";; \
1537           /* | [A-Za-z]:[\\/]*) \
1538             srcdiroption="--srcdir=$(srcdir)/gcc"; \
1539             libsrcdir="$$s/gcc";; \
1540           *) \
1541             srcdiroption="--srcdir=../$(srcdir)/gcc"; \
1542             libsrcdir="$$s/gcc";; \
1543         esac; \
1544         $(SHELL) $${libsrcdir}/configure \
1545           $(HOST_CONFIGARGS) $${srcdiroption} \
1546           [+extra_configure_flags+] && \
1547           $(STAMP) ../configure-stage[+id+]-gcc
1548
1549 all-stage[+id+]-gcc: configure-stage[+id+]-gcc
1550         $(MAKE) stage[+id+]-start
1551         @r=`${PWD_COMMAND}`; export r; \
1552         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; [+ IF prev +] \
1553         $(STAGE_HOST_EXPORTS) [+ ELSE prev +] \
1554         $(HOST_EXPORTS) [+ ENDIF prev +] \
1555         cd gcc && \
1556         $(MAKE) $(GCC_FLAGS_TO_PASS) [+ IF prev +] \
1557                 $(POSTSTAGE1_FLAGS_TO_PASS) [+ ENDIF prev +] \
1558                 [+extra_make_flags+] && $(STAMP) ../all-stage[+id+]-gcc
1559
1560 [+ IF compare-target +]
1561 [+compare-target+]: all-stage[+id+]-gcc
1562         [ -f stage_last ] && $(MAKE) `cat stage_last`-end || :
1563         @r=`${PWD_COMMAND}`; export r; \
1564         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1565         rm -f .bad_compare ; \
1566         cd stage[+id+]-gcc; \
1567         files=`find . -name "*$(objext)" -print` ; \
1568         cd .. ; \
1569         for file in $${files} ; do \
1570           f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
1571           @do_compare@ > /dev/null 2>&1; \
1572           test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
1573         done ; \
1574         if [ -f .bad_compare ]; then \
1575           echo "Bootstrap comparison failure!"; \
1576           cat .bad_compare; \
1577           exit 1; \
1578         else \
1579           true; \
1580         fi ; \
1581         $(STAMP) [+compare-target+]
1582 [+ ENDIF compare-target +]
1583
1584 [+ IF bootstrap-target +]
1585 .PHONY: [+bootstrap-target+]
1586 [+bootstrap-target+]:
1587         $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble [+
1588           IF compare-target +] [+compare-target+] [+
1589           ENDIF compare-target +] \
1590           stage[+id+]-start all stage[+id+]-end 
1591 [+ ENDIF bootstrap-target +]
1592
1593 .PHONY: restage[+id+] touch-stage[+id+] distclean-stage[+id+]
1594
1595 # Rules to wipe a stage and all the following ones, used for cleanstrap
1596 [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
1597 distclean-stage[+id+]::
1598         [ -f stage_last ] && $(MAKE) `cat stage_last`-end || :
1599         rm -rf configure-stage[+id+]-gcc all-stage[+id+]-gcc stage[+id+]-gcc [+
1600           IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1601
1602 # Rules to renew the timestamp on a stage and all the following ones
1603 [+ IF prev +]touch-stage[+prev+]:: touch-stage[+id+] [+ ENDIF prev +]
1604 touch-stage[+id+]::
1605         @[ -f configure-stage[+id+]-gcc ] && \
1606           echo '$(STAMP) configure-stage[+id+]-gcc' && \
1607           $(STAMP) configure-stage[+id+]-gcc; \
1608         [ -f all-stage[+id+]-gcc ] && \
1609           echo '$(STAMP) all-stage[+id+]-gcc' && \
1610           $(STAMP) all-stage[+id+]-gcc; \
1611         :
1612
1613 # After building a stage, touch the following ones
1614 [+ IF prev +]restage[+prev+]:: touch-stage[+id+] [+ ENDIF prev +]
1615 restage[+id+]::
1616         rm -rf all-stage[+id+]-gcc [+
1617           IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
1618         $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+
1619           IF compare-target +][+compare-target+] [+
1620           ELSE +] all-stage[+id+]-gcc [+ ENDIF compare-target +]
1621
1622 [+ IF cleanstrap-target +]
1623 .PHONY: [+cleanstrap-target+]
1624 [+cleanstrap-target+]: distclean-stage1 [+bootstrap-target+]
1625 [+ ENDIF cleanstrap-target +]
1626
1627 [+ ENDFOR bootstrap-stage +]
1628
1629 stagefeedback-start::
1630         @r=`${PWD_COMMAND}`; export r; \
1631         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1632         cd stageprofile-gcc && \
1633           { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../gcc/&",' | $(SHELL); } && \
1634           { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../gcc/&",' | $(SHELL); }
1635
1636 profiledbootstrap: all-bootstrap configure-gcc
1637         @r=`${PWD_COMMAND}`; export r; \
1638         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1639         $(SET_LIB_PATH) \
1640         $(HOST_EXPORTS) \
1641         echo "Bootstrapping the compiler"; \
1642         $(MAKE) stageprofile-bubble distclean-stagefeedback stageprofile-start
1643         @r=`${PWD_COMMAND}`; export r; \
1644         s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
1645         $(SET_LIB_PATH) \
1646         echo "Building runtime libraries and training compiler"; \
1647         $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all
1648         @r=`${PWD_COMMAND}`; export r; \
1649         s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1650         $(SET_LIB_PATH) \
1651         $(HOST_EXPORTS) \
1652         echo "Building feedback based compiler"; \
1653         $(MAKE) stagefeedback-bubble stagefeedback-end
1654
1655 @endif gcc-bootstrap
1656
1657 # --------------------------------------
1658 # Dependencies between different modules
1659 # --------------------------------------
1660
1661 # There are two types of dependencies here: 'hard' dependencies, where one
1662 # module simply won't build without the other; and 'soft' dependencies, where
1663 # if the depended-on module is missing, the depending module will do without
1664 # or find a substitute somewhere (perhaps installed).  Soft dependencies
1665 # are specified by depending on a 'maybe-' target.  If you're not sure,
1666 # it's safer to use a soft dependency.
1667
1668 # Build modules
1669 all-build-bison: maybe-all-build-texinfo
1670 all-build-flex: maybe-all-build-texinfo
1671 all-build-libiberty: maybe-all-build-texinfo
1672 all-build-m4: maybe-all-build-libiberty maybe-all-build-texinfo
1673
1674 # Host modules specific to gcc.
1675 # GCC needs to identify certain tools.
1676 # GCC also needs the information exported by the intl configure script.
1677 configure-gcc: maybe-configure-intl maybe-configure-binutils maybe-configure-gas maybe-configure-ld maybe-configure-bison maybe-configure-flex
1678 all-gcc: maybe-all-libiberty maybe-all-intl maybe-all-texinfo maybe-all-bison maybe-all-byacc maybe-all-flex maybe-all-binutils maybe-all-gas maybe-all-ld maybe-all-zlib maybe-all-libbanshee maybe-all-libcpp
1679 configure-libcpp: maybe-configure-libiberty maybe-configure-intl
1680 all-libcpp: maybe-all-libiberty maybe-all-intl
1681 # This is a slightly kludgy method of getting dependencies on 
1682 # all-build-libiberty correct; it would be better to build it every time.
1683 all-gcc: maybe-all-build-libiberty
1684 all-bootstrap: [+ FOR host_modules +][+ IF bootstrap +]maybe-all-[+module+] [+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1685
1686 # Host modules specific to gdb.
1687 # GDB needs to know that the simulator is being built.
1688 configure-gdb: maybe-configure-itcl maybe-configure-tcl maybe-configure-tk maybe-configure-sim
1689 GDB_TK = @GDB_TK@
1690 all-gdb: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-mmalloc maybe-all-readline maybe-all-bison maybe-all-byacc maybe-all-sim $(gdbnlmrequirements) $(GDB_TK)
1691 install-gdb: maybe-install-tcl maybe-install-tk maybe-install-itcl maybe-install-tix maybe-install-libgui
1692 configure-libgui: maybe-configure-tcl maybe-configure-tk
1693 all-libgui: maybe-all-tcl maybe-all-tk maybe-all-itcl
1694
1695 # Host modules specific to binutils.
1696 configure-bfd: configure-libiberty
1697 all-bfd: maybe-all-libiberty maybe-all-intl
1698 all-binutils: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-flex maybe-all-bison maybe-all-byacc maybe-all-intl
1699 # We put install-opcodes before install-binutils because the installed
1700 # binutils might be on PATH, and they might need the shared opcodes
1701 # library.
1702 install-binutils: maybe-install-opcodes
1703 # libopcodes depends on libbfd
1704 install-opcodes: maybe-install-bfd
1705 all-gas: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-intl
1706 all-gprof: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-intl
1707 all-ld: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-bison maybe-all-byacc maybe-all-flex maybe-all-intl
1708 all-opcodes: maybe-all-bfd maybe-all-libiberty
1709
1710 # Other host modules in the 'src' repository.
1711 all-dejagnu: maybe-all-tcl maybe-all-expect maybe-all-tk
1712 configure-expect: maybe-configure-tcl maybe-configure-tk
1713 all-expect: maybe-all-tcl maybe-all-tk
1714 configure-itcl: maybe-configure-tcl maybe-configure-tk
1715 all-itcl: maybe-all-tcl maybe-all-tk
1716 # We put install-tcl before install-itcl because itcl wants to run a
1717 # program on installation which uses the Tcl libraries.
1718 install-itcl: maybe-install-tcl
1719 all-sid: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-tcl maybe-all-tk
1720 install-sid: maybe-install-tcl maybe-install-tk
1721 all-sim: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-readline maybe-configure-gdb
1722 configure-tk: maybe-configure-tcl
1723 all-tk: maybe-all-tcl
1724 configure-tix: maybe-configure-tcl maybe-configure-tk
1725 all-tix: maybe-all-tcl maybe-all-tk
1726 all-texinfo: maybe-all-libiberty
1727
1728 # Other host modules.  Warning, these are not well tested.
1729 all-autoconf: maybe-all-m4 maybe-all-texinfo
1730 all-automake: maybe-all-m4 maybe-all-texinfo
1731 all-bison: maybe-all-texinfo
1732 all-diff: maybe-all-libiberty
1733 all-fastjar: maybe-all-zlib maybe-all-libiberty
1734 all-fileutils: maybe-all-libiberty
1735 all-flex: maybe-all-libiberty maybe-all-bison maybe-all-byacc
1736 all-gzip: maybe-all-libiberty
1737 all-hello: maybe-all-libiberty
1738 all-m4: maybe-all-libiberty maybe-all-texinfo
1739 all-make: maybe-all-libiberty maybe-all-intl
1740 all-patch: maybe-all-libiberty
1741 all-prms: maybe-all-libiberty
1742 all-recode: maybe-all-libiberty
1743 all-sed: maybe-all-libiberty
1744 all-send-pr: maybe-all-prms
1745 all-tar: maybe-all-libiberty
1746 all-uudecode: maybe-all-libiberty
1747
1748 ALL_GCC = maybe-all-gcc
1749 ALL_GCC_C = $(ALL_GCC) maybe-all-target-newlib maybe-all-target-libgloss
1750 ALL_GCC_CXX = $(ALL_GCC_C) maybe-all-target-libstdc++-v3
1751
1752 # Target modules specific to gcc.
1753 configure-target-boehm-gc: $(ALL_GCC_C) maybe-configure-target-qthreads
1754 configure-target-fastjar: maybe-configure-target-zlib
1755 all-target-fastjar: maybe-all-target-zlib maybe-all-target-libiberty
1756 configure-target-libada: $(ALL_GCC_C)
1757 configure-target-libgfortran: $(ALL_GCC_C)
1758 configure-target-libffi: $(ALL_GCC_C) 
1759 configure-target-libjava: $(ALL_GCC_C) maybe-configure-target-zlib maybe-configure-target-boehm-gc maybe-configure-target-qthreads maybe-configure-target-libffi
1760 all-target-libjava: maybe-all-fastjar maybe-all-target-zlib maybe-all-target-boehm-gc maybe-all-target-qthreads maybe-all-target-libffi
1761 configure-target-libobjc: $(ALL_GCC_C)
1762 all-target-libobjc: maybe-all-target-libiberty
1763 configure-target-libstdc++-v3: $(ALL_GCC_C)
1764 all-target-libstdc++-v3: maybe-all-target-libiberty
1765 configure-target-zlib: $(ALL_GCC_C)
1766
1767 # Target modules in the 'src' repository.
1768 configure-target-examples: $(ALL_GCC_C)
1769 configure-target-libgloss: $(ALL_GCC)
1770 all-target-libgloss: maybe-configure-target-newlib
1771 configure-target-libiberty: $(ALL_GCC)
1772 configure-target-libtermcap: $(ALL_GCC_C)
1773 configure-target-newlib: $(ALL_GCC)
1774 configure-target-rda: $(ALL_GCC_C)
1775 configure-target-winsup: $(ALL_GCC_C)
1776 all-target-winsup: maybe-all-target-libiberty maybe-all-target-libtermcap
1777
1778 # Other target modules.  Warning, these are not well tested.
1779 configure-target-gperf: $(ALL_GCC_CXX)
1780 all-target-gperf: maybe-all-target-libiberty maybe-all-target-libstdc++-v3
1781 configure-target-qthreads: $(ALL_GCC_C)
1782
1783 # Serialization dependencies.  Host configures don't work well in parallel to
1784 # each other, due to contention over config.cache.  Target configures and 
1785 # build configures are similar.
1786 @serialization_dependencies@
1787
1788 # --------------------------------
1789 # Regenerating top level configury
1790 # --------------------------------
1791
1792 # Multilib.out tells target dirs what multilibs they should build.
1793 # There is really only one copy.  We use the 'timestamp' method to
1794 # work around various timestamp bugs on some systems.
1795 # We use move-if-change so that it's only considered updated when it
1796 # actually changes, because it has to depend on a phony target.
1797 multilib.out: maybe-all-gcc
1798         @r=`${PWD_COMMAND}`; export r; \
1799         echo "Checking multilib configuration..."; \
1800         $(CC_FOR_TARGET) --print-multi-lib > multilib.tmp 2> /dev/null ; \
1801         $(SHELL) $(srcdir)/move-if-change multilib.tmp multilib.out ; \
1802
1803 # Rebuilding Makefile.in, using autogen.
1804 AUTOGEN = autogen
1805 $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
1806         cd $(srcdir) && $(AUTOGEN) Makefile.def
1807
1808 # Rebuilding Makefile.
1809 Makefile: $(srcdir)/Makefile.in config.status
1810         CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1811
1812 config.status: configure $(gcc_version_trigger)
1813         CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
1814
1815 # Rebuilding configure.
1816 AUTOCONF = autoconf
1817 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4
1818         cd $(srcdir) && $(AUTOCONF)
1819
1820 # ------------------------------
1821 # Special directives to GNU Make
1822 # ------------------------------
1823
1824 # Don't pass command-line variables to submakes.
1825 .NOEXPORT:
1826 MAKEOVERRIDES=
1827
1828 # end of Makefile.in