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