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