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