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