]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - Makefile.tpl
* resolve.cc (Symbol_table::resolve): Don't complain about defined
[thirdparty/binutils-gdb.git] / Makefile.tpl
CommitLineData
52d7cdee 1[+ AutoGen5 template -*- Mode: Makefile -*-
405ea7a0
NN
2in
3+]
4
5# Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
6#
7# Makefile for directory with subdirs to build.
8# Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1b05fbbd
AO
9# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
10# Free Software Foundation
405ea7a0
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
14# the Free Software Foundation; either version 2 of the License, or
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
23# along with this program; if not, write to the Free Software
6e4d0bcb 24# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
405ea7a0
NN
25#
26
0bb6ea20
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
50212802
NN
35# -------------------------------
36# Standard Autoconf-set variables
37# -------------------------------
583d52d7 38VPATH=@srcdir@
583d52d7 39
c6b750e1 40build_alias=@build_noncanonical@
4b900473
PB
41build_vendor=@build_vendor@
42build_os=@build_os@
7f121bbf 43build=@build@
c6b750e1 44host_alias=@host_noncanonical@
4b900473
PB
45host_vendor=@host_vendor@
46host_os=@host_os@
7f121bbf 47host=@host@
c6b750e1 48target_alias=@target_noncanonical@
4b900473
PB
49target_vendor=@target_vendor@
50target_os=@target_os@
7f121bbf 51target=@target@
583d52d7 52
50212802 53program_transform_name = @program_transform_name@
c66d951e
NN
54
55prefix = @prefix@
56exec_prefix = @exec_prefix@
57
50212802
NN
58srcdir = @srcdir@
59
c66d951e
NN
60bindir = @bindir@
61sbindir = @sbindir@
62libexecdir = @libexecdir@
63datadir = @datadir@
64sysconfdir = @sysconfdir@
65sharedstatedir = @sharedstatedir@
66localstatedir = @localstatedir@
67libdir = @libdir@
68includedir = @includedir@
69oldincludedir = @oldincludedir@
70infodir = @infodir@
108a6f8e
CD
71datarootdir = @datarootdir@
72docdir = @docdir@
a3ca38d2 73pdfdir = @pdfdir@
108a6f8e 74htmldir = @htmldir@
c66d951e 75mandir = @mandir@
405ea7a0
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
405ea7a0 85
e5c3f801
NN
86INSTALL = @INSTALL@
87INSTALL_PROGRAM = @INSTALL_PROGRAM@
88INSTALL_SCRIPT = @INSTALL_SCRIPT@
89INSTALL_DATA = @INSTALL_DATA@
656fdd47
PB
90LN = @LN@
91LN_S = @LN_S@
77d7106f
AM
92MAINT = @MAINT@
93MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
94MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
405ea7a0 95
50212802
NN
96# -------------------------------------------------
97# Miscellaneous non-standard autoconf-set variables
98# -------------------------------------------------
405ea7a0 99
50212802
NN
100# The gcc driver likes to know the arguments it was configured with.
101TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
405ea7a0 102
50212802
NN
103tooldir = @tooldir@
104build_tooldir = @build_tooldir@
405ea7a0 105
50212802 106GDB_NLM_DEPS =
405ea7a0 107
50212802
NN
108# This is the name of the environment variable used for the path to
109# the libraries.
110RPATH_ENVVAR = @RPATH_ENVVAR@
405ea7a0 111
3bbd2f8f
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
50212802
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.
a7254363 121BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
6a9cf61e
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
378fce5b 135# This is the list of variables to export in the environment when
6a9cf61e 136# configuring subdirectories for the build system.
378fce5b 137BUILD_EXPORTS = \
6a9cf61e 138 $(BASE_EXPORTS) \
378fce5b
DD
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; \
0c24b341
NC
153 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
154 WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC;
50212802 155
6641ce42 156# These variables must be set on the make command line for directories
7582fb4a 157# built for the build system to override those in BASE_FLAGS_TO_PASSS.
6641ce42
JM
158EXTRA_BUILD_FLAGS = \
159 CFLAGS="$(CFLAGS_FOR_BUILD)" \
160 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
161
50212802
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@
b00612cc
PB
167# Host programs are put under this directory, which is . except if building
168# with srcdir=..
169HOST_SUBDIR = @host_subdir@
378fce5b 170# This is the list of variables to export in the environment when
be01d343
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.
378fce5b 173HOST_EXPORTS = \
6a9cf61e 174 $(BASE_EXPORTS) \
378fce5b 175 CC="$(CC)"; export CC; \
da888c87 176 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
378fce5b
DD
177 CFLAGS="$(CFLAGS)"; export CFLAGS; \
178 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
179 CXX="$(CXX)"; export CXX; \
180 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
1b05fbbd
AO
181 GCJ="$(GCJ)"; export GCJ; \
182 GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
378fce5b
DD
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; \
0c24b341 192 WINDMC="$(WINDMC)"; export WINDMC; \
378fce5b 193 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
95b6a1f2 194 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
be01d343
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; \
378fce5b
DD
202 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
203 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
315b3b02 204 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
e28c595f
JM
205 PPLLIBS="$(HOST_PPLLIBS)"; export PPLLIBS; \
206 PPLINC="$(HOST_PPLINC)"; export PPLINC; \
207 CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \
208 CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \
f70224b5
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
e90269c8 212 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
378fce5b
DD
213
214# Similar, for later GCC stages.
d545f33b 215POSTSTAGE1_HOST_EXPORTS = \
7ffa0b57 216 $(HOST_EXPORTS) \
b00612cc 217 CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
1b05fbbd
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; \
dc17c78c 221 GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND \
caee866a 222 LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
50212802 223
50212802
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.
a7254363 228TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
378fce5b 229# This is the list of variables to export in the environment when
6a9cf61e 230# configuring subdirectories for the host system.
378fce5b 231BASE_TARGET_EXPORTS = \
6a9cf61e 232 $(BASE_EXPORTS) \
378fce5b 233 AR="$(AR_FOR_TARGET)"; export AR; \
be01d343 234 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
1b05fbbd
AO
235 CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
236 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
378fce5b 237 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
06bcb89d 238 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
1b05fbbd
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; \
378fce5b 242 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
be01d343 243 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
378fce5b 244 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
7e0f7140 245 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
be01d343 246 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
5ae72758 247 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
378fce5b 248 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
7e0f7140 249 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
315b3b02 250 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
0c24b341 251 WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
e90269c8 252 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
378fce5b
DD
253
254RAW_CXX_TARGET_EXPORTS = \
255 $(BASE_TARGET_EXPORTS) \
256 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
1b05fbbd 257 CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
378fce5b
DD
258
259NORMAL_TARGET_EXPORTS = \
260 $(BASE_TARGET_EXPORTS) \
1b05fbbd 261 CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
50212802 262
4b1cb4fe
DD
263# Where to find GMP
264HOST_GMPLIBS = @gmplibs@
265HOST_GMPINC = @gmpinc@
266
e28c595f
JM
267# Where to find PPL
268HOST_PPLLIBS = @ppllibs@
269HOST_PPLINC = @pplinc@
270
271# Where to find CLOOG
272HOST_CLOOGLIBS = @clooglibs@
273HOST_CLOOGINC = @clooginc@
274
50212802
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.
b40e3958
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}
50212802
NN
288
289# compilers to use to create programs which must be run in the build
290# environment.
b5714970
PB
291AR_FOR_BUILD = @AR_FOR_BUILD@
292AS_FOR_BUILD = @AS_FOR_BUILD@
50212802 293CC_FOR_BUILD = @CC_FOR_BUILD@
5fbad20a 294CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
b5714970
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@
50212802
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.
50212802
NN
309BUILD_PREFIX = @BUILD_PREFIX@
310BUILD_PREFIX_1 = @BUILD_PREFIX_1@
405ea7a0 311
0df3d27f
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
f6d183c0 315BOOT_LDFLAGS=
c325a203 316BOOT_ADAFLAGS=-gnatpg -gnata
0df3d27f 317
be01d343
PB
318BISON = @BISON@
319YACC = @YACC@
320FLEX = @FLEX@
321LEX = @LEX@
322M4 = @M4@
323MAKEINFO = @MAKEINFO@
324EXPECT = @EXPECT@
325RUNTEST = @RUNTEST@
405ea7a0
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.
62a3fc85
DD
330# (Default to avoid splitting info files by setting the threshold high.)
331MAKEINFOFLAGS = --split-size=5000000
405ea7a0 332
50212802
NN
333# ---------------------------------------------
334# Programs producing files for the HOST machine
335# ---------------------------------------------
405ea7a0 336
50212802 337AS = @AS@
50212802
NN
338AR = @AR@
339AR_FLAGS = rc
50212802 340CC = @CC@
50212802 341CXX = @CXX@
50212802 342DLLTOOL = @DLLTOOL@
50212802 343LD = @LD@
be01d343
PB
344LIPO = @LIPO@
345NM = @NM@
80911fe1 346OBJDUMP = @OBJDUMP@
50212802 347RANLIB = @RANLIB@
be01d343 348STRIP = @STRIP@
50212802 349WINDRES = @WINDRES@
0c24b341 350WINDMC = @WINDMC@
405ea7a0 351
a0323144
PB
352GNATBIND = @GNATBIND@
353GNATMAKE = @GNATMAKE@
354
be01d343 355CFLAGS = @CFLAGS@
b2edfdd2 356LDFLAGS = @LDFLAGS@
be01d343
PB
357LIBCFLAGS = $(CFLAGS)
358CXXFLAGS = @CXXFLAGS@
359LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
50212802 360
1b05fbbd
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
8a0d8a5c
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
1b05fbbd 382STAGE1_CFLAGS = @stage1_cflags@
8a0d8a5c
PB
383STAGE1_CHECKING=@stage1_checking@
384STAGE1_LANGUAGES=@stage1_languages@
1b05fbbd
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)"
8a0d8a5c 393
1b05fbbd
AO
394STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
395STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
8520c408 396
1b05fbbd
AO
397STAGEfeedback_CFLAGS = $(STAGE3_CFLAGS) -fprofile-use
398STAGEfeedback_TFLAGS = $(STAGE3_TFLAGS)
7f6ef0c0 399
8520c408
AO
400do-compare = @do_compare@
401do-compare3 = $(do-compare)
8520c408 402
50212802
NN
403# -----------------------------------------------
404# Programs producing files for the TARGET machine
405# -----------------------------------------------
405ea7a0 406
50212802 407AR_FOR_TARGET=@AR_FOR_TARGET@
852e5f18 408AS_FOR_TARGET=@AS_FOR_TARGET@
1b05fbbd 409CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@
55db4b87 410
50212802
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.
1b05fbbd
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@
852e5f18 420DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
50212802 421LD_FOR_TARGET=@LD_FOR_TARGET@
50212802 422
7e0f7140 423LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
50212802 424NM_FOR_TARGET=@NM_FOR_TARGET@
5ae72758 425OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
852e5f18 426RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
7e0f7140 427STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
50212802 428WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
0c24b341 429WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
405ea7a0 430
be01d343
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
7f6ef0c0
PB
435CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@
436CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
7f6ef0c0 437
be01d343
PB
438LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
439LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
7582fb4a 440LDFLAGS_FOR_TARGET =
50212802 441
1b05fbbd
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
50212802
NN
448# ------------------------------------
449# Miscellaneous targets and flag lists
450# ------------------------------------
451
405ea7a0
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.
f70224b5 454all:
405ea7a0 455
405ea7a0 456#### host and target specific makefile fragments come in here.
a0da8069
NN
457@target_makefile_frag@
458@alphaieee_frag@
459@ospace_frag@
460@host_makefile_frag@
405ea7a0
NN
461###
462
e90269c8
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
3bbd2f8f 483HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR):
e90269c8
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
405ea7a0 494# Flags to pass down to all sub-makes.
c52c6897
PB
495BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
496 "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
1b05fbbd
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)" \
10ecffb9 501 "CONFIG_SHELL=$(SHELL)" \
12f0bd74 502 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"
405ea7a0 503
55db4b87
PB
504# We leave this in just in case, but it is not needed anymore.
505RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
656fdd47 506
405ea7a0
NN
507# Flags to pass down to most sub-makes, in which we're building with
508# the host environment.
405ea7a0
NN
509EXTRA_HOST_FLAGS = \
510 'AR=$(AR)' \
511 'AS=$(AS)' \
512 'CC=$(CC)' \
513 'CXX=$(CXX)' \
514 'DLLTOOL=$(DLLTOOL)' \
1b05fbbd
AO
515 'GCJ=$(GCJ)' \
516 'GFORTRAN=$(GFORTRAN)' \
405ea7a0 517 'LD=$(LD)' \
be01d343 518 'LIPO=$(LIPO)' \
405ea7a0 519 'NM=$(NM)' \
80911fe1 520 'OBJDUMP=$(OBJDUMP)' \
b9459e83 521 'RANLIB=$(RANLIB)' \
be01d343 522 'STRIP=$(STRIP)' \
0c24b341
NC
523 'WINDRES=$(WINDRES)' \
524 'WINDMC=$(WINDMC)'
405ea7a0
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
8a0d8a5c
PB
540# Flags to pass to stage2 and later makes.
541
542POSTSTAGE1_FLAGS_TO_PASS = \
dc17c78c 543 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" GNATBIND="$${GNATBIND}" \
8a0d8a5c
PB
544 LDFLAGS="$(BOOT_LDFLAGS)" \
545 "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
546
405ea7a0 547# Flags to pass down to makes which are built with the target environment.
0aed8855
PB
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
7f6ef0c0
PB
550# *_CFLAGS_FOR_TARGET variables are not passed down and most often empty,
551# so we expand them here.
405ea7a0
NN
552EXTRA_TARGET_FLAGS = \
553 'AR=$$(AR_FOR_TARGET)' \
0aed8855 554 'AS=$(COMPILER_AS_FOR_TARGET)' \
1b05fbbd
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)' \
405ea7a0 559 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
1b05fbbd
AO
560 'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
561 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
0aed8855 562 'LD=$(COMPILER_LD_FOR_TARGET)' \
414e5532 563 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
1b05fbbd
AO
564 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
565 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
0aed8855 566 'NM=$(COMPILER_NM_FOR_TARGET)' \
5ae72758 567 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
405ea7a0 568 'RANLIB=$$(RANLIB_FOR_TARGET)' \
0c24b341 569 'WINDRES=$$(WINDRES_FOR_TARGET)' \
1b05fbbd
AO
570 'WINDMC=$$(WINDMC_FOR_TARGET)' \
571 'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
572 "TFLAGS=$$TFLAGS"
405ea7a0
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.
2a4cbe27 580# The BUILD_* variables are a special case, which are used for the gcc
405ea7a0
NN
581# cross-building scheme.
582EXTRA_GCC_FLAGS = \
405ea7a0 583 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
3dee29da
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=/'`" \
c52c6897 588 "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
405ea7a0 589
f0b24077 590GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
405ea7a0 591
1b05fbbd
AO
592@if gcc
593BUILD_CONFIG =
594ifneq ($(BUILD_CONFIG),)
595include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk)
596endif
597@endif gcc
598
dd12c3a8 599.PHONY: configure-host
b813574b 600configure-host: [+
dd12c3a8
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 +]
405ea7a0 609
319cab08
PB
610# The target built for a native non-bootstrap build.
611.PHONY: all
f70224b5
PB
612all:
613@if gcc-bootstrap
be01d343 614 [ -f stage_final ] || echo stage3 > stage_final
f70224b5
PB
615 @r=`${PWD_COMMAND}`; export r; \
616 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
0aed8855 617 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
f70224b5 618@endif gcc-bootstrap
0aed8855 619 @: $(MAKE); $(unstage)
f70224b5
PB
620 @r=`${PWD_COMMAND}`; export r; \
621 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1b05fbbd 622@if gcc-bootstrap
7b6175f9 623 if [ -f stage_last ]; then \
07fc31c9 624 TFLAGS="$(STAGE$(shell test ! -f stage_last || sed s,^stage,, stage_last)_TFLAGS)"; \
be01d343 625 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
f70224b5 626 else \
1b05fbbd 627@endif gcc-bootstrap
b5233201
AO
628 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
629@if gcc-bootstrap
630 ; \
04ec0acb 631 fi \
b5233201 632@endif gcc-bootstrap
04ec0acb 633 && :
dd12c3a8 634
6a9cf61e 635.PHONY: all-build
c52c6897
PB
636[+ FOR build_modules +]
637all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
638
dd12c3a8 639.PHONY: all-host
c52c6897
PB
640[+ FOR host_modules +][+ IF bootstrap +]
641@if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
642all-host: maybe-all-[+module+][+ IF bootstrap +]
643@endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
644
dd12c3a8 645.PHONY: all-target
c52c6897 646[+ FOR target_modules +][+ IF bootstrap +]
f86e35b8 647@if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
c52c6897 648all-target: maybe-all-target-[+module+][+ IF bootstrap +]
f86e35b8
NC
649@endif target-[+module+]-no-bootstrap[+
650 ENDIF bootstrap +][+ ENDFOR target_modules +]
405ea7a0
NN
651
652# Do a target for all the subdirectories. A ``make do-X'' will do a
653# ``make X'' in all subdirectories (because, in general, there is a
654# dependency (below) of X upon do-X, a ``make X'' will also do this,
655# but it may do additional work as well).
e393202e 656[+ FOR recursive_targets +]
27b1cc72 657.PHONY: do-[+make_target+]
f70224b5 658do-[+make_target+]:
0aed8855 659 @: $(MAKE); $(unstage)
e360f423
PB
660 @r=`${PWD_COMMAND}`; export r; \
661 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
662 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
f70224b5 663 [+make_target+]-target
f70224b5 664
2a4cbe27
NN
665
666.PHONY: [+make_target+]-host
c52c6897
PB
667[+ FOR host_modules +]
668[+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
2a4cbe27
NN
669
670.PHONY: [+make_target+]-target
c52c6897
PB
671[+ FOR target_modules +]
672[+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
e393202e
NN
673[+ ENDFOR recursive_targets +]
674
405ea7a0
NN
675# Here are the targets which correspond to the do-X targets.
676
a3ca38d2
DD
677.PHONY: info installcheck dvi pdf html
678.PHONY: install-info install-pdf install-html
405ea7a0
NN
679.PHONY: clean distclean mostlyclean maintainer-clean realclean
680.PHONY: local-clean local-distclean local-maintainer-clean
681info: do-info
682installcheck: do-installcheck
683dvi: do-dvi
56a8fe78 684pdf: do-pdf
6d389afc 685html: do-html
405ea7a0 686
43d92c63
NN
687# Make sure makeinfo is built before we do a `make info', if we're
688# in fact building texinfo.
689do-info: maybe-all-texinfo
405ea7a0
NN
690
691install-info: do-install-info dir.info
b40e3958 692 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
405ea7a0 693 if [ -f dir.info ] ; then \
497f816e 694 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
405ea7a0
NN
695 else true ; fi
696
a3ca38d2
DD
697install-pdf: do-install-pdf
698
108a6f8e
CD
699install-html: do-install-html
700
405ea7a0
NN
701local-clean:
702 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
703
704local-distclean:
705 -rm -f Makefile config.status config.cache mh-frag mt-frag
0aed8855 706 -rm -f maybedep.tmp serdep.tmp
405ea7a0
NN
707 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
708 rm -rf $(TARGET_SUBDIR); \
709 else true; fi
e4c4d240 710 -rm -rf $(BUILD_SUBDIR)
b00612cc
PB
711 -if [ "$(HOST_SUBDIR)" != "." ]; then \
712 rm -rf $(HOST_SUBDIR); \
713 else true; fi
405ea7a0
NN
714 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
715 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
716 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
717 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
718 -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
719
720local-maintainer-clean:
721 @echo "This command is intended for maintainers to use;"
722 @echo "it deletes files that may require special tools to rebuild."
723
724clean: do-clean local-clean
725mostlyclean: do-mostlyclean local-clean
726distclean: do-distclean local-clean local-distclean
727maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
728maintainer-clean: local-distclean
729realclean: maintainer-clean
730
405ea7a0
NN
731# Check target.
732
733.PHONY: check do-check
ede4fbe4 734check: do-check
405ea7a0 735
3866be5d 736# Only include modules actually being configured and built.
f70224b5
PB
737.PHONY: check-host
738check-host: [+
16ae0395
NN
739 FOR host_modules +] \
740 maybe-check-[+module+][+
f70224b5
PB
741 ENDFOR host_modules +]
742
743.PHONY: check-target
744check-target: [+
16ae0395
NN
745 FOR target_modules +] \
746 maybe-check-target-[+module+][+
f70224b5
PB
747 ENDFOR target_modules +]
748
749do-check:
0aed8855 750 @: $(MAKE); $(unstage)
e360f423
PB
751 @r=`${PWD_COMMAND}`; export r; \
752 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
753 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
405ea7a0
NN
754
755# Automated reporting of test results.
756
757warning.log: build.log
758 $(srcdir)/contrib/warn_summary build.log > $@
759
760mail-report.log:
761 if test x'$(BOOT_CFLAGS)' != x''; then \
762 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
763 fi; \
764 $(srcdir)/contrib/test_summary -t >$@
765 chmod +x $@
766 echo If you really want to send e-mail, run ./$@ now
767
768mail-report-with-warnings.log: warning.log
769 if test x'$(BOOT_CFLAGS)' != x''; then \
770 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
771 fi; \
772 $(srcdir)/contrib/test_summary -t -i warning.log >$@
773 chmod +x $@
774 echo If you really want to send e-mail, run ./$@ now
775
776# Installation targets.
777
ae831be5 778.PHONY: install uninstall
f70224b5 779install:
0aed8855 780 @: $(MAKE); $(unstage)
e360f423
PB
781 @r=`${PWD_COMMAND}`; export r; \
782 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
783 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
dd12c3a8 784
16ae0395
NN
785.PHONY: install-host-nogcc
786install-host-nogcc: [+
9e6ce191
PB
787 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
788 maybe-install-[+module+][+ ENDIF +][+
16ae0395
NN
789 ENDFOR host_modules +]
790
dd12c3a8 791.PHONY: install-host
b813574b 792install-host: [+
dd12c3a8
NN
793 FOR host_modules +] \
794 maybe-install-[+module+][+
795 ENDFOR host_modules +]
16ae0395 796
dd12c3a8
NN
797.PHONY: install-target
798install-target: [+
799 FOR target_modules +] \
800 maybe-install-target-[+module+][+
801 ENDFOR target_modules +]
405ea7a0
NN
802
803uninstall:
804 @echo "the uninstall target is not supported in this tree"
805
405ea7a0
NN
806.PHONY: install.all
807install.all: install-no-fixedincludes
808 @if [ -f ./gcc/Makefile ] ; then \
b40e3958 809 r=`${PWD_COMMAND}` ; export r ; \
0aed8855 810 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7ffa0b57 811 $(HOST_EXPORTS) \
1086bc09 812 (cd ./gcc && \
405ea7a0
NN
813 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
814 else \
815 true ; \
816 fi
817
818# install-no-fixedincludes is used because Cygnus can not distribute
819# the fixed header files.
820.PHONY: install-no-fixedincludes
16ae0395 821install-no-fixedincludes: installdirs install-host-nogcc \
dd12c3a8 822 install-target gcc-no-fixedincludes
405ea7a0 823
15723a45 824### other supporting targets
405ea7a0 825
15723a45
NN
826MAKEDIRS= \
827 $(DESTDIR)$(prefix) \
828 $(DESTDIR)$(exec_prefix)
829.PHONY: installdirs
830installdirs: mkinstalldirs
831 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
832
833dir.info: do-install-info
834 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
497f816e 835 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
15723a45
NN
836 mv -f dir.info.new dir.info ; \
837 else true ; \
405ea7a0
NN
838 fi
839
15723a45
NN
840dist:
841 @echo "Building a full distribution of this tree isn't done"
842 @echo "via 'make dist'. Check out the etc/ subdirectory"
843
844etags tags: TAGS
845
846# Right now this just builds TAGS in each subdirectory. emacs19 has the
847# ability to use several tags files at once, so there is probably no need
848# to combine them into one big TAGS file (like CVS 1.3 does). We could
849# (if we felt like it) have this Makefile write a piece of elisp which
850# the user could load to tell emacs19 where all the TAGS files we just
851# built are.
852TAGS: do-TAGS
853
a7254363
PB
854# ------------------------------------
855# Macros for configure and all targets
856# ------------------------------------
857
858[+ DEFINE configure +]
859.PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
860maybe-configure-[+prefix+][+module+]:
4f0ef2d8
CD
861@if gcc-bootstrap
862configure-[+prefix+][+module+]: stage_current
863@endif gcc-bootstrap
a7254363
PB
864@if [+prefix+][+module+]
865maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
4f0ef2d8 866configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
c52c6897
PB
867 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
868 @r=`${PWD_COMMAND}`; export r; \
0aed8855 869 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
c52c6897
PB
870 [+ IF check_multilibs
871 +]echo "Checking multilib configuration for [+module+]..."; \
0aed8855
PB
872 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
873 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
874 if test -r [+subdir+]/[+module+]/multilib.out; then \
875 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
876 rm -f [+subdir+]/[+module+]/multilib.tmp; \
877 else \
878 rm -f [+subdir+]/[+module+]/Makefile; \
879 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
880 fi; \
881 else \
882 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
c52c6897
PB
883 fi; \
884 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
a7254363 885 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
a7254363
PB
886 [+exports+] \
887 echo Configuring in [+subdir+]/[+module+]; \
888 cd "[+subdir+]/[+module+]" || exit 1; \
bba45b8b 889 case $(srcdir) in \
b00612cc 890 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
a7254363 891 *) topdir=`echo [+subdir+]/[+module+]/ | \
b00612cc 892 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
bba45b8b 893 esac; \
b00612cc
PB
894 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
895 libsrcdir="$$s/[+module+]"; \
a7254363
PB
896 [+ IF no-config-site +]rm -f no-such-file || : ; \
897 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
4b900473
PB
898 [+args+] --build=${build_alias} --host=[+host_alias+] \
899 --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
bba45b8b 900 || exit 1
a7254363 901@endif [+prefix+][+module+]
d545f33b
PB
902
903[+ IF bootstrap +]
904[+ FOR bootstrap_stage +]
905.PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
906maybe-configure-stage[+id+]-[+prefix+][+module+]:
0aed8855 907@if [+prefix+][+module+]-bootstrap
d545f33b 908maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
0aed8855 909configure-stage[+id+]-[+prefix+][+module+]:
c52c6897 910 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
0aed8855 911 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
c52c6897 912 @r=`${PWD_COMMAND}`; export r; \
d545f33b 913 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1b05fbbd 914 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
c52c6897
PB
915 [+ IF check_multilibs
916 +]echo "Checking multilib configuration for [+module+]..."; \
0aed8855
PB
917 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
918 if test -r [+subdir+]/[+module+]/multilib.out; then \
919 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
920 rm -f [+subdir+]/[+module+]/multilib.tmp; \
921 else \
922 rm -f [+subdir+]/[+module+]/Makefile; \
923 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
924 fi; \
925 else \
926 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
c52c6897
PB
927 fi; \
928 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
d545f33b 929 [+exports+][+ IF prev +] \
1b05fbbd
AO
930 [+poststage1_exports+][+ ENDIF prev +][+ IF prefix +] \
931 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
932 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
933 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;[+ ELSE prefix +] \
934 CFLAGS="$(STAGE[+id+]_CFLAGS)"; export CFLAGS; \
935 CXXFLAGS="$(STAGE[+id+]_CFLAGS)"; export CXXFLAGS;[+ IF prev +] \
936 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
937 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +]; export LIBCFLAGS;[+ ENDIF prefix +] \
d545f33b 938 echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
0aed8855 939 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
d545f33b
PB
940 cd [+subdir+]/[+module+] || exit 1; \
941 case $(srcdir) in \
942 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
943 *) topdir=`echo [+subdir+]/[+module+]/ | \
944 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
945 esac; \
946 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
947 libsrcdir="$$s/[+module+]"; \
948 $(SHELL) $${libsrcdir}/configure \
4b900473 949 [+args+] --build=${build_alias} --host=[+host_alias+] \
1b05fbbd
AO
950 --target=[+target_alias+] $${srcdiroption} [+ IF prev +]\
951 --with-build-libsubdir=$(HOST_SUBDIR) [+ ENDIF prev +]\
952 $(STAGE[+id+]_CONFIGURE_FLAGS)[+ IF extra_configure_flags +] \
953 [+extra_configure_flags+][+ ENDIF extra_configure_flags +]
0aed8855 954@endif [+prefix+][+module+]-bootstrap
d545f33b
PB
955[+ ENDFOR bootstrap_stage +]
956[+ ENDIF bootstrap +]
a7254363
PB
957[+ ENDDEF +]
958
959[+ DEFINE all +]
960.PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
961maybe-all-[+prefix+][+module+]:
4f0ef2d8
CD
962@if gcc-bootstrap
963all-[+prefix+][+module+]: stage_current
964@endif gcc-bootstrap
a7254363
PB
965@if [+prefix+][+module+]
966TARGET-[+prefix+][+module+]=[+
4b900473 967 IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
a7254363 968maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
4f0ef2d8 969all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
c52c6897
PB
970 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
971 @r=`${PWD_COMMAND}`; export r; \
b40e3958 972 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a7254363
PB
973 [+exports+] \
974 (cd [+subdir+]/[+module+] && \
7f6ef0c0
PB
975 $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+extra_make_flags+] \
976 $(TARGET-[+prefix+][+module+]))
a7254363 977@endif [+prefix+][+module+]
d545f33b
PB
978
979[+ IF bootstrap +]
980[+ FOR bootstrap_stage +]
981.PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
982.PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
983maybe-all-stage[+id+]-[+prefix+][+module+]:
984maybe-clean-stage[+id+]-[+prefix+][+module+]:
0aed8855 985@if [+prefix+][+module+]-bootstrap
d545f33b
PB
986maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
987all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
f70224b5 988TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
d545f33b 989all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
c52c6897 990 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
d545f33b
PB
991 @r=`${PWD_COMMAND}`; export r; \
992 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1b05fbbd 993 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
d545f33b
PB
994 [+exports+][+ IF prev +] \
995 [+poststage1_exports+][+ ENDIF prev +] \
996 cd [+subdir+]/[+module+] && \
1b05fbbd
AO
997 $(MAKE) $(BASE_FLAGS_TO_PASS)[+ IF prefix +] \
998 CFLAGS="$(CFLAGS_FOR_TARGET)" \
999 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
1000 LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"[+ ELSE prefix +] \
1001 CFLAGS="$(STAGE[+id+]_CFLAGS)" \
1002 CXXFLAGS="$(STAGE[+id+]_CFLAGS)"[+ IF prev +] \
1003 LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
1004 LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +][+ ENDIF prefix +] \
1005 CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
1006 CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
1007 LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
1008 [+args+] [+
8ee82aff
PB
1009 IF prev +][+poststage1_args+][+ ENDIF prev
1010 +] [+extra_make_flags+] \
1b05fbbd 1011 TFLAGS="$(STAGE[+id+]_TFLAGS)" \
f70224b5 1012 $(TARGET-stage[+id+]-[+prefix+][+module+])
d545f33b
PB
1013
1014maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
1015clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
1016clean-stage[+id+]-[+prefix+][+module+]:
9dbaa842
DD
1017 @if [ $(current_stage) = stage[+id+] ]; then \
1018 [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
1019 else \
1020 [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
1021 $(MAKE) stage[+id+]-start; \
1022 fi; \
d545f33b
PB
1023 cd [+subdir+]/[+module+] && \
1024 $(MAKE) [+args+] [+ IF prev +] \
1025 [+poststage1_args+] [+ ENDIF prev +] \
8ee82aff 1026 [+extra_make_flags+] clean
0aed8855 1027@endif [+prefix+][+module+]-bootstrap
d545f33b
PB
1028
1029[+ ENDFOR bootstrap_stage +]
1030[+ ENDIF bootstrap +]
a7254363
PB
1031[+ ENDDEF +]
1032
1033# --------------------------------------
1034# Modules which run on the build machine
1035# --------------------------------------
1036[+ FOR build_modules +]
1037[+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
4b900473
PB
1038 host_alias=(get "host" "${build_alias}")
1039 target_alias=(get "target" "${target_alias}")
a7254363
PB
1040 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
1041
6641ce42
JM
1042[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
1043 args="$(EXTRA_BUILD_FLAGS)" +]
a7254363 1044[+ ENDFOR build_module +]
405ea7a0 1045
15723a45
NN
1046# --------------------------------------
1047# Modules which run on the host machine
1048# --------------------------------------
3866be5d 1049[+ FOR host_modules +]
d545f33b
PB
1050[+ configure prefix="" subdir="$(HOST_SUBDIR)"
1051 exports="$(HOST_EXPORTS)"
1052 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
4b900473
PB
1053 host_alias=(get "host" "${host_alias}")
1054 target_alias=(get "target" "${target_alias}")
a7254363 1055 args="$(HOST_CONFIGARGS)" +]
e2b9e2dc 1056
d545f33b
PB
1057[+ all prefix="" subdir="$(HOST_SUBDIR)"
1058 exports="$(HOST_EXPORTS)"
1059 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
7f6ef0c0 1060 args="$(EXTRA_HOST_FLAGS)"
d545f33b 1061 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
405ea7a0 1062
16ae0395
NN
1063.PHONY: check-[+module+] maybe-check-[+module+]
1064maybe-check-[+module+]:
6bd3dfaa
PB
1065@if [+module+]
1066maybe-check-[+module+]: check-[+module+]
3866be5d 1067[+ IF no_check +]
3866be5d
NN
1068check-[+module+]:
1069[+ ELIF no_check_cross +]
3866be5d
NN
1070# This module is only tested in a native toolchain.
1071check-[+module+]:
0aed8855 1072 @: $(MAKE); $(unstage)
7f121bbf 1073 @if [ '$(host)' = '$(target)' ] ; then \
b40e3958
L
1074 r=`${PWD_COMMAND}`; export r; \
1075 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
378fce5b 1076 $(HOST_EXPORTS) \
b00612cc 1077 (cd $(HOST_SUBDIR)/[+module+] && \
4cfaf6d5 1078 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
bba45b8b
NN
1079 fi
1080[+ ELSE check +]
bba45b8b 1081check-[+module+]:
0aed8855 1082 @: $(MAKE); $(unstage)
b40e3958
L
1083 @r=`${PWD_COMMAND}`; export r; \
1084 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
378fce5b 1085 $(HOST_EXPORTS) \
b00612cc
PB
1086 (cd $(HOST_SUBDIR)/[+module+] && \
1087 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
3866be5d 1088[+ ENDIF no_check +]
6bd3dfaa 1089@endif [+module+]
405ea7a0 1090
930314a4
NN
1091.PHONY: install-[+module+] maybe-install-[+module+]
1092maybe-install-[+module+]:
6bd3dfaa
PB
1093@if [+module+]
1094maybe-install-[+module+]: install-[+module+]
16ae0395 1095[+ IF no_install +]
3866be5d
NN
1096install-[+module+]:
1097[+ ELSE install +]
3866be5d 1098install-[+module+]: installdirs
0aed8855 1099 @: $(MAKE); $(unstage)
b40e3958
L
1100 @r=`${PWD_COMMAND}`; export r; \
1101 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
378fce5b 1102 $(HOST_EXPORTS) \
b00612cc 1103 (cd $(HOST_SUBDIR)/[+module+] && \
2da12f12 1104 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
3866be5d 1105[+ ENDIF no_install +]
6bd3dfaa 1106@endif [+module+]
4fa63067 1107
56a8fe78 1108# Other targets (info, dvi, pdf, etc.)
4fa63067
NN
1109[+ FOR recursive_targets +]
1110.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
1111maybe-[+make_target+]-[+module+]:
6bd3dfaa
PB
1112@if [+module+]
1113maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
4fa63067
NN
1114[+ IF (match-value? = "missing" (get "make_target") ) +]
1115# [+module+] doesn't support [+make_target+].
1116[+make_target+]-[+module+]:
1117[+ ELSE +]
1118[+make_target+]-[+module+]: [+
1119 FOR depend +]\
1120 [+depend+]-[+module+] [+
1121 ENDFOR depend +]
0aed8855 1122 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
f70224b5 1123 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
4fa63067
NN
1124 r=`${PWD_COMMAND}`; export r; \
1125 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
378fce5b 1126 $(HOST_EXPORTS) \
b813574b 1127 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
4fa63067
NN
1128 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1129 done; \
1130 echo "Doing [+make_target+] in [+module+]" ; \
b00612cc 1131 (cd $(HOST_SUBDIR)/[+module+] && \
4fa63067
NN
1132 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1133 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1134 "RANLIB=$${RANLIB}" \
0c24b341 1135 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
b813574b 1136 [+make_target+]) \
4fa63067
NN
1137 || exit 1
1138[+ ENDIF +]
6bd3dfaa 1139@endif [+module+]
4fa63067 1140[+ ENDFOR recursive_targets +]
3866be5d 1141[+ ENDFOR host_modules +]
405ea7a0 1142
15723a45
NN
1143# ---------------------------------------
1144# Modules which run on the target machine
1145# ---------------------------------------
e393202e 1146[+ FOR target_modules +]
15723a45 1147
a7254363
PB
1148[+ IF raw_cxx +]
1149[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
0aed8855 1150 check_multilibs=true
a7254363 1151 exports="$(RAW_CXX_TARGET_EXPORTS)"
4b900473
PB
1152 host_alias=(get "host" "${target_alias}")
1153 target_alias=(get "target" "${target_alias}")
a7254363
PB
1154 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1155
1156[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1157 exports="$(RAW_CXX_TARGET_EXPORTS)"
7f6ef0c0 1158 args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
a7254363
PB
1159[+ ELSE +]
1160[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
0aed8855 1161 check_multilibs=true
a7254363 1162 exports="$(NORMAL_TARGET_EXPORTS)"
4b900473
PB
1163 host_alias=(get "host" "${target_alias}")
1164 target_alias=(get "target" "${target_alias}")
a7254363
PB
1165 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1166
1167[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1168 exports="$(NORMAL_TARGET_EXPORTS)"
7f6ef0c0 1169 args="$(EXTRA_TARGET_FLAGS)" +]
a7254363 1170[+ ENDIF +]
16ae0395
NN
1171
1172.PHONY: check-target-[+module+] maybe-check-target-[+module+]
1173maybe-check-target-[+module+]:
6bd3dfaa
PB
1174@if target-[+module+]
1175maybe-check-target-[+module+]: check-target-[+module+]
3866be5d
NN
1176[+ IF no_check +]
1177# Dummy target for uncheckable module.
3866be5d
NN
1178check-target-[+module+]:
1179[+ ELSE check +]
e393202e 1180check-target-[+module+]:
0aed8855 1181 @: $(MAKE); $(unstage)
b40e3958 1182 @r=`${PWD_COMMAND}`; export r; \
e90269c8 1183 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
378fce5b
DD
1184IF raw_cxx +]
1185 $(RAW_CXX_TARGET_EXPORTS) \[+
1186ELSE normal_cxx +]
1187 $(NORMAL_TARGET_EXPORTS) \[+
1188ENDIF raw_cxx +]
bba45b8b
NN
1189 (cd $(TARGET_SUBDIR)/[+module+] && \
1190 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1191 IF raw_cxx
1192 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1193 ENDIF raw_cxx
7ffa0b57 1194 +] [+extra_make_flags+] check)
e393202e 1195[+ ENDIF no_check +]
6bd3dfaa 1196@endif target-[+module+]
16ae0395 1197
930314a4
NN
1198.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1199maybe-install-target-[+module+]:
6bd3dfaa
PB
1200@if target-[+module+]
1201maybe-install-target-[+module+]: install-target-[+module+]
16ae0395 1202[+ IF no_install +]
930314a4
NN
1203# Dummy target for uninstallable.
1204install-target-[+module+]:
1205[+ ELSE install +]
e393202e 1206install-target-[+module+]: installdirs
0aed8855 1207 @: $(MAKE); $(unstage)
b40e3958 1208 @r=`${PWD_COMMAND}`; export r; \
e90269c8 1209 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
378fce5b
DD
1210IF raw_cxx +]
1211 $(RAW_CXX_TARGET_EXPORTS) \[+
1212ELSE normal_cxx +]
1213 $(NORMAL_TARGET_EXPORTS) \[+
1214ENDIF raw_cxx +]
bba45b8b 1215 (cd $(TARGET_SUBDIR)/[+module+] && \
7ffa0b57 1216 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
e393202e 1217[+ ENDIF no_install +]
6bd3dfaa 1218@endif target-[+module+]
4fa63067 1219
56a8fe78 1220# Other targets (info, dvi, pdf, etc.)
4fa63067
NN
1221[+ FOR recursive_targets +]
1222.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1223maybe-[+make_target+]-target-[+module+]:
6bd3dfaa
PB
1224@if target-[+module+]
1225maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
4fa63067
NN
1226[+ IF (match-value? = "missing" (get "make_target") ) +]
1227# [+module+] doesn't support [+make_target+].
1228[+make_target+]-target-[+module+]:
1229[+ ELSE +]
1230[+make_target+]-target-[+module+]: [+
1231 FOR depend +]\
1232 [+depend+]-target-[+module+] [+
1233 ENDFOR depend +]
0aed8855 1234 @: $(MAKE); $(unstage)
4fa63067
NN
1235 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1236 r=`${PWD_COMMAND}`; export r; \
e90269c8 1237 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
378fce5b
DD
1238IF raw_cxx +]
1239 $(RAW_CXX_TARGET_EXPORTS) \[+
1240ELSE normal_cxx +]
1241 $(NORMAL_TARGET_EXPORTS) \[+
1242ENDIF raw_cxx +]
4fa63067
NN
1243 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1244 for flag in $(EXTRA_TARGET_FLAGS); do \
1245 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1246 done; \
1247 (cd $(TARGET_SUBDIR)/[+module+] && \
1248 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1249 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1250 "RANLIB=$${RANLIB}" \
0c24b341 1251 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
7ffa0b57 1252 [+extra_make_flags+] [+make_target+]) \
4fa63067
NN
1253 || exit 1
1254[+ ENDIF +]
6bd3dfaa 1255@endif target-[+module+]
4fa63067 1256[+ ENDFOR recursive_targets +]
e393202e 1257[+ ENDFOR target_modules +]
405ea7a0 1258
15723a45
NN
1259# ----------
1260# GCC module
1261# ----------
1262
319cab08 1263@if gcc-no-bootstrap
405ea7a0 1264.PHONY: cross
72b2455a 1265cross: all-build all-gas all-ld
b40e3958
L
1266 @r=`${PWD_COMMAND}`; export r; \
1267 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7ffa0b57 1268 $(HOST_EXPORTS) \
405ea7a0
NN
1269 echo "Building the C and C++ compiler"; \
1270 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
b40e3958
L
1271 @r=`${PWD_COMMAND}`; export r; \
1272 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
405ea7a0 1273 echo "Building runtime libraries"; \
656fdd47 1274 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
319cab08 1275@endif gcc-no-bootstrap
405ea7a0 1276
6bd3dfaa 1277@if gcc
c50523ce
L
1278[+ FOR languages +]
1279.PHONY: check-gcc-[+language+] check-[+language+]
1280check-gcc-[+language+]:
1281 r=`${PWD_COMMAND}`; export r; \
1282 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1283 $(HOST_EXPORTS) \
1284 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]);
1285check-[+language+]: check-gcc-[+language+][+ IF lib-check-target +] [+ lib-check-target +][+ ENDIF lib-check-target +]
1286[+ ENDFOR languages +]
405ea7a0 1287
15723a45
NN
1288# Install the gcc headers files, but not the fixed include files,
1289# which Cygnus is not allowed to distribute. This rule is very
1290# dependent on the workings of the gcc Makefile.in.
1291.PHONY: gcc-no-fixedincludes
1292gcc-no-fixedincludes:
1293 @if [ -f ./gcc/Makefile ]; then \
1294 rm -rf gcc/tmp-include; \
1295 mv gcc/include gcc/tmp-include 2>/dev/null; \
1296 mkdir gcc/include; \
1297 cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1298 touch gcc/stmp-fixinc gcc/include/fixed; \
1299 rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
b40e3958
L
1300 r=`${PWD_COMMAND}`; export r; \
1301 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
7ffa0b57 1302 $(HOST_EXPORTS) \
1086bc09 1303 (cd ./gcc && \
15723a45
NN
1304 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1305 rm -rf gcc/include; \
1306 mv gcc/tmp-include gcc/include 2>/dev/null; \
1307 else true; fi
6bd3dfaa 1308@endif gcc
4fa63067 1309
1d39f329
NN
1310# ---------------------
1311# GCC bootstrap support
1312# ---------------------
1313
b813574b
PB
1314# We track the current stage (the one in 'gcc') in the stage_current file.
1315# stage_last instead tracks the stage that was built last. These targets
1316# are dummy when toplevel bootstrap is not active.
1317
f70224b5 1318# While making host and target tools, symlinks to the final stage must be
0aed8855
PB
1319# there, so $(unstage) should be run at various points. To avoid excessive
1320# recursive invocations of make, we "inline" them using a variable. These
1321# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1322# to avoid warnings from the GNU Make job server.
f70224b5
PB
1323
1324unstage = :
1325stage = :
c52c6897 1326current_stage = ""
f70224b5 1327
b813574b 1328@if gcc-bootstrap
9daf3993 1329unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
f6d183c0 1330stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
c52c6897 1331current_stage = "`cat stage_current 2> /dev/null`"
b813574b
PB
1332@endif gcc-bootstrap
1333
f70224b5
PB
1334.PHONY: unstage stage
1335unstage:
0aed8855 1336 @: $(MAKE); $(unstage)
b813574b 1337stage:
0aed8855 1338 @: $(MAKE); $(stage)
b813574b 1339
80911fe1
PB
1340# Disable commands for lean bootstrap.
1341LEAN = false
1342
dfdffa2c
PB
1343# We name the build directories for the various stages "stage1-gcc",
1344# "stage2-gcc","stage3-gcc", etc.
1345
1346# Since the 'compare' process will fail (on debugging information) if any
1347# directory names are different, we need to link the gcc directory for
0aed8855 1348# the previous stage to a constant name ('prev-gcc'), and to make the name of
dfdffa2c
PB
1349# the build directories constant as well. For the latter, we use naked names
1350# like 'gcc', because the scripts in that directory assume it. We use
1351# mv on platforms where symlinks to directories do not work or are not
1352# reliable.
1353
1d39f329
NN
1354# 'touch' doesn't work right on some platforms.
1355STAMP = echo timestamp >
1356
dfdffa2c
PB
1357# We only want to compare .o files, so set this!
1358objext = .o
1d39f329 1359
dfdffa2c 1360[+ FOR bootstrap-stage +]
319cab08 1361.PHONY: stage[+id+]-start stage[+id+]-end
dfdffa2c 1362
656fdd47 1363stage[+id+]-start::
0aed8855 1364 @: $(MAKE); $(stage); \
b813574b 1365 echo stage[+id+] > stage_current ; \
b00612cc 1366 echo stage[+id+] > stage_last; \
0aed8855 1367 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
b00612cc 1368 FOR host_modules +][+ IF bootstrap +]
72b2455a 1369@if [+ module +]
b00612cc
PB
1370 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1371 mkdir stage[+id+]-[+module+]; \
80911fe1
PB
1372 mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1373 mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
0aed8855
PB
1374@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1375 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1376 mkdir stage[+id+]-$(TARGET_SUBDIR); \
80911fe1
PB
1377 mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1378 mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
dfdffa2c 1379
80911fe1 1380stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
72b2455a 1381@if [+ module +]
80911fe1
PB
1382 @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1383 cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1384 mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
0aed8855
PB
1385 fi
1386@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1387 @if test -d $(TARGET_SUBDIR) ; then \
80911fe1
PB
1388 mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1389 mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
0aed8855 1390 fi
80911fe1 1391 rm -f stage_current
dfdffa2c 1392
973601e1 1393# Bubble a bug fix through all the stages up to stage [+id+]. They are
0aed8855 1394# remade, but not reconfigured. The next stage (if any) will not be
675492f0 1395# reconfigured either.
319cab08 1396.PHONY: stage[+id+]-bubble
80911fe1 1397stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
e360f423
PB
1398 @r=`${PWD_COMMAND}`; export r; \
1399 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1400 if test -f stage[+id+]-lean [+
9cb3fa6f
PB
1401 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1402 echo Skipping rebuild of stage[+id+] ; \
1403 else \
80911fe1
PB
1404 $(MAKE) stage[+id+]-start; \[+IF lean +]
1405 if $(LEAN); then \
1406 rm -rf stage[+lean+]-* ; \
1407 $(STAMP) stage[+lean+]-lean ; \
1408 fi; \[+ ENDIF lean +]
f70224b5 1409 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
be01d343 1410 fi[+ IF compare-target +]
f6d183c0 1411 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
72b2455a 1412
0df3d27f 1413.PHONY: all-stage[+id+] clean-stage[+id+]
0df3d27f 1414do-clean: clean-stage[+id+]
1d39f329 1415
72b2455a
PB
1416# FIXME: Will not need to be conditional when toplevel bootstrap is the
1417# only possibility, but now it conflicts with no-bootstrap rules
1418@if gcc-bootstrap
dfdffa2c 1419[+ IF compare-target +]
9cb3fa6f 1420[+compare-target+]:
e360f423
PB
1421 @r=`${PWD_COMMAND}`; export r; \
1422 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1423 if test -f stage[+prev+]-lean; then \
9cb3fa6f
PB
1424 echo Cannot compare object files as stage [+prev+] was deleted. ; \
1425 exit 0 ; \
1426 fi; \
0aed8855 1427 : $(MAKE); $(stage); \
1d39f329 1428 rm -f .bad_compare ; \
c52c6897 1429 echo Comparing stages [+prev+] and [+id+] ; \
fda13ee8
AO
1430 sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \
1431 files=`find stage[+id+]-* -name "*$(objext)" -print | \
1432 sed -n s,^stage$$sed-,,p` ; \
1d39f329 1433 for file in $${files} ; do \
fda13ee8
AO
1434 f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \
1435 if test ! -f $$f1; then continue; fi; \
8520c408 1436 $(do-[+compare-target+]) > /dev/null 2>&1; \
f70224b5
PB
1437 if test $$? -eq 1; then \
1438 case $$file in \
fda13ee8 1439 gcc/cc*-checksum$(objext) | ./libgcc/* | ./gcc/ada/*tools/*) \
f70224b5
PB
1440 echo warning: $$file differs ;; \
1441 *) \
1442 echo $$file differs >> .bad_compare ;; \
1443 esac ; \
1444 fi ; \
1d39f329
NN
1445 done ; \
1446 if [ -f .bad_compare ]; then \
1447 echo "Bootstrap comparison failure!"; \
1448 cat .bad_compare; \
1449 exit 1; \
1450 else \
c52c6897 1451 echo Comparison successful.; \
1d39f329 1452 fi ; \
9cb3fa6f 1453 $(STAMP) [+compare-target+][+ IF prev +]
80911fe1
PB
1454 if $(LEAN); then \
1455 rm -rf stage[+prev+]-*; \
1456 $(STAMP) stage[+prev+]-lean; \
1457 fi[+ ENDIF prev +]
dfdffa2c
PB
1458[+ ENDIF compare-target +]
1459
1460[+ IF bootstrap-target +]
80911fe1 1461.PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
be01d343
PB
1462[+bootstrap-target+]:
1463 echo stage[+id+] > stage_final
1464 @r=`${PWD_COMMAND}`; export r; \
1465 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1466 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
0aed8855 1467 @: $(MAKE); $(unstage)
be01d343
PB
1468 @r=`${PWD_COMMAND}`; export r; \
1469 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1b05fbbd 1470 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
be01d343 1471 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
80911fe1
PB
1472
1473[+bootstrap-target+]-lean:
1474 echo stage[+id+] > stage_final
1475 @r=`${PWD_COMMAND}`; export r; \
1476 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1477 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1478 @: $(MAKE); $(unstage)
1479 @r=`${PWD_COMMAND}`; export r; \
1480 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1b05fbbd 1481 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
80911fe1 1482 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
dfdffa2c
PB
1483[+ ENDIF bootstrap-target +]
1484
0df3d27f 1485# Rules to wipe a stage and all the following ones, also used for cleanstrap
656fdd47 1486[+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
0df3d27f 1487.PHONY: distclean-stage[+id+]
656fdd47 1488distclean-stage[+id+]::
0aed8855 1489 @: $(MAKE); $(stage)
e00a73e3 1490 @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
9cb3fa6f 1491 rm -rf stage[+id+]-* [+
dfdffa2c 1492 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
dfdffa2c
PB
1493
1494[+ IF cleanstrap-target +]
1495.PHONY: [+cleanstrap-target+]
e00a73e3
PB
1496[+cleanstrap-target+]: do-distclean local-clean
1497 echo stage[+id+] > stage_final
1498 @r=`${PWD_COMMAND}`; export r; \
1499 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1500 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1501 @: $(MAKE); $(unstage)
1502 @r=`${PWD_COMMAND}`; export r; \
1503 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1b05fbbd 1504 TFLAGS="$(STAGE[+id+]_TFLAGS)"; \
e00a73e3 1505 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
dfdffa2c 1506[+ ENDIF cleanstrap-target +]
72b2455a 1507@endif gcc-bootstrap
dfdffa2c
PB
1508
1509[+ ENDFOR bootstrap-stage +]
656fdd47 1510
7d329e61
PB
1511stageprofile-end::
1512 $(MAKE) distclean-stagefeedback
656fdd47 1513
7d329e61 1514stagefeedback-start::
656fdd47
PB
1515 @r=`${PWD_COMMAND}`; export r; \
1516 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7d329e61
PB
1517 for i in prev-*; do \
1518 j=`echo $$i | sed s/^prev-//` ; \
1519 cd $$r/$$i && \
1520 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1521 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1522 done
b8908782 1523
0df3d27f 1524@if gcc-bootstrap
0df3d27f 1525do-distclean: distclean-stage1
c52c6897
PB
1526
1527# Provide a GCC build when we're building target libraries. This does
1528# not work as a dependency, just as the minimum necessary to avoid errors.
1529stage_last:
314b2e66
AS
1530 @r=`${PWD_COMMAND}`; export r; \
1531 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
c52c6897 1532 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
0df3d27f 1533
4f0ef2d8
CD
1534# Same as unstage, but not phony and defaulting to stage1-start. We place
1535# it in the dependency so that for example `make -j3 all-gcc' works.
1536stage_current:
1537 @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1538
c52c6897 1539.PHONY: restrap
266df637 1540restrap::
c52c6897 1541 @: $(MAKE); $(stage)
1b05fbbd
AO
1542 rm -rf stage1-$(TARGET_SUBDIR)[+ FOR bootstrap-stage +][+ IF prev
1543 +] stage[+id+]-*[+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
266df637 1544restrap:: all
c380fdd8 1545@endif gcc-bootstrap
c52c6897 1546
ae831be5
NN
1547# --------------------------------------
1548# Dependencies between different modules
1549# --------------------------------------
405ea7a0 1550
9e6ce191 1551# Generic dependencies for target modules on host stuff, especially gcc
c52c6897
PB
1552@if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1553 +][+ FOR bootstrap_stage +]
1554configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1555 ENDFOR +][+ ELSE bootstrap +]
1556configure-target-[+module+]: stage_last[+
1557 ENDIF bootstrap +][+ ENDFOR target_modules +]
1558@endif gcc-bootstrap
1559
6aa8ef82 1560@if gcc-no-bootstrap[+ FOR target_modules +]
c52c6897 1561configure-target-[+module+]: maybe-all-gcc[+
6aa8ef82 1562 ENDFOR target_modules +]
c52c6897
PB
1563@endif gcc-no-bootstrap
1564
9e6ce191 1565
ae831be5
NN
1566# There are two types of dependencies here: 'hard' dependencies, where one
1567# module simply won't build without the other; and 'soft' dependencies, where
1568# if the depended-on module is missing, the depending module will do without
1569# or find a substitute somewhere (perhaps installed). Soft dependencies
9e6ce191 1570# are made here to depend on a 'maybe-' target. If you're not sure,
ae831be5
NN
1571# it's safer to use a soft dependency.
1572
9e6ce191
PB
1573[+ ;; These Scheme functions build the bulk of the dependencies.
1574 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
675492f0 1575 ;; where "maybe-" is only included if HARD is not true, and all-gcc
9e6ce191
PB
1576 ;; is taken from VAR-NAME.
1577 (define dep-target (lambda (module-kind var-name hard)
1578 (string-append
1579 (if hard "" "maybe-")
1580 (dep-subtarget var-name)
1581 module-kind
1582 (dep-module var-name)
1583 )))
1584
1585 ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
72b2455a 1586 (define make-dep (lambda (module-kind on-kind)
9e6ce191
PB
1587 (string-append
1588 (dep-target module-kind "module" #t) ": "
72b2455a 1589 (dep-target on-kind "on" (exist? "hard")))))
9e6ce191
PB
1590
1591 ;; dep-subtarget extracts everything up to the first dash in the given
1592 ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1593 (define dep-subtarget (lambda (var-name)
1594 (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1595
1596 ;; dep-module extracts everything up to the first dash in the given
1597 ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1598 (define dep-module (lambda (var-name)
1599 (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1600
1601 ;; dep-stage builds a string for the prefix of a bootstrap stage.
1602 (define dep-stage (lambda ()
1603 (string-append
1604 "stage"
1605 (get "id")
1606 "-")))
1607
1608 ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1609 ;; but is written in Scheme.
1610 (define dep-maybe (lambda ()
1611 (if (exist? "hard") "" "maybe-")))
1612
21fde4dc
DD
1613 ;; dep-kind returns "normal" if the dependency is on an "install" target,
1614 ;; or if either module is not bootstrapped. It returns "bootstrap" for
9e6ce191
PB
1615 ;; configure or build dependencies between bootstrapped modules; it returns
1616 ;; "prebootstrap" for configure or build dependencies of bootstrapped
72b2455a 1617 ;; modules on a build module (e.g. all-gcc on all-build-bison). All this
9e6ce191
PB
1618 ;; is only necessary for host modules.
1619 (define dep-kind (lambda ()
72b2455a
PB
1620 (if (and (hash-ref boot-modules (dep-module "module"))
1621 (=* (dep-module "on") "build-"))
1622 "prebootstrap"
9e6ce191 1623
72b2455a 1624 (if (or (= (dep-subtarget "on") "install-")
21fde4dc
DD
1625 (not (hash-ref boot-modules (dep-module "module")))
1626 (not (hash-ref boot-modules (dep-module "on"))))
72b2455a
PB
1627 "normal"
1628 "bootstrap"))))
9e6ce191
PB
1629
1630 ;; We now build the hash table that is used by dep-kind.
1631 (define boot-modules (make-hash-table 113))
9e6ce191
PB
1632+]
1633
1634[+ FOR host_modules +][+
1635 (if (exist? "bootstrap")
1636 (hash-create-handle! boot-modules (get "module") #t))
1637 "" +][+ ENDFOR host_modules +]
1dc3053f
PB
1638[+ FOR target_modules +][+
1639 (if (exist? "bootstrap")
1640 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1641 "" +][+ ENDFOR target_modules +]
9e6ce191
PB
1642
1643# With all the machinery above in place, it is pretty easy to generate
1644# dependencies. Host dependencies are a bit more complex because we have
1645# to check for bootstrap/prebootstrap dependencies. To resolve
1646# prebootstrap dependencies, prebootstrap modules are gathered in
1647# a hash table.
72b2455a
PB
1648[+ FOR dependencies +][+ (make-dep "" "") +]
1649[+ CASE (dep-kind) +]
1650[+ == "prebootstrap"
9e6ce191 1651 +][+ FOR bootstrap_stage +]
72b2455a
PB
1652[+ (make-dep (dep-stage) "") +][+
1653 ENDFOR bootstrap_stage +]
72b2455a
PB
1654[+ == "bootstrap"
1655 +][+ FOR bootstrap_stage +]
1656[+ (make-dep (dep-stage) (dep-stage)) +][+
9e6ce191
PB
1657 ENDFOR bootstrap_stage +]
1658[+ ESAC +][+
1659ENDFOR dependencies +]
1660
6aa8ef82
DJ
1661# Dependencies for target modules on other target modules are
1662# described by lang_env_dependencies; the defaults apply to anything
1663# not mentioned there.
1664[+
1665 ;; Predicate for whether LANG was specified in lang_env_dependencies.
1666 (define lang-dep (lambda (lang)
1667 (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1668
1669 ;; Build the hash table we will need.
1670 (define lang-env-deps (make-hash-table 7))
1671+][+ FOR lang_env_dependencies +][+
1672 (if (exist? "cxx")
1673 (hash-create-handle! lang-env-deps
1674 (string-append (get "module") "-" "cxx") #t))
1675
1676 (if (exist? "no_c")
1677 (hash-create-handle! lang-env-deps
1678 (string-append (get "module") "-" "no_c") #t))
1679
1680 (if (exist? "no_gcc")
1681 (hash-create-handle! lang-env-deps
1682 (string-append (get "module") "-" "no_gcc") #t))
1683 "" +][+ ENDFOR lang_env_dependencies +]
1684
1685@if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1686 +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1687configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1688 ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1689@endif gcc-bootstrap
1690
1691@if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1692configure-target-[+module+]: maybe-all-target-libgcc[+
1693 ENDIF +][+ ENDFOR target_modules +]
1694@endif gcc-no-bootstrap
1695
1696[+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1697configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1698 ENDIF +][+ IF (lang-dep "cxx") +]
1699configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1700 ENDIF +]
1701[+ ENDFOR target_modules +]
1702
907be67c 1703CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
ae831be5 1704GDB_TK = @GDB_TK@
907be67c
DJ
1705INSTALL_GDB_TK = @INSTALL_GDB_TK@
1706configure-gdb: $(CONFIGURE_GDB_TK)
9e6ce191 1707all-gdb: $(gdbnlmrequirements) $(GDB_TK)
907be67c 1708install-gdb: $(INSTALL_GDB_TK)
907a7241 1709
a2cc058a
NN
1710# Serialization dependencies. Host configures don't work well in parallel to
1711# each other, due to contention over config.cache. Target configures and
1712# build configures are similar.
1713@serialization_dependencies@
1714
15723a45
NN
1715# --------------------------------
1716# Regenerating top level configury
1717# --------------------------------
405ea7a0
NN
1718
1719# Rebuilding Makefile.in, using autogen.
43be203f 1720AUTOGEN = autogen
6b784d9f 1721$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
43be203f 1722 cd $(srcdir) && $(AUTOGEN) Makefile.def
405ea7a0 1723
a0da8069 1724# Rebuilding Makefile.
43be203f
AO
1725Makefile: $(srcdir)/Makefile.in config.status
1726 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1727
479759c8 1728config.status: configure
10ecffb9 1729 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
405ea7a0 1730
a0da8069 1731# Rebuilding configure.
43be203f 1732AUTOCONF = autoconf
da888c87
PB
1733$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
1734 $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4
43be203f 1735 cd $(srcdir) && $(AUTOCONF)
405ea7a0 1736
3728fade
NN
1737# ------------------------------
1738# Special directives to GNU Make
1739# ------------------------------
1740
3728fade
NN
1741# Don't pass command-line variables to submakes.
1742.NOEXPORT:
1743MAKEOVERRIDES=
1744
405ea7a0 1745# end of Makefile.in