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