OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [Makefile.tpl] - Blame information for rev 277

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.