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