]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - Makefile.tpl
2004-04-27 H.J. Lu <hongjiu.lu@intel.com>
[thirdparty/binutils-gdb.git] / Makefile.tpl
CommitLineData
52d7cdee 1[+ AutoGen5 template -*- Mode: Makefile -*-
405ea7a0
NN
2in
3+]
4
5# Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
6#
7# Makefile for directory with subdirs to build.
8# Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
91f0e695 9# 1999, 2000, 2001, 2002, 2003 Free Software Foundation
405ea7a0
NN
10#
11# This file is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24#
25
50212802
NN
26# -------------------------------
27# Standard Autoconf-set variables
28# -------------------------------
583d52d7 29VPATH=@srcdir@
583d52d7
NN
30
31build_alias=@build_alias@
7f121bbf 32build=@build@
583d52d7 33host_alias=@host_alias@
7f121bbf 34host=@host@
583d52d7 35target_alias=@target_alias@
7f121bbf 36target=@target@
583d52d7 37
50212802 38program_transform_name = @program_transform_name@
c66d951e
NN
39
40prefix = @prefix@
41exec_prefix = @exec_prefix@
42
50212802
NN
43srcdir = @srcdir@
44
c66d951e
NN
45bindir = @bindir@
46sbindir = @sbindir@
47libexecdir = @libexecdir@
48datadir = @datadir@
49sysconfdir = @sysconfdir@
50sharedstatedir = @sharedstatedir@
51localstatedir = @localstatedir@
52libdir = @libdir@
53includedir = @includedir@
54oldincludedir = @oldincludedir@
55infodir = @infodir@
56mandir = @mandir@
405ea7a0
NN
57man1dir = $(mandir)/man1
58man2dir = $(mandir)/man2
59man3dir = $(mandir)/man3
60man4dir = $(mandir)/man4
61man5dir = $(mandir)/man5
62man6dir = $(mandir)/man6
63man7dir = $(mandir)/man7
64man8dir = $(mandir)/man8
65man9dir = $(mandir)/man9
405ea7a0 66
e5c3f801
NN
67INSTALL = @INSTALL@
68INSTALL_PROGRAM = @INSTALL_PROGRAM@
69INSTALL_SCRIPT = @INSTALL_SCRIPT@
70INSTALL_DATA = @INSTALL_DATA@
405ea7a0 71
50212802
NN
72# -------------------------------------------------
73# Miscellaneous non-standard autoconf-set variables
74# -------------------------------------------------
405ea7a0 75
50212802
NN
76# The file containing GCC's version number.
77gcc_version_trigger = @gcc_version_trigger@
78gcc_version = @gcc_version@
405ea7a0 79
50212802
NN
80# The gcc driver likes to know the arguments it was configured with.
81TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
405ea7a0 82
50212802
NN
83gxx_include_dir = @gxx_include_dir@
84libstdcxx_incdir = @libstdcxx_incdir@
405ea7a0 85
50212802
NN
86tooldir = @tooldir@
87build_tooldir = @build_tooldir@
405ea7a0 88
50212802 89# Directory in which the compiler finds executables, libraries, etc.
ede4fbe4 90libsubdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)
50212802 91GDB_NLM_DEPS =
405ea7a0 92
50212802
NN
93# This is the name of the environment variable used for the path to
94# the libraries.
95RPATH_ENVVAR = @RPATH_ENVVAR@
405ea7a0 96
50212802
NN
97# This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
98# was used.
99SET_LIB_PATH = @SET_LIB_PATH@
405ea7a0 100
50212802
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);
405ea7a0 106
50212802
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.
b40e3958
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}
50212802
NN
143
144# compilers to use to create programs which must be run in the build
145# environment.
146CC_FOR_BUILD = @CC_FOR_BUILD@
5fbad20a 147CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
50212802
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.
50212802
NN
153BUILD_PREFIX = @BUILD_PREFIX@
154BUILD_PREFIX_1 = @BUILD_PREFIX_1@
405ea7a0 155
852e5f18
NN
156BISON=@BISON@
157USUAL_BISON = `if [ -f $$r/bison/bison ] ; then \
405ea7a0
NN
158 echo $$r/bison/bison -L $$s/bison/ ; \
159 else \
160 echo bison ; \
161 fi`
162
50212802 163DEFAULT_YACC = @DEFAULT_YACC@
852e5f18
NN
164YACC=@YACC@
165USUAL_YACC = `if [ -f $$r/bison/bison ] ; then \
405ea7a0
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
50212802 173DEFAULT_LEX = @DEFAULT_LEX@
852e5f18
NN
174LEX=@LEX@
175USUAL_LEX = `if [ -f $$r/flex/flex ] ; \
405ea7a0
NN
176 then echo $$r/flex/flex ; \
177 else echo ${DEFAULT_LEX} ; fi`
178
50212802 179DEFAULT_M4 = @DEFAULT_M4@
405ea7a0
NN
180M4 = `if [ -f $$r/m4/m4 ] ; \
181 then echo $$r/m4/m4 ; \
182 else echo ${DEFAULT_M4} ; fi`
183
77f7441a 184# For an installed makeinfo, we require it to be from texinfo 4.2 or
405ea7a0 185# higher, else we use the "missing" dummy.
852e5f18
NN
186MAKEINFO=@MAKEINFO@
187USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \
405ea7a0
NN
188 then echo $$r/texinfo/makeinfo/makeinfo ; \
189 else if (makeinfo --version \
77f7441a 190 | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])') >/dev/null 2>&1; \
405ea7a0
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.
62a3fc85
DD
196# (Default to avoid splitting info files by setting the threshold high.)
197MAKEINFOFLAGS = --split-size=5000000
405ea7a0
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
50212802
NN
207# ---------------------------------------------
208# Programs producing files for the HOST machine
209# ---------------------------------------------
405ea7a0 210
50212802
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
405ea7a0 214
50212802 215AS = @AS@
405ea7a0 216
50212802
NN
217AR = @AR@
218AR_FLAGS = rc
405ea7a0 219
50212802
NN
220CC = @CC@
221CFLAGS = @CFLAGS@
222LIBCFLAGS = $(CFLAGS)
405ea7a0 223
50212802
NN
224CXX = @CXX@
225CXXFLAGS = @CXXFLAGS@
226LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
405ea7a0 227
50212802 228DLLTOOL = @DLLTOOL@
405ea7a0 229
50212802 230NM = @NM@
15723a45 231
50212802
NN
232LD = @LD@
233LDFLAGS =
15723a45 234
50212802 235RANLIB = @RANLIB@
405ea7a0 236
50212802 237WINDRES = @WINDRES@
405ea7a0 238
50212802
NN
239PICFLAG =
240
241# -----------------------------------------------
242# Programs producing files for the TARGET machine
243# -----------------------------------------------
405ea7a0
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
58daee98 249FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
405ea7a0 250
50212802 251AR_FOR_TARGET=@AR_FOR_TARGET@
54752a6b 252CONFIGURED_AR_FOR_TARGET=@CONFIGURED_AR_FOR_TARGET@
50212802
NN
253USUAL_AR_FOR_TARGET = ` \
254 if [ -f $$r/binutils/ar ] ; then \
255 echo $$r/binutils/ar ; \
256 else \
7f121bbf 257 if [ '$(host)' = '$(target)' ] ; then \
50212802
NN
258 echo $(AR); \
259 else \
54752a6b 260 echo $(CONFIGURED_AR_FOR_TARGET) ; \
50212802
NN
261 fi; \
262 fi`
405ea7a0 263
852e5f18 264AS_FOR_TARGET=@AS_FOR_TARGET@
54752a6b 265CONFIGURED_AS_FOR_TARGET=@CONFIGURED_AS_FOR_TARGET@
852e5f18 266USUAL_AS_FOR_TARGET = ` \
405ea7a0
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 \
7f121bbf 272 if [ '$(host)' = '$(target)' ] ; then \
405ea7a0
NN
273 echo $(AS); \
274 else \
54752a6b 275 echo $(CONFIGURED_AS_FOR_TARGET) ; \
405ea7a0
NN
276 fi; \
277 fi`
278
50212802
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
405ea7a0 299
852e5f18 300DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
54752a6b 301CONFIGURED_DLLTOOL_FOR_TARGET=@CONFIGURED_DLLTOOL_FOR_TARGET@
852e5f18 302USUAL_DLLTOOL_FOR_TARGET = ` \
405ea7a0
NN
303 if [ -f $$r/binutils/dlltool ] ; then \
304 echo $$r/binutils/dlltool ; \
305 else \
7f121bbf 306 if [ '$(host)' = '$(target)' ] ; then \
405ea7a0
NN
307 echo $(DLLTOOL); \
308 else \
54752a6b 309 echo $(CONFIGURED_DLLTOOL_FOR_TARGET) ; \
405ea7a0
NN
310 fi; \
311 fi`
312
50212802
NN
313GCJ_FOR_TARGET = @GCJ_FOR_TARGET@
314
315LD_FOR_TARGET=@LD_FOR_TARGET@
54752a6b 316CONFIGURED_LD_FOR_TARGET=@CONFIGURED_LD_FOR_TARGET@
50212802
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 ; \
405ea7a0 322 else \
7f121bbf 323 if [ '$(host)' = '$(target)' ] ; then \
50212802 324 echo $(LD); \
405ea7a0 325 else \
54752a6b 326 echo $(CONFIGURED_LD_FOR_TARGET) ; \
405ea7a0
NN
327 fi; \
328 fi`
329
50212802
NN
330LDFLAGS_FOR_TARGET =
331
332NM_FOR_TARGET=@NM_FOR_TARGET@
54752a6b 333CONFIGURED_NM_FOR_TARGET=@CONFIGURED_NM_FOR_TARGET@
50212802
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 ; \
405ea7a0 339 else \
7f121bbf 340 if [ '$(host)' = '$(target)' ] ; then \
50212802 341 echo $(NM); \
405ea7a0 342 else \
54752a6b 343 echo $(CONFIGURED_NM_FOR_TARGET) ; \
405ea7a0
NN
344 fi; \
345 fi`
346
852e5f18 347RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
54752a6b 348CONFIGURED_RANLIB_FOR_TARGET=@CONFIGURED_RANLIB_FOR_TARGET@
852e5f18 349USUAL_RANLIB_FOR_TARGET = ` \
405ea7a0
NN
350 if [ -f $$r/binutils/ranlib ] ; then \
351 echo $$r/binutils/ranlib ; \
352 else \
7f121bbf 353 if [ '$(host)' = '$(target)' ] ; then \
405ea7a0
NN
354 if [ x'$(RANLIB)' != x ]; then \
355 echo $(RANLIB); \
356 else \
357 echo ranlib; \
358 fi; \
359 else \
54752a6b 360 echo $(CONFIGURED_RANLIB_FOR_TARGET) ; \
405ea7a0
NN
361 fi; \
362 fi`
363
50212802 364WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
54752a6b 365CONFIGURED_WINDRES_FOR_TARGET=@CONFIGURED_WINDRES_FOR_TARGET@
50212802
NN
366USUAL_WINDRES_FOR_TARGET = ` \
367 if [ -f $$r/binutils/windres ] ; then \
368 echo $$r/binutils/windres ; \
405ea7a0 369 else \
7f121bbf 370 if [ '$(host)' = '$(target)' ] ; then \
50212802 371 echo $(WINDRES); \
405ea7a0 372 else \
54752a6b 373 echo $(CONFIGURED_WINDRES_FOR_TARGET) ; \
405ea7a0
NN
374 fi; \
375 fi`
376
50212802
NN
377PICFLAG_FOR_TARGET =
378
379# ------------------------------------
380# Miscellaneous targets and flag lists
381# ------------------------------------
382
405ea7a0
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
405ea7a0 388#### host and target specific makefile fragments come in here.
a0da8069
NN
389@target_makefile_frag@
390@alphaieee_frag@
391@ospace_frag@
392@host_makefile_frag@
405ea7a0
NN
393###
394
395# Flags to pass down to all sub-makes.
12f0bd74
NN
396BASE_FLAGS_TO_PASS = [+ FOR flags_to_pass +]\
397 "[+flag+]=$([+flag+])" [+ ENDFOR flags_to_pass +]\
10ecffb9 398 "CONFIG_SHELL=$(SHELL)" \
12f0bd74 399 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"
405ea7a0
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 = \
930314a4
NN
407 CXX_FOR_TARGET='$(CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \
408 RAW_CXX_FOR_TARGET='$(RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \
405ea7a0
NN
409
410# Flags to pass down to most sub-makes, in which we're building with
411# the host environment.
405ea7a0
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)' \
b9459e83 420 'RANLIB=$(RANLIB)' \
405ea7a0
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.
405ea7a0
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.
2a4cbe27 461# The BUILD_* variables are a special case, which are used for the gcc
405ea7a0
NN
462# cross-building scheme.
463EXTRA_GCC_FLAGS = \
405ea7a0
NN
464 'BUILD_PREFIX=$(BUILD_PREFIX)' \
465 'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \
405ea7a0
NN
466 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
467 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
3dee29da
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=/'`"
405ea7a0 477
f0b24077 478GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
405ea7a0 479
dd12c3a8
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 +]
405ea7a0 490
405ea7a0
NN
491# The target built for a native build.
492.PHONY: all.normal
dd12c3a8
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 +]
405ea7a0
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).
e393202e 510[+ FOR recursive_targets +]
27b1cc72 511.PHONY: do-[+make_target+]
2a4cbe27
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 +]
e393202e
NN
525[+ ENDFOR recursive_targets +]
526
405ea7a0
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
43d92c63
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
405ea7a0
NN
539
540install-info: do-install-info dir.info
b40e3958 541 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
405ea7a0 542 if [ -f dir.info ] ; then \
497f816e 543 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
405ea7a0
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
e6bfb94a 551 -rm -f multilib.out multilib.tmp maybedep.tmp serdep.tmp
405ea7a0
NN
552 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
553 rm -rf $(TARGET_SUBDIR); \
554 else true; fi
e4c4d240 555 -rm -rf $(BUILD_SUBDIR)
405ea7a0
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
2a4cbe27
NN
573# Extra dependency for clean-target, owing to the mixed nature of gcc
574clean-target: clean-target-libgcc
405ea7a0
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
ede4fbe4 584check: do-check
405ea7a0 585
3866be5d 586# Only include modules actually being configured and built.
16ae0395
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 +]
405ea7a0
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
ae831be5 618.PHONY: install uninstall
dd12c3a8
NN
619install: installdirs install-host install-target
620
16ae0395
NN
621.PHONY: install-host-nogcc
622install-host-nogcc: [+
623 FOR host_modules +] \
624 maybe-install-[+module+][+
625 ENDFOR host_modules +]
626
dd12c3a8
NN
627.PHONY: install-host
628install-host: maybe-install-gcc [+
629 FOR host_modules +] \
630 maybe-install-[+module+][+
631 ENDFOR host_modules +]
16ae0395 632
dd12c3a8
NN
633.PHONY: install-target
634install-target: [+
635 FOR target_modules +] \
636 maybe-install-target-[+module+][+
637 ENDFOR target_modules +]
405ea7a0
NN
638
639uninstall:
640 @echo "the uninstall target is not supported in this tree"
641
405ea7a0
NN
642.PHONY: install.all
643install.all: install-no-fixedincludes
644 @if [ -f ./gcc/Makefile ] ; then \
b40e3958 645 r=`${PWD_COMMAND}` ; export r ; \
405ea7a0 646 $(SET_LIB_PATH) \
1086bc09 647 (cd ./gcc && \
405ea7a0
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
16ae0395 656install-no-fixedincludes: installdirs install-host-nogcc \
dd12c3a8 657 install-target gcc-no-fixedincludes
405ea7a0 658
15723a45 659### other supporting targets
405ea7a0 660
15723a45
NN
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 \
497f816e 670 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
15723a45
NN
671 mv -f dir.info.new dir.info ; \
672 else true ; \
405ea7a0
NN
673 fi
674
15723a45
NN
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
15723a45
NN
689# --------------------------------------
690# Modules which run on the build machine
691# --------------------------------------
692[+ FOR build_modules +]
930314a4
NN
693.PHONY: configure-build-[+module+] maybe-configure-build-[+module+]
694maybe-configure-build-[+module+]:
e6bfb94a
AO
695configure-build-[+module+]:
696 @test ! -f $(BUILD_SUBDIR)/[+module+]/Makefile || exit 0; \
9175bfc0 697 $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/[+module+] ; \
b40e3958
L
698 r=`${PWD_COMMAND}`; export r; \
699 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
bba45b8b
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; \
10ecffb9 704 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
bba45b8b
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 \
405ea7a0
NN
721 .) topdir="../$(srcdir)" ;; \
722 *) topdir="../../$(srcdir)" ;; \
bba45b8b
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; \
405ea7a0 734 else \
bba45b8b 735 true; \
405ea7a0 736 fi; \
405ea7a0 737 else \
bba45b8b 738 exit 1; \
405ea7a0 739 fi; \
bba45b8b
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
15723a45
NN
754
755.PHONY: all-build-[+module+] maybe-all-build-[+module+]
756maybe-all-build-[+module+]:
757all-build-[+module+]: configure-build-[+module+]
b40e3958
L
758 @r=`${PWD_COMMAND}`; export r; \
759 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
bba45b8b 760 (cd $(BUILD_SUBDIR)/[+module+] && $(MAKE) all)
e393202e 761[+ ENDFOR build_modules +]
405ea7a0 762
15723a45
NN
763# --------------------------------------
764# Modules which run on the host machine
765# --------------------------------------
3866be5d 766[+ FOR host_modules +]
e2b9e2dc
NN
767.PHONY: configure-[+module+] maybe-configure-[+module+]
768maybe-configure-[+module+]:
e6bfb94a
AO
769configure-[+module+]:
770 @test ! -f [+module+]/Makefile || exit 0; \
771 [ -d [+module+] ] || mkdir [+module+]; \
b40e3958
L
772 r=`${PWD_COMMAND}`; export r; \
773 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
e2b9e2dc
NN
774 CC="$(CC)"; export CC; \
775 CFLAGS="$(CFLAGS)"; export CFLAGS; \
10ecffb9 776 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
e2b9e2dc
NN
777 CXX="$(CXX)"; export CXX; \
778 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
ec7e0995
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; \
51860f05 784 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
ec7e0995
NN
785 NM="$(NM)"; export NM; \
786 RANLIB="$(RANLIB)"; export RANLIB; \
787 WINDRES="$(WINDRES)"; export WINDRES; \
788 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
789 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
e2b9e2dc
NN
790 echo Configuring in [+module+]; \
791 cd [+module+] || exit 1; \
792 case $(srcdir) in \
793 \.) \
794 srcdiroption="--srcdir=."; \
795 libsrcdir=".";; \
796 /* | [A-Za-z]:[\\/]*) \
797 srcdiroption="--srcdir=$(srcdir)/[+module+]"; \
798 libsrcdir="$$s/[+module+]";; \
799 *) \
800 srcdiroption="--srcdir=../$(srcdir)/[+module+]"; \
801 libsrcdir="$$s/[+module+]";; \
802 esac; \
803 $(SHELL) $${libsrcdir}/configure \
804 $(HOST_CONFIGARGS) $${srcdiroption} \
805 || exit 1
806
930314a4
NN
807.PHONY: all-[+module+] maybe-all-[+module+]
808maybe-all-[+module+]:
db1ac78d 809all-[+module+]: configure-[+module+]
b40e3958
L
810 @r=`${PWD_COMMAND}`; export r; \
811 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
bba45b8b
NN
812 $(SET_LIB_PATH) \
813 (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+
814 IF with_x
815 +] $(X11_FLAGS_TO_PASS)[+
816 ENDIF with_x +] all)
405ea7a0 817
16ae0395
NN
818.PHONY: check-[+module+] maybe-check-[+module+]
819maybe-check-[+module+]:
3866be5d 820[+ IF no_check +]
3866be5d
NN
821check-[+module+]:
822[+ ELIF no_check_cross +]
3866be5d
NN
823# This module is only tested in a native toolchain.
824check-[+module+]:
7f121bbf 825 @if [ '$(host)' = '$(target)' ] ; then \
b40e3958
L
826 r=`${PWD_COMMAND}`; export r; \
827 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
405ea7a0 828 $(SET_LIB_PATH) \
1086bc09 829 (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+
3866be5d
NN
830 IF with_x
831 +] $(X11_FLAGS_TO_PASS)[+
bba45b8b
NN
832 ENDIF with_x +] check); \
833 fi
834[+ ELSE check +]
bba45b8b 835check-[+module+]:
b40e3958
L
836 @r=`${PWD_COMMAND}`; export r; \
837 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
bba45b8b
NN
838 $(SET_LIB_PATH) \
839 (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+
840 IF with_x
841 +] $(X11_FLAGS_TO_PASS)[+
842 ENDIF with_x +] check)
3866be5d 843[+ ENDIF no_check +]
405ea7a0 844
930314a4
NN
845.PHONY: install-[+module+] maybe-install-[+module+]
846maybe-install-[+module+]:
16ae0395 847[+ IF no_install +]
3866be5d
NN
848install-[+module+]:
849[+ ELSE install +]
3866be5d 850install-[+module+]: installdirs
b40e3958
L
851 @r=`${PWD_COMMAND}`; export r; \
852 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
bba45b8b
NN
853 $(SET_LIB_PATH) \
854 (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+
855 IF with_x
856 +] $(X11_FLAGS_TO_PASS)[+
857 ENDIF with_x +] install)
3866be5d 858[+ ENDIF no_install +]
4fa63067
NN
859
860# Other targets (info, dvi, etc.)
861[+ FOR recursive_targets +]
862.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
863maybe-[+make_target+]-[+module+]:
864[+ IF (match-value? = "missing" (get "make_target") ) +]
865# [+module+] doesn't support [+make_target+].
866[+make_target+]-[+module+]:
867[+ ELSE +]
868[+make_target+]-[+module+]: [+
869 FOR depend +]\
870 [+depend+]-[+module+] [+
871 ENDFOR depend +]
872 @[ -f ./[+module+]/Makefile ] || exit 0; \
873 r=`${PWD_COMMAND}`; export r; \
874 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
875 $(SET_LIB_PATH) \
876 for flag in $(EXTRA_HOST_FLAGS); do \
877 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
878 done; \
879 echo "Doing [+make_target+] in [+module+]" ; \
880 (cd [+module+] && \
881 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
882 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
883 "RANLIB=$${RANLIB}" \
884 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
885 [+make_target+]) \
886 || exit 1
887[+ ENDIF +]
888[+ ENDFOR recursive_targets +]
3866be5d 889[+ ENDFOR host_modules +]
405ea7a0 890
15723a45
NN
891# ---------------------------------------
892# Modules which run on the target machine
893# ---------------------------------------
e393202e 894[+ FOR target_modules +]
930314a4
NN
895.PHONY: configure-target-[+module+] maybe-configure-target-[+module+]
896maybe-configure-target-[+module+]:
15723a45 897
1086bc09
NN
898# There's only one multilib.out. Cleverer subdirs shouldn't need it copied.
899$(TARGET_SUBDIR)/[+module+]/multilib.out: multilib.out
9175bfc0 900 $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/[+module+] ; \
e6bfb94a 901 rm -f $(TARGET_SUBDIR)/[+module+]/Makefile || : ; \
1086bc09 902 cp multilib.out $(TARGET_SUBDIR)/[+module+]/multilib.out
15723a45 903
e6bfb94a
AO
904configure-target-[+module+]: $(TARGET_SUBDIR)/[+module+]/multilib.out
905 @test ! -f $(TARGET_SUBDIR)/[+module+]/Makefile || exit 0; \
9175bfc0 906 $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/[+module+] ; \
b40e3958
L
907 r=`${PWD_COMMAND}`; export r; \
908 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
bba45b8b
NN
909 $(SET_LIB_PATH) \
910 AR="$(AR_FOR_TARGET)"; export AR; \
911 AS="$(AS_FOR_TARGET)"; export AS; \
912 CC="$(CC_FOR_TARGET)"; export CC; \
913 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
10ecffb9 914 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
bba45b8b
NN
915 CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \[+
916IF raw_cxx +]
917 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
918 CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \[+
919ELSE normal_cxx +]
920 CXX="$(CXX_FOR_TARGET)"; export CXX; \[+
921ENDIF raw_cxx +]
922 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
923 GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
924 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
925 LD="$(LD_FOR_TARGET)"; export LD; \
926 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
927 NM="$(NM_FOR_TARGET)"; export NM; \
928 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
929 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
930 echo Configuring in $(TARGET_SUBDIR)/[+module+]; \
931 cd "$(TARGET_SUBDIR)/[+module+]" || exit 1; \
932 case $(srcdir) in \
933 /* | [A-Za-z]:[\\/]*) \
934 topdir=$(srcdir) ;; \
935 *) \
936 case "$(TARGET_SUBDIR)" in \
405ea7a0
NN
937 .) topdir="../$(srcdir)" ;; \
938 *) topdir="../../$(srcdir)" ;; \
bba45b8b 939 esac ;; \
a6d6062d 940 esac; \[+ IF stage +]
bba45b8b
NN
941 if [ "$(srcdir)" = "." ] ; then \
942 if [ "$(TARGET_SUBDIR)" != "." ] ; then \
943 if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \
944 if [ -f Makefile ]; then \
945 if $(MAKE) distclean; then \
946 true; \
947 else \
948 exit 1; \
949 fi; \
405ea7a0 950 else \
bba45b8b 951 true; \
405ea7a0 952 fi; \
405ea7a0 953 else \
bba45b8b 954 exit 1; \
405ea7a0 955 fi; \
bba45b8b
NN
956 else \
957 true; \
958 fi; \
959 srcdiroption="--srcdir=."; \
960 libsrcdir="."; \
a6d6062d 961 else \[+ ENDIF stage +]
bba45b8b 962 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
a6d6062d
DD
963 libsrcdir="$$s/[+module+]"; \[+ IF stage +]
964 fi; \[+ ENDIF stage +]
bba45b8b
NN
965 rm -f no-such-file || : ; \
966 CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
967 $(TARGET_CONFIGARGS) $${srcdiroption} \
968 --with-target-subdir="$(TARGET_SUBDIR)" \
969 || exit 1
405ea7a0 970
930314a4
NN
971.PHONY: all-target-[+module+] maybe-all-target-[+module+]
972maybe-all-target-[+module+]:
15723a45 973all-target-[+module+]: configure-target-[+module+]
b40e3958
L
974 @r=`${PWD_COMMAND}`; export r; \
975 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
bba45b8b
NN
976 $(SET_LIB_PATH) \
977 (cd $(TARGET_SUBDIR)/[+module+] && \
978 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
979 IF raw_cxx
980 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
981 ENDIF raw_cxx
982 +] all)
16ae0395
NN
983
984.PHONY: check-target-[+module+] maybe-check-target-[+module+]
985maybe-check-target-[+module+]:
3866be5d
NN
986[+ IF no_check +]
987# Dummy target for uncheckable module.
3866be5d
NN
988check-target-[+module+]:
989[+ ELSE check +]
e393202e 990check-target-[+module+]:
b40e3958
L
991 @r=`${PWD_COMMAND}`; export r; \
992 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
bba45b8b
NN
993 $(SET_LIB_PATH) \
994 (cd $(TARGET_SUBDIR)/[+module+] && \
995 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
996 IF raw_cxx
997 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
998 ENDIF raw_cxx
999 +] check)
e393202e 1000[+ ENDIF no_check +]
16ae0395 1001
930314a4
NN
1002.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1003maybe-install-target-[+module+]:
16ae0395 1004[+ IF no_install +]
930314a4
NN
1005# Dummy target for uninstallable.
1006install-target-[+module+]:
1007[+ ELSE install +]
e393202e 1008install-target-[+module+]: installdirs
b40e3958
L
1009 @r=`${PWD_COMMAND}`; export r; \
1010 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
bba45b8b
NN
1011 $(SET_LIB_PATH) \
1012 (cd $(TARGET_SUBDIR)/[+module+] && \
1013 $(MAKE) $(TARGET_FLAGS_TO_PASS) install)
e393202e 1014[+ ENDIF no_install +]
4fa63067
NN
1015
1016# Other targets (info, dvi, etc.)
1017[+ FOR recursive_targets +]
1018.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1019maybe-[+make_target+]-target-[+module+]:
1020[+ IF (match-value? = "missing" (get "make_target") ) +]
1021# [+module+] doesn't support [+make_target+].
1022[+make_target+]-target-[+module+]:
1023[+ ELSE +]
1024[+make_target+]-target-[+module+]: [+
1025 FOR depend +]\
1026 [+depend+]-target-[+module+] [+
1027 ENDFOR depend +]
1028 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1029 r=`${PWD_COMMAND}`; export r; \
1030 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1031 $(SET_LIB_PATH) \
1032 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1033 for flag in $(EXTRA_TARGET_FLAGS); do \
1034 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1035 done; \
1036 (cd $(TARGET_SUBDIR)/[+module+] && \
1037 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1038 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1039 "RANLIB=$${RANLIB}" \
1040 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
1041 [+make_target+]) \
1042 || exit 1
1043[+ ENDIF +]
1044[+ ENDFOR recursive_targets +]
e393202e 1045[+ ENDFOR target_modules +]
405ea7a0 1046
15723a45
NN
1047# ----------
1048# GCC module
1049# ----------
1050
1051# Unfortunately, while gcc _should_ be a host module,
1052# libgcc is a target module, and gen* programs are
1053# build modules. So GCC is a sort of hybrid.
1054
405ea7a0 1055# gcc is the only module which uses GCC_FLAGS_TO_PASS.
ac7b618e
NN
1056# Don't use shared host config.cache, as it will confuse later
1057# directories; GCC wants slightly different values for some
1058# precious variables. *sigh*
1d39f329
NN
1059
1060# We must skip configuring if toplevel bootstrap is going.
e2b9e2dc
NN
1061.PHONY: configure-gcc maybe-configure-gcc
1062maybe-configure-gcc:
e6bfb94a
AO
1063configure-gcc:
1064 @test ! -f gcc/Makefile || exit 0; \
1d39f329 1065 [ -f stage_last ] && exit 0; \
e6bfb94a 1066 [ -d gcc ] || mkdir gcc; \
b40e3958
L
1067 r=`${PWD_COMMAND}`; export r; \
1068 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
e2b9e2dc
NN
1069 CC="$(CC)"; export CC; \
1070 CFLAGS="$(CFLAGS)"; export CFLAGS; \
10ecffb9 1071 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
e2b9e2dc
NN
1072 CXX="$(CXX)"; export CXX; \
1073 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
586c0873 1074 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
ec7e0995
NN
1075 AR="$(AR)"; export AR; \
1076 AS="$(AS)"; export AS; \
1077 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
1078 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
1079 LD="$(LD)"; export LD; \
51860f05 1080 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
ec7e0995
NN
1081 NM="$(NM)"; export NM; \
1082 RANLIB="$(RANLIB)"; export RANLIB; \
1083 WINDRES="$(WINDRES)"; export WINDRES; \
1084 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
1085 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
e2b9e2dc
NN
1086 echo Configuring in gcc; \
1087 cd gcc || exit 1; \
1088 case $(srcdir) in \
1089 \.) \
1090 srcdiroption="--srcdir=."; \
1091 libsrcdir=".";; \
1092 /* | [A-Za-z]:[\\/]*) \
1093 srcdiroption="--srcdir=$(srcdir)/gcc"; \
1094 libsrcdir="$$s/gcc";; \
1095 *) \
1096 srcdiroption="--srcdir=../$(srcdir)/gcc"; \
1097 libsrcdir="$$s/gcc";; \
1098 esac; \
1099 $(SHELL) $${libsrcdir}/configure \
bb5dca17 1100 $(HOST_CONFIGARGS) $${srcdiroption} \
e2b9e2dc
NN
1101 || exit 1
1102
b72e6a2d
JM
1103# Don't 'make all' in gcc if it's already been made by 'bootstrap'; that
1104# causes trouble. This wart will be fixed eventually by moving
db1ac78d 1105# the bootstrap behavior to this file.
930314a4
NN
1106.PHONY: all-gcc maybe-all-gcc
1107maybe-all-gcc:
db1ac78d 1108all-gcc: configure-gcc
1d39f329
NN
1109 r=`${PWD_COMMAND}`; export r; \
1110 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1111 if [ -f stage_last ] ; then \
1112 true ; \
1113 elif [ -f gcc/stage_last ] ; then \
b72e6a2d 1114 $(SET_LIB_PATH) \
1086bc09 1115 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) quickstrap); \
db1ac78d 1116 else \
405ea7a0 1117 $(SET_LIB_PATH) \
1086bc09 1118 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) all); \
405ea7a0
NN
1119 fi
1120
1121# Building GCC uses some tools for rebuilding "source" files
1122# like texinfo, bison/byacc, etc. So we must depend on those.
1123#
1124# While building GCC, it may be necessary to run various target
1125# programs like the assembler, linker, etc. So we depend on
1126# those too.
1127#
1128# In theory, on an SMP all those dependencies can be resolved
1129# in parallel.
1130#
5b474aa8
DD
1131GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap
1132.PHONY: $(GCC_STRAP_TARGETS)
1133$(GCC_STRAP_TARGETS): all-bootstrap configure-gcc
b40e3958
L
1134 @r=`${PWD_COMMAND}`; export r; \
1135 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
405ea7a0
NN
1136 $(SET_LIB_PATH) \
1137 echo "Bootstrapping the compiler"; \
1138 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
b40e3958
L
1139 @r=`${PWD_COMMAND}`; export r; \
1140 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
405ea7a0
NN
1141 case "$@" in \
1142 *bootstrap4-lean ) \
bba45b8b
NN
1143 msg="Comparing stage3 and stage4 of the compiler"; \
1144 compare=compare3-lean ;; \
1145 *bootstrap4 ) \
1146 msg="Comparing stage3 and stage4 of the compiler"; \
1147 compare=compare3 ;; \
1148 *-lean ) \
1149 msg="Comparing stage2 and stage3 of the compiler"; \
1150 compare=compare-lean ;; \
1151 * ) \
1152 msg="Comparing stage2 and stage3 of the compiler"; \
1153 compare=compare ;; \
405ea7a0
NN
1154 esac; \
1155 $(SET_LIB_PATH) \
1156 echo "$$msg"; \
1157 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
b40e3958
L
1158 @r=`${PWD_COMMAND}`; export r; \
1159 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
405ea7a0
NN
1160 $(SET_LIB_PATH) \
1161 echo "Building runtime libraries"; \
1162 $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all
1163
ec7e0995 1164profiledbootstrap: all-bootstrap configure-gcc
b40e3958
L
1165 @r=`${PWD_COMMAND}`; export r; \
1166 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
ec7e0995
NN
1167 $(SET_LIB_PATH) \
1168 echo "Bootstrapping the compiler"; \
1169 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build
b40e3958
L
1170 @r=`${PWD_COMMAND}`; export r; \
1171 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
ec7e0995
NN
1172 $(SET_LIB_PATH) \
1173 echo "Building runtime libraries and training compiler"; \
1174 $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all
b40e3958
L
1175 @r=`${PWD_COMMAND}`; export r; \
1176 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
ec7e0995
NN
1177 $(SET_LIB_PATH) \
1178 echo "Building feedback based compiler"; \
1179 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build
1180
405ea7a0
NN
1181.PHONY: cross
1182cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
b40e3958
L
1183 @r=`${PWD_COMMAND}`; export r; \
1184 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
405ea7a0
NN
1185 $(SET_LIB_PATH) \
1186 echo "Building the C and C++ compiler"; \
1187 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
b40e3958
L
1188 @r=`${PWD_COMMAND}`; export r; \
1189 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
405ea7a0
NN
1190 $(SET_LIB_PATH) \
1191 echo "Building runtime libraries"; \
1192 $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) \
1193 LANGUAGES="c c++" all
1194
8945c6bb 1195.PHONY: check-gcc maybe-check-gcc
44482353 1196maybe-check-gcc:
405ea7a0
NN
1197check-gcc:
1198 @if [ -f ./gcc/Makefile ] ; then \
b40e3958
L
1199 r=`${PWD_COMMAND}`; export r; \
1200 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
405ea7a0 1201 $(SET_LIB_PATH) \
1086bc09 1202 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check); \
405ea7a0
NN
1203 else \
1204 true; \
1205 fi
1206
7d695d07
JM
1207.PHONY: check-gcc-c++
1208check-gcc-c++:
405ea7a0 1209 @if [ -f ./gcc/Makefile ] ; then \
b40e3958
L
1210 r=`${PWD_COMMAND}`; export r; \
1211 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
405ea7a0 1212 $(SET_LIB_PATH) \
1086bc09 1213 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
405ea7a0
NN
1214 else \
1215 true; \
7d695d07
JM
1216 fi
1217
1218.PHONY: check-c++
ede4fbe4 1219check-c++: check-target-libstdc++-v3 check-gcc-c++
405ea7a0 1220
930314a4
NN
1221.PHONY: install-gcc maybe-install-gcc
1222maybe-install-gcc:
405ea7a0
NN
1223install-gcc:
1224 @if [ -f ./gcc/Makefile ] ; then \
b40e3958
L
1225 r=`${PWD_COMMAND}`; export r; \
1226 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
405ea7a0 1227 $(SET_LIB_PATH) \
1086bc09 1228 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
405ea7a0
NN
1229 else \
1230 true; \
1231 fi
1232
15723a45
NN
1233# Install the gcc headers files, but not the fixed include files,
1234# which Cygnus is not allowed to distribute. This rule is very
1235# dependent on the workings of the gcc Makefile.in.
1236.PHONY: gcc-no-fixedincludes
1237gcc-no-fixedincludes:
1238 @if [ -f ./gcc/Makefile ]; then \
1239 rm -rf gcc/tmp-include; \
1240 mv gcc/include gcc/tmp-include 2>/dev/null; \
1241 mkdir gcc/include; \
1242 cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1243 touch gcc/stmp-fixinc gcc/include/fixed; \
1244 rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
b40e3958
L
1245 r=`${PWD_COMMAND}`; export r; \
1246 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
15723a45 1247 $(SET_LIB_PATH) \
1086bc09 1248 (cd ./gcc && \
15723a45
NN
1249 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1250 rm -rf gcc/include; \
1251 mv gcc/tmp-include gcc/include 2>/dev/null; \
1252 else true; fi
1253
4fa63067
NN
1254# Other targets (dvi, info, etc.)
1255[+ FOR recursive_targets +]
1256.PHONY: maybe-[+make_target+]-gcc [+make_target+]-gcc
1257maybe-[+make_target+]-gcc:
1258[+make_target+]-gcc: [+
1259 FOR depend +]\
1260 [+depend+]-gcc [+
1261 ENDFOR depend +]
1262 @[ -f ./gcc/Makefile ] || exit 0; \
1263 r=`${PWD_COMMAND}`; export r; \
1264 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1265 $(SET_LIB_PATH) \
1266 for flag in $(EXTRA_GCC_FLAGS); do \
1267 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1268 done; \
1269 echo "Doing [+make_target+] in gcc" ; \
1270 (cd gcc && \
1271 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1272 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1273 "RANLIB=$${RANLIB}" \
1274 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
1275 [+make_target+]) \
1276 || exit 1
1277
1278[+ ENDFOR recursive_targets +]
1279
1d39f329
NN
1280# ---------------------
1281# GCC bootstrap support
1282# ---------------------
1283
1284# We name the directories for the various stages "stage1-gcc",
1285# "stage2-gcc","stage3-gcc", etc.
1286# Unfortunately, the 'compare' process will fail (on debugging information)
1287# if any directory names are different!
1288# So in the building rule for each stage, we relocate them before and after.
1289# The current one is 'gcc', while the previous one is 'prev-gcc'. (The
1290# current one must be 'gcc' for now because the scripts in that directory
1291# assume it.)
1292# At the end of the bootstrap, 'stage3-gcc' must be moved to 'gcc' so that
1293# libraries can find it. Ick!
1294
1295# Bugs: This is almost certainly not parallel-make safe.
1296
1297# 'touch' doesn't work right on some platforms.
1298STAMP = echo timestamp >
1299
1300# Only build the C compiler for stage1, because that is the only one that
1301# we can guarantee will build with the native compiler, and also it is the
1302# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
1303# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
1304# overrideable (for a bootstrap build stage1 also builds gcc.info).
1305
1306STAGE1_CFLAGS=@stage1_cflags@
1307STAGE1_LANGUAGES=@stage1_languages@
1308
4fa63067
NN
1309# For stage 1:
1310# * We force-disable intermodule optimizations, even if
1311# --enable-intermodule was passed, since the installed compiler probably
1312# can't handle them. Luckily, autoconf always respects
1313# the last argument when conflicting --enable arguments are passed.
1314# * Likewise, we force-disable coverage flags, since the installed compiler
1315# probably has never heard of them.
1316# * We build only C (and possibly Ada).
1d39f329
NN
1317configure-stage1-gcc:
1318 echo configure-stage1-gcc > stage_last ; \
1319 if [ -f stage1-gcc/Makefile ] ; then \
1320 $(STAMP) configure-stage1-gcc ; \
1321 exit 0; \
1322 else \
1323 true ; \
1324 fi ; \
1325 [ -d stage1-gcc ] || mkdir stage1-gcc; \
1326 mv stage1-gcc gcc ; \
1327 r=`${PWD_COMMAND}`; export r; \
1328 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fa63067
NN
1329 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
1330 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
1d39f329
NN
1331 CC="$(CC)"; export CC; \
1332 CFLAGS="$(CFLAGS)"; export CFLAGS; \
1333 CXX="$(CXX)"; export CXX; \
1334 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
1d39f329
NN
1335 AR="$(AR)"; export AR; \
1336 AS="$(AS)"; export AS; \
1337 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
1338 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
1339 LD="$(LD)"; export LD; \
51860f05 1340 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
1d39f329
NN
1341 NM="$(NM)"; export NM; \
1342 RANLIB="$(RANLIB)"; export RANLIB; \
1343 WINDRES="$(WINDRES)"; export WINDRES; \
1344 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
1345 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
1346 echo Configuring stage 1 in gcc; \
1347 cd gcc || exit 1; \
1348 case $(srcdir) in \
1349 \.) \
1350 srcdiroption="--srcdir=."; \
1351 libsrcdir=".";; \
1352 /* | [A-Za-z]:[\\/]*) \
1353 srcdiroption="--srcdir=$(srcdir)/gcc"; \
1354 libsrcdir="$$s/gcc";; \
1355 *) \
1356 srcdiroption="--srcdir=../$(srcdir)/gcc"; \
1357 libsrcdir="$$s/gcc";; \
1358 esac; \
1359 $(SHELL) $${libsrcdir}/configure \
4fa63067
NN
1360 $(HOST_CONFIGARGS) $${srcdiroption} \
1361 --disable-intermodule --disable-coverage \
1362 --enable-languages="$(STAGE1_LANGUAGES)"; \
1d39f329
NN
1363 cd .. ; \
1364 mv gcc stage1-gcc ; \
1365 $(STAMP) configure-stage1-gcc
1366
4fa63067
NN
1367# Real targets act phony if they depend on phony targets; this hack
1368# prevents gratuitous rebuilding of stage 1.
1369prebootstrap:
1370 $(MAKE) all-bootstrap
1371 $(STAMP) prebootstrap
1372
1373all-stage1-gcc: configure-stage1-gcc prebootstrap
1d39f329
NN
1374 echo all-stage1-gcc > stage_last ; \
1375 r=`${PWD_COMMAND}`; export r; \
1376 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1377 mv stage1-gcc gcc ; \
1378 cd gcc && \
1379 $(MAKE) $(GCC_FLAGS_TO_PASS) \
1d39f329 1380 CFLAGS="$(STAGE1_CFLAGS)" \
4fa63067 1381 || exit 1 ; \
1d39f329
NN
1382 cd .. ; \
1383 mv gcc stage1-gcc ; \
1384 $(STAMP) all-stage1-gcc
1385
4fa63067 1386# TODO: Deal with STAGE_PREFIX (which is only for ada, incidentally)
1a6f2dc7
NN
1387# Possibly pass --enable-werror-always (depending on --enable-werror);
1388# that's what @stage2_werror_flag@ is for
1d39f329
NN
1389configure-stage2-gcc: all-stage1-gcc
1390 echo configure-stage2-gcc > stage_last ; \
1391 if [ -f stage2-gcc/Makefile ] ; then \
1392 $(STAMP) configure-stage2-gcc ; \
1393 exit 0; \
1394 else \
1395 true ; \
1396 fi ; \
1397 [ -d stage2-gcc ] || mkdir stage2-gcc; \
1398 mv stage2-gcc gcc ; \
4fa63067 1399 mv stage1-gcc prev-gcc ; \
1d39f329
NN
1400 r=`${PWD_COMMAND}`; export r; \
1401 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fa63067
NN
1402 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
1403 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
1d39f329
NN
1404 CFLAGS="$(CFLAGS)"; export CFLAGS; \
1405 CXX="$(CXX)"; export CXX; \
1406 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
1d39f329
NN
1407 AR="$(AR)"; export AR; \
1408 AS="$(AS)"; export AS; \
1d39f329
NN
1409 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
1410 LD="$(LD)"; export LD; \
51860f05 1411 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
1d39f329
NN
1412 NM="$(NM)"; export NM; \
1413 RANLIB="$(RANLIB)"; export RANLIB; \
1414 WINDRES="$(WINDRES)"; export WINDRES; \
1415 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
1416 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
920e3419
NN
1417 CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
1418 CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
1d39f329
NN
1419 echo Configuring stage 2 in gcc; \
1420 cd gcc || exit 1; \
1421 case $(srcdir) in \
1422 \.) \
1423 srcdiroption="--srcdir=."; \
1424 libsrcdir=".";; \
1425 /* | [A-Za-z]:[\\/]*) \
1426 srcdiroption="--srcdir=$(srcdir)/gcc"; \
1427 libsrcdir="$$s/gcc";; \
1428 *) \
1429 srcdiroption="--srcdir=../$(srcdir)/gcc"; \
1430 libsrcdir="$$s/gcc";; \
1431 esac; \
1432 $(SHELL) $${libsrcdir}/configure \
1a6f2dc7 1433 $(HOST_CONFIGARGS) $${srcdiroption} @stage2_werror_flag@ ; \
1d39f329
NN
1434 cd .. ; \
1435 mv gcc stage2-gcc ; \
4fa63067 1436 mv prev-gcc stage1-gcc ; \
1d39f329
NN
1437 $(STAMP) configure-stage2-gcc
1438
1439# Flags to pass to stage2 and later makes.
1440BOOT_CFLAGS= -g -O2
1441POSTSTAGE1_FLAGS_TO_PASS = \
1442 CFLAGS="$(BOOT_CFLAGS)" \
a0049f1b 1443 ADAC="\$$(CC)"
1d39f329
NN
1444
1445all-stage2-gcc: all-stage1-gcc configure-stage2-gcc
1446 echo all-stage2-gcc > stage_last ; \
1447 r=`${PWD_COMMAND}`; export r; \
1448 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1449 mv stage2-gcc gcc ; \
1450 mv stage1-gcc prev-gcc ; \
1451 cd gcc && \
1452 $(MAKE) $(GCC_FLAGS_TO_PASS) \
1453 CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/" \
1d39f329
NN
1454 CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/" \
1455 STAGE_PREFIX=$$r/prev-gcc/ \
1456 $(POSTSTAGE1_FLAGS_TO_PASS) || exit 1 ; \
1457 cd .. ; \
1458 mv prev-gcc stage1-gcc ; \
1459 mv gcc stage2-gcc ; \
1460 $(STAMP) all-stage2-gcc
1461
1462configure-stage3-gcc: all-stage2-gcc
1463 echo configure-stage3-gcc > stage_last ; \
1464 if [ -f stage3-gcc/Makefile ] ; then \
1465 $(STAMP) configure-stage3-gcc ; \
1466 exit 0; \
1467 else \
1468 true ; \
1469 fi ; \
1470 [ -d stage3-gcc ] || mkdir stage3-gcc; \
1471 mv stage3-gcc gcc ; \
920e3419 1472 mv stage2-gcc prev-gcc ; \
1d39f329
NN
1473 r=`${PWD_COMMAND}`; export r; \
1474 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
4fa63067
NN
1475 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
1476 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
1d39f329
NN
1477 CFLAGS="$(CFLAGS)"; export CFLAGS; \
1478 CXX="$(CXX)"; export CXX; \
1479 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
1d39f329
NN
1480 AR="$(AR)"; export AR; \
1481 AS="$(AS)"; export AS; \
1d39f329
NN
1482 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
1483 LD="$(LD)"; export LD; \
51860f05 1484 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
1d39f329
NN
1485 NM="$(NM)"; export NM; \
1486 RANLIB="$(RANLIB)"; export RANLIB; \
1487 WINDRES="$(WINDRES)"; export WINDRES; \
1488 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
1489 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
920e3419
NN
1490 CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
1491 CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
1d39f329
NN
1492 echo Configuring stage 3 in gcc; \
1493 cd gcc || exit 1; \
1494 case $(srcdir) in \
1495 \.) \
1496 srcdiroption="--srcdir=."; \
1497 libsrcdir=".";; \
1498 /* | [A-Za-z]:[\\/]*) \
1499 srcdiroption="--srcdir=$(srcdir)/gcc"; \
1500 libsrcdir="$$s/gcc";; \
1501 *) \
1502 srcdiroption="--srcdir=../$(srcdir)/gcc"; \
1503 libsrcdir="$$s/gcc";; \
1504 esac; \
1505 $(SHELL) $${libsrcdir}/configure \
1a6f2dc7 1506 $(HOST_CONFIGARGS) $${srcdiroption} @stage2_werror_flag@ ; \
1d39f329
NN
1507 cd .. ; \
1508 mv gcc stage3-gcc ; \
4fa63067 1509 mv prev-gcc stage2-gcc ; \
1d39f329
NN
1510 $(STAMP) configure-stage3-gcc
1511
1d39f329
NN
1512all-stage3-gcc: all-stage2-gcc configure-stage3-gcc
1513 echo all-stage3-gcc > stage_last ; \
1514 r=`${PWD_COMMAND}`; export r; \
1515 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1516 mv stage2-gcc prev-gcc ; \
1517 mv stage3-gcc gcc ; \
1518 cd gcc && \
1519 $(MAKE) $(GCC_FLAGS_TO_PASS) \
1520 CC="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/" \
1d39f329
NN
1521 CC_FOR_BUILD="$(STAGE_CC_WRAPPER) $$r/prev-gcc/xgcc$(exeext) -B$$r/prev-gcc/ -B$(build_tooldir)/bin/" \
1522 STAGE_PREFIX=$$r/prev-gcc/ \
1523 $(POSTSTAGE1_FLAGS_TO_PASS) || exit 1 ; \
1524 cd .. ; \
1525 mv prev-gcc stage2-gcc ; \
1526 mv gcc stage3-gcc ; \
1527 $(STAMP) all-stage3-gcc
1528
1529# We only want to compare .o files, so set this!
1530objext = .o
1531
1532compare: all-stage3-gcc
1533 r=`${PWD_COMMAND}`; export r; \
1534 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1535 rm -f .bad_compare ; \
1536 cd stage3-gcc; \
1537 files=`find . -name "*$(objext)" -print` ; \
1538 cd .. ; \
1539 for file in $${files} ; do \
1540 cmp --ignore-initial=16 $$r/stage2-gcc/$$file $$r/stage3-gcc/$$file \
1541 > /dev/null 2>&1; \
1542 test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
1543 done ; \
1544 if [ -f .bad_compare ]; then \
1545 echo "Bootstrap comparison failure!"; \
1546 cat .bad_compare; \
1547 exit 1; \
1548 else \
1549 true; \
1550 fi ; \
1551 $(STAMP) compare
1552
1553.PHONY: new-bootstrap
1554# This target exists so that everything can be made in one pass.
1555# 'all-gcc' has to avoid stomping on the bootstrap-generated gcc for
1556# this to work.
1557new-bootstrap: compare
1558 mv stage3-gcc gcc ; \
1559 $(MAKE) all ; \
1560 mv gcc stage3-gcc
1561
ae831be5
NN
1562# --------------------------------------
1563# Dependencies between different modules
1564# --------------------------------------
405ea7a0 1565
ae831be5
NN
1566# There are two types of dependencies here: 'hard' dependencies, where one
1567# module simply won't build without the other; and 'soft' dependencies, where
1568# if the depended-on module is missing, the depending module will do without
1569# or find a substitute somewhere (perhaps installed). Soft dependencies
1570# are specified by depending on a 'maybe-' target. If you're not sure,
1571# it's safer to use a soft dependency.
1572
1573# Host modules specific to gcc.
e2b9e2dc 1574# GCC needs to identify certain tools.
e5c3f801
NN
1575# GCC also needs the information exported by the intl configure script.
1576configure-gcc: maybe-configure-intl maybe-configure-binutils maybe-configure-gas maybe-configure-ld maybe-configure-bison maybe-configure-flex
1577all-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
ae831be5
NN
1578# This is a slightly kludgy method of getting dependencies on
1579# all-build-libiberty correct; it would be better to build it every time.
1580all-gcc: maybe-all-build-libiberty
e5c3f801 1581all-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
ae831be5
NN
1582
1583# Host modules specific to gdb.
e2b9e2dc 1584# GDB needs to know that the simulator is being built.
8f32e830 1585configure-gdb: maybe-configure-itcl maybe-configure-tcl maybe-configure-tk maybe-configure-sim
ae831be5
NN
1586GDB_TK = @GDB_TK@
1587all-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)
1588install-gdb: maybe-install-tcl maybe-install-tk maybe-install-itcl maybe-install-tix maybe-install-libgui
59da4fe6 1589configure-libgui: maybe-configure-tcl maybe-configure-tk
ae831be5
NN
1590all-libgui: maybe-all-tcl maybe-all-tk maybe-all-itcl
1591
1592# Host modules specific to binutils.
b4a77b47 1593configure-bfd: configure-libiberty
930314a4
NN
1594all-bfd: maybe-all-libiberty maybe-all-intl
1595all-binutils: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-flex maybe-all-bison maybe-all-byacc maybe-all-intl
ae831be5
NN
1596# We put install-opcodes before install-binutils because the installed
1597# binutils might be on PATH, and they might need the shared opcodes
1598# library.
1599install-binutils: maybe-install-opcodes
cf662e21
AJ
1600# libopcodes depends on libbfd
1601install-opcodes: maybe-install-bfd
ae831be5
NN
1602all-gas: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-intl
1603all-gprof: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-intl
1604all-ld: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-bison maybe-all-byacc maybe-all-flex maybe-all-intl
1605all-opcodes: maybe-all-bfd maybe-all-libiberty
1606
1607# Other host modules in the 'src' repository.
930314a4 1608all-dejagnu: maybe-all-tcl maybe-all-expect maybe-all-tk
b4a77b47 1609configure-expect: maybe-configure-tcl maybe-configure-tk
930314a4 1610all-expect: maybe-all-tcl maybe-all-tk
b4a77b47 1611configure-itcl: maybe-configure-tcl maybe-configure-tk
ae831be5
NN
1612all-itcl: maybe-all-tcl maybe-all-tk
1613# We put install-tcl before install-itcl because itcl wants to run a
1614# program on installation which uses the Tcl libraries.
1615install-itcl: maybe-install-tcl
122bfa92 1616all-sid: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-tcl maybe-all-tk
ae831be5 1617install-sid: maybe-install-tcl maybe-install-tk
a36d530e 1618all-sim: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-readline maybe-configure-gdb
b4a77b47 1619configure-tk: maybe-configure-tcl
ae831be5 1620all-tk: maybe-all-tcl
b4a77b47 1621configure-tix: maybe-configure-tcl maybe-configure-tk
ae831be5
NN
1622all-tix: maybe-all-tcl maybe-all-tk
1623all-texinfo: maybe-all-libiberty
1624
1625# Other host modules. Warning, these are not well tested.
1626all-autoconf: maybe-all-m4 maybe-all-texinfo
1627all-automake: maybe-all-m4 maybe-all-texinfo
1628all-bison: maybe-all-texinfo
1629all-diff: maybe-all-libiberty
1630all-fastjar: maybe-all-zlib maybe-all-libiberty
930314a4
NN
1631all-fileutils: maybe-all-libiberty
1632all-flex: maybe-all-libiberty maybe-all-bison maybe-all-byacc
930314a4
NN
1633all-gzip: maybe-all-libiberty
1634all-hello: maybe-all-libiberty
930314a4 1635all-m4: maybe-all-libiberty maybe-all-texinfo
b9abda6a 1636all-make: maybe-all-libiberty maybe-all-intl
930314a4
NN
1637all-patch: maybe-all-libiberty
1638all-prms: maybe-all-libiberty
930314a4
NN
1639all-recode: maybe-all-libiberty
1640all-sed: maybe-all-libiberty
1641all-send-pr: maybe-all-prms
930314a4 1642all-tar: maybe-all-libiberty
930314a4 1643all-uudecode: maybe-all-libiberty
ae831be5
NN
1644
1645ALL_GCC = maybe-all-gcc
1646ALL_GCC_C = $(ALL_GCC) maybe-all-target-newlib maybe-all-target-libgloss
1647ALL_GCC_CXX = $(ALL_GCC_C) maybe-all-target-libstdc++-v3
1648
1649# Target modules specific to gcc.
b4a77b47
DD
1650configure-target-boehm-gc: $(ALL_GCC_C) maybe-configure-target-qthreads
1651configure-target-fastjar: maybe-configure-target-zlib
930314a4 1652all-target-fastjar: maybe-all-target-zlib maybe-all-target-libiberty
3dee29da 1653configure-target-libada: $(ALL_GCC_C)
b4a77b47 1654configure-target-libf2c: $(ALL_GCC_C)
ae831be5 1655all-target-libf2c: maybe-all-target-libiberty
b4a77b47
DD
1656configure-target-libffi: $(ALL_GCC_C)
1657configure-target-libjava: $(ALL_GCC_C) maybe-configure-target-zlib maybe-configure-target-boehm-gc maybe-configure-target-qthreads maybe-configure-target-libffi
ae831be5 1658all-target-libjava: maybe-all-fastjar maybe-all-target-zlib maybe-all-target-boehm-gc maybe-all-target-qthreads maybe-all-target-libffi
b4a77b47 1659configure-target-libobjc: $(ALL_GCC_C)
ae831be5 1660all-target-libobjc: maybe-all-target-libiberty
b4a77b47 1661configure-target-libstdc++-v3: $(ALL_GCC_C)
ae831be5 1662all-target-libstdc++-v3: maybe-all-target-libiberty
b4a77b47 1663configure-target-zlib: $(ALL_GCC_C)
a9590527 1664
ae831be5 1665# Target modules in the 'src' repository.
b4a77b47
DD
1666configure-target-examples: $(ALL_GCC_C)
1667configure-target-libgloss: $(ALL_GCC)
ae831be5 1668all-target-libgloss: maybe-configure-target-newlib
3a12db16 1669configure-target-libiberty: $(ALL_GCC)
b4a77b47
DD
1670configure-target-libtermcap: $(ALL_GCC_C)
1671configure-target-newlib: $(ALL_GCC)
7dda0df6 1672configure-target-rda: $(ALL_GCC_C)
b4a77b47 1673configure-target-winsup: $(ALL_GCC_C)
ae831be5 1674all-target-winsup: maybe-all-target-libiberty maybe-all-target-libtermcap
a9590527 1675
ae831be5 1676# Other target modules. Warning, these are not well tested.
b4a77b47 1677configure-target-gperf: $(ALL_GCC_CXX)
ae831be5 1678all-target-gperf: maybe-all-target-libiberty maybe-all-target-libstdc++-v3
b4a77b47 1679configure-target-qthreads: $(ALL_GCC_C)
907a7241 1680
930314a4
NN
1681# Dependencies of maybe-foo on foo. These are used because, for example,
1682# all-gcc only depends on all-gas if gas is present and being configured.
1683@maybe_dependencies@
1684
a2cc058a
NN
1685# Serialization dependencies. Host configures don't work well in parallel to
1686# each other, due to contention over config.cache. Target configures and
1687# build configures are similar.
1688@serialization_dependencies@
1689
15723a45
NN
1690# --------------------------------
1691# Regenerating top level configury
1692# --------------------------------
405ea7a0 1693
1086bc09
NN
1694# Multilib.out tells target dirs what multilibs they should build.
1695# There is really only one copy. We use the 'timestamp' method to
1696# work around various timestamp bugs on some systems.
1697# We use move-if-change so that it's only considered updated when it
1698# actually changes, because it has to depend on a phony target.
e6bfb94a 1699multilib.out: maybe-all-gcc
b40e3958 1700 @r=`${PWD_COMMAND}`; export r; \
1086bc09
NN
1701 echo "Checking multilib configuration..."; \
1702 $(CC_FOR_TARGET) --print-multi-lib > multilib.tmp 2> /dev/null ; \
1703 $(SHELL) $(srcdir)/move-if-change multilib.tmp multilib.out ; \
1086bc09 1704
405ea7a0 1705# Rebuilding Makefile.in, using autogen.
43be203f 1706AUTOGEN = autogen
6b784d9f 1707$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
43be203f 1708 cd $(srcdir) && $(AUTOGEN) Makefile.def
405ea7a0 1709
a0da8069 1710# Rebuilding Makefile.
43be203f
AO
1711Makefile: $(srcdir)/Makefile.in config.status
1712 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1713
1714config.status: configure $(gcc_version_trigger)
10ecffb9 1715 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
405ea7a0 1716
a0da8069 1717# Rebuilding configure.
43be203f 1718AUTOCONF = autoconf
6b784d9f 1719$(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4
43be203f 1720 cd $(srcdir) && $(AUTOCONF)
405ea7a0 1721
3728fade
NN
1722# ------------------------------
1723# Special directives to GNU Make
1724# ------------------------------
1725
3728fade
NN
1726# Don't pass command-line variables to submakes.
1727.NOEXPORT:
1728MAKEOVERRIDES=
1729
405ea7a0 1730# end of Makefile.in