]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - Makefile.tpl
2005-12-19 H.J. Lu <hongjiu.lu@intel.com>
[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,
378fce5b 9# 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
405ea7a0
NN
10#
11# This file is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
6e4d0bcb 23# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
405ea7a0
NN
24#
25
50212802
NN
26# -------------------------------
27# Standard Autoconf-set variables
28# -------------------------------
583d52d7 29VPATH=@srcdir@
583d52d7
NN
30
31build_alias=@build_alias@
7f121bbf 32build=@build@
583d52d7 33host_alias=@host_alias@
7f121bbf 34host=@host@
583d52d7 35target_alias=@target_alias@
7f121bbf 36target=@target@
583d52d7 37
50212802 38program_transform_name = @program_transform_name@
c66d951e
NN
39
40prefix = @prefix@
41exec_prefix = @exec_prefix@
42
50212802
NN
43srcdir = @srcdir@
44
c66d951e
NN
45bindir = @bindir@
46sbindir = @sbindir@
47libexecdir = @libexecdir@
48datadir = @datadir@
49sysconfdir = @sysconfdir@
50sharedstatedir = @sharedstatedir@
51localstatedir = @localstatedir@
52libdir = @libdir@
53includedir = @includedir@
54oldincludedir = @oldincludedir@
55infodir = @infodir@
56mandir = @mandir@
405ea7a0
NN
57man1dir = $(mandir)/man1
58man2dir = $(mandir)/man2
59man3dir = $(mandir)/man3
60man4dir = $(mandir)/man4
61man5dir = $(mandir)/man5
62man6dir = $(mandir)/man6
63man7dir = $(mandir)/man7
64man8dir = $(mandir)/man8
65man9dir = $(mandir)/man9
405ea7a0 66
e5c3f801
NN
67INSTALL = @INSTALL@
68INSTALL_PROGRAM = @INSTALL_PROGRAM@
69INSTALL_SCRIPT = @INSTALL_SCRIPT@
70INSTALL_DATA = @INSTALL_DATA@
656fdd47
PB
71LN = @LN@
72LN_S = @LN_S@
405ea7a0 73
50212802
NN
74# -------------------------------------------------
75# Miscellaneous non-standard autoconf-set variables
76# -------------------------------------------------
405ea7a0 77
50212802
NN
78# The gcc driver likes to know the arguments it was configured with.
79TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
405ea7a0 80
50212802
NN
81tooldir = @tooldir@
82build_tooldir = @build_tooldir@
405ea7a0 83
50212802 84GDB_NLM_DEPS =
405ea7a0 85
50212802
NN
86# This is the name of the environment variable used for the path to
87# the libraries.
88RPATH_ENVVAR = @RPATH_ENVVAR@
405ea7a0 89
50212802 90# This is the list of directories to be built for the build system.
be75bbe1 91BUILD_CONFIGDIRS = libiberty
50212802
NN
92# Build programs are put under this directory.
93BUILD_SUBDIR = @build_subdir@
94# This is set by the configure script to the arguments to use when configuring
95# directories built for the build system.
a7254363 96BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
6a9cf61e
PB
97
98# This is the list of variables to export in the environment when
99# configuring any subdirectory. It must also be exported whenever
100# recursing into a build directory in case that directory's Makefile
101# re-runs configure.
102BASE_EXPORTS = \
103 FLEX="$(FLEX)"; export FLEX; \
104 LEX="$(LEX)"; export LEX; \
105 BISON="$(BISON)"; export BISON; \
106 YACC="$(YACC)"; export YACC; \
107 M4="$(M4)"; export M4; \
108 MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
109
378fce5b 110# This is the list of variables to export in the environment when
6a9cf61e 111# configuring subdirectories for the build system.
378fce5b 112BUILD_EXPORTS = \
6a9cf61e 113 $(BASE_EXPORTS) \
378fce5b
DD
114 AR="$(AR_FOR_BUILD)"; export AR; \
115 AS="$(AS_FOR_BUILD)"; export AS; \
116 CC="$(CC_FOR_BUILD)"; export CC; \
117 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
118 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
119 CXX="$(CXX_FOR_BUILD)"; export CXX; \
120 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
121 GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
122 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
123 DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
124 LD="$(LD_FOR_BUILD)"; export LD; \
125 LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
126 NM="$(NM_FOR_BUILD)"; export NM; \
127 RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
128 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES;
50212802
NN
129
130# This is the list of directories to built for the host system.
131SUBDIRS = @configdirs@
132# This is set by the configure script to the arguments to use when configuring
133# directories built for the host system.
134HOST_CONFIGARGS = @host_configargs@
b00612cc
PB
135# Host programs are put under this directory, which is . except if building
136# with srcdir=..
137HOST_SUBDIR = @host_subdir@
378fce5b 138# This is the list of variables to export in the environment when
be01d343
PB
139# configuring subdirectories for the host system. We need to pass
140# some to the GCC configure because of its hybrid host/target nature.
378fce5b 141HOST_EXPORTS = \
6a9cf61e 142 $(BASE_EXPORTS) \
378fce5b
DD
143 CC="$(CC)"; export CC; \
144 CFLAGS="$(CFLAGS)"; export CFLAGS; \
145 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
146 CXX="$(CXX)"; export CXX; \
147 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
148 AR="$(AR)"; export AR; \
149 AS="$(AS)"; export AS; \
150 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
151 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
152 LD="$(LD)"; export LD; \
153 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
154 NM="$(NM)"; export NM; \
155 RANLIB="$(RANLIB)"; export RANLIB; \
156 WINDRES="$(WINDRES)"; export WINDRES; \
157 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
95b6a1f2 158 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
be01d343
PB
159 AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
160 AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
161 GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
162 LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
163 NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
164 OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
165 RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
378fce5b
DD
166 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
167 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
315b3b02 168 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
f70224b5
PB
169@if gcc-bootstrap
170 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
171@endif gcc-bootstrap
e90269c8 172 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
378fce5b
DD
173
174# Similar, for later GCC stages.
d545f33b 175POSTSTAGE1_HOST_EXPORTS = \
7ffa0b57 176 $(HOST_EXPORTS) \
b00612cc
PB
177 CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
178 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
179 CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \
180 $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
181 -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
182 -B$(build_tooldir)/bin/"; export CC_FOR_BUILD;
50212802
NN
183
184# This is set by the configure script to the list of directories which
185# should be built using the target tools.
186TARGET_CONFIGDIRS = @target_configdirs@
187# Target libraries are put under this directory:
188TARGET_SUBDIR = @target_subdir@
189# This is set by the configure script to the arguments to use when configuring
190# directories built for the target.
a7254363 191TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
378fce5b 192# This is the list of variables to export in the environment when
6a9cf61e 193# configuring subdirectories for the host system.
378fce5b 194BASE_TARGET_EXPORTS = \
6a9cf61e 195 $(BASE_EXPORTS) \
378fce5b 196 AR="$(AR_FOR_TARGET)"; export AR; \
be01d343 197 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
378fce5b
DD
198 CC="$(CC_FOR_TARGET)"; export CC; \
199 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
200 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
06bcb89d 201 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
378fce5b
DD
202 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
203 GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
204 GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
205 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
be01d343 206 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
378fce5b 207 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
7e0f7140 208 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
be01d343 209 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
5ae72758 210 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
378fce5b 211 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
7e0f7140 212 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
315b3b02 213 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
e90269c8 214 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
378fce5b
DD
215
216RAW_CXX_TARGET_EXPORTS = \
217 $(BASE_TARGET_EXPORTS) \
218 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
219 CXX="$(RAW_CXX_FOR_TARGET)"; export CXX;
220
221NORMAL_TARGET_EXPORTS = \
222 $(BASE_TARGET_EXPORTS) \
223 CXX="$(CXX_FOR_TARGET)"; export CXX;
50212802 224
4b1cb4fe
DD
225# Where to find GMP
226HOST_GMPLIBS = @gmplibs@
227HOST_GMPINC = @gmpinc@
228
50212802
NN
229# ----------------------------------------------
230# Programs producing files for the BUILD machine
231# ----------------------------------------------
232
233SHELL = @config_shell@
234
235# pwd command to use. Allow user to override default by setting PWDCMD in
236# the environment to account for automounters. The make variable must not
237# be called PWDCMD, otherwise the value set here is passed to make
238# subprocesses and overrides the setting from the user's environment.
b40e3958
L
239# Don't use PWD since it is a common shell environment variable and we
240# don't want to corrupt it.
241PWD_COMMAND = $${PWDCMD-pwd}
50212802
NN
242
243# compilers to use to create programs which must be run in the build
244# environment.
245CC_FOR_BUILD = @CC_FOR_BUILD@
5fbad20a 246CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
50212802
NN
247
248CXX_FOR_BUILD = $(CXX)
249
250# Special variables passed down in EXTRA_GCC_FLAGS. They are defined
251# here so that they can be overridden by Makefile fragments.
50212802
NN
252BUILD_PREFIX = @BUILD_PREFIX@
253BUILD_PREFIX_1 = @BUILD_PREFIX_1@
405ea7a0 254
0df3d27f
PB
255# Flags to pass to stage2 and later makes. They are defined
256# here so that they can be overridden by Makefile fragments.
257BOOT_CFLAGS= -g -O2
258
be01d343
PB
259BISON = @BISON@
260YACC = @YACC@
261FLEX = @FLEX@
262LEX = @LEX@
263M4 = @M4@
264MAKEINFO = @MAKEINFO@
265EXPECT = @EXPECT@
266RUNTEST = @RUNTEST@
405ea7a0
NN
267
268# This just becomes part of the MAKEINFO definition passed down to
269# sub-makes. It lets flags be given on the command line while still
270# using the makeinfo from the object tree.
62a3fc85
DD
271# (Default to avoid splitting info files by setting the threshold high.)
272MAKEINFOFLAGS = --split-size=5000000
405ea7a0 273
50212802
NN
274# ---------------------------------------------
275# Programs producing files for the HOST machine
276# ---------------------------------------------
405ea7a0 277
50212802 278AS = @AS@
50212802
NN
279AR = @AR@
280AR_FLAGS = rc
50212802 281CC = @CC@
50212802 282CXX = @CXX@
50212802 283DLLTOOL = @DLLTOOL@
50212802 284LD = @LD@
be01d343
PB
285LIPO = @LIPO@
286NM = @NM@
50212802 287RANLIB = @RANLIB@
be01d343 288STRIP = @STRIP@
50212802 289WINDRES = @WINDRES@
405ea7a0 290
be01d343
PB
291CFLAGS = @CFLAGS@
292LDFLAGS =
293LIBCFLAGS = $(CFLAGS)
294CXXFLAGS = @CXXFLAGS@
295LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
50212802
NN
296PICFLAG =
297
298# -----------------------------------------------
299# Programs producing files for the TARGET machine
300# -----------------------------------------------
405ea7a0 301
58daee98 302FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
405ea7a0 303
50212802 304AR_FOR_TARGET=@AR_FOR_TARGET@
852e5f18 305AS_FOR_TARGET=@AS_FOR_TARGET@
55db4b87 306CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
55db4b87 307
50212802
NN
308# If GCC_FOR_TARGET is not overriden on the command line, then this
309# variable is passed down to the gcc Makefile, where it is used to
310# build libgcc2.a. We define it here so that it can itself be
311# overridden on the command line.
be01d343 312GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
55db4b87 313CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
55db4b87 314RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
55db4b87 315GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
55db4b87 316GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
852e5f18 317DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
50212802 318LD_FOR_TARGET=@LD_FOR_TARGET@
50212802 319
7e0f7140 320LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
50212802 321NM_FOR_TARGET=@NM_FOR_TARGET@
5ae72758 322OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
852e5f18 323RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
7e0f7140 324STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
50212802 325WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
405ea7a0 326
be01d343
PB
327COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
328COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
329COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
330
331# During gcc bootstrap, if we use some random cc for stage1 then
332# CFLAGS will be just -g. We want to ensure that TARGET libraries
333# (which we know are built with gcc) are built with optimizations so
334# prepend -O2 when setting CFLAGS_FOR_TARGET.
335CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
336SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
337CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
338LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
339LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
340LDFLAGS_FOR_TARGET =
50212802
NN
341PICFLAG_FOR_TARGET =
342
343# ------------------------------------
344# Miscellaneous targets and flag lists
345# ------------------------------------
346
405ea7a0
NN
347# The first rule in the file had better be this one. Don't put any above it.
348# This lives here to allow makefile fragments to contain dependencies.
f70224b5 349all:
405ea7a0 350
405ea7a0 351#### host and target specific makefile fragments come in here.
a0da8069
NN
352@target_makefile_frag@
353@alphaieee_frag@
354@ospace_frag@
355@host_makefile_frag@
405ea7a0
NN
356###
357
e90269c8
PB
358# This is the list of directories that may be needed in RPATH_ENVVAR
359# so that prorgams built for the target machine work.
360TARGET_LIB_PATH = [+ FOR target_modules +][+
361 IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
362 ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
363[+ FOR target_modules +][+ IF lib_path +]
364@if target-[+module+]
365TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
366@endif target-[+module+]
367[+ ENDIF lib_path +][+ ENDFOR target_modules +]
368
369
370# This is the list of directories that may be needed in RPATH_ENVVAR
371# so that programs built for the host machine work.
372HOST_LIB_PATH = [+ FOR host_modules +][+
373 IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
374 ENDFOR host_modules +]
375
376# Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
377@if gcc
378HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
379@endif gcc
380
381[+ FOR host_modules +][+ IF lib_path +]
382@if [+module+]
383HOST_LIB_PATH_[+module+] = \
384 $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
385 +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
386@endif [+module+]
387[+ ENDIF lib_path +][+ ENDFOR host_modules +]
388
405ea7a0 389# Flags to pass down to all sub-makes.
12f0bd74
NN
390BASE_FLAGS_TO_PASS = [+ FOR flags_to_pass +]\
391 "[+flag+]=$([+flag+])" [+ ENDFOR flags_to_pass +]\
10ecffb9 392 "CONFIG_SHELL=$(SHELL)" \
12f0bd74 393 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"
405ea7a0 394
55db4b87
PB
395# We leave this in just in case, but it is not needed anymore.
396RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
656fdd47 397
405ea7a0
NN
398# Flags to pass down to most sub-makes, in which we're building with
399# the host environment.
405ea7a0
NN
400EXTRA_HOST_FLAGS = \
401 'AR=$(AR)' \
402 'AS=$(AS)' \
403 'CC=$(CC)' \
404 'CXX=$(CXX)' \
405 'DLLTOOL=$(DLLTOOL)' \
406 'LD=$(LD)' \
be01d343 407 'LIPO=$(LIPO)' \
405ea7a0 408 'NM=$(NM)' \
b9459e83 409 'RANLIB=$(RANLIB)' \
be01d343 410 'STRIP=$(STRIP)' \
405ea7a0
NN
411 'WINDRES=$(WINDRES)'
412
413FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
414
415# Flags that are concerned with the location of the X11 include files
416# and library files
417#
418# NOTE: until the top-level is getting the values via autoconf, it only
419# causes problems to have this top-level Makefile overriding the autoconf-set
420# values in child directories. Only variables that don't conflict with
421# autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
422#
423X11_FLAGS_TO_PASS = \
424 'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
425 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
426
427# Flags to pass down to makes which are built with the target environment.
0aed8855
PB
428# The double $ decreases the length of the command line; those variables
429# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The
430# COMPILER_ prefixed variables are not passed down so we expand them here.
405ea7a0
NN
431EXTRA_TARGET_FLAGS = \
432 'AR=$$(AR_FOR_TARGET)' \
0aed8855 433 'AS=$(COMPILER_AS_FOR_TARGET)' \
405ea7a0
NN
434 'CC=$$(CC_FOR_TARGET)' \
435 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
436 'CXX=$$(CXX_FOR_TARGET)' \
437 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
438 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
0aed8855 439 'LD=$(COMPILER_LD_FOR_TARGET)' \
414e5532 440 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
405ea7a0
NN
441 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
442 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
0aed8855 443 'NM=$(COMPILER_NM_FOR_TARGET)' \
5ae72758 444 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
405ea7a0
NN
445 'RANLIB=$$(RANLIB_FOR_TARGET)' \
446 'WINDRES=$$(WINDRES_FOR_TARGET)'
447
448TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
449
450# Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
451# unfortunately needs the native compiler and the target ar and
452# ranlib.
453# If any variables are added here, they must be added to do-*, below.
2a4cbe27 454# The BUILD_* variables are a special case, which are used for the gcc
405ea7a0
NN
455# cross-building scheme.
456EXTRA_GCC_FLAGS = \
405ea7a0
NN
457 'BUILD_PREFIX=$(BUILD_PREFIX)' \
458 'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \
405ea7a0 459 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
3dee29da
NN
460 "`echo 'LANGUAGES=$(LANGUAGES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
461 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
462 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
463 "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
464 "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
465 "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
466 "`echo 'STAGE1_CFLAGS=$(STAGE1_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
467 "`echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
468 "`echo 'BOOT_ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
405ea7a0 469
f0b24077 470GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
405ea7a0 471
dd12c3a8 472.PHONY: configure-host
b813574b 473configure-host: [+
dd12c3a8
NN
474 FOR host_modules +] \
475 maybe-configure-[+module+][+
476 ENDFOR host_modules +]
477.PHONY: configure-target
478configure-target: [+
479 FOR target_modules +] \
480 maybe-configure-target-[+module+][+
481 ENDFOR target_modules +]
405ea7a0 482
319cab08
PB
483# The target built for a native non-bootstrap build.
484.PHONY: all
f70224b5
PB
485all:
486@if gcc-bootstrap
be01d343 487 [ -f stage_final ] || echo stage3 > stage_final
f70224b5
PB
488 @r=`${PWD_COMMAND}`; export r; \
489 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
0aed8855 490 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
f70224b5 491@endif gcc-bootstrap
0aed8855 492 @: $(MAKE); $(unstage)
f70224b5
PB
493 @r=`${PWD_COMMAND}`; export r; \
494 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
495 if [ -f stage_last ]; then \
be01d343 496 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
f70224b5 497 else \
be01d343 498 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
f70224b5 499 fi
dd12c3a8 500
6a9cf61e
PB
501.PHONY: all-build
502all-build: [+
503 FOR build_modules +] \
504 maybe-all-build-[+module+][+
505 ENDFOR build_modules +]
dd12c3a8 506.PHONY: all-host
b813574b 507all-host: [+
dd12c3a8
NN
508 FOR host_modules +] \
509 maybe-all-[+module+][+
510 ENDFOR host_modules +]
511.PHONY: all-target
512all-target: [+
513 FOR target_modules +] \
514 maybe-all-target-[+module+][+
515 ENDFOR target_modules +]
405ea7a0
NN
516
517# Do a target for all the subdirectories. A ``make do-X'' will do a
518# ``make X'' in all subdirectories (because, in general, there is a
519# dependency (below) of X upon do-X, a ``make X'' will also do this,
520# but it may do additional work as well).
e393202e 521[+ FOR recursive_targets +]
27b1cc72 522.PHONY: do-[+make_target+]
f70224b5 523do-[+make_target+]:
0aed8855 524 @: $(MAKE); $(unstage)
e360f423
PB
525 @r=`${PWD_COMMAND}`; export r; \
526 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
527 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
f70224b5 528 [+make_target+]-target
f70224b5 529
2a4cbe27
NN
530
531.PHONY: [+make_target+]-host
b813574b 532[+make_target+]-host: [+
2a4cbe27
NN
533 FOR host_modules +] \
534 maybe-[+make_target+]-[+module+][+
535 ENDFOR host_modules +]
536
537.PHONY: [+make_target+]-target
538[+make_target+]-target: [+
539 FOR target_modules +] \
540 maybe-[+make_target+]-target-[+module+][+
541 ENDFOR target_modules +]
e393202e
NN
542[+ ENDFOR recursive_targets +]
543
405ea7a0
NN
544# Here are the targets which correspond to the do-X targets.
545
6d389afc 546.PHONY: info installcheck dvi html install-info
405ea7a0
NN
547.PHONY: clean distclean mostlyclean maintainer-clean realclean
548.PHONY: local-clean local-distclean local-maintainer-clean
549info: do-info
550installcheck: do-installcheck
551dvi: do-dvi
6d389afc 552html: do-html
405ea7a0 553
43d92c63
NN
554# Make sure makeinfo is built before we do a `make info', if we're
555# in fact building texinfo.
556do-info: maybe-all-texinfo
405ea7a0
NN
557
558install-info: do-install-info dir.info
b40e3958 559 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
405ea7a0 560 if [ -f dir.info ] ; then \
497f816e 561 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
405ea7a0
NN
562 else true ; fi
563
564local-clean:
565 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
566
567local-distclean:
568 -rm -f Makefile config.status config.cache mh-frag mt-frag
0aed8855 569 -rm -f maybedep.tmp serdep.tmp
405ea7a0
NN
570 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
571 rm -rf $(TARGET_SUBDIR); \
572 else true; fi
e4c4d240 573 -rm -rf $(BUILD_SUBDIR)
b00612cc
PB
574 -if [ "$(HOST_SUBDIR)" != "." ]; then \
575 rm -rf $(HOST_SUBDIR); \
576 else true; fi
405ea7a0
NN
577 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
578 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
579 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
580 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
581 -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
582
583local-maintainer-clean:
584 @echo "This command is intended for maintainers to use;"
585 @echo "it deletes files that may require special tools to rebuild."
586
587clean: do-clean local-clean
588mostlyclean: do-mostlyclean local-clean
589distclean: do-distclean local-clean local-distclean
590maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
591maintainer-clean: local-distclean
592realclean: maintainer-clean
593
be01d343 594# Extra dependency for clean-target, owing to the mixed nature of gcc.
2a4cbe27 595clean-target: clean-target-libgcc
405ea7a0 596clean-target-libgcc:
be01d343 597 test ! -d gcc || (cd gcc && $(MAKE) $@)
405ea7a0
NN
598
599# Check target.
600
601.PHONY: check do-check
ede4fbe4 602check: do-check
405ea7a0 603
3866be5d 604# Only include modules actually being configured and built.
f70224b5
PB
605.PHONY: check-host
606check-host: [+
16ae0395
NN
607 FOR host_modules +] \
608 maybe-check-[+module+][+
f70224b5
PB
609 ENDFOR host_modules +]
610
611.PHONY: check-target
612check-target: [+
16ae0395
NN
613 FOR target_modules +] \
614 maybe-check-target-[+module+][+
f70224b5
PB
615 ENDFOR target_modules +]
616
617do-check:
0aed8855 618 @: $(MAKE); $(unstage)
e360f423
PB
619 @r=`${PWD_COMMAND}`; export r; \
620 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
621 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
405ea7a0
NN
622
623# Automated reporting of test results.
624
625warning.log: build.log
626 $(srcdir)/contrib/warn_summary build.log > $@
627
628mail-report.log:
629 if test x'$(BOOT_CFLAGS)' != x''; then \
630 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
631 fi; \
632 $(srcdir)/contrib/test_summary -t >$@
633 chmod +x $@
634 echo If you really want to send e-mail, run ./$@ now
635
636mail-report-with-warnings.log: warning.log
637 if test x'$(BOOT_CFLAGS)' != x''; then \
638 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
639 fi; \
640 $(srcdir)/contrib/test_summary -t -i warning.log >$@
641 chmod +x $@
642 echo If you really want to send e-mail, run ./$@ now
643
644# Installation targets.
645
ae831be5 646.PHONY: install uninstall
f70224b5 647install:
0aed8855 648 @: $(MAKE); $(unstage)
e360f423
PB
649 @r=`${PWD_COMMAND}`; export r; \
650 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
651 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
dd12c3a8 652
16ae0395
NN
653.PHONY: install-host-nogcc
654install-host-nogcc: [+
9e6ce191
PB
655 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
656 maybe-install-[+module+][+ ENDIF +][+
16ae0395
NN
657 ENDFOR host_modules +]
658
dd12c3a8 659.PHONY: install-host
b813574b 660install-host: [+
dd12c3a8
NN
661 FOR host_modules +] \
662 maybe-install-[+module+][+
663 ENDFOR host_modules +]
16ae0395 664
dd12c3a8
NN
665.PHONY: install-target
666install-target: [+
667 FOR target_modules +] \
668 maybe-install-target-[+module+][+
669 ENDFOR target_modules +]
405ea7a0
NN
670
671uninstall:
672 @echo "the uninstall target is not supported in this tree"
673
405ea7a0
NN
674.PHONY: install.all
675install.all: install-no-fixedincludes
676 @if [ -f ./gcc/Makefile ] ; then \
b40e3958 677 r=`${PWD_COMMAND}` ; export r ; \
0aed8855 678 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7ffa0b57 679 $(HOST_EXPORTS) \
1086bc09 680 (cd ./gcc && \
405ea7a0
NN
681 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
682 else \
683 true ; \
684 fi
685
686# install-no-fixedincludes is used because Cygnus can not distribute
687# the fixed header files.
688.PHONY: install-no-fixedincludes
16ae0395 689install-no-fixedincludes: installdirs install-host-nogcc \
dd12c3a8 690 install-target gcc-no-fixedincludes
405ea7a0 691
15723a45 692### other supporting targets
405ea7a0 693
15723a45
NN
694MAKEDIRS= \
695 $(DESTDIR)$(prefix) \
696 $(DESTDIR)$(exec_prefix)
697.PHONY: installdirs
698installdirs: mkinstalldirs
699 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
700
701dir.info: do-install-info
702 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
497f816e 703 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
15723a45
NN
704 mv -f dir.info.new dir.info ; \
705 else true ; \
405ea7a0
NN
706 fi
707
15723a45
NN
708dist:
709 @echo "Building a full distribution of this tree isn't done"
710 @echo "via 'make dist'. Check out the etc/ subdirectory"
711
712etags tags: TAGS
713
714# Right now this just builds TAGS in each subdirectory. emacs19 has the
715# ability to use several tags files at once, so there is probably no need
716# to combine them into one big TAGS file (like CVS 1.3 does). We could
717# (if we felt like it) have this Makefile write a piece of elisp which
718# the user could load to tell emacs19 where all the TAGS files we just
719# built are.
720TAGS: do-TAGS
721
a7254363
PB
722# ------------------------------------
723# Macros for configure and all targets
724# ------------------------------------
725
726[+ DEFINE configure +]
727.PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
728maybe-configure-[+prefix+][+module+]:
729@if [+prefix+][+module+]
730maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
0aed8855 731configure-[+prefix+][+module+]:
a7254363 732 @[+ IF bootstrap +]test -f stage_last && exit 0; \
0aed8855
PB
733 [+ ELSE bootstrap +]: $(MAKE); $(unstage)
734 @[+ ENDIF bootstrap +][+ IF check_multilibs
735 +]r=`${PWD_COMMAND}`; export r; \
736 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
737 echo "Checking multilib configuration for [+module+]..."; \
738 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
739 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
740 if test -r [+subdir+]/[+module+]/multilib.out; then \
741 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
742 rm -f [+subdir+]/[+module+]/multilib.tmp; \
743 else \
744 rm -f [+subdir+]/[+module+]/Makefile; \
745 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
746 fi; \
747 else \
748 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
749 fi
750 @[+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
a7254363 751 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
b40e3958
L
752 r=`${PWD_COMMAND}`; export r; \
753 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a7254363
PB
754 [+exports+] \
755 echo Configuring in [+subdir+]/[+module+]; \
756 cd "[+subdir+]/[+module+]" || exit 1; \
bba45b8b 757 case $(srcdir) in \
b00612cc 758 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
a7254363 759 *) topdir=`echo [+subdir+]/[+module+]/ | \
b00612cc 760 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
bba45b8b 761 esac; \
b00612cc
PB
762 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
763 libsrcdir="$$s/[+module+]"; \
a7254363
PB
764 [+ IF no-config-site +]rm -f no-such-file || : ; \
765 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
766 [+args+] $${srcdiroption} [+extra_configure_flags+] \
bba45b8b 767 || exit 1
a7254363 768@endif [+prefix+][+module+]
d545f33b
PB
769
770[+ IF bootstrap +]
771[+ FOR bootstrap_stage +]
772.PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
773maybe-configure-stage[+id+]-[+prefix+][+module+]:
0aed8855 774@if [+prefix+][+module+]-bootstrap
d545f33b 775maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
0aed8855 776configure-stage[+id+]-[+prefix+][+module+]:
f70224b5 777 @[ `cat stage_current` = stage[+id+] ] || $(MAKE) stage[+id+]-start
0aed8855
PB
778 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
779 [+ IF check_multilibs
780 +]@r=`${PWD_COMMAND}`; export r; \
d545f33b 781 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
0aed8855
PB
782 echo "Checking multilib configuration for [+module+]..."; \
783 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
784 if test -r [+subdir+]/[+module+]/multilib.out; then \
785 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
786 rm -f [+subdir+]/[+module+]/multilib.tmp; \
787 else \
788 rm -f [+subdir+]/[+module+]/Makefile; \
789 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
790 fi; \
791 else \
792 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
793 fi
794 @[+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
d545f33b
PB
795 [+exports+][+ IF prev +] \
796 [+poststage1_exports+][+ ENDIF prev +] \
797 echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
0aed8855 798 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
d545f33b
PB
799 cd [+subdir+]/[+module+] || exit 1; \
800 case $(srcdir) in \
801 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
802 *) topdir=`echo [+subdir+]/[+module+]/ | \
803 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
804 esac; \
805 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
806 libsrcdir="$$s/[+module+]"; \
807 $(SHELL) $${libsrcdir}/configure \
808 [+args+] $${srcdiroption} \
809 [+stage_configure_flags+] [+extra_configure_flags+]
0aed8855 810@endif [+prefix+][+module+]-bootstrap
d545f33b
PB
811[+ ENDFOR bootstrap_stage +]
812[+ ENDIF bootstrap +]
a7254363
PB
813[+ ENDDEF +]
814
815[+ DEFINE all +]
816.PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
817maybe-all-[+prefix+][+module+]:
818@if [+prefix+][+module+]
819TARGET-[+prefix+][+module+]=[+
820 IF target +][+target+][+ ELSE +]all[+ ENDIF target +]
821maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
822all-[+prefix+][+module+]: configure-[+prefix+][+module+]
823 @[+ IF bootstrap +]test -f stage_last && exit 0; \
0aed8855 824 [+ ELSE bootstrap +]: $(MAKE); $(unstage)
f70224b5 825 @[+ ENDIF bootstrap +]r=`${PWD_COMMAND}`; export r; \
b40e3958 826 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a7254363
PB
827 [+exports+] \
828 (cd [+subdir+]/[+module+] && \
829 $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
830@endif [+prefix+][+module+]
d545f33b
PB
831
832[+ IF bootstrap +]
833[+ FOR bootstrap_stage +]
834.PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
835.PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
836maybe-all-stage[+id+]-[+prefix+][+module+]:
837maybe-clean-stage[+id+]-[+prefix+][+module+]:
0aed8855 838@if [+prefix+][+module+]-bootstrap
d545f33b
PB
839maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
840all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
f70224b5 841TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
d545f33b 842all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
f70224b5 843 @[ `cat stage_current` = stage[+id+] ] || $(MAKE) stage[+id+]-start
d545f33b
PB
844 @r=`${PWD_COMMAND}`; export r; \
845 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
846 [+exports+][+ IF prev +] \
847 [+poststage1_exports+][+ ENDIF prev +] \
848 cd [+subdir+]/[+module+] && \
849 $(MAKE) [+args+] [+ IF prev
850 +][+poststage1_args+][+ ENDIF prev
f70224b5
PB
851 +] [+stage_make_flags+] [+extra_make_flags+] \
852 $(TARGET-stage[+id+]-[+prefix+][+module+])
d545f33b
PB
853
854maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
855clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
856clean-stage[+id+]-[+prefix+][+module+]:
857 @[ -f [+subdir+]/[+module+]/Makefile ] || [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] \
858 || exit 0 ; \
f70224b5 859 @[ `cat stage_current` = stage[+id+] ] || $(MAKE) stage[+id+]-start
d545f33b
PB
860 cd [+subdir+]/[+module+] && \
861 $(MAKE) [+args+] [+ IF prev +] \
862 [+poststage1_args+] [+ ENDIF prev +] \
863 [+stage_make_flags+] [+extra_make_flags+] clean
0aed8855 864@endif [+prefix+][+module+]-bootstrap
d545f33b
PB
865
866[+ ENDFOR bootstrap_stage +]
867[+ ENDIF bootstrap +]
a7254363
PB
868[+ ENDDEF +]
869
870# --------------------------------------
871# Modules which run on the build machine
872# --------------------------------------
873[+ FOR build_modules +]
874[+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
875 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
876
877[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
878[+ ENDFOR build_module +]
405ea7a0 879
15723a45
NN
880# --------------------------------------
881# Modules which run on the host machine
882# --------------------------------------
3866be5d 883[+ FOR host_modules +]
d545f33b
PB
884[+ configure prefix="" subdir="$(HOST_SUBDIR)"
885 exports="$(HOST_EXPORTS)"
886 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
a7254363 887 args="$(HOST_CONFIGARGS)" +]
e2b9e2dc 888
d545f33b
PB
889[+ all prefix="" subdir="$(HOST_SUBDIR)"
890 exports="$(HOST_EXPORTS)"
891 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
892 args="$(FLAGS_TO_PASS)"
893 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
405ea7a0 894
16ae0395
NN
895.PHONY: check-[+module+] maybe-check-[+module+]
896maybe-check-[+module+]:
6bd3dfaa
PB
897@if [+module+]
898maybe-check-[+module+]: check-[+module+]
3866be5d 899[+ IF no_check +]
3866be5d
NN
900check-[+module+]:
901[+ ELIF no_check_cross +]
3866be5d
NN
902# This module is only tested in a native toolchain.
903check-[+module+]:
0aed8855 904 @: $(MAKE); $(unstage)
7f121bbf 905 @if [ '$(host)' = '$(target)' ] ; then \
b40e3958
L
906 r=`${PWD_COMMAND}`; export r; \
907 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
378fce5b 908 $(HOST_EXPORTS) \
b00612cc 909 (cd $(HOST_SUBDIR)/[+module+] && \
4cfaf6d5 910 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
bba45b8b
NN
911 fi
912[+ ELSE check +]
bba45b8b 913check-[+module+]:
0aed8855 914 @: $(MAKE); $(unstage)
b40e3958
L
915 @r=`${PWD_COMMAND}`; export r; \
916 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
378fce5b 917 $(HOST_EXPORTS) \
b00612cc
PB
918 (cd $(HOST_SUBDIR)/[+module+] && \
919 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
3866be5d 920[+ ENDIF no_check +]
6bd3dfaa 921@endif [+module+]
405ea7a0 922
930314a4
NN
923.PHONY: install-[+module+] maybe-install-[+module+]
924maybe-install-[+module+]:
6bd3dfaa
PB
925@if [+module+]
926maybe-install-[+module+]: install-[+module+]
16ae0395 927[+ IF no_install +]
3866be5d
NN
928install-[+module+]:
929[+ ELSE install +]
3866be5d 930install-[+module+]: installdirs
0aed8855 931 @: $(MAKE); $(unstage)
b40e3958
L
932 @r=`${PWD_COMMAND}`; export r; \
933 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
378fce5b 934 $(HOST_EXPORTS) \
b00612cc 935 (cd $(HOST_SUBDIR)/[+module+] && \
2da12f12 936 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
3866be5d 937[+ ENDIF no_install +]
6bd3dfaa 938@endif [+module+]
4fa63067
NN
939
940# Other targets (info, dvi, etc.)
941[+ FOR recursive_targets +]
942.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
943maybe-[+make_target+]-[+module+]:
6bd3dfaa
PB
944@if [+module+]
945maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
4fa63067
NN
946[+ IF (match-value? = "missing" (get "make_target") ) +]
947# [+module+] doesn't support [+make_target+].
948[+make_target+]-[+module+]:
949[+ ELSE +]
950[+make_target+]-[+module+]: [+
951 FOR depend +]\
952 [+depend+]-[+module+] [+
953 ENDFOR depend +]
0aed8855 954 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
f70224b5 955 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
4fa63067
NN
956 r=`${PWD_COMMAND}`; export r; \
957 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
378fce5b 958 $(HOST_EXPORTS) \
b813574b 959 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
4fa63067
NN
960 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
961 done; \
962 echo "Doing [+make_target+] in [+module+]" ; \
b00612cc 963 (cd $(HOST_SUBDIR)/[+module+] && \
4fa63067
NN
964 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
965 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
966 "RANLIB=$${RANLIB}" \
967 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
b813574b 968 [+make_target+]) \
4fa63067
NN
969 || exit 1
970[+ ENDIF +]
6bd3dfaa 971@endif [+module+]
4fa63067 972[+ ENDFOR recursive_targets +]
3866be5d 973[+ ENDFOR host_modules +]
405ea7a0 974
15723a45
NN
975# ---------------------------------------
976# Modules which run on the target machine
977# ---------------------------------------
e393202e 978[+ FOR target_modules +]
15723a45 979
a7254363
PB
980[+ IF raw_cxx +]
981[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
0aed8855 982 check_multilibs=true
a7254363
PB
983 exports="$(RAW_CXX_TARGET_EXPORTS)"
984 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
985
986[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
987 exports="$(RAW_CXX_TARGET_EXPORTS)"
988 args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
989[+ ELSE +]
990[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
0aed8855 991 check_multilibs=true
a7254363
PB
992 exports="$(NORMAL_TARGET_EXPORTS)"
993 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
994
995[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
996 exports="$(NORMAL_TARGET_EXPORTS)"
997 args="$(TARGET_FLAGS_TO_PASS)" +]
998[+ ENDIF +]
16ae0395
NN
999
1000.PHONY: check-target-[+module+] maybe-check-target-[+module+]
1001maybe-check-target-[+module+]:
6bd3dfaa
PB
1002@if target-[+module+]
1003maybe-check-target-[+module+]: check-target-[+module+]
3866be5d
NN
1004[+ IF no_check +]
1005# Dummy target for uncheckable module.
3866be5d
NN
1006check-target-[+module+]:
1007[+ ELSE check +]
e393202e 1008check-target-[+module+]:
0aed8855 1009 @: $(MAKE); $(unstage)
b40e3958 1010 @r=`${PWD_COMMAND}`; export r; \
e90269c8 1011 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
378fce5b
DD
1012IF raw_cxx +]
1013 $(RAW_CXX_TARGET_EXPORTS) \[+
1014ELSE normal_cxx +]
1015 $(NORMAL_TARGET_EXPORTS) \[+
1016ENDIF raw_cxx +]
bba45b8b
NN
1017 (cd $(TARGET_SUBDIR)/[+module+] && \
1018 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1019 IF raw_cxx
1020 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1021 ENDIF raw_cxx
7ffa0b57 1022 +] [+extra_make_flags+] check)
e393202e 1023[+ ENDIF no_check +]
6bd3dfaa 1024@endif target-[+module+]
16ae0395 1025
930314a4
NN
1026.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1027maybe-install-target-[+module+]:
6bd3dfaa
PB
1028@if target-[+module+]
1029maybe-install-target-[+module+]: install-target-[+module+]
16ae0395 1030[+ IF no_install +]
930314a4
NN
1031# Dummy target for uninstallable.
1032install-target-[+module+]:
1033[+ ELSE install +]
e393202e 1034install-target-[+module+]: installdirs
0aed8855 1035 @: $(MAKE); $(unstage)
b40e3958 1036 @r=`${PWD_COMMAND}`; export r; \
e90269c8 1037 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
378fce5b
DD
1038IF raw_cxx +]
1039 $(RAW_CXX_TARGET_EXPORTS) \[+
1040ELSE normal_cxx +]
1041 $(NORMAL_TARGET_EXPORTS) \[+
1042ENDIF raw_cxx +]
bba45b8b 1043 (cd $(TARGET_SUBDIR)/[+module+] && \
7ffa0b57 1044 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
e393202e 1045[+ ENDIF no_install +]
6bd3dfaa 1046@endif target-[+module+]
4fa63067
NN
1047
1048# Other targets (info, dvi, etc.)
1049[+ FOR recursive_targets +]
1050.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1051maybe-[+make_target+]-target-[+module+]:
6bd3dfaa
PB
1052@if target-[+module+]
1053maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
4fa63067
NN
1054[+ IF (match-value? = "missing" (get "make_target") ) +]
1055# [+module+] doesn't support [+make_target+].
1056[+make_target+]-target-[+module+]:
1057[+ ELSE +]
1058[+make_target+]-target-[+module+]: [+
1059 FOR depend +]\
1060 [+depend+]-target-[+module+] [+
1061 ENDFOR depend +]
0aed8855 1062 @: $(MAKE); $(unstage)
4fa63067
NN
1063 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1064 r=`${PWD_COMMAND}`; export r; \
e90269c8 1065 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
378fce5b
DD
1066IF raw_cxx +]
1067 $(RAW_CXX_TARGET_EXPORTS) \[+
1068ELSE normal_cxx +]
1069 $(NORMAL_TARGET_EXPORTS) \[+
1070ENDIF raw_cxx +]
4fa63067
NN
1071 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1072 for flag in $(EXTRA_TARGET_FLAGS); do \
1073 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1074 done; \
1075 (cd $(TARGET_SUBDIR)/[+module+] && \
1076 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1077 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1078 "RANLIB=$${RANLIB}" \
1079 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
7ffa0b57 1080 [+extra_make_flags+] [+make_target+]) \
4fa63067
NN
1081 || exit 1
1082[+ ENDIF +]
6bd3dfaa 1083@endif target-[+module+]
4fa63067 1084[+ ENDFOR recursive_targets +]
e393202e 1085[+ ENDFOR target_modules +]
405ea7a0 1086
15723a45
NN
1087# ----------
1088# GCC module
1089# ----------
1090
319cab08 1091@if gcc-no-bootstrap
b813574b
PB
1092# GCC has some more recursive targets, which trigger the old
1093# (but still current, until the toplevel bootstrap project
1094# is finished) compiler bootstrapping rules.
405ea7a0 1095
5b474aa8
DD
1096GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
1097.PHONY: $(GCC_STRAP_TARGETS)
9e6ce191 1098$(GCC_STRAP_TARGETS): all-prebootstrap configure-gcc
b40e3958
L
1099 @r=`${PWD_COMMAND}`; export r; \
1100 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7ffa0b57 1101 $(HOST_EXPORTS) \
405ea7a0 1102 echo "Bootstrapping the compiler"; \
e90269c8 1103 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
405ea7a0 1104 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
b40e3958
L
1105 @r=`${PWD_COMMAND}`; export r; \
1106 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
405ea7a0
NN
1107 case "$@" in \
1108 *bootstrap4-lean ) \
bba45b8b
NN
1109 msg="Comparing stage3 and stage4 of the compiler"; \
1110 compare=compare3-lean ;; \
1111 *bootstrap4 ) \
1112 msg="Comparing stage3 and stage4 of the compiler"; \
1113 compare=compare3 ;; \
1114 *-lean ) \
1115 msg="Comparing stage2 and stage3 of the compiler"; \
1116 compare=compare-lean ;; \
1117 * ) \
1118 msg="Comparing stage2 and stage3 of the compiler"; \
1119 compare=compare ;; \
405ea7a0 1120 esac; \
7ffa0b57 1121 $(HOST_EXPORTS) \
405ea7a0
NN
1122 echo "$$msg"; \
1123 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
b40e3958
L
1124 @r=`${PWD_COMMAND}`; export r; \
1125 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
405ea7a0 1126 echo "Building runtime libraries"; \
656fdd47 1127 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
405ea7a0 1128
9e6ce191 1129profiledbootstrap: all-prebootstrap configure-gcc
b40e3958
L
1130 @r=`${PWD_COMMAND}`; export r; \
1131 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7ffa0b57 1132 $(HOST_EXPORTS) \
e90269c8 1133 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
3e707e94 1134 echo "Bootstrapping training compiler"; \
ec7e0995 1135 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build
b40e3958 1136 @r=`${PWD_COMMAND}`; export r; \
b40e3958 1137 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7ffa0b57 1138 $(HOST_EXPORTS) \
ec7e0995
NN
1139 echo "Building feedback based compiler"; \
1140 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build
3e707e94
PB
1141 @r=`${PWD_COMMAND}`; export r; \
1142 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
3e707e94
PB
1143 echo "Building runtime libraries"; \
1144 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
ec7e0995 1145
405ea7a0 1146.PHONY: cross
72b2455a 1147cross: all-build all-gas all-ld
b40e3958
L
1148 @r=`${PWD_COMMAND}`; export r; \
1149 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7ffa0b57 1150 $(HOST_EXPORTS) \
405ea7a0
NN
1151 echo "Building the C and C++ compiler"; \
1152 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
b40e3958
L
1153 @r=`${PWD_COMMAND}`; export r; \
1154 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
405ea7a0 1155 echo "Building runtime libraries"; \
656fdd47 1156 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
319cab08 1157@endif gcc-no-bootstrap
405ea7a0 1158
6bd3dfaa 1159@if gcc
7d695d07
JM
1160.PHONY: check-gcc-c++
1161check-gcc-c++:
405ea7a0 1162 @if [ -f ./gcc/Makefile ] ; then \
b40e3958
L
1163 r=`${PWD_COMMAND}`; export r; \
1164 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7ffa0b57 1165 $(HOST_EXPORTS) \
1086bc09 1166 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
405ea7a0
NN
1167 else \
1168 true; \
7d695d07
JM
1169 fi
1170
1171.PHONY: check-c++
ede4fbe4 1172check-c++: check-target-libstdc++-v3 check-gcc-c++
405ea7a0 1173
15723a45
NN
1174# Install the gcc headers files, but not the fixed include files,
1175# which Cygnus is not allowed to distribute. This rule is very
1176# dependent on the workings of the gcc Makefile.in.
1177.PHONY: gcc-no-fixedincludes
1178gcc-no-fixedincludes:
1179 @if [ -f ./gcc/Makefile ]; then \
1180 rm -rf gcc/tmp-include; \
1181 mv gcc/include gcc/tmp-include 2>/dev/null; \
1182 mkdir gcc/include; \
1183 cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1184 touch gcc/stmp-fixinc gcc/include/fixed; \
1185 rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
b40e3958
L
1186 r=`${PWD_COMMAND}`; export r; \
1187 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
7ffa0b57 1188 $(HOST_EXPORTS) \
1086bc09 1189 (cd ./gcc && \
15723a45
NN
1190 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1191 rm -rf gcc/include; \
1192 mv gcc/tmp-include gcc/include 2>/dev/null; \
1193 else true; fi
6bd3dfaa 1194@endif gcc
4fa63067 1195
1d39f329
NN
1196# ---------------------
1197# GCC bootstrap support
1198# ---------------------
1199
b813574b
PB
1200# We track the current stage (the one in 'gcc') in the stage_current file.
1201# stage_last instead tracks the stage that was built last. These targets
1202# are dummy when toplevel bootstrap is not active.
1203
f70224b5 1204# While making host and target tools, symlinks to the final stage must be
0aed8855
PB
1205# there, so $(unstage) should be run at various points. To avoid excessive
1206# recursive invocations of make, we "inline" them using a variable. These
1207# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1208# to avoid warnings from the GNU Make job server.
f70224b5
PB
1209
1210unstage = :
1211stage = :
1212
b813574b 1213@if gcc-bootstrap
f70224b5 1214unstage = [ -f stage_current ] || $(MAKE) `cat stage_last`-start
be01d343 1215stage = [ -f stage_current ] && $(MAKE) `cat stage_current`-end || :
b813574b
PB
1216@endif gcc-bootstrap
1217
f70224b5
PB
1218.PHONY: unstage stage
1219unstage:
0aed8855 1220 @: $(MAKE); $(unstage)
b813574b 1221stage:
0aed8855 1222 @: $(MAKE); $(stage)
b813574b 1223
dfdffa2c
PB
1224# We name the build directories for the various stages "stage1-gcc",
1225# "stage2-gcc","stage3-gcc", etc.
1226
1227# Since the 'compare' process will fail (on debugging information) if any
1228# directory names are different, we need to link the gcc directory for
0aed8855 1229# the previous stage to a constant name ('prev-gcc'), and to make the name of
dfdffa2c
PB
1230# the build directories constant as well. For the latter, we use naked names
1231# like 'gcc', because the scripts in that directory assume it. We use
1232# mv on platforms where symlinks to directories do not work or are not
1233# reliable.
1234
1d39f329
NN
1235# 'touch' doesn't work right on some platforms.
1236STAMP = echo timestamp >
1237
1238# Only build the C compiler for stage1, because that is the only one that
1239# we can guarantee will build with the native compiler, and also it is the
1240# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
1241# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
1242# overrideable (for a bootstrap build stage1 also builds gcc.info).
1243
1244STAGE1_CFLAGS=@stage1_cflags@
1245STAGE1_LANGUAGES=@stage1_languages@
1246
dfdffa2c
PB
1247# We only want to compare .o files, so set this!
1248objext = .o
1d39f329 1249
1d39f329 1250# Flags to pass to stage2 and later makes.
1d39f329 1251POSTSTAGE1_FLAGS_TO_PASS = \
656fdd47 1252 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
064d0a7c 1253 STAGE_PREFIX=$$r/prev-gcc/ \
1d39f329 1254 CFLAGS="$(BOOT_CFLAGS)" \
a0049f1b 1255 ADAC="\$$(CC)"
1d39f329 1256
dfdffa2c
PB
1257# For stage 1:
1258# * We force-disable intermodule optimizations, even if
1259# --enable-intermodule was passed, since the installed compiler probably
1260# can't handle them. Luckily, autoconf always respects
1261# the last argument when conflicting --enable arguments are passed.
1262# * Likewise, we force-disable coverage flags, since the installed compiler
1263# probably has never heard of them.
1264# * We build only C (and possibly Ada).
1265
1266[+ FOR bootstrap-stage +]
319cab08 1267.PHONY: stage[+id+]-start stage[+id+]-end
dfdffa2c 1268
656fdd47 1269stage[+id+]-start::
0aed8855 1270 @: $(MAKE); $(stage); \
b813574b 1271 echo stage[+id+] > stage_current ; \
b00612cc 1272 echo stage[+id+] > stage_last; \
0aed8855 1273 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
b00612cc 1274 FOR host_modules +][+ IF bootstrap +]
72b2455a 1275@if [+ module +]
b00612cc
PB
1276 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1277 mkdir stage[+id+]-[+module+]; \
1278 set stage[+id+]-[+module+] [+module+] ; \
1279 @CREATE_LINK_TO_DIR@ [+ IF prev +] ; \
1280 set stage[+prev+]-[+module+] prev-[+module+] ; \
1281 @CREATE_LINK_TO_DIR@ [+ ENDIF prev +]
0aed8855
PB
1282@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1283 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1284 mkdir stage[+id+]-$(TARGET_SUBDIR); \
1285 set stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) ; \
1dc3053f 1286 @CREATE_LINK_TO_DIR@ [+ IF prev +] ; \
0aed8855 1287 set stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) ; \
1dc3053f 1288 @CREATE_LINK_TO_DIR@ [+ ENDIF prev +]
dfdffa2c 1289
656fdd47 1290stage[+id+]-end::
9cb3fa6f 1291 @rm -f stage_current[+ FOR host_modules +][+ IF bootstrap +]
72b2455a 1292@if [+ module +]
0aed8855
PB
1293 @if test -d $(HOST_SUBDIR) ; then \
1294 cd $(HOST_SUBDIR); set [+module+] stage[+id+]-[+module+] ; \
1dc3053f
PB
1295 @UNDO_LINK_TO_DIR@ [+ IF prev +] ; \
1296 set prev-[+module+] stage[+prev+]-[+module+] ; \
0aed8855
PB
1297 @UNDO_LINK_TO_DIR@ [+ ENDIF prev +] ; \
1298 fi
1299@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1300 @if test -d $(TARGET_SUBDIR) ; then \
1301 set $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) ; \
1302 @UNDO_LINK_TO_DIR@ [+ IF prev +] ; \
1303 set prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; \
1304 @UNDO_LINK_TO_DIR@ [+ ENDIF prev +] ; \
1305 fi
dfdffa2c 1306
0aed8855
PB
1307# Bubble a bugfix through all the stages up to stage [+id+]. They are
1308# remade, but not reconfigured. The next stage (if any) will not be
1309# reconfigured as well.
319cab08 1310.PHONY: stage[+id+]-bubble
9cb3fa6f
PB
1311stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +][+IF lean +]
1312 @bootstrap_lean@-rm -rf stage[+lean+]-* ; $(STAMP) stage[+lean+]-lean[+ ENDIF lean +]
e360f423
PB
1313 @r=`${PWD_COMMAND}`; export r; \
1314 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1315 if test -f stage[+id+]-lean [+
9cb3fa6f
PB
1316 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1317 echo Skipping rebuild of stage[+id+] ; \
1318 else \
f70224b5
PB
1319 $(MAKE) stage[+id+]-start; \
1320 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
be01d343
PB
1321 fi[+ IF compare-target +]
1322 $(MAKE) [+compare-target+][+ ENDIF compare-target +]
72b2455a 1323
0df3d27f 1324.PHONY: all-stage[+id+] clean-stage[+id+]
0df3d27f 1325do-clean: clean-stage[+id+]
1d39f329 1326
72b2455a
PB
1327# FIXME: Will not need to be conditional when toplevel bootstrap is the
1328# only possibility, but now it conflicts with no-bootstrap rules
1329@if gcc-bootstrap
dfdffa2c 1330[+ IF compare-target +]
9cb3fa6f 1331[+compare-target+]:
e360f423
PB
1332 @r=`${PWD_COMMAND}`; export r; \
1333 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1334 if test -f stage[+prev+]-lean; then \
9cb3fa6f
PB
1335 echo Cannot compare object files as stage [+prev+] was deleted. ; \
1336 exit 0 ; \
1337 fi; \
0aed8855 1338 : $(MAKE); $(stage); \
1d39f329 1339 rm -f .bad_compare ; \
dfdffa2c 1340 cd stage[+id+]-gcc; \
1d39f329
NN
1341 files=`find . -name "*$(objext)" -print` ; \
1342 cd .. ; \
1343 for file in $${files} ; do \
dfdffa2c 1344 f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
b8908782 1345 @do_compare@ > /dev/null 2>&1; \
f70224b5
PB
1346 if test $$? -eq 1; then \
1347 case $$file in \
1348 ./cc*-checksum$(objext) | ./libgcc/* ) \
1349 echo warning: $$file differs ;; \
1350 *) \
1351 echo $$file differs >> .bad_compare ;; \
1352 esac ; \
1353 fi ; \
1d39f329
NN
1354 done ; \
1355 if [ -f .bad_compare ]; then \
1356 echo "Bootstrap comparison failure!"; \
1357 cat .bad_compare; \
1358 exit 1; \
1359 else \
1360 true; \
1361 fi ; \
9cb3fa6f
PB
1362 $(STAMP) [+compare-target+][+ IF prev +]
1363 @bootstrap_lean@-rm -rf stage[+prev+]-* ; $(STAMP) stage[+prev+]-lean[+ ENDIF prev +]
dfdffa2c
PB
1364[+ ENDIF compare-target +]
1365
1366[+ IF bootstrap-target +]
1367.PHONY: [+bootstrap-target+]
be01d343
PB
1368[+bootstrap-target+]:
1369 echo stage[+id+] > stage_final
1370 @r=`${PWD_COMMAND}`; export r; \
1371 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1372 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
0aed8855 1373 @: $(MAKE); $(unstage)
be01d343
PB
1374 @r=`${PWD_COMMAND}`; export r; \
1375 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1376 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
dfdffa2c
PB
1377[+ ENDIF bootstrap-target +]
1378
0df3d27f 1379# Rules to wipe a stage and all the following ones, also used for cleanstrap
656fdd47 1380[+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
0df3d27f 1381.PHONY: distclean-stage[+id+]
656fdd47 1382distclean-stage[+id+]::
0aed8855 1383 @: $(MAKE); $(stage)
9cb3fa6f 1384 rm -rf stage[+id+]-* [+
dfdffa2c 1385 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
dfdffa2c
PB
1386
1387[+ IF cleanstrap-target +]
1388.PHONY: [+cleanstrap-target+]
0df3d27f 1389[+cleanstrap-target+]: distclean [+bootstrap-target+]
dfdffa2c 1390[+ ENDIF cleanstrap-target +]
72b2455a 1391@endif gcc-bootstrap
dfdffa2c
PB
1392
1393[+ ENDFOR bootstrap-stage +]
656fdd47 1394
7d329e61
PB
1395stageprofile-end::
1396 $(MAKE) distclean-stagefeedback
656fdd47 1397
7d329e61 1398stagefeedback-start::
656fdd47
PB
1399 @r=`${PWD_COMMAND}`; export r; \
1400 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7d329e61
PB
1401 for i in prev-*; do \
1402 j=`echo $$i | sed s/^prev-//` ; \
1403 cd $$r/$$i && \
1404 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1405 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1406 done
b8908782 1407
0df3d27f 1408@if gcc-bootstrap
0df3d27f
PB
1409do-distclean: distclean-stage1
1410@endif gcc-bootstrap
1411
ae831be5
NN
1412# --------------------------------------
1413# Dependencies between different modules
1414# --------------------------------------
405ea7a0 1415
9e6ce191 1416# Generic dependencies for target modules on host stuff, especially gcc
1dc3053f
PB
1417[+ FOR target_modules +][+ IF bootstrap +]
1418@if gcc-bootstrap[+ FOR bootstrap_stage +]
1419configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+ ENDFOR +]
1420@endif gcc-bootstrap[+ ENDIF bootstrap +]
9e6ce191
PB
1421configure-target-[+module+]: maybe-all-gcc
1422[+ ENDFOR target_modules +]
1423
1424[+ FOR lang_env_dependencies +]
1425configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss
1426[+ IF cxx +]configure-target-[+module+]: maybe-all-target-libstdc++-v3
1427[+ ENDIF cxx +][+ ENDFOR lang_env_dependencies +]
1428
ae831be5
NN
1429# There are two types of dependencies here: 'hard' dependencies, where one
1430# module simply won't build without the other; and 'soft' dependencies, where
1431# if the depended-on module is missing, the depending module will do without
1432# or find a substitute somewhere (perhaps installed). Soft dependencies
9e6ce191 1433# are made here to depend on a 'maybe-' target. If you're not sure,
ae831be5
NN
1434# it's safer to use a soft dependency.
1435
9e6ce191
PB
1436[+ ;; These Scheme functions build the bulk of the dependencies.
1437 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1438 ;; where "maybe-" is only included if HARD is true, and all-gcc
1439 ;; is taken from VAR-NAME.
1440 (define dep-target (lambda (module-kind var-name hard)
1441 (string-append
1442 (if hard "" "maybe-")
1443 (dep-subtarget var-name)
1444 module-kind
1445 (dep-module var-name)
1446 )))
1447
1448 ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
72b2455a 1449 (define make-dep (lambda (module-kind on-kind)
9e6ce191
PB
1450 (string-append
1451 (dep-target module-kind "module" #t) ": "
72b2455a 1452 (dep-target on-kind "on" (exist? "hard")))))
9e6ce191
PB
1453
1454 ;; dep-subtarget extracts everything up to the first dash in the given
1455 ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1456 (define dep-subtarget (lambda (var-name)
1457 (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1458
1459 ;; dep-module extracts everything up to the first dash in the given
1460 ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1461 (define dep-module (lambda (var-name)
1462 (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1463
1464 ;; dep-stage builds a string for the prefix of a bootstrap stage.
1465 (define dep-stage (lambda ()
1466 (string-append
1467 "stage"
1468 (get "id")
1469 "-")))
1470
1471 ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1472 ;; but is written in Scheme.
1473 (define dep-maybe (lambda ()
1474 (if (exist? "hard") "" "maybe-")))
1475
21fde4dc
DD
1476 ;; dep-kind returns "normal" if the dependency is on an "install" target,
1477 ;; or if either module is not bootstrapped. It returns "bootstrap" for
9e6ce191
PB
1478 ;; configure or build dependencies between bootstrapped modules; it returns
1479 ;; "prebootstrap" for configure or build dependencies of bootstrapped
72b2455a 1480 ;; modules on a build module (e.g. all-gcc on all-build-bison). All this
9e6ce191
PB
1481 ;; is only necessary for host modules.
1482 (define dep-kind (lambda ()
72b2455a
PB
1483 (if (and (hash-ref boot-modules (dep-module "module"))
1484 (=* (dep-module "on") "build-"))
1485 "prebootstrap"
9e6ce191 1486
72b2455a 1487 (if (or (= (dep-subtarget "on") "install-")
21fde4dc
DD
1488 (not (hash-ref boot-modules (dep-module "module")))
1489 (not (hash-ref boot-modules (dep-module "on"))))
72b2455a
PB
1490 "normal"
1491 "bootstrap"))))
9e6ce191
PB
1492
1493 ;; We now build the hash table that is used by dep-kind.
1494 (define boot-modules (make-hash-table 113))
9e6ce191
PB
1495+]
1496
1497[+ FOR host_modules +][+
1498 (if (exist? "bootstrap")
1499 (hash-create-handle! boot-modules (get "module") #t))
1500 "" +][+ ENDFOR host_modules +]
1dc3053f
PB
1501[+ FOR target_modules +][+
1502 (if (exist? "bootstrap")
1503 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1504 "" +][+ ENDFOR target_modules +]
9e6ce191
PB
1505
1506# With all the machinery above in place, it is pretty easy to generate
1507# dependencies. Host dependencies are a bit more complex because we have
1508# to check for bootstrap/prebootstrap dependencies. To resolve
1509# prebootstrap dependencies, prebootstrap modules are gathered in
1510# a hash table.
72b2455a
PB
1511[+ FOR dependencies +][+ (make-dep "" "") +]
1512[+ CASE (dep-kind) +]
1513[+ == "prebootstrap"
9e6ce191 1514 +][+ FOR bootstrap_stage +]
72b2455a
PB
1515[+ (make-dep (dep-stage) "") +][+
1516 ENDFOR bootstrap_stage +]
1517all-prebootstrap: [+ (dep-target "" "on" (exist? "hard")) +]
1518[+ == "bootstrap"
1519 +][+ FOR bootstrap_stage +]
1520[+ (make-dep (dep-stage) (dep-stage)) +][+
9e6ce191
PB
1521 ENDFOR bootstrap_stage +]
1522[+ ESAC +][+
1523ENDFOR dependencies +]
1524
72b2455a
PB
1525# Non-toplevel bootstrap rules must depend on several packages, to be built
1526# before gcc. Another wart that will go away, hopefully soon.
9e6ce191
PB
1527@if gcc-no-bootstrap
1528[+ FOR host_modules +][+
1529 IF (and (not (= (get "module") "gcc"))
1530 (hash-ref boot-modules (get "module"))) +]
1531all-prebootstrap: maybe-all-[+module+][+
1532 ENDIF +][+
1533ENDFOR host_modules +]
1534@endif gcc-no-bootstrap
1535
907be67c 1536CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
ae831be5 1537GDB_TK = @GDB_TK@
907be67c
DJ
1538INSTALL_GDB_TK = @INSTALL_GDB_TK@
1539configure-gdb: $(CONFIGURE_GDB_TK)
9e6ce191 1540all-gdb: $(gdbnlmrequirements) $(GDB_TK)
907be67c 1541install-gdb: $(INSTALL_GDB_TK)
907a7241 1542
a2cc058a
NN
1543# Serialization dependencies. Host configures don't work well in parallel to
1544# each other, due to contention over config.cache. Target configures and
1545# build configures are similar.
1546@serialization_dependencies@
1547
15723a45
NN
1548# --------------------------------
1549# Regenerating top level configury
1550# --------------------------------
405ea7a0
NN
1551
1552# Rebuilding Makefile.in, using autogen.
43be203f 1553AUTOGEN = autogen
6b784d9f 1554$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
43be203f 1555 cd $(srcdir) && $(AUTOGEN) Makefile.def
405ea7a0 1556
a0da8069 1557# Rebuilding Makefile.
43be203f
AO
1558Makefile: $(srcdir)/Makefile.in config.status
1559 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1560
479759c8 1561config.status: configure
10ecffb9 1562 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
405ea7a0 1563
a0da8069 1564# Rebuilding configure.
43be203f 1565AUTOCONF = autoconf
6b784d9f 1566$(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4
43be203f 1567 cd $(srcdir) && $(AUTOCONF)
405ea7a0 1568
3728fade
NN
1569# ------------------------------
1570# Special directives to GNU Make
1571# ------------------------------
1572
3728fade
NN
1573# Don't pass command-line variables to submakes.
1574.NOEXPORT:
1575MAKEOVERRIDES=
1576
405ea7a0 1577# end of Makefile.in