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