]> git.ipfire.org Git - thirdparty/gcc.git/blame - Makefile.tpl
Merge tree-ssa-20020619-branch into mainline.
[thirdparty/gcc.git] / Makefile.tpl
CommitLineData
f507a3cb 1[+ AutoGen5 template -*- Mode: Makefile -*-
2a1ac811 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,
e50ab007 9# 1999, 2000, 2001, 2002, 2003 Free Software Foundation
2a1ac811 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
f7ca337f 26# -------------------------------
27# Standard Autoconf-set variables
28# -------------------------------
805e22b2 29VPATH=@srcdir@
805e22b2 30
31build_alias=@build_alias@
ab8cf29b 32build=@build@
805e22b2 33host_alias=@host_alias@
ab8cf29b 34host=@host@
805e22b2 35target_alias=@target_alias@
ab8cf29b 36target=@target@
805e22b2 37
f7ca337f 38program_transform_name = @program_transform_name@
0311ff84 39
40prefix = @prefix@
41exec_prefix = @exec_prefix@
42
f7ca337f 43srcdir = @srcdir@
44
0311ff84 45bindir = @bindir@
46sbindir = @sbindir@
47libexecdir = @libexecdir@
48datadir = @datadir@
49sysconfdir = @sysconfdir@
50sharedstatedir = @sharedstatedir@
51localstatedir = @localstatedir@
52libdir = @libdir@
53includedir = @includedir@
54oldincludedir = @oldincludedir@
55infodir = @infodir@
56mandir = @mandir@
2a1ac811 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
2a1ac811 66
450e6c84 67INSTALL = @INSTALL@
68INSTALL_PROGRAM = @INSTALL_PROGRAM@
69INSTALL_SCRIPT = @INSTALL_SCRIPT@
70INSTALL_DATA = @INSTALL_DATA@
2a1ac811 71
f7ca337f 72# -------------------------------------------------
73# Miscellaneous non-standard autoconf-set variables
74# -------------------------------------------------
2a1ac811 75
f7ca337f 76# The file containing GCC's version number.
77gcc_version_trigger = @gcc_version_trigger@
78gcc_version = @gcc_version@
2a1ac811 79
f7ca337f 80# The gcc driver likes to know the arguments it was configured with.
81TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
2a1ac811 82
f7ca337f 83gxx_include_dir = @gxx_include_dir@
84libstdcxx_incdir = @libstdcxx_incdir@
2a1ac811 85
f7ca337f 86tooldir = @tooldir@
87build_tooldir = @build_tooldir@
2a1ac811 88
f7ca337f 89# Directory in which the compiler finds executables, libraries, etc.
9db45a87 90libsubdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)
f7ca337f 91GDB_NLM_DEPS =
2a1ac811 92
f7ca337f 93# This is the name of the environment variable used for the path to
94# the libraries.
95RPATH_ENVVAR = @RPATH_ENVVAR@
2a1ac811 96
f7ca337f 97# This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
98# was used.
99SET_LIB_PATH = @SET_LIB_PATH@
2a1ac811 100
f7ca337f 101# configure.in sets SET_LIB_PATH to this if --enable-shared was used.
102# Some platforms don't like blank entries, so we remove duplicate,
103# leading and trailing colons.
104REALLY_SET_LIB_PATH = \
105 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
2a1ac811 106
f7ca337f 107# This is the list of directories to be built for the build system.
4ee9c684 108BUILD_CONFIGDIRS = libiberty libbanshee
f7ca337f 109# Build programs are put under this directory.
110BUILD_SUBDIR = @build_subdir@
111# This is set by the configure script to the arguments to use when configuring
112# directories built for the build system.
113BUILD_CONFIGARGS = @build_configargs@
114
115# This is the list of directories to built for the host system.
116SUBDIRS = @configdirs@
117# This is set by the configure script to the arguments to use when configuring
118# directories built for the host system.
119HOST_CONFIGARGS = @host_configargs@
120
121# This is set by the configure script to the list of directories which
122# should be built using the target tools.
123TARGET_CONFIGDIRS = @target_configdirs@
124# Target libraries are put under this directory:
125TARGET_SUBDIR = @target_subdir@
126# This is set by the configure script to the arguments to use when configuring
127# directories built for the target.
128TARGET_CONFIGARGS = @target_configargs@
129
4ee9c684 130# Where to find GMP
131HOST_GMPLIBS = @gmplibs@
132HOST_GMPINC = @gmpinc@
133
f7ca337f 134# ----------------------------------------------
135# Programs producing files for the BUILD machine
136# ----------------------------------------------
137
138SHELL = @config_shell@
139
140# pwd command to use. Allow user to override default by setting PWDCMD in
141# the environment to account for automounters. The make variable must not
142# be called PWDCMD, otherwise the value set here is passed to make
143# subprocesses and overrides the setting from the user's environment.
7a8ca04a 144# Don't use PWD since it is a common shell environment variable and we
145# don't want to corrupt it.
146PWD_COMMAND = $${PWDCMD-pwd}
f7ca337f 147
148# compilers to use to create programs which must be run in the build
149# environment.
150CC_FOR_BUILD = @CC_FOR_BUILD@
d8e9ea04 151CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
f7ca337f 152
153CXX_FOR_BUILD = $(CXX)
154
155# Special variables passed down in EXTRA_GCC_FLAGS. They are defined
156# here so that they can be overridden by Makefile fragments.
f7ca337f 157BUILD_PREFIX = @BUILD_PREFIX@
158BUILD_PREFIX_1 = @BUILD_PREFIX_1@
2a1ac811 159
805e22b2 160BISON=@BISON@
161USUAL_BISON = `if [ -f $$r/bison/bison ] ; then \
2a1ac811 162 echo $$r/bison/bison -L $$s/bison/ ; \
163 else \
164 echo bison ; \
165 fi`
166
f7ca337f 167DEFAULT_YACC = @DEFAULT_YACC@
805e22b2 168YACC=@YACC@
169USUAL_YACC = `if [ -f $$r/bison/bison ] ; then \
2a1ac811 170 echo $$r/bison/bison -y -L $$s/bison/ ; \
171 elif [ -f $$r/byacc/byacc ] ; then \
172 echo $$r/byacc/byacc ; \
173 else \
174 echo ${DEFAULT_YACC} ; \
175 fi`
176
f7ca337f 177DEFAULT_LEX = @DEFAULT_LEX@
805e22b2 178LEX=@LEX@
179USUAL_LEX = `if [ -f $$r/flex/flex ] ; \
2a1ac811 180 then echo $$r/flex/flex ; \
181 else echo ${DEFAULT_LEX} ; fi`
182
f7ca337f 183DEFAULT_M4 = @DEFAULT_M4@
2a1ac811 184M4 = `if [ -f $$r/m4/m4 ] ; \
185 then echo $$r/m4/m4 ; \
186 else echo ${DEFAULT_M4} ; fi`
187
d8b01fbe 188# For an installed makeinfo, we require it to be from texinfo 4.2 or
2a1ac811 189# higher, else we use the "missing" dummy.
805e22b2 190MAKEINFO=@MAKEINFO@
191USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \
2a1ac811 192 then echo $$r/texinfo/makeinfo/makeinfo ; \
193 else if (makeinfo --version \
d8b01fbe 194 | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])') >/dev/null 2>&1; \
2a1ac811 195 then echo makeinfo; else echo $$s/missing makeinfo; fi; fi`
196
197# This just becomes part of the MAKEINFO definition passed down to
198# sub-makes. It lets flags be given on the command line while still
199# using the makeinfo from the object tree.
516b2e07 200# (Default to avoid splitting info files by setting the threshold high.)
201MAKEINFOFLAGS = --split-size=5000000
2a1ac811 202
203EXPECT = `if [ -f $$r/expect/expect ] ; \
204 then echo $$r/expect/expect ; \
205 else echo expect ; fi`
206
207RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \
208 then echo $$s/dejagnu/runtest ; \
209 else echo runtest ; fi`
210
f7ca337f 211# ---------------------------------------------
212# Programs producing files for the HOST machine
213# ---------------------------------------------
2a1ac811 214
f7ca337f 215# This is the list of directories that may be needed in RPATH_ENVVAR
216# so that programs built for the host machine work.
217HOST_LIB_PATH = $$r/bfd:$$r/opcodes
2a1ac811 218
f7ca337f 219AS = @AS@
2a1ac811 220
f7ca337f 221AR = @AR@
222AR_FLAGS = rc
2a1ac811 223
f7ca337f 224CC = @CC@
225CFLAGS = @CFLAGS@
226LIBCFLAGS = $(CFLAGS)
2a1ac811 227
f7ca337f 228CXX = @CXX@
229CXXFLAGS = @CXXFLAGS@
230LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
2a1ac811 231
f7ca337f 232DLLTOOL = @DLLTOOL@
2a1ac811 233
f7ca337f 234NM = @NM@
805e22b2 235
f7ca337f 236LD = @LD@
237LDFLAGS =
805e22b2 238
f7ca337f 239RANLIB = @RANLIB@
2a1ac811 240
f7ca337f 241WINDRES = @WINDRES@
2a1ac811 242
f7ca337f 243PICFLAG =
244
245# -----------------------------------------------
246# Programs producing files for the TARGET machine
247# -----------------------------------------------
2a1ac811 248
249# This is the list of directories that may be needed in RPATH_ENVVAR
250# so that prorgams built for the target machine work.
4ee9c684 251TARGET_LIB_PATH = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:$$r/$(TARGET_SUBDIR)/libmudflap/.libs
2a1ac811 252
0e1ac85c 253FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
2a1ac811 254
f7ca337f 255AR_FOR_TARGET=@AR_FOR_TARGET@
49aae208 256CONFIGURED_AR_FOR_TARGET=@CONFIGURED_AR_FOR_TARGET@
f7ca337f 257USUAL_AR_FOR_TARGET = ` \
258 if [ -f $$r/binutils/ar ] ; then \
259 echo $$r/binutils/ar ; \
260 else \
ab8cf29b 261 if [ '$(host)' = '$(target)' ] ; then \
f7ca337f 262 echo $(AR); \
263 else \
49aae208 264 echo $(CONFIGURED_AR_FOR_TARGET) ; \
f7ca337f 265 fi; \
266 fi`
2a1ac811 267
805e22b2 268AS_FOR_TARGET=@AS_FOR_TARGET@
49aae208 269CONFIGURED_AS_FOR_TARGET=@CONFIGURED_AS_FOR_TARGET@
805e22b2 270USUAL_AS_FOR_TARGET = ` \
2a1ac811 271 if [ -f $$r/gas/as-new ] ; then \
272 echo $$r/gas/as-new ; \
273 elif [ -f $$r/gcc/xgcc ]; then \
274 $(CC_FOR_TARGET) -print-prog-name=as ; \
275 else \
ab8cf29b 276 if [ '$(host)' = '$(target)' ] ; then \
2a1ac811 277 echo $(AS); \
278 else \
49aae208 279 echo $(CONFIGURED_AS_FOR_TARGET) ; \
2a1ac811 280 fi; \
281 fi`
282
f7ca337f 283CC_FOR_TARGET = @CC_FOR_TARGET@
284# During gcc bootstrap, if we use some random cc for stage1 then
285# CFLAGS will be just -g. We want to ensure that TARGET libraries
286# (which we know are built with gcc) are built with optimizations so
287# prepend -O2 when setting CFLAGS_FOR_TARGET.
288CFLAGS_FOR_TARGET = -O2 $(CFLAGS)
289# If GCC_FOR_TARGET is not overriden on the command line, then this
290# variable is passed down to the gcc Makefile, where it is used to
291# build libgcc2.a. We define it here so that it can itself be
292# overridden on the command line.
293GCC_FOR_TARGET=@GCC_FOR_TARGET@
294USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET)
295LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
296
297CXX_FOR_TARGET = @CXX_FOR_TARGET@
298RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
299CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
300RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
301CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
302LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
2a1ac811 303
805e22b2 304DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
49aae208 305CONFIGURED_DLLTOOL_FOR_TARGET=@CONFIGURED_DLLTOOL_FOR_TARGET@
805e22b2 306USUAL_DLLTOOL_FOR_TARGET = ` \
2a1ac811 307 if [ -f $$r/binutils/dlltool ] ; then \
308 echo $$r/binutils/dlltool ; \
309 else \
ab8cf29b 310 if [ '$(host)' = '$(target)' ] ; then \
2a1ac811 311 echo $(DLLTOOL); \
312 else \
49aae208 313 echo $(CONFIGURED_DLLTOOL_FOR_TARGET) ; \
2a1ac811 314 fi; \
315 fi`
316
f7ca337f 317GCJ_FOR_TARGET = @GCJ_FOR_TARGET@
4ee9c684 318GFORTRAN_FOR_TARGET = @GFORTRAN_FOR_TARGET@
f7ca337f 319
320LD_FOR_TARGET=@LD_FOR_TARGET@
49aae208 321CONFIGURED_LD_FOR_TARGET=@CONFIGURED_LD_FOR_TARGET@
f7ca337f 322USUAL_LD_FOR_TARGET = ` \
323 if [ -f $$r/ld/ld-new ] ; then \
324 echo $$r/ld/ld-new ; \
325 elif [ -f $$r/gcc/xgcc ]; then \
326 $(CC_FOR_TARGET) -print-prog-name=ld ; \
2a1ac811 327 else \
ab8cf29b 328 if [ '$(host)' = '$(target)' ] ; then \
f7ca337f 329 echo $(LD); \
2a1ac811 330 else \
49aae208 331 echo $(CONFIGURED_LD_FOR_TARGET) ; \
2a1ac811 332 fi; \
333 fi`
334
f7ca337f 335LDFLAGS_FOR_TARGET =
336
337NM_FOR_TARGET=@NM_FOR_TARGET@
49aae208 338CONFIGURED_NM_FOR_TARGET=@CONFIGURED_NM_FOR_TARGET@
f7ca337f 339USUAL_NM_FOR_TARGET = ` \
340 if [ -f $$r/binutils/nm-new ] ; then \
341 echo $$r/binutils/nm-new ; \
342 elif [ -f $$r/gcc/xgcc ]; then \
343 $(CC_FOR_TARGET) -print-prog-name=nm ; \
2a1ac811 344 else \
ab8cf29b 345 if [ '$(host)' = '$(target)' ] ; then \
f7ca337f 346 echo $(NM); \
2a1ac811 347 else \
49aae208 348 echo $(CONFIGURED_NM_FOR_TARGET) ; \
2a1ac811 349 fi; \
350 fi`
351
805e22b2 352RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
49aae208 353CONFIGURED_RANLIB_FOR_TARGET=@CONFIGURED_RANLIB_FOR_TARGET@
805e22b2 354USUAL_RANLIB_FOR_TARGET = ` \
2a1ac811 355 if [ -f $$r/binutils/ranlib ] ; then \
356 echo $$r/binutils/ranlib ; \
357 else \
ab8cf29b 358 if [ '$(host)' = '$(target)' ] ; then \
2a1ac811 359 if [ x'$(RANLIB)' != x ]; then \
360 echo $(RANLIB); \
361 else \
362 echo ranlib; \
363 fi; \
364 else \
49aae208 365 echo $(CONFIGURED_RANLIB_FOR_TARGET) ; \
2a1ac811 366 fi; \
367 fi`
368
f7ca337f 369WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
49aae208 370CONFIGURED_WINDRES_FOR_TARGET=@CONFIGURED_WINDRES_FOR_TARGET@
f7ca337f 371USUAL_WINDRES_FOR_TARGET = ` \
372 if [ -f $$r/binutils/windres ] ; then \
373 echo $$r/binutils/windres ; \
2a1ac811 374 else \
ab8cf29b 375 if [ '$(host)' = '$(target)' ] ; then \
f7ca337f 376 echo $(WINDRES); \
2a1ac811 377 else \
49aae208 378 echo $(CONFIGURED_WINDRES_FOR_TARGET) ; \
2a1ac811 379 fi; \
380 fi`
381
f7ca337f 382PICFLAG_FOR_TARGET =
383
384# ------------------------------------
385# Miscellaneous targets and flag lists
386# ------------------------------------
387
2a1ac811 388# The first rule in the file had better be this one. Don't put any above it.
389# This lives here to allow makefile fragments to contain dependencies.
390all: all.normal
391.PHONY: all
392
2a1ac811 393#### host and target specific makefile fragments come in here.
71ab34df 394@target_makefile_frag@
395@alphaieee_frag@
396@ospace_frag@
397@host_makefile_frag@
2a1ac811 398###
399
400# Flags to pass down to all sub-makes.
36bbd884 401BASE_FLAGS_TO_PASS = [+ FOR flags_to_pass +]\
402 "[+flag+]=$([+flag+])" [+ ENDFOR flags_to_pass +]\
3a6fbbb0 403 "CONFIG_SHELL=$(SHELL)" \
36bbd884 404 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"
2a1ac811 405
406# For any flags above that may contain shell code that varies from one
407# target library to another. When doing recursive invocations of the
408# top-level Makefile, we don't want the outer make to evaluate them,
409# so we pass these variables down unchanged. They must not contain
410# single nor double quotes.
411RECURSE_FLAGS = \
805e22b2 412 CXX_FOR_TARGET='$(CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \
413 RAW_CXX_FOR_TARGET='$(RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \
2a1ac811 414
415# Flags to pass down to most sub-makes, in which we're building with
416# the host environment.
2a1ac811 417EXTRA_HOST_FLAGS = \
418 'AR=$(AR)' \
419 'AS=$(AS)' \
420 'CC=$(CC)' \
421 'CXX=$(CXX)' \
422 'DLLTOOL=$(DLLTOOL)' \
423 'LD=$(LD)' \
424 'NM=$(NM)' \
224ed654 425 'RANLIB=$(RANLIB)' \
2a1ac811 426 'WINDRES=$(WINDRES)'
427
428FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
429
430# Flags that are concerned with the location of the X11 include files
431# and library files
432#
433# NOTE: until the top-level is getting the values via autoconf, it only
434# causes problems to have this top-level Makefile overriding the autoconf-set
435# values in child directories. Only variables that don't conflict with
436# autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
437#
438X11_FLAGS_TO_PASS = \
439 'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
440 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
441
442# Flags to pass down to makes which are built with the target environment.
443# The double $ decreases the length of the command line; the variables
444# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.
2a1ac811 445EXTRA_TARGET_FLAGS = \
446 'AR=$$(AR_FOR_TARGET)' \
447 'AS=$$(AS_FOR_TARGET)' \
448 'CC=$$(CC_FOR_TARGET)' \
449 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
450 'CXX=$$(CXX_FOR_TARGET)' \
451 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
452 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
453 'LD=$$(LD_FOR_TARGET)' \
454 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
455 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
456 'NM=$$(NM_FOR_TARGET)' \
457 'RANLIB=$$(RANLIB_FOR_TARGET)' \
458 'WINDRES=$$(WINDRES_FOR_TARGET)'
459
460TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
461
462# Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
463# unfortunately needs the native compiler and the target ar and
464# ranlib.
465# If any variables are added here, they must be added to do-*, below.
ff2e99a4 466# The BUILD_* variables are a special case, which are used for the gcc
2a1ac811 467# cross-building scheme.
468EXTRA_GCC_FLAGS = \
2a1ac811 469 'BUILD_PREFIX=$(BUILD_PREFIX)' \
470 'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \
2a1ac811 471 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
472 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
75fc7adc 473 "`echo 'LANGUAGES=$(LANGUAGES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
474 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
475 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
476 "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
477 "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
478 "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
479 "`echo 'STAGE1_CFLAGS=$(STAGE1_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
480 "`echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
481 "`echo 'BOOT_ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
2a1ac811 482
70356f61 483GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
2a1ac811 484
6f4f34a7 485.PHONY: configure-host
486configure-host: maybe-configure-gcc [+
487 FOR host_modules +] \
488 maybe-configure-[+module+][+
489 ENDFOR host_modules +]
490.PHONY: configure-target
491configure-target: [+
492 FOR target_modules +] \
493 maybe-configure-target-[+module+][+
494 ENDFOR target_modules +]
2a1ac811 495
2a1ac811 496# The target built for a native build.
497.PHONY: all.normal
6f4f34a7 498all.normal: @all_build_modules@ all-host all-target
499
500.PHONY: all-host
501all-host: maybe-all-gcc [+
502 FOR host_modules +] \
503 maybe-all-[+module+][+
504 ENDFOR host_modules +]
505.PHONY: all-target
506all-target: [+
507 FOR target_modules +] \
508 maybe-all-target-[+module+][+
509 ENDFOR target_modules +]
2a1ac811 510
511# Do a target for all the subdirectories. A ``make do-X'' will do a
512# ``make X'' in all subdirectories (because, in general, there is a
513# dependency (below) of X upon do-X, a ``make X'' will also do this,
514# but it may do additional work as well).
805e22b2 515[+ FOR recursive_targets +]
ffe98fac 516.PHONY: do-[+make_target+]
ff2e99a4 517do-[+make_target+]: [+make_target+]-host [+make_target+]-target
518
519.PHONY: [+make_target+]-host
520[+make_target+]-host: maybe-[+make_target+]-gcc [+
521 FOR host_modules +] \
522 maybe-[+make_target+]-[+module+][+
523 ENDFOR host_modules +]
524
525.PHONY: [+make_target+]-target
526[+make_target+]-target: [+
527 FOR target_modules +] \
528 maybe-[+make_target+]-target-[+module+][+
529 ENDFOR target_modules +]
805e22b2 530[+ ENDFOR recursive_targets +]
531
2a1ac811 532# Here are the targets which correspond to the do-X targets.
533
534.PHONY: info installcheck dvi install-info
535.PHONY: clean distclean mostlyclean maintainer-clean realclean
536.PHONY: local-clean local-distclean local-maintainer-clean
537info: do-info
538installcheck: do-installcheck
539dvi: do-dvi
540
20672016 541# Make sure makeinfo is built before we do a `make info', if we're
542# in fact building texinfo.
543do-info: maybe-all-texinfo
2a1ac811 544
545install-info: do-install-info dir.info
7a8ca04a 546 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
2a1ac811 547 if [ -f dir.info ] ; then \
05794691 548 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
2a1ac811 549 else true ; fi
550
551local-clean:
552 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
553
554local-distclean:
555 -rm -f Makefile config.status config.cache mh-frag mt-frag
11d8013a 556 -rm -f multilib.out multilib.tmp maybedep.tmp serdep.tmp
2a1ac811 557 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
558 rm -rf $(TARGET_SUBDIR); \
559 else true; fi
170853d0 560 -rm -rf $(BUILD_SUBDIR)
2a1ac811 561 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
562 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
563 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
564 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
565 -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
566
567local-maintainer-clean:
568 @echo "This command is intended for maintainers to use;"
569 @echo "it deletes files that may require special tools to rebuild."
570
571clean: do-clean local-clean
572mostlyclean: do-mostlyclean local-clean
573distclean: do-distclean local-clean local-distclean
574maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
575maintainer-clean: local-distclean
576realclean: maintainer-clean
577
ff2e99a4 578# Extra dependency for clean-target, owing to the mixed nature of gcc
579clean-target: clean-target-libgcc
2a1ac811 580clean-target-libgcc:
581 test ! -d gcc/libgcc || \
582 (cd gcc/libgcc && find . -type d -print) | \
583 while read d; do rm -f gcc/$$d/libgcc.a || : ; done
584 -rm -rf gcc/libgcc
585
586# Check target.
587
588.PHONY: check do-check
465fccaf 589check: do-check
2a1ac811 590
805e22b2 591# Only include modules actually being configured and built.
4d9c9c81 592do-check: maybe-check-gcc [+
593 FOR host_modules +] \
594 maybe-check-[+module+][+
595 ENDFOR host_modules +][+
596 FOR target_modules +] \
597 maybe-check-target-[+module+][+
598 ENDFOR target_modules +]
2a1ac811 599
600# Automated reporting of test results.
601
602warning.log: build.log
603 $(srcdir)/contrib/warn_summary build.log > $@
604
605mail-report.log:
606 if test x'$(BOOT_CFLAGS)' != x''; then \
607 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
608 fi; \
609 $(srcdir)/contrib/test_summary -t >$@
610 chmod +x $@
611 echo If you really want to send e-mail, run ./$@ now
612
613mail-report-with-warnings.log: warning.log
614 if test x'$(BOOT_CFLAGS)' != x''; then \
615 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
616 fi; \
617 $(srcdir)/contrib/test_summary -t -i warning.log >$@
618 chmod +x $@
619 echo If you really want to send e-mail, run ./$@ now
620
621# Installation targets.
622
805e22b2 623.PHONY: install uninstall
6f4f34a7 624install: installdirs install-host install-target
625
4d9c9c81 626.PHONY: install-host-nogcc
627install-host-nogcc: [+
628 FOR host_modules +] \
629 maybe-install-[+module+][+
630 ENDFOR host_modules +]
631
6f4f34a7 632.PHONY: install-host
633install-host: maybe-install-gcc [+
634 FOR host_modules +] \
635 maybe-install-[+module+][+
636 ENDFOR host_modules +]
4d9c9c81 637
6f4f34a7 638.PHONY: install-target
639install-target: [+
640 FOR target_modules +] \
641 maybe-install-target-[+module+][+
642 ENDFOR target_modules +]
2a1ac811 643
644uninstall:
645 @echo "the uninstall target is not supported in this tree"
646
2a1ac811 647.PHONY: install.all
648install.all: install-no-fixedincludes
649 @if [ -f ./gcc/Makefile ] ; then \
7a8ca04a 650 r=`${PWD_COMMAND}` ; export r ; \
2a1ac811 651 $(SET_LIB_PATH) \
ca86fd55 652 (cd ./gcc && \
2a1ac811 653 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
654 else \
655 true ; \
656 fi
657
658# install-no-fixedincludes is used because Cygnus can not distribute
659# the fixed header files.
660.PHONY: install-no-fixedincludes
4d9c9c81 661install-no-fixedincludes: installdirs install-host-nogcc \
6f4f34a7 662 install-target gcc-no-fixedincludes
2a1ac811 663
805e22b2 664### other supporting targets
2a1ac811 665
805e22b2 666MAKEDIRS= \
667 $(DESTDIR)$(prefix) \
668 $(DESTDIR)$(exec_prefix)
669.PHONY: installdirs
670installdirs: mkinstalldirs
671 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
672
673dir.info: do-install-info
674 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
05794691 675 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
805e22b2 676 mv -f dir.info.new dir.info ; \
677 else true ; \
2a1ac811 678 fi
679
805e22b2 680dist:
681 @echo "Building a full distribution of this tree isn't done"
682 @echo "via 'make dist'. Check out the etc/ subdirectory"
683
684etags tags: TAGS
685
686# Right now this just builds TAGS in each subdirectory. emacs19 has the
687# ability to use several tags files at once, so there is probably no need
688# to combine them into one big TAGS file (like CVS 1.3 does). We could
689# (if we felt like it) have this Makefile write a piece of elisp which
690# the user could load to tell emacs19 where all the TAGS files we just
691# built are.
692TAGS: do-TAGS
693
805e22b2 694# --------------------------------------
695# Modules which run on the build machine
696# --------------------------------------
697[+ FOR build_modules +]
698.PHONY: configure-build-[+module+] maybe-configure-build-[+module+]
699maybe-configure-build-[+module+]:
11d8013a 700configure-build-[+module+]:
701 @test ! -f $(BUILD_SUBDIR)/[+module+]/Makefile || exit 0; \
2f61b8ca 702 $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/[+module+] ; \
7a8ca04a 703 r=`${PWD_COMMAND}`; export r; \
704 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
602d002b 705 AR="$(AR_FOR_BUILD)"; export AR; \
706 AS="$(AS_FOR_BUILD)"; export AS; \
707 CC="$(CC_FOR_BUILD)"; export CC; \
708 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
3a6fbbb0 709 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
602d002b 710 CXX="$(CXX_FOR_BUILD)"; export CXX; \
711 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
712 GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
4ee9c684 713 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
602d002b 714 DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
715 LD="$(LD_FOR_BUILD)"; export LD; \
716 LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
717 NM="$(NM_FOR_BUILD)"; export NM; \
718 RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
719 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \
720 echo Configuring in $(BUILD_SUBDIR)/[+module+]; \
721 cd "$(BUILD_SUBDIR)/[+module+]" || exit 1; \
722 case $(srcdir) in \
723 /* | [A-Za-z]:[\\/]*) \
724 topdir=$(srcdir) ;; \
725 *) \
726 case "$(BUILD_SUBDIR)" in \
2a1ac811 727 .) topdir="../$(srcdir)" ;; \
728 *) topdir="../../$(srcdir)" ;; \
602d002b 729 esac ;; \
730 esac; \
731 if [ "$(srcdir)" = "." ] ; then \
732 if [ "$(BUILD_SUBDIR)" != "." ] ; then \
733 if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \
734 if [ -f Makefile ]; then \
735 if $(MAKE) distclean; then \
736 true; \
737 else \
738 exit 1; \
739 fi; \
2a1ac811 740 else \
602d002b 741 true; \
2a1ac811 742 fi; \
2a1ac811 743 else \
602d002b 744 exit 1; \
2a1ac811 745 fi; \
602d002b 746 else \
747 true; \
748 fi; \
749 srcdiroption="--srcdir=."; \
750 libsrcdir="."; \
751 else \
752 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
753 libsrcdir="$$s/[+module+]"; \
754 fi; \
755 rm -f no-such-file || : ; \
756 CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
757 $(BUILD_CONFIGARGS) $${srcdiroption} \
758 --with-build-subdir="$(BUILD_SUBDIR)" \
759 || exit 1
805e22b2 760
761.PHONY: all-build-[+module+] maybe-all-build-[+module+]
762maybe-all-build-[+module+]:
763all-build-[+module+]: configure-build-[+module+]
7a8ca04a 764 @r=`${PWD_COMMAND}`; export r; \
765 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
602d002b 766 (cd $(BUILD_SUBDIR)/[+module+] && $(MAKE) all)
805e22b2 767[+ ENDFOR build_modules +]
768
769# --------------------------------------
770# Modules which run on the host machine
771# --------------------------------------
772[+ FOR host_modules +]
773.PHONY: configure-[+module+] maybe-configure-[+module+]
774maybe-configure-[+module+]:
11d8013a 775configure-[+module+]:
776 @test ! -f [+module+]/Makefile || exit 0; \
777 [ -d [+module+] ] || mkdir [+module+]; \
7a8ca04a 778 r=`${PWD_COMMAND}`; export r; \
779 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
805e22b2 780 CC="$(CC)"; export CC; \
781 CFLAGS="$(CFLAGS)"; export CFLAGS; \
3a6fbbb0 782 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
805e22b2 783 CXX="$(CXX)"; export CXX; \
784 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
d95eabf9 785 AR="$(AR)"; export AR; \
786 AS="$(AS)"; export AS; \
787 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
788 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
789 LD="$(LD)"; export LD; \
b8d376b5 790 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
d95eabf9 791 NM="$(NM)"; export NM; \
792 RANLIB="$(RANLIB)"; export RANLIB; \
793 WINDRES="$(WINDRES)"; export WINDRES; \
794 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
795 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
805e22b2 796 echo Configuring in [+module+]; \
797 cd [+module+] || exit 1; \
798 case $(srcdir) in \
799 \.) \
800 srcdiroption="--srcdir=."; \
801 libsrcdir=".";; \
802 /* | [A-Za-z]:[\\/]*) \
803 srcdiroption="--srcdir=$(srcdir)/[+module+]"; \
804 libsrcdir="$$s/[+module+]";; \
805 *) \
806 srcdiroption="--srcdir=../$(srcdir)/[+module+]"; \
807 libsrcdir="$$s/[+module+]";; \
808 esac; \
809 $(SHELL) $${libsrcdir}/configure \
810 $(HOST_CONFIGARGS) $${srcdiroption} \
811 || exit 1
2a1ac811 812
805e22b2 813.PHONY: all-[+module+] maybe-all-[+module+]
814maybe-all-[+module+]:
815all-[+module+]: configure-[+module+]
7a8ca04a 816 @r=`${PWD_COMMAND}`; export r; \
817 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
602d002b 818 $(SET_LIB_PATH) \
819 (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+
820 IF with_x
821 +] $(X11_FLAGS_TO_PASS)[+
822 ENDIF with_x +] all)
805e22b2 823
4d9c9c81 824.PHONY: check-[+module+] maybe-check-[+module+]
825maybe-check-[+module+]:
805e22b2 826[+ IF no_check +]
805e22b2 827check-[+module+]:
828[+ ELIF no_check_cross +]
805e22b2 829# This module is only tested in a native toolchain.
830check-[+module+]:
ab8cf29b 831 @if [ '$(host)' = '$(target)' ] ; then \
7a8ca04a 832 r=`${PWD_COMMAND}`; export r; \
833 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
2a1ac811 834 $(SET_LIB_PATH) \
ca86fd55 835 (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+
805e22b2 836 IF with_x
837 +] $(X11_FLAGS_TO_PASS)[+
602d002b 838 ENDIF with_x +] check); \
839 fi
840[+ ELSE check +]
602d002b 841check-[+module+]:
7a8ca04a 842 @r=`${PWD_COMMAND}`; export r; \
843 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
602d002b 844 $(SET_LIB_PATH) \
845 (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+
846 IF with_x
847 +] $(X11_FLAGS_TO_PASS)[+
848 ENDIF with_x +] check)
805e22b2 849[+ ENDIF no_check +]
850
805e22b2 851.PHONY: install-[+module+] maybe-install-[+module+]
852maybe-install-[+module+]:
4d9c9c81 853[+ IF no_install +]
805e22b2 854install-[+module+]:
855[+ ELSE install +]
805e22b2 856install-[+module+]: installdirs
7a8ca04a 857 @r=`${PWD_COMMAND}`; export r; \
858 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
602d002b 859 $(SET_LIB_PATH) \
860 (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+
861 IF with_x
862 +] $(X11_FLAGS_TO_PASS)[+
863 ENDIF with_x +] install)
805e22b2 864[+ ENDIF no_install +]
9621e512 865
866# Other targets (info, dvi, etc.)
867[+ FOR recursive_targets +]
868.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
869maybe-[+make_target+]-[+module+]:
870[+ IF (match-value? = "missing" (get "make_target") ) +]
871# [+module+] doesn't support [+make_target+].
872[+make_target+]-[+module+]:
873[+ ELSE +]
874[+make_target+]-[+module+]: [+
875 FOR depend +]\
876 [+depend+]-[+module+] [+
877 ENDFOR depend +]
878 @[ -f ./[+module+]/Makefile ] || exit 0; \
879 r=`${PWD_COMMAND}`; export r; \
880 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
881 $(SET_LIB_PATH) \
882 for flag in $(EXTRA_HOST_FLAGS); do \
883 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
884 done; \
885 echo "Doing [+make_target+] in [+module+]" ; \
886 (cd [+module+] && \
887 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
888 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
889 "RANLIB=$${RANLIB}" \
890 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
891 [+make_target+]) \
892 || exit 1
893[+ ENDIF +]
894[+ ENDFOR recursive_targets +]
805e22b2 895[+ ENDFOR host_modules +]
896
897# ---------------------------------------
898# Modules which run on the target machine
899# ---------------------------------------
900[+ FOR target_modules +]
901.PHONY: configure-target-[+module+] maybe-configure-target-[+module+]
902maybe-configure-target-[+module+]:
805e22b2 903
ca86fd55 904# There's only one multilib.out. Cleverer subdirs shouldn't need it copied.
905$(TARGET_SUBDIR)/[+module+]/multilib.out: multilib.out
2f61b8ca 906 $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/[+module+] ; \
11d8013a 907 rm -f $(TARGET_SUBDIR)/[+module+]/Makefile || : ; \
ca86fd55 908 cp multilib.out $(TARGET_SUBDIR)/[+module+]/multilib.out
2a1ac811 909
11d8013a 910configure-target-[+module+]: $(TARGET_SUBDIR)/[+module+]/multilib.out
911 @test ! -f $(TARGET_SUBDIR)/[+module+]/Makefile || exit 0; \
2f61b8ca 912 $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/[+module+] ; \
7a8ca04a 913 r=`${PWD_COMMAND}`; export r; \
914 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
602d002b 915 $(SET_LIB_PATH) \
916 AR="$(AR_FOR_TARGET)"; export AR; \
917 AS="$(AS_FOR_TARGET)"; export AS; \
918 CC="$(CC_FOR_TARGET)"; export CC; \
919 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
3a6fbbb0 920 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
602d002b 921 CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \[+
922IF raw_cxx +]
923 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
924 CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \[+
925ELSE normal_cxx +]
926 CXX="$(CXX_FOR_TARGET)"; export CXX; \[+
927ENDIF raw_cxx +]
928 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
929 GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
4ee9c684 930 GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
602d002b 931 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
932 LD="$(LD_FOR_TARGET)"; export LD; \
933 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
934 NM="$(NM_FOR_TARGET)"; export NM; \
935 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
936 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
937 echo Configuring in $(TARGET_SUBDIR)/[+module+]; \
938 cd "$(TARGET_SUBDIR)/[+module+]" || exit 1; \
939 case $(srcdir) in \
940 /* | [A-Za-z]:[\\/]*) \
941 topdir=$(srcdir) ;; \
942 *) \
943 case "$(TARGET_SUBDIR)" in \
2a1ac811 944 .) topdir="../$(srcdir)" ;; \
945 *) topdir="../../$(srcdir)" ;; \
602d002b 946 esac ;; \
4003683b 947 esac; \[+ IF stage +]
602d002b 948 if [ "$(srcdir)" = "." ] ; then \
949 if [ "$(TARGET_SUBDIR)" != "." ] ; then \
950 if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \
951 if [ -f Makefile ]; then \
952 if $(MAKE) distclean; then \
953 true; \
954 else \
955 exit 1; \
956 fi; \
2a1ac811 957 else \
602d002b 958 true; \
2a1ac811 959 fi; \
2a1ac811 960 else \
602d002b 961 exit 1; \
2a1ac811 962 fi; \
602d002b 963 else \
964 true; \
965 fi; \
966 srcdiroption="--srcdir=."; \
967 libsrcdir="."; \
4003683b 968 else \[+ ENDIF stage +]
602d002b 969 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
4003683b 970 libsrcdir="$$s/[+module+]"; \[+ IF stage +]
971 fi; \[+ ENDIF stage +]
602d002b 972 rm -f no-such-file || : ; \
973 CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
974 $(TARGET_CONFIGARGS) $${srcdiroption} \
975 --with-target-subdir="$(TARGET_SUBDIR)" \
976 || exit 1
805e22b2 977
978.PHONY: all-target-[+module+] maybe-all-target-[+module+]
979maybe-all-target-[+module+]:
980all-target-[+module+]: configure-target-[+module+]
7a8ca04a 981 @r=`${PWD_COMMAND}`; export r; \
982 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
602d002b 983 $(SET_LIB_PATH) \
984 (cd $(TARGET_SUBDIR)/[+module+] && \
985 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
986 IF raw_cxx
987 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
988 ENDIF raw_cxx
989 +] all)
4d9c9c81 990
991.PHONY: check-target-[+module+] maybe-check-target-[+module+]
992maybe-check-target-[+module+]:
805e22b2 993[+ IF no_check +]
994# Dummy target for uncheckable module.
805e22b2 995check-target-[+module+]:
996[+ ELSE check +]
805e22b2 997check-target-[+module+]:
7a8ca04a 998 @r=`${PWD_COMMAND}`; export r; \
999 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
602d002b 1000 $(SET_LIB_PATH) \
1001 (cd $(TARGET_SUBDIR)/[+module+] && \
1002 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1003 IF raw_cxx
1004 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1005 ENDIF raw_cxx
1006 +] check)
805e22b2 1007[+ ENDIF no_check +]
4d9c9c81 1008
805e22b2 1009.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1010maybe-install-target-[+module+]:
4d9c9c81 1011[+ IF no_install +]
805e22b2 1012# Dummy target for uninstallable.
1013install-target-[+module+]:
1014[+ ELSE install +]
805e22b2 1015install-target-[+module+]: installdirs
7a8ca04a 1016 @r=`${PWD_COMMAND}`; export r; \
1017 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
602d002b 1018 $(SET_LIB_PATH) \
1019 (cd $(TARGET_SUBDIR)/[+module+] && \
1020 $(MAKE) $(TARGET_FLAGS_TO_PASS) install)
805e22b2 1021[+ ENDIF no_install +]
9621e512 1022
1023# Other targets (info, dvi, etc.)
1024[+ FOR recursive_targets +]
1025.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1026maybe-[+make_target+]-target-[+module+]:
1027[+ IF (match-value? = "missing" (get "make_target") ) +]
1028# [+module+] doesn't support [+make_target+].
1029[+make_target+]-target-[+module+]:
1030[+ ELSE +]
1031[+make_target+]-target-[+module+]: [+
1032 FOR depend +]\
1033 [+depend+]-target-[+module+] [+
1034 ENDFOR depend +]
1035 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1036 r=`${PWD_COMMAND}`; export r; \
1037 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1038 $(SET_LIB_PATH) \
1039 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1040 for flag in $(EXTRA_TARGET_FLAGS); do \
1041 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1042 done; \
1043 (cd $(TARGET_SUBDIR)/[+module+] && \
1044 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1045 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1046 "RANLIB=$${RANLIB}" \
1047 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
1048 [+make_target+]) \
1049 || exit 1
1050[+ ENDIF +]
1051[+ ENDFOR recursive_targets +]
805e22b2 1052[+ ENDFOR target_modules +]
2a1ac811 1053
805e22b2 1054# ----------
1055# GCC module
1056# ----------
2a1ac811 1057
805e22b2 1058# Unfortunately, while gcc _should_ be a host module,
1059# libgcc is a target module, and gen* programs are
1060# build modules. So GCC is a sort of hybrid.
2a1ac811 1061
1062# gcc is the only module which uses GCC_FLAGS_TO_PASS.
6509bb23 1063# Don't use shared host config.cache, as it will confuse later
1064# directories; GCC wants slightly different values for some
1065# precious variables. *sigh*
2d64c2fd 1066
1067# We must skip configuring if toplevel bootstrap is going.
805e22b2 1068.PHONY: configure-gcc maybe-configure-gcc
1069maybe-configure-gcc:
11d8013a 1070configure-gcc:
1071 @test ! -f gcc/Makefile || exit 0; \
2d64c2fd 1072 [ -f stage_last ] && exit 0; \
11d8013a 1073 [ -d gcc ] || mkdir gcc; \
7a8ca04a 1074 r=`${PWD_COMMAND}`; export r; \
1075 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
805e22b2 1076 CC="$(CC)"; export CC; \
1077 CFLAGS="$(CFLAGS)"; export CFLAGS; \
3a6fbbb0 1078 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
805e22b2 1079 CXX="$(CXX)"; export CXX; \
1080 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
a16b5a9d 1081 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
d95eabf9 1082 AR="$(AR)"; export AR; \
1083 AS="$(AS)"; export AS; \
1084 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
1085 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
1086 LD="$(LD)"; export LD; \
b8d376b5 1087 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
d95eabf9 1088 NM="$(NM)"; export NM; \
1089 RANLIB="$(RANLIB)"; export RANLIB; \
1090 WINDRES="$(WINDRES)"; export WINDRES; \
1091 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
1092 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
4ee9c684 1093 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
1094 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
805e22b2 1095 echo Configuring in gcc; \
1096 cd gcc || exit 1; \
1097 case $(srcdir) in \
1098 \.) \
1099 srcdiroption="--srcdir=."; \
1100 libsrcdir=".";; \
1101 /* | [A-Za-z]:[\\/]*) \
1102 srcdiroption="--srcdir=$(srcdir)/gcc"; \
1103 libsrcdir="$$s/gcc";; \
1104 *) \
1105 srcdiroption="--srcdir=../$(srcdir)/gcc"; \
1106 libsrcdir="$$s/gcc";; \
1107 esac; \
1108 $(SHELL) $${libsrcdir}/configure \
c8241dd9 1109 $(HOST_CONFIGARGS) $${srcdiroption} \
805e22b2 1110 || exit 1
1111
f7c8fc8e 1112# Don't 'make all' in gcc if it's already been made by 'bootstrap'; that
1113# causes trouble. This wart will be fixed eventually by moving
805e22b2 1114# the bootstrap behavior to this file.
1115.PHONY: all-gcc maybe-all-gcc
1116maybe-all-gcc:
1117all-gcc: configure-gcc
2d64c2fd 1118 r=`${PWD_COMMAND}`; export r; \
1119 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1120 if [ -f stage_last ] ; then \
1121 true ; \
1122 elif [ -f gcc/stage_last ] ; then \
f7c8fc8e 1123 $(SET_LIB_PATH) \
ca86fd55 1124 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) quickstrap); \
805e22b2 1125 else \
2a1ac811 1126 $(SET_LIB_PATH) \
ca86fd55 1127 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) all); \
2a1ac811 1128 fi
1129
1130# Building GCC uses some tools for rebuilding "source" files
1131# like texinfo, bison/byacc, etc. So we must depend on those.
1132#
1133# While building GCC, it may be necessary to run various target
1134# programs like the assembler, linker, etc. So we depend on
1135# those too.
1136#
1137# In theory, on an SMP all those dependencies can be resolved
1138# in parallel.
1139#
057705e9 1140GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
1141.PHONY: $(GCC_STRAP_TARGETS)
1142$(GCC_STRAP_TARGETS): all-bootstrap configure-gcc
7a8ca04a 1143 @r=`${PWD_COMMAND}`; export r; \
1144 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
2a1ac811 1145 $(SET_LIB_PATH) \
1146 echo "Bootstrapping the compiler"; \
1147 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
7a8ca04a 1148 @r=`${PWD_COMMAND}`; export r; \
1149 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
2a1ac811 1150 case "$@" in \
1151 *bootstrap4-lean ) \
602d002b 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 ;; \
2a1ac811 1163 esac; \
1164 $(SET_LIB_PATH) \
1165 echo "$$msg"; \
1166 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
7a8ca04a 1167 @r=`${PWD_COMMAND}`; export r; \
1168 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
2a1ac811 1169 $(SET_LIB_PATH) \
1170 echo "Building runtime libraries"; \
1171 $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all
1172
ef3bb540 1173profiledbootstrap: all-bootstrap configure-gcc
7a8ca04a 1174 @r=`${PWD_COMMAND}`; export r; \
1175 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
ef3bb540 1176 $(SET_LIB_PATH) \
1177 echo "Bootstrapping the compiler"; \
1178 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build
7a8ca04a 1179 @r=`${PWD_COMMAND}`; export r; \
1180 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
ef3bb540 1181 $(SET_LIB_PATH) \
1182 echo "Building runtime libraries and training compiler"; \
1183 $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all
7a8ca04a 1184 @r=`${PWD_COMMAND}`; export r; \
1185 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
ef3bb540 1186 $(SET_LIB_PATH) \
1187 echo "Building feedback based compiler"; \
1188 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build
1189
2a1ac811 1190.PHONY: cross
1191cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
7a8ca04a 1192 @r=`${PWD_COMMAND}`; export r; \
1193 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
2a1ac811 1194 $(SET_LIB_PATH) \
1195 echo "Building the C and C++ compiler"; \
1196 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
7a8ca04a 1197 @r=`${PWD_COMMAND}`; export r; \
1198 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
2a1ac811 1199 $(SET_LIB_PATH) \
1200 echo "Building runtime libraries"; \
1201 $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) \
1202 LANGUAGES="c c++" all
1203
abcfd3cb 1204.PHONY: check-gcc maybe-check-gcc
575caa8d 1205maybe-check-gcc:
2a1ac811 1206check-gcc:
1207 @if [ -f ./gcc/Makefile ] ; then \
7a8ca04a 1208 r=`${PWD_COMMAND}`; export r; \
1209 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
2a1ac811 1210 $(SET_LIB_PATH) \
ca86fd55 1211 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check); \
2a1ac811 1212 else \
1213 true; \
1214 fi
1215
7c28bad6 1216.PHONY: check-gcc-c++
1217check-gcc-c++:
2a1ac811 1218 @if [ -f ./gcc/Makefile ] ; then \
7a8ca04a 1219 r=`${PWD_COMMAND}`; export r; \
1220 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
2a1ac811 1221 $(SET_LIB_PATH) \
ca86fd55 1222 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
2a1ac811 1223 else \
1224 true; \
7c28bad6 1225 fi
1226
1227.PHONY: check-c++
465fccaf 1228check-c++: check-target-libstdc++-v3 check-gcc-c++
2a1ac811 1229
805e22b2 1230.PHONY: install-gcc maybe-install-gcc
1231maybe-install-gcc:
2a1ac811 1232install-gcc:
1233 @if [ -f ./gcc/Makefile ] ; then \
7a8ca04a 1234 r=`${PWD_COMMAND}`; export r; \
1235 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
2a1ac811 1236 $(SET_LIB_PATH) \
ca86fd55 1237 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
2a1ac811 1238 else \
1239 true; \
1240 fi
1241
805e22b2 1242# Install the gcc headers files, but not the fixed include files,
1243# which Cygnus is not allowed to distribute. This rule is very
1244# dependent on the workings of the gcc Makefile.in.
1245.PHONY: gcc-no-fixedincludes
1246gcc-no-fixedincludes:
1247 @if [ -f ./gcc/Makefile ]; then \
1248 rm -rf gcc/tmp-include; \
1249 mv gcc/include gcc/tmp-include 2>/dev/null; \
1250 mkdir gcc/include; \
1251 cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1252 touch gcc/stmp-fixinc gcc/include/fixed; \
1253 rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
7a8ca04a 1254 r=`${PWD_COMMAND}`; export r; \
1255 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
2a1ac811 1256 $(SET_LIB_PATH) \
ca86fd55 1257 (cd ./gcc && \
805e22b2 1258 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1259 rm -rf gcc/include; \
1260 mv gcc/tmp-include gcc/include 2>/dev/null; \
1261 else true; fi
2a1ac811 1262
9621e512 1263# Other targets (dvi, info, etc.)
1264[+ FOR recursive_targets +]
1265.PHONY: maybe-[+make_target+]-gcc [+make_target+]-gcc
1266maybe-[+make_target+]-gcc:
1267[+make_target+]-gcc: [+
1268 FOR depend +]\
1269 [+depend+]-gcc [+
1270 ENDFOR depend +]
1271 @[ -f ./gcc/Makefile ] || exit 0; \
1272 r=`${PWD_COMMAND}`; export r; \
1273 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1274 $(SET_LIB_PATH) \
1275 for flag in $(EXTRA_GCC_FLAGS); do \
1276 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1277 done; \
1278 echo "Doing [+make_target+] in gcc" ; \
1279 (cd gcc && \
1280 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1281 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1282 "RANLIB=$${RANLIB}" \
1283 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
1284 [+make_target+]) \
1285 || exit 1
1286
1287[+ ENDFOR recursive_targets +]
1288
2d64c2fd 1289# ---------------------
1290# GCC bootstrap support
1291# ---------------------
1292
1293# We name the directories for the various stages "stage1-gcc",
1294# "stage2-gcc","stage3-gcc", etc.
1295# Unfortunately, the 'compare' process will fail (on debugging information)
1296# if any directory names are different!
1297# So in the building rule for each stage, we relocate them before and after.
1298# The current one is 'gcc', while the previous one is 'prev-gcc'. (The
1299# current one must be 'gcc' for now because the scripts in that directory
1300# assume it.)
1301# At the end of the bootstrap, 'stage3-gcc' must be moved to 'gcc' so that
1302# libraries can find it. Ick!
1303
1304# Bugs: This is almost certainly not parallel-make safe.
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
aff6cf7b 1318# For stage 1:
9621e512 1319# * We force-disable intermodule optimizations, even if
1320# --enable-intermodule was passed, since the installed compiler probably
1321# can't handle them. Luckily, autoconf always respects
1322# the last argument when conflicting --enable arguments are passed.
1323# * Likewise, we force-disable coverage flags, since the installed compiler
1324# probably has never heard of them.
1325# * We build only C (and possibly Ada).
2d64c2fd 1326configure-stage1-gcc:
1327 echo configure-stage1-gcc > stage_last ; \
1328 if [ -f stage1-gcc/Makefile ] ; then \
1329 $(STAMP) configure-stage1-gcc ; \
1330 exit 0; \
1331 else \
1332 true ; \
1333 fi ; \
1334 [ -d stage1-gcc ] || mkdir stage1-gcc; \
1335 mv stage1-gcc gcc ; \
1336 r=`${PWD_COMMAND}`; export r; \
1337 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7dade866 1338 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
1339 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
2d64c2fd 1340 CC="$(CC)"; export CC; \
1341 CFLAGS="$(CFLAGS)"; export CFLAGS; \
1342 CXX="$(CXX)"; export CXX; \
1343 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
2d64c2fd 1344 AR="$(AR)"; export AR; \
1345 AS="$(AS)"; export AS; \
1346 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
1347 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
1348 LD="$(LD)"; export LD; \
b8d376b5 1349 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
2d64c2fd 1350 NM="$(NM)"; export NM; \
1351 RANLIB="$(RANLIB)"; export RANLIB; \
1352 WINDRES="$(WINDRES)"; export WINDRES; \
1353 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
1354 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
1355 echo Configuring stage 1 in gcc; \
1356 cd gcc || exit 1; \
1357 case $(srcdir) in \
1358 \.) \
1359 srcdiroption="--srcdir=."; \
1360 libsrcdir=".";; \
1361 /* | [A-Za-z]:[\\/]*) \
1362 srcdiroption="--srcdir=$(srcdir)/gcc"; \
1363 libsrcdir="$$s/gcc";; \
1364 *) \
1365 srcdiroption="--srcdir=../$(srcdir)/gcc"; \
1366 libsrcdir="$$s/gcc";; \
1367 esac; \
1368 $(SHELL) $${libsrcdir}/configure \
aff6cf7b 1369 $(HOST_CONFIGARGS) $${srcdiroption} \
9621e512 1370 --disable-intermodule --disable-coverage \
aff6cf7b 1371 --enable-languages="$(STAGE1_LANGUAGES)"; \
2d64c2fd 1372 cd .. ; \
1373 mv gcc stage1-gcc ; \
1374 $(STAMP) configure-stage1-gcc
1375
aff6cf7b 1376# Real targets act phony if they depend on phony targets; this hack
1377# prevents gratuitous rebuilding of stage 1.
1378prebootstrap:
1379 $(MAKE) all-bootstrap
1380 $(STAMP) prebootstrap
1381
1382all-stage1-gcc: configure-stage1-gcc prebootstrap
2d64c2fd 1383 echo all-stage1-gcc > stage_last ; \
1384 r=`${PWD_COMMAND}`; export r; \
1385 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1386 mv stage1-gcc gcc ; \
1387 cd gcc && \
1388 $(MAKE) $(GCC_FLAGS_TO_PASS) \
33e3141d 1389 CFLAGS="$(STAGE1_CFLAGS)" && $(STAMP) ../all-stage1-gcc ; \
1390 result=$$? ; \
2d64c2fd 1391 cd .. ; \
1392 mv gcc stage1-gcc ; \
33e3141d 1393 exit $$result
2d64c2fd 1394
7dade866 1395# TODO: Deal with STAGE_PREFIX (which is only for ada, incidentally)
c0c5068d 1396# Possibly pass --enable-werror-always (depending on --enable-werror);
1397# that's what @stage2_werror_flag@ is for
2d64c2fd 1398configure-stage2-gcc: all-stage1-gcc
1399 echo configure-stage2-gcc > stage_last ; \
1400 if [ -f stage2-gcc/Makefile ] ; then \
1401 $(STAMP) configure-stage2-gcc ; \
1402 exit 0; \
1403 else \
1404 true ; \
1405 fi ; \
1406 [ -d stage2-gcc ] || mkdir stage2-gcc; \
1407 mv stage2-gcc gcc ; \
7dade866 1408 mv stage1-gcc prev-gcc ; \
2d64c2fd 1409 r=`${PWD_COMMAND}`; export r; \
1410 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7dade866 1411 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
1412 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
2d64c2fd 1413 CFLAGS="$(CFLAGS)"; export CFLAGS; \
1414 CXX="$(CXX)"; export CXX; \
1415 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
2d64c2fd 1416 AR="$(AR)"; export AR; \
1417 AS="$(AS)"; export AS; \
2d64c2fd 1418 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
1419 LD="$(LD)"; export LD; \
b8d376b5 1420 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
2d64c2fd 1421 NM="$(NM)"; export NM; \
1422 RANLIB="$(RANLIB)"; export RANLIB; \
1423 WINDRES="$(WINDRES)"; export WINDRES; \
1424 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
1425 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
7f6f8932 1426 CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
1427 CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
2d64c2fd 1428 echo Configuring stage 2 in gcc; \
1429 cd gcc || exit 1; \
1430 case $(srcdir) in \
1431 \.) \
1432 srcdiroption="--srcdir=."; \
1433 libsrcdir=".";; \
1434 /* | [A-Za-z]:[\\/]*) \
1435 srcdiroption="--srcdir=$(srcdir)/gcc"; \
1436 libsrcdir="$$s/gcc";; \
1437 *) \
1438 srcdiroption="--srcdir=../$(srcdir)/gcc"; \
1439 libsrcdir="$$s/gcc";; \
1440 esac; \
1441 $(SHELL) $${libsrcdir}/configure \
c0c5068d 1442 $(HOST_CONFIGARGS) $${srcdiroption} @stage2_werror_flag@ ; \
2d64c2fd 1443 cd .. ; \
1444 mv gcc stage2-gcc ; \
7dade866 1445 mv prev-gcc stage1-gcc ; \
2d64c2fd 1446 $(STAMP) configure-stage2-gcc
1447
1448# Flags to pass to stage2 and later makes.
1449BOOT_CFLAGS= -g -O2
1450POSTSTAGE1_FLAGS_TO_PASS = \
1451 CFLAGS="$(BOOT_CFLAGS)" \
32fbc463 1452 ADAC="\$$(CC)"
2d64c2fd 1453
1454all-stage2-gcc: all-stage1-gcc configure-stage2-gcc
1455 echo all-stage2-gcc > stage_last ; \
1456 r=`${PWD_COMMAND}`; export r; \
1457 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1458 mv stage2-gcc gcc ; \
1459 mv stage1-gcc prev-gcc ; \
1460 cd gcc && \
1461 $(MAKE) $(GCC_FLAGS_TO_PASS) \
1462 CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/" \
2d64c2fd 1463 CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/" \
1464 STAGE_PREFIX=$$r/prev-gcc/ \
33e3141d 1465 $(POSTSTAGE1_FLAGS_TO_PASS) && $(STAMP) ../all-stage2-gcc ; \
1466 result=$$? ; \
2d64c2fd 1467 cd .. ; \
1468 mv prev-gcc stage1-gcc ; \
1469 mv gcc stage2-gcc ; \
33e3141d 1470 exit $$result
2d64c2fd 1471
1472configure-stage3-gcc: all-stage2-gcc
1473 echo configure-stage3-gcc > stage_last ; \
1474 if [ -f stage3-gcc/Makefile ] ; then \
1475 $(STAMP) configure-stage3-gcc ; \
1476 exit 0; \
1477 else \
1478 true ; \
1479 fi ; \
1480 [ -d stage3-gcc ] || mkdir stage3-gcc; \
1481 mv stage3-gcc gcc ; \
d120ca69 1482 mv stage2-gcc prev-gcc ; \
2d64c2fd 1483 r=`${PWD_COMMAND}`; export r; \
1484 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
7dade866 1485 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
1486 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
2d64c2fd 1487 CFLAGS="$(CFLAGS)"; export CFLAGS; \
1488 CXX="$(CXX)"; export CXX; \
1489 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
2d64c2fd 1490 AR="$(AR)"; export AR; \
1491 AS="$(AS)"; export AS; \
2d64c2fd 1492 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
1493 LD="$(LD)"; export LD; \
b8d376b5 1494 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
2d64c2fd 1495 NM="$(NM)"; export NM; \
1496 RANLIB="$(RANLIB)"; export RANLIB; \
1497 WINDRES="$(WINDRES)"; export WINDRES; \
1498 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
1499 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
7f6f8932 1500 CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
1501 CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
2d64c2fd 1502 echo Configuring stage 3 in gcc; \
1503 cd gcc || exit 1; \
1504 case $(srcdir) in \
1505 \.) \
1506 srcdiroption="--srcdir=."; \
1507 libsrcdir=".";; \
1508 /* | [A-Za-z]:[\\/]*) \
1509 srcdiroption="--srcdir=$(srcdir)/gcc"; \
1510 libsrcdir="$$s/gcc";; \
1511 *) \
1512 srcdiroption="--srcdir=../$(srcdir)/gcc"; \
1513 libsrcdir="$$s/gcc";; \
1514 esac; \
1515 $(SHELL) $${libsrcdir}/configure \
c0c5068d 1516 $(HOST_CONFIGARGS) $${srcdiroption} @stage2_werror_flag@ ; \
2d64c2fd 1517 cd .. ; \
1518 mv gcc stage3-gcc ; \
7dade866 1519 mv prev-gcc stage2-gcc ; \
2d64c2fd 1520 $(STAMP) configure-stage3-gcc
1521
2d64c2fd 1522all-stage3-gcc: all-stage2-gcc configure-stage3-gcc
1523 echo all-stage3-gcc > stage_last ; \
1524 r=`${PWD_COMMAND}`; export r; \
1525 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1526 mv stage2-gcc prev-gcc ; \
1527 mv stage3-gcc gcc ; \
1528 cd gcc && \
1529 $(MAKE) $(GCC_FLAGS_TO_PASS) \
1530 CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/" \
2d64c2fd 1531 CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/" \
1532 STAGE_PREFIX=$$r/prev-gcc/ \
33e3141d 1533 $(POSTSTAGE1_FLAGS_TO_PASS) && $(STAMP) ../all-stage3-gcc \
1534 result=$$? ; \
2d64c2fd 1535 cd .. ; \
1536 mv prev-gcc stage2-gcc ; \
1537 mv gcc stage3-gcc ; \
33e3141d 1538 exit $$result
2d64c2fd 1539
1540# We only want to compare .o files, so set this!
1541objext = .o
1542
1543compare: all-stage3-gcc
1544 r=`${PWD_COMMAND}`; export r; \
1545 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1546 rm -f .bad_compare ; \
1547 cd stage3-gcc; \
1548 files=`find . -name "*$(objext)" -print` ; \
1549 cd .. ; \
1550 for file in $${files} ; do \
7bcc3b4a 1551 f1=$$r/stage2-gcc/$$file; f2=$$r/stage3-gcc/$$file; \
1552 @do_compare@ > /dev/null 2>&1; \
2d64c2fd 1553 test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
1554 done ; \
1555 if [ -f .bad_compare ]; then \
1556 echo "Bootstrap comparison failure!"; \
1557 cat .bad_compare; \
1558 exit 1; \
1559 else \
1560 true; \
1561 fi ; \
1562 $(STAMP) compare
1563
1564.PHONY: new-bootstrap
1565# This target exists so that everything can be made in one pass.
1566# 'all-gcc' has to avoid stomping on the bootstrap-generated gcc for
1567# this to work.
1568new-bootstrap: compare
1569 mv stage3-gcc gcc ; \
1570 $(MAKE) all ; \
1571 mv gcc stage3-gcc
1572
33e3141d 1573new-cleanstrap:
1574 rm -rf configure-stage1-gcc all-stage1-gcc stage1-gcc \
1575 configure-stage2-gcc all-stage2-gcc stage2-gcc \
1576 configure-stage3-gcc all-stage3-gcc stage3-gcc \
1577 compare
1578 $(MAKE) new-bootstrap
1579
1580new-restage1:
1581 rm -rf all-stage1-gcc \
1582 configure-stage2-gcc all-stage2-gcc stage2-gcc \
1583 configure-stage3-gcc all-stage3-gcc stage3-gcc \
1584 compare
1585 $(MAKE) all-stage1-gcc
1586
1587new-restage2: all-stage1-gcc
1588 rm -rf all-stage2-gcc \
1589 configure-stage3-gcc all-stage3-gcc stage3-gcc \
1590 compare
1591 $(MAKE) all-stage2-gcc
1592
1593new-restage3: all-stage2-gcc
1594 rm -rf all-stage3-gcc compare
1595 $(MAKE) compare
1596
805e22b2 1597# --------------------------------------
1598# Dependencies between different modules
1599# --------------------------------------
1600
1601# There are two types of dependencies here: 'hard' dependencies, where one
1602# module simply won't build without the other; and 'soft' dependencies, where
1603# if the depended-on module is missing, the depending module will do without
1604# or find a substitute somewhere (perhaps installed). Soft dependencies
1605# are specified by depending on a 'maybe-' target. If you're not sure,
1606# it's safer to use a soft dependency.
1607
1608# Host modules specific to gcc.
1609# GCC needs to identify certain tools.
c6976b58 1610# GCC also needs the information exported by the intl configure script.
1611configure-gcc: maybe-configure-intl maybe-configure-binutils maybe-configure-gas maybe-configure-ld maybe-configure-bison maybe-configure-flex
4ee9c684 1612all-gcc: maybe-all-libiberty maybe-all-intl maybe-all-bison maybe-all-byacc maybe-all-binutils maybe-all-gas maybe-all-ld maybe-all-zlib maybe-all-libbanshee
805e22b2 1613# This is a slightly kludgy method of getting dependencies on
1614# all-build-libiberty correct; it would be better to build it every time.
4ee9c684 1615all-gcc: maybe-all-build-libiberty maybe-all-libbanshee
be2c9eb1 1616all-bootstrap: [+ FOR host_modules +][+ IF bootstrap +]maybe-all-[+module+] [+ ENDIF bootstrap +][+ ENDFOR host_modules +]
805e22b2 1617
1618# Host modules specific to gdb.
1619# GDB needs to know that the simulator is being built.
8ca838c4 1620configure-gdb: maybe-configure-itcl maybe-configure-tcl maybe-configure-tk maybe-configure-sim
0311ff84 1621GDB_TK = @GDB_TK@
805e22b2 1622all-gdb: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-mmalloc maybe-all-readline maybe-all-bison maybe-all-byacc maybe-all-sim $(gdbnlmrequirements) $(GDB_TK)
1623install-gdb: maybe-install-tcl maybe-install-tk maybe-install-itcl maybe-install-tix maybe-install-libgui
6c11eefc 1624configure-libgui: maybe-configure-tcl maybe-configure-tk
805e22b2 1625all-libgui: maybe-all-tcl maybe-all-tk maybe-all-itcl
1626
1627# Host modules specific to binutils.
1628configure-bfd: configure-libiberty
1629all-bfd: maybe-all-libiberty maybe-all-intl
1630all-binutils: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-flex maybe-all-bison maybe-all-byacc maybe-all-intl
aca8ad75 1631# We put install-opcodes before install-binutils because the installed
1632# binutils might be on PATH, and they might need the shared opcodes
1633# library.
805e22b2 1634install-binutils: maybe-install-opcodes
a841c4d4 1635# libopcodes depends on libbfd
1636install-opcodes: maybe-install-bfd
805e22b2 1637all-gas: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-intl
1638all-gprof: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-intl
1639all-ld: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-bison maybe-all-byacc maybe-all-flex maybe-all-intl
1640all-opcodes: maybe-all-bfd maybe-all-libiberty
1641
1642# Other host modules in the 'src' repository.
1643all-dejagnu: maybe-all-tcl maybe-all-expect maybe-all-tk
1644configure-expect: maybe-configure-tcl maybe-configure-tk
1645all-expect: maybe-all-tcl maybe-all-tk
1646configure-itcl: maybe-configure-tcl maybe-configure-tk
1647all-itcl: maybe-all-tcl maybe-all-tk
aca8ad75 1648# We put install-tcl before install-itcl because itcl wants to run a
1649# program on installation which uses the Tcl libraries.
805e22b2 1650install-itcl: maybe-install-tcl
621ed2b9 1651all-sid: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-tcl maybe-all-tk
805e22b2 1652install-sid: maybe-install-tcl maybe-install-tk
1653all-sim: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-readline maybe-configure-gdb
1654configure-tk: maybe-configure-tcl
1655all-tk: maybe-all-tcl
1656configure-tix: maybe-configure-tcl maybe-configure-tk
1657all-tix: maybe-all-tcl maybe-all-tk
1658all-texinfo: maybe-all-libiberty
1659
1660# Other host modules. Warning, these are not well tested.
1661all-autoconf: maybe-all-m4 maybe-all-texinfo
1662all-automake: maybe-all-m4 maybe-all-texinfo
1663all-bison: maybe-all-texinfo
1664all-diff: maybe-all-libiberty
1665all-fastjar: maybe-all-zlib maybe-all-libiberty
1666all-fileutils: maybe-all-libiberty
1667all-flex: maybe-all-libiberty maybe-all-bison maybe-all-byacc
805e22b2 1668all-gzip: maybe-all-libiberty
1669all-hello: maybe-all-libiberty
1670all-m4: maybe-all-libiberty maybe-all-texinfo
8a3e139d 1671all-make: maybe-all-libiberty maybe-all-intl
805e22b2 1672all-patch: maybe-all-libiberty
1673all-prms: maybe-all-libiberty
1674all-recode: maybe-all-libiberty
1675all-sed: maybe-all-libiberty
1676all-send-pr: maybe-all-prms
805e22b2 1677all-tar: maybe-all-libiberty
1678all-uudecode: maybe-all-libiberty
1679
1680ALL_GCC = maybe-all-gcc
1681ALL_GCC_C = $(ALL_GCC) maybe-all-target-newlib maybe-all-target-libgloss
1682ALL_GCC_CXX = $(ALL_GCC_C) maybe-all-target-libstdc++-v3
1683
1684# Target modules specific to gcc.
1685configure-target-boehm-gc: $(ALL_GCC_C) maybe-configure-target-qthreads
1686configure-target-fastjar: maybe-configure-target-zlib
1687all-target-fastjar: maybe-all-target-zlib maybe-all-target-libiberty
75fc7adc 1688configure-target-libada: $(ALL_GCC_C)
805e22b2 1689configure-target-libf2c: $(ALL_GCC_C)
1690all-target-libf2c: maybe-all-target-libiberty
4ee9c684 1691configure-target-libgfortran: $(ALL_GCC_C)
805e22b2 1692configure-target-libffi: $(ALL_GCC_C)
1693configure-target-libjava: $(ALL_GCC_C) maybe-configure-target-zlib maybe-configure-target-boehm-gc maybe-configure-target-qthreads maybe-configure-target-libffi
1694all-target-libjava: maybe-all-fastjar maybe-all-target-zlib maybe-all-target-boehm-gc maybe-all-target-qthreads maybe-all-target-libffi
1695configure-target-libobjc: $(ALL_GCC_C)
1696all-target-libobjc: maybe-all-target-libiberty
1697configure-target-libstdc++-v3: $(ALL_GCC_C)
1698all-target-libstdc++-v3: maybe-all-target-libiberty
1699configure-target-zlib: $(ALL_GCC_C)
2a1ac811 1700
805e22b2 1701# Target modules in the 'src' repository.
1702configure-target-examples: $(ALL_GCC_C)
1703configure-target-libgloss: $(ALL_GCC)
1704all-target-libgloss: maybe-configure-target-newlib
7a9bc7f6 1705configure-target-libiberty: $(ALL_GCC)
805e22b2 1706configure-target-libtermcap: $(ALL_GCC_C)
1707configure-target-newlib: $(ALL_GCC)
1708configure-target-rda: $(ALL_GCC_C)
1709configure-target-winsup: $(ALL_GCC_C)
1710all-target-winsup: maybe-all-target-libiberty maybe-all-target-libtermcap
2a1ac811 1711
805e22b2 1712# Other target modules. Warning, these are not well tested.
1713configure-target-gperf: $(ALL_GCC_CXX)
1714all-target-gperf: maybe-all-target-libiberty maybe-all-target-libstdc++-v3
1715configure-target-qthreads: $(ALL_GCC_C)
2a1ac811 1716
805e22b2 1717# Dependencies of maybe-foo on foo. These are used because, for example,
1718# all-gcc only depends on all-gas if gas is present and being configured.
1719@maybe_dependencies@
2a1ac811 1720
805e22b2 1721# Serialization dependencies. Host configures don't work well in parallel to
1722# each other, due to contention over config.cache. Target configures and
1723# build configures are similar.
1724@serialization_dependencies@
2a1ac811 1725
805e22b2 1726# --------------------------------
1727# Regenerating top level configury
1728# --------------------------------
2a1ac811 1729
ca86fd55 1730# Multilib.out tells target dirs what multilibs they should build.
1731# There is really only one copy. We use the 'timestamp' method to
1732# work around various timestamp bugs on some systems.
1733# We use move-if-change so that it's only considered updated when it
1734# actually changes, because it has to depend on a phony target.
11d8013a 1735multilib.out: maybe-all-gcc
7a8ca04a 1736 @r=`${PWD_COMMAND}`; export r; \
ca86fd55 1737 echo "Checking multilib configuration..."; \
1738 $(CC_FOR_TARGET) --print-multi-lib > multilib.tmp 2> /dev/null ; \
1739 $(SHELL) $(srcdir)/move-if-change multilib.tmp multilib.out ; \
ca86fd55 1740
2a1ac811 1741# Rebuilding Makefile.in, using autogen.
041dd099 1742AUTOGEN = autogen
3290c0cf 1743$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
041dd099 1744 cd $(srcdir) && $(AUTOGEN) Makefile.def
2a1ac811 1745
71ab34df 1746# Rebuilding Makefile.
041dd099 1747Makefile: $(srcdir)/Makefile.in config.status
1748 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1749
1750config.status: configure $(gcc_version_trigger)
3a6fbbb0 1751 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
2a1ac811 1752
71ab34df 1753# Rebuilding configure.
041dd099 1754AUTOCONF = autoconf
3290c0cf 1755$(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4
041dd099 1756 cd $(srcdir) && $(AUTOCONF)
2a1ac811 1757
523318a0 1758# ------------------------------
1759# Special directives to GNU Make
1760# ------------------------------
1761
523318a0 1762# Don't pass command-line variables to submakes.
1763.NOEXPORT:
1764MAKEOVERRIDES=
1765
2a1ac811 1766# end of Makefile.in