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