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