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