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