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