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