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