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