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