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