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