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