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