]> gcc.gnu.org Git - gcc.git/blame - Makefile.tpl
Daily bump.
[gcc.git] / Makefile.tpl
CommitLineData
d3ac17c9 1[+ AutoGen5 template -*- Mode: Makefile -*-
95ddd785
NN
2in
3+]
4
5# Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
6#
7# Makefile for directory with subdirs to build.
8# Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
2d309510 9# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
95ddd785
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
539df155 23# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
95ddd785
NN
24#
25
df0f0674
NN
26# -------------------------------
27# Standard Autoconf-set variables
28# -------------------------------
4977bab6 29VPATH=@srcdir@
4977bab6
ZW
30
31build_alias=@build_alias@
e89fbdfe 32build=@build@
4977bab6 33host_alias=@host_alias@
e89fbdfe 34host=@host@
4977bab6 35target_alias=@target_alias@
e89fbdfe 36target=@target@
4977bab6 37
df0f0674 38program_transform_name = @program_transform_name@
0dffceed
NN
39
40prefix = @prefix@
41exec_prefix = @exec_prefix@
42
df0f0674
NN
43srcdir = @srcdir@
44
0dffceed
NN
45bindir = @bindir@
46sbindir = @sbindir@
47libexecdir = @libexecdir@
48datadir = @datadir@
49sysconfdir = @sysconfdir@
50sharedstatedir = @sharedstatedir@
51localstatedir = @localstatedir@
52libdir = @libdir@
53includedir = @includedir@
54oldincludedir = @oldincludedir@
55infodir = @infodir@
65d6e994
CD
56datarootdir = @datarootdir@
57docdir = @docdir@
58htmldir = @htmldir@
0dffceed 59mandir = @mandir@
95ddd785
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
95ddd785 69
775956d0
NN
70INSTALL = @INSTALL@
71INSTALL_PROGRAM = @INSTALL_PROGRAM@
72INSTALL_SCRIPT = @INSTALL_SCRIPT@
73INSTALL_DATA = @INSTALL_DATA@
ad6717df
PB
74LN = @LN@
75LN_S = @LN_S@
95ddd785 76
df0f0674
NN
77# -------------------------------------------------
78# Miscellaneous non-standard autoconf-set variables
79# -------------------------------------------------
95ddd785 80
df0f0674
NN
81# The gcc driver likes to know the arguments it was configured with.
82TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
95ddd785 83
df0f0674
NN
84tooldir = @tooldir@
85build_tooldir = @build_tooldir@
95ddd785 86
df0f0674 87GDB_NLM_DEPS =
95ddd785 88
df0f0674
NN
89# This is the name of the environment variable used for the path to
90# the libraries.
91RPATH_ENVVAR = @RPATH_ENVVAR@
95ddd785 92
df0f0674
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.
25b42232 97BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
23f6b2f9
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
4fc4dd12 111# This is the list of variables to export in the environment when
23f6b2f9 112# configuring subdirectories for the build system.
4fc4dd12 113BUILD_EXPORTS = \
23f6b2f9 114 $(BASE_EXPORTS) \
4fc4dd12
DJ
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;
df0f0674
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@
215c351a
PB
136# Host programs are put under this directory, which is . except if building
137# with srcdir=..
138HOST_SUBDIR = @host_subdir@
4fc4dd12 139# This is the list of variables to export in the environment when
2abefe3d
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.
4fc4dd12 142HOST_EXPORTS = \
23f6b2f9 143 $(BASE_EXPORTS) \
4fc4dd12
DJ
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; \
1c020272 159 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
2abefe3d
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; \
4fc4dd12
DJ
167 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
168 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
4c4a5bbc 169 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
1061f99e
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
0bff65e7 173 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
4fc4dd12
DJ
174
175# Similar, for later GCC stages.
ce406537 176POSTSTAGE1_HOST_EXPORTS = \
a52a0a7f 177 $(HOST_EXPORTS) \
215c351a
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/ \
ec6c7392
PB
183 -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
184 CFLAGS="$(BOOT_CFLAGS)"; export CFLAGS; \
185 LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
df0f0674 186
df0f0674
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.
25b42232 191TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
4fc4dd12 192# This is the list of variables to export in the environment when
23f6b2f9 193# configuring subdirectories for the host system.
4fc4dd12 194BASE_TARGET_EXPORTS = \
23f6b2f9 195 $(BASE_EXPORTS) \
4fc4dd12 196 AR="$(AR_FOR_TARGET)"; export AR; \
2abefe3d 197 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
4fc4dd12
DJ
198 CC="$(CC_FOR_TARGET)"; export CC; \
199 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
200 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
e7daab31 201 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
4fc4dd12
DJ
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; \
2abefe3d 206 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
4fc4dd12 207 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
040b1c5a 208 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
2abefe3d 209 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
d739199a 210 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
4fc4dd12 211 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
040b1c5a 212 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
4c4a5bbc 213 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
0bff65e7 214 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
4fc4dd12
DJ
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;
df0f0674 224
6de9cd9a
DN
225# Where to find GMP
226HOST_GMPLIBS = @gmplibs@
227HOST_GMPINC = @gmpinc@
228
df0f0674
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.
8c90b13a
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}
df0f0674
NN
242
243# compilers to use to create programs which must be run in the build
244# environment.
245CC_FOR_BUILD = @CC_FOR_BUILD@
6691a79e 246CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
df0f0674
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.
df0f0674
NN
252BUILD_PREFIX = @BUILD_PREFIX@
253BUILD_PREFIX_1 = @BUILD_PREFIX_1@
95ddd785 254
45f366ab
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
d19bca38 258BOOT_LDFLAGS=
45f366ab 259
2abefe3d
PB
260BISON = @BISON@
261YACC = @YACC@
262FLEX = @FLEX@
263LEX = @LEX@
264M4 = @M4@
265MAKEINFO = @MAKEINFO@
266EXPECT = @EXPECT@
267RUNTEST = @RUNTEST@
95ddd785
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.
2f50999f
GP
272# (Default to avoid splitting info files by setting the threshold high.)
273MAKEINFOFLAGS = --split-size=5000000
95ddd785 274
df0f0674
NN
275# ---------------------------------------------
276# Programs producing files for the HOST machine
277# ---------------------------------------------
95ddd785 278
df0f0674 279AS = @AS@
df0f0674
NN
280AR = @AR@
281AR_FLAGS = rc
df0f0674 282CC = @CC@
df0f0674 283CXX = @CXX@
df0f0674 284DLLTOOL = @DLLTOOL@
df0f0674 285LD = @LD@
2abefe3d
PB
286LIPO = @LIPO@
287NM = @NM@
2d309510 288OBJDUMP = @OBJDUMP@
df0f0674 289RANLIB = @RANLIB@
2abefe3d 290STRIP = @STRIP@
df0f0674 291WINDRES = @WINDRES@
95ddd785 292
2abefe3d
PB
293CFLAGS = @CFLAGS@
294LDFLAGS =
295LIBCFLAGS = $(CFLAGS)
296CXXFLAGS = @CXXFLAGS@
297LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
df0f0674
NN
298PICFLAG =
299
300# -----------------------------------------------
301# Programs producing files for the TARGET machine
302# -----------------------------------------------
95ddd785 303
ec0461f6 304FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
95ddd785 305
df0f0674 306AR_FOR_TARGET=@AR_FOR_TARGET@
4977bab6 307AS_FOR_TARGET=@AS_FOR_TARGET@
4de997d1 308CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 309
df0f0674
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.
2abefe3d 314GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 315CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 316RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 317GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 318GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4977bab6 319DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
df0f0674 320LD_FOR_TARGET=@LD_FOR_TARGET@
df0f0674 321
040b1c5a 322LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
df0f0674 323NM_FOR_TARGET=@NM_FOR_TARGET@
d739199a 324OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
4977bab6 325RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
040b1c5a 326STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
df0f0674 327WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
95ddd785 328
2abefe3d
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 =
df0f0674
NN
343PICFLAG_FOR_TARGET =
344
345# ------------------------------------
346# Miscellaneous targets and flag lists
347# ------------------------------------
348
95ddd785
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.
1061f99e 351all:
95ddd785 352
95ddd785 353#### host and target specific makefile fragments come in here.
671aa708
NN
354@target_makefile_frag@
355@alphaieee_frag@
356@ospace_frag@
357@host_makefile_frag@
95ddd785
NN
358###
359
0bff65e7
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
95ddd785 391# Flags to pass down to all sub-makes.
cc11cc9b
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 +] \
e75f9147 395 "CONFIG_SHELL=$(SHELL)" \
11405c93 396 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"
95ddd785 397
4de997d1
PB
398# We leave this in just in case, but it is not needed anymore.
399RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
ad6717df 400
95ddd785
NN
401# Flags to pass down to most sub-makes, in which we're building with
402# the host environment.
95ddd785
NN
403EXTRA_HOST_FLAGS = \
404 'AR=$(AR)' \
405 'AS=$(AS)' \
406 'CC=$(CC)' \
407 'CXX=$(CXX)' \
408 'DLLTOOL=$(DLLTOOL)' \
409 'LD=$(LD)' \
2abefe3d 410 'LIPO=$(LIPO)' \
95ddd785 411 'NM=$(NM)' \
2d309510 412 'OBJDUMP=$(OBJDUMP)' \
c858bf1e 413 'RANLIB=$(RANLIB)' \
2abefe3d 414 'STRIP=$(STRIP)' \
95ddd785
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.
f41d6665
DJ
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.
95ddd785
NN
435EXTRA_TARGET_FLAGS = \
436 'AR=$$(AR_FOR_TARGET)' \
f41d6665 437 'AS=$(COMPILER_AS_FOR_TARGET)' \
95ddd785
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)' \
f41d6665 443 'LD=$(COMPILER_LD_FOR_TARGET)' \
e3791243 444 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
95ddd785
NN
445 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
446 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
f41d6665 447 'NM=$(COMPILER_NM_FOR_TARGET)' \
d739199a 448 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
95ddd785
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.
1358ccea 458# The BUILD_* variables are a special case, which are used for the gcc
95ddd785
NN
459# cross-building scheme.
460EXTRA_GCC_FLAGS = \
95ddd785 461 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
d4cd9d81
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=/'`" \
cc11cc9b 466 "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
95ddd785 467
d29b8ad8 468GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
95ddd785 469
8b87bb96 470.PHONY: configure-host
d32ab992 471configure-host: [+
8b87bb96
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 +]
95ddd785 480
f516a7da
PB
481# The target built for a native non-bootstrap build.
482.PHONY: all
1061f99e
PB
483all:
484@if gcc-bootstrap
2abefe3d 485 [ -f stage_final ] || echo stage3 > stage_final
1061f99e
PB
486 @r=`${PWD_COMMAND}`; export r; \
487 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
f41d6665 488 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
1061f99e 489@endif gcc-bootstrap
f41d6665 490 @: $(MAKE); $(unstage)
1061f99e
PB
491 @r=`${PWD_COMMAND}`; export r; \
492 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
493 if [ -f stage_last ]; then \
2abefe3d 494 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
1061f99e 495 else \
2abefe3d 496 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
1061f99e 497 fi
8b87bb96 498
23f6b2f9 499.PHONY: all-build
cc11cc9b
PB
500[+ FOR build_modules +]
501all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
502
8b87bb96 503.PHONY: all-host
cc11cc9b
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
8b87bb96 509.PHONY: all-target
cc11cc9b
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 +]
95ddd785
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).
4977bab6 519[+ FOR recursive_targets +]
1a1e6b96 520.PHONY: do-[+make_target+]
1061f99e 521do-[+make_target+]:
f41d6665 522 @: $(MAKE); $(unstage)
e7c84bf8
PB
523 @r=`${PWD_COMMAND}`; export r; \
524 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
525 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
1061f99e 526 [+make_target+]-target
1061f99e 527
1358ccea
NN
528
529.PHONY: [+make_target+]-host
cc11cc9b
PB
530[+ FOR host_modules +]
531[+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
1358ccea
NN
532
533.PHONY: [+make_target+]-target
cc11cc9b
PB
534[+ FOR target_modules +]
535[+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
4977bab6
ZW
536[+ ENDFOR recursive_targets +]
537
95ddd785
NN
538# Here are the targets which correspond to the do-X targets.
539
65d6e994 540.PHONY: info installcheck dvi html install-info install-html
95ddd785
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
f87a2b2e 546html: do-html
95ddd785 547
212f6dd0
NN
548# Make sure makeinfo is built before we do a `make info', if we're
549# in fact building texinfo.
550do-info: maybe-all-texinfo
95ddd785
NN
551
552install-info: do-install-info dir.info
8c90b13a 553 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
95ddd785 554 if [ -f dir.info ] ; then \
3fbe8e4a 555 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
95ddd785
NN
556 else true ; fi
557
65d6e994
CD
558install-html: do-install-html
559
95ddd785
NN
560local-clean:
561 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
562
563local-distclean:
564 -rm -f Makefile config.status config.cache mh-frag mt-frag
f41d6665 565 -rm -f maybedep.tmp serdep.tmp
95ddd785
NN
566 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
567 rm -rf $(TARGET_SUBDIR); \
568 else true; fi
0c227849 569 -rm -rf $(BUILD_SUBDIR)
215c351a
PB
570 -if [ "$(HOST_SUBDIR)" != "." ]; then \
571 rm -rf $(HOST_SUBDIR); \
572 else true; fi
95ddd785
NN
573 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
574 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
575 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
576 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
577 -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
578
579local-maintainer-clean:
580 @echo "This command is intended for maintainers to use;"
581 @echo "it deletes files that may require special tools to rebuild."
582
583clean: do-clean local-clean
584mostlyclean: do-mostlyclean local-clean
585distclean: do-distclean local-clean local-distclean
586maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
587maintainer-clean: local-distclean
588realclean: maintainer-clean
589
2f3bdde7 590# Extra dependency for clean-target, owing to the mixed nature of gcc.
1358ccea 591clean-target: clean-target-libgcc
95ddd785 592clean-target-libgcc:
2f3bdde7 593 test ! -d gcc || (cd gcc && $(MAKE) $@)
95ddd785
NN
594
595# Check target.
596
597.PHONY: check do-check
333a28b4 598check: do-check
95ddd785 599
4977bab6 600# Only include modules actually being configured and built.
1061f99e
PB
601.PHONY: check-host
602check-host: [+
7e2dbcef
NN
603 FOR host_modules +] \
604 maybe-check-[+module+][+
1061f99e
PB
605 ENDFOR host_modules +]
606
607.PHONY: check-target
608check-target: [+
7e2dbcef
NN
609 FOR target_modules +] \
610 maybe-check-target-[+module+][+
1061f99e
PB
611 ENDFOR target_modules +]
612
613do-check:
f41d6665 614 @: $(MAKE); $(unstage)
e7c84bf8
PB
615 @r=`${PWD_COMMAND}`; export r; \
616 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
617 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
95ddd785
NN
618
619# Automated reporting of test results.
620
621warning.log: build.log
622 $(srcdir)/contrib/warn_summary build.log > $@
623
624mail-report.log:
625 if test x'$(BOOT_CFLAGS)' != x''; then \
626 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
627 fi; \
628 $(srcdir)/contrib/test_summary -t >$@
629 chmod +x $@
630 echo If you really want to send e-mail, run ./$@ now
631
632mail-report-with-warnings.log: warning.log
633 if test x'$(BOOT_CFLAGS)' != x''; then \
634 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
635 fi; \
636 $(srcdir)/contrib/test_summary -t -i warning.log >$@
637 chmod +x $@
638 echo If you really want to send e-mail, run ./$@ now
639
640# Installation targets.
641
4977bab6 642.PHONY: install uninstall
1061f99e 643install:
f41d6665 644 @: $(MAKE); $(unstage)
e7c84bf8
PB
645 @r=`${PWD_COMMAND}`; export r; \
646 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
647 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
8b87bb96 648
7e2dbcef
NN
649.PHONY: install-host-nogcc
650install-host-nogcc: [+
3589b69e
PB
651 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
652 maybe-install-[+module+][+ ENDIF +][+
7e2dbcef
NN
653 ENDFOR host_modules +]
654
8b87bb96 655.PHONY: install-host
d32ab992 656install-host: [+
8b87bb96
NN
657 FOR host_modules +] \
658 maybe-install-[+module+][+
659 ENDFOR host_modules +]
7e2dbcef 660
8b87bb96
NN
661.PHONY: install-target
662install-target: [+
663 FOR target_modules +] \
664 maybe-install-target-[+module+][+
665 ENDFOR target_modules +]
95ddd785
NN
666
667uninstall:
668 @echo "the uninstall target is not supported in this tree"
669
95ddd785
NN
670.PHONY: install.all
671install.all: install-no-fixedincludes
672 @if [ -f ./gcc/Makefile ] ; then \
8c90b13a 673 r=`${PWD_COMMAND}` ; export r ; \
f41d6665 674 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 675 $(HOST_EXPORTS) \
88b5521b 676 (cd ./gcc && \
95ddd785
NN
677 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
678 else \
679 true ; \
680 fi
681
682# install-no-fixedincludes is used because Cygnus can not distribute
683# the fixed header files.
684.PHONY: install-no-fixedincludes
7e2dbcef 685install-no-fixedincludes: installdirs install-host-nogcc \
8b87bb96 686 install-target gcc-no-fixedincludes
95ddd785 687
4977bab6 688### other supporting targets
95ddd785 689
4977bab6
ZW
690MAKEDIRS= \
691 $(DESTDIR)$(prefix) \
692 $(DESTDIR)$(exec_prefix)
693.PHONY: installdirs
694installdirs: mkinstalldirs
695 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
696
697dir.info: do-install-info
698 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
3fbe8e4a 699 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
4977bab6
ZW
700 mv -f dir.info.new dir.info ; \
701 else true ; \
95ddd785
NN
702 fi
703
4977bab6
ZW
704dist:
705 @echo "Building a full distribution of this tree isn't done"
706 @echo "via 'make dist'. Check out the etc/ subdirectory"
707
708etags tags: TAGS
709
710# Right now this just builds TAGS in each subdirectory. emacs19 has the
711# ability to use several tags files at once, so there is probably no need
712# to combine them into one big TAGS file (like CVS 1.3 does). We could
713# (if we felt like it) have this Makefile write a piece of elisp which
714# the user could load to tell emacs19 where all the TAGS files we just
715# built are.
716TAGS: do-TAGS
717
25b42232
PB
718# ------------------------------------
719# Macros for configure and all targets
720# ------------------------------------
721
722[+ DEFINE configure +]
723.PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
724maybe-configure-[+prefix+][+module+]:
3ff3adad
PB
725@if gcc-bootstrap
726configure-[+prefix+][+module+]: stage_current
727@endif gcc-bootstrap
25b42232
PB
728@if [+prefix+][+module+]
729maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
3ff3adad 730configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
cc11cc9b
PB
731 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
732 @r=`${PWD_COMMAND}`; export r; \
f41d6665 733 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
cc11cc9b
PB
734 [+ IF check_multilibs
735 +]echo "Checking multilib configuration for [+module+]..."; \
f41d6665
DJ
736 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
737 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
738 if test -r [+subdir+]/[+module+]/multilib.out; then \
739 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
740 rm -f [+subdir+]/[+module+]/multilib.tmp; \
741 else \
742 rm -f [+subdir+]/[+module+]/Makefile; \
743 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
744 fi; \
745 else \
746 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
cc11cc9b
PB
747 fi; \
748 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
25b42232 749 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
25b42232
PB
750 [+exports+] \
751 echo Configuring in [+subdir+]/[+module+]; \
752 cd "[+subdir+]/[+module+]" || exit 1; \
3aa83176 753 case $(srcdir) in \
215c351a 754 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
25b42232 755 *) topdir=`echo [+subdir+]/[+module+]/ | \
215c351a 756 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
3aa83176 757 esac; \
215c351a
PB
758 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
759 libsrcdir="$$s/[+module+]"; \
25b42232
PB
760 [+ IF no-config-site +]rm -f no-such-file || : ; \
761 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
762 [+args+] $${srcdiroption} [+extra_configure_flags+] \
3aa83176 763 || exit 1
25b42232 764@endif [+prefix+][+module+]
ce406537
PB
765
766[+ IF bootstrap +]
767[+ FOR bootstrap_stage +]
768.PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
769maybe-configure-stage[+id+]-[+prefix+][+module+]:
f41d6665 770@if [+prefix+][+module+]-bootstrap
ce406537 771maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
f41d6665 772configure-stage[+id+]-[+prefix+][+module+]:
cc11cc9b 773 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
f41d6665 774 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
cc11cc9b 775 @r=`${PWD_COMMAND}`; export r; \
ce406537 776 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
cc11cc9b
PB
777 [+ IF check_multilibs
778 +]echo "Checking multilib configuration for [+module+]..."; \
f41d6665
DJ
779 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
780 if test -r [+subdir+]/[+module+]/multilib.out; then \
781 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
782 rm -f [+subdir+]/[+module+]/multilib.tmp; \
783 else \
784 rm -f [+subdir+]/[+module+]/Makefile; \
785 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
786 fi; \
787 else \
788 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
cc11cc9b
PB
789 fi; \
790 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
ce406537
PB
791 [+exports+][+ IF prev +] \
792 [+poststage1_exports+][+ ENDIF prev +] \
793 echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
f41d6665 794 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
ce406537
PB
795 cd [+subdir+]/[+module+] || exit 1; \
796 case $(srcdir) in \
797 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
798 *) topdir=`echo [+subdir+]/[+module+]/ | \
799 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
800 esac; \
801 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
802 libsrcdir="$$s/[+module+]"; \
803 $(SHELL) $${libsrcdir}/configure \
804 [+args+] $${srcdiroption} \
57255173 805 [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
ce406537 806 [+stage_configure_flags+] [+extra_configure_flags+]
f41d6665 807@endif [+prefix+][+module+]-bootstrap
ce406537
PB
808[+ ENDFOR bootstrap_stage +]
809[+ ENDIF bootstrap +]
25b42232
PB
810[+ ENDDEF +]
811
812[+ DEFINE all +]
813.PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
814maybe-all-[+prefix+][+module+]:
3ff3adad
PB
815@if gcc-bootstrap
816all-[+prefix+][+module+]: stage_current
817@endif gcc-bootstrap
25b42232
PB
818@if [+prefix+][+module+]
819TARGET-[+prefix+][+module+]=[+
820 IF target +][+target+][+ ELSE +]all[+ ENDIF target +]
821maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
3ff3adad 822all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
cc11cc9b
PB
823 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
824 @r=`${PWD_COMMAND}`; export r; \
8c90b13a 825 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
25b42232
PB
826 [+exports+] \
827 (cd [+subdir+]/[+module+] && \
828 $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
829@endif [+prefix+][+module+]
ce406537
PB
830
831[+ IF bootstrap +]
832[+ FOR bootstrap_stage +]
833.PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
834.PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
835maybe-all-stage[+id+]-[+prefix+][+module+]:
836maybe-clean-stage[+id+]-[+prefix+][+module+]:
f41d6665 837@if [+prefix+][+module+]-bootstrap
ce406537
PB
838maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
839all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
1061f99e 840TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
ce406537 841all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
cc11cc9b 842 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
ce406537
PB
843 @r=`${PWD_COMMAND}`; export r; \
844 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
845 [+exports+][+ IF prev +] \
846 [+poststage1_exports+][+ ENDIF prev +] \
847 cd [+subdir+]/[+module+] && \
848 $(MAKE) [+args+] [+ IF prev
849 +][+poststage1_args+][+ ENDIF prev
1061f99e
PB
850 +] [+stage_make_flags+] [+extra_make_flags+] \
851 $(TARGET-stage[+id+]-[+prefix+][+module+])
ce406537
PB
852
853maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
854clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
855clean-stage[+id+]-[+prefix+][+module+]:
856 @[ -f [+subdir+]/[+module+]/Makefile ] || [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] \
857 || exit 0 ; \
cc11cc9b 858 [ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start; \
ce406537
PB
859 cd [+subdir+]/[+module+] && \
860 $(MAKE) [+args+] [+ IF prev +] \
861 [+poststage1_args+] [+ ENDIF prev +] \
862 [+stage_make_flags+] [+extra_make_flags+] clean
f41d6665 863@endif [+prefix+][+module+]-bootstrap
ce406537
PB
864
865[+ ENDFOR bootstrap_stage +]
866[+ ENDIF bootstrap +]
25b42232
PB
867[+ ENDDEF +]
868
869# --------------------------------------
870# Modules which run on the build machine
871# --------------------------------------
872[+ FOR build_modules +]
873[+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
874 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
875
876[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
877[+ ENDFOR build_module +]
4977bab6
ZW
878
879# --------------------------------------
880# Modules which run on the host machine
881# --------------------------------------
882[+ FOR host_modules +]
ce406537
PB
883[+ configure prefix="" subdir="$(HOST_SUBDIR)"
884 exports="$(HOST_EXPORTS)"
885 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
25b42232 886 args="$(HOST_CONFIGARGS)" +]
95ddd785 887
ce406537
PB
888[+ all prefix="" subdir="$(HOST_SUBDIR)"
889 exports="$(HOST_EXPORTS)"
890 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
891 args="$(FLAGS_TO_PASS)"
892 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
4977bab6 893
7e2dbcef
NN
894.PHONY: check-[+module+] maybe-check-[+module+]
895maybe-check-[+module+]:
60975492
PB
896@if [+module+]
897maybe-check-[+module+]: check-[+module+]
4977bab6 898[+ IF no_check +]
4977bab6
ZW
899check-[+module+]:
900[+ ELIF no_check_cross +]
4977bab6
ZW
901# This module is only tested in a native toolchain.
902check-[+module+]:
f41d6665 903 @: $(MAKE); $(unstage)
e89fbdfe 904 @if [ '$(host)' = '$(target)' ] ; then \
8c90b13a
L
905 r=`${PWD_COMMAND}`; export r; \
906 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 907 $(HOST_EXPORTS) \
215c351a 908 (cd $(HOST_SUBDIR)/[+module+] && \
ef6e9bc0 909 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
3aa83176
NN
910 fi
911[+ ELSE check +]
3aa83176 912check-[+module+]:
f41d6665 913 @: $(MAKE); $(unstage)
8c90b13a
L
914 @r=`${PWD_COMMAND}`; export r; \
915 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 916 $(HOST_EXPORTS) \
215c351a
PB
917 (cd $(HOST_SUBDIR)/[+module+] && \
918 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
4977bab6 919[+ ENDIF no_check +]
60975492 920@endif [+module+]
4977bab6 921
4977bab6
ZW
922.PHONY: install-[+module+] maybe-install-[+module+]
923maybe-install-[+module+]:
60975492
PB
924@if [+module+]
925maybe-install-[+module+]: install-[+module+]
7e2dbcef 926[+ IF no_install +]
4977bab6
ZW
927install-[+module+]:
928[+ ELSE install +]
4977bab6 929install-[+module+]: installdirs
f41d6665 930 @: $(MAKE); $(unstage)
8c90b13a
L
931 @r=`${PWD_COMMAND}`; export r; \
932 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 933 $(HOST_EXPORTS) \
215c351a 934 (cd $(HOST_SUBDIR)/[+module+] && \
ace9ac7b 935 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
4977bab6 936[+ ENDIF no_install +]
60975492 937@endif [+module+]
295f4e42
NN
938
939# Other targets (info, dvi, etc.)
940[+ FOR recursive_targets +]
941.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
942maybe-[+make_target+]-[+module+]:
60975492
PB
943@if [+module+]
944maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
295f4e42
NN
945[+ IF (match-value? = "missing" (get "make_target") ) +]
946# [+module+] doesn't support [+make_target+].
947[+make_target+]-[+module+]:
948[+ ELSE +]
949[+make_target+]-[+module+]: [+
950 FOR depend +]\
951 [+depend+]-[+module+] [+
952 ENDFOR depend +]
f41d6665 953 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1061f99e 954 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
295f4e42
NN
955 r=`${PWD_COMMAND}`; export r; \
956 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 957 $(HOST_EXPORTS) \
d32ab992 958 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
295f4e42
NN
959 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
960 done; \
961 echo "Doing [+make_target+] in [+module+]" ; \
215c351a 962 (cd $(HOST_SUBDIR)/[+module+] && \
295f4e42
NN
963 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
964 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
965 "RANLIB=$${RANLIB}" \
966 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
d32ab992 967 [+make_target+]) \
295f4e42
NN
968 || exit 1
969[+ ENDIF +]
60975492 970@endif [+module+]
295f4e42 971[+ ENDFOR recursive_targets +]
4977bab6
ZW
972[+ ENDFOR host_modules +]
973
974# ---------------------------------------
975# Modules which run on the target machine
976# ---------------------------------------
977[+ FOR target_modules +]
4977bab6 978
25b42232
PB
979[+ IF raw_cxx +]
980[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
f41d6665 981 check_multilibs=true
25b42232
PB
982 exports="$(RAW_CXX_TARGET_EXPORTS)"
983 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
984
985[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
986 exports="$(RAW_CXX_TARGET_EXPORTS)"
987 args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
988[+ ELSE +]
989[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
f41d6665 990 check_multilibs=true
25b42232
PB
991 exports="$(NORMAL_TARGET_EXPORTS)"
992 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
993
994[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
995 exports="$(NORMAL_TARGET_EXPORTS)"
996 args="$(TARGET_FLAGS_TO_PASS)" +]
997[+ ENDIF +]
7e2dbcef
NN
998
999.PHONY: check-target-[+module+] maybe-check-target-[+module+]
1000maybe-check-target-[+module+]:
60975492
PB
1001@if target-[+module+]
1002maybe-check-target-[+module+]: check-target-[+module+]
4977bab6
ZW
1003[+ IF no_check +]
1004# Dummy target for uncheckable module.
4977bab6
ZW
1005check-target-[+module+]:
1006[+ ELSE check +]
4977bab6 1007check-target-[+module+]:
f41d6665 1008 @: $(MAKE); $(unstage)
8c90b13a 1009 @r=`${PWD_COMMAND}`; export r; \
0bff65e7 1010 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1011IF raw_cxx +]
1012 $(RAW_CXX_TARGET_EXPORTS) \[+
1013ELSE normal_cxx +]
1014 $(NORMAL_TARGET_EXPORTS) \[+
1015ENDIF raw_cxx +]
3aa83176
NN
1016 (cd $(TARGET_SUBDIR)/[+module+] && \
1017 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1018 IF raw_cxx
1019 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1020 ENDIF raw_cxx
a52a0a7f 1021 +] [+extra_make_flags+] check)
4977bab6 1022[+ ENDIF no_check +]
60975492 1023@endif target-[+module+]
7e2dbcef 1024
4977bab6
ZW
1025.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1026maybe-install-target-[+module+]:
60975492
PB
1027@if target-[+module+]
1028maybe-install-target-[+module+]: install-target-[+module+]
7e2dbcef 1029[+ IF no_install +]
4977bab6
ZW
1030# Dummy target for uninstallable.
1031install-target-[+module+]:
1032[+ ELSE install +]
4977bab6 1033install-target-[+module+]: installdirs
f41d6665 1034 @: $(MAKE); $(unstage)
8c90b13a 1035 @r=`${PWD_COMMAND}`; export r; \
0bff65e7 1036 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1037IF raw_cxx +]
1038 $(RAW_CXX_TARGET_EXPORTS) \[+
1039ELSE normal_cxx +]
1040 $(NORMAL_TARGET_EXPORTS) \[+
1041ENDIF raw_cxx +]
3aa83176 1042 (cd $(TARGET_SUBDIR)/[+module+] && \
a52a0a7f 1043 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
4977bab6 1044[+ ENDIF no_install +]
60975492 1045@endif target-[+module+]
295f4e42
NN
1046
1047# Other targets (info, dvi, etc.)
1048[+ FOR recursive_targets +]
1049.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1050maybe-[+make_target+]-target-[+module+]:
60975492
PB
1051@if target-[+module+]
1052maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
295f4e42
NN
1053[+ IF (match-value? = "missing" (get "make_target") ) +]
1054# [+module+] doesn't support [+make_target+].
1055[+make_target+]-target-[+module+]:
1056[+ ELSE +]
1057[+make_target+]-target-[+module+]: [+
1058 FOR depend +]\
1059 [+depend+]-target-[+module+] [+
1060 ENDFOR depend +]
f41d6665 1061 @: $(MAKE); $(unstage)
295f4e42
NN
1062 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1063 r=`${PWD_COMMAND}`; export r; \
0bff65e7 1064 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1065IF raw_cxx +]
1066 $(RAW_CXX_TARGET_EXPORTS) \[+
1067ELSE normal_cxx +]
1068 $(NORMAL_TARGET_EXPORTS) \[+
1069ENDIF raw_cxx +]
295f4e42
NN
1070 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1071 for flag in $(EXTRA_TARGET_FLAGS); do \
1072 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1073 done; \
1074 (cd $(TARGET_SUBDIR)/[+module+] && \
1075 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1076 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1077 "RANLIB=$${RANLIB}" \
1078 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
a52a0a7f 1079 [+extra_make_flags+] [+make_target+]) \
295f4e42
NN
1080 || exit 1
1081[+ ENDIF +]
60975492 1082@endif target-[+module+]
295f4e42 1083[+ ENDFOR recursive_targets +]
4977bab6 1084[+ ENDFOR target_modules +]
95ddd785 1085
4977bab6
ZW
1086# ----------
1087# GCC module
1088# ----------
95ddd785 1089
f516a7da 1090@if gcc-no-bootstrap
d32ab992
PB
1091# GCC has some more recursive targets, which trigger the old
1092# (but still current, until the toplevel bootstrap project
1093# is finished) compiler bootstrapping rules.
95ddd785 1094
1ca4c6e1
PE
1095GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
1096.PHONY: $(GCC_STRAP_TARGETS)
3589b69e 1097$(GCC_STRAP_TARGETS): all-prebootstrap configure-gcc
8c90b13a
L
1098 @r=`${PWD_COMMAND}`; export r; \
1099 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1100 $(HOST_EXPORTS) \
95ddd785 1101 echo "Bootstrapping the compiler"; \
0bff65e7 1102 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
95ddd785 1103 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
8c90b13a
L
1104 @r=`${PWD_COMMAND}`; export r; \
1105 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
95ddd785
NN
1106 case "$@" in \
1107 *bootstrap4-lean ) \
3aa83176
NN
1108 msg="Comparing stage3 and stage4 of the compiler"; \
1109 compare=compare3-lean ;; \
1110 *bootstrap4 ) \
1111 msg="Comparing stage3 and stage4 of the compiler"; \
1112 compare=compare3 ;; \
1113 *-lean ) \
1114 msg="Comparing stage2 and stage3 of the compiler"; \
1115 compare=compare-lean ;; \
1116 * ) \
1117 msg="Comparing stage2 and stage3 of the compiler"; \
1118 compare=compare ;; \
95ddd785 1119 esac; \
a52a0a7f 1120 $(HOST_EXPORTS) \
95ddd785
NN
1121 echo "$$msg"; \
1122 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
8c90b13a
L
1123 @r=`${PWD_COMMAND}`; export r; \
1124 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
95ddd785 1125 echo "Building runtime libraries"; \
ad6717df 1126 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
95ddd785 1127
3589b69e 1128profiledbootstrap: all-prebootstrap configure-gcc
8c90b13a
L
1129 @r=`${PWD_COMMAND}`; export r; \
1130 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1131 $(HOST_EXPORTS) \
0bff65e7 1132 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
3922b216 1133 echo "Bootstrapping training compiler"; \
8f231b5d 1134 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build
8c90b13a 1135 @r=`${PWD_COMMAND}`; export r; \
8c90b13a 1136 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1137 $(HOST_EXPORTS) \
8f231b5d
JH
1138 echo "Building feedback based compiler"; \
1139 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build
3922b216
JDA
1140 @r=`${PWD_COMMAND}`; export r; \
1141 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
3922b216
JDA
1142 echo "Building runtime libraries"; \
1143 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
8f231b5d 1144
95ddd785 1145.PHONY: cross
7c27e184 1146cross: all-build all-gas all-ld
8c90b13a
L
1147 @r=`${PWD_COMMAND}`; export r; \
1148 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1149 $(HOST_EXPORTS) \
95ddd785
NN
1150 echo "Building the C and C++ compiler"; \
1151 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
8c90b13a
L
1152 @r=`${PWD_COMMAND}`; export r; \
1153 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
95ddd785 1154 echo "Building runtime libraries"; \
ad6717df 1155 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
f516a7da 1156@endif gcc-no-bootstrap
95ddd785 1157
60975492 1158@if gcc
6248218a
JM
1159.PHONY: check-gcc-c++
1160check-gcc-c++:
95ddd785 1161 @if [ -f ./gcc/Makefile ] ; then \
8c90b13a
L
1162 r=`${PWD_COMMAND}`; export r; \
1163 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1164 $(HOST_EXPORTS) \
88b5521b 1165 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
95ddd785
NN
1166 else \
1167 true; \
6248218a
JM
1168 fi
1169
1170.PHONY: check-c++
333a28b4 1171check-c++: check-target-libstdc++-v3 check-gcc-c++
95ddd785 1172
4977bab6
ZW
1173# Install the gcc headers files, but not the fixed include files,
1174# which Cygnus is not allowed to distribute. This rule is very
1175# dependent on the workings of the gcc Makefile.in.
1176.PHONY: gcc-no-fixedincludes
1177gcc-no-fixedincludes:
1178 @if [ -f ./gcc/Makefile ]; then \
1179 rm -rf gcc/tmp-include; \
1180 mv gcc/include gcc/tmp-include 2>/dev/null; \
1181 mkdir gcc/include; \
1182 cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1183 touch gcc/stmp-fixinc gcc/include/fixed; \
1184 rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
8c90b13a
L
1185 r=`${PWD_COMMAND}`; export r; \
1186 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
a52a0a7f 1187 $(HOST_EXPORTS) \
88b5521b 1188 (cd ./gcc && \
4977bab6
ZW
1189 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1190 rm -rf gcc/include; \
1191 mv gcc/tmp-include gcc/include 2>/dev/null; \
1192 else true; fi
60975492 1193@endif gcc
295f4e42 1194
2805b53a
NN
1195# ---------------------
1196# GCC bootstrap support
1197# ---------------------
1198
d32ab992
PB
1199# We track the current stage (the one in 'gcc') in the stage_current file.
1200# stage_last instead tracks the stage that was built last. These targets
1201# are dummy when toplevel bootstrap is not active.
1202
1061f99e 1203# While making host and target tools, symlinks to the final stage must be
f41d6665
DJ
1204# there, so $(unstage) should be run at various points. To avoid excessive
1205# recursive invocations of make, we "inline" them using a variable. These
1206# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1207# to avoid warnings from the GNU Make job server.
1061f99e
PB
1208
1209unstage = :
1210stage = :
cc11cc9b 1211current_stage = ""
1061f99e 1212
d32ab992 1213@if gcc-bootstrap
1061f99e 1214unstage = [ -f stage_current ] || $(MAKE) `cat stage_last`-start
d19bca38 1215stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
cc11cc9b 1216current_stage = "`cat stage_current 2> /dev/null`"
d32ab992
PB
1217@endif gcc-bootstrap
1218
1061f99e
PB
1219.PHONY: unstage stage
1220unstage:
f41d6665 1221 @: $(MAKE); $(unstage)
d32ab992 1222stage:
f41d6665 1223 @: $(MAKE); $(stage)
d32ab992 1224
2d309510
PB
1225# Disable commands for lean bootstrap.
1226LEAN = false
1227
148907ea
PB
1228# We name the build directories for the various stages "stage1-gcc",
1229# "stage2-gcc","stage3-gcc", etc.
1230
1231# Since the 'compare' process will fail (on debugging information) if any
1232# directory names are different, we need to link the gcc directory for
f41d6665 1233# the previous stage to a constant name ('prev-gcc'), and to make the name of
148907ea
PB
1234# the build directories constant as well. For the latter, we use naked names
1235# like 'gcc', because the scripts in that directory assume it. We use
1236# mv on platforms where symlinks to directories do not work or are not
1237# reliable.
1238
2805b53a
NN
1239# 'touch' doesn't work right on some platforms.
1240STAMP = echo timestamp >
1241
1242# Only build the C compiler for stage1, because that is the only one that
1243# we can guarantee will build with the native compiler, and also it is the
1244# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
1245# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
1246# overrideable (for a bootstrap build stage1 also builds gcc.info).
1247
1248STAGE1_CFLAGS=@stage1_cflags@
1249STAGE1_LANGUAGES=@stage1_languages@
1250
148907ea
PB
1251# We only want to compare .o files, so set this!
1252objext = .o
2805b53a 1253
2805b53a 1254# Flags to pass to stage2 and later makes.
2805b53a 1255POSTSTAGE1_FLAGS_TO_PASS = \
ad6717df 1256 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
5bea4a03 1257 STAGE_PREFIX=$$r/prev-gcc/ \
2805b53a 1258 CFLAGS="$(BOOT_CFLAGS)" \
cc11cc9b 1259 LIBCFLAGS="$(BOOT_CFLAGS)" \
d19bca38 1260 LDFLAGS="$(BOOT_LDFLAGS)" \
e9a54b07 1261 "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
2805b53a 1262
148907ea
PB
1263# For stage 1:
1264# * We force-disable intermodule optimizations, even if
1265# --enable-intermodule was passed, since the installed compiler probably
1266# can't handle them. Luckily, autoconf always respects
1267# the last argument when conflicting --enable arguments are passed.
1268# * Likewise, we force-disable coverage flags, since the installed compiler
1269# probably has never heard of them.
1270# * We build only C (and possibly Ada).
1271
1272[+ FOR bootstrap-stage +]
f516a7da 1273.PHONY: stage[+id+]-start stage[+id+]-end
148907ea 1274
ad6717df 1275stage[+id+]-start::
f41d6665 1276 @: $(MAKE); $(stage); \
d32ab992 1277 echo stage[+id+] > stage_current ; \
215c351a 1278 echo stage[+id+] > stage_last; \
f41d6665 1279 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
215c351a 1280 FOR host_modules +][+ IF bootstrap +]
7c27e184 1281@if [+ module +]
215c351a
PB
1282 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1283 mkdir stage[+id+]-[+module+]; \
2d309510
PB
1284 mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1285 mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
f41d6665
DJ
1286@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1287 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1288 mkdir stage[+id+]-$(TARGET_SUBDIR); \
2d309510
PB
1289 mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1290 mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
148907ea 1291
2d309510 1292stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
7c27e184 1293@if [+ module +]
2d309510
PB
1294 @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1295 cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1296 mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
f41d6665
DJ
1297 fi
1298@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1299 @if test -d $(TARGET_SUBDIR) ; then \
2d309510
PB
1300 mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1301 mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
f41d6665 1302 fi
2d309510 1303 rm -f stage_current
148907ea 1304
f41d6665
DJ
1305# Bubble a bugfix through all the stages up to stage [+id+]. They are
1306# remade, but not reconfigured. The next stage (if any) will not be
1307# reconfigured as well.
f516a7da 1308.PHONY: stage[+id+]-bubble
2d309510 1309stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
e7c84bf8
PB
1310 @r=`${PWD_COMMAND}`; export r; \
1311 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1312 if test -f stage[+id+]-lean [+
ce521a9c
PB
1313 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1314 echo Skipping rebuild of stage[+id+] ; \
1315 else \
2d309510
PB
1316 $(MAKE) stage[+id+]-start; \[+IF lean +]
1317 if $(LEAN); then \
1318 rm -rf stage[+lean+]-* ; \
1319 $(STAMP) stage[+lean+]-lean ; \
1320 fi; \[+ ENDIF lean +]
1061f99e 1321 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
2abefe3d 1322 fi[+ IF compare-target +]
d19bca38 1323 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
7c27e184 1324
45f366ab 1325.PHONY: all-stage[+id+] clean-stage[+id+]
45f366ab 1326do-clean: clean-stage[+id+]
2805b53a 1327
7c27e184
PB
1328# FIXME: Will not need to be conditional when toplevel bootstrap is the
1329# only possibility, but now it conflicts with no-bootstrap rules
1330@if gcc-bootstrap
148907ea 1331[+ IF compare-target +]
ce521a9c 1332[+compare-target+]:
e7c84bf8
PB
1333 @r=`${PWD_COMMAND}`; export r; \
1334 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1335 if test -f stage[+prev+]-lean; then \
ce521a9c
PB
1336 echo Cannot compare object files as stage [+prev+] was deleted. ; \
1337 exit 0 ; \
1338 fi; \
f41d6665 1339 : $(MAKE); $(stage); \
2805b53a 1340 rm -f .bad_compare ; \
cc11cc9b 1341 echo Comparing stages [+prev+] and [+id+] ; \
148907ea 1342 cd stage[+id+]-gcc; \
2805b53a
NN
1343 files=`find . -name "*$(objext)" -print` ; \
1344 cd .. ; \
1345 for file in $${files} ; do \
148907ea 1346 f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
a76494aa 1347 @do_compare@ > /dev/null 2>&1; \
1061f99e
PB
1348 if test $$? -eq 1; then \
1349 case $$file in \
1350 ./cc*-checksum$(objext) | ./libgcc/* ) \
1351 echo warning: $$file differs ;; \
1352 *) \
1353 echo $$file differs >> .bad_compare ;; \
1354 esac ; \
1355 fi ; \
2805b53a
NN
1356 done ; \
1357 if [ -f .bad_compare ]; then \
1358 echo "Bootstrap comparison failure!"; \
1359 cat .bad_compare; \
1360 exit 1; \
1361 else \
cc11cc9b 1362 echo Comparison successful.; \
2805b53a 1363 fi ; \
ce521a9c 1364 $(STAMP) [+compare-target+][+ IF prev +]
2d309510
PB
1365 if $(LEAN); then \
1366 rm -rf stage[+prev+]-*; \
1367 $(STAMP) stage[+prev+]-lean; \
1368 fi[+ ENDIF prev +]
148907ea
PB
1369[+ ENDIF compare-target +]
1370
1371[+ IF bootstrap-target +]
2d309510 1372.PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
2abefe3d
PB
1373[+bootstrap-target+]:
1374 echo stage[+id+] > stage_final
1375 @r=`${PWD_COMMAND}`; export r; \
1376 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1377 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
f41d6665 1378 @: $(MAKE); $(unstage)
2abefe3d
PB
1379 @r=`${PWD_COMMAND}`; export r; \
1380 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1381 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
2d309510
PB
1382
1383[+bootstrap-target+]-lean:
1384 echo stage[+id+] > stage_final
1385 @r=`${PWD_COMMAND}`; export r; \
1386 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1387 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1388 @: $(MAKE); $(unstage)
1389 @r=`${PWD_COMMAND}`; export r; \
1390 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1391 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
148907ea
PB
1392[+ ENDIF bootstrap-target +]
1393
45f366ab 1394# Rules to wipe a stage and all the following ones, also used for cleanstrap
ad6717df 1395[+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
45f366ab 1396.PHONY: distclean-stage[+id+]
ad6717df 1397distclean-stage[+id+]::
f41d6665 1398 @: $(MAKE); $(stage)
ce521a9c 1399 rm -rf stage[+id+]-* [+
148907ea 1400 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
148907ea
PB
1401
1402[+ IF cleanstrap-target +]
1403.PHONY: [+cleanstrap-target+]
45f366ab 1404[+cleanstrap-target+]: distclean [+bootstrap-target+]
148907ea 1405[+ ENDIF cleanstrap-target +]
7c27e184 1406@endif gcc-bootstrap
148907ea
PB
1407
1408[+ ENDFOR bootstrap-stage +]
ad6717df 1409
c7870f5d
PB
1410stageprofile-end::
1411 $(MAKE) distclean-stagefeedback
ad6717df 1412
c7870f5d 1413stagefeedback-start::
ad6717df
PB
1414 @r=`${PWD_COMMAND}`; export r; \
1415 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
c7870f5d
PB
1416 for i in prev-*; do \
1417 j=`echo $$i | sed s/^prev-//` ; \
1418 cd $$r/$$i && \
1419 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1420 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1421 done
03a91701 1422
45f366ab 1423@if gcc-bootstrap
45f366ab 1424do-distclean: distclean-stage1
cc11cc9b
PB
1425
1426# Provide a GCC build when we're building target libraries. This does
1427# not work as a dependency, just as the minimum necessary to avoid errors.
1428stage_last:
1429 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
45f366ab 1430
3ff3adad
PB
1431# Same as unstage, but not phony and defaulting to stage1-start. We place
1432# it in the dependency so that for example `make -j3 all-gcc' works.
1433stage_current:
1434 @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1435
cc11cc9b
PB
1436.PHONY: restrap
1437restrap:
1438 @: $(MAKE); $(stage)
1439 rm -rf stage1-$(TARGET_SUBDIR) [+ FOR bootstrap-stage +][+ IF prev
e9a54b07 1440 +]stage[+id+]-* [+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
cc11cc9b 1441 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
e9a54b07 1442@endif gcc-bootstrap
cc11cc9b 1443
4977bab6
ZW
1444# --------------------------------------
1445# Dependencies between different modules
1446# --------------------------------------
1447
3589b69e 1448# Generic dependencies for target modules on host stuff, especially gcc
cc11cc9b
PB
1449@if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1450 +][+ FOR bootstrap_stage +]
1451configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1452 ENDFOR +][+ ELSE bootstrap +]
1453configure-target-[+module+]: stage_last[+
1454 ENDIF bootstrap +][+ ENDFOR target_modules +]
1455@endif gcc-bootstrap
1456
1457@if gcc-no-bootstrap[+ FOR target_modules +][+ IF bootstrap
1458 +][+ ELSE +]
1459configure-target-[+module+]: maybe-all-gcc[+
1460 ENDIF bootstrap +][+ ENDFOR target_modules +]
1461@endif gcc-no-bootstrap
1462
3589b69e
PB
1463
1464[+ FOR lang_env_dependencies +]
1465configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss
1466[+ IF cxx +]configure-target-[+module+]: maybe-all-target-libstdc++-v3
1467[+ ENDIF cxx +][+ ENDFOR lang_env_dependencies +]
1468
4977bab6
ZW
1469# There are two types of dependencies here: 'hard' dependencies, where one
1470# module simply won't build without the other; and 'soft' dependencies, where
1471# if the depended-on module is missing, the depending module will do without
1472# or find a substitute somewhere (perhaps installed). Soft dependencies
3589b69e 1473# are made here to depend on a 'maybe-' target. If you're not sure,
4977bab6
ZW
1474# it's safer to use a soft dependency.
1475
3589b69e
PB
1476[+ ;; These Scheme functions build the bulk of the dependencies.
1477 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1478 ;; where "maybe-" is only included if HARD is true, and all-gcc
1479 ;; is taken from VAR-NAME.
1480 (define dep-target (lambda (module-kind var-name hard)
1481 (string-append
1482 (if hard "" "maybe-")
1483 (dep-subtarget var-name)
1484 module-kind
1485 (dep-module var-name)
1486 )))
1487
1488 ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
7c27e184 1489 (define make-dep (lambda (module-kind on-kind)
3589b69e
PB
1490 (string-append
1491 (dep-target module-kind "module" #t) ": "
7c27e184 1492 (dep-target on-kind "on" (exist? "hard")))))
3589b69e
PB
1493
1494 ;; dep-subtarget extracts everything up to the first dash in the given
1495 ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1496 (define dep-subtarget (lambda (var-name)
1497 (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1498
1499 ;; dep-module extracts everything up to the first dash in the given
1500 ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1501 (define dep-module (lambda (var-name)
1502 (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1503
1504 ;; dep-stage builds a string for the prefix of a bootstrap stage.
1505 (define dep-stage (lambda ()
1506 (string-append
1507 "stage"
1508 (get "id")
1509 "-")))
1510
1511 ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1512 ;; but is written in Scheme.
1513 (define dep-maybe (lambda ()
1514 (if (exist? "hard") "" "maybe-")))
1515
893f1e87
MK
1516 ;; dep-kind returns "normal" if the dependency is on an "install" target,
1517 ;; or if either module is not bootstrapped. It returns "bootstrap" for
3589b69e
PB
1518 ;; configure or build dependencies between bootstrapped modules; it returns
1519 ;; "prebootstrap" for configure or build dependencies of bootstrapped
7c27e184 1520 ;; modules on a build module (e.g. all-gcc on all-build-bison). All this
3589b69e
PB
1521 ;; is only necessary for host modules.
1522 (define dep-kind (lambda ()
7c27e184
PB
1523 (if (and (hash-ref boot-modules (dep-module "module"))
1524 (=* (dep-module "on") "build-"))
1525 "prebootstrap"
3589b69e 1526
7c27e184 1527 (if (or (= (dep-subtarget "on") "install-")
893f1e87
MK
1528 (not (hash-ref boot-modules (dep-module "module")))
1529 (not (hash-ref boot-modules (dep-module "on"))))
7c27e184
PB
1530 "normal"
1531 "bootstrap"))))
3589b69e
PB
1532
1533 ;; We now build the hash table that is used by dep-kind.
1534 (define boot-modules (make-hash-table 113))
3589b69e
PB
1535+]
1536
1537[+ FOR host_modules +][+
1538 (if (exist? "bootstrap")
1539 (hash-create-handle! boot-modules (get "module") #t))
1540 "" +][+ ENDFOR host_modules +]
2dfbef6d
PB
1541[+ FOR target_modules +][+
1542 (if (exist? "bootstrap")
1543 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1544 "" +][+ ENDFOR target_modules +]
3589b69e
PB
1545
1546# With all the machinery above in place, it is pretty easy to generate
1547# dependencies. Host dependencies are a bit more complex because we have
1548# to check for bootstrap/prebootstrap dependencies. To resolve
1549# prebootstrap dependencies, prebootstrap modules are gathered in
1550# a hash table.
7c27e184
PB
1551[+ FOR dependencies +][+ (make-dep "" "") +]
1552[+ CASE (dep-kind) +]
1553[+ == "prebootstrap"
3589b69e 1554 +][+ FOR bootstrap_stage +]
7c27e184
PB
1555[+ (make-dep (dep-stage) "") +][+
1556 ENDFOR bootstrap_stage +]
1557all-prebootstrap: [+ (dep-target "" "on" (exist? "hard")) +]
1558[+ == "bootstrap"
1559 +][+ FOR bootstrap_stage +]
1560[+ (make-dep (dep-stage) (dep-stage)) +][+
3589b69e
PB
1561 ENDFOR bootstrap_stage +]
1562[+ ESAC +][+
1563ENDFOR dependencies +]
1564
7c27e184
PB
1565# Non-toplevel bootstrap rules must depend on several packages, to be built
1566# before gcc. Another wart that will go away, hopefully soon.
3589b69e
PB
1567@if gcc-no-bootstrap
1568[+ FOR host_modules +][+
1569 IF (and (not (= (get "module") "gcc"))
1570 (hash-ref boot-modules (get "module"))) +]
1571all-prebootstrap: maybe-all-[+module+][+
1572 ENDIF +][+
1573ENDFOR host_modules +]
1574@endif gcc-no-bootstrap
1575
ef9db8d5 1576CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
0dffceed 1577GDB_TK = @GDB_TK@
ef9db8d5
DJ
1578INSTALL_GDB_TK = @INSTALL_GDB_TK@
1579configure-gdb: $(CONFIGURE_GDB_TK)
3589b69e 1580all-gdb: $(gdbnlmrequirements) $(GDB_TK)
ef9db8d5 1581install-gdb: $(INSTALL_GDB_TK)
95ddd785 1582
4977bab6
ZW
1583# Serialization dependencies. Host configures don't work well in parallel to
1584# each other, due to contention over config.cache. Target configures and
1585# build configures are similar.
1586@serialization_dependencies@
95ddd785 1587
4977bab6
ZW
1588# --------------------------------
1589# Regenerating top level configury
1590# --------------------------------
95ddd785
NN
1591
1592# Rebuilding Makefile.in, using autogen.
e245b0ea 1593AUTOGEN = autogen
ee03dc5e 1594$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
e245b0ea 1595 cd $(srcdir) && $(AUTOGEN) Makefile.def
95ddd785 1596
671aa708 1597# Rebuilding Makefile.
e245b0ea
AO
1598Makefile: $(srcdir)/Makefile.in config.status
1599 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1600
191dd2c9 1601config.status: configure
e75f9147 1602 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
95ddd785 1603
671aa708 1604# Rebuilding configure.
e245b0ea 1605AUTOCONF = autoconf
ee03dc5e 1606$(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4
e245b0ea 1607 cd $(srcdir) && $(AUTOCONF)
95ddd785 1608
93c834b7
NN
1609# ------------------------------
1610# Special directives to GNU Make
1611# ------------------------------
1612
93c834b7
NN
1613# Don't pass command-line variables to submakes.
1614.NOEXPORT:
1615MAKEOVERRIDES=
1616
95ddd785 1617# end of Makefile.in
This page took 0.520602 seconds and 5 git commands to generate.