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