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