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