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