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