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