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