]> sourceware.org Git - newlib-cygwin.git/blame - Makefile.tpl
[mingw-Bugs-1749305]
[newlib-cygwin.git] / Makefile.tpl
CommitLineData
52b809e4 1[+ AutoGen5 template -*- Mode: Makefile -*-
bba02726
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,
e3c08f94 9# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
bba02726
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
5fc585f6 23# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
bba02726
NN
24#
25
ff0592df
NN
26# -------------------------------
27# Standard Autoconf-set variables
28# -------------------------------
c002f9d3 29VPATH=@srcdir@
c002f9d3 30
b58b6ee1 31build_alias=@build_noncanonical@
42f55f77
PB
32build_vendor=@build_vendor@
33build_os=@build_os@
7e9ae190 34build=@build@
b58b6ee1 35host_alias=@host_noncanonical@
42f55f77
PB
36host_vendor=@host_vendor@
37host_os=@host_os@
7e9ae190 38host=@host@
b58b6ee1 39target_alias=@target_noncanonical@
42f55f77
PB
40target_vendor=@target_vendor@
41target_os=@target_os@
7e9ae190 42target=@target@
c002f9d3 43
ff0592df 44program_transform_name = @program_transform_name@
1ae955ba
NN
45
46prefix = @prefix@
47exec_prefix = @exec_prefix@
48
ff0592df
NN
49srcdir = @srcdir@
50
1ae955ba
NN
51bindir = @bindir@
52sbindir = @sbindir@
53libexecdir = @libexecdir@
54datadir = @datadir@
55sysconfdir = @sysconfdir@
56sharedstatedir = @sharedstatedir@
57localstatedir = @localstatedir@
58libdir = @libdir@
59includedir = @includedir@
60oldincludedir = @oldincludedir@
61infodir = @infodir@
83c9add4
CD
62datarootdir = @datarootdir@
63docdir = @docdir@
d4954b6d 64pdfdir = @pdfdir@
83c9add4 65htmldir = @htmldir@
1ae955ba 66mandir = @mandir@
bba02726
NN
67man1dir = $(mandir)/man1
68man2dir = $(mandir)/man2
69man3dir = $(mandir)/man3
70man4dir = $(mandir)/man4
71man5dir = $(mandir)/man5
72man6dir = $(mandir)/man6
73man7dir = $(mandir)/man7
74man8dir = $(mandir)/man8
75man9dir = $(mandir)/man9
bba02726 76
282c0e47
NN
77INSTALL = @INSTALL@
78INSTALL_PROGRAM = @INSTALL_PROGRAM@
79INSTALL_SCRIPT = @INSTALL_SCRIPT@
80INSTALL_DATA = @INSTALL_DATA@
21ff191e
PB
81LN = @LN@
82LN_S = @LN_S@
e53c5df0
AM
83MAINT = @MAINT@
84MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
85MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
bba02726 86
ff0592df
NN
87# -------------------------------------------------
88# Miscellaneous non-standard autoconf-set variables
89# -------------------------------------------------
bba02726 90
ff0592df
NN
91# The gcc driver likes to know the arguments it was configured with.
92TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
bba02726 93
ff0592df
NN
94tooldir = @tooldir@
95build_tooldir = @build_tooldir@
bba02726 96
ff0592df 97GDB_NLM_DEPS =
bba02726 98
ff0592df
NN
99# This is the name of the environment variable used for the path to
100# the libraries.
101RPATH_ENVVAR = @RPATH_ENVVAR@
bba02726 102
ff0592df
NN
103# Build programs are put under this directory.
104BUILD_SUBDIR = @build_subdir@
105# This is set by the configure script to the arguments to use when configuring
106# directories built for the build system.
f0fdfd34 107BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
2cb47d68
PB
108
109# This is the list of variables to export in the environment when
110# configuring any subdirectory. It must also be exported whenever
111# recursing into a build directory in case that directory's Makefile
112# re-runs configure.
113BASE_EXPORTS = \
114 FLEX="$(FLEX)"; export FLEX; \
115 LEX="$(LEX)"; export LEX; \
116 BISON="$(BISON)"; export BISON; \
117 YACC="$(YACC)"; export YACC; \
118 M4="$(M4)"; export M4; \
119 MAKEINFO="$(MAKEINFO)"; export MAKEINFO;
120
a675b75a 121# This is the list of variables to export in the environment when
2cb47d68 122# configuring subdirectories for the build system.
a675b75a 123BUILD_EXPORTS = \
2cb47d68 124 $(BASE_EXPORTS) \
a675b75a
DD
125 AR="$(AR_FOR_BUILD)"; export AR; \
126 AS="$(AS_FOR_BUILD)"; export AS; \
127 CC="$(CC_FOR_BUILD)"; export CC; \
128 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
129 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
130 CXX="$(CXX_FOR_BUILD)"; export CXX; \
131 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
132 GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
133 GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
134 DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
135 LD="$(LD_FOR_BUILD)"; export LD; \
136 LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
137 NM="$(NM_FOR_BUILD)"; export NM; \
138 RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \
139 WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES;
ff0592df
NN
140
141# This is the list of directories to built for the host system.
142SUBDIRS = @configdirs@
143# This is set by the configure script to the arguments to use when configuring
144# directories built for the host system.
145HOST_CONFIGARGS = @host_configargs@
7fc2ca22
PB
146# Host programs are put under this directory, which is . except if building
147# with srcdir=..
148HOST_SUBDIR = @host_subdir@
a675b75a 149# This is the list of variables to export in the environment when
a7dc05b5
PB
150# configuring subdirectories for the host system. We need to pass
151# some to the GCC configure because of its hybrid host/target nature.
a675b75a 152HOST_EXPORTS = \
2cb47d68 153 $(BASE_EXPORTS) \
a675b75a
DD
154 CC="$(CC)"; export CC; \
155 CFLAGS="$(CFLAGS)"; export CFLAGS; \
156 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
157 CXX="$(CXX)"; export CXX; \
158 CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
159 AR="$(AR)"; export AR; \
160 AS="$(AS)"; export AS; \
161 CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
162 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
163 LD="$(LD)"; export LD; \
164 LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
165 NM="$(NM)"; export NM; \
166 RANLIB="$(RANLIB)"; export RANLIB; \
167 WINDRES="$(WINDRES)"; export WINDRES; \
168 OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
ead1b9ae 169 OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
a7dc05b5
PB
170 AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
171 AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
172 GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
173 LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
174 NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
175 OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
176 RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
a675b75a
DD
177 TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
178 GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
9ab64c4a 179 GMPINC="$(HOST_GMPINC)"; export GMPINC; \
168b158c
PB
180@if gcc-bootstrap
181 $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
182@endif gcc-bootstrap
f3fd76d4 183 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
a675b75a
DD
184
185# Similar, for later GCC stages.
a8a96878 186POSTSTAGE1_HOST_EXPORTS = \
63673a5b 187 $(HOST_EXPORTS) \
7fc2ca22
PB
188 CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
189 -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
190 CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \
191 $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
192 -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
71205cf0 193 -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; \
71205cf0 194 LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
ff0592df 195
ff0592df
NN
196# Target libraries are put under this directory:
197TARGET_SUBDIR = @target_subdir@
198# This is set by the configure script to the arguments to use when configuring
199# directories built for the target.
f0fdfd34 200TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)"
a675b75a 201# This is the list of variables to export in the environment when
2cb47d68 202# configuring subdirectories for the host system.
a675b75a 203BASE_TARGET_EXPORTS = \
2cb47d68 204 $(BASE_EXPORTS) \
a675b75a 205 AR="$(AR_FOR_TARGET)"; export AR; \
a7dc05b5 206 AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
a675b75a
DD
207 CC="$(CC_FOR_TARGET)"; export CC; \
208 CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
209 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
ec724188 210 CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
a675b75a
DD
211 CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
212 GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
213 GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \
214 DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
a7dc05b5 215 LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
a675b75a 216 LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
6a33f745 217 LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
a7dc05b5 218 NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
51c8a213 219 OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
a675b75a 220 RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
6a33f745 221 STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
9ab64c4a 222 WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
f3fd76d4 223 $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
a675b75a
DD
224
225RAW_CXX_TARGET_EXPORTS = \
226 $(BASE_TARGET_EXPORTS) \
227 CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
228 CXX="$(RAW_CXX_FOR_TARGET)"; export CXX;
229
230NORMAL_TARGET_EXPORTS = \
231 $(BASE_TARGET_EXPORTS) \
232 CXX="$(CXX_FOR_TARGET)"; export CXX;
ff0592df 233
cb2333e8
DD
234# Where to find GMP
235HOST_GMPLIBS = @gmplibs@
236HOST_GMPINC = @gmpinc@
237
ff0592df
NN
238# ----------------------------------------------
239# Programs producing files for the BUILD machine
240# ----------------------------------------------
241
242SHELL = @config_shell@
243
244# pwd command to use. Allow user to override default by setting PWDCMD in
245# the environment to account for automounters. The make variable must not
246# be called PWDCMD, otherwise the value set here is passed to make
247# subprocesses and overrides the setting from the user's environment.
5230d454
L
248# Don't use PWD since it is a common shell environment variable and we
249# don't want to corrupt it.
250PWD_COMMAND = $${PWDCMD-pwd}
ff0592df
NN
251
252# compilers to use to create programs which must be run in the build
253# environment.
254CC_FOR_BUILD = @CC_FOR_BUILD@
e9ea9dec 255CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
ff0592df
NN
256
257CXX_FOR_BUILD = $(CXX)
258
259# Special variables passed down in EXTRA_GCC_FLAGS. They are defined
260# here so that they can be overridden by Makefile fragments.
ff0592df
NN
261BUILD_PREFIX = @BUILD_PREFIX@
262BUILD_PREFIX_1 = @BUILD_PREFIX_1@
bba02726 263
99df82b9
PB
264# Flags to pass to stage2 and later makes. They are defined
265# here so that they can be overridden by Makefile fragments.
266BOOT_CFLAGS= -g -O2
7e958b2e 267BOOT_LDFLAGS=
99df82b9 268
a7dc05b5
PB
269BISON = @BISON@
270YACC = @YACC@
271FLEX = @FLEX@
272LEX = @LEX@
273M4 = @M4@
274MAKEINFO = @MAKEINFO@
275EXPECT = @EXPECT@
276RUNTEST = @RUNTEST@
bba02726
NN
277
278# This just becomes part of the MAKEINFO definition passed down to
279# sub-makes. It lets flags be given on the command line while still
280# using the makeinfo from the object tree.
8997bae8
DD
281# (Default to avoid splitting info files by setting the threshold high.)
282MAKEINFOFLAGS = --split-size=5000000
bba02726 283
ff0592df
NN
284# ---------------------------------------------
285# Programs producing files for the HOST machine
286# ---------------------------------------------
bba02726 287
ff0592df 288AS = @AS@
ff0592df
NN
289AR = @AR@
290AR_FLAGS = rc
ff0592df 291CC = @CC@
ff0592df 292CXX = @CXX@
ff0592df 293DLLTOOL = @DLLTOOL@
ff0592df 294LD = @LD@
a7dc05b5
PB
295LIPO = @LIPO@
296NM = @NM@
e3c08f94 297OBJDUMP = @OBJDUMP@
ff0592df 298RANLIB = @RANLIB@
a7dc05b5 299STRIP = @STRIP@
ff0592df 300WINDRES = @WINDRES@
bba02726 301
e6659c00
PB
302GNATBIND = @GNATBIND@
303GNATMAKE = @GNATMAKE@
304
a7dc05b5 305CFLAGS = @CFLAGS@
07846b16 306LDFLAGS = @LDFLAGS@
a7dc05b5
PB
307LIBCFLAGS = $(CFLAGS)
308CXXFLAGS = @CXXFLAGS@
309LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
ff0592df
NN
310PICFLAG =
311
14a1406e
PB
312# Only build the C compiler for stage1, because that is the only one that
313# we can guarantee will build with the native compiler, and also it is the
314# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS),
315# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them
316# overrideable (for a bootstrap build stage1 also builds gcc.info).
317
318STAGE1_CFLAGS=@stage1_cflags@
319STAGE1_CHECKING=@stage1_checking@
320STAGE1_LANGUAGES=@stage1_languages@
321
ff0592df
NN
322# -----------------------------------------------
323# Programs producing files for the TARGET machine
324# -----------------------------------------------
bba02726 325
426ce14a 326FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
bba02726 327
ff0592df 328AR_FOR_TARGET=@AR_FOR_TARGET@
712e2a32 329AS_FOR_TARGET=@AS_FOR_TARGET@
5fb28bcc 330CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
5fb28bcc 331
ff0592df
NN
332# If GCC_FOR_TARGET is not overriden on the command line, then this
333# variable is passed down to the gcc Makefile, where it is used to
334# build libgcc2.a. We define it here so that it can itself be
335# overridden on the command line.
a7dc05b5 336GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET)
5fb28bcc 337CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
5fb28bcc 338RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET)
5fb28bcc 339GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
5fb28bcc 340GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET)
712e2a32 341DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
ff0592df 342LD_FOR_TARGET=@LD_FOR_TARGET@
ff0592df 343
6a33f745 344LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
ff0592df 345NM_FOR_TARGET=@NM_FOR_TARGET@
51c8a213 346OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
712e2a32 347RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
6a33f745 348STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
ff0592df 349WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
bba02726 350
a7dc05b5
PB
351COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@
352COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@
353COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@
354
355# During gcc bootstrap, if we use some random cc for stage1 then
356# CFLAGS will be just -g. We want to ensure that TARGET libraries
357# (which we know are built with gcc) are built with optimizations so
358# prepend -O2 when setting CFLAGS_FOR_TARGET.
359CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
360SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
361CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
362LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
363LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
364LDFLAGS_FOR_TARGET =
ff0592df
NN
365PICFLAG_FOR_TARGET =
366
367# ------------------------------------
368# Miscellaneous targets and flag lists
369# ------------------------------------
370
bba02726
NN
371# The first rule in the file had better be this one. Don't put any above it.
372# This lives here to allow makefile fragments to contain dependencies.
168b158c 373all:
bba02726 374
bba02726 375#### host and target specific makefile fragments come in here.
bafecfd6
NN
376@target_makefile_frag@
377@alphaieee_frag@
378@ospace_frag@
379@host_makefile_frag@
bba02726
NN
380###
381
f3fd76d4
PB
382# This is the list of directories that may be needed in RPATH_ENVVAR
383# so that prorgams built for the target machine work.
384TARGET_LIB_PATH = [+ FOR target_modules +][+
385 IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
386 ENDFOR target_modules +]$(HOST_LIB_PATH_gcc)
387[+ FOR target_modules +][+ IF lib_path +]
388@if target-[+module+]
389TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]:
390@endif target-[+module+]
391[+ ENDIF lib_path +][+ ENDFOR target_modules +]
392
393
394# This is the list of directories that may be needed in RPATH_ENVVAR
395# so that programs built for the host machine work.
396HOST_LIB_PATH = [+ FOR host_modules +][+
397 IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+
398 ENDFOR host_modules +]
399
400# Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
401@if gcc
402HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
403@endif gcc
404
405[+ FOR host_modules +][+ IF lib_path +]
406@if [+module+]
407HOST_LIB_PATH_[+module+] = \
408 $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap
409 +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +]
410@endif [+module+]
411[+ ENDIF lib_path +][+ ENDFOR host_modules +]
412
bba02726 413# Flags to pass down to all sub-makes.
ec92c4d6
PB
414BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
415 "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \
416 "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +] \
08bf2e60 417 "CONFIG_SHELL=$(SHELL)" \
47cd8327 418 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"
bba02726 419
5fb28bcc
PB
420# We leave this in just in case, but it is not needed anymore.
421RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS)
21ff191e 422
bba02726
NN
423# Flags to pass down to most sub-makes, in which we're building with
424# the host environment.
bba02726
NN
425EXTRA_HOST_FLAGS = \
426 'AR=$(AR)' \
427 'AS=$(AS)' \
428 'CC=$(CC)' \
429 'CXX=$(CXX)' \
430 'DLLTOOL=$(DLLTOOL)' \
431 'LD=$(LD)' \
a7dc05b5 432 'LIPO=$(LIPO)' \
bba02726 433 'NM=$(NM)' \
e3c08f94 434 'OBJDUMP=$(OBJDUMP)' \
76ab491a 435 'RANLIB=$(RANLIB)' \
a7dc05b5 436 'STRIP=$(STRIP)' \
bba02726
NN
437 'WINDRES=$(WINDRES)'
438
439FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
440
441# Flags that are concerned with the location of the X11 include files
442# and library files
443#
444# NOTE: until the top-level is getting the values via autoconf, it only
445# causes problems to have this top-level Makefile overriding the autoconf-set
446# values in child directories. Only variables that don't conflict with
447# autoconf'ed ones should be passed by X11_FLAGS_TO_PASS for now.
448#
449X11_FLAGS_TO_PASS = \
450 'X11_EXTRA_CFLAGS=$(X11_EXTRA_CFLAGS)' \
451 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)'
452
14a1406e
PB
453# Flags to pass to stage2 and later makes.
454
455POSTSTAGE1_FLAGS_TO_PASS = \
456 CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
e6659c00 457 GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind" \
14a1406e
PB
458 LDFLAGS="$(BOOT_LDFLAGS)" \
459 "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
460
bba02726 461# Flags to pass down to makes which are built with the target environment.
15b527ca
PB
462# The double $ decreases the length of the command line; those variables
463# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The
464# COMPILER_ prefixed variables are not passed down so we expand them here.
bba02726
NN
465EXTRA_TARGET_FLAGS = \
466 'AR=$$(AR_FOR_TARGET)' \
15b527ca 467 'AS=$(COMPILER_AS_FOR_TARGET)' \
bba02726
NN
468 'CC=$$(CC_FOR_TARGET)' \
469 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
470 'CXX=$$(CXX_FOR_TARGET)' \
471 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
472 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
15b527ca 473 'LD=$(COMPILER_LD_FOR_TARGET)' \
ece7e564 474 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
bba02726
NN
475 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
476 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
15b527ca 477 'NM=$(COMPILER_NM_FOR_TARGET)' \
51c8a213 478 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
bba02726
NN
479 'RANLIB=$$(RANLIB_FOR_TARGET)' \
480 'WINDRES=$$(WINDRES_FOR_TARGET)'
481
482TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
483
484# Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
485# unfortunately needs the native compiler and the target ar and
486# ranlib.
487# If any variables are added here, they must be added to do-*, below.
657b58f4 488# The BUILD_* variables are a special case, which are used for the gcc
bba02726
NN
489# cross-building scheme.
490EXTRA_GCC_FLAGS = \
bba02726 491 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
07bc9e41
NN
492 "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
493 "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
494 "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
495 "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
ec92c4d6 496 "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
bba02726 497
2286046e 498GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS)
bba02726 499
9b520963 500.PHONY: configure-host
d5eec917 501configure-host: [+
9b520963
NN
502 FOR host_modules +] \
503 maybe-configure-[+module+][+
504 ENDFOR host_modules +]
505.PHONY: configure-target
506configure-target: [+
507 FOR target_modules +] \
508 maybe-configure-target-[+module+][+
509 ENDFOR target_modules +]
bba02726 510
e1666221
PB
511# The target built for a native non-bootstrap build.
512.PHONY: all
168b158c
PB
513all:
514@if gcc-bootstrap
a7dc05b5 515 [ -f stage_final ] || echo stage3 > stage_final
168b158c
PB
516 @r=`${PWD_COMMAND}`; export r; \
517 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
15b527ca 518 $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
168b158c 519@endif gcc-bootstrap
15b527ca 520 @: $(MAKE); $(unstage)
168b158c
PB
521 @r=`${PWD_COMMAND}`; export r; \
522 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
523 if [ -f stage_last ]; then \
a7dc05b5 524 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
168b158c 525 else \
a7dc05b5 526 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \
168b158c 527 fi
9b520963 528
2cb47d68 529.PHONY: all-build
ec92c4d6
PB
530[+ FOR build_modules +]
531all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +]
532
9b520963 533.PHONY: all-host
ec92c4d6
PB
534[+ FOR host_modules +][+ IF bootstrap +]
535@if [+module+]-no-bootstrap[+ ENDIF bootstrap +]
536all-host: maybe-all-[+module+][+ IF bootstrap +]
537@endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +]
538
9b520963 539.PHONY: all-target
ec92c4d6 540[+ FOR target_modules +][+ IF bootstrap +]
a1c408a1 541@if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +]
ec92c4d6 542all-target: maybe-all-target-[+module+][+ IF bootstrap +]
a1c408a1
NC
543@endif target-[+module+]-no-bootstrap[+
544 ENDIF bootstrap +][+ ENDFOR target_modules +]
bba02726
NN
545
546# Do a target for all the subdirectories. A ``make do-X'' will do a
547# ``make X'' in all subdirectories (because, in general, there is a
548# dependency (below) of X upon do-X, a ``make X'' will also do this,
549# but it may do additional work as well).
d6ebd419 550[+ FOR recursive_targets +]
878813bd 551.PHONY: do-[+make_target+]
168b158c 552do-[+make_target+]:
15b527ca 553 @: $(MAKE); $(unstage)
ecebee48
PB
554 @r=`${PWD_COMMAND}`; export r; \
555 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
556 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \
168b158c 557 [+make_target+]-target
168b158c 558
657b58f4
NN
559
560.PHONY: [+make_target+]-host
ec92c4d6
PB
561[+ FOR host_modules +]
562[+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +]
657b58f4
NN
563
564.PHONY: [+make_target+]-target
ec92c4d6
PB
565[+ FOR target_modules +]
566[+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +]
d6ebd419
NN
567[+ ENDFOR recursive_targets +]
568
bba02726
NN
569# Here are the targets which correspond to the do-X targets.
570
d4954b6d
DD
571.PHONY: info installcheck dvi pdf html
572.PHONY: install-info install-pdf install-html
bba02726
NN
573.PHONY: clean distclean mostlyclean maintainer-clean realclean
574.PHONY: local-clean local-distclean local-maintainer-clean
575info: do-info
576installcheck: do-installcheck
577dvi: do-dvi
39bbbb69 578pdf: do-pdf
b6fb961f 579html: do-html
bba02726 580
5b6edf66
NN
581# Make sure makeinfo is built before we do a `make info', if we're
582# in fact building texinfo.
583do-info: maybe-all-texinfo
bba02726
NN
584
585install-info: do-install-info dir.info
5230d454 586 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
bba02726 587 if [ -f dir.info ] ; then \
8ccfe116 588 $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \
bba02726
NN
589 else true ; fi
590
d4954b6d
DD
591install-pdf: do-install-pdf
592
83c9add4
CD
593install-html: do-install-html
594
bba02726
NN
595local-clean:
596 -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
597
598local-distclean:
599 -rm -f Makefile config.status config.cache mh-frag mt-frag
15b527ca 600 -rm -f maybedep.tmp serdep.tmp
bba02726
NN
601 -if [ "$(TARGET_SUBDIR)" != "." ]; then \
602 rm -rf $(TARGET_SUBDIR); \
603 else true; fi
f29d8007 604 -rm -rf $(BUILD_SUBDIR)
7fc2ca22
PB
605 -if [ "$(HOST_SUBDIR)" != "." ]; then \
606 rm -rf $(HOST_SUBDIR); \
607 else true; fi
bba02726
NN
608 -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile
609 -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
610 -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
611 -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
612 -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
613
614local-maintainer-clean:
615 @echo "This command is intended for maintainers to use;"
616 @echo "it deletes files that may require special tools to rebuild."
617
618clean: do-clean local-clean
619mostlyclean: do-mostlyclean local-clean
620distclean: do-distclean local-clean local-distclean
621maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean
622maintainer-clean: local-distclean
623realclean: maintainer-clean
624
bba02726
NN
625# Check target.
626
627.PHONY: check do-check
2a33c5f1 628check: do-check
bba02726 629
8ecc6504 630# Only include modules actually being configured and built.
168b158c
PB
631.PHONY: check-host
632check-host: [+
70ffc148
NN
633 FOR host_modules +] \
634 maybe-check-[+module+][+
168b158c
PB
635 ENDFOR host_modules +]
636
637.PHONY: check-target
638check-target: [+
70ffc148
NN
639 FOR target_modules +] \
640 maybe-check-target-[+module+][+
168b158c
PB
641 ENDFOR target_modules +]
642
643do-check:
15b527ca 644 @: $(MAKE); $(unstage)
ecebee48
PB
645 @r=`${PWD_COMMAND}`; export r; \
646 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
647 $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target
bba02726
NN
648
649# Automated reporting of test results.
650
651warning.log: build.log
652 $(srcdir)/contrib/warn_summary build.log > $@
653
654mail-report.log:
655 if test x'$(BOOT_CFLAGS)' != x''; then \
656 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
657 fi; \
658 $(srcdir)/contrib/test_summary -t >$@
659 chmod +x $@
660 echo If you really want to send e-mail, run ./$@ now
661
662mail-report-with-warnings.log: warning.log
663 if test x'$(BOOT_CFLAGS)' != x''; then \
664 BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
665 fi; \
666 $(srcdir)/contrib/test_summary -t -i warning.log >$@
667 chmod +x $@
668 echo If you really want to send e-mail, run ./$@ now
669
670# Installation targets.
671
c5ab3a90 672.PHONY: install uninstall
168b158c 673install:
15b527ca 674 @: $(MAKE); $(unstage)
ecebee48
PB
675 @r=`${PWD_COMMAND}`; export r; \
676 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
677 $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target
9b520963 678
70ffc148
NN
679.PHONY: install-host-nogcc
680install-host-nogcc: [+
364b9683
PB
681 FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \
682 maybe-install-[+module+][+ ENDIF +][+
70ffc148
NN
683 ENDFOR host_modules +]
684
9b520963 685.PHONY: install-host
d5eec917 686install-host: [+
9b520963
NN
687 FOR host_modules +] \
688 maybe-install-[+module+][+
689 ENDFOR host_modules +]
70ffc148 690
9b520963
NN
691.PHONY: install-target
692install-target: [+
693 FOR target_modules +] \
694 maybe-install-target-[+module+][+
695 ENDFOR target_modules +]
bba02726
NN
696
697uninstall:
698 @echo "the uninstall target is not supported in this tree"
699
bba02726
NN
700.PHONY: install.all
701install.all: install-no-fixedincludes
702 @if [ -f ./gcc/Makefile ] ; then \
5230d454 703 r=`${PWD_COMMAND}` ; export r ; \
15b527ca 704 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
63673a5b 705 $(HOST_EXPORTS) \
6dbec167 706 (cd ./gcc && \
bba02726
NN
707 $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
708 else \
709 true ; \
710 fi
711
712# install-no-fixedincludes is used because Cygnus can not distribute
713# the fixed header files.
714.PHONY: install-no-fixedincludes
70ffc148 715install-no-fixedincludes: installdirs install-host-nogcc \
9b520963 716 install-target gcc-no-fixedincludes
bba02726 717
43bdb69a 718### other supporting targets
bba02726 719
43bdb69a
NN
720MAKEDIRS= \
721 $(DESTDIR)$(prefix) \
722 $(DESTDIR)$(exec_prefix)
723.PHONY: installdirs
724installdirs: mkinstalldirs
725 $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
726
727dir.info: do-install-info
728 if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
8ccfe116 729 $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
43bdb69a
NN
730 mv -f dir.info.new dir.info ; \
731 else true ; \
bba02726
NN
732 fi
733
43bdb69a
NN
734dist:
735 @echo "Building a full distribution of this tree isn't done"
736 @echo "via 'make dist'. Check out the etc/ subdirectory"
737
738etags tags: TAGS
739
740# Right now this just builds TAGS in each subdirectory. emacs19 has the
741# ability to use several tags files at once, so there is probably no need
742# to combine them into one big TAGS file (like CVS 1.3 does). We could
743# (if we felt like it) have this Makefile write a piece of elisp which
744# the user could load to tell emacs19 where all the TAGS files we just
745# built are.
746TAGS: do-TAGS
747
f0fdfd34
PB
748# ------------------------------------
749# Macros for configure and all targets
750# ------------------------------------
751
752[+ DEFINE configure +]
753.PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+]
754maybe-configure-[+prefix+][+module+]:
e1e5148c
CD
755@if gcc-bootstrap
756configure-[+prefix+][+module+]: stage_current
757@endif gcc-bootstrap
f0fdfd34
PB
758@if [+prefix+][+module+]
759maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+]
e1e5148c 760configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +]
ec92c4d6
PB
761 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
762 @r=`${PWD_COMMAND}`; export r; \
15b527ca 763 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
ec92c4d6
PB
764 [+ IF check_multilibs
765 +]echo "Checking multilib configuration for [+module+]..."; \
15b527ca
PB
766 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
767 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
768 if test -r [+subdir+]/[+module+]/multilib.out; then \
769 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
770 rm -f [+subdir+]/[+module+]/multilib.tmp; \
771 else \
772 rm -f [+subdir+]/[+module+]/Makefile; \
773 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
774 fi; \
775 else \
776 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
ec92c4d6
PB
777 fi; \
778 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
f0fdfd34 779 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
f0fdfd34
PB
780 [+exports+] \
781 echo Configuring in [+subdir+]/[+module+]; \
782 cd "[+subdir+]/[+module+]" || exit 1; \
2245eb63 783 case $(srcdir) in \
7fc2ca22 784 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
f0fdfd34 785 *) topdir=`echo [+subdir+]/[+module+]/ | \
7fc2ca22 786 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
2245eb63 787 esac; \
7fc2ca22
PB
788 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
789 libsrcdir="$$s/[+module+]"; \
f0fdfd34
PB
790 [+ IF no-config-site +]rm -f no-such-file || : ; \
791 CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
42f55f77
PB
792 [+args+] --build=${build_alias} --host=[+host_alias+] \
793 --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
2245eb63 794 || exit 1
f0fdfd34 795@endif [+prefix+][+module+]
a8a96878
PB
796
797[+ IF bootstrap +]
798[+ FOR bootstrap_stage +]
799.PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+]
800maybe-configure-stage[+id+]-[+prefix+][+module+]:
15b527ca 801@if [+prefix+][+module+]-bootstrap
a8a96878 802maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
15b527ca 803configure-stage[+id+]-[+prefix+][+module+]:
ec92c4d6 804 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
15b527ca 805 @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]
ec92c4d6 806 @r=`${PWD_COMMAND}`; export r; \
a8a96878 807 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
ec92c4d6
PB
808 [+ IF check_multilibs
809 +]echo "Checking multilib configuration for [+module+]..."; \
15b527ca
PB
810 $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \
811 if test -r [+subdir+]/[+module+]/multilib.out; then \
812 if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \
813 rm -f [+subdir+]/[+module+]/multilib.tmp; \
814 else \
815 rm -f [+subdir+]/[+module+]/Makefile; \
816 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
817 fi; \
818 else \
819 mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \
ec92c4d6
PB
820 fi; \
821 [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \
a8a96878
PB
822 [+exports+][+ IF prev +] \
823 [+poststage1_exports+][+ ENDIF prev +] \
2ba09444
PB
824 CFLAGS="[+stage_cflags+]"; export CFLAGS; \
825 LIBCFLAGS="[+stage_cflags+]"; export LIBCFLAGS; \
a8a96878 826 echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \
15b527ca 827 $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \
a8a96878
PB
828 cd [+subdir+]/[+module+] || exit 1; \
829 case $(srcdir) in \
830 /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
831 *) topdir=`echo [+subdir+]/[+module+]/ | \
832 sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
833 esac; \
834 srcdiroption="--srcdir=$${topdir}/[+module+]"; \
835 libsrcdir="$$s/[+module+]"; \
836 $(SHELL) $${libsrcdir}/configure \
42f55f77
PB
837 [+args+] --build=${build_alias} --host=[+host_alias+] \
838 --target=[+target_alias+] $${srcdiroption} \
380e48e5 839 [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
a8a96878 840 [+stage_configure_flags+] [+extra_configure_flags+]
15b527ca 841@endif [+prefix+][+module+]-bootstrap
a8a96878
PB
842[+ ENDFOR bootstrap_stage +]
843[+ ENDIF bootstrap +]
f0fdfd34
PB
844[+ ENDDEF +]
845
846[+ DEFINE all +]
847.PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+]
848maybe-all-[+prefix+][+module+]:
e1e5148c
CD
849@if gcc-bootstrap
850all-[+prefix+][+module+]: stage_current
851@endif gcc-bootstrap
f0fdfd34
PB
852@if [+prefix+][+module+]
853TARGET-[+prefix+][+module+]=[+
42f55f77 854 IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
f0fdfd34 855maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
e1e5148c 856all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
ec92c4d6
PB
857 @: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
858 @r=`${PWD_COMMAND}`; export r; \
5230d454 859 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
f0fdfd34
PB
860 [+exports+] \
861 (cd [+subdir+]/[+module+] && \
862 $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+]))
863@endif [+prefix+][+module+]
a8a96878
PB
864
865[+ IF bootstrap +]
866[+ FOR bootstrap_stage +]
867.PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+]
868.PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+]
869maybe-all-stage[+id+]-[+prefix+][+module+]:
870maybe-clean-stage[+id+]-[+prefix+][+module+]:
15b527ca 871@if [+prefix+][+module+]-bootstrap
a8a96878
PB
872maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+]
873all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+]
168b158c 874TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+])
a8a96878 875all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
ec92c4d6 876 @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start
a8a96878
PB
877 @r=`${PWD_COMMAND}`; export r; \
878 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
879 [+exports+][+ IF prev +] \
880 [+poststage1_exports+][+ ENDIF prev +] \
881 cd [+subdir+]/[+module+] && \
2ba09444
PB
882 $(MAKE) [+args+] \
883 CFLAGS="[+stage_cflags+]" LIBCFLAGS="[+stage_cflags+]" [+
884 IF prev +][+poststage1_args+][+ ENDIF prev
885 +] [+extra_make_flags+] \
168b158c 886 $(TARGET-stage[+id+]-[+prefix+][+module+])
a8a96878
PB
887
888maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]
889clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+]
890clean-stage[+id+]-[+prefix+][+module+]:
a6a4e782
DD
891 @if [ $(current_stage) = stage[+id+] ]; then \
892 [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \
893 else \
894 [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \
895 $(MAKE) stage[+id+]-start; \
896 fi; \
a8a96878
PB
897 cd [+subdir+]/[+module+] && \
898 $(MAKE) [+args+] [+ IF prev +] \
899 [+poststage1_args+] [+ ENDIF prev +] \
2ba09444 900 [+extra_make_flags+] clean
15b527ca 901@endif [+prefix+][+module+]-bootstrap
a8a96878
PB
902
903[+ ENDFOR bootstrap_stage +]
904[+ ENDIF bootstrap +]
f0fdfd34
PB
905[+ ENDDEF +]
906
907# --------------------------------------
908# Modules which run on the build machine
909# --------------------------------------
910[+ FOR build_modules +]
911[+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
42f55f77
PB
912 host_alias=(get "host" "${build_alias}")
913 target_alias=(get "target" "${target_alias}")
f0fdfd34
PB
914 args="$(BUILD_CONFIGARGS)" no-config-site=true +]
915
916[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
917[+ ENDFOR build_module +]
bba02726 918
43bdb69a
NN
919# --------------------------------------
920# Modules which run on the host machine
921# --------------------------------------
8ecc6504 922[+ FOR host_modules +]
a8a96878
PB
923[+ configure prefix="" subdir="$(HOST_SUBDIR)"
924 exports="$(HOST_EXPORTS)"
925 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
42f55f77
PB
926 host_alias=(get "host" "${host_alias}")
927 target_alias=(get "target" "${target_alias}")
f0fdfd34 928 args="$(HOST_CONFIGARGS)" +]
94f860c0 929
a8a96878
PB
930[+ all prefix="" subdir="$(HOST_SUBDIR)"
931 exports="$(HOST_EXPORTS)"
932 poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
933 args="$(FLAGS_TO_PASS)"
934 poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +]
bba02726 935
70ffc148
NN
936.PHONY: check-[+module+] maybe-check-[+module+]
937maybe-check-[+module+]:
a7e609d6
PB
938@if [+module+]
939maybe-check-[+module+]: check-[+module+]
8ecc6504 940[+ IF no_check +]
8ecc6504
NN
941check-[+module+]:
942[+ ELIF no_check_cross +]
8ecc6504
NN
943# This module is only tested in a native toolchain.
944check-[+module+]:
15b527ca 945 @: $(MAKE); $(unstage)
7e9ae190 946 @if [ '$(host)' = '$(target)' ] ; then \
5230d454
L
947 r=`${PWD_COMMAND}`; export r; \
948 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a675b75a 949 $(HOST_EXPORTS) \
7fc2ca22 950 (cd $(HOST_SUBDIR)/[+module+] && \
80e4c577 951 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \
2245eb63
NN
952 fi
953[+ ELSE check +]
2245eb63 954check-[+module+]:
15b527ca 955 @: $(MAKE); $(unstage)
5230d454
L
956 @r=`${PWD_COMMAND}`; export r; \
957 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a675b75a 958 $(HOST_EXPORTS) \
7fc2ca22
PB
959 (cd $(HOST_SUBDIR)/[+module+] && \
960 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
8ecc6504 961[+ ENDIF no_check +]
a7e609d6 962@endif [+module+]
bba02726 963
c5e4bb70
NN
964.PHONY: install-[+module+] maybe-install-[+module+]
965maybe-install-[+module+]:
a7e609d6
PB
966@if [+module+]
967maybe-install-[+module+]: install-[+module+]
70ffc148 968[+ IF no_install +]
8ecc6504
NN
969install-[+module+]:
970[+ ELSE install +]
8ecc6504 971install-[+module+]: installdirs
15b527ca 972 @: $(MAKE); $(unstage)
5230d454
L
973 @r=`${PWD_COMMAND}`; export r; \
974 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a675b75a 975 $(HOST_EXPORTS) \
7fc2ca22 976 (cd $(HOST_SUBDIR)/[+module+] && \
93c60b6d 977 $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install)
8ecc6504 978[+ ENDIF no_install +]
a7e609d6 979@endif [+module+]
8ec98d6c 980
39bbbb69 981# Other targets (info, dvi, pdf, etc.)
8ec98d6c
NN
982[+ FOR recursive_targets +]
983.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+]
984maybe-[+make_target+]-[+module+]:
a7e609d6
PB
985@if [+module+]
986maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+]
8ec98d6c
NN
987[+ IF (match-value? = "missing" (get "make_target") ) +]
988# [+module+] doesn't support [+make_target+].
989[+make_target+]-[+module+]:
990[+ ELSE +]
991[+make_target+]-[+module+]: [+
992 FOR depend +]\
993 [+depend+]-[+module+] [+
994 ENDFOR depend +]
15b527ca 995 @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage)
168b158c 996 @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \
8ec98d6c
NN
997 r=`${PWD_COMMAND}`; export r; \
998 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
a675b75a 999 $(HOST_EXPORTS) \
d5eec917 1000 for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
8ec98d6c
NN
1001 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1002 done; \
1003 echo "Doing [+make_target+] in [+module+]" ; \
7fc2ca22 1004 (cd $(HOST_SUBDIR)/[+module+] && \
8ec98d6c
NN
1005 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1006 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1007 "RANLIB=$${RANLIB}" \
1008 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
d5eec917 1009 [+make_target+]) \
8ec98d6c
NN
1010 || exit 1
1011[+ ENDIF +]
a7e609d6 1012@endif [+module+]
8ec98d6c 1013[+ ENDFOR recursive_targets +]
8ecc6504 1014[+ ENDFOR host_modules +]
bba02726 1015
43bdb69a
NN
1016# ---------------------------------------
1017# Modules which run on the target machine
1018# ---------------------------------------
d6ebd419 1019[+ FOR target_modules +]
43bdb69a 1020
f0fdfd34
PB
1021[+ IF raw_cxx +]
1022[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
15b527ca 1023 check_multilibs=true
f0fdfd34 1024 exports="$(RAW_CXX_TARGET_EXPORTS)"
42f55f77
PB
1025 host_alias=(get "host" "${target_alias}")
1026 target_alias=(get "target" "${target_alias}")
f0fdfd34
PB
1027 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1028
1029[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1030 exports="$(RAW_CXX_TARGET_EXPORTS)"
1031 args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +]
1032[+ ELSE +]
1033[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
15b527ca 1034 check_multilibs=true
f0fdfd34 1035 exports="$(NORMAL_TARGET_EXPORTS)"
42f55f77
PB
1036 host_alias=(get "host" "${target_alias}")
1037 target_alias=(get "target" "${target_alias}")
f0fdfd34
PB
1038 args="$(TARGET_CONFIGARGS)" no-config-site=true +]
1039
1040[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
1041 exports="$(NORMAL_TARGET_EXPORTS)"
1042 args="$(TARGET_FLAGS_TO_PASS)" +]
1043[+ ENDIF +]
70ffc148
NN
1044
1045.PHONY: check-target-[+module+] maybe-check-target-[+module+]
1046maybe-check-target-[+module+]:
a7e609d6
PB
1047@if target-[+module+]
1048maybe-check-target-[+module+]: check-target-[+module+]
8ecc6504
NN
1049[+ IF no_check +]
1050# Dummy target for uncheckable module.
8ecc6504
NN
1051check-target-[+module+]:
1052[+ ELSE check +]
d6ebd419 1053check-target-[+module+]:
15b527ca 1054 @: $(MAKE); $(unstage)
5230d454 1055 @r=`${PWD_COMMAND}`; export r; \
f3fd76d4 1056 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
a675b75a
DD
1057IF raw_cxx +]
1058 $(RAW_CXX_TARGET_EXPORTS) \[+
1059ELSE normal_cxx +]
1060 $(NORMAL_TARGET_EXPORTS) \[+
1061ENDIF raw_cxx +]
2245eb63
NN
1062 (cd $(TARGET_SUBDIR)/[+module+] && \
1063 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+
1064 IF raw_cxx
1065 +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+
1066 ENDIF raw_cxx
63673a5b 1067 +] [+extra_make_flags+] check)
d6ebd419 1068[+ ENDIF no_check +]
a7e609d6 1069@endif target-[+module+]
70ffc148 1070
c5e4bb70
NN
1071.PHONY: install-target-[+module+] maybe-install-target-[+module+]
1072maybe-install-target-[+module+]:
a7e609d6
PB
1073@if target-[+module+]
1074maybe-install-target-[+module+]: install-target-[+module+]
70ffc148 1075[+ IF no_install +]
c5e4bb70
NN
1076# Dummy target for uninstallable.
1077install-target-[+module+]:
1078[+ ELSE install +]
d6ebd419 1079install-target-[+module+]: installdirs
15b527ca 1080 @: $(MAKE); $(unstage)
5230d454 1081 @r=`${PWD_COMMAND}`; export r; \
f3fd76d4 1082 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
a675b75a
DD
1083IF raw_cxx +]
1084 $(RAW_CXX_TARGET_EXPORTS) \[+
1085ELSE normal_cxx +]
1086 $(NORMAL_TARGET_EXPORTS) \[+
1087ENDIF raw_cxx +]
2245eb63 1088 (cd $(TARGET_SUBDIR)/[+module+] && \
63673a5b 1089 $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install)
d6ebd419 1090[+ ENDIF no_install +]
a7e609d6 1091@endif target-[+module+]
8ec98d6c 1092
39bbbb69 1093# Other targets (info, dvi, pdf, etc.)
8ec98d6c
NN
1094[+ FOR recursive_targets +]
1095.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+]
1096maybe-[+make_target+]-target-[+module+]:
a7e609d6
PB
1097@if target-[+module+]
1098maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+]
8ec98d6c
NN
1099[+ IF (match-value? = "missing" (get "make_target") ) +]
1100# [+module+] doesn't support [+make_target+].
1101[+make_target+]-target-[+module+]:
1102[+ ELSE +]
1103[+make_target+]-target-[+module+]: [+
1104 FOR depend +]\
1105 [+depend+]-target-[+module+] [+
1106 ENDFOR depend +]
15b527ca 1107 @: $(MAKE); $(unstage)
8ec98d6c
NN
1108 @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
1109 r=`${PWD_COMMAND}`; export r; \
f3fd76d4 1110 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
a675b75a
DD
1111IF raw_cxx +]
1112 $(RAW_CXX_TARGET_EXPORTS) \[+
1113ELSE normal_cxx +]
1114 $(NORMAL_TARGET_EXPORTS) \[+
1115ENDIF raw_cxx +]
8ec98d6c
NN
1116 echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \
1117 for flag in $(EXTRA_TARGET_FLAGS); do \
1118 eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
1119 done; \
1120 (cd $(TARGET_SUBDIR)/[+module+] && \
1121 $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
1122 "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
1123 "RANLIB=$${RANLIB}" \
1124 "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
63673a5b 1125 [+extra_make_flags+] [+make_target+]) \
8ec98d6c
NN
1126 || exit 1
1127[+ ENDIF +]
a7e609d6 1128@endif target-[+module+]
8ec98d6c 1129[+ ENDFOR recursive_targets +]
d6ebd419 1130[+ ENDFOR target_modules +]
bba02726 1131
43bdb69a
NN
1132# ----------
1133# GCC module
1134# ----------
1135
e1666221 1136@if gcc-no-bootstrap
bba02726 1137.PHONY: cross
6a19fd82 1138cross: all-build all-gas all-ld
5230d454
L
1139 @r=`${PWD_COMMAND}`; export r; \
1140 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
63673a5b 1141 $(HOST_EXPORTS) \
bba02726
NN
1142 echo "Building the C and C++ compiler"; \
1143 cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
5230d454
L
1144 @r=`${PWD_COMMAND}`; export r; \
1145 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
bba02726 1146 echo "Building runtime libraries"; \
21ff191e 1147 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
e1666221 1148@endif gcc-no-bootstrap
bba02726 1149
a7e609d6 1150@if gcc
d97f0f72
JM
1151.PHONY: check-gcc-c++
1152check-gcc-c++:
bba02726 1153 @if [ -f ./gcc/Makefile ] ; then \
5230d454
L
1154 r=`${PWD_COMMAND}`; export r; \
1155 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
63673a5b 1156 $(HOST_EXPORTS) \
6dbec167 1157 (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
bba02726
NN
1158 else \
1159 true; \
d97f0f72
JM
1160 fi
1161
1162.PHONY: check-c++
2a33c5f1 1163check-c++: check-target-libstdc++-v3 check-gcc-c++
bba02726 1164
43bdb69a
NN
1165# Install the gcc headers files, but not the fixed include files,
1166# which Cygnus is not allowed to distribute. This rule is very
1167# dependent on the workings of the gcc Makefile.in.
1168.PHONY: gcc-no-fixedincludes
1169gcc-no-fixedincludes:
1170 @if [ -f ./gcc/Makefile ]; then \
1171 rm -rf gcc/tmp-include; \
1172 mv gcc/include gcc/tmp-include 2>/dev/null; \
1173 mkdir gcc/include; \
1174 cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
1175 touch gcc/stmp-fixinc gcc/include/fixed; \
1176 rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
5230d454
L
1177 r=`${PWD_COMMAND}`; export r; \
1178 s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
63673a5b 1179 $(HOST_EXPORTS) \
6dbec167 1180 (cd ./gcc && \
43bdb69a
NN
1181 $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
1182 rm -rf gcc/include; \
1183 mv gcc/tmp-include gcc/include 2>/dev/null; \
1184 else true; fi
a7e609d6 1185@endif gcc
8ec98d6c 1186
457eaf16
NN
1187# ---------------------
1188# GCC bootstrap support
1189# ---------------------
1190
d5eec917
PB
1191# We track the current stage (the one in 'gcc') in the stage_current file.
1192# stage_last instead tracks the stage that was built last. These targets
1193# are dummy when toplevel bootstrap is not active.
1194
168b158c 1195# While making host and target tools, symlinks to the final stage must be
15b527ca
PB
1196# there, so $(unstage) should be run at various points. To avoid excessive
1197# recursive invocations of make, we "inline" them using a variable. These
1198# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
1199# to avoid warnings from the GNU Make job server.
168b158c
PB
1200
1201unstage = :
1202stage = :
ec92c4d6 1203current_stage = ""
168b158c 1204
d5eec917 1205@if gcc-bootstrap
0b66ef4c 1206unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi
7e958b2e 1207stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi
ec92c4d6 1208current_stage = "`cat stage_current 2> /dev/null`"
d5eec917
PB
1209@endif gcc-bootstrap
1210
168b158c
PB
1211.PHONY: unstage stage
1212unstage:
15b527ca 1213 @: $(MAKE); $(unstage)
d5eec917 1214stage:
15b527ca 1215 @: $(MAKE); $(stage)
d5eec917 1216
e3c08f94
PB
1217# Disable commands for lean bootstrap.
1218LEAN = false
1219
35269421
PB
1220# We name the build directories for the various stages "stage1-gcc",
1221# "stage2-gcc","stage3-gcc", etc.
1222
1223# Since the 'compare' process will fail (on debugging information) if any
1224# directory names are different, we need to link the gcc directory for
15b527ca 1225# the previous stage to a constant name ('prev-gcc'), and to make the name of
35269421
PB
1226# the build directories constant as well. For the latter, we use naked names
1227# like 'gcc', because the scripts in that directory assume it. We use
1228# mv on platforms where symlinks to directories do not work or are not
1229# reliable.
1230
457eaf16
NN
1231# 'touch' doesn't work right on some platforms.
1232STAMP = echo timestamp >
1233
35269421
PB
1234# We only want to compare .o files, so set this!
1235objext = .o
457eaf16 1236
35269421 1237[+ FOR bootstrap-stage +]
e1666221 1238.PHONY: stage[+id+]-start stage[+id+]-end
35269421 1239
21ff191e 1240stage[+id+]-start::
15b527ca 1241 @: $(MAKE); $(stage); \
d5eec917 1242 echo stage[+id+] > stage_current ; \
7fc2ca22 1243 echo stage[+id+] > stage_last; \
15b527ca 1244 $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+
7fc2ca22 1245 FOR host_modules +][+ IF bootstrap +]
6a19fd82 1246@if [+ module +]
7fc2ca22
PB
1247 @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \
1248 mkdir stage[+id+]-[+module+]; \
e3c08f94
PB
1249 mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \
1250 mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +]
15b527ca
PB
1251@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1252 @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \
1253 mkdir stage[+id+]-$(TARGET_SUBDIR); \
e3c08f94
PB
1254 mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \
1255 mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +]
35269421 1256
e3c08f94 1257stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +]
6a19fd82 1258@if [+ module +]
e3c08f94
PB
1259 @if test -d $(HOST_SUBDIR)/[+module+] ; then \
1260 cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \
1261 mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \
15b527ca
PB
1262 fi
1263@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +]
1264 @if test -d $(TARGET_SUBDIR) ; then \
e3c08f94
PB
1265 mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \
1266 mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \
15b527ca 1267 fi
e3c08f94 1268 rm -f stage_current
35269421 1269
d3531b73 1270# Bubble a bug fix through all the stages up to stage [+id+]. They are
15b527ca
PB
1271# remade, but not reconfigured. The next stage (if any) will not be
1272# reconfigured as well.
e1666221 1273.PHONY: stage[+id+]-bubble
e3c08f94 1274stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
ecebee48
PB
1275 @r=`${PWD_COMMAND}`; export r; \
1276 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1277 if test -f stage[+id+]-lean [+
ebc58bf8
PB
1278 IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \
1279 echo Skipping rebuild of stage[+id+] ; \
1280 else \
e3c08f94
PB
1281 $(MAKE) stage[+id+]-start; \[+IF lean +]
1282 if $(LEAN); then \
1283 rm -rf stage[+lean+]-* ; \
1284 $(STAMP) stage[+lean+]-lean ; \
1285 fi; \[+ ENDIF lean +]
168b158c 1286 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \
a7dc05b5 1287 fi[+ IF compare-target +]
7e958b2e 1288 $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
6a19fd82 1289
99df82b9 1290.PHONY: all-stage[+id+] clean-stage[+id+]
99df82b9 1291do-clean: clean-stage[+id+]
457eaf16 1292
6a19fd82
PB
1293# FIXME: Will not need to be conditional when toplevel bootstrap is the
1294# only possibility, but now it conflicts with no-bootstrap rules
1295@if gcc-bootstrap
35269421 1296[+ IF compare-target +]
ebc58bf8 1297[+compare-target+]:
ecebee48
PB
1298 @r=`${PWD_COMMAND}`; export r; \
1299 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1300 if test -f stage[+prev+]-lean; then \
ebc58bf8
PB
1301 echo Cannot compare object files as stage [+prev+] was deleted. ; \
1302 exit 0 ; \
1303 fi; \
15b527ca 1304 : $(MAKE); $(stage); \
457eaf16 1305 rm -f .bad_compare ; \
ec92c4d6 1306 echo Comparing stages [+prev+] and [+id+] ; \
35269421 1307 cd stage[+id+]-gcc; \
457eaf16
NN
1308 files=`find . -name "*$(objext)" -print` ; \
1309 cd .. ; \
1310 for file in $${files} ; do \
35269421 1311 f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
866c244e 1312 @do_compare@ > /dev/null 2>&1; \
168b158c
PB
1313 if test $$? -eq 1; then \
1314 case $$file in \
1315 ./cc*-checksum$(objext) | ./libgcc/* ) \
1316 echo warning: $$file differs ;; \
1317 *) \
1318 echo $$file differs >> .bad_compare ;; \
1319 esac ; \
1320 fi ; \
457eaf16
NN
1321 done ; \
1322 if [ -f .bad_compare ]; then \
1323 echo "Bootstrap comparison failure!"; \
1324 cat .bad_compare; \
1325 exit 1; \
1326 else \
ec92c4d6 1327 echo Comparison successful.; \
457eaf16 1328 fi ; \
ebc58bf8 1329 $(STAMP) [+compare-target+][+ IF prev +]
e3c08f94
PB
1330 if $(LEAN); then \
1331 rm -rf stage[+prev+]-*; \
1332 $(STAMP) stage[+prev+]-lean; \
1333 fi[+ ENDIF prev +]
35269421
PB
1334[+ ENDIF compare-target +]
1335
1336[+ IF bootstrap-target +]
e3c08f94 1337.PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean
a7dc05b5
PB
1338[+bootstrap-target+]:
1339 echo stage[+id+] > stage_final
1340 @r=`${PWD_COMMAND}`; export r; \
1341 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1342 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
15b527ca 1343 @: $(MAKE); $(unstage)
a7dc05b5
PB
1344 @r=`${PWD_COMMAND}`; export r; \
1345 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1346 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
e3c08f94
PB
1347
1348[+bootstrap-target+]-lean:
1349 echo stage[+id+] > stage_final
1350 @r=`${PWD_COMMAND}`; export r; \
1351 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1352 $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble
1353 @: $(MAKE); $(unstage)
1354 @r=`${PWD_COMMAND}`; export r; \
1355 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1356 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
35269421
PB
1357[+ ENDIF bootstrap-target +]
1358
99df82b9 1359# Rules to wipe a stage and all the following ones, also used for cleanstrap
21ff191e 1360[+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +]
99df82b9 1361.PHONY: distclean-stage[+id+]
21ff191e 1362distclean-stage[+id+]::
15b527ca 1363 @: $(MAKE); $(stage)
28826d8f 1364 @test "`cat stage_last`" != stage[+id+] || rm -f stage_last
ebc58bf8 1365 rm -rf stage[+id+]-* [+
35269421 1366 IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
35269421
PB
1367
1368[+ IF cleanstrap-target +]
1369.PHONY: [+cleanstrap-target+]
28826d8f
PB
1370[+cleanstrap-target+]: do-distclean local-clean
1371 echo stage[+id+] > stage_final
1372 @r=`${PWD_COMMAND}`; export r; \
1373 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1374 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble
1375 @: $(MAKE); $(unstage)
1376 @r=`${PWD_COMMAND}`; export r; \
1377 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
1378 $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target
35269421 1379[+ ENDIF cleanstrap-target +]
6a19fd82 1380@endif gcc-bootstrap
35269421
PB
1381
1382[+ ENDFOR bootstrap-stage +]
21ff191e 1383
6bfab24e
PB
1384stageprofile-end::
1385 $(MAKE) distclean-stagefeedback
21ff191e 1386
6bfab24e 1387stagefeedback-start::
21ff191e
PB
1388 @r=`${PWD_COMMAND}`; export r; \
1389 s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
6bfab24e
PB
1390 for i in prev-*; do \
1391 j=`echo $$i | sed s/^prev-//` ; \
1392 cd $$r/$$i && \
1393 { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \
1394 { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \
1395 done
866c244e 1396
99df82b9 1397@if gcc-bootstrap
99df82b9 1398do-distclean: distclean-stage1
ec92c4d6
PB
1399
1400# Provide a GCC build when we're building target libraries. This does
1401# not work as a dependency, just as the minimum necessary to avoid errors.
1402stage_last:
1403 $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble
99df82b9 1404
e1e5148c
CD
1405# Same as unstage, but not phony and defaulting to stage1-start. We place
1406# it in the dependency so that for example `make -j3 all-gcc' works.
1407stage_current:
1408 @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi
1409
ec92c4d6
PB
1410.PHONY: restrap
1411restrap:
1412 @: $(MAKE); $(stage)
1413 rm -rf stage1-$(TARGET_SUBDIR) [+ FOR bootstrap-stage +][+ IF prev
5544eee7 1414 +]stage[+id+]-* [+ ENDIF prev +][+ ENDFOR bootstrap-stage +]
ec92c4d6 1415 $(MAKE) $(RECURSE_FLAGS_TO_PASS) all
5544eee7 1416@endif gcc-bootstrap
ec92c4d6 1417
c5ab3a90
NN
1418# --------------------------------------
1419# Dependencies between different modules
1420# --------------------------------------
bba02726 1421
364b9683 1422# Generic dependencies for target modules on host stuff, especially gcc
ec92c4d6
PB
1423@if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap
1424 +][+ FOR bootstrap_stage +]
1425configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+
1426 ENDFOR +][+ ELSE bootstrap +]
1427configure-target-[+module+]: stage_last[+
1428 ENDIF bootstrap +][+ ENDFOR target_modules +]
1429@endif gcc-bootstrap
1430
1f316156 1431@if gcc-no-bootstrap[+ FOR target_modules +]
ec92c4d6 1432configure-target-[+module+]: maybe-all-gcc[+
1f316156 1433 ENDFOR target_modules +]
ec92c4d6
PB
1434@endif gcc-no-bootstrap
1435
364b9683 1436
c5ab3a90
NN
1437# There are two types of dependencies here: 'hard' dependencies, where one
1438# module simply won't build without the other; and 'soft' dependencies, where
1439# if the depended-on module is missing, the depending module will do without
1440# or find a substitute somewhere (perhaps installed). Soft dependencies
364b9683 1441# are made here to depend on a 'maybe-' target. If you're not sure,
c5ab3a90
NN
1442# it's safer to use a soft dependency.
1443
364b9683
PB
1444[+ ;; These Scheme functions build the bulk of the dependencies.
1445 ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc",
1446 ;; where "maybe-" is only included if HARD is true, and all-gcc
1447 ;; is taken from VAR-NAME.
1448 (define dep-target (lambda (module-kind var-name hard)
1449 (string-append
1450 (if hard "" "maybe-")
1451 (dep-subtarget var-name)
1452 module-kind
1453 (dep-module var-name)
1454 )))
1455
1456 ;; make-dep builds a dependency from the MODULE and ON AutoGen vars.
6a19fd82 1457 (define make-dep (lambda (module-kind on-kind)
364b9683
PB
1458 (string-append
1459 (dep-target module-kind "module" #t) ": "
6a19fd82 1460 (dep-target on-kind "on" (exist? "hard")))))
364b9683
PB
1461
1462 ;; dep-subtarget extracts everything up to the first dash in the given
1463 ;; AutoGen variable, for example it extracts "all-" out of "all-gcc".
1464 (define dep-subtarget (lambda (var-name)
1465 (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-)))))
1466
1467 ;; dep-module extracts everything up to the first dash in the given
1468 ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc".
1469 (define dep-module (lambda (var-name)
1470 (substring (get var-name) (+ 1 (string-index (get var-name) #\-)))))
1471
1472 ;; dep-stage builds a string for the prefix of a bootstrap stage.
1473 (define dep-stage (lambda ()
1474 (string-append
1475 "stage"
1476 (get "id")
1477 "-")))
1478
1479 ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'"
1480 ;; but is written in Scheme.
1481 (define dep-maybe (lambda ()
1482 (if (exist? "hard") "" "maybe-")))
1483
da3e88ae
DD
1484 ;; dep-kind returns "normal" if the dependency is on an "install" target,
1485 ;; or if either module is not bootstrapped. It returns "bootstrap" for
364b9683
PB
1486 ;; configure or build dependencies between bootstrapped modules; it returns
1487 ;; "prebootstrap" for configure or build dependencies of bootstrapped
6a19fd82 1488 ;; modules on a build module (e.g. all-gcc on all-build-bison). All this
364b9683
PB
1489 ;; is only necessary for host modules.
1490 (define dep-kind (lambda ()
6a19fd82
PB
1491 (if (and (hash-ref boot-modules (dep-module "module"))
1492 (=* (dep-module "on") "build-"))
1493 "prebootstrap"
364b9683 1494
6a19fd82 1495 (if (or (= (dep-subtarget "on") "install-")
da3e88ae
DD
1496 (not (hash-ref boot-modules (dep-module "module")))
1497 (not (hash-ref boot-modules (dep-module "on"))))
6a19fd82
PB
1498 "normal"
1499 "bootstrap"))))
364b9683
PB
1500
1501 ;; We now build the hash table that is used by dep-kind.
1502 (define boot-modules (make-hash-table 113))
364b9683
PB
1503+]
1504
1505[+ FOR host_modules +][+
1506 (if (exist? "bootstrap")
1507 (hash-create-handle! boot-modules (get "module") #t))
1508 "" +][+ ENDFOR host_modules +]
04639fa6
PB
1509[+ FOR target_modules +][+
1510 (if (exist? "bootstrap")
1511 (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t))
1512 "" +][+ ENDFOR target_modules +]
364b9683
PB
1513
1514# With all the machinery above in place, it is pretty easy to generate
1515# dependencies. Host dependencies are a bit more complex because we have
1516# to check for bootstrap/prebootstrap dependencies. To resolve
1517# prebootstrap dependencies, prebootstrap modules are gathered in
1518# a hash table.
6a19fd82
PB
1519[+ FOR dependencies +][+ (make-dep "" "") +]
1520[+ CASE (dep-kind) +]
1521[+ == "prebootstrap"
364b9683 1522 +][+ FOR bootstrap_stage +]
6a19fd82
PB
1523[+ (make-dep (dep-stage) "") +][+
1524 ENDFOR bootstrap_stage +]
6a19fd82
PB
1525[+ == "bootstrap"
1526 +][+ FOR bootstrap_stage +]
1527[+ (make-dep (dep-stage) (dep-stage)) +][+
364b9683
PB
1528 ENDFOR bootstrap_stage +]
1529[+ ESAC +][+
1530ENDFOR dependencies +]
1531
1f316156
DJ
1532# Dependencies for target modules on other target modules are
1533# described by lang_env_dependencies; the defaults apply to anything
1534# not mentioned there.
1535[+
1536 ;; Predicate for whether LANG was specified in lang_env_dependencies.
1537 (define lang-dep (lambda (lang)
1538 (hash-ref lang-env-deps (string-append (get "module") "-" lang))))
1539
1540 ;; Build the hash table we will need.
1541 (define lang-env-deps (make-hash-table 7))
1542+][+ FOR lang_env_dependencies +][+
1543 (if (exist? "cxx")
1544 (hash-create-handle! lang-env-deps
1545 (string-append (get "module") "-" "cxx") #t))
1546
1547 (if (exist? "no_c")
1548 (hash-create-handle! lang-env-deps
1549 (string-append (get "module") "-" "no_c") #t))
1550
1551 (if (exist? "no_gcc")
1552 (hash-create-handle! lang-env-deps
1553 (string-append (get "module") "-" "no_gcc") #t))
1554 "" +][+ ENDFOR lang_env_dependencies +]
1555
1556@if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc"))
1557 +][+ IF bootstrap +][+ FOR bootstrap_stage +]
1558configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+
1559 ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +]
1560@endif gcc-bootstrap
1561
1562@if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +]
1563configure-target-[+module+]: maybe-all-target-libgcc[+
1564 ENDIF +][+ ENDFOR target_modules +]
1565@endif gcc-no-bootstrap
1566
1567[+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +]
1568configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+
1569 ENDIF +][+ IF (lang-dep "cxx") +]
1570configure-target-[+module+]: maybe-all-target-libstdc++-v3[+
1571 ENDIF +]
1572[+ ENDFOR target_modules +]
1573
81cdf522 1574CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@
c5ab3a90 1575GDB_TK = @GDB_TK@
81cdf522
DJ
1576INSTALL_GDB_TK = @INSTALL_GDB_TK@
1577configure-gdb: $(CONFIGURE_GDB_TK)
364b9683 1578all-gdb: $(gdbnlmrequirements) $(GDB_TK)
81cdf522 1579install-gdb: $(INSTALL_GDB_TK)
00f56d7b 1580
d8e6f006
NN
1581# Serialization dependencies. Host configures don't work well in parallel to
1582# each other, due to contention over config.cache. Target configures and
1583# build configures are similar.
1584@serialization_dependencies@
1585
43bdb69a
NN
1586# --------------------------------
1587# Regenerating top level configury
1588# --------------------------------
bba02726
NN
1589
1590# Rebuilding Makefile.in, using autogen.
81011f17 1591AUTOGEN = autogen
3728f201 1592$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
81011f17 1593 cd $(srcdir) && $(AUTOGEN) Makefile.def
bba02726 1594
bafecfd6 1595# Rebuilding Makefile.
81011f17
AO
1596Makefile: $(srcdir)/Makefile.in config.status
1597 CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
1598
9e6daff1 1599config.status: configure
08bf2e60 1600 CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck
bba02726 1601
bafecfd6 1602# Rebuilding configure.
81011f17 1603AUTOCONF = autoconf
b58b6ee1 1604$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4
81011f17 1605 cd $(srcdir) && $(AUTOCONF)
bba02726 1606
1c53cd00
NN
1607# ------------------------------
1608# Special directives to GNU Make
1609# ------------------------------
1610
1c53cd00
NN
1611# Don't pass command-line variables to submakes.
1612.NOEXPORT:
1613MAKEOVERRIDES=
1614
bba02726 1615# end of Makefile.in
This page took 0.314216 seconds and 5 git commands to generate.