]> gcc.gnu.org Git - gcc.git/blame - Makefile.tpl
tree-vrp.c (extract_range_from_assert): Set the range to VARYING for LT and GT if...
[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/ \
183 -B$(build_tooldir)/bin/"; export CC_FOR_BUILD;
df0f0674 184
df0f0674
NN
185# Target libraries are put under this directory:
186TARGET_SUBDIR = @target_subdir@
187# This is set by the configure script to the arguments to use when configuring
188# directories built for the target.
25b42232 189TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
4fc4dd12 190# This is the list of variables to export in the environment when
23f6b2f9 191# configuring subdirectories for the host system.
4fc4dd12 192BASE_TARGET_EXPORTS = \
23f6b2f9 193 $(BASE_EXPORTS) \
4fc4dd12 194 AR="$(AR_FOR_TARGET)"; export AR; \
2abefe3d 195 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
4fc4dd12
DJ
196 CC="$(CC_FOR_TARGET)"; export CC; \
197 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
198 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
e7daab31 199 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
4fc4dd12
DJ
200 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
201 GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
202 GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
203 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
2abefe3d 204 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
4fc4dd12 205 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
040b1c5a 206 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
2abefe3d 207 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
d739199a 208 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
4fc4dd12 209 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
040b1c5a 210 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
4c4a5bbc 211 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
0bff65e7 212 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
4fc4dd12
DJ
213
214RAW_CXX_TARGET_EXPORTS = \
215 $(BASE_TARGET_EXPORTS) \
216 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
217 CXX="$(RAW_CXX_FOR_TARGET)"; export CXX;
218
219NORMAL_TARGET_EXPORTS = \
220 $(BASE_TARGET_EXPORTS) \
221 CXX="$(CXX_FOR_TARGET)"; export CXX;
df0f0674 222
6de9cd9a
DN
223# Where to find GMP
224HOST_GMPLIBS = @gmplibs@
225HOST_GMPINC = @gmpinc@
226
df0f0674
NN
227# ----------------------------------------------
228# Programs producing files for the BUILD machine
229# ----------------------------------------------
230
231SHELL = @config_shell@
232
233# pwd command to use. Allow user to override default by setting PWDCMD in
234# the environment to account for automounters. The make variable must not
235# be called PWDCMD, otherwise the value set here is passed to make
236# subprocesses and overrides the setting from the user's environment.
8c90b13a
L
237# Don't use PWD since it is a common shell environment variable and we
238# don't want to corrupt it.
239PWD_COMMAND = $${PWDCMD-pwd}
df0f0674
NN
240
241# compilers to use to create programs which must be run in the build
242# environment.
243CC_FOR_BUILD = @CC_FOR_BUILD@
6691a79e 244CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
df0f0674
NN
245
246CXX_FOR_BUILD = $(CXX)
247
248# Special variables passed down in EXTRA_GCC_FLAGS. They are defined
249# here so that they can be overridden by Makefile fragments.
df0f0674
NN
250BUILD_PREFIX = @BUILD_PREFIX@
251BUILD_PREFIX_1 = @BUILD_PREFIX_1@
95ddd785 252
45f366ab
PB
253# Flags to pass to stage2 and later makes. They are defined
254# here so that they can be overridden by Makefile fragments.
255BOOT_CFLAGS= -g -O2
d19bca38 256BOOT_LDFLAGS=
45f366ab 257
2abefe3d
PB
258BISON = @BISON@
259YACC = @YACC@
260FLEX = @FLEX@
261LEX = @LEX@
262M4 = @M4@
263MAKEINFO = @MAKEINFO@
264EXPECT = @EXPECT@
265RUNTEST = @RUNTEST@
95ddd785
NN
266
267# This just becomes part of the MAKEINFO definition passed down to
268# sub-makes. It lets flags be given on the command line while still
269# using the makeinfo from the object tree.
2f50999f
GP
270# (Default to avoid splitting info files by setting the threshold high.)
271MAKEINFOFLAGS = --split-size=5000000
95ddd785 272
df0f0674
NN
273# ---------------------------------------------
274# Programs producing files for the HOST machine
275# ---------------------------------------------
95ddd785 276
df0f0674 277AS = @AS@
df0f0674
NN
278AR = @AR@
279AR_FLAGS = rc
df0f0674 280CC = @CC@
df0f0674 281CXX = @CXX@
df0f0674 282DLLTOOL = @DLLTOOL@
df0f0674 283LD = @LD@
2abefe3d
PB
284LIPO = @LIPO@
285NM = @NM@
2d309510 286OBJDUMP = @OBJDUMP@
df0f0674 287RANLIB = @RANLIB@
2abefe3d 288STRIP = @STRIP@
df0f0674 289WINDRES = @WINDRES@
95ddd785 290
2abefe3d
PB
291CFLAGS = @CFLAGS@
292LDFLAGS =
293LIBCFLAGS = $(CFLAGS)
294CXXFLAGS = @CXXFLAGS@
295LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
df0f0674
NN
296PICFLAG =
297
298# -----------------------------------------------
299# Programs producing files for the TARGET machine
300# -----------------------------------------------
95ddd785 301
ec0461f6 302FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
95ddd785 303
df0f0674 304AR_FOR_TARGET=@AR_FOR_TARGET@
4977bab6 305AS_FOR_TARGET=@AS_FOR_TARGET@
4de997d1 306CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 307
df0f0674
NN
308# If GCC_FOR_TARGET is not overriden on the command line, then this
309# variable is passed down to the gcc Makefile, where it is used to
310# build libgcc2.a. We define it here so that it can itself be
311# overridden on the command line.
2abefe3d 312GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 313CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 314RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 315GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 316GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4977bab6 317DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
df0f0674 318LD_FOR_TARGET=@LD_FOR_TARGET@
df0f0674 319
040b1c5a 320LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
df0f0674 321NM_FOR_TARGET=@NM_FOR_TARGET@
d739199a 322OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
4977bab6 323RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
040b1c5a 324STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
df0f0674 325WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
95ddd785 326
2abefe3d
PB
327COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
328COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
329COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
330
331# During gcc bootstrap, if we use some random cc for stage1 then
332# CFLAGS will be just -g. We want to ensure that TARGET libraries
333# (which we know are built with gcc) are built with optimizations so
334# prepend -O2 when setting CFLAGS_FOR_TARGET.
335CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
336SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
337CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
338LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
339LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
340LDFLAGS_FOR_TARGET =
df0f0674
NN
341PICFLAG_FOR_TARGET =
342
343# ------------------------------------
344# Miscellaneous targets and flag lists
345# ------------------------------------
346
95ddd785
NN
347# The first rule in the file had better be this one. Don't put any above it.
348# This lives here to allow makefile fragments to contain dependencies.
1061f99e 349all:
95ddd785 350
95ddd785 351#### host and target specific makefile fragments come in here.
671aa708
NN
352@target_makefile_frag@
353@alphaieee_frag@
354@ospace_frag@
355@host_makefile_frag@
95ddd785
NN
356###
357
0bff65e7
PB
358# This is the list of directories that may be needed in RPATH_ENVVAR
359# so that prorgams built for the target machine work.
360TARGET_LIB_PATH = [+ FOR target_modules +][+
361 IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
362 ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
363[+ FOR target_modules +][+ IF lib_path +]
364@if target-[+module+]
365TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
366@endif target-[+module+]
367[+ ENDIF lib_path +][+ ENDFOR target_modules +]
368
369
370# This is the list of directories that may be needed in RPATH_ENVVAR
371# so that programs built for the host machine work.
372HOST_LIB_PATH = [+ FOR host_modules +][+
373 IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
374 ENDFOR host_modules +]
375
376# Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
377@if gcc
378HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
379@endif gcc
380
381[+ FOR host_modules +][+ IF lib_path +]
382@if [+module+]
383HOST_LIB_PATH_[+module+] = \
384 $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
385 +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
386@endif [+module+]
387[+ ENDIF lib_path +][+ ENDFOR host_modules +]
388
95ddd785 389# Flags to pass down to all sub-makes.
cc11cc9b
PB
390BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
391 "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
392 "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +] \
e75f9147 393 "CONFIG_SHELL=$(SHELL)" \
11405c93 394 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"
95ddd785 395
4de997d1
PB
396# We leave this in just in case, but it is not needed anymore.
397RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
ad6717df 398
95ddd785
NN
399# Flags to pass down to most sub-makes, in which we're building with
400# the host environment.
95ddd785
NN
401EXTRA_HOST_FLAGS = \
402 'AR=$(AR)' \
403 'AS=$(AS)' \
404 'CC=$(CC)' \
405 'CXX=$(CXX)' \
406 'DLLTOOL=$(DLLTOOL)' \
407 'LD=$(LD)' \
2abefe3d 408 'LIPO=$(LIPO)' \
95ddd785 409 'NM=$(NM)' \
2d309510 410 'OBJDUMP=$(OBJDUMP)' \
c858bf1e 411 'RANLIB=$(RANLIB)' \
2abefe3d 412 'STRIP=$(STRIP)' \
95ddd785
NN
413 'WINDRES=$(WINDRES)'
414
415FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
416
417# Flags that are concerned with the location of the X11 include files
418# and library files
419#
420# NOTE: until the top-level is getting the values via autoconf, it only
421# causes problems to have this top-level Makefile overriding the autoconf-set
422# values in child directories. Only variables that don't conflict with
423# autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
424#
425X11_FLAGS_TO_PASS = \
426 'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
427 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
428
429# Flags to pass down to makes which are built with the target environment.
f41d6665
DJ
430# The double $ decreases the length of the command line; those variables
431# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The
432# COMPILER_ prefixed variables are not passed down so we expand them here.
95ddd785
NN
433EXTRA_TARGET_FLAGS = \
434 'AR=$$(AR_FOR_TARGET)' \
f41d6665 435 'AS=$(COMPILER_AS_FOR_TARGET)' \
95ddd785
NN
436 'CC=$$(CC_FOR_TARGET)' \
437 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
438 'CXX=$$(CXX_FOR_TARGET)' \
439 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
440 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
f41d6665 441 'LD=$(COMPILER_LD_FOR_TARGET)' \
e3791243 442 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
95ddd785
NN
443 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
444 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
f41d6665 445 'NM=$(COMPILER_NM_FOR_TARGET)' \
d739199a 446 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
95ddd785
NN
447 'RANLIB=$$(RANLIB_FOR_TARGET)' \
448 'WINDRES=$$(WINDRES_FOR_TARGET)'
449
450TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
451
452# Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
453# unfortunately needs the native compiler and the target ar and
454# ranlib.
455# If any variables are added here, they must be added to do-*, below.
1358ccea 456# The BUILD_* variables are a special case, which are used for the gcc
95ddd785
NN
457# cross-building scheme.
458EXTRA_GCC_FLAGS = \
95ddd785 459 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
d4cd9d81
NN
460 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
461 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
462 "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
463 "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
cc11cc9b 464 "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
95ddd785 465
d29b8ad8 466GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
95ddd785 467
8b87bb96 468.PHONY: configure-host
d32ab992 469configure-host: [+
8b87bb96
NN
470 FOR host_modules +] \
471 maybe-configure-[+module+][+
472 ENDFOR host_modules +]
473.PHONY: configure-target
474configure-target: [+
475 FOR target_modules +] \
476 maybe-configure-target-[+module+][+
477 ENDFOR target_modules +]
95ddd785 478
f516a7da
PB
479# The target built for a native non-bootstrap build.
480.PHONY: all
1061f99e
PB
481all:
482@if gcc-bootstrap
2abefe3d 483 [ -f stage_final ] || echo stage3 > stage_final
1061f99e
PB
484 @r=`${PWD_COMMAND}`; export r; \
485 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
f41d6665 486 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
1061f99e 487@endif gcc-bootstrap
f41d6665 488 @: $(MAKE); $(unstage)
1061f99e
PB
489 @r=`${PWD_COMMAND}`; export r; \
490 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
491 if [ -f stage_last ]; then \
2abefe3d 492 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
1061f99e 493 else \
2abefe3d 494 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
1061f99e 495 fi
8b87bb96 496
23f6b2f9 497.PHONY: all-build
cc11cc9b
PB
498[+ FOR build_modules +]
499all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
500
8b87bb96 501.PHONY: all-host
cc11cc9b
PB
502[+ FOR host_modules +][+ IF bootstrap +]
503@if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
504all-host: maybe-all-[+module+][+ IF bootstrap +]
505@endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
506
8b87bb96 507.PHONY: all-target
cc11cc9b
PB
508[+ FOR target_modules +][+ IF bootstrap +]
509@if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
510all-target: maybe-all-target-[+module+][+ IF bootstrap +]
511@endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR target_modules +]
95ddd785
NN
512
513# Do a target for all the subdirectories. A ``make do-X'' will do a
514# ``make X'' in all subdirectories (because, in general, there is a
515# dependency (below) of X upon do-X, a ``make X'' will also do this,
516# but it may do additional work as well).
4977bab6 517[+ FOR recursive_targets +]
1a1e6b96 518.PHONY: do-[+make_target+]
1061f99e 519do-[+make_target+]:
f41d6665 520 @: $(MAKE); $(unstage)
e7c84bf8
PB
521 @r=`${PWD_COMMAND}`; export r; \
522 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
523 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
1061f99e 524 [+make_target+]-target
1061f99e 525
1358ccea
NN
526
527.PHONY: [+make_target+]-host
cc11cc9b
PB
528[+ FOR host_modules +]
529[+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
1358ccea
NN
530
531.PHONY: [+make_target+]-target
cc11cc9b
PB
532[+ FOR target_modules +]
533[+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
4977bab6
ZW
534[+ ENDFOR recursive_targets +]
535
95ddd785
NN
536# Here are the targets which correspond to the do-X targets.
537
65d6e994 538.PHONY: info installcheck dvi html install-info install-html
95ddd785
NN
539.PHONY: clean distclean mostlyclean maintainer-clean realclean
540.PHONY: local-clean local-distclean local-maintainer-clean
541info: do-info
542installcheck: do-installcheck
543dvi: do-dvi
f87a2b2e 544html: do-html
95ddd785 545
212f6dd0
NN
546# Make sure makeinfo is built before we do a `make info', if we're
547# in fact building texinfo.
548do-info: maybe-all-texinfo
95ddd785
NN
549
550install-info: do-install-info dir.info
8c90b13a 551 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
95ddd785 552 if [ -f dir.info ] ; then \
3fbe8e4a 553 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
95ddd785
NN
554 else true ; fi
555
65d6e994
CD
556install-html: do-install-html
557
95ddd785
NN
558local-clean:
559 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
560
561local-distclean:
562 -rm -f Makefile config.status config.cache mh-frag mt-frag
f41d6665 563 -rm -f maybedep.tmp serdep.tmp
95ddd785
NN
564 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
565 rm -rf $(TARGET_SUBDIR); \
566 else true; fi
0c227849 567 -rm -rf $(BUILD_SUBDIR)
215c351a
PB
568 -if [ "$(HOST_SUBDIR)" != "." ]; then \
569 rm -rf $(HOST_SUBDIR); \
570 else true; fi
95ddd785
NN
571 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
572 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
573 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
574 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
575 -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
576
577local-maintainer-clean:
578 @echo "This command is intended for maintainers to use;"
579 @echo "it deletes files that may require special tools to rebuild."
580
581clean: do-clean local-clean
582mostlyclean: do-mostlyclean local-clean
583distclean: do-distclean local-clean local-distclean
584maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
585maintainer-clean: local-distclean
586realclean: maintainer-clean
587
2f3bdde7 588# Extra dependency for clean-target, owing to the mixed nature of gcc.
1358ccea 589clean-target: clean-target-libgcc
95ddd785 590clean-target-libgcc:
2f3bdde7 591 test ! -d gcc || (cd gcc && $(MAKE) $@)
95ddd785
NN
592
593# Check target.
594
595.PHONY: check do-check
333a28b4 596check: do-check
95ddd785 597
4977bab6 598# Only include modules actually being configured and built.
1061f99e
PB
599.PHONY: check-host
600check-host: [+
7e2dbcef
NN
601 FOR host_modules +] \
602 maybe-check-[+module+][+
1061f99e
PB
603 ENDFOR host_modules +]
604
605.PHONY: check-target
606check-target: [+
7e2dbcef
NN
607 FOR target_modules +] \
608 maybe-check-target-[+module+][+
1061f99e
PB
609 ENDFOR target_modules +]
610
611do-check:
f41d6665 612 @: $(MAKE); $(unstage)
e7c84bf8
PB
613 @r=`${PWD_COMMAND}`; export r; \
614 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
615 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
95ddd785
NN
616
617# Automated reporting of test results.
618
619warning.log: build.log
620 $(srcdir)/contrib/warn_summary build.log > $@
621
622mail-report.log:
623 if test x'$(BOOT_CFLAGS)' != x''; then \
624 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
625 fi; \
626 $(srcdir)/contrib/test_summary -t >$@
627 chmod +x $@
628 echo If you really want to send e-mail, run ./$@ now
629
630mail-report-with-warnings.log: warning.log
631 if test x'$(BOOT_CFLAGS)' != x''; then \
632 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
633 fi; \
634 $(srcdir)/contrib/test_summary -t -i warning.log >$@
635 chmod +x $@
636 echo If you really want to send e-mail, run ./$@ now
637
638# Installation targets.
639
4977bab6 640.PHONY: install uninstall
1061f99e 641install:
f41d6665 642 @: $(MAKE); $(unstage)
e7c84bf8
PB
643 @r=`${PWD_COMMAND}`; export r; \
644 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
645 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
8b87bb96 646
7e2dbcef
NN
647.PHONY: install-host-nogcc
648install-host-nogcc: [+
3589b69e
PB
649 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
650 maybe-install-[+module+][+ ENDIF +][+
7e2dbcef
NN
651 ENDFOR host_modules +]
652
8b87bb96 653.PHONY: install-host
d32ab992 654install-host: [+
8b87bb96
NN
655 FOR host_modules +] \
656 maybe-install-[+module+][+
657 ENDFOR host_modules +]
7e2dbcef 658
8b87bb96
NN
659.PHONY: install-target
660install-target: [+
661 FOR target_modules +] \
662 maybe-install-target-[+module+][+
663 ENDFOR target_modules +]
95ddd785
NN
664
665uninstall:
666 @echo "the uninstall target is not supported in this tree"
667
95ddd785
NN
668.PHONY: install.all
669install.all: install-no-fixedincludes
670 @if [ -f ./gcc/Makefile ] ; then \
8c90b13a 671 r=`${PWD_COMMAND}` ; export r ; \
f41d6665 672 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 673 $(HOST_EXPORTS) \
88b5521b 674 (cd ./gcc && \
95ddd785
NN
675 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
676 else \
677 true ; \
678 fi
679
680# install-no-fixedincludes is used because Cygnus can not distribute
681# the fixed header files.
682.PHONY: install-no-fixedincludes
7e2dbcef 683install-no-fixedincludes: installdirs install-host-nogcc \
8b87bb96 684 install-target gcc-no-fixedincludes
95ddd785 685
4977bab6 686### other supporting targets
95ddd785 687
4977bab6
ZW
688MAKEDIRS= \
689 $(DESTDIR)$(prefix) \
690 $(DESTDIR)$(exec_prefix)
691.PHONY: installdirs
692installdirs: mkinstalldirs
693 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
694
695dir.info: do-install-info
696 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
3fbe8e4a 697 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
4977bab6
ZW
698 mv -f dir.info.new dir.info ; \
699 else true ; \
95ddd785
NN
700 fi
701
4977bab6
ZW
702dist:
703 @echo "Building a full distribution of this tree isn't done"
704 @echo "via 'make dist'. Check out the etc/ subdirectory"
705
706etags tags: TAGS
707
708# Right now this just builds TAGS in each subdirectory. emacs19 has the
709# ability to use several tags files at once, so there is probably no need
710# to combine them into one big TAGS file (like CVS 1.3 does). We could
711# (if we felt like it) have this Makefile write a piece of elisp which
712# the user could load to tell emacs19 where all the TAGS files we just
713# built are.
714TAGS: do-TAGS
715
25b42232
PB
716# ------------------------------------
717# Macros for configure and all targets
718# ------------------------------------
719
720[+ DEFINE configure +]
721.PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
722maybe-configure-[+prefix+][+module+]:
723@if [+prefix+][+module+]
724maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
cc11cc9b
PB
725configure-[+prefix+][+module+]: [+ IF bootstrap +]
726@endif [+prefix+][+module+]
727@if [+prefix+][+module+]-bootstrap
728 @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
729@endif [+prefix+][+module+]-bootstrap
730@if [+prefix+][+module+][+ ELSE bootstrap +]
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} \
805 [+stage_configure_flags+] [+extra_configure_flags+]
f41d6665 806@endif [+prefix+][+module+]-bootstrap
ce406537
PB
807[+ ENDFOR bootstrap_stage +]
808[+ ENDIF bootstrap +]
25b42232
PB
809[+ ENDDEF +]
810
811[+ DEFINE all +]
812.PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
813maybe-all-[+prefix+][+module+]:
814@if [+prefix+][+module+]
815TARGET-[+prefix+][+module+]=[+
816 IF target +][+target+][+ ELSE +]all[+ ENDIF target +]
817maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
cc11cc9b
PB
818all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +]
819@endif [+prefix+][+module+]
820@if [+prefix+][+module+]-bootstrap
821 @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
822@endif [+prefix+][+module+]-bootstrap
823@if [+prefix+][+module+][+ ELSE bootstrap +]
824 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
825 @r=`${PWD_COMMAND}`; export r; \
8c90b13a 826 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
25b42232
PB
827 [+exports+] \
828 (cd [+subdir+]/[+module+] && \
829 $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
830@endif [+prefix+][+module+]
ce406537
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+]:
f41d6665 838@if [+prefix+][+module+]-bootstrap
ce406537
PB
839maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
840all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
1061f99e 841TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
ce406537 842all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
cc11cc9b 843 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
ce406537
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
1061f99e
PB
851 +] [+stage_make_flags+] [+extra_make_flags+] \
852 $(TARGET-stage[+id+]-[+prefix+][+module+])
ce406537
PB
853
854maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
855clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
856clean-stage[+id+]-[+prefix+][+module+]:
857 @[ -f [+subdir+]/[+module+]/Makefile ] || [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] \
858 || exit 0 ; \
cc11cc9b 859 [ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start; \
ce406537
PB
860 cd [+subdir+]/[+module+] && \
861 $(MAKE) [+args+] [+ IF prev +] \
862 [+poststage1_args+] [+ ENDIF prev +] \
863 [+stage_make_flags+] [+extra_make_flags+] clean
f41d6665 864@endif [+prefix+][+module+]-bootstrap
ce406537
PB
865
866[+ ENDFOR bootstrap_stage +]
867[+ ENDIF bootstrap +]
25b42232
PB
868[+ ENDDEF +]
869
870# --------------------------------------
871# Modules which run on the build machine
872# --------------------------------------
873[+ FOR build_modules +]
874[+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
875 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
876
877[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
878[+ ENDFOR build_module +]
4977bab6
ZW
879
880# --------------------------------------
881# Modules which run on the host machine
882# --------------------------------------
883[+ FOR host_modules +]
ce406537
PB
884[+ configure prefix="" subdir="$(HOST_SUBDIR)"
885 exports="$(HOST_EXPORTS)"
886 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
25b42232 887 args="$(HOST_CONFIGARGS)" +]
95ddd785 888
ce406537
PB
889[+ all prefix="" subdir="$(HOST_SUBDIR)"
890 exports="$(HOST_EXPORTS)"
891 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
892 args="$(FLAGS_TO_PASS)"
893 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
4977bab6 894
7e2dbcef
NN
895.PHONY: check-[+module+] maybe-check-[+module+]
896maybe-check-[+module+]:
60975492
PB
897@if [+module+]
898maybe-check-[+module+]: check-[+module+]
4977bab6 899[+ IF no_check +]
4977bab6
ZW
900check-[+module+]:
901[+ ELIF no_check_cross +]
4977bab6
ZW
902# This module is only tested in a native toolchain.
903check-[+module+]:
f41d6665 904 @: $(MAKE); $(unstage)
e89fbdfe 905 @if [ '$(host)' = '$(target)' ] ; then \
8c90b13a
L
906 r=`${PWD_COMMAND}`; export r; \
907 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 908 $(HOST_EXPORTS) \
215c351a 909 (cd $(HOST_SUBDIR)/[+module+] && \
ef6e9bc0 910 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
3aa83176
NN
911 fi
912[+ ELSE check +]
3aa83176 913check-[+module+]:
f41d6665 914 @: $(MAKE); $(unstage)
8c90b13a
L
915 @r=`${PWD_COMMAND}`; export r; \
916 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 917 $(HOST_EXPORTS) \
215c351a
PB
918 (cd $(HOST_SUBDIR)/[+module+] && \
919 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
4977bab6 920[+ ENDIF no_check +]
60975492 921@endif [+module+]
4977bab6 922
4977bab6
ZW
923.PHONY: install-[+module+] maybe-install-[+module+]
924maybe-install-[+module+]:
60975492
PB
925@if [+module+]
926maybe-install-[+module+]: install-[+module+]
7e2dbcef 927[+ IF no_install +]
4977bab6
ZW
928install-[+module+]:
929[+ ELSE install +]
4977bab6 930install-[+module+]: installdirs
f41d6665 931 @: $(MAKE); $(unstage)
8c90b13a
L
932 @r=`${PWD_COMMAND}`; export r; \
933 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 934 $(HOST_EXPORTS) \
215c351a 935 (cd $(HOST_SUBDIR)/[+module+] && \
ace9ac7b 936 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
4977bab6 937[+ ENDIF no_install +]
60975492 938@endif [+module+]
295f4e42
NN
939
940# Other targets (info, dvi, etc.)
941[+ FOR recursive_targets +]
942.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
943maybe-[+make_target+]-[+module+]:
60975492
PB
944@if [+module+]
945maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
295f4e42
NN
946[+ IF (match-value? = "missing" (get "make_target") ) +]
947# [+module+] doesn't support [+make_target+].
948[+make_target+]-[+module+]:
949[+ ELSE +]
950[+make_target+]-[+module+]: [+
951 FOR depend +]\
952 [+depend+]-[+module+] [+
953 ENDFOR depend +]
f41d6665 954 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1061f99e 955 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
295f4e42
NN
956 r=`${PWD_COMMAND}`; export r; \
957 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 958 $(HOST_EXPORTS) \
d32ab992 959 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
295f4e42
NN
960 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
961 done; \
962 echo "Doing [+make_target+] in [+module+]" ; \
215c351a 963 (cd $(HOST_SUBDIR)/[+module+] && \
295f4e42
NN
964 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
965 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
966 "RANLIB=$${RANLIB}" \
967 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
d32ab992 968 [+make_target+]) \
295f4e42
NN
969 || exit 1
970[+ ENDIF +]
60975492 971@endif [+module+]
295f4e42 972[+ ENDFOR recursive_targets +]
4977bab6
ZW
973[+ ENDFOR host_modules +]
974
975# ---------------------------------------
976# Modules which run on the target machine
977# ---------------------------------------
978[+ FOR target_modules +]
4977bab6 979
25b42232
PB
980[+ IF raw_cxx +]
981[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
f41d6665 982 check_multilibs=true
25b42232
PB
983 exports="$(RAW_CXX_TARGET_EXPORTS)"
984 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
985
986[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
987 exports="$(RAW_CXX_TARGET_EXPORTS)"
988 args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
989[+ ELSE +]
990[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
f41d6665 991 check_multilibs=true
25b42232
PB
992 exports="$(NORMAL_TARGET_EXPORTS)"
993 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
994
995[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
996 exports="$(NORMAL_TARGET_EXPORTS)"
997 args="$(TARGET_FLAGS_TO_PASS)" +]
998[+ ENDIF +]
7e2dbcef
NN
999
1000.PHONY: check-target-[+module+] maybe-check-target-[+module+]
1001maybe-check-target-[+module+]:
60975492
PB
1002@if target-[+module+]
1003maybe-check-target-[+module+]: check-target-[+module+]
4977bab6
ZW
1004[+ IF no_check +]
1005# Dummy target for uncheckable module.
4977bab6
ZW
1006check-target-[+module+]:
1007[+ ELSE check +]
4977bab6 1008check-target-[+module+]:
f41d6665 1009 @: $(MAKE); $(unstage)
8c90b13a 1010 @r=`${PWD_COMMAND}`; export r; \
0bff65e7 1011 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1012IF raw_cxx +]
1013 $(RAW_CXX_TARGET_EXPORTS) \[+
1014ELSE normal_cxx +]
1015 $(NORMAL_TARGET_EXPORTS) \[+
1016ENDIF raw_cxx +]
3aa83176
NN
1017 (cd $(TARGET_SUBDIR)/[+module+] && \
1018 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1019 IF raw_cxx
1020 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1021 ENDIF raw_cxx
a52a0a7f 1022 +] [+extra_make_flags+] check)
4977bab6 1023[+ ENDIF no_check +]
60975492 1024@endif target-[+module+]
7e2dbcef 1025
4977bab6
ZW
1026.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1027maybe-install-target-[+module+]:
60975492
PB
1028@if target-[+module+]
1029maybe-install-target-[+module+]: install-target-[+module+]
7e2dbcef 1030[+ IF no_install +]
4977bab6
ZW
1031# Dummy target for uninstallable.
1032install-target-[+module+]:
1033[+ ELSE install +]
4977bab6 1034install-target-[+module+]: installdirs
f41d6665 1035 @: $(MAKE); $(unstage)
8c90b13a 1036 @r=`${PWD_COMMAND}`; export r; \
0bff65e7 1037 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1038IF raw_cxx +]
1039 $(RAW_CXX_TARGET_EXPORTS) \[+
1040ELSE normal_cxx +]
1041 $(NORMAL_TARGET_EXPORTS) \[+
1042ENDIF raw_cxx +]
3aa83176 1043 (cd $(TARGET_SUBDIR)/[+module+] && \
a52a0a7f 1044 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
4977bab6 1045[+ ENDIF no_install +]
60975492 1046@endif target-[+module+]
295f4e42
NN
1047
1048# Other targets (info, dvi, etc.)
1049[+ FOR recursive_targets +]
1050.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1051maybe-[+make_target+]-target-[+module+]:
60975492
PB
1052@if target-[+module+]
1053maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
295f4e42
NN
1054[+ IF (match-value? = "missing" (get "make_target") ) +]
1055# [+module+] doesn't support [+make_target+].
1056[+make_target+]-target-[+module+]:
1057[+ ELSE +]
1058[+make_target+]-target-[+module+]: [+
1059 FOR depend +]\
1060 [+depend+]-target-[+module+] [+
1061 ENDFOR depend +]
f41d6665 1062 @: $(MAKE); $(unstage)
295f4e42
NN
1063 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1064 r=`${PWD_COMMAND}`; export r; \
0bff65e7 1065 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1066IF raw_cxx +]
1067 $(RAW_CXX_TARGET_EXPORTS) \[+
1068ELSE normal_cxx +]
1069 $(NORMAL_TARGET_EXPORTS) \[+
1070ENDIF raw_cxx +]
295f4e42
NN
1071 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1072 for flag in $(EXTRA_TARGET_FLAGS); do \
1073 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1074 done; \
1075 (cd $(TARGET_SUBDIR)/[+module+] && \
1076 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1077 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1078 "RANLIB=$${RANLIB}" \
1079 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
a52a0a7f 1080 [+extra_make_flags+] [+make_target+]) \
295f4e42
NN
1081 || exit 1
1082[+ ENDIF +]
60975492 1083@endif target-[+module+]
295f4e42 1084[+ ENDFOR recursive_targets +]
4977bab6 1085[+ ENDFOR target_modules +]
95ddd785 1086
4977bab6
ZW
1087# ----------
1088# GCC module
1089# ----------
95ddd785 1090
f516a7da 1091@if gcc-no-bootstrap
d32ab992
PB
1092# GCC has some more recursive targets, which trigger the old
1093# (but still current, until the toplevel bootstrap project
1094# is finished) compiler bootstrapping rules.
95ddd785 1095
1ca4c6e1
PE
1096GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
1097.PHONY: $(GCC_STRAP_TARGETS)
3589b69e 1098$(GCC_STRAP_TARGETS): all-prebootstrap configure-gcc
8c90b13a
L
1099 @r=`${PWD_COMMAND}`; export r; \
1100 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1101 $(HOST_EXPORTS) \
95ddd785 1102 echo "Bootstrapping the compiler"; \
0bff65e7 1103 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
95ddd785 1104 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
8c90b13a
L
1105 @r=`${PWD_COMMAND}`; export r; \
1106 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
95ddd785
NN
1107 case "$@" in \
1108 *bootstrap4-lean ) \
3aa83176
NN
1109 msg="Comparing stage3 and stage4 of the compiler"; \
1110 compare=compare3-lean ;; \
1111 *bootstrap4 ) \
1112 msg="Comparing stage3 and stage4 of the compiler"; \
1113 compare=compare3 ;; \
1114 *-lean ) \
1115 msg="Comparing stage2 and stage3 of the compiler"; \
1116 compare=compare-lean ;; \
1117 * ) \
1118 msg="Comparing stage2 and stage3 of the compiler"; \
1119 compare=compare ;; \
95ddd785 1120 esac; \
a52a0a7f 1121 $(HOST_EXPORTS) \
95ddd785
NN
1122 echo "$$msg"; \
1123 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
8c90b13a
L
1124 @r=`${PWD_COMMAND}`; export r; \
1125 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
95ddd785 1126 echo "Building runtime libraries"; \
ad6717df 1127 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
95ddd785 1128
3589b69e 1129profiledbootstrap: all-prebootstrap configure-gcc
8c90b13a
L
1130 @r=`${PWD_COMMAND}`; export r; \
1131 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1132 $(HOST_EXPORTS) \
0bff65e7 1133 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
3922b216 1134 echo "Bootstrapping training compiler"; \
8f231b5d 1135 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build
8c90b13a 1136 @r=`${PWD_COMMAND}`; export r; \
8c90b13a 1137 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1138 $(HOST_EXPORTS) \
8f231b5d
JH
1139 echo "Building feedback based compiler"; \
1140 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build
3922b216
JDA
1141 @r=`${PWD_COMMAND}`; export r; \
1142 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
3922b216
JDA
1143 echo "Building runtime libraries"; \
1144 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
8f231b5d 1145
95ddd785 1146.PHONY: cross
7c27e184 1147cross: all-build all-gas all-ld
8c90b13a
L
1148 @r=`${PWD_COMMAND}`; export r; \
1149 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1150 $(HOST_EXPORTS) \
95ddd785
NN
1151 echo "Building the C and C++ compiler"; \
1152 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
8c90b13a
L
1153 @r=`${PWD_COMMAND}`; export r; \
1154 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
95ddd785 1155 echo "Building runtime libraries"; \
ad6717df 1156 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
f516a7da 1157@endif gcc-no-bootstrap
95ddd785 1158
60975492 1159@if gcc
6248218a
JM
1160.PHONY: check-gcc-c++
1161check-gcc-c++:
95ddd785 1162 @if [ -f ./gcc/Makefile ] ; then \
8c90b13a
L
1163 r=`${PWD_COMMAND}`; export r; \
1164 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1165 $(HOST_EXPORTS) \
88b5521b 1166 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
95ddd785
NN
1167 else \
1168 true; \
6248218a
JM
1169 fi
1170
1171.PHONY: check-c++
333a28b4 1172check-c++: check-target-libstdc++-v3 check-gcc-c++
95ddd785 1173
4977bab6
ZW
1174# Install the gcc headers files, but not the fixed include files,
1175# which Cygnus is not allowed to distribute. This rule is very
1176# dependent on the workings of the gcc Makefile.in.
1177.PHONY: gcc-no-fixedincludes
1178gcc-no-fixedincludes:
1179 @if [ -f ./gcc/Makefile ]; then \
1180 rm -rf gcc/tmp-include; \
1181 mv gcc/include gcc/tmp-include 2>/dev/null; \
1182 mkdir gcc/include; \
1183 cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1184 touch gcc/stmp-fixinc gcc/include/fixed; \
1185 rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
8c90b13a
L
1186 r=`${PWD_COMMAND}`; export r; \
1187 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
a52a0a7f 1188 $(HOST_EXPORTS) \
88b5521b 1189 (cd ./gcc && \
4977bab6
ZW
1190 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1191 rm -rf gcc/include; \
1192 mv gcc/tmp-include gcc/include 2>/dev/null; \
1193 else true; fi
60975492 1194@endif gcc
295f4e42 1195
2805b53a
NN
1196# ---------------------
1197# GCC bootstrap support
1198# ---------------------
1199
d32ab992
PB
1200# We track the current stage (the one in 'gcc') in the stage_current file.
1201# stage_last instead tracks the stage that was built last. These targets
1202# are dummy when toplevel bootstrap is not active.
1203
1061f99e 1204# While making host and target tools, symlinks to the final stage must be
f41d6665
DJ
1205# there, so $(unstage) should be run at various points. To avoid excessive
1206# recursive invocations of make, we "inline" them using a variable. These
1207# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1208# to avoid warnings from the GNU Make job server.
1061f99e
PB
1209
1210unstage = :
1211stage = :
cc11cc9b 1212current_stage = ""
1061f99e 1213
d32ab992 1214@if gcc-bootstrap
1061f99e 1215unstage = [ -f stage_current ] || $(MAKE) `cat stage_last`-start
d19bca38 1216stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
cc11cc9b 1217current_stage = "`cat stage_current 2> /dev/null`"
d32ab992
PB
1218@endif gcc-bootstrap
1219
1061f99e
PB
1220.PHONY: unstage stage
1221unstage:
f41d6665 1222 @: $(MAKE); $(unstage)
d32ab992 1223stage:
f41d6665 1224 @: $(MAKE); $(stage)
d32ab992 1225
2d309510
PB
1226# Disable commands for lean bootstrap.
1227LEAN = false
1228
148907ea
PB
1229# We name the build directories for the various stages "stage1-gcc",
1230# "stage2-gcc","stage3-gcc", etc.
1231
1232# Since the 'compare' process will fail (on debugging information) if any
1233# directory names are different, we need to link the gcc directory for
f41d6665 1234# the previous stage to a constant name ('prev-gcc'), and to make the name of
148907ea
PB
1235# the build directories constant as well. For the latter, we use naked names
1236# like 'gcc', because the scripts in that directory assume it. We use
1237# mv on platforms where symlinks to directories do not work or are not
1238# reliable.
1239
2805b53a
NN
1240# 'touch' doesn't work right on some platforms.
1241STAMP = echo timestamp >
1242
1243# Only build the C compiler for stage1, because that is the only one that
1244# we can guarantee will build with the native compiler, and also it is the
1245# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
1246# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
1247# overrideable (for a bootstrap build stage1 also builds gcc.info).
1248
1249STAGE1_CFLAGS=@stage1_cflags@
1250STAGE1_LANGUAGES=@stage1_languages@
1251
148907ea
PB
1252# We only want to compare .o files, so set this!
1253objext = .o
2805b53a 1254
2805b53a 1255# Flags to pass to stage2 and later makes.
2805b53a 1256POSTSTAGE1_FLAGS_TO_PASS = \
ad6717df 1257 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
5bea4a03 1258 STAGE_PREFIX=$$r/prev-gcc/ \
2805b53a 1259 CFLAGS="$(BOOT_CFLAGS)" \
cc11cc9b 1260 LIBCFLAGS="$(BOOT_CFLAGS)" \
d19bca38 1261 LDFLAGS="$(BOOT_LDFLAGS)" \
7caf53cb 1262 ADAC="\$$(CC)"
2805b53a 1263
148907ea
PB
1264# For stage 1:
1265# * We force-disable intermodule optimizations, even if
1266# --enable-intermodule was passed, since the installed compiler probably
1267# can't handle them. Luckily, autoconf always respects
1268# the last argument when conflicting --enable arguments are passed.
1269# * Likewise, we force-disable coverage flags, since the installed compiler
1270# probably has never heard of them.
1271# * We build only C (and possibly Ada).
1272
1273[+ FOR bootstrap-stage +]
f516a7da 1274.PHONY: stage[+id+]-start stage[+id+]-end
148907ea 1275
ad6717df 1276stage[+id+]-start::
f41d6665 1277 @: $(MAKE); $(stage); \
d32ab992 1278 echo stage[+id+] > stage_current ; \
215c351a 1279 echo stage[+id+] > stage_last; \
f41d6665 1280 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
215c351a 1281 FOR host_modules +][+ IF bootstrap +]
7c27e184 1282@if [+ module +]
215c351a
PB
1283 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1284 mkdir stage[+id+]-[+module+]; \
2d309510
PB
1285 mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1286 mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
f41d6665
DJ
1287@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1288 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1289 mkdir stage[+id+]-$(TARGET_SUBDIR); \
2d309510
PB
1290 mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1291 mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
148907ea 1292
2d309510 1293stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
7c27e184 1294@if [+ module +]
2d309510
PB
1295 @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1296 cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1297 mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
f41d6665
DJ
1298 fi
1299@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1300 @if test -d $(TARGET_SUBDIR) ; then \
2d309510
PB
1301 mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1302 mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
f41d6665 1303 fi
2d309510 1304 rm -f stage_current
148907ea 1305
f41d6665
DJ
1306# Bubble a bugfix through all the stages up to stage [+id+]. They are
1307# remade, but not reconfigured. The next stage (if any) will not be
1308# reconfigured as well.
f516a7da 1309.PHONY: stage[+id+]-bubble
2d309510 1310stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
e7c84bf8
PB
1311 @r=`${PWD_COMMAND}`; export r; \
1312 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1313 if test -f stage[+id+]-lean [+
ce521a9c
PB
1314 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1315 echo Skipping rebuild of stage[+id+] ; \
1316 else \
2d309510
PB
1317 $(MAKE) stage[+id+]-start; \[+IF lean +]
1318 if $(LEAN); then \
1319 rm -rf stage[+lean+]-* ; \
1320 $(STAMP) stage[+lean+]-lean ; \
1321 fi; \[+ ENDIF lean +]
1061f99e 1322 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
2abefe3d 1323 fi[+ IF compare-target +]
d19bca38 1324 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
7c27e184 1325
45f366ab 1326.PHONY: all-stage[+id+] clean-stage[+id+]
45f366ab 1327do-clean: clean-stage[+id+]
2805b53a 1328
7c27e184
PB
1329# FIXME: Will not need to be conditional when toplevel bootstrap is the
1330# only possibility, but now it conflicts with no-bootstrap rules
1331@if gcc-bootstrap
148907ea 1332[+ IF compare-target +]
ce521a9c 1333[+compare-target+]:
e7c84bf8
PB
1334 @r=`${PWD_COMMAND}`; export r; \
1335 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1336 if test -f stage[+prev+]-lean; then \
ce521a9c
PB
1337 echo Cannot compare object files as stage [+prev+] was deleted. ; \
1338 exit 0 ; \
1339 fi; \
f41d6665 1340 : $(MAKE); $(stage); \
2805b53a 1341 rm -f .bad_compare ; \
cc11cc9b 1342 echo Comparing stages [+prev+] and [+id+] ; \
148907ea 1343 cd stage[+id+]-gcc; \
2805b53a
NN
1344 files=`find . -name "*$(objext)" -print` ; \
1345 cd .. ; \
1346 for file in $${files} ; do \
148907ea 1347 f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
a76494aa 1348 @do_compare@ > /dev/null 2>&1; \
1061f99e
PB
1349 if test $$? -eq 1; then \
1350 case $$file in \
1351 ./cc*-checksum$(objext) | ./libgcc/* ) \
1352 echo warning: $$file differs ;; \
1353 *) \
1354 echo $$file differs >> .bad_compare ;; \
1355 esac ; \
1356 fi ; \
2805b53a
NN
1357 done ; \
1358 if [ -f .bad_compare ]; then \
1359 echo "Bootstrap comparison failure!"; \
1360 cat .bad_compare; \
1361 exit 1; \
1362 else \
cc11cc9b 1363 echo Comparison successful.; \
2805b53a 1364 fi ; \
ce521a9c 1365 $(STAMP) [+compare-target+][+ IF prev +]
2d309510
PB
1366 if $(LEAN); then \
1367 rm -rf stage[+prev+]-*; \
1368 $(STAMP) stage[+prev+]-lean; \
1369 fi[+ ENDIF prev +]
148907ea
PB
1370[+ ENDIF compare-target +]
1371
1372[+ IF bootstrap-target +]
2d309510 1373.PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
2abefe3d
PB
1374[+bootstrap-target+]:
1375 echo stage[+id+] > stage_final
1376 @r=`${PWD_COMMAND}`; export r; \
1377 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1378 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
f41d6665 1379 @: $(MAKE); $(unstage)
2abefe3d
PB
1380 @r=`${PWD_COMMAND}`; export r; \
1381 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1382 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
2d309510
PB
1383
1384[+bootstrap-target+]-lean:
1385 echo stage[+id+] > stage_final
1386 @r=`${PWD_COMMAND}`; export r; \
1387 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1388 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1389 @: $(MAKE); $(unstage)
1390 @r=`${PWD_COMMAND}`; export r; \
1391 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1392 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
148907ea
PB
1393[+ ENDIF bootstrap-target +]
1394
45f366ab 1395# Rules to wipe a stage and all the following ones, also used for cleanstrap
ad6717df 1396[+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
45f366ab 1397.PHONY: distclean-stage[+id+]
ad6717df 1398distclean-stage[+id+]::
f41d6665 1399 @: $(MAKE); $(stage)
ce521a9c 1400 rm -rf stage[+id+]-* [+
148907ea 1401 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
148907ea
PB
1402
1403[+ IF cleanstrap-target +]
1404.PHONY: [+cleanstrap-target+]
45f366ab 1405[+cleanstrap-target+]: distclean [+bootstrap-target+]
148907ea 1406[+ ENDIF cleanstrap-target +]
7c27e184 1407@endif gcc-bootstrap
148907ea
PB
1408
1409[+ ENDFOR bootstrap-stage +]
ad6717df 1410
c7870f5d
PB
1411stageprofile-end::
1412 $(MAKE) distclean-stagefeedback
ad6717df 1413
c7870f5d 1414stagefeedback-start::
ad6717df
PB
1415 @r=`${PWD_COMMAND}`; export r; \
1416 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
c7870f5d
PB
1417 for i in prev-*; do \
1418 j=`echo $$i | sed s/^prev-//` ; \
1419 cd $$r/$$i && \
1420 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1421 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1422 done
03a91701 1423
45f366ab 1424@if gcc-bootstrap
45f366ab 1425do-distclean: distclean-stage1
cc11cc9b
PB
1426
1427# Provide a GCC build when we're building target libraries. This does
1428# not work as a dependency, just as the minimum necessary to avoid errors.
1429stage_last:
1430 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
45f366ab
PB
1431@endif gcc-bootstrap
1432
cc11cc9b
PB
1433.PHONY: restrap
1434restrap:
1435 @: $(MAKE); $(stage)
1436 rm -rf stage1-$(TARGET_SUBDIR) [+ FOR bootstrap-stage +][+ IF prev
1437 +]stage[+id+] [+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
1438 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
1439
4977bab6
ZW
1440# --------------------------------------
1441# Dependencies between different modules
1442# --------------------------------------
1443
3589b69e 1444# Generic dependencies for target modules on host stuff, especially gcc
cc11cc9b
PB
1445@if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1446 +][+ FOR bootstrap_stage +]
1447configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1448 ENDFOR +][+ ELSE bootstrap +]
1449configure-target-[+module+]: stage_last[+
1450 ENDIF bootstrap +][+ ENDFOR target_modules +]
1451@endif gcc-bootstrap
1452
1453@if gcc-no-bootstrap[+ FOR target_modules +][+ IF bootstrap
1454 +][+ ELSE +]
1455configure-target-[+module+]: maybe-all-gcc[+
1456 ENDIF bootstrap +][+ ENDFOR target_modules +]
1457@endif gcc-no-bootstrap
1458
3589b69e
PB
1459
1460[+ FOR lang_env_dependencies +]
1461configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss
1462[+ IF cxx +]configure-target-[+module+]: maybe-all-target-libstdc++-v3
1463[+ ENDIF cxx +][+ ENDFOR lang_env_dependencies +]
1464
4977bab6
ZW
1465# There are two types of dependencies here: 'hard' dependencies, where one
1466# module simply won't build without the other; and 'soft' dependencies, where
1467# if the depended-on module is missing, the depending module will do without
1468# or find a substitute somewhere (perhaps installed). Soft dependencies
3589b69e 1469# are made here to depend on a 'maybe-' target. If you're not sure,
4977bab6
ZW
1470# it's safer to use a soft dependency.
1471
3589b69e
PB
1472[+ ;; These Scheme functions build the bulk of the dependencies.
1473 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1474 ;; where "maybe-" is only included if HARD is true, and all-gcc
1475 ;; is taken from VAR-NAME.
1476 (define dep-target (lambda (module-kind var-name hard)
1477 (string-append
1478 (if hard "" "maybe-")
1479 (dep-subtarget var-name)
1480 module-kind
1481 (dep-module var-name)
1482 )))
1483
1484 ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
7c27e184 1485 (define make-dep (lambda (module-kind on-kind)
3589b69e
PB
1486 (string-append
1487 (dep-target module-kind "module" #t) ": "
7c27e184 1488 (dep-target on-kind "on" (exist? "hard")))))
3589b69e
PB
1489
1490 ;; dep-subtarget extracts everything up to the first dash in the given
1491 ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1492 (define dep-subtarget (lambda (var-name)
1493 (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1494
1495 ;; dep-module extracts everything up to the first dash in the given
1496 ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1497 (define dep-module (lambda (var-name)
1498 (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1499
1500 ;; dep-stage builds a string for the prefix of a bootstrap stage.
1501 (define dep-stage (lambda ()
1502 (string-append
1503 "stage"
1504 (get "id")
1505 "-")))
1506
1507 ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1508 ;; but is written in Scheme.
1509 (define dep-maybe (lambda ()
1510 (if (exist? "hard") "" "maybe-")))
1511
893f1e87
MK
1512 ;; dep-kind returns "normal" if the dependency is on an "install" target,
1513 ;; or if either module is not bootstrapped. It returns "bootstrap" for
3589b69e
PB
1514 ;; configure or build dependencies between bootstrapped modules; it returns
1515 ;; "prebootstrap" for configure or build dependencies of bootstrapped
7c27e184 1516 ;; modules on a build module (e.g. all-gcc on all-build-bison). All this
3589b69e
PB
1517 ;; is only necessary for host modules.
1518 (define dep-kind (lambda ()
7c27e184
PB
1519 (if (and (hash-ref boot-modules (dep-module "module"))
1520 (=* (dep-module "on") "build-"))
1521 "prebootstrap"
3589b69e 1522
7c27e184 1523 (if (or (= (dep-subtarget "on") "install-")
893f1e87
MK
1524 (not (hash-ref boot-modules (dep-module "module")))
1525 (not (hash-ref boot-modules (dep-module "on"))))
7c27e184
PB
1526 "normal"
1527 "bootstrap"))))
3589b69e
PB
1528
1529 ;; We now build the hash table that is used by dep-kind.
1530 (define boot-modules (make-hash-table 113))
3589b69e
PB
1531+]
1532
1533[+ FOR host_modules +][+
1534 (if (exist? "bootstrap")
1535 (hash-create-handle! boot-modules (get "module") #t))
1536 "" +][+ ENDFOR host_modules +]
2dfbef6d
PB
1537[+ FOR target_modules +][+
1538 (if (exist? "bootstrap")
1539 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1540 "" +][+ ENDFOR target_modules +]
3589b69e
PB
1541
1542# With all the machinery above in place, it is pretty easy to generate
1543# dependencies. Host dependencies are a bit more complex because we have
1544# to check for bootstrap/prebootstrap dependencies. To resolve
1545# prebootstrap dependencies, prebootstrap modules are gathered in
1546# a hash table.
7c27e184
PB
1547[+ FOR dependencies +][+ (make-dep "" "") +]
1548[+ CASE (dep-kind) +]
1549[+ == "prebootstrap"
3589b69e 1550 +][+ FOR bootstrap_stage +]
7c27e184
PB
1551[+ (make-dep (dep-stage) "") +][+
1552 ENDFOR bootstrap_stage +]
1553all-prebootstrap: [+ (dep-target "" "on" (exist? "hard")) +]
1554[+ == "bootstrap"
1555 +][+ FOR bootstrap_stage +]
1556[+ (make-dep (dep-stage) (dep-stage)) +][+
3589b69e
PB
1557 ENDFOR bootstrap_stage +]
1558[+ ESAC +][+
1559ENDFOR dependencies +]
1560
7c27e184
PB
1561# Non-toplevel bootstrap rules must depend on several packages, to be built
1562# before gcc. Another wart that will go away, hopefully soon.
3589b69e
PB
1563@if gcc-no-bootstrap
1564[+ FOR host_modules +][+
1565 IF (and (not (= (get "module") "gcc"))
1566 (hash-ref boot-modules (get "module"))) +]
1567all-prebootstrap: maybe-all-[+module+][+
1568 ENDIF +][+
1569ENDFOR host_modules +]
1570@endif gcc-no-bootstrap
1571
ef9db8d5 1572CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
0dffceed 1573GDB_TK = @GDB_TK@
ef9db8d5
DJ
1574INSTALL_GDB_TK = @INSTALL_GDB_TK@
1575configure-gdb: $(CONFIGURE_GDB_TK)
3589b69e 1576all-gdb: $(gdbnlmrequirements) $(GDB_TK)
ef9db8d5 1577install-gdb: $(INSTALL_GDB_TK)
95ddd785 1578
4977bab6
ZW
1579# Serialization dependencies. Host configures don't work well in parallel to
1580# each other, due to contention over config.cache. Target configures and
1581# build configures are similar.
1582@serialization_dependencies@
95ddd785 1583
4977bab6
ZW
1584# --------------------------------
1585# Regenerating top level configury
1586# --------------------------------
95ddd785
NN
1587
1588# Rebuilding Makefile.in, using autogen.
e245b0ea 1589AUTOGEN = autogen
ee03dc5e 1590$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
e245b0ea 1591 cd $(srcdir) && $(AUTOGEN) Makefile.def
95ddd785 1592
671aa708 1593# Rebuilding Makefile.
e245b0ea
AO
1594Makefile: $(srcdir)/Makefile.in config.status
1595 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1596
191dd2c9 1597config.status: configure
e75f9147 1598 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
95ddd785 1599
671aa708 1600# Rebuilding configure.
e245b0ea 1601AUTOCONF = autoconf
ee03dc5e 1602$(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4
e245b0ea 1603 cd $(srcdir) && $(AUTOCONF)
95ddd785 1604
93c834b7
NN
1605# ------------------------------
1606# Special directives to GNU Make
1607# ------------------------------
1608
93c834b7
NN
1609# Don't pass command-line variables to submakes.
1610.NOEXPORT:
1611MAKEOVERRIDES=
1612
95ddd785 1613# end of Makefile.in
This page took 0.532278 seconds and 5 git commands to generate.