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