]> git.ipfire.org Git - thirdparty/gcc.git/blame - Makefile.tpl
PR target/42811 (prerequisite)
[thirdparty/gcc.git] / Makefile.tpl
CommitLineData
d3ac17c9 1[+ AutoGen5 template -*- Mode: Makefile -*-
95ddd785
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,
4a4a4e99 9# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
309c24a9 10# Free Software Foundation
95ddd785
NN
11#
12# This file is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
309c24a9 14# the Free Software Foundation; either version 3 of the License, or
95ddd785
NN
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
309c24a9
JJ
23# along with this program; see the file COPYING3. If not see
24# <http://www.gnu.org/licenses/>.
95ddd785
NN
25#
26
295e261a
HPN
27# First, test for a proper version of make, but only where one is required.
28
29@if gcc
30ifeq (,$(.VARIABLES)) # The variable .VARIABLES, new with 3.80, is never empty.
31$(error GNU make version 3.80 or newer is required.)
32endif
33@endif gcc
34
df0f0674
NN
35# -------------------------------
36# Standard Autoconf-set variables
37# -------------------------------
4977bab6 38VPATH=@srcdir@
4977bab6 39
1c710c3c 40build_alias=@build_noncanonical@
e69bf64b
PB
41build_vendor=@build_vendor@
42build_os=@build_os@
e89fbdfe 43build=@build@
1c710c3c 44host_alias=@host_noncanonical@
e69bf64b
PB
45host_vendor=@host_vendor@
46host_os=@host_os@
e89fbdfe 47host=@host@
1c710c3c 48target_alias=@target_noncanonical@
e69bf64b
PB
49target_vendor=@target_vendor@
50target_os=@target_os@
e89fbdfe 51target=@target@
4977bab6 52
df0f0674 53program_transform_name = @program_transform_name@
0dffceed
NN
54
55prefix = @prefix@
56exec_prefix = @exec_prefix@
57
df0f0674
NN
58srcdir = @srcdir@
59
0dffceed
NN
60bindir = @bindir@
61sbindir = @sbindir@
62libexecdir = @libexecdir@
63datadir = @datadir@
64sysconfdir = @sysconfdir@
65sharedstatedir = @sharedstatedir@
66localstatedir = @localstatedir@
67libdir = @libdir@
68includedir = @includedir@
69oldincludedir = @oldincludedir@
70infodir = @infodir@
65d6e994
CD
71datarootdir = @datarootdir@
72docdir = @docdir@
9c4d2493 73pdfdir = @pdfdir@
65d6e994 74htmldir = @htmldir@
0dffceed 75mandir = @mandir@
95ddd785
NN
76man1dir = $(mandir)/man1
77man2dir = $(mandir)/man2
78man3dir = $(mandir)/man3
79man4dir = $(mandir)/man4
80man5dir = $(mandir)/man5
81man6dir = $(mandir)/man6
82man7dir = $(mandir)/man7
83man8dir = $(mandir)/man8
84man9dir = $(mandir)/man9
95ddd785 85
775956d0
NN
86INSTALL = @INSTALL@
87INSTALL_PROGRAM = @INSTALL_PROGRAM@
88INSTALL_SCRIPT = @INSTALL_SCRIPT@
89INSTALL_DATA = @INSTALL_DATA@
ad6717df
PB
90LN = @LN@
91LN_S = @LN_S@
58e24147
AM
92MAINT = @MAINT@
93MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
94MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
95ddd785 95
df0f0674
NN
96# -------------------------------------------------
97# Miscellaneous non-standard autoconf-set variables
98# -------------------------------------------------
95ddd785 99
df0f0674
NN
100# The gcc driver likes to know the arguments it was configured with.
101TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
95ddd785 102
df0f0674
NN
103tooldir = @tooldir@
104build_tooldir = @build_tooldir@
95ddd785 105
df0f0674 106GDB_NLM_DEPS =
95ddd785 107
df0f0674
NN
108# This is the name of the environment variable used for the path to
109# the libraries.
110RPATH_ENVVAR = @RPATH_ENVVAR@
95ddd785 111
d89f0ad6
AL
112# On targets where RPATH_ENVVAR is PATH, a subdirectory of the GCC build path
113# is used instead of the directory itself to avoid including built
114# executables in PATH.
115GCC_SHLIB_SUBDIR = @GCC_SHLIB_SUBDIR@
116
df0f0674
NN
117# Build programs are put under this directory.
118BUILD_SUBDIR = @build_subdir@
119# This is set by the configure script to the arguments to use when configuring
120# directories built for the build system.
25b42232 121BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
23f6b2f9 122
00020c16
ILT
123# Linker flags to use on the host, for stage1 or when not
124# bootstrapping.
125STAGE1_LDFLAGS = @stage1_ldflags@
126
127# Libraries to use on the host, for stage1 or when not bootstrapping.
128STAGE1_LIBS = @stage1_libs@
129
130# Linker flags to use for stage2 and later.
131POSTSTAGE1_LDFLAGS = @poststage1_ldflags@
132
133# Libraries to use for stage2 and later.
134POSTSTAGE1_LIBS = @poststage1_libs@
135
23f6b2f9
PB
136# This is the list of variables to export in the environment when
137# configuring any subdirectory. It must also be exported whenever
138# recursing into a build directory in case that directory's Makefile
139# re-runs configure.
140BASE_EXPORTS = \
141 FLEX="$(FLEX)"; export FLEX; \
142 LEX="$(LEX)"; export LEX; \
143 BISON="$(BISON)"; export BISON; \
144 YACC="$(YACC)"; export YACC; \
145 M4="$(M4)"; export M4; \
87264276 146 SED="$(SED)"; export SED; \
f945e229 147 AWK="$(AWK)"; export AWK; \
23f6b2f9
PB
148 MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
149
4fc4dd12 150# This is the list of variables to export in the environment when
23f6b2f9 151# configuring subdirectories for the build system.
4fc4dd12 152BUILD_EXPORTS = \
23f6b2f9 153 $(BASE_EXPORTS) \
4fc4dd12
DJ
154 AR="$(AR_FOR_BUILD)"; export AR; \
155 AS="$(AS_FOR_BUILD)"; export AS; \
156 CC="$(CC_FOR_BUILD)"; export CC; \
157 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
158 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
159 CXX="$(CXX_FOR_BUILD)"; export CXX; \
160 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
161 GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
162 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
163 DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
164 LD="$(LD_FOR_BUILD)"; export LD; \
165 LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
166 NM="$(NM_FOR_BUILD)"; export NM; \
167 RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
0136f2f7 168 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
901119ae 169 WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
df0f0674 170
f8c33439 171# These variables must be set on the make command line for directories
487e299b 172# built for the build system to override those in BASE_FLAGS_TO_PASSS.
f8c33439
JM
173EXTRA_BUILD_FLAGS = \
174 CFLAGS="$(CFLAGS_FOR_BUILD)" \
175 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
176
df0f0674
NN
177# This is the list of directories to built for the host system.
178SUBDIRS = @configdirs@
aae29963 179TARGET_CONFIGDIRS = @target_configdirs@
df0f0674
NN
180# This is set by the configure script to the arguments to use when configuring
181# directories built for the host system.
182HOST_CONFIGARGS = @host_configargs@
215c351a
PB
183# Host programs are put under this directory, which is . except if building
184# with srcdir=..
185HOST_SUBDIR = @host_subdir@
4fc4dd12 186# This is the list of variables to export in the environment when
2abefe3d
PB
187# configuring subdirectories for the host system. We need to pass
188# some to the GCC configure because of its hybrid host/target nature.
4fc4dd12 189HOST_EXPORTS = \
23f6b2f9 190 $(BASE_EXPORTS) \
4fc4dd12 191 CC="$(CC)"; export CC; \
00afcaa0 192 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
4fc4dd12
DJ
193 CFLAGS="$(CFLAGS)"; export CFLAGS; \
194 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
195 CXX="$(CXX)"; export CXX; \
196 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
4a4a4e99
AO
197 GCJ="$(GCJ)"; export GCJ; \
198 GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
4fc4dd12
DJ
199 AR="$(AR)"; export AR; \
200 AS="$(AS)"; export AS; \
201 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
202 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
203 LD="$(LD)"; export LD; \
00020c16 204 LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
4fc4dd12
DJ
205 NM="$(NM)"; export NM; \
206 RANLIB="$(RANLIB)"; export RANLIB; \
207 WINDRES="$(WINDRES)"; export WINDRES; \
901119ae 208 WINDMC="$(WINDMC)"; export WINDMC; \
4fc4dd12 209 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
1c020272 210 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
2abefe3d
PB
211 AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
212 AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
213 GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
214 LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
215 NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
216 OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
217 RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
4fc4dd12 218 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
00020c16 219 HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
4fc4dd12 220 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
4c4a5bbc 221 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
f8bf9252
SP
222 PPLLIBS="$(HOST_PPLLIBS)"; export PPLLIBS; \
223 PPLINC="$(HOST_PPLINC)"; export PPLINC; \
224 CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \
225 CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \
d7f09764
DN
226 LIBELFLIBS="$(HOST_LIBELFLIBS)" ; export LIBELFLIBS; \
227 LIBELFINC="$(HOST_LIBELFINC)" ; export LIBELFINC; \
1061f99e
PB
228@if gcc-bootstrap
229 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
230@endif gcc-bootstrap
0bff65e7 231 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
4fc4dd12 232
f61428ed
AO
233POSTSTAGE1_CXX_EXPORT = \
234 CXX='$(CXX)'; export CXX; \
235 CXX_FOR_BUILD='$(CXX_FOR_BUILD)'; export CXX_FOR_BUILD;
236@if target-libstdc++-v3-bootstrap
237# Override the above if we're bootstrapping C++.
238POSTSTAGE1_CXX_EXPORT = \
239 CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/g++$(exeext) \
240 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \
241 -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \
242 -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \
243 -I$$s/libstdc++-v3/libsupc++ \
244 -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs"; export CXX; \
245 CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD;
246@endif target-libstdc++-v3-bootstrap
247
4fc4dd12 248# Similar, for later GCC stages.
ce406537 249POSTSTAGE1_HOST_EXPORTS = \
a52a0a7f 250 $(HOST_EXPORTS) \
215c351a 251 CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
4a4a4e99
AO
252 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ \
253 $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
254 CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \
f61428ed 255 $(POSTSTAGE1_CXX_EXPORT) \
00020c16
ILT
256 GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \
257 LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \
258 HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS;
df0f0674 259
df0f0674
NN
260# Target libraries are put under this directory:
261TARGET_SUBDIR = @target_subdir@
262# This is set by the configure script to the arguments to use when configuring
263# directories built for the target.
25b42232 264TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
4fc4dd12 265# This is the list of variables to export in the environment when
60a2e213 266# configuring subdirectories for the target system.
4fc4dd12 267BASE_TARGET_EXPORTS = \
23f6b2f9 268 $(BASE_EXPORTS) \
4fc4dd12 269 AR="$(AR_FOR_TARGET)"; export AR; \
2abefe3d 270 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
4a4a4e99
AO
271 CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
272 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
4fc4dd12 273 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
e7daab31 274 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
4a4a4e99
AO
275 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
276 GCJ="$(GCJ_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GCJ; \
277 GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
4fc4dd12 278 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
2abefe3d 279 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
4fc4dd12 280 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
040b1c5a 281 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
2abefe3d 282 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
d739199a 283 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
4fc4dd12 284 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
040b1c5a 285 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
4c4a5bbc 286 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
901119ae 287 WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
60a2e213
RW
288@if gcc-bootstrap
289 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
290@endif gcc-bootstrap
aae29963
JR
291 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
292 TARGET_CONFIGDIRS="$(TARGET_CONFIGDIRS)"; export TARGET_CONFIGDIRS;
4fc4dd12
DJ
293
294RAW_CXX_TARGET_EXPORTS = \
295 $(BASE_TARGET_EXPORTS) \
296 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
4a4a4e99 297 CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
4fc4dd12
DJ
298
299NORMAL_TARGET_EXPORTS = \
300 $(BASE_TARGET_EXPORTS) \
4a4a4e99 301 CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
df0f0674 302
6de9cd9a
DN
303# Where to find GMP
304HOST_GMPLIBS = @gmplibs@
305HOST_GMPINC = @gmpinc@
306
f8bf9252
SP
307# Where to find PPL
308HOST_PPLLIBS = @ppllibs@
309HOST_PPLINC = @pplinc@
310
311# Where to find CLOOG
312HOST_CLOOGLIBS = @clooglibs@
313HOST_CLOOGINC = @clooginc@
314
d7f09764
DN
315# Where to find libelf
316HOST_LIBELFLIBS = @libelflibs@
317HOST_LIBELFINC = @libelfinc@
318
df0f0674
NN
319# ----------------------------------------------
320# Programs producing files for the BUILD machine
321# ----------------------------------------------
322
323SHELL = @config_shell@
324
325# pwd command to use. Allow user to override default by setting PWDCMD in
326# the environment to account for automounters. The make variable must not
327# be called PWDCMD, otherwise the value set here is passed to make
328# subprocesses and overrides the setting from the user's environment.
8c90b13a
L
329# Don't use PWD since it is a common shell environment variable and we
330# don't want to corrupt it.
331PWD_COMMAND = $${PWDCMD-pwd}
df0f0674
NN
332
333# compilers to use to create programs which must be run in the build
334# environment.
0999159b
PB
335AR_FOR_BUILD = @AR_FOR_BUILD@
336AS_FOR_BUILD = @AS_FOR_BUILD@
df0f0674 337CC_FOR_BUILD = @CC_FOR_BUILD@
6691a79e 338CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
0999159b
PB
339CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
340CXX_FOR_BUILD = @CXX_FOR_BUILD@
341DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
342GCJ_FOR_BUILD = @GCJ_FOR_BUILD@
343GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
344LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
345LD_FOR_BUILD = @LD_FOR_BUILD@
346NM_FOR_BUILD = @NM_FOR_BUILD@
347RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@
348WINDMC_FOR_BUILD = @WINDMC_FOR_BUILD@
349WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@
df0f0674
NN
350
351# Special variables passed down in EXTRA_GCC_FLAGS. They are defined
352# here so that they can be overridden by Makefile fragments.
df0f0674
NN
353BUILD_PREFIX = @BUILD_PREFIX@
354BUILD_PREFIX_1 = @BUILD_PREFIX_1@
95ddd785 355
45f366ab
PB
356# Flags to pass to stage2 and later makes. They are defined
357# here so that they can be overridden by Makefile fragments.
358BOOT_CFLAGS= -g -O2
d19bca38 359BOOT_LDFLAGS=
dd609cc1 360BOOT_ADAFLAGS=-gnatpg -gnata
45f366ab 361
87264276
PB
362AWK = @AWK@
363SED = @SED@
2abefe3d
PB
364BISON = @BISON@
365YACC = @YACC@
366FLEX = @FLEX@
367LEX = @LEX@
368M4 = @M4@
369MAKEINFO = @MAKEINFO@
370EXPECT = @EXPECT@
371RUNTEST = @RUNTEST@
95ddd785
NN
372
373# This just becomes part of the MAKEINFO definition passed down to
374# sub-makes. It lets flags be given on the command line while still
375# using the makeinfo from the object tree.
2f50999f
GP
376# (Default to avoid splitting info files by setting the threshold high.)
377MAKEINFOFLAGS = --split-size=5000000
95ddd785 378
df0f0674
NN
379# ---------------------------------------------
380# Programs producing files for the HOST machine
381# ---------------------------------------------
95ddd785 382
df0f0674 383AS = @AS@
df0f0674
NN
384AR = @AR@
385AR_FLAGS = rc
df0f0674 386CC = @CC@
df0f0674 387CXX = @CXX@
df0f0674 388DLLTOOL = @DLLTOOL@
df0f0674 389LD = @LD@
2abefe3d
PB
390LIPO = @LIPO@
391NM = @NM@
2d309510 392OBJDUMP = @OBJDUMP@
df0f0674 393RANLIB = @RANLIB@
2abefe3d 394STRIP = @STRIP@
df0f0674 395WINDRES = @WINDRES@
901119ae 396WINDMC = @WINDMC@
95ddd785 397
5305be7e
RG
398GNATBIND = @GNATBIND@
399GNATMAKE = @GNATMAKE@
400
2abefe3d 401CFLAGS = @CFLAGS@
f6671c93 402LDFLAGS = @LDFLAGS@
2abefe3d
PB
403LIBCFLAGS = $(CFLAGS)
404CXXFLAGS = @CXXFLAGS@
405LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
df0f0674 406
4a4a4e99
AO
407TFLAGS =
408
409# Defaults for all stages; some are overridden below.
410
411STAGE_CFLAGS = $(BOOT_CFLAGS)
412STAGE_TFLAGS = $(TFLAGS)
413STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
414
415[+ FOR bootstrap-stage +]
416# Defaults for stage [+id+]; some are overridden below.
417STAGE[+id+]_CFLAGS = $(STAGE_CFLAGS)
f61428ed
AO
418STAGE[+id+]_CXXFLAGS = $(CXXFLAGS)
419@if target-libstdc++-v3-bootstrap
420# Override the above if we're bootstrapping C++.
421STAGE[+id+]_CXXFLAGS = $(STAGE[+id+]_CFLAGS)
422@endif target-libstdc++-v3-bootstrap
4a4a4e99
AO
423STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS)
424STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
425[+ ENDFOR bootstrap-stage +]
426
8efea775
PB
427# Only build the C compiler for stage1, because that is the only one that
428# we can guarantee will build with the native compiler, and also it is the
429# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
430# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
431# overrideable (for a bootstrap build stage1 also builds gcc.info).
432
4a4a4e99 433STAGE1_CFLAGS = @stage1_cflags@
f61428ed
AO
434STAGE1_CHECKING = @stage1_checking@
435STAGE1_LANGUAGES = @stage1_languages@
4a4a4e99
AO
436# * We force-disable intermodule optimizations, even if
437# --enable-intermodule was passed, since the installed compiler
438# probably can't handle them. Luckily, autoconf always respects
439# the last argument when conflicting --enable arguments are passed.
440# * Likewise, we force-disable coverage flags, since the installed
441# compiler probably has never heard of them.
442STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
443 --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)"
8efea775 444
4a4a4e99
AO
445STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
446STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
bb286d71 447
4a4a4e99
AO
448STAGEfeedback_CFLAGS = $(STAGE3_CFLAGS) -fprofile-use
449STAGEfeedback_TFLAGS = $(STAGE3_TFLAGS)
1c8bd6a3 450
bb286d71
AO
451do-compare = @do_compare@
452do-compare3 = $(do-compare)
bb286d71 453
df0f0674
NN
454# -----------------------------------------------
455# Programs producing files for the TARGET machine
456# -----------------------------------------------
95ddd785 457
df0f0674 458AR_FOR_TARGET=@AR_FOR_TARGET@
4977bab6 459AS_FOR_TARGET=@AS_FOR_TARGET@
4a4a4e99 460CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@
4de997d1 461
df0f0674
NN
462# If GCC_FOR_TARGET is not overriden on the command line, then this
463# variable is passed down to the gcc Makefile, where it is used to
464# build libgcc2.a. We define it here so that it can itself be
465# overridden on the command line.
4a4a4e99
AO
466GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@
467CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@
468RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
469GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@
470GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
4977bab6 471DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
df0f0674 472LD_FOR_TARGET=@LD_FOR_TARGET@
df0f0674 473
040b1c5a 474LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
df0f0674 475NM_FOR_TARGET=@NM_FOR_TARGET@
d739199a 476OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
4977bab6 477RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
040b1c5a 478STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
df0f0674 479WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
901119ae 480WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
95ddd785 481
2abefe3d
PB
482COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
483COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
484COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
485
1c8bd6a3
PB
486CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
487CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
1c8bd6a3 488
2abefe3d
PB
489LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
490LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
487e299b 491LDFLAGS_FOR_TARGET =
df0f0674 492
4a4a4e99
AO
493FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
494SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
495DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
496
497XGCC_FLAGS_FOR_TARGET = $(FLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
498
df0f0674
NN
499# ------------------------------------
500# Miscellaneous targets and flag lists
501# ------------------------------------
502
95ddd785
NN
503# The first rule in the file had better be this one. Don't put any above it.
504# This lives here to allow makefile fragments to contain dependencies.
1061f99e 505all:
95ddd785 506
95ddd785 507#### host and target specific makefile fragments come in here.
671aa708
NN
508@target_makefile_frag@
509@alphaieee_frag@
510@ospace_frag@
511@host_makefile_frag@
95ddd785
NN
512###
513
0bff65e7
PB
514# This is the list of directories that may be needed in RPATH_ENVVAR
515# so that prorgams built for the target machine work.
516TARGET_LIB_PATH = [+ FOR target_modules +][+
517 IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
518 ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
519[+ FOR target_modules +][+ IF lib_path +]
520@if target-[+module+]
521TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
522@endif target-[+module+]
523[+ ENDIF lib_path +][+ ENDFOR target_modules +]
524
525
526# This is the list of directories that may be needed in RPATH_ENVVAR
527# so that programs built for the host machine work.
528HOST_LIB_PATH = [+ FOR host_modules +][+
529 IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
530 ENDFOR host_modules +]
531
532# Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
533@if gcc
d89f0ad6 534HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR):
0bff65e7
PB
535@endif gcc
536
537[+ FOR host_modules +][+ IF lib_path +]
538@if [+module+]
539HOST_LIB_PATH_[+module+] = \
540 $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
541 +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
542@endif [+module+]
543[+ ENDIF lib_path +][+ ENDFOR host_modules +]
544
95ddd785 545# Flags to pass down to all sub-makes.
cc11cc9b
PB
546BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
547 "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
4a4a4e99
AO
548 "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +][+ FOR bootstrap-stage +] \
549 "STAGE[+id+]_CFLAGS=$(STAGE[+id+]_CFLAGS)" \
f61428ed 550 "STAGE[+id+]_CXXFLAGS=$(STAGE[+id+]_CXXFLAGS)" \
4a4a4e99
AO
551 "STAGE[+id+]_TFLAGS=$(STAGE[+id+]_TFLAGS)"[+ ENDFOR bootstrap-stage +] \
552 "TFLAGS=$(TFLAGS)" \
e75f9147 553 "CONFIG_SHELL=$(SHELL)" \
11405c93 554 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"
95ddd785 555
4de997d1
PB
556# We leave this in just in case, but it is not needed anymore.
557RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
ad6717df 558
95ddd785
NN
559# Flags to pass down to most sub-makes, in which we're building with
560# the host environment.
95ddd785
NN
561EXTRA_HOST_FLAGS = \
562 'AR=$(AR)' \
563 'AS=$(AS)' \
564 'CC=$(CC)' \
565 'CXX=$(CXX)' \
566 'DLLTOOL=$(DLLTOOL)' \
4a4a4e99
AO
567 'GCJ=$(GCJ)' \
568 'GFORTRAN=$(GFORTRAN)' \
95ddd785 569 'LD=$(LD)' \
2abefe3d 570 'LIPO=$(LIPO)' \
95ddd785 571 'NM=$(NM)' \
2d309510 572 'OBJDUMP=$(OBJDUMP)' \
c858bf1e 573 'RANLIB=$(RANLIB)' \
2abefe3d 574 'STRIP=$(STRIP)' \
901119ae
KT
575 'WINDRES=$(WINDRES)' \
576 'WINDMC=$(WINDMC)'
95ddd785
NN
577
578FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
579
580# Flags that are concerned with the location of the X11 include files
581# and library files
582#
583# NOTE: until the top-level is getting the values via autoconf, it only
584# causes problems to have this top-level Makefile overriding the autoconf-set
585# values in child directories. Only variables that don't conflict with
586# autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
587#
588X11_FLAGS_TO_PASS = \
589 'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
590 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
591
8efea775
PB
592# Flags to pass to stage2 and later makes.
593
594POSTSTAGE1_FLAGS_TO_PASS = \
00020c16
ILT
595 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
596 CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
597 GNATBIND="$${GNATBIND}" \
f61428ed
AO
598 LDFLAGS="$${LDFLAGS}" \
599 HOST_LIBS="$${HOST_LIBS}" \
8efea775
PB
600 "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
601
95ddd785 602# Flags to pass down to makes which are built with the target environment.
f41d6665
DJ
603# The double $ decreases the length of the command line; those variables
604# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The
1c8bd6a3
PB
605# *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
606# so we expand them here.
95ddd785
NN
607EXTRA_TARGET_FLAGS = \
608 'AR=$$(AR_FOR_TARGET)' \
f41d6665 609 'AS=$(COMPILER_AS_FOR_TARGET)' \
4a4a4e99
AO
610 'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
611 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
612 'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
613 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
95ddd785 614 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
4a4a4e99
AO
615 'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
616 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
f41d6665 617 'LD=$(COMPILER_LD_FOR_TARGET)' \
e3791243 618 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
4a4a4e99
AO
619 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
620 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
f41d6665 621 'NM=$(COMPILER_NM_FOR_TARGET)' \
d739199a 622 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
95ddd785 623 'RANLIB=$$(RANLIB_FOR_TARGET)' \
901119ae 624 'WINDRES=$$(WINDRES_FOR_TARGET)' \
4a4a4e99
AO
625 'WINDMC=$$(WINDMC_FOR_TARGET)' \
626 'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
627 "TFLAGS=$$TFLAGS"
95ddd785
NN
628
629TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
630
631# Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
632# unfortunately needs the native compiler and the target ar and
633# ranlib.
634# If any variables are added here, they must be added to do-*, below.
1358ccea 635# The BUILD_* variables are a special case, which are used for the gcc
95ddd785
NN
636# cross-building scheme.
637EXTRA_GCC_FLAGS = \
95ddd785 638 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
d4cd9d81
NN
639 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
640 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
641 "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
642 "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
cc11cc9b 643 "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
95ddd785 644
d29b8ad8 645GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
95ddd785 646
4a4a4e99 647@if gcc
e12c4094 648BUILD_CONFIG = @BUILD_CONFIG@
4a4a4e99
AO
649ifneq ($(BUILD_CONFIG),)
650include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk)
651endif
652@endif gcc
653
8b87bb96 654.PHONY: configure-host
d32ab992 655configure-host: [+
8b87bb96
NN
656 FOR host_modules +] \
657 maybe-configure-[+module+][+
658 ENDFOR host_modules +]
659.PHONY: configure-target
660configure-target: [+
661 FOR target_modules +] \
662 maybe-configure-target-[+module+][+
663 ENDFOR target_modules +]
95ddd785 664
f516a7da
PB
665# The target built for a native non-bootstrap build.
666.PHONY: all
1061f99e
PB
667all:
668@if gcc-bootstrap
2abefe3d 669 [ -f stage_final ] || echo stage3 > stage_final
1061f99e
PB
670 @r=`${PWD_COMMAND}`; export r; \
671 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
f41d6665 672 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
1061f99e 673@endif gcc-bootstrap
f41d6665 674 @: $(MAKE); $(unstage)
1061f99e
PB
675 @r=`${PWD_COMMAND}`; export r; \
676 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4a4a4e99 677@if gcc-bootstrap
0f501837 678 if [ -f stage_last ]; then \
a1fc946a 679 TFLAGS="$(STAGE$(shell test ! -f stage_last || sed s,^stage,, stage_last)_TFLAGS)"; \
2abefe3d 680 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
1061f99e 681 else \
4a4a4e99 682@endif gcc-bootstrap
31c98f49
AO
683 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
684@if gcc-bootstrap
685 ; \
394e9195 686 fi \
31c98f49 687@endif gcc-bootstrap
394e9195 688 && :
8b87bb96 689
23f6b2f9 690.PHONY: all-build
cc11cc9b
PB
691[+ FOR build_modules +]
692all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
693
8b87bb96 694.PHONY: all-host
cc11cc9b
PB
695[+ FOR host_modules +][+ IF bootstrap +]
696@if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
697all-host: maybe-all-[+module+][+ IF bootstrap +]
698@endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
699
8b87bb96 700.PHONY: all-target
cc11cc9b 701[+ FOR target_modules +][+ IF bootstrap +]
54fdc474 702@if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
cc11cc9b 703all-target: maybe-all-target-[+module+][+ IF bootstrap +]
54fdc474
DJ
704@endif target-[+module+]-no-bootstrap[+
705 ENDIF bootstrap +][+ ENDFOR target_modules +]
95ddd785
NN
706
707# Do a target for all the subdirectories. A ``make do-X'' will do a
708# ``make X'' in all subdirectories (because, in general, there is a
709# dependency (below) of X upon do-X, a ``make X'' will also do this,
710# but it may do additional work as well).
4977bab6 711[+ FOR recursive_targets +]
1a1e6b96 712.PHONY: do-[+make_target+]
1061f99e 713do-[+make_target+]:
f41d6665 714 @: $(MAKE); $(unstage)
e7c84bf8
PB
715 @r=`${PWD_COMMAND}`; export r; \
716 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
717 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
1061f99e 718 [+make_target+]-target
1061f99e 719
1358ccea
NN
720
721.PHONY: [+make_target+]-host
cc11cc9b
PB
722[+ FOR host_modules +]
723[+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
1358ccea
NN
724
725.PHONY: [+make_target+]-target
cc11cc9b
PB
726[+ FOR target_modules +]
727[+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
4977bab6
ZW
728[+ ENDFOR recursive_targets +]
729
95ddd785
NN
730# Here are the targets which correspond to the do-X targets.
731
9c4d2493
BM
732.PHONY: info installcheck dvi pdf html
733.PHONY: install-info install-pdf install-html
95ddd785
NN
734.PHONY: clean distclean mostlyclean maintainer-clean realclean
735.PHONY: local-clean local-distclean local-maintainer-clean
736info: do-info
737installcheck: do-installcheck
738dvi: do-dvi
b5422ad7 739pdf: do-pdf
f87a2b2e 740html: do-html
95ddd785 741
212f6dd0
NN
742# Make sure makeinfo is built before we do a `make info', if we're
743# in fact building texinfo.
744do-info: maybe-all-texinfo
95ddd785
NN
745
746install-info: do-install-info dir.info
8c90b13a 747 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
95ddd785 748 if [ -f dir.info ] ; then \
3fbe8e4a 749 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
95ddd785
NN
750 else true ; fi
751
9c4d2493
BM
752install-pdf: do-install-pdf
753
65d6e994
CD
754install-html: do-install-html
755
95ddd785
NN
756local-clean:
757 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
758
759local-distclean:
760 -rm -f Makefile config.status config.cache mh-frag mt-frag
f41d6665 761 -rm -f maybedep.tmp serdep.tmp
95ddd785
NN
762 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
763 rm -rf $(TARGET_SUBDIR); \
764 else true; fi
0c227849 765 -rm -rf $(BUILD_SUBDIR)
215c351a
PB
766 -if [ "$(HOST_SUBDIR)" != "." ]; then \
767 rm -rf $(HOST_SUBDIR); \
768 else true; fi
95ddd785
NN
769 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
770 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
771 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
772 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
773 -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
e50390fc 774 -find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
95ddd785
NN
775
776local-maintainer-clean:
777 @echo "This command is intended for maintainers to use;"
778 @echo "it deletes files that may require special tools to rebuild."
779
780clean: do-clean local-clean
781mostlyclean: do-mostlyclean local-clean
782distclean: do-distclean local-clean local-distclean
783maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
784maintainer-clean: local-distclean
785realclean: maintainer-clean
786
95ddd785
NN
787# Check target.
788
789.PHONY: check do-check
333a28b4 790check: do-check
95ddd785 791
4977bab6 792# Only include modules actually being configured and built.
1061f99e
PB
793.PHONY: check-host
794check-host: [+
7e2dbcef
NN
795 FOR host_modules +] \
796 maybe-check-[+module+][+
1061f99e
PB
797 ENDFOR host_modules +]
798
799.PHONY: check-target
800check-target: [+
7e2dbcef
NN
801 FOR target_modules +] \
802 maybe-check-target-[+module+][+
1061f99e
PB
803 ENDFOR target_modules +]
804
805do-check:
f41d6665 806 @: $(MAKE); $(unstage)
e7c84bf8
PB
807 @r=`${PWD_COMMAND}`; export r; \
808 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
809 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
95ddd785
NN
810
811# Automated reporting of test results.
812
813warning.log: build.log
814 $(srcdir)/contrib/warn_summary build.log > $@
815
816mail-report.log:
817 if test x'$(BOOT_CFLAGS)' != x''; then \
818 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
819 fi; \
820 $(srcdir)/contrib/test_summary -t >$@
821 chmod +x $@
822 echo If you really want to send e-mail, run ./$@ now
823
824mail-report-with-warnings.log: warning.log
825 if test x'$(BOOT_CFLAGS)' != x''; then \
826 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
827 fi; \
828 $(srcdir)/contrib/test_summary -t -i warning.log >$@
829 chmod +x $@
830 echo If you really want to send e-mail, run ./$@ now
831
832# Installation targets.
833
4977bab6 834.PHONY: install uninstall
1061f99e 835install:
f41d6665 836 @: $(MAKE); $(unstage)
e7c84bf8
PB
837 @r=`${PWD_COMMAND}`; export r; \
838 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
839 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
8b87bb96 840
7e2dbcef
NN
841.PHONY: install-host-nogcc
842install-host-nogcc: [+
3589b69e
PB
843 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
844 maybe-install-[+module+][+ ENDIF +][+
7e2dbcef
NN
845 ENDFOR host_modules +]
846
8b87bb96 847.PHONY: install-host
d32ab992 848install-host: [+
8b87bb96
NN
849 FOR host_modules +] \
850 maybe-install-[+module+][+
851 ENDFOR host_modules +]
7e2dbcef 852
8b87bb96
NN
853.PHONY: install-target
854install-target: [+
855 FOR target_modules +] \
856 maybe-install-target-[+module+][+
857 ENDFOR target_modules +]
95ddd785
NN
858
859uninstall:
860 @echo "the uninstall target is not supported in this tree"
861
95ddd785
NN
862.PHONY: install.all
863install.all: install-no-fixedincludes
864 @if [ -f ./gcc/Makefile ] ; then \
8c90b13a 865 r=`${PWD_COMMAND}` ; export r ; \
f41d6665 866 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 867 $(HOST_EXPORTS) \
88b5521b 868 (cd ./gcc && \
95ddd785
NN
869 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
870 else \
871 true ; \
872 fi
873
874# install-no-fixedincludes is used because Cygnus can not distribute
875# the fixed header files.
876.PHONY: install-no-fixedincludes
7e2dbcef 877install-no-fixedincludes: installdirs install-host-nogcc \
8b87bb96 878 install-target gcc-no-fixedincludes
95ddd785 879
4977bab6 880### other supporting targets
95ddd785 881
4977bab6
ZW
882MAKEDIRS= \
883 $(DESTDIR)$(prefix) \
884 $(DESTDIR)$(exec_prefix)
885.PHONY: installdirs
886installdirs: mkinstalldirs
887 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
888
889dir.info: do-install-info
890 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
3fbe8e4a 891 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
4977bab6
ZW
892 mv -f dir.info.new dir.info ; \
893 else true ; \
95ddd785
NN
894 fi
895
4977bab6
ZW
896dist:
897 @echo "Building a full distribution of this tree isn't done"
898 @echo "via 'make dist'. Check out the etc/ subdirectory"
899
900etags tags: TAGS
901
902# Right now this just builds TAGS in each subdirectory. emacs19 has the
903# ability to use several tags files at once, so there is probably no need
904# to combine them into one big TAGS file (like CVS 1.3 does). We could
905# (if we felt like it) have this Makefile write a piece of elisp which
906# the user could load to tell emacs19 where all the TAGS files we just
907# built are.
908TAGS: do-TAGS
909
25b42232
PB
910# ------------------------------------
911# Macros for configure and all targets
912# ------------------------------------
913
914[+ DEFINE configure +]
915.PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
916maybe-configure-[+prefix+][+module+]:
3ff3adad
PB
917@if gcc-bootstrap
918configure-[+prefix+][+module+]: stage_current
919@endif gcc-bootstrap
25b42232
PB
920@if [+prefix+][+module+]
921maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
3ff3adad 922configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
cc11cc9b
PB
923 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
924 @r=`${PWD_COMMAND}`; export r; \
f41d6665 925 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
cc11cc9b
PB
926 [+ IF check_multilibs
927 +]echo "Checking multilib configuration for [+module+]..."; \
f41d6665
DJ
928 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
929 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
930 if test -r [+subdir+]/[+module+]/multilib.out; then \
931 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
932 rm -f [+subdir+]/[+module+]/multilib.tmp; \
933 else \
934 rm -f [+subdir+]/[+module+]/Makefile; \
935 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
936 fi; \
937 else \
938 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
cc11cc9b
PB
939 fi; \
940 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
25b42232 941 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
f61428ed 942 [+exports+] [+extra_exports+] \
25b42232
PB
943 echo Configuring in [+subdir+]/[+module+]; \
944 cd "[+subdir+]/[+module+]" || exit 1; \
3aa83176 945 case $(srcdir) in \
215c351a 946 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
25b42232 947 *) topdir=`echo [+subdir+]/[+module+]/ | \
215c351a 948 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
3aa83176 949 esac; \
215c351a
PB
950 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
951 libsrcdir="$$s/[+module+]"; \
25b42232
PB
952 [+ IF no-config-site +]rm -f no-such-file || : ; \
953 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
e69bf64b
PB
954 [+args+] --build=${build_alias} --host=[+host_alias+] \
955 --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
3aa83176 956 || exit 1
25b42232 957@endif [+prefix+][+module+]
ce406537
PB
958
959[+ IF bootstrap +]
960[+ FOR bootstrap_stage +]
961.PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
962maybe-configure-stage[+id+]-[+prefix+][+module+]:
f41d6665 963@if [+prefix+][+module+]-bootstrap
ce406537 964maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
f41d6665 965configure-stage[+id+]-[+prefix+][+module+]:
cc11cc9b 966 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
f41d6665 967 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
cc11cc9b 968 @r=`${PWD_COMMAND}`; export r; \
ce406537 969 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4a4a4e99 970 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
cc11cc9b
PB
971 [+ IF check_multilibs
972 +]echo "Checking multilib configuration for [+module+]..."; \
f41d6665
DJ
973 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
974 if test -r [+subdir+]/[+module+]/multilib.out; then \
975 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
976 rm -f [+subdir+]/[+module+]/multilib.tmp; \
977 else \
978 rm -f [+subdir+]/[+module+]/Makefile; \
979 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
980 fi; \
981 else \
982 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
cc11cc9b
PB
983 fi; \
984 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
ce406537 985 [+exports+][+ IF prev +] \
4a4a4e99
AO
986 [+poststage1_exports+][+ ENDIF prev +][+ IF prefix +] \
987 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
988 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
989 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;[+ ELSE prefix +] \
990 CFLAGS="$(STAGE[+id+]_CFLAGS)"; export CFLAGS; \
f61428ed 991 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"; export CXXFLAGS;[+ IF prev +] \
4a4a4e99 992 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
f61428ed
AO
993 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +]; export LIBCFLAGS;[+
994 ENDIF prefix +] [+extra_exports+] \
ce406537 995 echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
f41d6665 996 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
ce406537
PB
997 cd [+subdir+]/[+module+] || exit 1; \
998 case $(srcdir) in \
999 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
1000 *) topdir=`echo [+subdir+]/[+module+]/ | \
1001 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
1002 esac; \
1003 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
1004 libsrcdir="$$s/[+module+]"; \
1005 $(SHELL) $${libsrcdir}/configure \
e69bf64b 1006 [+args+] --build=${build_alias} --host=[+host_alias+] \
4a4a4e99
AO
1007 --target=[+target_alias+] $${srcdiroption} [+ IF prev +]\
1008 --with-build-libsubdir=$(HOST_SUBDIR) [+ ENDIF prev +]\
1009 $(STAGE[+id+]_CONFIGURE_FLAGS)[+ IF extra_configure_flags +] \
1010 [+extra_configure_flags+][+ ENDIF extra_configure_flags +]
f41d6665 1011@endif [+prefix+][+module+]-bootstrap
ce406537
PB
1012[+ ENDFOR bootstrap_stage +]
1013[+ ENDIF bootstrap +]
25b42232
PB
1014[+ ENDDEF +]
1015
1016[+ DEFINE all +]
1017.PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
1018maybe-all-[+prefix+][+module+]:
3ff3adad
PB
1019@if gcc-bootstrap
1020all-[+prefix+][+module+]: stage_current
1021@endif gcc-bootstrap
25b42232
PB
1022@if [+prefix+][+module+]
1023TARGET-[+prefix+][+module+]=[+
e69bf64b 1024 IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
25b42232 1025maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
3ff3adad 1026all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
cc11cc9b
PB
1027 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
1028 @r=`${PWD_COMMAND}`; export r; \
8c90b13a 1029 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
f61428ed 1030 [+exports+] [+extra_exports+] \
25b42232 1031 (cd [+subdir+]/[+module+] && \
1c8bd6a3
PB
1032 $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+extra_make_flags+] \
1033 $(TARGET-[+prefix+][+module+]))
25b42232 1034@endif [+prefix+][+module+]
ce406537
PB
1035
1036[+ IF bootstrap +]
1037[+ FOR bootstrap_stage +]
1038.PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
1039.PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
1040maybe-all-stage[+id+]-[+prefix+][+module+]:
1041maybe-clean-stage[+id+]-[+prefix+][+module+]:
f41d6665 1042@if [+prefix+][+module+]-bootstrap
ce406537
PB
1043maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
1044all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
1061f99e 1045TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
ce406537 1046all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
cc11cc9b 1047 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
ce406537
PB
1048 @r=`${PWD_COMMAND}`; export r; \
1049 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4a4a4e99 1050 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
ce406537 1051 [+exports+][+ IF prev +] \
f61428ed 1052 [+poststage1_exports+][+ ENDIF prev +] [+extra_exports+] \
ce406537 1053 cd [+subdir+]/[+module+] && \
4a4a4e99
AO
1054 $(MAKE) $(BASE_FLAGS_TO_PASS)[+ IF prefix +] \
1055 CFLAGS="$(CFLAGS_FOR_TARGET)" \
1056 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
1057 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"[+ ELSE prefix +] \
1058 CFLAGS="$(STAGE[+id+]_CFLAGS)" \
f61428ed 1059 CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"[+ IF prev +] \
4a4a4e99
AO
1060 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1061 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +][+ ENDIF prefix +] \
1062 CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
1063 CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
1064 LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
1065 [+args+] [+
342b9200
PB
1066 IF prev +][+poststage1_args+][+ ENDIF prev
1067 +] [+extra_make_flags+] \
4a4a4e99 1068 TFLAGS="$(STAGE[+id+]_TFLAGS)" \
1061f99e 1069 $(TARGET-stage[+id+]-[+prefix+][+module+])
ce406537
PB
1070
1071maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
1072clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
1073clean-stage[+id+]-[+prefix+][+module+]:
995a5697
PB
1074 @if [ $(current_stage) = stage[+id+] ]; then \
1075 [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
1076 else \
1077 [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
1078 $(MAKE) stage[+id+]-start; \
1079 fi; \
ce406537
PB
1080 cd [+subdir+]/[+module+] && \
1081 $(MAKE) [+args+] [+ IF prev +] \
1082 [+poststage1_args+] [+ ENDIF prev +] \
342b9200 1083 [+extra_make_flags+] clean
f41d6665 1084@endif [+prefix+][+module+]-bootstrap
ce406537
PB
1085
1086[+ ENDFOR bootstrap_stage +]
1087[+ ENDIF bootstrap +]
25b42232
PB
1088[+ ENDDEF +]
1089
1090# --------------------------------------
1091# Modules which run on the build machine
1092# --------------------------------------
1093[+ FOR build_modules +]
1094[+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
e69bf64b
PB
1095 host_alias=(get "host" "${build_alias}")
1096 target_alias=(get "target" "${target_alias}")
25b42232
PB
1097 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
1098
f8c33439
JM
1099[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1100 args="$(EXTRA_BUILD_FLAGS)" +]
25b42232 1101[+ ENDFOR build_module +]
4977bab6
ZW
1102
1103# --------------------------------------
1104# Modules which run on the host machine
1105# --------------------------------------
1106[+ FOR host_modules +]
ce406537
PB
1107[+ configure prefix="" subdir="$(HOST_SUBDIR)"
1108 exports="$(HOST_EXPORTS)"
1109 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
e69bf64b
PB
1110 host_alias=(get "host" "${host_alias}")
1111 target_alias=(get "target" "${target_alias}")
25b42232 1112 args="$(HOST_CONFIGARGS)" +]
95ddd785 1113
ce406537
PB
1114[+ all prefix="" subdir="$(HOST_SUBDIR)"
1115 exports="$(HOST_EXPORTS)"
1116 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
1c8bd6a3 1117 args="$(EXTRA_HOST_FLAGS)"
ce406537 1118 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
4977bab6 1119
7e2dbcef
NN
1120.PHONY: check-[+module+] maybe-check-[+module+]
1121maybe-check-[+module+]:
60975492
PB
1122@if [+module+]
1123maybe-check-[+module+]: check-[+module+]
4977bab6 1124[+ IF no_check +]
4977bab6
ZW
1125check-[+module+]:
1126[+ ELIF no_check_cross +]
4977bab6
ZW
1127# This module is only tested in a native toolchain.
1128check-[+module+]:
f41d6665 1129 @: $(MAKE); $(unstage)
e89fbdfe 1130 @if [ '$(host)' = '$(target)' ] ; then \
8c90b13a
L
1131 r=`${PWD_COMMAND}`; export r; \
1132 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 1133 $(HOST_EXPORTS) \
215c351a 1134 (cd $(HOST_SUBDIR)/[+module+] && \
ef6e9bc0 1135 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
3aa83176
NN
1136 fi
1137[+ ELSE check +]
3aa83176 1138check-[+module+]:
f41d6665 1139 @: $(MAKE); $(unstage)
8c90b13a
L
1140 @r=`${PWD_COMMAND}`; export r; \
1141 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 1142 $(HOST_EXPORTS) \
215c351a
PB
1143 (cd $(HOST_SUBDIR)/[+module+] && \
1144 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
4977bab6 1145[+ ENDIF no_check +]
60975492 1146@endif [+module+]
4977bab6 1147
4977bab6
ZW
1148.PHONY: install-[+module+] maybe-install-[+module+]
1149maybe-install-[+module+]:
60975492
PB
1150@if [+module+]
1151maybe-install-[+module+]: install-[+module+]
7e2dbcef 1152[+ IF no_install +]
4977bab6
ZW
1153install-[+module+]:
1154[+ ELSE install +]
4977bab6 1155install-[+module+]: installdirs
f41d6665 1156 @: $(MAKE); $(unstage)
8c90b13a
L
1157 @r=`${PWD_COMMAND}`; export r; \
1158 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 1159 $(HOST_EXPORTS) \
215c351a 1160 (cd $(HOST_SUBDIR)/[+module+] && \
ace9ac7b 1161 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
4977bab6 1162[+ ENDIF no_install +]
60975492 1163@endif [+module+]
295f4e42 1164
b5422ad7 1165# Other targets (info, dvi, pdf, etc.)
295f4e42
NN
1166[+ FOR recursive_targets +]
1167.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1168maybe-[+make_target+]-[+module+]:
60975492
PB
1169@if [+module+]
1170maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
295f4e42
NN
1171[+ IF (match-value? = "missing" (get "make_target") ) +]
1172# [+module+] doesn't support [+make_target+].
1173[+make_target+]-[+module+]:
1174[+ ELSE +]
1175[+make_target+]-[+module+]: [+
1176 FOR depend +]\
1177 [+depend+]-[+module+] [+
1178 ENDFOR depend +]
f41d6665 1179 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1061f99e 1180 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
295f4e42
NN
1181 r=`${PWD_COMMAND}`; export r; \
1182 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 1183 $(HOST_EXPORTS) \
d32ab992 1184 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
295f4e42
NN
1185 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1186 done; \
1187 echo "Doing [+make_target+] in [+module+]" ; \
215c351a 1188 (cd $(HOST_SUBDIR)/[+module+] && \
295f4e42
NN
1189 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1190 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1191 "RANLIB=$${RANLIB}" \
901119ae 1192 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
d32ab992 1193 [+make_target+]) \
295f4e42
NN
1194 || exit 1
1195[+ ENDIF +]
60975492 1196@endif [+module+]
295f4e42 1197[+ ENDFOR recursive_targets +]
4977bab6
ZW
1198[+ ENDFOR host_modules +]
1199
1200# ---------------------------------------
1201# Modules which run on the target machine
1202# ---------------------------------------
1203[+ FOR target_modules +]
4977bab6 1204
25b42232
PB
1205[+ IF raw_cxx +]
1206[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
f41d6665 1207 check_multilibs=true
25b42232 1208 exports="$(RAW_CXX_TARGET_EXPORTS)"
e69bf64b
PB
1209 host_alias=(get "host" "${target_alias}")
1210 target_alias=(get "target" "${target_alias}")
25b42232
PB
1211 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1212
1213[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1214 exports="$(RAW_CXX_TARGET_EXPORTS)"
1c8bd6a3 1215 args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
25b42232
PB
1216[+ ELSE +]
1217[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
f41d6665 1218 check_multilibs=true
25b42232 1219 exports="$(NORMAL_TARGET_EXPORTS)"
e69bf64b
PB
1220 host_alias=(get "host" "${target_alias}")
1221 target_alias=(get "target" "${target_alias}")
25b42232
PB
1222 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1223
1224[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1225 exports="$(NORMAL_TARGET_EXPORTS)"
1c8bd6a3 1226 args="$(EXTRA_TARGET_FLAGS)" +]
25b42232 1227[+ ENDIF +]
7e2dbcef
NN
1228
1229.PHONY: check-target-[+module+] maybe-check-target-[+module+]
1230maybe-check-target-[+module+]:
60975492
PB
1231@if target-[+module+]
1232maybe-check-target-[+module+]: check-target-[+module+]
4977bab6
ZW
1233[+ IF no_check +]
1234# Dummy target for uncheckable module.
4977bab6
ZW
1235check-target-[+module+]:
1236[+ ELSE check +]
4977bab6 1237check-target-[+module+]:
f41d6665 1238 @: $(MAKE); $(unstage)
8c90b13a 1239 @r=`${PWD_COMMAND}`; export r; \
0bff65e7 1240 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1241IF raw_cxx +]
1242 $(RAW_CXX_TARGET_EXPORTS) \[+
1243ELSE normal_cxx +]
1244 $(NORMAL_TARGET_EXPORTS) \[+
1245ENDIF raw_cxx +]
3aa83176
NN
1246 (cd $(TARGET_SUBDIR)/[+module+] && \
1247 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1248 IF raw_cxx
1249 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1250 ENDIF raw_cxx
a52a0a7f 1251 +] [+extra_make_flags+] check)
4977bab6 1252[+ ENDIF no_check +]
60975492 1253@endif target-[+module+]
7e2dbcef 1254
4977bab6
ZW
1255.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1256maybe-install-target-[+module+]:
60975492
PB
1257@if target-[+module+]
1258maybe-install-target-[+module+]: install-target-[+module+]
7e2dbcef 1259[+ IF no_install +]
4977bab6
ZW
1260# Dummy target for uninstallable.
1261install-target-[+module+]:
1262[+ ELSE install +]
4977bab6 1263install-target-[+module+]: installdirs
f41d6665 1264 @: $(MAKE); $(unstage)
8c90b13a 1265 @r=`${PWD_COMMAND}`; export r; \
0bff65e7 1266 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1267IF raw_cxx +]
1268 $(RAW_CXX_TARGET_EXPORTS) \[+
1269ELSE normal_cxx +]
1270 $(NORMAL_TARGET_EXPORTS) \[+
1271ENDIF raw_cxx +]
3aa83176 1272 (cd $(TARGET_SUBDIR)/[+module+] && \
a52a0a7f 1273 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
4977bab6 1274[+ ENDIF no_install +]
60975492 1275@endif target-[+module+]
295f4e42 1276
b5422ad7 1277# Other targets (info, dvi, pdf, etc.)
295f4e42
NN
1278[+ FOR recursive_targets +]
1279.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1280maybe-[+make_target+]-target-[+module+]:
60975492
PB
1281@if target-[+module+]
1282maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
295f4e42
NN
1283[+ IF (match-value? = "missing" (get "make_target") ) +]
1284# [+module+] doesn't support [+make_target+].
1285[+make_target+]-target-[+module+]:
1286[+ ELSE +]
1287[+make_target+]-target-[+module+]: [+
1288 FOR depend +]\
1289 [+depend+]-target-[+module+] [+
1290 ENDFOR depend +]
f41d6665 1291 @: $(MAKE); $(unstage)
295f4e42
NN
1292 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1293 r=`${PWD_COMMAND}`; export r; \
0bff65e7 1294 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1295IF raw_cxx +]
1296 $(RAW_CXX_TARGET_EXPORTS) \[+
1297ELSE normal_cxx +]
1298 $(NORMAL_TARGET_EXPORTS) \[+
1299ENDIF raw_cxx +]
295f4e42
NN
1300 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1301 for flag in $(EXTRA_TARGET_FLAGS); do \
1302 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1303 done; \
1304 (cd $(TARGET_SUBDIR)/[+module+] && \
1305 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1306 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1307 "RANLIB=$${RANLIB}" \
901119ae 1308 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
a52a0a7f 1309 [+extra_make_flags+] [+make_target+]) \
295f4e42
NN
1310 || exit 1
1311[+ ENDIF +]
60975492 1312@endif target-[+module+]
295f4e42 1313[+ ENDFOR recursive_targets +]
4977bab6 1314[+ ENDFOR target_modules +]
95ddd785 1315
4977bab6
ZW
1316# ----------
1317# GCC module
1318# ----------
95ddd785 1319
f516a7da 1320@if gcc-no-bootstrap
95ddd785 1321.PHONY: cross
7c27e184 1322cross: all-build all-gas all-ld
8c90b13a
L
1323 @r=`${PWD_COMMAND}`; export r; \
1324 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1325 $(HOST_EXPORTS) \
95ddd785
NN
1326 echo "Building the C and C++ compiler"; \
1327 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
8c90b13a
L
1328 @r=`${PWD_COMMAND}`; export r; \
1329 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
95ddd785 1330 echo "Building runtime libraries"; \
ad6717df 1331 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
f516a7da 1332@endif gcc-no-bootstrap
95ddd785 1333
60975492 1334@if gcc
60911f14
SE
1335[+ FOR languages +]
1336.PHONY: check-gcc-[+language+] check-[+language+]
1337check-gcc-[+language+]:
1338 r=`${PWD_COMMAND}`; export r; \
1339 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1340 $(HOST_EXPORTS) \
1341 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]);
1342check-[+language+]: check-gcc-[+language+][+ IF lib-check-target +] [+ lib-check-target +][+ ENDIF lib-check-target +]
1343[+ ENDFOR languages +]
95ddd785 1344
4977bab6
ZW
1345# Install the gcc headers files, but not the fixed include files,
1346# which Cygnus is not allowed to distribute. This rule is very
1347# dependent on the workings of the gcc Makefile.in.
1348.PHONY: gcc-no-fixedincludes
1349gcc-no-fixedincludes:
1350 @if [ -f ./gcc/Makefile ]; then \
1351 rm -rf gcc/tmp-include; \
1352 mv gcc/include gcc/tmp-include 2>/dev/null; \
1353 mkdir gcc/include; \
1354 cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1355 touch gcc/stmp-fixinc gcc/include/fixed; \
1356 rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
8c90b13a
L
1357 r=`${PWD_COMMAND}`; export r; \
1358 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
a52a0a7f 1359 $(HOST_EXPORTS) \
88b5521b 1360 (cd ./gcc && \
4977bab6
ZW
1361 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1362 rm -rf gcc/include; \
1363 mv gcc/tmp-include gcc/include 2>/dev/null; \
1364 else true; fi
60975492 1365@endif gcc
295f4e42 1366
2805b53a
NN
1367# ---------------------
1368# GCC bootstrap support
1369# ---------------------
1370
d32ab992
PB
1371# We track the current stage (the one in 'gcc') in the stage_current file.
1372# stage_last instead tracks the stage that was built last. These targets
1373# are dummy when toplevel bootstrap is not active.
1374
1061f99e 1375# While making host and target tools, symlinks to the final stage must be
f41d6665
DJ
1376# there, so $(unstage) should be run at various points. To avoid excessive
1377# recursive invocations of make, we "inline" them using a variable. These
1378# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1379# to avoid warnings from the GNU Make job server.
1061f99e
PB
1380
1381unstage = :
1382stage = :
cc11cc9b 1383current_stage = ""
1061f99e 1384
d32ab992 1385@if gcc-bootstrap
9bd6112c 1386unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
d19bca38 1387stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
cc11cc9b 1388current_stage = "`cat stage_current 2> /dev/null`"
d32ab992
PB
1389@endif gcc-bootstrap
1390
1061f99e
PB
1391.PHONY: unstage stage
1392unstage:
f41d6665 1393 @: $(MAKE); $(unstage)
d32ab992 1394stage:
f41d6665 1395 @: $(MAKE); $(stage)
d32ab992 1396
2d309510
PB
1397# Disable commands for lean bootstrap.
1398LEAN = false
1399
148907ea
PB
1400# We name the build directories for the various stages "stage1-gcc",
1401# "stage2-gcc","stage3-gcc", etc.
1402
1403# Since the 'compare' process will fail (on debugging information) if any
1404# directory names are different, we need to link the gcc directory for
f41d6665 1405# the previous stage to a constant name ('prev-gcc'), and to make the name of
148907ea
PB
1406# the build directories constant as well. For the latter, we use naked names
1407# like 'gcc', because the scripts in that directory assume it. We use
1408# mv on platforms where symlinks to directories do not work or are not
1409# reliable.
1410
2805b53a
NN
1411# 'touch' doesn't work right on some platforms.
1412STAMP = echo timestamp >
1413
148907ea
PB
1414# We only want to compare .o files, so set this!
1415objext = .o
2805b53a 1416
148907ea 1417[+ FOR bootstrap-stage +]
f516a7da 1418.PHONY: stage[+id+]-start stage[+id+]-end
148907ea 1419
ad6717df 1420stage[+id+]-start::
f41d6665 1421 @: $(MAKE); $(stage); \
d32ab992 1422 echo stage[+id+] > stage_current ; \
215c351a 1423 echo stage[+id+] > stage_last; \
f41d6665 1424 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
215c351a 1425 FOR host_modules +][+ IF bootstrap +]
7c27e184 1426@if [+ module +]
215c351a
PB
1427 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1428 mkdir stage[+id+]-[+module+]; \
2d309510
PB
1429 mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1430 mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
f41d6665
DJ
1431@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1432 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1433 mkdir stage[+id+]-$(TARGET_SUBDIR); \
2d309510
PB
1434 mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1435 mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
148907ea 1436
2d309510 1437stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
7c27e184 1438@if [+ module +]
2d309510
PB
1439 @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1440 cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1441 mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
f41d6665
DJ
1442 fi
1443@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1444 @if test -d $(TARGET_SUBDIR) ; then \
2d309510
PB
1445 mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1446 mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
f41d6665 1447 fi
2d309510 1448 rm -f stage_current
148907ea 1449
8024d75e 1450# Bubble a bug fix through all the stages up to stage [+id+]. They are
f41d6665 1451# remade, but not reconfigured. The next stage (if any) will not be
cdce5c41 1452# reconfigured either.
f516a7da 1453.PHONY: stage[+id+]-bubble
2d309510 1454stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
e7c84bf8
PB
1455 @r=`${PWD_COMMAND}`; export r; \
1456 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1457 if test -f stage[+id+]-lean [+
ce521a9c
PB
1458 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1459 echo Skipping rebuild of stage[+id+] ; \
1460 else \
2d309510
PB
1461 $(MAKE) stage[+id+]-start; \[+IF lean +]
1462 if $(LEAN); then \
1463 rm -rf stage[+lean+]-* ; \
1464 $(STAMP) stage[+lean+]-lean ; \
1465 fi; \[+ ENDIF lean +]
1061f99e 1466 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
2abefe3d 1467 fi[+ IF compare-target +]
d19bca38 1468 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
7c27e184 1469
45f366ab 1470.PHONY: all-stage[+id+] clean-stage[+id+]
45f366ab 1471do-clean: clean-stage[+id+]
2805b53a 1472
7c27e184
PB
1473# FIXME: Will not need to be conditional when toplevel bootstrap is the
1474# only possibility, but now it conflicts with no-bootstrap rules
1475@if gcc-bootstrap
148907ea 1476[+ IF compare-target +]
ce521a9c 1477[+compare-target+]:
e7c84bf8
PB
1478 @r=`${PWD_COMMAND}`; export r; \
1479 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1480 if test -f stage[+prev+]-lean; then \
ce521a9c
PB
1481 echo Cannot compare object files as stage [+prev+] was deleted. ; \
1482 exit 0 ; \
1483 fi; \
f41d6665 1484 : $(MAKE); $(stage); \
2805b53a 1485 rm -f .bad_compare ; \
cc11cc9b 1486 echo Comparing stages [+prev+] and [+id+] ; \
70cb2d9f
AO
1487 sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \
1488 files=`find stage[+id+]-* -name "*$(objext)" -print | \
1489 sed -n s,^stage$$sed-,,p` ; \
2805b53a 1490 for file in $${files} ; do \
70cb2d9f
AO
1491 f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \
1492 if test ! -f $$f1; then continue; fi; \
bb286d71 1493 $(do-[+compare-target+]) > /dev/null 2>&1; \
1061f99e
PB
1494 if test $$? -eq 1; then \
1495 case $$file in \
f2689b09 1496 @compare_exclusions@) \
1061f99e
PB
1497 echo warning: $$file differs ;; \
1498 *) \
1499 echo $$file differs >> .bad_compare ;; \
1500 esac ; \
1501 fi ; \
2805b53a
NN
1502 done ; \
1503 if [ -f .bad_compare ]; then \
1504 echo "Bootstrap comparison failure!"; \
1505 cat .bad_compare; \
1506 exit 1; \
1507 else \
cc11cc9b 1508 echo Comparison successful.; \
2805b53a 1509 fi ; \
ce521a9c 1510 $(STAMP) [+compare-target+][+ IF prev +]
2d309510
PB
1511 if $(LEAN); then \
1512 rm -rf stage[+prev+]-*; \
1513 $(STAMP) stage[+prev+]-lean; \
1514 fi[+ ENDIF prev +]
148907ea
PB
1515[+ ENDIF compare-target +]
1516
1517[+ IF bootstrap-target +]
2d309510 1518.PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
2abefe3d
PB
1519[+bootstrap-target+]:
1520 echo stage[+id+] > stage_final
1521 @r=`${PWD_COMMAND}`; export r; \
1522 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1523 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
f41d6665 1524 @: $(MAKE); $(unstage)
2abefe3d
PB
1525 @r=`${PWD_COMMAND}`; export r; \
1526 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4a4a4e99 1527 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
2abefe3d 1528 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
2d309510
PB
1529
1530[+bootstrap-target+]-lean:
1531 echo stage[+id+] > stage_final
1532 @r=`${PWD_COMMAND}`; export r; \
1533 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1534 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1535 @: $(MAKE); $(unstage)
1536 @r=`${PWD_COMMAND}`; export r; \
1537 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4a4a4e99 1538 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
2d309510 1539 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
148907ea
PB
1540[+ ENDIF bootstrap-target +]
1541
45f366ab 1542# Rules to wipe a stage and all the following ones, also used for cleanstrap
ad6717df 1543[+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
45f366ab 1544.PHONY: distclean-stage[+id+]
ad6717df 1545distclean-stage[+id+]::
f41d6665 1546 @: $(MAKE); $(stage)
a19e8f64 1547 @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
ce521a9c 1548 rm -rf stage[+id+]-* [+
148907ea 1549 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
148907ea
PB
1550
1551[+ IF cleanstrap-target +]
1552.PHONY: [+cleanstrap-target+]
a19e8f64
PB
1553[+cleanstrap-target+]: do-distclean local-clean
1554 echo stage[+id+] > stage_final
1555 @r=`${PWD_COMMAND}`; export r; \
1556 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1557 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1558 @: $(MAKE); $(unstage)
1559 @r=`${PWD_COMMAND}`; export r; \
1560 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4a4a4e99 1561 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
a19e8f64 1562 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
148907ea 1563[+ ENDIF cleanstrap-target +]
7c27e184 1564@endif gcc-bootstrap
148907ea
PB
1565
1566[+ ENDFOR bootstrap-stage +]
ad6717df 1567
c7870f5d
PB
1568stageprofile-end::
1569 $(MAKE) distclean-stagefeedback
ad6717df 1570
c7870f5d 1571stagefeedback-start::
ad6717df
PB
1572 @r=`${PWD_COMMAND}`; export r; \
1573 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
c7870f5d
PB
1574 for i in prev-*; do \
1575 j=`echo $$i | sed s/^prev-//` ; \
1576 cd $$r/$$i && \
1577 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1578 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1579 done
03a91701 1580
45f366ab 1581@if gcc-bootstrap
45f366ab 1582do-distclean: distclean-stage1
cc11cc9b
PB
1583
1584# Provide a GCC build when we're building target libraries. This does
1585# not work as a dependency, just as the minimum necessary to avoid errors.
1586stage_last:
ee04b574
AS
1587 @r=`${PWD_COMMAND}`; export r; \
1588 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
cc11cc9b 1589 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
45f366ab 1590
3ff3adad
PB
1591# Same as unstage, but not phony and defaulting to stage1-start. We place
1592# it in the dependency so that for example `make -j3 all-gcc' works.
1593stage_current:
1594 @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1595
cc11cc9b 1596.PHONY: restrap
c6b196de 1597restrap::
cc11cc9b 1598 @: $(MAKE); $(stage)
4a4a4e99
AO
1599 rm -rf stage1-$(TARGET_SUBDIR)[+ FOR bootstrap-stage +][+ IF prev
1600 +] stage[+id+]-*[+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
c6b196de 1601restrap:: all
e9a54b07 1602@endif gcc-bootstrap
cc11cc9b 1603
4977bab6
ZW
1604# --------------------------------------
1605# Dependencies between different modules
1606# --------------------------------------
1607
3589b69e 1608# Generic dependencies for target modules on host stuff, especially gcc
cc11cc9b
PB
1609@if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1610 +][+ FOR bootstrap_stage +]
1611configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1612 ENDFOR +][+ ELSE bootstrap +]
1613configure-target-[+module+]: stage_last[+
1614 ENDIF bootstrap +][+ ENDFOR target_modules +]
1615@endif gcc-bootstrap
1616
fa958513 1617@if gcc-no-bootstrap[+ FOR target_modules +]
cc11cc9b 1618configure-target-[+module+]: maybe-all-gcc[+
fa958513 1619 ENDFOR target_modules +]
cc11cc9b
PB
1620@endif gcc-no-bootstrap
1621
3589b69e 1622
4977bab6
ZW
1623# There are two types of dependencies here: 'hard' dependencies, where one
1624# module simply won't build without the other; and 'soft' dependencies, where
1625# if the depended-on module is missing, the depending module will do without
1626# or find a substitute somewhere (perhaps installed). Soft dependencies
3589b69e 1627# are made here to depend on a 'maybe-' target. If you're not sure,
4977bab6
ZW
1628# it's safer to use a soft dependency.
1629
3589b69e
PB
1630[+ ;; These Scheme functions build the bulk of the dependencies.
1631 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
cdce5c41 1632 ;; where "maybe-" is only included if HARD is not true, and all-gcc
3589b69e
PB
1633 ;; is taken from VAR-NAME.
1634 (define dep-target (lambda (module-kind var-name hard)
1635 (string-append
1636 (if hard "" "maybe-")
1637 (dep-subtarget var-name)
1638 module-kind
1639 (dep-module var-name)
1640 )))
1641
1642 ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
7c27e184 1643 (define make-dep (lambda (module-kind on-kind)
3589b69e
PB
1644 (string-append
1645 (dep-target module-kind "module" #t) ": "
7c27e184 1646 (dep-target on-kind "on" (exist? "hard")))))
3589b69e
PB
1647
1648 ;; dep-subtarget extracts everything up to the first dash in the given
1649 ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1650 (define dep-subtarget (lambda (var-name)
1651 (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1652
1653 ;; dep-module extracts everything up to the first dash in the given
1654 ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1655 (define dep-module (lambda (var-name)
1656 (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1657
1658 ;; dep-stage builds a string for the prefix of a bootstrap stage.
1659 (define dep-stage (lambda ()
1660 (string-append
1661 "stage"
1662 (get "id")
1663 "-")))
1664
1665 ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1666 ;; but is written in Scheme.
1667 (define dep-maybe (lambda ()
1668 (if (exist? "hard") "" "maybe-")))
1669
893f1e87
MK
1670 ;; dep-kind returns "normal" if the dependency is on an "install" target,
1671 ;; or if either module is not bootstrapped. It returns "bootstrap" for
3589b69e
PB
1672 ;; configure or build dependencies between bootstrapped modules; it returns
1673 ;; "prebootstrap" for configure or build dependencies of bootstrapped
7c27e184 1674 ;; modules on a build module (e.g. all-gcc on all-build-bison). All this
3589b69e
PB
1675 ;; is only necessary for host modules.
1676 (define dep-kind (lambda ()
7c27e184
PB
1677 (if (and (hash-ref boot-modules (dep-module "module"))
1678 (=* (dep-module "on") "build-"))
1679 "prebootstrap"
3589b69e 1680
7c27e184 1681 (if (or (= (dep-subtarget "on") "install-")
893f1e87
MK
1682 (not (hash-ref boot-modules (dep-module "module")))
1683 (not (hash-ref boot-modules (dep-module "on"))))
7c27e184
PB
1684 "normal"
1685 "bootstrap"))))
3589b69e
PB
1686
1687 ;; We now build the hash table that is used by dep-kind.
1688 (define boot-modules (make-hash-table 113))
3589b69e
PB
1689+]
1690
1691[+ FOR host_modules +][+
1692 (if (exist? "bootstrap")
1693 (hash-create-handle! boot-modules (get "module") #t))
1694 "" +][+ ENDFOR host_modules +]
2dfbef6d
PB
1695[+ FOR target_modules +][+
1696 (if (exist? "bootstrap")
1697 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1698 "" +][+ ENDFOR target_modules +]
3589b69e
PB
1699
1700# With all the machinery above in place, it is pretty easy to generate
1701# dependencies. Host dependencies are a bit more complex because we have
1702# to check for bootstrap/prebootstrap dependencies. To resolve
1703# prebootstrap dependencies, prebootstrap modules are gathered in
1704# a hash table.
7c27e184
PB
1705[+ FOR dependencies +][+ (make-dep "" "") +]
1706[+ CASE (dep-kind) +]
1707[+ == "prebootstrap"
3589b69e 1708 +][+ FOR bootstrap_stage +]
7c27e184
PB
1709[+ (make-dep (dep-stage) "") +][+
1710 ENDFOR bootstrap_stage +]
7c27e184
PB
1711[+ == "bootstrap"
1712 +][+ FOR bootstrap_stage +]
1713[+ (make-dep (dep-stage) (dep-stage)) +][+
3589b69e
PB
1714 ENDFOR bootstrap_stage +]
1715[+ ESAC +][+
1716ENDFOR dependencies +]
1717
fa958513
DJ
1718# Dependencies for target modules on other target modules are
1719# described by lang_env_dependencies; the defaults apply to anything
1720# not mentioned there.
1721[+
1722 ;; Predicate for whether LANG was specified in lang_env_dependencies.
1723 (define lang-dep (lambda (lang)
1724 (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1725
1726 ;; Build the hash table we will need.
1727 (define lang-env-deps (make-hash-table 7))
1728+][+ FOR lang_env_dependencies +][+
1729 (if (exist? "cxx")
1730 (hash-create-handle! lang-env-deps
1731 (string-append (get "module") "-" "cxx") #t))
1732
1733 (if (exist? "no_c")
1734 (hash-create-handle! lang-env-deps
1735 (string-append (get "module") "-" "no_c") #t))
1736
1737 (if (exist? "no_gcc")
1738 (hash-create-handle! lang-env-deps
1739 (string-append (get "module") "-" "no_gcc") #t))
1740 "" +][+ ENDFOR lang_env_dependencies +]
1741
1742@if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1743 +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1744configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1745 ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1746@endif gcc-bootstrap
1747
1748@if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1749configure-target-[+module+]: maybe-all-target-libgcc[+
1750 ENDIF +][+ ENDFOR target_modules +]
1751@endif gcc-no-bootstrap
1752
1753[+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1754configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1755 ENDIF +][+ IF (lang-dep "cxx") +]
1756configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1757 ENDIF +]
1758[+ ENDFOR target_modules +]
1759
ef9db8d5 1760CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
0dffceed 1761GDB_TK = @GDB_TK@
ef9db8d5
DJ
1762INSTALL_GDB_TK = @INSTALL_GDB_TK@
1763configure-gdb: $(CONFIGURE_GDB_TK)
3589b69e 1764all-gdb: $(gdbnlmrequirements) $(GDB_TK)
ef9db8d5 1765install-gdb: $(INSTALL_GDB_TK)
95ddd785 1766
4977bab6
ZW
1767# Serialization dependencies. Host configures don't work well in parallel to
1768# each other, due to contention over config.cache. Target configures and
1769# build configures are similar.
1770@serialization_dependencies@
95ddd785 1771
4977bab6
ZW
1772# --------------------------------
1773# Regenerating top level configury
1774# --------------------------------
95ddd785
NN
1775
1776# Rebuilding Makefile.in, using autogen.
e245b0ea 1777AUTOGEN = autogen
ee03dc5e 1778$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
e245b0ea 1779 cd $(srcdir) && $(AUTOGEN) Makefile.def
95ddd785 1780
671aa708 1781# Rebuilding Makefile.
e245b0ea
AO
1782Makefile: $(srcdir)/Makefile.in config.status
1783 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1784
191dd2c9 1785config.status: configure
e75f9147 1786 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
95ddd785 1787
671aa708 1788# Rebuilding configure.
e245b0ea 1789AUTOCONF = autoconf
18c04407
RW
1790$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
1791 $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4
e245b0ea 1792 cd $(srcdir) && $(AUTOCONF)
95ddd785 1793
93c834b7
NN
1794# ------------------------------
1795# Special directives to GNU Make
1796# ------------------------------
1797
93c834b7
NN
1798# Don't pass command-line variables to submakes.
1799.NOEXPORT:
1800MAKEOVERRIDES=
1801
95ddd785 1802# end of Makefile.in