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