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