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