]> gcc.gnu.org Git - gcc.git/blame - Makefile.tpl
re PR fortran/30236 ([4.1 only]alternate-return subroutine in generic interface cause...
[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@
58e24147
AM
76MAINT = @MAINT@
77MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
78MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
95ddd785 79
df0f0674
NN
80# -------------------------------------------------
81# Miscellaneous non-standard autoconf-set variables
82# -------------------------------------------------
95ddd785 83
df0f0674
NN
84# The gcc driver likes to know the arguments it was configured with.
85TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
95ddd785 86
df0f0674
NN
87tooldir = @tooldir@
88build_tooldir = @build_tooldir@
95ddd785 89
df0f0674 90GDB_NLM_DEPS =
95ddd785 91
df0f0674
NN
92# This is the name of the environment variable used for the path to
93# the libraries.
94RPATH_ENVVAR = @RPATH_ENVVAR@
95ddd785 95
df0f0674
NN
96# Build programs are put under this directory.
97BUILD_SUBDIR = @build_subdir@
98# This is set by the configure script to the arguments to use when configuring
99# directories built for the build system.
25b42232 100BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
23f6b2f9
PB
101
102# This is the list of variables to export in the environment when
103# configuring any subdirectory. It must also be exported whenever
104# recursing into a build directory in case that directory's Makefile
105# re-runs configure.
106BASE_EXPORTS = \
107 FLEX="$(FLEX)"; export FLEX; \
108 LEX="$(LEX)"; export LEX; \
109 BISON="$(BISON)"; export BISON; \
110 YACC="$(YACC)"; export YACC; \
111 M4="$(M4)"; export M4; \
112 MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
113
4fc4dd12 114# This is the list of variables to export in the environment when
23f6b2f9 115# configuring subdirectories for the build system.
4fc4dd12 116BUILD_EXPORTS = \
23f6b2f9 117 $(BASE_EXPORTS) \
4fc4dd12
DJ
118 AR="$(AR_FOR_BUILD)"; export AR; \
119 AS="$(AS_FOR_BUILD)"; export AS; \
120 CC="$(CC_FOR_BUILD)"; export CC; \
121 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
122 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
123 CXX="$(CXX_FOR_BUILD)"; export CXX; \
124 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
125 GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
126 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
127 DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
128 LD="$(LD_FOR_BUILD)"; export LD; \
129 LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
130 NM="$(NM_FOR_BUILD)"; export NM; \
131 RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
132 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES;
df0f0674
NN
133
134# This is the list of directories to built for the host system.
135SUBDIRS = @configdirs@
136# This is set by the configure script to the arguments to use when configuring
137# directories built for the host system.
138HOST_CONFIGARGS = @host_configargs@
215c351a
PB
139# Host programs are put under this directory, which is . except if building
140# with srcdir=..
141HOST_SUBDIR = @host_subdir@
4fc4dd12 142# This is the list of variables to export in the environment when
2abefe3d
PB
143# configuring subdirectories for the host system. We need to pass
144# some to the GCC configure because of its hybrid host/target nature.
4fc4dd12 145HOST_EXPORTS = \
23f6b2f9 146 $(BASE_EXPORTS) \
4fc4dd12
DJ
147 CC="$(CC)"; export CC; \
148 CFLAGS="$(CFLAGS)"; export CFLAGS; \
149 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
150 CXX="$(CXX)"; export CXX; \
151 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
152 AR="$(AR)"; export AR; \
153 AS="$(AS)"; export AS; \
154 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
155 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
156 LD="$(LD)"; export LD; \
157 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
158 NM="$(NM)"; export NM; \
159 RANLIB="$(RANLIB)"; export RANLIB; \
160 WINDRES="$(WINDRES)"; export WINDRES; \
161 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
1c020272 162 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
2abefe3d
PB
163 AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
164 AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
165 GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
166 LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
167 NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
168 OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
169 RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
4fc4dd12
DJ
170 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
171 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
4c4a5bbc 172 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
1061f99e
PB
173@if gcc-bootstrap
174 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
175@endif gcc-bootstrap
0bff65e7 176 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
4fc4dd12
DJ
177
178# Similar, for later GCC stages.
ce406537 179POSTSTAGE1_HOST_EXPORTS = \
a52a0a7f 180 $(HOST_EXPORTS) \
215c351a
PB
181 CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
182 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
183 CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \
184 $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
185 -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
ec6c7392
PB
186 -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
187 CFLAGS="$(BOOT_CFLAGS)"; export CFLAGS; \
188 LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
df0f0674 189
df0f0674
NN
190# Target libraries are put under this directory:
191TARGET_SUBDIR = @target_subdir@
192# This is set by the configure script to the arguments to use when configuring
193# directories built for the target.
25b42232 194TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
4fc4dd12 195# This is the list of variables to export in the environment when
23f6b2f9 196# configuring subdirectories for the host system.
4fc4dd12 197BASE_TARGET_EXPORTS = \
23f6b2f9 198 $(BASE_EXPORTS) \
4fc4dd12 199 AR="$(AR_FOR_TARGET)"; export AR; \
2abefe3d 200 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
4fc4dd12
DJ
201 CC="$(CC_FOR_TARGET)"; export CC; \
202 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
203 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
e7daab31 204 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
4fc4dd12
DJ
205 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
206 GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
207 GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
208 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
2abefe3d 209 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
4fc4dd12 210 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
040b1c5a 211 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
2abefe3d 212 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
d739199a 213 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
4fc4dd12 214 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
040b1c5a 215 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
4c4a5bbc 216 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
0bff65e7 217 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
4fc4dd12
DJ
218
219RAW_CXX_TARGET_EXPORTS = \
220 $(BASE_TARGET_EXPORTS) \
221 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
222 CXX="$(RAW_CXX_FOR_TARGET)"; export CXX;
223
224NORMAL_TARGET_EXPORTS = \
225 $(BASE_TARGET_EXPORTS) \
226 CXX="$(CXX_FOR_TARGET)"; export CXX;
df0f0674 227
6de9cd9a
DN
228# Where to find GMP
229HOST_GMPLIBS = @gmplibs@
230HOST_GMPINC = @gmpinc@
231
df0f0674
NN
232# ----------------------------------------------
233# Programs producing files for the BUILD machine
234# ----------------------------------------------
235
236SHELL = @config_shell@
237
238# pwd command to use. Allow user to override default by setting PWDCMD in
239# the environment to account for automounters. The make variable must not
240# be called PWDCMD, otherwise the value set here is passed to make
241# subprocesses and overrides the setting from the user's environment.
8c90b13a
L
242# Don't use PWD since it is a common shell environment variable and we
243# don't want to corrupt it.
244PWD_COMMAND = $${PWDCMD-pwd}
df0f0674
NN
245
246# compilers to use to create programs which must be run in the build
247# environment.
248CC_FOR_BUILD = @CC_FOR_BUILD@
6691a79e 249CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
df0f0674
NN
250
251CXX_FOR_BUILD = $(CXX)
252
253# Special variables passed down in EXTRA_GCC_FLAGS. They are defined
254# here so that they can be overridden by Makefile fragments.
df0f0674
NN
255BUILD_PREFIX = @BUILD_PREFIX@
256BUILD_PREFIX_1 = @BUILD_PREFIX_1@
95ddd785 257
45f366ab
PB
258# Flags to pass to stage2 and later makes. They are defined
259# here so that they can be overridden by Makefile fragments.
260BOOT_CFLAGS= -g -O2
d19bca38 261BOOT_LDFLAGS=
45f366ab 262
2abefe3d
PB
263BISON = @BISON@
264YACC = @YACC@
265FLEX = @FLEX@
266LEX = @LEX@
267M4 = @M4@
268MAKEINFO = @MAKEINFO@
269EXPECT = @EXPECT@
270RUNTEST = @RUNTEST@
95ddd785
NN
271
272# This just becomes part of the MAKEINFO definition passed down to
273# sub-makes. It lets flags be given on the command line while still
274# using the makeinfo from the object tree.
2f50999f
GP
275# (Default to avoid splitting info files by setting the threshold high.)
276MAKEINFOFLAGS = --split-size=5000000
95ddd785 277
df0f0674
NN
278# ---------------------------------------------
279# Programs producing files for the HOST machine
280# ---------------------------------------------
95ddd785 281
df0f0674 282AS = @AS@
df0f0674
NN
283AR = @AR@
284AR_FLAGS = rc
df0f0674 285CC = @CC@
df0f0674 286CXX = @CXX@
df0f0674 287DLLTOOL = @DLLTOOL@
df0f0674 288LD = @LD@
2abefe3d
PB
289LIPO = @LIPO@
290NM = @NM@
2d309510 291OBJDUMP = @OBJDUMP@
df0f0674 292RANLIB = @RANLIB@
2abefe3d 293STRIP = @STRIP@
df0f0674 294WINDRES = @WINDRES@
95ddd785 295
2abefe3d
PB
296CFLAGS = @CFLAGS@
297LDFLAGS =
298LIBCFLAGS = $(CFLAGS)
299CXXFLAGS = @CXXFLAGS@
300LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
df0f0674
NN
301PICFLAG =
302
8efea775
PB
303# Only build the C compiler for stage1, because that is the only one that
304# we can guarantee will build with the native compiler, and also it is the
305# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
306# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
307# overrideable (for a bootstrap build stage1 also builds gcc.info).
308
309STAGE1_CFLAGS=@stage1_cflags@
310STAGE1_CHECKING=@stage1_checking@
311STAGE1_LANGUAGES=@stage1_languages@
312
df0f0674
NN
313# -----------------------------------------------
314# Programs producing files for the TARGET machine
315# -----------------------------------------------
95ddd785 316
ec0461f6 317FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
95ddd785 318
df0f0674 319AR_FOR_TARGET=@AR_FOR_TARGET@
4977bab6 320AS_FOR_TARGET=@AS_FOR_TARGET@
4de997d1 321CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 322
df0f0674
NN
323# If GCC_FOR_TARGET is not overriden on the command line, then this
324# variable is passed down to the gcc Makefile, where it is used to
325# build libgcc2.a. We define it here so that it can itself be
326# overridden on the command line.
2abefe3d 327GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 328CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 329RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 330GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4de997d1 331GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
4977bab6 332DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
df0f0674 333LD_FOR_TARGET=@LD_FOR_TARGET@
df0f0674 334
040b1c5a 335LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
df0f0674 336NM_FOR_TARGET=@NM_FOR_TARGET@
d739199a 337OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
4977bab6 338RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
040b1c5a 339STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
df0f0674 340WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
95ddd785 341
2abefe3d
PB
342COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
343COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
344COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
345
346# During gcc bootstrap, if we use some random cc for stage1 then
347# CFLAGS will be just -g. We want to ensure that TARGET libraries
348# (which we know are built with gcc) are built with optimizations so
349# prepend -O2 when setting CFLAGS_FOR_TARGET.
350CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
351SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
352CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
353LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
354LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
355LDFLAGS_FOR_TARGET =
df0f0674
NN
356PICFLAG_FOR_TARGET =
357
358# ------------------------------------
359# Miscellaneous targets and flag lists
360# ------------------------------------
361
95ddd785
NN
362# The first rule in the file had better be this one. Don't put any above it.
363# This lives here to allow makefile fragments to contain dependencies.
1061f99e 364all:
95ddd785 365
95ddd785 366#### host and target specific makefile fragments come in here.
671aa708
NN
367@target_makefile_frag@
368@alphaieee_frag@
369@ospace_frag@
370@host_makefile_frag@
95ddd785
NN
371###
372
0bff65e7
PB
373# This is the list of directories that may be needed in RPATH_ENVVAR
374# so that prorgams built for the target machine work.
375TARGET_LIB_PATH = [+ FOR target_modules +][+
376 IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
377 ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
378[+ FOR target_modules +][+ IF lib_path +]
379@if target-[+module+]
380TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
381@endif target-[+module+]
382[+ ENDIF lib_path +][+ ENDFOR target_modules +]
383
384
385# This is the list of directories that may be needed in RPATH_ENVVAR
386# so that programs built for the host machine work.
387HOST_LIB_PATH = [+ FOR host_modules +][+
388 IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
389 ENDFOR host_modules +]
390
391# Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
392@if gcc
393HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
394@endif gcc
395
396[+ FOR host_modules +][+ IF lib_path +]
397@if [+module+]
398HOST_LIB_PATH_[+module+] = \
399 $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
400 +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
401@endif [+module+]
402[+ ENDIF lib_path +][+ ENDFOR host_modules +]
403
95ddd785 404# Flags to pass down to all sub-makes.
cc11cc9b
PB
405BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
406 "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
407 "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +] \
e75f9147 408 "CONFIG_SHELL=$(SHELL)" \
11405c93 409 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"
95ddd785 410
4de997d1
PB
411# We leave this in just in case, but it is not needed anymore.
412RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
ad6717df 413
95ddd785
NN
414# Flags to pass down to most sub-makes, in which we're building with
415# the host environment.
95ddd785
NN
416EXTRA_HOST_FLAGS = \
417 'AR=$(AR)' \
418 'AS=$(AS)' \
419 'CC=$(CC)' \
420 'CXX=$(CXX)' \
421 'DLLTOOL=$(DLLTOOL)' \
422 'LD=$(LD)' \
2abefe3d 423 'LIPO=$(LIPO)' \
95ddd785 424 'NM=$(NM)' \
2d309510 425 'OBJDUMP=$(OBJDUMP)' \
c858bf1e 426 'RANLIB=$(RANLIB)' \
2abefe3d 427 'STRIP=$(STRIP)' \
95ddd785
NN
428 'WINDRES=$(WINDRES)'
429
430FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
431
432# Flags that are concerned with the location of the X11 include files
433# and library files
434#
435# NOTE: until the top-level is getting the values via autoconf, it only
436# causes problems to have this top-level Makefile overriding the autoconf-set
437# values in child directories. Only variables that don't conflict with
438# autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
439#
440X11_FLAGS_TO_PASS = \
441 'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
442 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
443
8efea775
PB
444# Flags to pass to stage2 and later makes.
445
446POSTSTAGE1_FLAGS_TO_PASS = \
447 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
448 STAGE_PREFIX="$$r/$(HOST_SUBDIR)/prev-gcc/" \
449 CFLAGS="$(BOOT_CFLAGS)" \
450 LIBCFLAGS="$(BOOT_CFLAGS)" \
451 LDFLAGS="$(BOOT_LDFLAGS)" \
452 "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
453
95ddd785 454# Flags to pass down to makes which are built with the target environment.
f41d6665
DJ
455# The double $ decreases the length of the command line; those variables
456# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The
457# COMPILER_ prefixed variables are not passed down so we expand them here.
95ddd785
NN
458EXTRA_TARGET_FLAGS = \
459 'AR=$$(AR_FOR_TARGET)' \
f41d6665 460 'AS=$(COMPILER_AS_FOR_TARGET)' \
95ddd785
NN
461 'CC=$$(CC_FOR_TARGET)' \
462 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
463 'CXX=$$(CXX_FOR_TARGET)' \
464 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
465 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
f41d6665 466 'LD=$(COMPILER_LD_FOR_TARGET)' \
e3791243 467 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
95ddd785
NN
468 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
469 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
f41d6665 470 'NM=$(COMPILER_NM_FOR_TARGET)' \
d739199a 471 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
95ddd785
NN
472 'RANLIB=$$(RANLIB_FOR_TARGET)' \
473 'WINDRES=$$(WINDRES_FOR_TARGET)'
474
475TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
476
477# Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
478# unfortunately needs the native compiler and the target ar and
479# ranlib.
480# If any variables are added here, they must be added to do-*, below.
1358ccea 481# The BUILD_* variables are a special case, which are used for the gcc
95ddd785
NN
482# cross-building scheme.
483EXTRA_GCC_FLAGS = \
95ddd785 484 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
d4cd9d81
NN
485 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
486 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
487 "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
488 "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
cc11cc9b 489 "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
95ddd785 490
d29b8ad8 491GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
95ddd785 492
8b87bb96 493.PHONY: configure-host
d32ab992 494configure-host: [+
8b87bb96
NN
495 FOR host_modules +] \
496 maybe-configure-[+module+][+
497 ENDFOR host_modules +]
498.PHONY: configure-target
499configure-target: [+
500 FOR target_modules +] \
501 maybe-configure-target-[+module+][+
502 ENDFOR target_modules +]
95ddd785 503
f516a7da
PB
504# The target built for a native non-bootstrap build.
505.PHONY: all
1061f99e
PB
506all:
507@if gcc-bootstrap
2abefe3d 508 [ -f stage_final ] || echo stage3 > stage_final
1061f99e
PB
509 @r=`${PWD_COMMAND}`; export r; \
510 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
f41d6665 511 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
1061f99e 512@endif gcc-bootstrap
f41d6665 513 @: $(MAKE); $(unstage)
1061f99e
PB
514 @r=`${PWD_COMMAND}`; export r; \
515 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
516 if [ -f stage_last ]; then \
2abefe3d 517 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
1061f99e 518 else \
2abefe3d 519 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
1061f99e 520 fi
8b87bb96 521
23f6b2f9 522.PHONY: all-build
cc11cc9b
PB
523[+ FOR build_modules +]
524all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
525
8b87bb96 526.PHONY: all-host
cc11cc9b
PB
527[+ FOR host_modules +][+ IF bootstrap +]
528@if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
529all-host: maybe-all-[+module+][+ IF bootstrap +]
530@endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
531
8b87bb96 532.PHONY: all-target
cc11cc9b
PB
533[+ FOR target_modules +][+ IF bootstrap +]
534@if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
535all-target: maybe-all-target-[+module+][+ IF bootstrap +]
536@endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR target_modules +]
95ddd785
NN
537
538# Do a target for all the subdirectories. A ``make do-X'' will do a
539# ``make X'' in all subdirectories (because, in general, there is a
540# dependency (below) of X upon do-X, a ``make X'' will also do this,
541# but it may do additional work as well).
4977bab6 542[+ FOR recursive_targets +]
1a1e6b96 543.PHONY: do-[+make_target+]
1061f99e 544do-[+make_target+]:
f41d6665 545 @: $(MAKE); $(unstage)
e7c84bf8
PB
546 @r=`${PWD_COMMAND}`; export r; \
547 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
548 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
1061f99e 549 [+make_target+]-target
1061f99e 550
1358ccea
NN
551
552.PHONY: [+make_target+]-host
cc11cc9b
PB
553[+ FOR host_modules +]
554[+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
1358ccea
NN
555
556.PHONY: [+make_target+]-target
cc11cc9b
PB
557[+ FOR target_modules +]
558[+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
4977bab6
ZW
559[+ ENDFOR recursive_targets +]
560
95ddd785
NN
561# Here are the targets which correspond to the do-X targets.
562
b5422ad7 563.PHONY: info installcheck dvi pdf html install-info install-html
95ddd785
NN
564.PHONY: clean distclean mostlyclean maintainer-clean realclean
565.PHONY: local-clean local-distclean local-maintainer-clean
566info: do-info
567installcheck: do-installcheck
568dvi: do-dvi
b5422ad7 569pdf: do-pdf
f87a2b2e 570html: do-html
95ddd785 571
212f6dd0
NN
572# Make sure makeinfo is built before we do a `make info', if we're
573# in fact building texinfo.
574do-info: maybe-all-texinfo
95ddd785
NN
575
576install-info: do-install-info dir.info
8c90b13a 577 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
95ddd785 578 if [ -f dir.info ] ; then \
3fbe8e4a 579 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
95ddd785
NN
580 else true ; fi
581
65d6e994
CD
582install-html: do-install-html
583
95ddd785
NN
584local-clean:
585 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
586
587local-distclean:
588 -rm -f Makefile config.status config.cache mh-frag mt-frag
f41d6665 589 -rm -f maybedep.tmp serdep.tmp
95ddd785
NN
590 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
591 rm -rf $(TARGET_SUBDIR); \
592 else true; fi
0c227849 593 -rm -rf $(BUILD_SUBDIR)
215c351a
PB
594 -if [ "$(HOST_SUBDIR)" != "." ]; then \
595 rm -rf $(HOST_SUBDIR); \
596 else true; fi
95ddd785
NN
597 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
598 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
599 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
600 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
601 -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
602
603local-maintainer-clean:
604 @echo "This command is intended for maintainers to use;"
605 @echo "it deletes files that may require special tools to rebuild."
606
607clean: do-clean local-clean
608mostlyclean: do-mostlyclean local-clean
609distclean: do-distclean local-clean local-distclean
610maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
611maintainer-clean: local-distclean
612realclean: maintainer-clean
613
2f3bdde7 614# Extra dependency for clean-target, owing to the mixed nature of gcc.
1358ccea 615clean-target: clean-target-libgcc
95ddd785 616clean-target-libgcc:
9bd6112c 617 if test -f gcc/Makefile; then cd gcc && $(MAKE) $@; else :; fi
95ddd785
NN
618
619# Check target.
620
621.PHONY: check do-check
333a28b4 622check: do-check
95ddd785 623
4977bab6 624# Only include modules actually being configured and built.
1061f99e
PB
625.PHONY: check-host
626check-host: [+
7e2dbcef
NN
627 FOR host_modules +] \
628 maybe-check-[+module+][+
1061f99e
PB
629 ENDFOR host_modules +]
630
631.PHONY: check-target
632check-target: [+
7e2dbcef
NN
633 FOR target_modules +] \
634 maybe-check-target-[+module+][+
1061f99e
PB
635 ENDFOR target_modules +]
636
637do-check:
f41d6665 638 @: $(MAKE); $(unstage)
e7c84bf8
PB
639 @r=`${PWD_COMMAND}`; export r; \
640 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
641 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
95ddd785
NN
642
643# Automated reporting of test results.
644
645warning.log: build.log
646 $(srcdir)/contrib/warn_summary build.log > $@
647
648mail-report.log:
649 if test x'$(BOOT_CFLAGS)' != x''; then \
650 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
651 fi; \
652 $(srcdir)/contrib/test_summary -t >$@
653 chmod +x $@
654 echo If you really want to send e-mail, run ./$@ now
655
656mail-report-with-warnings.log: warning.log
657 if test x'$(BOOT_CFLAGS)' != x''; then \
658 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
659 fi; \
660 $(srcdir)/contrib/test_summary -t -i warning.log >$@
661 chmod +x $@
662 echo If you really want to send e-mail, run ./$@ now
663
664# Installation targets.
665
4977bab6 666.PHONY: install uninstall
1061f99e 667install:
f41d6665 668 @: $(MAKE); $(unstage)
e7c84bf8
PB
669 @r=`${PWD_COMMAND}`; export r; \
670 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
671 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
8b87bb96 672
7e2dbcef
NN
673.PHONY: install-host-nogcc
674install-host-nogcc: [+
3589b69e
PB
675 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
676 maybe-install-[+module+][+ ENDIF +][+
7e2dbcef
NN
677 ENDFOR host_modules +]
678
8b87bb96 679.PHONY: install-host
d32ab992 680install-host: [+
8b87bb96
NN
681 FOR host_modules +] \
682 maybe-install-[+module+][+
683 ENDFOR host_modules +]
7e2dbcef 684
8b87bb96
NN
685.PHONY: install-target
686install-target: [+
687 FOR target_modules +] \
688 maybe-install-target-[+module+][+
689 ENDFOR target_modules +]
95ddd785
NN
690
691uninstall:
692 @echo "the uninstall target is not supported in this tree"
693
95ddd785
NN
694.PHONY: install.all
695install.all: install-no-fixedincludes
696 @if [ -f ./gcc/Makefile ] ; then \
8c90b13a 697 r=`${PWD_COMMAND}` ; export r ; \
f41d6665 698 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 699 $(HOST_EXPORTS) \
88b5521b 700 (cd ./gcc && \
95ddd785
NN
701 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
702 else \
703 true ; \
704 fi
705
706# install-no-fixedincludes is used because Cygnus can not distribute
707# the fixed header files.
708.PHONY: install-no-fixedincludes
7e2dbcef 709install-no-fixedincludes: installdirs install-host-nogcc \
8b87bb96 710 install-target gcc-no-fixedincludes
95ddd785 711
4977bab6 712### other supporting targets
95ddd785 713
4977bab6
ZW
714MAKEDIRS= \
715 $(DESTDIR)$(prefix) \
716 $(DESTDIR)$(exec_prefix)
717.PHONY: installdirs
718installdirs: mkinstalldirs
719 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
720
721dir.info: do-install-info
722 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
3fbe8e4a 723 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
4977bab6
ZW
724 mv -f dir.info.new dir.info ; \
725 else true ; \
95ddd785
NN
726 fi
727
4977bab6
ZW
728dist:
729 @echo "Building a full distribution of this tree isn't done"
730 @echo "via 'make dist'. Check out the etc/ subdirectory"
731
732etags tags: TAGS
733
734# Right now this just builds TAGS in each subdirectory. emacs19 has the
735# ability to use several tags files at once, so there is probably no need
736# to combine them into one big TAGS file (like CVS 1.3 does). We could
737# (if we felt like it) have this Makefile write a piece of elisp which
738# the user could load to tell emacs19 where all the TAGS files we just
739# built are.
740TAGS: do-TAGS
741
25b42232
PB
742# ------------------------------------
743# Macros for configure and all targets
744# ------------------------------------
745
746[+ DEFINE configure +]
747.PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
748maybe-configure-[+prefix+][+module+]:
3ff3adad
PB
749@if gcc-bootstrap
750configure-[+prefix+][+module+]: stage_current
751@endif gcc-bootstrap
25b42232
PB
752@if [+prefix+][+module+]
753maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
3ff3adad 754configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
cc11cc9b
PB
755 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
756 @r=`${PWD_COMMAND}`; export r; \
f41d6665 757 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
cc11cc9b
PB
758 [+ IF check_multilibs
759 +]echo "Checking multilib configuration for [+module+]..."; \
f41d6665
DJ
760 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
761 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
762 if test -r [+subdir+]/[+module+]/multilib.out; then \
763 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
764 rm -f [+subdir+]/[+module+]/multilib.tmp; \
765 else \
766 rm -f [+subdir+]/[+module+]/Makefile; \
767 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
768 fi; \
769 else \
770 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
cc11cc9b
PB
771 fi; \
772 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
25b42232 773 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
25b42232
PB
774 [+exports+] \
775 echo Configuring in [+subdir+]/[+module+]; \
776 cd "[+subdir+]/[+module+]" || exit 1; \
3aa83176 777 case $(srcdir) in \
215c351a 778 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
25b42232 779 *) topdir=`echo [+subdir+]/[+module+]/ | \
215c351a 780 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
3aa83176 781 esac; \
215c351a
PB
782 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
783 libsrcdir="$$s/[+module+]"; \
25b42232
PB
784 [+ IF no-config-site +]rm -f no-such-file || : ; \
785 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
786 [+args+] $${srcdiroption} [+extra_configure_flags+] \
3aa83176 787 || exit 1
25b42232 788@endif [+prefix+][+module+]
ce406537
PB
789
790[+ IF bootstrap +]
791[+ FOR bootstrap_stage +]
792.PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
793maybe-configure-stage[+id+]-[+prefix+][+module+]:
f41d6665 794@if [+prefix+][+module+]-bootstrap
ce406537 795maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
f41d6665 796configure-stage[+id+]-[+prefix+][+module+]:
cc11cc9b 797 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
f41d6665 798 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
cc11cc9b 799 @r=`${PWD_COMMAND}`; export r; \
ce406537 800 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
cc11cc9b
PB
801 [+ IF check_multilibs
802 +]echo "Checking multilib configuration for [+module+]..."; \
f41d6665
DJ
803 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
804 if test -r [+subdir+]/[+module+]/multilib.out; then \
805 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
806 rm -f [+subdir+]/[+module+]/multilib.tmp; \
807 else \
808 rm -f [+subdir+]/[+module+]/Makefile; \
809 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
810 fi; \
811 else \
812 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
cc11cc9b
PB
813 fi; \
814 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
ce406537
PB
815 [+exports+][+ IF prev +] \
816 [+poststage1_exports+][+ ENDIF prev +] \
817 echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
f41d6665 818 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
ce406537
PB
819 cd [+subdir+]/[+module+] || exit 1; \
820 case $(srcdir) in \
821 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
822 *) topdir=`echo [+subdir+]/[+module+]/ | \
823 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
824 esac; \
825 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
826 libsrcdir="$$s/[+module+]"; \
827 $(SHELL) $${libsrcdir}/configure \
828 [+args+] $${srcdiroption} \
57255173 829 [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
ce406537 830 [+stage_configure_flags+] [+extra_configure_flags+]
f41d6665 831@endif [+prefix+][+module+]-bootstrap
ce406537
PB
832[+ ENDFOR bootstrap_stage +]
833[+ ENDIF bootstrap +]
25b42232
PB
834[+ ENDDEF +]
835
836[+ DEFINE all +]
837.PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
838maybe-all-[+prefix+][+module+]:
3ff3adad
PB
839@if gcc-bootstrap
840all-[+prefix+][+module+]: stage_current
841@endif gcc-bootstrap
25b42232
PB
842@if [+prefix+][+module+]
843TARGET-[+prefix+][+module+]=[+
844 IF target +][+target+][+ ELSE +]all[+ ENDIF target +]
845maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
3ff3adad 846all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
cc11cc9b
PB
847 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
848 @r=`${PWD_COMMAND}`; export r; \
8c90b13a 849 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
25b42232
PB
850 [+exports+] \
851 (cd [+subdir+]/[+module+] && \
852 $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
853@endif [+prefix+][+module+]
ce406537
PB
854
855[+ IF bootstrap +]
856[+ FOR bootstrap_stage +]
857.PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
858.PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
859maybe-all-stage[+id+]-[+prefix+][+module+]:
860maybe-clean-stage[+id+]-[+prefix+][+module+]:
f41d6665 861@if [+prefix+][+module+]-bootstrap
ce406537
PB
862maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
863all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
1061f99e 864TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
ce406537 865all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
cc11cc9b 866 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
ce406537
PB
867 @r=`${PWD_COMMAND}`; export r; \
868 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
869 [+exports+][+ IF prev +] \
870 [+poststage1_exports+][+ ENDIF prev +] \
871 cd [+subdir+]/[+module+] && \
872 $(MAKE) [+args+] [+ IF prev
873 +][+poststage1_args+][+ ENDIF prev
1061f99e
PB
874 +] [+stage_make_flags+] [+extra_make_flags+] \
875 $(TARGET-stage[+id+]-[+prefix+][+module+])
ce406537
PB
876
877maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
878clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
879clean-stage[+id+]-[+prefix+][+module+]:
995a5697
PB
880 @if [ $(current_stage) = stage[+id+] ]; then \
881 [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
882 else \
883 [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
884 $(MAKE) stage[+id+]-start; \
885 fi; \
ce406537
PB
886 cd [+subdir+]/[+module+] && \
887 $(MAKE) [+args+] [+ IF prev +] \
888 [+poststage1_args+] [+ ENDIF prev +] \
889 [+stage_make_flags+] [+extra_make_flags+] clean
f41d6665 890@endif [+prefix+][+module+]-bootstrap
ce406537
PB
891
892[+ ENDFOR bootstrap_stage +]
893[+ ENDIF bootstrap +]
25b42232
PB
894[+ ENDDEF +]
895
896# --------------------------------------
897# Modules which run on the build machine
898# --------------------------------------
899[+ FOR build_modules +]
900[+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
901 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
902
903[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
904[+ ENDFOR build_module +]
4977bab6
ZW
905
906# --------------------------------------
907# Modules which run on the host machine
908# --------------------------------------
909[+ FOR host_modules +]
ce406537
PB
910[+ configure prefix="" subdir="$(HOST_SUBDIR)"
911 exports="$(HOST_EXPORTS)"
912 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
25b42232 913 args="$(HOST_CONFIGARGS)" +]
95ddd785 914
ce406537
PB
915[+ all prefix="" subdir="$(HOST_SUBDIR)"
916 exports="$(HOST_EXPORTS)"
917 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
918 args="$(FLAGS_TO_PASS)"
919 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
4977bab6 920
7e2dbcef
NN
921.PHONY: check-[+module+] maybe-check-[+module+]
922maybe-check-[+module+]:
60975492
PB
923@if [+module+]
924maybe-check-[+module+]: check-[+module+]
4977bab6 925[+ IF no_check +]
4977bab6
ZW
926check-[+module+]:
927[+ ELIF no_check_cross +]
4977bab6
ZW
928# This module is only tested in a native toolchain.
929check-[+module+]:
f41d6665 930 @: $(MAKE); $(unstage)
e89fbdfe 931 @if [ '$(host)' = '$(target)' ] ; then \
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+] && \
ef6e9bc0 936 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
3aa83176
NN
937 fi
938[+ ELSE check +]
3aa83176 939check-[+module+]:
f41d6665 940 @: $(MAKE); $(unstage)
8c90b13a
L
941 @r=`${PWD_COMMAND}`; export r; \
942 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 943 $(HOST_EXPORTS) \
215c351a
PB
944 (cd $(HOST_SUBDIR)/[+module+] && \
945 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
4977bab6 946[+ ENDIF no_check +]
60975492 947@endif [+module+]
4977bab6 948
4977bab6
ZW
949.PHONY: install-[+module+] maybe-install-[+module+]
950maybe-install-[+module+]:
60975492
PB
951@if [+module+]
952maybe-install-[+module+]: install-[+module+]
7e2dbcef 953[+ IF no_install +]
4977bab6
ZW
954install-[+module+]:
955[+ ELSE install +]
4977bab6 956install-[+module+]: installdirs
f41d6665 957 @: $(MAKE); $(unstage)
8c90b13a
L
958 @r=`${PWD_COMMAND}`; export r; \
959 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 960 $(HOST_EXPORTS) \
215c351a 961 (cd $(HOST_SUBDIR)/[+module+] && \
ace9ac7b 962 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
4977bab6 963[+ ENDIF no_install +]
60975492 964@endif [+module+]
295f4e42 965
b5422ad7 966# Other targets (info, dvi, pdf, etc.)
295f4e42
NN
967[+ FOR recursive_targets +]
968.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
969maybe-[+make_target+]-[+module+]:
60975492
PB
970@if [+module+]
971maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
295f4e42
NN
972[+ IF (match-value? = "missing" (get "make_target") ) +]
973# [+module+] doesn't support [+make_target+].
974[+make_target+]-[+module+]:
975[+ ELSE +]
976[+make_target+]-[+module+]: [+
977 FOR depend +]\
978 [+depend+]-[+module+] [+
979 ENDFOR depend +]
f41d6665 980 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
1061f99e 981 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
295f4e42
NN
982 r=`${PWD_COMMAND}`; export r; \
983 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fc4dd12 984 $(HOST_EXPORTS) \
d32ab992 985 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
295f4e42
NN
986 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
987 done; \
988 echo "Doing [+make_target+] in [+module+]" ; \
215c351a 989 (cd $(HOST_SUBDIR)/[+module+] && \
295f4e42
NN
990 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
991 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
992 "RANLIB=$${RANLIB}" \
993 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
d32ab992 994 [+make_target+]) \
295f4e42
NN
995 || exit 1
996[+ ENDIF +]
60975492 997@endif [+module+]
295f4e42 998[+ ENDFOR recursive_targets +]
4977bab6
ZW
999[+ ENDFOR host_modules +]
1000
1001# ---------------------------------------
1002# Modules which run on the target machine
1003# ---------------------------------------
1004[+ FOR target_modules +]
4977bab6 1005
25b42232
PB
1006[+ IF raw_cxx +]
1007[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
f41d6665 1008 check_multilibs=true
25b42232
PB
1009 exports="$(RAW_CXX_TARGET_EXPORTS)"
1010 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1011
1012[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1013 exports="$(RAW_CXX_TARGET_EXPORTS)"
1014 args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1015[+ ELSE +]
1016[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
f41d6665 1017 check_multilibs=true
25b42232
PB
1018 exports="$(NORMAL_TARGET_EXPORTS)"
1019 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1020
1021[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1022 exports="$(NORMAL_TARGET_EXPORTS)"
1023 args="$(TARGET_FLAGS_TO_PASS)" +]
1024[+ ENDIF +]
7e2dbcef
NN
1025
1026.PHONY: check-target-[+module+] maybe-check-target-[+module+]
1027maybe-check-target-[+module+]:
60975492
PB
1028@if target-[+module+]
1029maybe-check-target-[+module+]: check-target-[+module+]
4977bab6
ZW
1030[+ IF no_check +]
1031# Dummy target for uncheckable module.
4977bab6
ZW
1032check-target-[+module+]:
1033[+ ELSE check +]
4977bab6 1034check-target-[+module+]:
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
NN
1043 (cd $(TARGET_SUBDIR)/[+module+] && \
1044 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1045 IF raw_cxx
1046 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1047 ENDIF raw_cxx
a52a0a7f 1048 +] [+extra_make_flags+] check)
4977bab6 1049[+ ENDIF no_check +]
60975492 1050@endif target-[+module+]
7e2dbcef 1051
4977bab6
ZW
1052.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1053maybe-install-target-[+module+]:
60975492
PB
1054@if target-[+module+]
1055maybe-install-target-[+module+]: install-target-[+module+]
7e2dbcef 1056[+ IF no_install +]
4977bab6
ZW
1057# Dummy target for uninstallable.
1058install-target-[+module+]:
1059[+ ELSE install +]
4977bab6 1060install-target-[+module+]: installdirs
f41d6665 1061 @: $(MAKE); $(unstage)
8c90b13a 1062 @r=`${PWD_COMMAND}`; export r; \
0bff65e7 1063 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1064IF raw_cxx +]
1065 $(RAW_CXX_TARGET_EXPORTS) \[+
1066ELSE normal_cxx +]
1067 $(NORMAL_TARGET_EXPORTS) \[+
1068ENDIF raw_cxx +]
3aa83176 1069 (cd $(TARGET_SUBDIR)/[+module+] && \
a52a0a7f 1070 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
4977bab6 1071[+ ENDIF no_install +]
60975492 1072@endif target-[+module+]
295f4e42 1073
b5422ad7 1074# Other targets (info, dvi, pdf, etc.)
295f4e42
NN
1075[+ FOR recursive_targets +]
1076.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1077maybe-[+make_target+]-target-[+module+]:
60975492
PB
1078@if target-[+module+]
1079maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
295f4e42
NN
1080[+ IF (match-value? = "missing" (get "make_target") ) +]
1081# [+module+] doesn't support [+make_target+].
1082[+make_target+]-target-[+module+]:
1083[+ ELSE +]
1084[+make_target+]-target-[+module+]: [+
1085 FOR depend +]\
1086 [+depend+]-target-[+module+] [+
1087 ENDFOR depend +]
f41d6665 1088 @: $(MAKE); $(unstage)
295f4e42
NN
1089 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1090 r=`${PWD_COMMAND}`; export r; \
0bff65e7 1091 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
4fc4dd12
DJ
1092IF raw_cxx +]
1093 $(RAW_CXX_TARGET_EXPORTS) \[+
1094ELSE normal_cxx +]
1095 $(NORMAL_TARGET_EXPORTS) \[+
1096ENDIF raw_cxx +]
295f4e42
NN
1097 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1098 for flag in $(EXTRA_TARGET_FLAGS); do \
1099 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1100 done; \
1101 (cd $(TARGET_SUBDIR)/[+module+] && \
1102 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1103 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1104 "RANLIB=$${RANLIB}" \
1105 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
a52a0a7f 1106 [+extra_make_flags+] [+make_target+]) \
295f4e42
NN
1107 || exit 1
1108[+ ENDIF +]
60975492 1109@endif target-[+module+]
295f4e42 1110[+ ENDFOR recursive_targets +]
4977bab6 1111[+ ENDFOR target_modules +]
95ddd785 1112
4977bab6
ZW
1113# ----------
1114# GCC module
1115# ----------
95ddd785 1116
f516a7da 1117@if gcc-no-bootstrap
d32ab992
PB
1118# GCC has some more recursive targets, which trigger the old
1119# (but still current, until the toplevel bootstrap project
1120# is finished) compiler bootstrapping rules.
95ddd785 1121
1ca4c6e1
PE
1122GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
1123.PHONY: $(GCC_STRAP_TARGETS)
3589b69e 1124$(GCC_STRAP_TARGETS): all-prebootstrap configure-gcc
8c90b13a
L
1125 @r=`${PWD_COMMAND}`; export r; \
1126 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1127 $(HOST_EXPORTS) \
95ddd785 1128 echo "Bootstrapping the compiler"; \
0bff65e7 1129 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
95ddd785 1130 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
8c90b13a
L
1131 @r=`${PWD_COMMAND}`; export r; \
1132 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
95ddd785
NN
1133 case "$@" in \
1134 *bootstrap4-lean ) \
3aa83176
NN
1135 msg="Comparing stage3 and stage4 of the compiler"; \
1136 compare=compare3-lean ;; \
1137 *bootstrap4 ) \
1138 msg="Comparing stage3 and stage4 of the compiler"; \
1139 compare=compare3 ;; \
1140 *-lean ) \
1141 msg="Comparing stage2 and stage3 of the compiler"; \
1142 compare=compare-lean ;; \
1143 * ) \
1144 msg="Comparing stage2 and stage3 of the compiler"; \
1145 compare=compare ;; \
95ddd785 1146 esac; \
a52a0a7f 1147 $(HOST_EXPORTS) \
95ddd785
NN
1148 echo "$$msg"; \
1149 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
8c90b13a
L
1150 @r=`${PWD_COMMAND}`; export r; \
1151 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
95ddd785 1152 echo "Building runtime libraries"; \
ad6717df 1153 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
95ddd785 1154
3589b69e 1155profiledbootstrap: all-prebootstrap configure-gcc
8c90b13a
L
1156 @r=`${PWD_COMMAND}`; export r; \
1157 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1158 $(HOST_EXPORTS) \
0bff65e7 1159 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
3922b216 1160 echo "Bootstrapping training compiler"; \
8f231b5d 1161 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build
8c90b13a 1162 @r=`${PWD_COMMAND}`; export r; \
8c90b13a 1163 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1164 $(HOST_EXPORTS) \
8f231b5d
JH
1165 echo "Building feedback based compiler"; \
1166 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build
3922b216
JDA
1167 @r=`${PWD_COMMAND}`; export r; \
1168 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
3922b216
JDA
1169 echo "Building runtime libraries"; \
1170 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
8f231b5d 1171
95ddd785 1172.PHONY: cross
7c27e184 1173cross: all-build all-gas all-ld
8c90b13a
L
1174 @r=`${PWD_COMMAND}`; export r; \
1175 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1176 $(HOST_EXPORTS) \
95ddd785
NN
1177 echo "Building the C and C++ compiler"; \
1178 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
8c90b13a
L
1179 @r=`${PWD_COMMAND}`; export r; \
1180 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
95ddd785 1181 echo "Building runtime libraries"; \
ad6717df 1182 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
f516a7da 1183@endif gcc-no-bootstrap
95ddd785 1184
60975492 1185@if gcc
6248218a
JM
1186.PHONY: check-gcc-c++
1187check-gcc-c++:
95ddd785 1188 @if [ -f ./gcc/Makefile ] ; then \
8c90b13a
L
1189 r=`${PWD_COMMAND}`; export r; \
1190 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a52a0a7f 1191 $(HOST_EXPORTS) \
88b5521b 1192 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
95ddd785
NN
1193 else \
1194 true; \
6248218a
JM
1195 fi
1196
1197.PHONY: check-c++
333a28b4 1198check-c++: check-target-libstdc++-v3 check-gcc-c++
95ddd785 1199
4977bab6
ZW
1200# Install the gcc headers files, but not the fixed include files,
1201# which Cygnus is not allowed to distribute. This rule is very
1202# dependent on the workings of the gcc Makefile.in.
1203.PHONY: gcc-no-fixedincludes
1204gcc-no-fixedincludes:
1205 @if [ -f ./gcc/Makefile ]; then \
1206 rm -rf gcc/tmp-include; \
1207 mv gcc/include gcc/tmp-include 2>/dev/null; \
1208 mkdir gcc/include; \
1209 cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1210 touch gcc/stmp-fixinc gcc/include/fixed; \
1211 rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
8c90b13a
L
1212 r=`${PWD_COMMAND}`; export r; \
1213 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
a52a0a7f 1214 $(HOST_EXPORTS) \
88b5521b 1215 (cd ./gcc && \
4977bab6
ZW
1216 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1217 rm -rf gcc/include; \
1218 mv gcc/tmp-include gcc/include 2>/dev/null; \
1219 else true; fi
60975492 1220@endif gcc
295f4e42 1221
2805b53a
NN
1222# ---------------------
1223# GCC bootstrap support
1224# ---------------------
1225
d32ab992
PB
1226# We track the current stage (the one in 'gcc') in the stage_current file.
1227# stage_last instead tracks the stage that was built last. These targets
1228# are dummy when toplevel bootstrap is not active.
1229
1061f99e 1230# While making host and target tools, symlinks to the final stage must be
f41d6665
DJ
1231# there, so $(unstage) should be run at various points. To avoid excessive
1232# recursive invocations of make, we "inline" them using a variable. These
1233# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1234# to avoid warnings from the GNU Make job server.
1061f99e
PB
1235
1236unstage = :
1237stage = :
cc11cc9b 1238current_stage = ""
1061f99e 1239
d32ab992 1240@if gcc-bootstrap
9bd6112c 1241unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
d19bca38 1242stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
cc11cc9b 1243current_stage = "`cat stage_current 2> /dev/null`"
d32ab992
PB
1244@endif gcc-bootstrap
1245
1061f99e
PB
1246.PHONY: unstage stage
1247unstage:
f41d6665 1248 @: $(MAKE); $(unstage)
d32ab992 1249stage:
f41d6665 1250 @: $(MAKE); $(stage)
d32ab992 1251
2d309510
PB
1252# Disable commands for lean bootstrap.
1253LEAN = false
1254
148907ea
PB
1255# We name the build directories for the various stages "stage1-gcc",
1256# "stage2-gcc","stage3-gcc", etc.
1257
1258# Since the 'compare' process will fail (on debugging information) if any
1259# directory names are different, we need to link the gcc directory for
f41d6665 1260# the previous stage to a constant name ('prev-gcc'), and to make the name of
148907ea
PB
1261# the build directories constant as well. For the latter, we use naked names
1262# like 'gcc', because the scripts in that directory assume it. We use
1263# mv on platforms where symlinks to directories do not work or are not
1264# reliable.
1265
2805b53a
NN
1266# 'touch' doesn't work right on some platforms.
1267STAMP = echo timestamp >
1268
148907ea
PB
1269# We only want to compare .o files, so set this!
1270objext = .o
2805b53a 1271
148907ea 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.526498 seconds and 5 git commands to generate.