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