1# Makefile for GNU Compiler Collection
2# Run 'configure' to generate Makefile from Makefile.in
3
4# Copyright (C) 1987-2020 Free Software Foundation, Inc.
5
6#This file is part of GCC.
7
8#GCC is free software; you can redistribute it and/or modify
9#it under the terms of the GNU General Public License as published by
10#the Free Software Foundation; either version 3, or (at your option)
11#any later version.
12
13#GCC is distributed in the hope that it will be useful,
14#but WITHOUT ANY WARRANTY; without even the implied warranty of
15#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16#GNU General Public License for more details.
17
18#You should have received a copy of the GNU General Public License
19#along with GCC; see the file COPYING3.  If not see
20#<http://www.gnu.org/licenses/>.
21
22# The targets for external use include:
23# all, doc, install, install-cross, install-cross-rest, install-strip,
24# uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean.
25
26# This is the default target.
27# Set by autoconf to "all.internal" for a native build, or
28# "all.cross" to build a cross compiler.
29all: @ALL@
30
31# Depend on this to specify a phony target portably.
32force:
33
34# This tells GNU make version 3 not to export the variables
35# defined in this file into the environment (and thus recursive makes).
36.NOEXPORT:
37# And this tells it not to automatically pass command-line variables
38# to recursive makes.
39MAKEOVERRIDES =
40
41# Suppress smart makes who think they know how to automake yacc and flex file
42.y.c:
43.l.c:
44
45# The only suffixes we want for implicit rules are .c and .o, so clear
46# the list and add them.  This speeds up GNU Make, and allows -r to work.
47# For i18n support, we also need .gmo, .po, .pox.
48# This must come before the language makefile fragments to allow them to
49# add suffixes and rules of their own.
50.SUFFIXES:
51.SUFFIXES: .c .cc .o .po .pox .gmo
52
53# -------------------------------
54# Standard autoconf-set variables
55# -------------------------------
56
57build=@build@
58host=@host@
59host_noncanonical=@host_noncanonical@
60host_os=@host_os@
61target=@target@
62target_noncanonical:=@target_noncanonical@
63
64# Normally identical to target_noncanonical, except for compilers built
65# as accelerator targets.
66real_target_noncanonical:=@real_target_noncanonical@
67accel_dir_suffix = @accel_dir_suffix@
68
69# Sed command to transform gcc to installed name.
70program_transform_name := @program_transform_name@
71
72# -----------------------------
73# Directories used during build
74# -----------------------------
75
76# Directory where sources are, from where we are.
77srcdir = @srcdir@
78gcc_docdir = @srcdir@/doc
79
80# Directory where sources are, absolute.
81abs_srcdir = @abs_srcdir@
82abs_docdir = @abs_srcdir@/doc
83
84# Directory where sources are, relative to here.
85top_srcdir = @top_srcdir@
86
87# Top build directory for this package, relative to here.
88top_builddir = .
89
90# The absolute path to the current directory.
91objdir := $(shell pwd)
92
93host_subdir=@host_subdir@
94build_subdir=@build_subdir@
95target_subdir=@target_subdir@
96build_libsubdir=@build_libsubdir@
97
98# Top build directory for the "Cygnus tree", relative to $(top_builddir).
99ifeq ($(host_subdir),.)
100toplevel_builddir := ..
101else
102toplevel_builddir := ../..
103endif
104
105build_objdir := $(toplevel_builddir)/$(build_subdir)
106build_libobjdir := $(toplevel_builddir)/$(build_libsubdir)
107target_objdir := $(toplevel_builddir)/$(target_subdir)
108
109# --------
110# Defined vpaths
111# --------
112
113# Directory where sources are, from where we are.
114VPATH = @srcdir@
115
116# We define a vpath for the sources of the .texi files here because they
117# are split between multiple directories and we would rather use one implicit
118# pattern rule for everything.
119# This vpath could be extended within the Make-lang fragments.
120
121vpath %.texi $(gcc_docdir)
122vpath %.texi $(gcc_docdir)/include
123
124# --------
125# UNSORTED
126# --------
127
128# Extra flags to pass to indicate cross compilation, which
129# might be used or tested by Make-lang fragments.
130CROSS=@CROSS@
131
132# Variables that exist for you to override.
133# See below for how to change them for certain systems.
134
135# List of language subdirectories.
136SUBDIRS =@subdirs@ build
137
138# Selection of languages to be made.
139CONFIG_LANGUAGES = @all_selected_languages@
140LANGUAGES = c $(CONFIG_LANGUAGES)
141ifeq (@enable_gcov@,yes)
142LANGUAGES += gcov$(exeext) gcov-dump$(exeext) gcov-tool$(exeext)
143endif
144
145# Default values for variables overridden in Makefile fragments.
146# CFLAGS is for the user to override to, e.g., do a cross build with -O2.
147# TCFLAGS is used for compilations with the GCC just built.
148# T_CFLAGS is used for all compilations and is overridden by t-* files.
149T_CFLAGS =
150TCFLAGS =
151CFLAGS = @CFLAGS@
152CXXFLAGS = @CXXFLAGS@
153LDFLAGS = @LDFLAGS@
154
155# Should we build position-independent host code?
156PICFLAG = @PICFLAG@
157
158# Flags to determine code coverage. When coverage is disabled, this will
159# contain the optimization flags, as you normally want code coverage
160# without optimization.
161COVERAGE_FLAGS = @coverage_flags@
162coverageexts = .{gcda,gcno}
163
164# The warning flags are separate from CFLAGS because people tend to
165# override optimization flags and we'd like them to still have warnings
166# turned on.  These flags are also used to pass other stage dependent
167# flags from configure.  The user is free to explicitly turn these flags
168# off if they wish.
169# LOOSE_WARN are the warning flags to use when compiling something
170# which is only compiled with gcc, such as libgcc.
171# C_LOOSE_WARN is similar, but with C-only warnings.
172# STRICT_WARN are the additional warning flags to
173# apply to the back end and some front ends, which may be compiled
174# with other compilers.
175# C_STRICT_WARN is similar, with C-only warnings.
176LOOSE_WARN = @loose_warn@
177C_LOOSE_WARN = @c_loose_warn@
178STRICT_WARN = @strict_warn@
179C_STRICT_WARN = @c_strict_warn@
180
181# This is set by --enable-checking.  The idea is to catch forgotten
182# "extern" tags in header files.
183NOCOMMON_FLAG = @nocommon_flag@
184
185NOEXCEPTION_FLAGS = @noexception_flags@
186
187ALIASING_FLAGS = @aliasing_flags@
188
189# This is set by --disable-maintainer-mode (default) to "#"
190# FIXME: 'MAINT' will always be set to an empty string, no matter if
191# --disable-maintainer-mode is used or not.  This is because the
192# following will expand to "MAINT := " in maintainer mode, and to
193# "MAINT := #" in non-maintainer mode, but because '#' starts a comment,
194# they mean exactly the same thing for make.
195MAINT := @MAINT@
196
197# The following provides the variable ENABLE_MAINTAINER_RULES that can
198# be used in language Make-lang.in makefile fragments to enable
199# maintainer rules.  So, ENABLE_MAINTAINER_RULES is 'true' in
200# maintainer mode, and '' otherwise.
201@MAINT@ ENABLE_MAINTAINER_RULES = true
202
203# These are set by --enable-checking=valgrind.
204RUN_GEN = @valgrind_command@
205VALGRIND_DRIVER_DEFINES = @valgrind_path_defines@
206
207# This is how we control whether or not the additional warnings are applied.
208.-warn = $(STRICT_WARN)
209build-warn = $(STRICT_WARN)
210GCC_WARN_CFLAGS = $(LOOSE_WARN) $(C_LOOSE_WARN) $($(@D)-warn) $(if $(filter-out $(STRICT_WARN),$($(@D)-warn)),,$(C_STRICT_WARN)) $(NOCOMMON_FLAG) $($@-warn)
211GCC_WARN_CXXFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG) $($@-warn)
212
213# These files are to have specific diagnostics suppressed, or are not to
214# be subject to -Werror:
215# flex output may yield harmless "no previous prototype" warnings
216build/gengtype-lex.o-warn = -Wno-error
217gengtype-lex.o-warn = -Wno-error
218libgcov-util.o-warn = -Wno-error
219libgcov-driver-tool.o-warn = -Wno-error
220libgcov-merge-tool.o-warn = -Wno-error
221gimple-match.o-warn = -Wno-unused
222generic-match.o-warn = -Wno-unused
223dfp.o-warn = -Wno-strict-aliasing
224
225# All warnings have to be shut off in stage1 if the compiler used then
226# isn't gcc; configure determines that.  WARN_CFLAGS will be either
227# $(GCC_WARN_CFLAGS), or nothing.  Similarly, WARN_CXXFLAGS will be
228# either $(GCC_WARN_CXXFLAGS), or nothing.
229WARN_CFLAGS = @warn_cflags@
230WARN_CXXFLAGS = @warn_cxxflags@
231
232CPPFLAGS = @CPPFLAGS@
233
234AWK = @AWK@
235CC = @CC@
236CXX = @CXX@
237BISON = @BISON@
238BISONFLAGS =
239FLEX = @FLEX@
240FLEXFLAGS =
241AR = @AR@
242AR_FLAGS = rc
243NM = @NM@
244RANLIB = @RANLIB@
245RANLIB_FLAGS = @ranlib_flags@
246
247# Libraries to use on the host.
248HOST_LIBS = @HOST_LIBS@
249
250# The name of the compiler to use.
251COMPILER = $(CXX)
252COMPILER_FLAGS = $(CXXFLAGS)
253# If HOST_LIBS is set, then the user is controlling the libraries to
254# link against.  In that case, link with $(CC) so that the -lstdc++
255# library is not introduced.  If HOST_LIBS is not set, link with
256# $(CXX) to pick up -lstdc++.
257ifeq ($(HOST_LIBS),)
258LINKER = $(CXX)
259LINKER_FLAGS = $(CXXFLAGS)
260else
261LINKER = $(CC)
262LINKER_FLAGS = $(CFLAGS)
263endif
264
265NO_PIE_CFLAGS = @NO_PIE_CFLAGS@
266NO_PIE_FLAG = @NO_PIE_FLAG@
267
268# We don't want to compile the compilers with -fPIE, it make PCH fail.
269COMPILER += $(NO_PIE_CFLAGS)
270
271# Link with -no-pie since we compile the compiler with -fno-PIE.
272LINKER += $(NO_PIE_FLAG)
273
274# Like LINKER, but use a mutex for serializing front end links.
275ifeq (@DO_LINK_MUTEX@,true)
276LLINKER = $(SHELL) $(srcdir)/lock-and-run.sh linkfe.lck $(LINKER)
277else
278LLINKER = $(LINKER)
279endif
280
281THIN_ARCHIVE_SUPPORT = @thin_archive_support@
282
283USE_THIN_ARCHIVES = no
284ifeq ($(THIN_ARCHIVE_SUPPORT),yes)
285ifeq ($(AR_FLAGS),rc)
286ifeq ($(RANLIB_FLAGS),)
287USE_THIN_ARCHIVES = yes
288endif
289endif
290endif
291
292# -------------------------------------------
293# Programs which operate on the build machine
294# -------------------------------------------
295
296SHELL = @SHELL@
297# pwd command to use.  Allow user to override default by setting PWDCMD in
298# the environment to account for automounters.  The make variable must not
299# be called PWDCMD, otherwise the value set here is passed to make
300# subprocesses and overrides the setting from the user's environment.
301# Don't use PWD since it is a common shell environment variable and we
302# don't want to corrupt it.
303PWD_COMMAND = $${PWDCMD-pwd}
304# on sysV, define this as cp.
305INSTALL = @INSTALL@
306# Some systems may be missing symbolic links, regular links, or both.
307# Allow configure to check this and use "ln -s", "ln", or "cp" as appropriate.
308LN=@LN@
309LN_S=@LN_S@
310# These permit overriding just for certain files.
311INSTALL_PROGRAM = @INSTALL_PROGRAM@
312INSTALL_DATA = @INSTALL_DATA@
313INSTALL_SCRIPT = @INSTALL@
314install_sh = $(SHELL) $(srcdir)/../install-sh
315INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
316MAKEINFO = @MAKEINFO@
317MAKEINFOFLAGS = --no-split
318TEXI2DVI = texi2dvi
319TEXI2PDF = texi2pdf
320TEXI2HTML = $(MAKEINFO) --html
321TEXI2POD = perl $(srcdir)/../contrib/texi2pod.pl
322POD2MAN = pod2man --center="GNU" --release="gcc-$(version)" --date=$(shell sed 's/\(....\)\(..\)\(..\)/\1-\2-\3/' <$(DATESTAMP))
323# Some versions of `touch' (such as the version on Solaris 2.8)
324# do not correctly set the timestamp due to buggy versions of `utime'
325# in the kernel.  So, we use `echo' instead.
326STAMP = echo timestamp >
327# If necessary (e.g., when using the MSYS shell on Microsoft Windows)
328# translate the shell's notion of absolute pathnames to the native
329# spelling.
330build_file_translate = @build_file_translate@
331
332# Make sure the $(MAKE) variable is defined.
333@SET_MAKE@
334
335# Locate mkinstalldirs.
336mkinstalldirs=$(SHELL) $(srcdir)/../mkinstalldirs
337
338# write_entries_to_file - writes each entry in a list
339# to the specified file.  Entries are written in chunks of
340# $(write_entries_to_file_split) to accommodate systems with
341# severe command-line-length limitations.
342# Parameters:
343# $(1): variable containing entries to iterate over
344# $(2): output file
345write_entries_to_file_split = 50
346write_entries_to_file = $(shell rm -f $(2) || :) $(shell touch $(2)) \
347	$(foreach range, \
348	  $(shell i=1; while test $$i -le $(words $(1)); do \
349	     echo $$i; i=`expr $$i + $(write_entries_to_file_split)`; done), \
350	  $(shell echo "$(wordlist $(range), \
351			  $(shell expr $(range) + $(write_entries_to_file_split) - 1), $(1))" \
352	     | tr ' ' '\012' >> $(2)))
353
354# The jit documentation looks better if built with sphinx, but can be
355# built with texinfo if sphinx is not available.
356# configure sets "doc_build_sys" to "sphinx" or "texinfo" accordingly
357doc_build_sys=@doc_build_sys@
358
359# --------
360# UNSORTED
361# --------
362
363# Dependency tracking stuff.
364CXXDEPMODE = @CXXDEPMODE@
365DEPDIR = @DEPDIR@
366depcomp = $(SHELL) $(srcdir)/../depcomp
367
368# In the past we used AC_PROG_CC_C_O and set this properly, but
369# it was discovered that this hadn't worked in a long time, so now
370# we just hard-code.
371OUTPUT_OPTION = -o $@
372
373# This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
374# -I../zlib, unless we were configured with --with-system-zlib, in which
375# case both are empty.
376ZLIB = @zlibdir@ -lz
377ZLIBINC = @zlibinc@
378
379# How to find GMP
380GMPLIBS = @GMPLIBS@
381GMPINC = @GMPINC@
382
383# How to find isl.
384ISLLIBS = @ISLLIBS@
385ISLINC = @ISLINC@
386
387# Set to 'yes' if the LTO front end is enabled.
388enable_lto = @enable_lto@
389
390# Compiler and flags needed for plugin support
391PLUGINCC = @CXX@
392PLUGINCFLAGS = @CXXFLAGS@
393
394# Libs and linker options needed for plugin support
395PLUGINLIBS = @pluginlibs@
396
397enable_plugin = @enable_plugin@
398
399# On MinGW plugin installation involves installing import libraries.
400ifeq ($(enable_plugin),yes)
401  plugin_implib := $(if $(strip $(filter mingw%,$(host_os))),yes,no)
402endif
403
404enable_host_shared = @enable_host_shared@
405
406enable_as_accelerator = @enable_as_accelerator@
407
408CPPLIB = ../libcpp/libcpp.a
409CPPINC = -I$(srcdir)/../libcpp/include
410
411# Where to find decNumber
412enable_decimal_float = @enable_decimal_float@
413DECNUM = $(srcdir)/../libdecnumber
414DECNUMFMT = $(srcdir)/../libdecnumber/$(enable_decimal_float)
415DECNUMINC = -I$(DECNUM) -I$(DECNUMFMT) -I../libdecnumber
416LIBDECNUMBER = ../libdecnumber/libdecnumber.a
417
418# The backtrace library.
419BACKTRACE = $(srcdir)/../libbacktrace
420BACKTRACEINC = -I$(BACKTRACE)
421LIBBACKTRACE = ../libbacktrace/.libs/libbacktrace.a
422
423# Target to use when installing include directory.  Either
424# install-headers-tar, install-headers-cpio or install-headers-cp.
425INSTALL_HEADERS_DIR = @build_install_headers_dir@
426
427# Header files that are made available under the same name
428# to programs compiled with GCC.
429USER_H = $(srcdir)/ginclude/float.h \
430	 $(srcdir)/ginclude/iso646.h \
431	 $(srcdir)/ginclude/stdarg.h \
432	 $(srcdir)/ginclude/stdbool.h \
433	 $(srcdir)/ginclude/stddef.h \
434	 $(srcdir)/ginclude/varargs.h \
435	 $(srcdir)/ginclude/stdfix.h \
436	 $(srcdir)/ginclude/stdnoreturn.h \
437	 $(srcdir)/ginclude/stdalign.h \
438	 $(srcdir)/ginclude/stdatomic.h \
439	 $(EXTRA_HEADERS)
440
441USER_H_INC_NEXT_PRE = @user_headers_inc_next_pre@
442USER_H_INC_NEXT_POST = @user_headers_inc_next_post@
443
444# The GCC to use for compiling crt*.o.
445# Usually the one we just built.
446# Don't use this as a dependency--use $(GCC_PASSES).
447GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) ./xgcc -B./ -B$(build_tooldir)/bin/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include -L$(objdir)/../ld
448
449# Set if the compiler was configured with --with-build-sysroot.
450SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
451
452# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
453# It specifies -B./.
454# It also specifies -isystem ./include to find, e.g., stddef.h.
455GCC_CFLAGS=$(CFLAGS_FOR_TARGET) $(INTERNAL_CFLAGS) $(T_CFLAGS) $(LOOSE_WARN) $(C_LOOSE_WARN) -Wold-style-definition $($@-warn) -isystem ./include $(TCFLAGS)
456
457# ---------------------------------------------------
458# Programs which produce files for the target machine
459# ---------------------------------------------------
460
461AR_FOR_TARGET := $(shell \
462  if [ -f $(objdir)/../binutils/ar ] ; then \
463    echo $(objdir)/../binutils/ar ; \
464  else \
465    if [ "$(host)" = "$(target)" ] ; then \
466      echo $(AR); \
467    else \
468       t='$(program_transform_name)'; echo ar | sed -e "$$t" ; \
469    fi; \
470  fi)
471AR_FLAGS_FOR_TARGET =
472AR_CREATE_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) rc
473AR_EXTRACT_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) x
474LIPO_FOR_TARGET = lipo
475ORIGINAL_AS_FOR_TARGET = @ORIGINAL_AS_FOR_TARGET@
476RANLIB_FOR_TARGET := $(shell \
477  if [ -f $(objdir)/../binutils/ranlib ] ; then \
478    echo $(objdir)/../binutils/ranlib ; \
479  else \
480    if [ "$(host)" = "$(target)" ] ; then \
481      echo $(RANLIB); \
482    else \
483       t='$(program_transform_name)'; echo ranlib | sed -e "$$t" ; \
484    fi; \
485  fi)
486ORIGINAL_LD_FOR_TARGET = @ORIGINAL_LD_FOR_TARGET@
487ORIGINAL_NM_FOR_TARGET = @ORIGINAL_NM_FOR_TARGET@
488NM_FOR_TARGET = ./nm
489STRIP_FOR_TARGET := $(shell \
490  if [ -f $(objdir)/../binutils/strip-new ] ; then \
491    echo $(objdir)/../binutils/strip-new ; \
492  else \
493    if [ "$(host)" = "$(target)" ] ; then \
494      echo strip; \
495    else \
496       t='$(program_transform_name)'; echo strip | sed -e "$$t" ; \
497    fi; \
498  fi)
499
500# --------
501# UNSORTED
502# --------
503
504# Where to find some libiberty headers.
505HASHTAB_H   = $(srcdir)/../include/hashtab.h
506OBSTACK_H   = $(srcdir)/../include/obstack.h
507SPLAY_TREE_H= $(srcdir)/../include/splay-tree.h
508MD5_H	    = $(srcdir)/../include/md5.h
509XREGEX_H    = $(srcdir)/../include/xregex.h
510FNMATCH_H   = $(srcdir)/../include/fnmatch.h
511
512# Linker plugin API headers
513LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
514
515# Default native SYSTEM_HEADER_DIR, to be overridden by targets.
516NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
517# Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
518CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
519
520# autoconf sets SYSTEM_HEADER_DIR to one of the above.
521# Purge it of unnecessary internal relative paths
522# to directories that might not exist yet.
523# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta.
524# Use single quotes here to avoid nested double- and backquotes, this
525# macro is also used in a double-quoted context.
526SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta`
527
528# Path to the system headers on the build machine.
529BUILD_SYSTEM_HEADER_DIR = `echo @BUILD_SYSTEM_HEADER_DIR@ | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta`
530
531# Control whether to run fixincludes.
532STMP_FIXINC = @STMP_FIXINC@
533
534# Test to see whether <limits.h> exists in the system header files.
535LIMITS_H_TEST = [ -f $(BUILD_SYSTEM_HEADER_DIR)/limits.h ]
536
537# Directory for prefix to system directories, for
538# each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc.
539TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
540TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
541
542xmake_file=@xmake_file@
543tmake_file=@tmake_file@
544TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
545TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
546TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
547out_file=$(srcdir)/config/@out_file@
548out_object_file=@out_object_file@
549common_out_file=$(srcdir)/common/config/@common_out_file@
550common_out_object_file=@common_out_object_file@
551md_file=$(srcdir)/common.md $(srcdir)/config/@md_file@
552tm_file_list=@tm_file_list@
553tm_include_list=@tm_include_list@
554tm_defines=@tm_defines@
555tm_p_file_list=@tm_p_file_list@
556tm_p_include_list=@tm_p_include_list@
557tm_d_file_list=@tm_d_file_list@
558tm_d_include_list=@tm_d_include_list@
559build_xm_file_list=@build_xm_file_list@
560build_xm_include_list=@build_xm_include_list@
561build_xm_defines=@build_xm_defines@
562host_xm_file_list=@host_xm_file_list@
563host_xm_include_list=@host_xm_include_list@
564host_xm_defines=@host_xm_defines@
565xm_file_list=@xm_file_list@
566xm_include_list=@xm_include_list@
567xm_defines=@xm_defines@
568lang_checks=
569lang_checks_parallelized=
570lang_opt_files=@lang_opt_files@ $(srcdir)/c-family/c.opt $(srcdir)/common.opt $(srcdir)/params.opt $(srcdir)/analyzer/analyzer.opt
571lang_specs_files=@lang_specs_files@
572lang_tree_files=@lang_tree_files@
573target_cpu_default=@target_cpu_default@
574OBJC_BOEHM_GC=@objc_boehm_gc@
575extra_modes_file=@extra_modes_file@
576extra_opt_files=@extra_opt_files@
577host_hook_obj=@out_host_hook_obj@
578
579# Multiarch support
580enable_multiarch = @enable_multiarch@
581with_cpu = @with_cpu@
582with_float = @with_float@
583ifeq ($(enable_multiarch),yes)
584  if_multiarch = $(1)
585else
586  ifeq ($(enable_multiarch),auto)
587    # SYSTEM_HEADER_DIR is makefile syntax, cannot be evaluated in configure.ac
588    if_multiarch = $(if $(wildcard $(shell echo $(BUILD_SYSTEM_HEADER_DIR))/../../usr/lib/*/crti.o),$(1))
589  else
590    if_multiarch =
591  endif
592endif
593
594# ------------------------
595# Installation directories
596# ------------------------
597
598# Common prefix for installation directories.
599# NOTE: This directory must exist when you start installation.
600prefix = @prefix@
601# Directory in which to put localized header files. On the systems with
602# gcc as the native cc, `local_prefix' may not be `prefix' which is
603# `/usr'.
604# NOTE: local_prefix *should not* default from prefix.
605local_prefix = @local_prefix@
606# Directory in which to put host dependent programs and libraries
607exec_prefix = @exec_prefix@
608# Directory in which to put the executable for the command `gcc'
609bindir = @bindir@
610# Directory in which to put the directories used by the compiler.
611libdir = @libdir@
612# Directory in which GCC puts its executables.
613libexecdir = @libexecdir@
614
615# --------
616# UNSORTED
617# --------
618
619# Directory in which the compiler finds libraries etc.
620libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
621# Directory in which the compiler finds executables
622libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
623# Directory in which all plugin resources are installed
624plugin_resourcesdir = $(libsubdir)/plugin
625 # Directory in which plugin headers are installed
626plugin_includedir = $(plugin_resourcesdir)/include
627# Directory in which plugin specific executables are installed
628plugin_bindir = $(libexecsubdir)/plugin
629# Used to produce a relative $(gcc_tooldir) in gcc.o
630ifeq ($(enable_as_accelerator),yes)
631unlibsubdir = ../../../../..
632else
633unlibsubdir = ../../..
634endif
635# $(prefix), expressed as a path relative to $(libsubdir).
636#
637# An explanation of the sed strings:
638#  -e 's|^$(prefix)||'   matches and eliminates 'prefix' from 'exec_prefix'
639#  -e 's|/$$||'          match a trailing forward slash and eliminates it
640#  -e 's|^[^/]|/|'       forces the string to start with a forward slash (*)
641#  -e 's|/[^/]*|../|g'   replaces each occurrence of /<directory> with ../
642#
643# (*) Note this pattern overwrites the first character of the string
644# with a forward slash if one is not already present.  This is not a
645# problem because the exact names of the sub-directories concerned is
646# unimportant, just the number of them matters.
647#
648# The practical upshot of these patterns is like this:
649#
650#  prefix     exec_prefix        result
651#  ------     -----------        ------
652#   /foo        /foo/bar          ../
653#   /foo/       /foo/bar          ../
654#   /foo        /foo/bar/         ../
655#   /foo/       /foo/bar/         ../
656#   /foo        /foo/bar/ugg      ../../
657libsubdir_to_prefix := \
658  $(unlibsubdir)/$(shell echo "$(libdir)" | \
659    sed -e 's|^$(prefix)||' -e 's|/$$||' -e 's|^[^/]|/|' \
660        -e 's|/[^/]*|../|g')
661# $(exec_prefix), expressed as a path relative to $(prefix).
662prefix_to_exec_prefix := \
663  $(shell echo "$(exec_prefix)" | \
664    sed -e 's|^$(prefix)||' -e 's|^/||' -e '/./s|$$|/|')
665# Directory in which to find other cross-compilation tools and headers.
666dollar = @dollar@
667# Used in install-cross.
668gcc_tooldir = @gcc_tooldir@
669# Since gcc_tooldir does not exist at build-time, use -B$(build_tooldir)/bin/
670build_tooldir = $(exec_prefix)/$(target_noncanonical)
671# Directory in which the compiler finds target-independent g++ includes.
672gcc_gxx_include_dir = @gcc_gxx_include_dir@
673gcc_gxx_include_dir_add_sysroot = @gcc_gxx_include_dir_add_sysroot@
674# Directory to search for site-specific includes.
675local_includedir = $(local_prefix)/include
676includedir = $(prefix)/include
677# where the info files go
678infodir = @infodir@
679# Where cpp should go besides $prefix/bin if necessary
680cpp_install_dir = @cpp_install_dir@
681# where the locale files go
682datadir = @datadir@
683localedir = $(datadir)/locale
684# Extension (if any) to put in installed man-page filename.
685man1ext = .1
686man7ext = .7
687objext = .o
688exeext = @host_exeext@
689build_exeext = @build_exeext@
690
691# Directory in which to put man pages.
692mandir = @mandir@
693man1dir = $(mandir)/man1
694man7dir = $(mandir)/man7
695# Dir for temp files.
696tmpdir = /tmp
697
698datarootdir = @datarootdir@
699docdir = @docdir@
700# Directory in which to build HTML
701build_htmldir = $(objdir)/HTML/gcc-$(version)
702# Directory in which to put HTML
703htmldir = @htmldir@
704
705# Whether we were configured with NLS.
706USE_NLS = @USE_NLS@
707
708# Internationalization library.
709LIBINTL = @LIBINTL@
710LIBINTL_DEP = @LIBINTL_DEP@
711
712# Character encoding conversion library.
713LIBICONV = @LIBICONV@
714LIBICONV_DEP = @LIBICONV_DEP@
715
716# If a supplementary library is being used for the GC.
717GGC_LIB=
718
719# "true" if the target C library headers are unavailable; "false"
720# otherwise.
721inhibit_libc = @inhibit_libc@
722ifeq ($(inhibit_libc),true)
723INHIBIT_LIBC_CFLAGS = -Dinhibit_libc
724endif
725
726# List of extra executables that should be compiled for this target machine
727# that are used when linking.
728# The rules for compiling them should be in the t-* file for the machine.
729EXTRA_PROGRAMS = @extra_programs@
730
731# List of extra object files that should be compiled and linked with
732# compiler proper (cc1, cc1obj, cc1plus).
733EXTRA_OBJS = @extra_objs@
734
735# List of extra object files that should be compiled and linked with
736# the gcc driver.
737EXTRA_GCC_OBJS =@extra_gcc_objs@
738
739# List of extra libraries that should be linked with the gcc driver.
740EXTRA_GCC_LIBS = @EXTRA_GCC_LIBS@
741
742# List of additional header files to install.
743EXTRA_HEADERS =@extra_headers_list@
744
745# How to handle <stdint.h>.
746USE_GCC_STDINT = @use_gcc_stdint@
747
748# The configure script will set this to collect2$(exeext), except on a
749# (non-Unix) host which cannot build collect2, for which it will be
750# set to empty.
751COLLECT2 = @collect2@
752
753# Program to convert libraries.
754LIBCONVERT =
755
756# Control whether header files are installed.
757INSTALL_HEADERS=install-headers install-mkheaders
758
759# Control whether Info documentation is built and installed.
760BUILD_INFO = @BUILD_INFO@
761
762# Control whether manpages generated by texi2pod.pl can be rebuilt.
763GENERATED_MANPAGES = @GENERATED_MANPAGES@
764
765# Additional directories of header files to run fixincludes on.
766# These should be directories searched automatically by default
767# just as /usr/include is.
768# *Do not* use this for directories that happen to contain
769# header files, but are not searched automatically by default.
770# On most systems, this is empty.
771OTHER_FIXINCLUDES_DIRS=
772
773# A list of all the language-specific executables.
774COMPILERS = @all_compilers@
775
776# List of things which should already be built whenever we try to use xgcc
777# to compile anything (without linking).
778GCC_PASSES=xgcc$(exeext) specs
779
780# Directory to link to, when using the target `maketest'.
781DIR = ../gcc
782
783# Native compiler for the build machine and its switches.
784CC_FOR_BUILD = @CC_FOR_BUILD@
785CXX_FOR_BUILD = @CXX_FOR_BUILD@
786NO_PIE_CFLAGS_FOR_BUILD = @NO_PIE_CFLAGS_FOR_BUILD@
787NO_PIE_FLAG_FOR_BUILD = @NO_PIE_FLAG_FOR_BUILD@
788BUILD_CFLAGS= @BUILD_CFLAGS@ $(GENERATOR_CFLAGS) -DGENERATOR_FILE
789BUILD_CXXFLAGS = @BUILD_CXXFLAGS@ $(GENERATOR_CFLAGS) -DGENERATOR_FILE
790BUILD_NO_PIE_CFLAGS = @BUILD_NO_PIE_CFLAGS@
791BUILD_CFLAGS += $(BUILD_NO_PIE_CFLAGS)
792BUILD_CXXFLAGS += $(BUILD_NO_PIE_CFLAGS)
793
794# Native compiler that we use.  This may be C++ some day.
795COMPILER_FOR_BUILD = $(CXX_FOR_BUILD)
796BUILD_COMPILERFLAGS = $(BUILD_CXXFLAGS)
797
798# Native linker that we use.
799LINKER_FOR_BUILD = $(CXX_FOR_BUILD)
800BUILD_LINKERFLAGS = $(BUILD_CXXFLAGS)
801
802# Native linker and preprocessor flags.  For x-fragment overrides.
803BUILD_LDFLAGS=@BUILD_LDFLAGS@
804BUILD_NO_PIE_FLAG = @BUILD_NO_PIE_FLAG@
805BUILD_LDFLAGS += $(BUILD_NO_PIE_FLAG)
806BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
807		-I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS)
808
809# Actual name to use when installing a native compiler.
810GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
811GCC_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcc|sed '$(program_transform_name)')
812CPP_INSTALL_NAME := $(shell echo cpp|sed '$(program_transform_name)')
813GCOV_INSTALL_NAME := $(shell echo gcov|sed '$(program_transform_name)')
814GCOV_TOOL_INSTALL_NAME := $(shell echo gcov-tool|sed '$(program_transform_name)')
815GCOV_DUMP_INSTALL_NAME := $(shell echo gcov-dump|sed '$(program_transform_name)')
816
817# Setup the testing framework, if you have one
818EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \
819            echo $${rootme}/../expect/expect ; \
820          else echo expect ; fi`
821
822RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
823	       echo $${srcdir}/../dejagnu/runtest ; \
824	    else echo runtest; fi`
825RUNTESTFLAGS =
826
827# This should name the specs file that we're going to install.  Target
828# Makefiles may override it and name another file to be generated from
829# the built-in specs and installed as the default spec, as long as
830# they also introduce a rule to generate a file name specs, to be used
831# at build time.
832SPECS = specs
833
834# Extra include files that are defined by HeaderInclude directives in
835# the .opt files
836OPTIONS_H_EXTRA =
837
838# Extra include files that are defined by SourceInclude directives in
839# the .opt files
840OPTIONS_C_EXTRA = $(PRETTY_PRINT_H)
841
842@option_includes@
843
844# End of variables for you to override.
845
846# GTM_H lists the config files that the generator files depend on,
847# while TM_H lists the ones ordinary gcc files depend on, which
848# includes several files generated by those generators.
849BCONFIG_H = bconfig.h $(build_xm_file_list)
850CONFIG_H  = config.h  $(host_xm_file_list)
851TCONFIG_H = tconfig.h $(xm_file_list)
852TM_P_H    = tm_p.h    $(tm_p_file_list)
853TM_D_H    = tm_d.h    $(tm_d_file_list)
854GTM_H     = tm.h      $(tm_file_list) insn-constants.h
855TM_H      = $(GTM_H) insn-flags.h $(OPTIONS_H)
856
857# Variables for version information.
858BASEVER     := $(srcdir)/BASE-VER  # 4.x.y
859DEVPHASE    := $(srcdir)/DEV-PHASE # experimental, prerelease, ""
860DATESTAMP   := $(srcdir)/DATESTAMP # YYYYMMDD or empty
861REVISION    := $(srcdir)/REVISION  # [BRANCH revision XXXXXX]
862
863BASEVER_c   := $(shell cat $(BASEVER))
864DEVPHASE_c  := $(shell cat $(DEVPHASE))
865DATESTAMP_c := $(shell cat $(DATESTAMP))
866
867ifeq (,$(wildcard $(REVISION)))
868REVISION_c  :=
869REVISION    :=
870else
871REVISION_c  := $(shell cat $(REVISION))
872endif
873
874version     := $(shell @get_gcc_base_ver@ $(BASEVER))
875
876PATCHLEVEL_c := \
877  $(shell echo $(BASEVER_c) | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$$/\1/')
878
879
880# For use in version.c - double quoted strings, with appropriate
881# surrounding punctuation and spaces, and with the datestamp and
882# development phase collapsed to the empty string in release mode
883# (i.e. if DEVPHASE_c is empty and PATCHLEVEL_c is 0).  The space
884# immediately after the comma in the $(if ...) constructs is
885# significant - do not remove it.
886BASEVER_s   := "\"$(BASEVER_c)\""
887DEVPHASE_s  := "\"$(if $(DEVPHASE_c), ($(DEVPHASE_c)))\""
888DATESTAMP_s := \
889  "\"$(if $(DEVPHASE_c)$(filter-out 0,$(PATCHLEVEL_c)), $(DATESTAMP_c))\""
890PKGVERSION_s:= "\"@PKGVERSION@\""
891BUGURL_s    := "\"@REPORT_BUGS_TO@\""
892
893PKGVERSION  := @PKGVERSION@
894BUGURL_TEXI := @REPORT_BUGS_TEXI@
895
896ifdef REVISION_c
897REVISION_s  := \
898  "\"$(if $(DEVPHASE_c)$(filter-out 0,$(PATCHLEVEL_c)), $(REVISION_c))\""
899else
900REVISION_s  := "\"\""
901endif
902
903# Shorthand variables for dependency lists.
904DUMPFILE_H = $(srcdir)/../libcpp/include/line-map.h dumpfile.h
905VEC_H = vec.h statistics.h $(GGC_H)
906HASH_TABLE_H = $(HASHTAB_H) hash-table.h $(GGC_H)
907EXCEPT_H = except.h $(HASHTAB_H)
908TARGET_DEF = target.def target-hooks-macros.h target-insns.def
909C_TARGET_DEF = c-family/c-target.def target-hooks-macros.h
910COMMON_TARGET_DEF = common/common-target.def target-hooks-macros.h
911D_TARGET_DEF = d/d-target.def target-hooks-macros.h
912TARGET_H = $(TM_H) target.h $(TARGET_DEF) insn-modes.h insn-codes.h
913C_TARGET_H = c-family/c-target.h $(C_TARGET_DEF)
914COMMON_TARGET_H = common/common-target.h $(INPUT_H) $(COMMON_TARGET_DEF)
915D_TARGET_H = d/d-target.h $(D_TARGET_DEF)
916MACHMODE_H = machmode.h mode-classes.def
917HOOKS_H = hooks.h
918HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H)
919LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H)
920TARGET_DEF_H = target-def.h target-hooks-def.h $(HOOKS_H) targhooks.h
921C_TARGET_DEF_H = c-family/c-target-def.h c-family/c-target-hooks-def.h \
922  $(TREE_H) $(C_COMMON_H) $(HOOKS_H) common/common-targhooks.h
923CORETYPES_H = coretypes.h insn-modes.h signop.h wide-int.h wide-int-print.h \
924  insn-modes-inline.h $(MACHMODE_H) double-int.h
925RTL_BASE_H = $(CORETYPES_H) rtl.h rtl.def reg-notes.def \
926  insn-notes.def $(INPUT_H) $(REAL_H) statistics.h $(VEC_H) \
927  $(FIXED_VALUE_H) alias.h $(HASHTAB_H)
928FIXED_VALUE_H = fixed-value.h
929RTL_H = $(RTL_BASE_H) $(FLAGS_H) genrtl.h
930READ_MD_H = $(OBSTACK_H) $(HASHTAB_H) read-md.h
931BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def \
932	gtm-builtins.def sanitizer.def \
933	hsa-builtins.def
934INTERNAL_FN_DEF = internal-fn.def
935INTERNAL_FN_H = internal-fn.h $(INTERNAL_FN_DEF)
936TREE_CORE_H = tree-core.h $(CORETYPES_H) all-tree.def tree.def \
937	c-family/c-common.def $(lang_tree_files) \
938	$(BUILTINS_DEF) $(INPUT_H) statistics.h \
939	$(VEC_H) treestruct.def $(HASHTAB_H) \
940	alias.h $(SYMTAB_H) $(FLAGS_H) \
941	$(REAL_H) $(FIXED_VALUE_H)
942TREE_H = tree.h $(TREE_CORE_H)  tree-check.h
943REGSET_H = regset.h $(BITMAP_H) hard-reg-set.h
944BASIC_BLOCK_H = basic-block.h $(PREDICT_H) $(VEC_H) $(FUNCTION_H) \
945	cfg-flags.def cfghooks.h profile-count.h
946GIMPLE_H = gimple.h gimple.def gsstruct.def $(VEC_H) \
947	$(GGC_H) $(BASIC_BLOCK_H) $(TREE_H) tree-ssa-operands.h \
948	tree-ssa-alias.h $(INTERNAL_FN_H) $(HASH_TABLE_H) is-a.h
949GCOV_IO_H = gcov-io.h gcov-iov.h auto-host.h gcov-counter.def
950RECOG_H = recog.h
951EMIT_RTL_H = emit-rtl.h
952FLAGS_H = flags.h flag-types.h $(OPTIONS_H)
953OPTIONS_H = options.h flag-types.h $(OPTIONS_H_EXTRA)
954FUNCTION_H = function.h $(HASHTAB_H) $(TM_H) hard-reg-set.h \
955	$(VEC_H) $(INPUT_H)
956EXPR_H = expr.h insn-config.h $(FUNCTION_H) $(RTL_H) $(FLAGS_H) $(TREE_H) \
957	$(EMIT_RTL_H)
958OPTABS_H = optabs.h insn-codes.h insn-opinit.h
959REGS_H = regs.h hard-reg-set.h
960CFGLOOP_H = cfgloop.h $(BASIC_BLOCK_H) $(BITMAP_H) sbitmap.h
961IPA_UTILS_H = ipa-utils.h $(TREE_H) $(CGRAPH_H)
962IPA_REFERENCE_H = ipa-reference.h $(BITMAP_H) $(TREE_H)
963CGRAPH_H = cgraph.h $(VEC_H) $(TREE_H) $(BASIC_BLOCK_H) $(FUNCTION_H) \
964	cif-code.def ipa-ref.h $(LINKER_PLUGIN_API_H) is-a.h
965DF_H = df.h $(BITMAP_H) $(REGSET_H) sbitmap.h $(BASIC_BLOCK_H) \
966	alloc-pool.h $(TIMEVAR_H)
967RESOURCE_H = resource.h hard-reg-set.h $(DF_H)
968GCC_H = gcc.h version.h $(DIAGNOSTIC_CORE_H)
969GGC_H = ggc.h gtype-desc.h statistics.h
970TIMEVAR_H = timevar.h timevar.def
971INSN_ATTR_H = insn-attr.h insn-attr-common.h $(INSN_ADDR_H)
972INSN_ADDR_H = $(srcdir)/insn-addr.h
973C_COMMON_H = c-family/c-common.h c-family/c-common.def $(TREE_H) \
974	$(SPLAY_TREE_H) $(CPPLIB_H) $(GGC_H) $(DIAGNOSTIC_CORE_H)
975C_PRAGMA_H = c-family/c-pragma.h $(CPPLIB_H)
976C_TREE_H = c/c-tree.h $(C_COMMON_H) $(DIAGNOSTIC_H)
977SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h \
978	$(srcdir)/../include/safe-ctype.h $(srcdir)/../include/filenames.h
979PREDICT_H = predict.h predict.def
980CPPLIB_H = $(srcdir)/../libcpp/include/line-map.h \
981	$(srcdir)/../libcpp/include/cpplib.h
982INPUT_H = $(srcdir)/../libcpp/include/line-map.h input.h
983OPTS_H = $(INPUT_H) $(VEC_H) opts.h $(OBSTACK_H)
984SYMTAB_H = $(srcdir)/../libcpp/include/symtab.h $(OBSTACK_H)
985CPP_INTERNAL_H = $(srcdir)/../libcpp/internal.h
986TREE_DUMP_H = tree-dump.h $(SPLAY_TREE_H) $(DUMPFILE_H)
987TREE_PASS_H = tree-pass.h $(TIMEVAR_H) $(DUMPFILE_H)
988TREE_SSA_H = tree-ssa.h tree-ssa-operands.h \
989		$(BITMAP_H) sbitmap.h $(BASIC_BLOCK_H) $(GIMPLE_H) \
990		$(HASHTAB_H) $(CGRAPH_H) $(IPA_REFERENCE_H) \
991		tree-ssa-alias.h
992PRETTY_PRINT_H = pretty-print.h $(INPUT_H) $(OBSTACK_H) wide-int-print.h
993TREE_PRETTY_PRINT_H = tree-pretty-print.h $(PRETTY_PRINT_H)
994GIMPLE_PRETTY_PRINT_H = gimple-pretty-print.h $(TREE_PRETTY_PRINT_H)
995DIAGNOSTIC_CORE_H = diagnostic-core.h $(INPUT_H) bversion.h diagnostic.def
996DIAGNOSTIC_H = diagnostic.h $(DIAGNOSTIC_CORE_H) $(PRETTY_PRINT_H)
997C_PRETTY_PRINT_H = c-family/c-pretty-print.h $(PRETTY_PRINT_H) \
998	$(C_COMMON_H) $(TREE_H)
999TREE_INLINE_H = tree-inline.h
1000REAL_H = real.h
1001LTO_STREAMER_H = lto-streamer.h $(LINKER_PLUGIN_API_H) $(TARGET_H) \
1002		$(CGRAPH_H) $(VEC_H) $(HASH_TABLE_H) $(TREE_H) $(GIMPLE_H) \
1003		$(GCOV_IO_H) $(DIAGNOSTIC_H) alloc-pool.h
1004IPA_PROP_H = ipa-prop.h $(TREE_H) $(VEC_H) $(CGRAPH_H) $(GIMPLE_H) alloc-pool.h
1005BITMAP_H = bitmap.h $(HASHTAB_H) statistics.h
1006GCC_PLUGIN_H = gcc-plugin.h highlev-plugin-common.h plugin.def \
1007		$(CONFIG_H) $(SYSTEM_H) $(HASHTAB_H)
1008PLUGIN_H = plugin.h $(GCC_PLUGIN_H)
1009PLUGIN_VERSION_H = plugin-version.h configargs.h
1010CONTEXT_H = context.h
1011GENSUPPORT_H = gensupport.h read-md.h optabs.def
1012
1013#
1014# Now figure out from those variables how to compile and link.
1015
1016# IN_GCC distinguishes between code compiled into GCC itself and other
1017# programs built during a bootstrap.
1018# autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a
1019# cross compiler which does not use the native headers and libraries.
1020INTERNAL_CFLAGS = -DIN_GCC $(PICFLAG) @CROSS@
1021
1022# This is the variable actually used when we compile. If you change this,
1023# you probably want to update BUILD_CFLAGS in configure.ac
1024ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \
1025  $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@
1026
1027# The C++ version.
1028ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
1029  $(COVERAGE_FLAGS) $(ALIASING_FLAGS) $(NOEXCEPTION_FLAGS) \
1030  $(WARN_CXXFLAGS) @DEFS@
1031
1032# Likewise.  Put INCLUDES at the beginning: this way, if some autoconf macro
1033# puts -I options in CPPFLAGS, our include files in the srcdir will always
1034# win against random include files in /usr/include.
1035ALL_CPPFLAGS = $(INCLUDES) $(CPPFLAGS)
1036
1037# This is the variable to use when using $(COMPILER).
1038ALL_COMPILERFLAGS = $(ALL_CXXFLAGS)
1039
1040# This is the variable to use when using $(LINKER).
1041ALL_LINKERFLAGS = $(ALL_CXXFLAGS)
1042
1043# Build and host support libraries.
1044
1045# Use the "pic" build of libiberty if --enable-host-shared.
1046ifeq ($(enable_host_shared),yes)
1047LIBIBERTY = ../libiberty/pic/libiberty.a
1048BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/pic/libiberty.a
1049else
1050LIBIBERTY = ../libiberty/libiberty.a
1051BUILD_LIBIBERTY = $(build_libobjdir)/libiberty/libiberty.a
1052endif
1053
1054# Dependencies on the intl and portability libraries.
1055LIBDEPS= libcommon.a $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) \
1056	$(LIBDECNUMBER) $(LIBBACKTRACE)
1057
1058# Likewise, for use in the tools that must run on this machine
1059# even if we are cross-building GCC.
1060BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
1061
1062# How to link with both our special library facilities
1063# and the system's installed libraries.
1064LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
1065	$(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)
1066BACKENDLIBS = $(ISLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
1067	$(ZLIB) $(ZSTD_LIB)
1068# Any system libraries needed just for GNAT.
1069SYSLIBS = @GNAT_LIBEXC@
1070
1071# Used from ada/gcc-interface/Make-lang.in
1072GNATBIND = @GNATBIND@
1073GNATMAKE = @GNATMAKE@
1074
1075# Libs needed (at present) just for jcf-dump.
1076LDEXP_LIB = @LDEXP_LIB@
1077
1078ZSTD_LIB = @ZSTD_LIB@
1079
1080# Likewise, for use in the tools that must run on this machine
1081# even if we are cross-building GCC.
1082BUILD_LIBS = $(BUILD_LIBIBERTY)
1083
1084BUILD_RTL = build/rtl.o build/read-rtl.o build/ggc-none.o \
1085	    build/vec.o build/min-insn-modes.o build/gensupport.o \
1086	    build/print-rtl.o build/hash-table.o build/sort.o
1087BUILD_MD = build/read-md.o
1088BUILD_ERRORS = build/errors.o
1089
1090# Specify the directories to be searched for header files.
1091# Both . and srcdir are used, in that order,
1092# so that *config.h will be found in the compilation
1093# subdirectory rather than in the source directory.
1094# -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
1095# currently being compiled, in both source trees, to be examined as well.
1096# libintl.h will be found in ../intl if we are using the included libintl.
1097INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
1098	   -I$(srcdir)/../include @INCINTL@ \
1099	   $(CPPINC) $(GMPINC) $(DECNUMINC) $(BACKTRACEINC) \
1100	   $(ISLINC)
1101
1102COMPILE.base = $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) -o $@
1103ifeq ($(CXXDEPMODE),depmode=gcc3)
1104# Note a subtlety here: we use $(@D) for the directory part, to make
1105# things like the go/%.o rule work properly; but we use $(*F) for the
1106# file part, as we just want the file part of the stem, not the entire
1107# file name.
1108COMPILE = $(COMPILE.base) -MT $@ -MMD -MP -MF $(@D)/$(DEPDIR)/$(*F).TPo
1109POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(*F).TPo $(@D)/$(DEPDIR)/$(*F).Po
1110else
1111COMPILE = source='$<' object='$@' libtool=no \
1112    DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) $(COMPILE.base)
1113POSTCOMPILE =
1114endif
1115
1116.cc.o .c.o:
1117	$(COMPILE) $<
1118	$(POSTCOMPILE)
1119
1120#
1121# Support for additional languages (other than C).
1122# C can be supported this way too (leave for later).
1123
1124LANG_CONFIGUREFRAGS  = @all_lang_configurefrags@
1125LANG_MAKEFRAGS = @all_lang_makefrags@
1126
1127# Used by gcc/jit/Make-lang.in
1128LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@
1129LD_SONAME_OPTION = @ld_soname_option@
1130
1131# Flags to pass to recursive makes.
1132# CC is set by configure.
1133# ??? The choices here will need some experimenting with.
1134
1135export AR_FOR_TARGET
1136export AR_CREATE_FOR_TARGET
1137export AR_FLAGS_FOR_TARGET
1138export AR_EXTRACT_FOR_TARGET
1139export AWK
1140export DESTDIR
1141export GCC_FOR_TARGET
1142export INCLUDES
1143export INSTALL_DATA
1144export LIPO_FOR_TARGET
1145export MACHMODE_H
1146export NM_FOR_TARGET
1147export STRIP_FOR_TARGET
1148export RANLIB_FOR_TARGET
1149export libsubdir
1150
1151FLAGS_TO_PASS = \
1152	"ADA_CFLAGS=$(ADA_CFLAGS)" \
1153	"BISON=$(BISON)" \
1154	"BISONFLAGS=$(BISONFLAGS)" \
1155	"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
1156	"LDFLAGS=$(LDFLAGS)" \
1157	"FLEX=$(FLEX)" \
1158	"FLEXFLAGS=$(FLEXFLAGS)" \
1159	"INSTALL=$(INSTALL)" \
1160	"INSTALL_DATA=$(INSTALL_DATA)" \
1161	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
1162	"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
1163	"LN=$(LN)" \
1164	"LN_S=$(LN_S)" \
1165	"RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
1166	"MAKEINFO=$(MAKEINFO)" \
1167	"MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
1168	"MAKEOVERRIDES=" \
1169	"SHELL=$(SHELL)" \
1170	"exeext=$(exeext)" \
1171	"build_exeext=$(build_exeext)" \
1172	"objext=$(objext)" \
1173	"exec_prefix=$(exec_prefix)" \
1174	"prefix=$(prefix)" \
1175	"local_prefix=$(local_prefix)" \
1176	"gxx_include_dir=$(gcc_gxx_include_dir)" \
1177	"build_tooldir=$(build_tooldir)" \
1178	"gcc_tooldir=$(gcc_tooldir)" \
1179	"bindir=$(bindir)" \
1180	"libexecsubdir=$(libexecsubdir)" \
1181	"datarootdir=$(datarootdir)" \
1182	"datadir=$(datadir)" \
1183	"libsubdir=$(libsubdir)" \
1184	"localedir=$(localedir)"
1185#
1186# Lists of files for various purposes.
1187
1188# All option source files
1189ALL_OPT_FILES=$(lang_opt_files) $(extra_opt_files)
1190
1191# Target specific, C specific object file
1192C_TARGET_OBJS=@c_target_objs@
1193
1194# Target specific, C++ specific object file
1195CXX_TARGET_OBJS=@cxx_target_objs@
1196
1197# Target specific, D specific object file
1198D_TARGET_OBJS=@d_target_objs@
1199
1200# Target specific, Fortran specific object file
1201FORTRAN_TARGET_OBJS=@fortran_target_objs@
1202
1203# Object files for gcc many-languages driver.
1204GCC_OBJS = gcc.o gcc-main.o ggc-none.o
1205
1206c-family-warn = $(STRICT_WARN)
1207
1208# Language-specific object files shared by all C-family front ends.
1209C_COMMON_OBJS = c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o \
1210  c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o \
1211  c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o \
1212  c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o \
1213  c-family/c-semantics.o c-family/c-ada-spec.o \
1214  c-family/c-ubsan.o c-family/known-headers.o \
1215  c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o
1216
1217# Analyzer object files
1218ANALYZER_OBJS = \
1219	analyzer/analysis-plan.o \
1220	analyzer/analyzer.o \
1221	analyzer/analyzer-logging.o \
1222	analyzer/analyzer-pass.o \
1223	analyzer/analyzer-selftests.o \
1224	analyzer/bar-chart.o \
1225	analyzer/call-string.o \
1226	analyzer/checker-path.o \
1227	analyzer/constraint-manager.o \
1228	analyzer/diagnostic-manager.o \
1229	analyzer/engine.o \
1230	analyzer/function-set.o \
1231	analyzer/pending-diagnostic.o \
1232	analyzer/program-point.o \
1233	analyzer/program-state.o \
1234	analyzer/region-model.o \
1235	analyzer/sm.o \
1236	analyzer/sm-file.o \
1237	analyzer/sm-malloc.o \
1238	analyzer/sm-pattern-test.o \
1239	analyzer/sm-sensitive.o \
1240	analyzer/sm-signal.o \
1241	analyzer/sm-taint.o \
1242	analyzer/state-purge.o \
1243	analyzer/supergraph.o
1244
1245# Language-independent object files.
1246# We put the *-match.o and insn-*.o files first so that a parallel make
1247# will build them sooner, because they are large and otherwise tend to be
1248# the last objects to finish building.
1249OBJS = \
1250	gimple-match.o \
1251	generic-match.o \
1252	insn-attrtab.o \
1253	insn-automata.o \
1254	insn-dfatab.o \
1255	insn-emit.o \
1256	insn-extract.o \
1257	insn-latencytab.o \
1258	insn-modes.o \
1259	insn-opinit.o \
1260	insn-output.o \
1261	insn-peep.o \
1262	insn-preds.o \
1263	insn-recog.o \
1264	insn-enums.o \
1265	ggc-page.o \
1266	alias.o \
1267	alloc-pool.o \
1268	auto-inc-dec.o \
1269	auto-profile.o \
1270	bb-reorder.o \
1271	bitmap.o \
1272	builtins.o \
1273	caller-save.o \
1274	calls.o \
1275	ccmp.o \
1276	cfg.o \
1277	cfganal.o \
1278	cfgbuild.o \
1279	cfgcleanup.o \
1280	cfgexpand.o \
1281	cfghooks.o \
1282	cfgloop.o \
1283	cfgloopanal.o \
1284	cfgloopmanip.o \
1285	cfgrtl.o \
1286	symtab.o \
1287	cgraph.o \
1288	cgraphbuild.o \
1289	cgraphunit.o \
1290	cgraphclones.o \
1291	combine.o \
1292	combine-stack-adj.o \
1293	compare-elim.o \
1294	context.o \
1295	convert.o \
1296	coroutine-passes.o \
1297	coverage.o \
1298	cppbuiltin.o \
1299	cppdefault.o \
1300	cprop.o \
1301	cse.o \
1302	cselib.o \
1303	data-streamer.o \
1304	data-streamer-in.o \
1305	data-streamer-out.o \
1306	dbxout.o \
1307	dbgcnt.o \
1308	dce.o \
1309	ddg.o \
1310	debug.o \
1311	df-core.o \
1312	df-problems.o \
1313	df-scan.o \
1314	dfp.o \
1315	digraph.o \
1316	dojump.o \
1317	dominance.o \
1318	domwalk.o \
1319	double-int.o \
1320	dse.o \
1321	dumpfile.o \
1322	dwarf2asm.o \
1323	dwarf2cfi.o \
1324	dwarf2out.o \
1325	early-remat.o \
1326	emit-rtl.o \
1327	et-forest.o \
1328	except.o \
1329	explow.o \
1330	expmed.o \
1331	expr.o \
1332	fibonacci_heap.o \
1333	file-prefix-map.o \
1334	final.o \
1335	fixed-value.o \
1336	fold-const.o \
1337	fold-const-call.o \
1338	function.o \
1339	function-abi.o \
1340	function-tests.o \
1341	fwprop.o \
1342	gcc-rich-location.o \
1343	gcse.o \
1344	gcse-common.o \
1345	ggc-common.o \
1346	ggc-tests.o \
1347	gimple.o \
1348	gimple-builder.o \
1349	gimple-expr.o \
1350	gimple-iterator.o \
1351	gimple-fold.o \
1352	gimple-laddress.o \
1353	gimple-loop-interchange.o \
1354	gimple-loop-jam.o \
1355	gimple-loop-versioning.o \
1356	gimple-low.o \
1357	gimple-pretty-print.o \
1358	gimple-ssa-backprop.o \
1359	gimple-ssa-evrp.o \
1360	gimple-ssa-evrp-analyze.o \
1361	gimple-ssa-isolate-paths.o \
1362	gimple-ssa-nonnull-compare.o \
1363	gimple-ssa-split-paths.o \
1364	gimple-ssa-store-merging.o \
1365	gimple-ssa-strength-reduction.o \
1366	gimple-ssa-sprintf.o \
1367	gimple-ssa-warn-alloca.o \
1368	gimple-ssa-warn-restrict.o \
1369	gimple-streamer-in.o \
1370	gimple-streamer-out.o \
1371	gimple-walk.o \
1372	gimplify.o \
1373	gimplify-me.o \
1374	godump.o \
1375	graph.o \
1376	graphds.o \
1377	graphviz.o \
1378	graphite.o \
1379	graphite-isl-ast-to-gimple.o \
1380	graphite-dependences.o \
1381	graphite-optimize-isl.o \
1382	graphite-poly.o \
1383	graphite-scop-detection.o \
1384	graphite-sese-to-poly.o \
1385	gtype-desc.o \
1386	haifa-sched.o \
1387	hash-map-tests.o \
1388	hash-set-tests.o \
1389	hsa-common.o \
1390	hsa-gen.o \
1391	hsa-regalloc.o \
1392	hsa-brig.o \
1393	hsa-dump.o \
1394	hw-doloop.o \
1395	hwint.o \
1396	ifcvt.o \
1397	ree.o \
1398	inchash.o \
1399	incpath.o \
1400	init-regs.o \
1401	internal-fn.o \
1402	ipa-cp.o \
1403	ipa-sra.o \
1404	ipa-devirt.o \
1405	ipa-fnsummary.o \
1406	ipa-polymorphic-call.o \
1407	ipa-split.o \
1408	ipa-inline.o \
1409	ipa-comdats.o \
1410	ipa-visibility.o \
1411	ipa-inline-analysis.o \
1412	ipa-inline-transform.o \
1413	ipa-predicate.o \
1414	ipa-profile.o \
1415	ipa-prop.o \
1416	ipa-param-manipulation.o \
1417	ipa-pure-const.o \
1418	ipa-icf.o \
1419	ipa-icf-gimple.o \
1420	ipa-reference.o \
1421	ipa-hsa.o \
1422	ipa-ref.o \
1423	ipa-utils.o \
1424	ipa.o \
1425	ira.o \
1426	ira-build.o \
1427	ira-costs.o \
1428	ira-conflicts.o \
1429	ira-color.o \
1430	ira-emit.o \
1431	ira-lives.o \
1432	jump.o \
1433	langhooks.o \
1434	lcm.o \
1435	lists.o \
1436	loop-doloop.o \
1437	loop-init.o \
1438	loop-invariant.o \
1439	loop-iv.o \
1440	loop-unroll.o \
1441	lower-subreg.o \
1442	lra.o \
1443	lra-assigns.o \
1444	lra-coalesce.o \
1445	lra-constraints.o \
1446	lra-eliminations.o \
1447	lra-lives.o \
1448	lra-remat.o \
1449	lra-spills.o \
1450	lto-cgraph.o \
1451	lto-streamer.o \
1452	lto-streamer-in.o \
1453	lto-streamer-out.o \
1454	lto-section-in.o \
1455	lto-section-out.o \
1456	lto-opts.o \
1457	lto-compress.o \
1458	mcf.o \
1459	mode-switching.o \
1460	modulo-sched.o \
1461	multiple_target.o \
1462	omp-offload.o \
1463	omp-expand.o \
1464	omp-general.o \
1465	omp-grid.o \
1466	omp-low.o \
1467	omp-simd-clone.o \
1468	opt-problem.o \
1469	optabs.o \
1470	optabs-libfuncs.o \
1471	optabs-query.o \
1472	optabs-tree.o \
1473	optinfo.o \
1474	optinfo-emit-json.o \
1475	options-save.o \
1476	opts-global.o \
1477	ordered-hash-map-tests.o \
1478	passes.o \
1479	plugin.o \
1480	postreload-gcse.o \
1481	postreload.o \
1482	predict.o \
1483	print-rtl.o \
1484	print-rtl-function.o \
1485	print-tree.o \
1486	profile.o \
1487	profile-count.o \
1488	range.o \
1489	range-op.o \
1490	read-md.o \
1491	read-rtl.o \
1492	read-rtl-function.o \
1493	real.o \
1494	realmpfr.o \
1495	recog.o \
1496	reg-stack.o \
1497	regcprop.o \
1498	reginfo.o \
1499	regrename.o \
1500	regstat.o \
1501	reload.o \
1502	reload1.o \
1503	reorg.o \
1504	resource.o \
1505	rtl-error.o \
1506	rtl-tests.o \
1507	rtl.o \
1508	rtlhash.o \
1509	rtlanal.o \
1510	rtlhooks.o \
1511	rtx-vector-builder.o \
1512	run-rtl-passes.o \
1513	sched-deps.o \
1514	sched-ebb.o \
1515	sched-rgn.o \
1516	sel-sched-ir.o \
1517	sel-sched-dump.o \
1518	sel-sched.o \
1519	selftest-rtl.o \
1520	selftest-run-tests.o \
1521	sese.o \
1522	shrink-wrap.o \
1523	simplify-rtx.o \
1524	sparseset.o \
1525	spellcheck.o \
1526	spellcheck-tree.o \
1527	sreal.o \
1528	stack-ptr-mod.o \
1529	statistics.o \
1530	stmt.o \
1531	stor-layout.o \
1532	store-motion.o \
1533	streamer-hooks.o \
1534	stringpool.o \
1535	substring-locations.o \
1536	target-globals.o \
1537	targhooks.o \
1538	timevar.o \
1539	toplev.o \
1540	tracer.o \
1541	trans-mem.o \
1542	tree-affine.o \
1543	asan.o \
1544	tsan.o \
1545	ubsan.o \
1546	sanopt.o \
1547	sancov.o \
1548	tree-call-cdce.o \
1549	tree-cfg.o \
1550	tree-cfgcleanup.o \
1551	tree-chrec.o \
1552	tree-complex.o \
1553	tree-data-ref.o \
1554	tree-dfa.o \
1555	tree-diagnostic.o \
1556	tree-diagnostic-path.o \
1557	tree-dump.o \
1558	tree-eh.o \
1559	tree-emutls.o \
1560	tree-if-conv.o \
1561	tree-inline.o \
1562	tree-into-ssa.o \
1563	tree-iterator.o \
1564	tree-loop-distribution.o \
1565	tree-nested.o \
1566	tree-nrv.o \
1567	tree-object-size.o \
1568	tree-outof-ssa.o \
1569	tree-parloops.o \
1570	tree-phinodes.o \
1571	tree-predcom.o \
1572	tree-pretty-print.o \
1573	tree-profile.o \
1574	tree-scalar-evolution.o \
1575	tree-sra.o \
1576	tree-switch-conversion.o \
1577	tree-ssa-address.o \
1578	tree-ssa-alias.o \
1579	tree-ssa-ccp.o \
1580	tree-ssa-coalesce.o \
1581	tree-ssa-copy.o \
1582	tree-ssa-dce.o \
1583	tree-ssa-dom.o \
1584	tree-ssa-dse.o \
1585	tree-ssa-forwprop.o \
1586	tree-ssa-ifcombine.o \
1587	tree-ssa-live.o \
1588	tree-ssa-loop-ch.o \
1589	tree-ssa-loop-im.o \
1590	tree-ssa-loop-ivcanon.o \
1591	tree-ssa-loop-ivopts.o \
1592	tree-ssa-loop-manip.o \
1593	tree-ssa-loop-niter.o \
1594	tree-ssa-loop-prefetch.o \
1595	tree-ssa-loop-split.o \
1596	tree-ssa-loop-unswitch.o \
1597	tree-ssa-loop.o \
1598	tree-ssa-math-opts.o \
1599	tree-ssa-operands.o \
1600	tree-ssa-phiopt.o \
1601	tree-ssa-phiprop.o \
1602	tree-ssa-pre.o \
1603	tree-ssa-propagate.o \
1604	tree-ssa-reassoc.o \
1605	tree-ssa-sccvn.o \
1606	tree-ssa-scopedtables.o \
1607	tree-ssa-sink.o \
1608	tree-ssa-strlen.o \
1609	tree-ssa-structalias.o \
1610	tree-ssa-tail-merge.o \
1611	tree-ssa-ter.o \
1612	tree-ssa-threadbackward.o \
1613	tree-ssa-threadedge.o \
1614	tree-ssa-threadupdate.o \
1615	tree-ssa-uncprop.o \
1616	tree-ssa-uninit.o \
1617	tree-ssa.o \
1618	tree-ssanames.o \
1619	tree-stdarg.o \
1620	tree-streamer.o \
1621	tree-streamer-in.o \
1622	tree-streamer-out.o \
1623	tree-tailcall.o \
1624	tree-vect-generic.o \
1625	tree-vect-patterns.o \
1626	tree-vect-data-refs.o \
1627	tree-vect-stmts.o \
1628	tree-vect-loop.o \
1629	tree-vect-loop-manip.o \
1630	tree-vect-slp.o \
1631	tree-vectorizer.o \
1632	tree-vector-builder.o \
1633	tree-vrp.o \
1634	tree.o \
1635	tristate.o \
1636	typed-splay-tree.o \
1637	unique-ptr-tests.o \
1638	valtrack.o \
1639	value-range.o \
1640	value-prof.o \
1641	var-tracking.o \
1642	varasm.o \
1643	varpool.o \
1644	vec-perm-indices.o \
1645	vmsdbgout.o \
1646	vr-values.o \
1647	vtable-verify.o \
1648	web.o \
1649	wide-int.o \
1650	wide-int-print.o \
1651	xcoffout.o \
1652	$(out_object_file) \
1653	$(ANALYZER_OBJS) \
1654	$(EXTRA_OBJS) \
1655	$(host_hook_obj)
1656
1657# Objects in libcommon.a, potentially used by all host binaries and with
1658# no target dependencies.
1659OBJS-libcommon = diagnostic.o diagnostic-color.o diagnostic-show-locus.o \
1660	diagnostic-format-json.o json.o \
1661	edit-context.o \
1662	pretty-print.o intl.o \
1663	sbitmap.o \
1664	vec.o input.o version.o hash-table.o ggc-none.o memory-block.o \
1665	selftest.o selftest-diagnostic.o sort.o
1666
1667# Objects in libcommon-target.a, used by drivers and by the core
1668# compiler and containing target-dependent code.
1669OBJS-libcommon-target = $(common_out_object_file) prefix.o \
1670	opts.o opts-common.o options.o vec.o hooks.o common/common-targhooks.o \
1671	hash-table.o file-find.o spellcheck.o selftest.o opt-suggestions.o
1672
1673# This lists all host objects for the front ends.
1674ALL_HOST_FRONTEND_OBJS = $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS))
1675
1676ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) $(OBJS-libcommon) \
1677  $(OBJS-libcommon-target) main.o c-family/cppspec.o \
1678  $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) $(GCOV_OBJS) $(GCOV_DUMP_OBJS) \
1679  $(GCOV_TOOL_OBJS) $(GENGTYPE_OBJS) gcc-ar.o gcc-nm.o gcc-ranlib.o \
1680  lto-wrapper.o collect-utils.o
1681
1682# for anything that is shared use the cc1plus profile data, as that
1683# is likely the most exercised during the build
1684ifeq ($(if $(wildcard ../stage_current),$(shell cat \
1685  ../stage_current)),stageautofeedback)
1686$(ALL_HOST_BACKEND_OBJS): ALL_COMPILERFLAGS += -fauto-profile=cc1plus.fda
1687$(ALL_HOST_BACKEND_OBJS): cc1plus.fda
1688endif
1689
1690# This lists all host object files, whether they are included in this
1691# compilation or not.
1692ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS) $(ALL_HOST_BACKEND_OBJS)
1693
1694BACKEND = libbackend.a main.o libcommon-target.a libcommon.a \
1695	$(CPPLIB) $(LIBDECNUMBER)
1696
1697# This is defined to "yes" if Tree checking is enabled, which roughly means
1698# front-end checking.
1699TREECHECKING = @TREECHECKING@
1700
1701# The full name of the driver on installation
1702FULL_DRIVER_NAME=$(target_noncanonical)-gcc-$(version)$(exeext)
1703
1704MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
1705 insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
1706 insn-attr.h insn-attr-common.h insn-attrtab.c insn-dfatab.c \
1707 insn-latencytab.c insn-opinit.c insn-opinit.h insn-preds.c insn-constants.h \
1708 tm-preds.h tm-constrs.h checksum-options gimple-match.c generic-match.c \
1709 tree-check.h min-insn-modes.c insn-modes.c insn-modes.h insn-modes-inline.h \
1710 genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-input.list \
1711 case-cfn-macros.h cfn-operators.pd \
1712 xgcc$(exeext) cpp$(exeext) $(FULL_DRIVER_NAME) \
1713 $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
1714 $(SPECS) collect2$(exeext) gcc-ar$(exeext) gcc-nm$(exeext) \
1715 gcc-ranlib$(exeext) \
1716 gcov-iov$(build_exeext) gcov$(exeext) gcov-dump$(exeext) \
1717 gcov-tool$(exeect) \
1718 gengtype$(exeext) *.[0-9][0-9].* *.[si] *-checksum.c libbackend.a \
1719 libcommon-target.a libcommon.a libgcc.mk perf.data
1720
1721# This symlink makes the full installation name of the driver be available
1722# from within the *build* directory, for use when running the JIT library
1723# from there (e.g. when running its testsuite).
1724$(FULL_DRIVER_NAME): ./xgcc
1725	rm -f $@
1726	$(LN_S) $< $@
1727
1728#
1729# SELFTEST_DEPS need to be set before including language makefile fragments.
1730# Otherwise $(SELFTEST_DEPS) is empty when used from <LANG>/Make-lang.in.
1731SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests
1732
1733# Language makefile fragments.
1734
1735# The following targets define the interface between us and the languages.
1736#
1737# all.cross, start.encap, rest.encap,
1738# install-common, install-info, install-man,
1739# uninstall,
1740# mostlyclean, clean, distclean, maintainer-clean,
1741#
1742# Each language is linked in with a series of hooks.  The name of each
1743# hooked is "lang.${target_name}" (eg: lang.info).  Configure computes
1744# and adds these here.  We use double-colon rules for some of the hooks;
1745# double-colon rules should be preferred for any new hooks.
1746
1747# language hooks, generated by configure
1748@language_hooks@
1749
1750# Wire in install-gnatlib invocation with `make install' for a configuration
1751# with top-level libada disabled.
1752gnat_install_lib = @gnat_install_lib@
1753
1754# per-language makefile fragments
1755ifneq ($(LANG_MAKEFRAGS),)
1756include $(LANG_MAKEFRAGS)
1757endif
1758
1759# target and host overrides must follow the per-language makefile fragments
1760# so they can override or augment language-specific variables
1761
1762# target overrides
1763ifneq ($(tmake_file),)
1764include $(tmake_file)
1765endif
1766
1767# host overrides
1768ifneq ($(xmake_file),)
1769include $(xmake_file)
1770endif
1771
1772# all-tree.def includes all the tree.def files.
1773all-tree.def: s-alltree; @true
1774s-alltree: Makefile
1775	rm -f tmp-all-tree.def
1776	echo '#include "tree.def"' > tmp-all-tree.def
1777	echo 'END_OF_BASE_TREE_CODES' >> tmp-all-tree.def
1778	echo '#include "c-family/c-common.def"' >> tmp-all-tree.def
1779	ltf="$(lang_tree_files)"; for f in $$ltf; do \
1780	  echo "#include \"$$f\""; \
1781	done | sed 's|$(srcdir)/||' >> tmp-all-tree.def
1782	$(SHELL) $(srcdir)/../move-if-change tmp-all-tree.def all-tree.def
1783	$(STAMP) s-alltree
1784
1785# Now that LANG_MAKEFRAGS are included, we can add special flags to the
1786# objects that belong to the front ends.  We add an extra define that
1787# causes back-end specific include files to be poisoned, in the hope that
1788# we can avoid introducing dependencies of the front ends on things that
1789# no front end should ever look at (e.g. everything RTL related).
1790$(foreach file,$(ALL_HOST_FRONTEND_OBJS),$(eval CFLAGS-$(file) += -DIN_GCC_FRONTEND))
1791
1792#
1793
1794# -----------------------------
1795# Rebuilding this configuration
1796# -----------------------------
1797
1798# On the use of stamps:
1799# Consider the example of tree-check.h. It is constructed with build/gencheck.
1800# A simple rule to build tree-check.h would be
1801# tree-check.h: build/gencheck$(build_exeext)
1802#	$(RUN_GEN) build/gencheck$(build_exeext) > tree-check.h
1803#
1804# but tree-check.h doesn't change every time gencheck changes. It would the
1805# nice if targets that depend on tree-check.h wouldn't be rebuild
1806# unnecessarily when tree-check.h is unchanged. To make this, tree-check.h
1807# must not be overwritten with a identical copy. One solution is to use a
1808# temporary file
1809# tree-check.h: build/gencheck$(build_exeext)
1810#	$(RUN_GEN) build/gencheck$(build_exeext) > tmp-check.h
1811#	$(SHELL) $(srcdir)/../move-if-change tmp-check.h tree-check.h
1812#
1813# This solution has a different problem. Since the time stamp of tree-check.h
1814# is unchanged, make will try to update tree-check.h every time it runs.
1815# To prevent this, one can add a stamp
1816# tree-check.h: s-check
1817# s-check : build/gencheck$(build_exeext)
1818#	$(RUN_GEN) build/gencheck$(build_exeext) > tmp-check.h
1819#	$(SHELL) $(srcdir)/../move-if-change tmp-check.h tree-check.h
1820#	$(STAMP) s-check
1821#
1822# The problem with this solution is that make thinks that tree-check.h is
1823# always unchanged. Make must be deceived into thinking that tree-check.h is
1824# rebuild by the "tree-check.h: s-check" rule. To do this, add a dummy command:
1825# tree-check.h: s-check; @true
1826# s-check : build/gencheck$(build_exeext)
1827#	$(RUN_GEN) build/gencheck$(build_exeext) > tmp-check.h
1828#	$(SHELL) $(srcdir)/../move-if-change tmp-check.h tree-check.h
1829#	$(STAMP) s-check
1830#
1831# This is what is done in this makefile. Note that mkconfig.sh has a
1832# move-if-change built-in
1833
1834Makefile: config.status $(srcdir)/Makefile.in $(LANG_MAKEFRAGS)
1835	LANGUAGES="$(CONFIG_LANGUAGES)" \
1836	CONFIG_HEADERS= \
1837	CONFIG_SHELL="$(SHELL)" \
1838	CONFIG_FILES=$@ $(SHELL) config.status
1839
1840config.h: cs-config.h ; @true
1841bconfig.h: cs-bconfig.h ; @true
1842tconfig.h: cs-tconfig.h ; @true
1843tm.h: cs-tm.h ; @true
1844tm_p.h: cs-tm_p.h ; @true
1845tm_d.h: cs-tm_d.h ; @true
1846
1847cs-config.h: Makefile
1848	TARGET_CPU_DEFAULT="" \
1849	HEADERS="$(host_xm_include_list)" DEFINES="$(host_xm_defines)" \
1850	$(SHELL) $(srcdir)/mkconfig.sh config.h
1851
1852cs-bconfig.h: Makefile
1853	TARGET_CPU_DEFAULT="" \
1854	HEADERS="$(build_xm_include_list)" DEFINES="$(build_xm_defines)" \
1855	$(SHELL) $(srcdir)/mkconfig.sh bconfig.h
1856
1857cs-tconfig.h: Makefile
1858	TARGET_CPU_DEFAULT="" \
1859	HEADERS="$(xm_include_list)" DEFINES="USED_FOR_TARGET $(xm_defines)" \
1860	$(SHELL) $(srcdir)/mkconfig.sh tconfig.h
1861
1862cs-tm.h: Makefile
1863	TARGET_CPU_DEFAULT="$(target_cpu_default)" \
1864	HEADERS="$(tm_include_list)" DEFINES="$(tm_defines)" \
1865	$(SHELL) $(srcdir)/mkconfig.sh tm.h
1866
1867cs-tm_p.h: Makefile
1868	TARGET_CPU_DEFAULT="" \
1869	HEADERS="$(tm_p_include_list)" DEFINES="" \
1870	$(SHELL) $(srcdir)/mkconfig.sh tm_p.h
1871
1872cs-tm_d.h: Makefile
1873	TARGET_CPU_DEFAULT="" \
1874	HEADERS="$(tm_d_include_list)" DEFINES="" \
1875	$(SHELL) $(srcdir)/mkconfig.sh tm_d.h
1876
1877# Don't automatically run autoconf, since configure.ac might be accidentally
1878# newer than configure.  Also, this writes into the source directory which
1879# might be on a read-only file system.  If configured for maintainer mode
1880# then do allow autoconf to be run.
1881
1882AUTOCONF = autoconf
1883ACLOCAL = aclocal
1884ACLOCAL_AMFLAGS = -I ../config -I ..
1885aclocal_deps = \
1886	$(srcdir)/../libtool.m4 \
1887	$(srcdir)/../ltoptions.m4 \
1888	$(srcdir)/../ltsugar.m4 \
1889	$(srcdir)/../ltversion.m4 \
1890	$(srcdir)/../lt~obsolete.m4 \
1891	$(srcdir)/../config/acx.m4 \
1892	$(srcdir)/../config/codeset.m4 \
1893	$(srcdir)/../config/depstand.m4 \
1894	$(srcdir)/../config/dfp.m4 \
1895	$(srcdir)/../config/gcc-plugin.m4 \
1896	$(srcdir)/../config/gettext-sister.m4 \
1897	$(srcdir)/../config/iconv.m4 \
1898	$(srcdir)/../config/lcmessage.m4 \
1899	$(srcdir)/../config/lead-dot.m4 \
1900	$(srcdir)/../config/lib-ld.m4 \
1901	$(srcdir)/../config/lib-link.m4 \
1902	$(srcdir)/../config/lib-prefix.m4 \
1903	$(srcdir)/../config/mmap.m4 \
1904	$(srcdir)/../config/override.m4 \
1905	$(srcdir)/../config/picflag.m4 \
1906	$(srcdir)/../config/progtest.m4 \
1907        $(srcdir)/../config/stdint.m4 \
1908	$(srcdir)/../config/warnings.m4 \
1909	$(srcdir)/../config/zlib.m4 \
1910	$(srcdir)/acinclude.m4
1911
1912$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/aclocal.m4
1913	(cd $(srcdir) && $(AUTOCONF))
1914
1915$(srcdir)/aclocal.m4 : @MAINT@ $(aclocal_deps)
1916	(cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS))
1917
1918# cstamp-h.in controls rebuilding of config.in.
1919# It is named cstamp-h.in and not stamp-h.in so the mostlyclean rule doesn't
1920# delete it.  A stamp file is needed as autoheader won't update the file if
1921# nothing has changed.
1922# It remains in the source directory and is part of the distribution.
1923# This follows what is done in shellutils, fileutils, etc.
1924# "echo timestamp" is used instead of touch to be consistent with other
1925# packages that use autoconf (??? perhaps also to avoid problems with patch?).
1926# ??? Newer versions have a maintainer mode that may be useful here.
1927
1928# Don't run autoheader automatically either.
1929# Only run it if maintainer mode is enabled.
1930@MAINT@ AUTOHEADER = autoheader
1931@MAINT@ $(srcdir)/config.in: $(srcdir)/cstamp-h.in
1932@MAINT@ $(srcdir)/cstamp-h.in: $(srcdir)/configure.ac
1933@MAINT@	(cd $(srcdir) && $(AUTOHEADER))
1934@MAINT@	@rm -f $(srcdir)/cstamp-h.in
1935@MAINT@	echo timestamp > $(srcdir)/cstamp-h.in
1936auto-host.h: cstamp-h ; @true
1937cstamp-h: config.in config.status
1938	CONFIG_HEADERS=auto-host.h:config.in \
1939	CONFIG_FILES= \
1940	LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
1941
1942# On configurations that require auto-build.h, it is created while
1943# running configure, so make config.status depend on it, so that
1944# config.status --recheck runs and updates or creates it.
1945@HAVE_AUTO_BUILD@auto-build.h: $(srcdir)/configure $(srcdir)/config.gcc
1946@HAVE_AUTO_BUILD@	@if test -f $@; then echo rerunning config.status to update $@; \
1947@HAVE_AUTO_BUILD@	else echo rerunning config.status to update $@; fi
1948@HAVE_AUTO_BUILD@config.status: auto-build.h
1949
1950# Really, really stupid make features, such as SUN's KEEP_STATE, may force
1951# a target to build even if it is up-to-date.  So we must verify that
1952# config.status does not exist before failing.
1953config.status: $(srcdir)/configure $(srcdir)/config.gcc $(LANG_CONFIGUREFRAGS)
1954	@if [ ! -f config.status ] ; then \
1955	  echo You must configure gcc.  Look at http://gcc.gnu.org/install/ for details.; \
1956	  false; \
1957	else \
1958	  LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status --recheck; \
1959	fi
1960
1961# --------
1962# UNSORTED
1963# --------
1964
1965# Provide quickstrap as a target that people can type into the gcc directory,
1966# and that fails if you're not into it.
1967quickstrap: all
1968	cd $(toplevel_builddir) && $(MAKE) all-target-libgcc
1969
1970all.internal: start.encap rest.encap doc selftest
1971# This is what to compile if making a cross-compiler.
1972all.cross: native gcc-cross$(exeext) cpp$(exeext) specs \
1973	libgcc-support lang.all.cross doc selftest @GENINSRC@ srcextra
1974# This is what must be made before installing GCC and converting libraries.
1975start.encap: native xgcc$(exeext) cpp$(exeext) specs \
1976	libgcc-support lang.start.encap @GENINSRC@ srcextra
1977# These can't be made until after GCC can run.
1978rest.encap: lang.rest.encap
1979# This is what is made with the host's compiler
1980# whether making a cross compiler or not.
1981native: config.status auto-host.h build-@POSUB@ $(LANGUAGES) \
1982	$(EXTRA_PROGRAMS) $(COLLECT2) lto-wrapper$(exeext) \
1983	gcc-ar$(exeext) gcc-nm$(exeext) gcc-ranlib$(exeext)
1984
1985ifeq ($(enable_plugin),yes)
1986native: gengtype$(exeext)
1987endif
1988
1989# On the target machine, finish building a cross compiler.
1990# This does the things that can't be done on the host machine.
1991rest.cross: specs
1992
1993# GCC's selftests.
1994# Specify a dummy input file to placate the driver.
1995# Specify -nostdinc to work around missing WIND_BASE environment variable
1996# required for *-wrs-vxworks-* targets.
1997# Specify -o /dev/null so the output of -S is discarded. More importantly
1998# It does not try to create a file with the name "null.s" on POSIX and
1999# "nul.s" on Windows. Because on Windows "nul" is a reserved file name.
2000# Beware that /dev/null is not available to mingw tools, so directly use
2001# "nul" instead of "/dev/null" if we're building on a mingw machine.
2002# Specify the path to gcc/testsuite/selftests within the srcdir
2003# as an argument to -fself-test.
2004DEVNULL=$(if $(findstring mingw,$(build)),nul,/dev/null)
2005SELFTEST_FLAGS = -nostdinc $(DEVNULL) -S -o $(DEVNULL) \
2006	-fself-test=$(srcdir)/testsuite/selftests
2007
2008# Run the selftests during the build once we have a driver and the frontend,
2009# so that self-test failures are caught as early as possible.
2010# Use "s-selftest-FE" to ensure that we only run the selftests if the
2011# driver, frontend, or selftest data change.
2012.PHONY: selftest
2013
2014# Potentially run all selftest-<LANG>.  The various <LANG>/Make-lang.in can
2015# require the selftests to be run by defining their selftest-<LANG> as
2016# s-selftest-<LANG>.  Otherwise, they should define it as empty.
2017
2018SELFTEST_TARGETS = @selftest_languages@
2019selftest: $(SELFTEST_TARGETS)
2020
2021# Recompile all the language-independent object files.
2022# This is used only if the user explicitly asks for it.
2023compilations: $(BACKEND)
2024
2025# This archive is strictly for the host.
2026libbackend.a: $(OBJS)
2027	-rm -rf libbackend.a
2028	@# Build libbackend.a as a thin archive if possible, as doing so
2029	@# significantly reduces build times.
2030ifeq ($(USE_THIN_ARCHIVES),yes)
2031	$(AR) $(AR_FLAGS)T libbackend.a $(OBJS)
2032else
2033	$(AR) $(AR_FLAGS) libbackend.a $(OBJS)
2034	-$(RANLIB) $(RANLIB_FLAGS) libbackend.a
2035endif
2036
2037libcommon-target.a: $(OBJS-libcommon-target)
2038	-rm -rf libcommon-target.a
2039	$(AR) $(AR_FLAGS) libcommon-target.a $(OBJS-libcommon-target)
2040	-$(RANLIB) $(RANLIB_FLAGS) libcommon-target.a
2041
2042libcommon.a: $(OBJS-libcommon)
2043	-rm -rf libcommon.a
2044	$(AR) $(AR_FLAGS) libcommon.a $(OBJS-libcommon)
2045	-$(RANLIB) $(RANLIB_FLAGS) libcommon.a
2046
2047# We call this executable `xgcc' rather than `gcc'
2048# to avoid confusion if the current directory is in the path
2049# and CC is `gcc'.  It is renamed to `gcc' when it is installed.
2050xgcc$(exeext): $(GCC_OBJS) c/gccspec.o libcommon-target.a $(LIBDEPS) \
2051	$(EXTRA_GCC_OBJS)
2052	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) \
2053	  c/gccspec.o $(EXTRA_GCC_OBJS) libcommon-target.a \
2054	  $(EXTRA_GCC_LIBS) $(LIBS)
2055
2056# cpp is to cpp0 as e.g. g++ is to cc1plus: Just another driver.
2057# It is part of c-family because the handled extensions are hard-coded
2058# and only contain c-family extensions (see known_suffixes).
2059cpp$(exeext): $(GCC_OBJS) c-family/cppspec.o libcommon-target.a $(LIBDEPS) \
2060	$(EXTRA_GCC_OBJS)
2061	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) \
2062	  c-family/cppspec.o $(EXTRA_GCC_OBJS) libcommon-target.a \
2063	  $(EXTRA_GCC_LIBS) $(LIBS)
2064
2065# Dump a specs file to make -B./ read these specs over installed ones.
2066$(SPECS): xgcc$(exeext)
2067	$(GCC_FOR_TARGET) -dumpspecs > tmp-specs
2068	mv tmp-specs $(SPECS)
2069
2070# We do want to create an executable named `xgcc', so we can use it to
2071# compile libgcc2.a.
2072# Also create gcc-cross, so that install-common will install properly.
2073gcc-cross$(exeext): xgcc$(exeext)
2074	cp xgcc$(exeext) gcc-cross$(exeext)
2075
2076checksum-options:
2077	echo "$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS)" > checksum-options.tmp \
2078	&& $(srcdir)/../move-if-change checksum-options.tmp checksum-options
2079
2080#
2081# Build libgcc.a.
2082
2083libgcc-support: libgcc.mvars stmp-int-hdrs $(TCONFIG_H) \
2084	$(MACHMODE_H) gcov-iov.h
2085
2086libgcc.mvars: config.status Makefile specs xgcc$(exeext)
2087	: > tmp-libgcc.mvars
2088	echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars
2089	echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars
2090	echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars
2091	if test @enable_default_pie@ = yes; then \
2092	  NO_PIE_CFLAGS="-fno-PIE"; \
2093	else \
2094	  NO_PIE_CFLAGS=; \
2095	fi; \
2096	echo NO_PIE_CFLAGS = "$$NO_PIE_CFLAGS" >> tmp-libgcc.mvars
2097
2098	mv tmp-libgcc.mvars libgcc.mvars
2099
2100# Use the genmultilib shell script to generate the information the gcc
2101# driver program needs to select the library directory based on the
2102# switches.
2103multilib.h: s-mlib; @true
2104s-mlib: $(srcdir)/genmultilib Makefile
2105	if test @enable_multilib@ = yes \
2106	   || test -n "$(MULTILIB_OSDIRNAMES)"; then \
2107	  $(SHELL) $(srcdir)/genmultilib \
2108	    "$(MULTILIB_OPTIONS)" \
2109	    "$(MULTILIB_DIRNAMES)" \
2110	    "$(MULTILIB_MATCHES)" \
2111	    "$(MULTILIB_EXCEPTIONS)" \
2112	    "$(MULTILIB_EXTRA_OPTS)" \
2113	    "$(MULTILIB_EXCLUSIONS)" \
2114	    "$(MULTILIB_OSDIRNAMES)" \
2115	    "$(MULTILIB_REQUIRED)" \
2116	    "$(if $(MULTILIB_OSDIRNAMES),,$(MULTIARCH_DIRNAME))" \
2117	    "$(MULTILIB_REUSE)" \
2118	    "@enable_multilib@" \
2119	    > tmp-mlib.h; \
2120	else \
2121	  $(SHELL) $(srcdir)/genmultilib '' '' '' '' '' '' '' '' \
2122	    "$(MULTIARCH_DIRNAME)" '' no \
2123	    > tmp-mlib.h; \
2124	fi
2125	$(SHELL) $(srcdir)/../move-if-change tmp-mlib.h multilib.h
2126	$(STAMP) s-mlib
2127#
2128# Compiling object files from source files.
2129
2130# Note that dependencies on obstack.h are not written
2131# because that file is not part of GCC.
2132
2133srcextra: gcc.srcextra lang.srcextra
2134
2135gcc.srcextra: gengtype-lex.c
2136	-cp -p $^ $(srcdir)
2137
2138AR_OBJS = file-find.o
2139AR_LIBS = @COLLECT2_LIBS@
2140
2141gcc-ar$(exeext): gcc-ar.o $(AR_OBJS) $(LIBDEPS)
2142	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) gcc-ar.o -o $@ \
2143		$(AR_OBJS) $(LIBS) $(AR_LIBS)
2144
2145gcc-nm$(exeext): gcc-nm.o $(AR_OBJS) $(LIBDEPS)
2146	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) gcc-nm.o -o $@ \
2147		$(AR_OBJS) $(LIBS) $(AR_LIBS)
2148
2149gcc-ranlib$(exeext): gcc-ranlib.o $(AR_OBJS) $(LIBDEPS)
2150	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) gcc-ranlib.o -o $@ \
2151		$(AR_OBJS) $(LIBS) $(AR_LIBS)
2152
2153CFLAGS-gcc-ar.o += $(DRIVER_DEFINES) \
2154	-DTARGET_MACHINE=\"$(target_noncanonical)\" \
2155	@TARGET_SYSTEM_ROOT_DEFINE@ -DPERSONALITY=\"ar\"
2156
2157CFLAGS-gcc-ranlib.o += $(DRIVER_DEFINES) \
2158	-DTARGET_MACHINE=\"$(target_noncanonical)\" \
2159	@TARGET_SYSTEM_ROOT_DEFINE@ -DPERSONALITY=\"ranlib\"
2160
2161CFLAGS-gcc-nm.o += $(DRIVER_DEFINES) \
2162	-DTARGET_MACHINE=\"$(target_noncanonical)\" \
2163	@TARGET_SYSTEM_ROOT_DEFINE@ -DPERSONALITY=\"nm\"
2164
2165# ??? the implicit rules dont trigger if the source file has a different name
2166# so copy instead
2167gcc-ranlib.c: gcc-ar.c
2168	cp $^ $@
2169
2170gcc-nm.c: gcc-ar.c
2171	cp $^ $@
2172
2173COLLECT2_OBJS = collect2.o collect2-aix.o vec.o ggc-none.o \
2174  collect-utils.o file-find.o hash-table.o selftest.o
2175COLLECT2_LIBS = @COLLECT2_LIBS@
2176collect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS)
2177# Don't try modifying collect2 (aka ld) in place--it might be linking this.
2178	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o T$@ \
2179		$(COLLECT2_OBJS) $(LIBS) $(COLLECT2_LIBS)
2180	mv -f T$@ $@
2181
2182CFLAGS-collect2.o += -DTARGET_MACHINE=\"$(target_noncanonical)\" \
2183	@TARGET_SYSTEM_ROOT_DEFINE@
2184
2185LTO_WRAPPER_OBJS = lto-wrapper.o collect-utils.o ggc-none.o
2186lto-wrapper$(exeext): $(LTO_WRAPPER_OBJS) libcommon-target.a $(LIBDEPS)
2187	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o T$@ \
2188	   $(LTO_WRAPPER_OBJS) libcommon-target.a $(LIBS)
2189	mv -f T$@ $@
2190
2191# Files used by all variants of C or by the stand-alone pre-processor.
2192
2193CFLAGS-c-family/c-opts.o += @TARGET_SYSTEM_ROOT_DEFINE@
2194
2195CFLAGS-c-family/c-pch.o += -DHOST_MACHINE=\"$(host)\" \
2196	-DTARGET_MACHINE=\"$(target)\"
2197
2198default-c.o: config/default-c.c
2199	$(COMPILE) $<
2200	$(POSTCOMPILE)
2201
2202# Files used by all variants of C and some other languages.
2203
2204CFLAGS-prefix.o += -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s)
2205prefix.o: $(BASEVER)
2206
2207# Files used by the D language front end.
2208
2209default-d.o: config/default-d.c
2210	$(COMPILE) $<
2211	$(POSTCOMPILE)
2212
2213# Language-independent files.
2214
2215DRIVER_DEFINES = \
2216  -DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \
2217  -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
2218  -DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \
2219  -DDEFAULT_TARGET_VERSION=\"$(version)\" \
2220  -DDEFAULT_REAL_TARGET_MACHINE=\"$(real_target_noncanonical)\" \
2221  -DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" \
2222  -DSTANDARD_BINDIR_PREFIX=\"$(bindir)/\" \
2223  -DTOOLDIR_BASE_PREFIX=\"$(libsubdir_to_prefix)$(prefix_to_exec_prefix)\" \
2224  -DACCEL_DIR_SUFFIX=\"$(accel_dir_suffix)\" \
2225  @TARGET_SYSTEM_ROOT_DEFINE@ \
2226  $(VALGRIND_DRIVER_DEFINES) \
2227  $(if $(SHLIB),$(if $(filter yes,@enable_shared@),-DENABLE_SHARED_LIBGCC)) \
2228  -DCONFIGURE_SPECS="\"@CONFIGURE_SPECS@\"" \
2229  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
2230  -DNATIVE_SYSTEM_HEADER_DIR=\"$(NATIVE_SYSTEM_HEADER_DIR)\"
2231
2232CFLAGS-gcc.o += $(DRIVER_DEFINES) -DBASEVER=$(BASEVER_s)
2233gcc.o: $(BASEVER)
2234
2235specs.h : s-specs ; @true
2236s-specs : Makefile
2237	lsf="$(lang_specs_files)"; for f in $$lsf; do \
2238	    echo "#include \"$$f\""; \
2239	done | sed 's|$(srcdir)/||' > tmp-specs.h
2240	$(SHELL) $(srcdir)/../move-if-change tmp-specs.h specs.h
2241	$(STAMP) s-specs
2242
2243optionlist: s-options ; @true
2244s-options: $(ALL_OPT_FILES) Makefile $(srcdir)/opt-gather.awk
2245	LC_ALL=C ; export LC_ALL ; \
2246	$(AWK) -f $(srcdir)/opt-gather.awk $(ALL_OPT_FILES) > tmp-optionlist
2247	$(SHELL) $(srcdir)/../move-if-change tmp-optionlist optionlist
2248	$(STAMP) s-options
2249
2250options.c: optionlist $(srcdir)/opt-functions.awk $(srcdir)/opt-read.awk \
2251    $(srcdir)/optc-gen.awk
2252	$(AWK) -f $(srcdir)/opt-functions.awk -f $(srcdir)/opt-read.awk \
2253	       -f $(srcdir)/optc-gen.awk \
2254	       -v header_name="config.h system.h coretypes.h options.h tm.h" < $< > $@
2255
2256options-save.c: optionlist $(srcdir)/opt-functions.awk $(srcdir)/opt-read.awk \
2257    $(srcdir)/optc-save-gen.awk
2258	$(AWK) -f $(srcdir)/opt-functions.awk -f $(srcdir)/opt-read.awk \
2259	       -f $(srcdir)/optc-save-gen.awk \
2260	       -v header_name="config.h system.h coretypes.h tm.h" < $< > $@
2261
2262options.h: s-options-h ; @true
2263s-options-h: optionlist $(srcdir)/opt-functions.awk $(srcdir)/opt-read.awk \
2264    $(srcdir)/opth-gen.awk
2265	$(AWK) -f $(srcdir)/opt-functions.awk -f $(srcdir)/opt-read.awk \
2266	       -f $(srcdir)/opth-gen.awk \
2267	       < $< > tmp-options.h
2268	$(SHELL) $(srcdir)/../move-if-change tmp-options.h options.h
2269	$(STAMP) $@
2270
2271dumpvers: dumpvers.c
2272
2273CFLAGS-version.o += -DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
2274	-DREVISION=$(REVISION_s) \
2275	-DDEVPHASE=$(DEVPHASE_s) -DPKGVERSION=$(PKGVERSION_s) \
2276	-DBUGURL=$(BUGURL_s)
2277version.o: $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
2278
2279# lto-compress.o needs $(ZLIBINC) added to the include flags.
2280CFLAGS-lto-compress.o += $(ZLIBINC)
2281
2282CFLAGS-lto-streamer-in.o += -DTARGET_MACHINE=\"$(target_noncanonical)\"
2283
2284bversion.h: s-bversion; @true
2285s-bversion: BASE-VER
2286	echo "#define BUILDING_GCC_MAJOR `echo $(BASEVER_c) | sed -e 's/^\([0-9]*\).*$$/\1/'`" > bversion.h
2287	echo "#define BUILDING_GCC_MINOR `echo $(BASEVER_c) | sed -e 's/^[0-9]*\.\([0-9]*\).*$$/\1/'`" >> bversion.h
2288	echo "#define BUILDING_GCC_PATCHLEVEL `echo $(BASEVER_c) | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$$/\1/'`" >> bversion.h
2289	echo "#define BUILDING_GCC_VERSION (BUILDING_GCC_MAJOR * 1000 + BUILDING_GCC_MINOR)" >> bversion.h
2290	$(STAMP) s-bversion
2291
2292CFLAGS-toplev.o += -DTARGET_NAME=\"$(target_noncanonical)\"
2293CFLAGS-optinfo-emit-json.o += -DTARGET_NAME=\"$(target_noncanonical)\" $(ZLIBINC)
2294
2295pass-instances.def: $(srcdir)/passes.def $(PASSES_EXTRA) \
2296		    $(srcdir)/gen-pass-instances.awk
2297	$(AWK) -f $(srcdir)/gen-pass-instances.awk \
2298	  $(srcdir)/passes.def $(PASSES_EXTRA) > pass-instances.def
2299
2300$(out_object_file): $(out_file)
2301	$(COMPILE) $<
2302	$(POSTCOMPILE)
2303
2304$(common_out_object_file): $(common_out_file)
2305	$(COMPILE) $<
2306	$(POSTCOMPILE)
2307#
2308# Generate header and source files from the machine description,
2309# and compile them.
2310
2311.PRECIOUS: insn-config.h insn-flags.h insn-codes.h insn-constants.h \
2312  insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
2313  insn-attr.h insn-attr-common.h insn-attrtab.c insn-dfatab.c \
2314  insn-latencytab.c insn-preds.c gimple-match.c generic-match.c \
2315  insn-target-def.h
2316
2317# Dependencies for the md file.  The first time through, we just assume
2318# the md file itself and the generated dependency file (in order to get
2319# it built).  The second time through we have the dependency file.
2320-include mddeps.mk
2321MD_DEPS = s-mddeps $(md_file) $(MD_INCLUDES)
2322
2323s-mddeps: $(md_file) $(MD_INCLUDES) build/genmddeps$(build_exeext)
2324	$(RUN_GEN) build/genmddeps$(build_exeext) $(md_file) > tmp-mddeps
2325	$(SHELL) $(srcdir)/../move-if-change tmp-mddeps mddeps.mk
2326	$(STAMP) s-mddeps
2327
2328# For each of the files generated by running a generator program over
2329# the machine description, the following static pattern rules run the
2330# generator program only if the machine description has changed,
2331# but touch the target file only when its contents actually change.
2332# The "; @true" construct forces Make to recheck the timestamp on
2333# the target file.
2334
2335simple_rtl_generated_h	= insn-attr.h insn-attr-common.h insn-codes.h \
2336			  insn-config.h insn-flags.h insn-target-def.h
2337
2338simple_rtl_generated_c	= insn-automata.c insn-emit.c \
2339			  insn-extract.c insn-output.c \
2340			  insn-peep.c insn-recog.c
2341
2342simple_generated_h	= $(simple_rtl_generated_h) insn-constants.h
2343
2344simple_generated_c	= $(simple_rtl_generated_c) insn-enums.c
2345
2346$(simple_generated_h:insn-%.h=s-%) \
2347$(simple_generated_c:insn-%.c=s-%): s-%: $(MD_DEPS)
2348
2349$(simple_rtl_generated_h:insn-%.h=s-%) \
2350$(simple_rtl_generated_c:insn-%.c=s-%): s-%: insn-conditions.md
2351
2352$(simple_generated_h): insn-%.h: s-%; @true
2353
2354$(simple_generated_h:insn-%.h=s-%): s-%: build/gen%$(build_exeext)
2355	$(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
2356	  $(filter insn-conditions.md,$^) > tmp-$*.h
2357	$(SHELL) $(srcdir)/../move-if-change tmp-$*.h insn-$*.h
2358	$(STAMP) s-$*
2359
2360$(simple_generated_c): insn-%.c: s-%; @true
2361$(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
2362	$(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
2363	  $(filter insn-conditions.md,$^) > tmp-$*.c
2364	$(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
2365	$(STAMP) s-$*
2366
2367# gencheck doesn't read the machine description, and the file produced
2368# doesn't use the insn-* convention.
2369tree-check.h: s-check ; @true
2370s-check : build/gencheck$(build_exeext)
2371	$(RUN_GEN) build/gencheck$(build_exeext) > tmp-check.h
2372	$(SHELL) $(srcdir)/../move-if-change tmp-check.h tree-check.h
2373	$(STAMP) s-check
2374
2375# genattrtab produces three files: tmp-{attrtab.c,dfatab.c,latencytab.c}
2376insn-attrtab.c insn-dfatab.c insn-latencytab.c: s-attrtab ; @true
2377s-attrtab : $(MD_DEPS) build/genattrtab$(build_exeext) \
2378  insn-conditions.md
2379	$(RUN_GEN) build/genattrtab$(build_exeext) $(md_file) insn-conditions.md \
2380		-Atmp-attrtab.c -Dtmp-dfatab.c -Ltmp-latencytab.c
2381	$(SHELL) $(srcdir)/../move-if-change tmp-attrtab.c    insn-attrtab.c
2382	$(SHELL) $(srcdir)/../move-if-change tmp-dfatab.c     insn-dfatab.c
2383	$(SHELL) $(srcdir)/../move-if-change tmp-latencytab.c insn-latencytab.c
2384	$(STAMP) s-attrtab
2385
2386# genopinit produces two files.
2387insn-opinit.c insn-opinit.h: s-opinit ; @true
2388s-opinit: $(MD_DEPS) build/genopinit$(build_exeext) insn-conditions.md
2389	$(RUN_GEN) build/genopinit$(build_exeext) $(md_file) \
2390	  insn-conditions.md -htmp-opinit.h -ctmp-opinit.c
2391	$(SHELL) $(srcdir)/../move-if-change tmp-opinit.h insn-opinit.h
2392	$(SHELL) $(srcdir)/../move-if-change tmp-opinit.c insn-opinit.c
2393	$(STAMP) s-opinit
2394
2395# gencondmd doesn't use the standard naming convention.
2396build/gencondmd.c: s-conditions; @true
2397s-conditions: $(MD_DEPS) build/genconditions$(build_exeext)
2398	$(RUN_GEN) build/genconditions$(build_exeext) $(md_file) > tmp-condmd.c
2399	$(SHELL) $(srcdir)/../move-if-change tmp-condmd.c build/gencondmd.c
2400	$(STAMP) s-conditions
2401
2402insn-conditions.md: s-condmd; @true
2403s-condmd: build/gencondmd$(build_exeext)
2404	$(RUN_GEN) build/gencondmd$(build_exeext) > tmp-cond.md
2405	$(SHELL) $(srcdir)/../move-if-change tmp-cond.md insn-conditions.md
2406	$(STAMP) s-condmd
2407
2408
2409# These files are generated by running the same generator more than
2410# once with different options, so they have custom rules.  The
2411# stampfile idiom is the same.
2412genrtl.h: s-genrtl-h; @true
2413
2414s-genrtl-h: build/gengenrtl$(build_exeext)
2415	$(RUN_GEN) build/gengenrtl$(build_exeext) > tmp-genrtl.h
2416	$(SHELL) $(srcdir)/../move-if-change tmp-genrtl.h genrtl.h
2417	$(STAMP) s-genrtl-h
2418
2419insn-modes.c: s-modes; @true
2420insn-modes.h: s-modes-h; @true
2421insn-modes-inline.h: s-modes-inline-h; @true
2422min-insn-modes.c: s-modes-m; @true
2423
2424s-modes: build/genmodes$(build_exeext)
2425	$(RUN_GEN) build/genmodes$(build_exeext) > tmp-modes.c
2426	$(SHELL) $(srcdir)/../move-if-change tmp-modes.c insn-modes.c
2427	$(STAMP) s-modes
2428
2429s-modes-h: build/genmodes$(build_exeext)
2430	$(RUN_GEN) build/genmodes$(build_exeext) -h > tmp-modes.h
2431	$(SHELL) $(srcdir)/../move-if-change tmp-modes.h insn-modes.h
2432	$(STAMP) s-modes-h
2433
2434s-modes-inline-h: build/genmodes$(build_exeext)
2435	$(RUN_GEN) build/genmodes$(build_exeext) -i > tmp-modes-inline.h
2436	$(SHELL) $(srcdir)/../move-if-change tmp-modes-inline.h \
2437	  insn-modes-inline.h
2438	$(STAMP) s-modes-inline-h
2439
2440s-modes-m: build/genmodes$(build_exeext)
2441	$(RUN_GEN) build/genmodes$(build_exeext) -m > tmp-min-modes.c
2442	$(SHELL) $(srcdir)/../move-if-change tmp-min-modes.c min-insn-modes.c
2443	$(STAMP) s-modes-m
2444
2445insn-preds.c: s-preds; @true
2446tm-preds.h: s-preds-h; @true
2447tm-constrs.h: s-constrs-h; @true
2448
2449.PHONY: mddump
2450mddump: $(BUILD_RTL) $(MD_DEPS) build/genmddump$(build_exeext)
2451	$(RUN_GEN) build/genmddump$(build_exeext) $(md_file) > tmp-mddump.md
2452
2453s-preds: $(MD_DEPS) build/genpreds$(build_exeext)
2454	$(RUN_GEN) build/genpreds$(build_exeext) $(md_file) > tmp-preds.c
2455	$(SHELL) $(srcdir)/../move-if-change tmp-preds.c insn-preds.c
2456	$(STAMP) s-preds
2457
2458s-preds-h: $(MD_DEPS) build/genpreds$(build_exeext)
2459	$(RUN_GEN) build/genpreds$(build_exeext) -h $(md_file) > tmp-preds.h
2460	$(SHELL) $(srcdir)/../move-if-change tmp-preds.h tm-preds.h
2461	$(STAMP) s-preds-h
2462
2463s-constrs-h: $(MD_DEPS) build/genpreds$(build_exeext)
2464	$(RUN_GEN) build/genpreds$(build_exeext) -c $(md_file) > tmp-constrs.h
2465	$(SHELL) $(srcdir)/../move-if-change tmp-constrs.h tm-constrs.h
2466	$(STAMP) s-constrs-h
2467
2468s-case-cfn-macros: build/gencfn-macros$(build_exeext)
2469	$(RUN_GEN) build/gencfn-macros$(build_exeext) -c \
2470	  > tmp-case-cfn-macros.h
2471	$(SHELL) $(srcdir)/../move-if-change tmp-case-cfn-macros.h \
2472	  case-cfn-macros.h
2473	$(STAMP) s-case-cfn-macros
2474case-cfn-macros.h: s-case-cfn-macros; @true
2475
2476s-cfn-operators: build/gencfn-macros$(build_exeext)
2477	$(RUN_GEN) build/gencfn-macros$(build_exeext) -o \
2478	  > tmp-cfn-operators.pd
2479	$(SHELL) $(srcdir)/../move-if-change tmp-cfn-operators.pd \
2480	  cfn-operators.pd
2481	$(STAMP) s-cfn-operators
2482cfn-operators.pd: s-cfn-operators; @true
2483
2484target-hooks-def.h: s-target-hooks-def-h; @true
2485# make sure that when we build info files, the used tm.texi is up to date.
2486$(srcdir)/doc/tm.texi: s-tm-texi; @true
2487
2488s-target-hooks-def-h: build/genhooks$(build_exeext)
2489	$(RUN_GEN) build/genhooks$(build_exeext) "Target Hook" \
2490					     > tmp-target-hooks-def.h
2491	$(SHELL) $(srcdir)/../move-if-change tmp-target-hooks-def.h \
2492					     target-hooks-def.h
2493	$(STAMP) s-target-hooks-def-h
2494
2495c-family/c-target-hooks-def.h: s-c-target-hooks-def-h; @true
2496
2497s-c-target-hooks-def-h: build/genhooks$(build_exeext)
2498	$(RUN_GEN) build/genhooks$(build_exeext) "C Target Hook" \
2499					     > tmp-c-target-hooks-def.h
2500	$(SHELL) $(srcdir)/../move-if-change tmp-c-target-hooks-def.h \
2501					     c-family/c-target-hooks-def.h
2502	$(STAMP) s-c-target-hooks-def-h
2503
2504common/common-target-hooks-def.h: s-common-target-hooks-def-h; @true
2505
2506s-common-target-hooks-def-h: build/genhooks$(build_exeext)
2507	$(RUN_GEN) build/genhooks$(build_exeext) "Common Target Hook" \
2508					     > tmp-common-target-hooks-def.h
2509	$(SHELL) $(srcdir)/../move-if-change tmp-common-target-hooks-def.h \
2510					     common/common-target-hooks-def.h
2511	$(STAMP) s-common-target-hooks-def-h
2512
2513d/d-target-hooks-def.h: s-d-target-hooks-def-h; @true
2514
2515s-d-target-hooks-def-h: build/genhooks$(build_exeext)
2516	$(RUN_GEN) build/genhooks$(build_exeext) "D Target Hook" \
2517					     > tmp-d-target-hooks-def.h
2518	$(SHELL) $(srcdir)/../move-if-change tmp-d-target-hooks-def.h \
2519					     d/d-target-hooks-def.h
2520	$(STAMP) s-d-target-hooks-def-h
2521
2522# check if someone mistakenly only changed tm.texi.
2523# We use a different pathname here to avoid a circular dependency.
2524s-tm-texi: $(srcdir)/doc/../doc/tm.texi
2525
2526# The tm.texi we want to compare against / check into svn should have
2527# unix-style line endings.  To make this work on MinGW, remove \r.
2528# \r is not portable to Solaris tr, therefore we have a special
2529# case for ASCII.  We use \r for other encodings like EBCDIC.
2530s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
2531	$(RUN_GEN) build/genhooks$(build_exeext) -d \
2532			$(srcdir)/doc/tm.texi.in > tmp-tm.texi
2533	case `echo X|tr X '\101'` in \
2534	  A) tr -d '\015' < tmp-tm.texi > tmp2-tm.texi ;; \
2535	  *) tr -d '\r' < tmp-tm.texi > tmp2-tm.texi ;; \
2536	esac
2537	mv tmp2-tm.texi tmp-tm.texi
2538	$(SHELL) $(srcdir)/../move-if-change tmp-tm.texi tm.texi
2539	@if cmp -s $(srcdir)/doc/tm.texi tm.texi; then \
2540	  $(STAMP) $@; \
2541	elif test $(srcdir)/doc/tm.texi -nt $(srcdir)/doc/tm.texi.in \
2542	  && ( test $(srcdir)/doc/tm.texi -nt $(srcdir)/target.def \
2543	    || test $(srcdir)/doc/tm.texi -nt $(srcdir)/c-family/c-target.def \
2544	    || test $(srcdir)/doc/tm.texi -nt $(srcdir)/common/common-target.def \
2545	    || test $(srcdir)/doc/tm.texi -nt $(srcdir)/d/d-target.def \
2546	  ); then \
2547	  echo >&2 ; \
2548	  echo You should edit $(srcdir)/doc/tm.texi.in rather than $(srcdir)/doc/tm.texi . >&2 ; \
2549	  false; \
2550	else \
2551	  echo >&2 ; \
2552	  echo Verify that you have permission to grant a GFDL license for all >&2 ; \
2553	  echo new text in $(objdir)/tm.texi, then copy it to $(srcdir)/doc/tm.texi. >&2 ; \
2554	  false; \
2555	fi
2556
2557gimple-match.c: s-match gimple-match-head.c ; @true
2558generic-match.c: s-match generic-match-head.c ; @true
2559
2560s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd
2561	$(RUN_GEN) build/genmatch$(build_exeext) --gimple $(srcdir)/match.pd \
2562	    > tmp-gimple-match.c
2563	$(RUN_GEN) build/genmatch$(build_exeext) --generic $(srcdir)/match.pd \
2564	    > tmp-generic-match.c
2565	$(SHELL) $(srcdir)/../move-if-change tmp-gimple-match.c \
2566	    					gimple-match.c
2567	$(SHELL) $(srcdir)/../move-if-change tmp-generic-match.c \
2568	    					generic-match.c
2569	$(STAMP) s-match
2570
2571GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
2572  $(host_xm_file_list) \
2573  $(tm_file_list) $(HASHTAB_H) $(SPLAY_TREE_H) $(srcdir)/bitmap.h \
2574  $(srcdir)/wide-int.h $(srcdir)/alias.h \
2575  $(srcdir)/coverage.c  $(srcdir)/rtl.h \
2576  $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/tree-core.h \
2577  $(srcdir)/libfuncs.h $(SYMTAB_H) \
2578  $(srcdir)/real.h $(srcdir)/function.h $(srcdir)/insn-addr.h $(srcdir)/hwint.h \
2579  $(srcdir)/fixed-value.h \
2580  $(srcdir)/function-abi.h \
2581  $(srcdir)/output.h $(srcdir)/cfgloop.h $(srcdir)/cfg.h $(srcdir)/profile-count.h \
2582  $(srcdir)/cselib.h $(srcdir)/basic-block.h  $(srcdir)/ipa-ref.h $(srcdir)/cgraph.h \
2583  $(srcdir)/reload.h $(srcdir)/caller-save.c $(srcdir)/symtab.c \
2584  $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
2585  $(srcdir)/ipa-prop.c $(srcdir)/ipa-cp.c $(srcdir)/ipa-utils.h \
2586  $(srcdir)/ipa-param-manipulation.h $(srcdir)/ipa-sra.c $(srcdir)/dbxout.c \
2587  $(srcdir)/signop.h \
2588  $(srcdir)/dwarf2out.h \
2589  $(srcdir)/dwarf2asm.c \
2590  $(srcdir)/dwarf2cfi.c \
2591  $(srcdir)/dwarf2out.c \
2592  $(srcdir)/tree-vect-generic.c \
2593  $(srcdir)/dojump.c $(srcdir)/emit-rtl.h \
2594  $(srcdir)/emit-rtl.c $(srcdir)/except.h $(srcdir)/explow.c $(srcdir)/expr.c \
2595  $(srcdir)/expr.h \
2596  $(srcdir)/function.c $(srcdir)/except.c \
2597  $(srcdir)/ggc-tests.c \
2598  $(srcdir)/gcse.c $(srcdir)/godump.c \
2599  $(srcdir)/lists.c $(srcdir)/optabs-libfuncs.c \
2600  $(srcdir)/profile.c $(srcdir)/mcf.c \
2601  $(srcdir)/reg-stack.c $(srcdir)/cfgrtl.c \
2602  $(srcdir)/stor-layout.c \
2603  $(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \
2604  $(srcdir)/gimple.h \
2605  $(srcdir)/gimple-ssa.h \
2606  $(srcdir)/tree-ssanames.c $(srcdir)/tree-eh.c $(srcdir)/tree-ssa-address.c \
2607  $(srcdir)/tree-cfg.c $(srcdir)/tree-ssa-loop-ivopts.c \
2608  $(srcdir)/tree-dfa.c \
2609  $(srcdir)/tree-iterator.c $(srcdir)/gimple-expr.c \
2610  $(srcdir)/tree-chrec.h \
2611  $(srcdir)/tree-scalar-evolution.c \
2612  $(srcdir)/tree-ssa-operands.h \
2613  $(srcdir)/tree-profile.c $(srcdir)/tree-nested.c \
2614  $(srcdir)/omp-offload.h \
2615  $(srcdir)/omp-offload.c \
2616  $(srcdir)/omp-expand.c \
2617  $(srcdir)/omp-low.c \
2618  $(srcdir)/targhooks.c $(out_file) $(srcdir)/passes.c $(srcdir)/cgraphunit.c \
2619  $(srcdir)/cgraphclones.c \
2620  $(srcdir)/tree-phinodes.c \
2621  $(srcdir)/tree-ssa-alias.h \
2622  $(srcdir)/tree-ssanames.h \
2623  $(srcdir)/tree-vrp.h \
2624  $(srcdir)/ipa-prop.h \
2625  $(srcdir)/trans-mem.c \
2626  $(srcdir)/lto-streamer.h \
2627  $(srcdir)/target-globals.h \
2628  $(srcdir)/ipa-predicate.h \
2629  $(srcdir)/ipa-fnsummary.h \
2630  $(srcdir)/value-range.h \
2631  $(srcdir)/vtable-verify.c \
2632  $(srcdir)/asan.c \
2633  $(srcdir)/ubsan.c \
2634  $(srcdir)/tsan.c \
2635  $(srcdir)/sanopt.c \
2636  $(srcdir)/sancov.c \
2637  $(srcdir)/ipa-devirt.c \
2638  $(srcdir)/internal-fn.h \
2639  $(srcdir)/hsa-common.c \
2640  $(srcdir)/calls.c \
2641  $(srcdir)/omp-general.h \
2642  @all_gtfiles@
2643
2644# Compute the list of GT header files from the corresponding C sources,
2645# possibly nested within config or language subdirectories.  Match gengtype's
2646# behavior in this respect: gt-LANG-file.h for "file" anywhere within a LANG
2647# language subdir, gt-file.h otherwise (no subdir indication for config/
2648# related sources).
2649
2650GTFILES_H = $(subst /,-, \
2651	    $(shell echo $(patsubst $(srcdir)/%,gt-%, \
2652			   $(patsubst %.c,%.h, \
2653			     $(filter %.c, $(GTFILES)))) \
2654			| sed -e "s|/[^ ]*/|/|g" -e "s|gt-config/|gt-|g"))
2655
2656GTFILES_LANG_H = $(patsubst [%], gtype-%.h, $(filter [%], $(GTFILES)))
2657ALL_GTFILES_H := $(sort $(GTFILES_H) $(GTFILES_LANG_H))
2658
2659# $(GTFILES) may be too long to put on a command line, so we have to
2660# write it out to a file (taking care not to do that in a way that
2661# overflows a command line!) and then have gengtype read the file in.
2662
2663$(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gtype.state: s-gtype ; @true
2664
2665### Common flags to gengtype [e.g. -v or -B backupdir]
2666GENGTYPE_FLAGS=
2667
2668gtyp-input.list: s-gtyp-input ; @true
2669s-gtyp-input: Makefile
2670	@: $(call write_entries_to_file,$(GTFILES),tmp-gi.list)
2671	$(SHELL) $(srcdir)/../move-if-change tmp-gi.list gtyp-input.list
2672	$(STAMP) s-gtyp-input
2673
2674s-gtype: build/gengtype$(build_exeext) $(filter-out [%], $(GTFILES)) \
2675	 gtyp-input.list
2676# First, parse all files and save a state file.
2677	$(RUN_GEN) build/gengtype$(build_exeext) $(GENGTYPE_FLAGS) \
2678                    -S $(srcdir) -I gtyp-input.list -w tmp-gtype.state
2679# Second, read the state file and generate all files.  This ensure that
2680# gtype.state is correctly read:
2681	$(SHELL) $(srcdir)/../move-if-change tmp-gtype.state gtype.state
2682	$(RUN_GEN) build/gengtype$(build_exeext) $(GENGTYPE_FLAGS) \
2683                    -r gtype.state
2684	$(STAMP) s-gtype
2685
2686generated_files = config.h tm.h $(TM_P_H) $(TM_D_H) $(TM_H) multilib.h \
2687       $(simple_generated_h) specs.h \
2688       tree-check.h genrtl.h insn-modes.h insn-modes-inline.h \
2689       tm-preds.h tm-constrs.h \
2690       $(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h \
2691       options.h target-hooks-def.h insn-opinit.h \
2692       common/common-target-hooks-def.h pass-instances.def \
2693       c-family/c-target-hooks-def.h d/d-target-hooks-def.h \
2694       case-cfn-macros.h \
2695       cfn-operators.pd omp-device-properties.h
2696
2697#
2698# How to compile object files to run on the build machine.
2699
2700build/%.o :  # dependencies provided by explicit rule later
2701	$(COMPILER_FOR_BUILD) -c $(BUILD_COMPILERFLAGS) $(BUILD_CPPFLAGS) \
2702		-o $@ $<
2703
2704## build/version.o is compiled by the $(COMPILER_FOR_BUILD) but needs
2705## several C macro definitions, just like version.o
2706build/version.o:  version.c version.h \
2707                  $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
2708	$(COMPILER_FOR_BUILD) -c $(BUILD_COMPILERFLAGS) $(BUILD_CPPFLAGS) \
2709	-DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
2710	-DREVISION=$(REVISION_s) \
2711	-DDEVPHASE=$(DEVPHASE_s) -DPKGVERSION=$(PKGVERSION_s) \
2712	-DBUGURL=$(BUGURL_s) -o $@ $<
2713
2714# Header dependencies for the programs that generate source code.
2715# These are library modules...
2716build/errors.o : errors.c $(BCONFIG_H) $(SYSTEM_H) errors.h
2717build/gensupport.o: gensupport.c $(BCONFIG_H) $(SYSTEM_H) 		\
2718  $(CORETYPES_H) $(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) errors.h		\
2719  $(HASHTAB_H) $(READ_MD_H) $(GENSUPPORT_H) $(HASH_TABLE_H)
2720build/ggc-none.o : ggc-none.c $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) 	\
2721  $(GGC_H)
2722build/min-insn-modes.o : min-insn-modes.c $(BCONFIG_H) $(SYSTEM_H)	\
2723  $(CORETYPES_H)
2724build/print-rtl.o: print-rtl.c $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H)	\
2725  $(GTM_H) $(RTL_BASE_H)
2726build/read-md.o: read-md.c $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H)	\
2727  $(HASHTAB_H) errors.h $(READ_MD_H)
2728build/read-rtl.o: read-rtl.c $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H)	\
2729  $(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) $(HASHTAB_H) $(READ_MD_H)		\
2730  $(GENSUPPORT_H)
2731build/rtl.o: rtl.c $(BCONFIG_H) $(CORETYPES_H) $(GTM_H) $(SYSTEM_H)	\
2732  $(RTL_H) $(GGC_H) errors.h
2733build/vec.o : vec.c $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) $(VEC_H)	\
2734  $(GGC_H) toplev.h $(DIAGNOSTIC_CORE_H) $(HASH_TABLE_H)
2735build/hash-table.o : hash-table.c $(BCONFIG_H) $(SYSTEM_H)		\
2736  $(CORETYPES_H) $(HASH_TABLE_H) $(GGC_H) toplev.h $(DIAGNOSTIC_CORE_H)
2737build/sort.o : sort.cc $(BCONFIG_H) $(SYSTEM_H)
2738build/inchash.o : inchash.c $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H)	\
2739  $(HASHTAB_H) inchash.h
2740build/gencondmd.o : build/gencondmd.c $(BCONFIG_H) $(SYSTEM_H)		\
2741  $(CORETYPES_H) $(GTM_H) insn-constants.h				\
2742  $(filter-out insn-flags.h, $(RTL_H) $(TM_P_H) $(FUNCTION_H) $(REGS_H) \
2743  $(RECOG_H) output.h $(FLAGS_H) $(RESOURCE_H) toplev.h $(DIAGNOSTIC_CORE_H) reload.h 	\
2744  $(EXCEPT_H) tm-constrs.h)
2745# This pulls in tm-pred.h which contains inline functions wrapping up
2746# predicates from the back-end so those functions must be discarded.
2747# No big deal since gencondmd.c is a dummy file for non-GCC compilers.
2748build/gencondmd.o : \
2749  BUILD_CFLAGS := $(filter-out -fkeep-inline-functions, $(BUILD_CFLAGS))
2750
2751# ...these are the programs themselves.
2752build/genattr.o : genattr.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
2753  $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
2754build/genattr-common.o : genattr-common.c $(RTL_BASE_H) $(BCONFIG_H)	\
2755  $(SYSTEM_H) $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
2756build/genattrtab.o : genattrtab.c $(RTL_BASE_H) $(OBSTACK_H)		\
2757  $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) $(GTM_H) errors.h $(GGC_H)	\
2758  $(READ_MD_H) $(GENSUPPORT_H) $(FNMATCH_H)
2759build/genautomata.o : genautomata.c $(RTL_BASE_H) $(OBSTACK_H)		\
2760  $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) $(GTM_H) errors.h $(VEC_H)	\
2761  $(HASHTAB_H) $(GENSUPPORT_H) $(FNMATCH_H)
2762build/gencheck.o : gencheck.c all-tree.def $(BCONFIG_H) $(GTM_H)	\
2763	$(SYSTEM_H) $(CORETYPES_H) tree.def c-family/c-common.def	\
2764	$(lang_tree_files) gimple.def
2765build/genchecksum.o : genchecksum.c $(BCONFIG_H) $(SYSTEM_H) $(MD5_H)
2766build/gencodes.o : gencodes.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
2767  $(CORETYPES_H) $(GTM_H) errors.h $(GENSUPPORT_H)
2768build/genconditions.o : genconditions.c $(RTL_BASE_H) $(BCONFIG_H)	\
2769  $(SYSTEM_H) $(CORETYPES_H) $(GTM_H) errors.h $(HASHTAB_H)		\
2770  $(READ_MD_H) $(GENSUPPORT_H)
2771build/genconfig.o : genconfig.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
2772  $(CORETYPES_H) $(GTM_H) errors.h $(GENSUPPORT_H)
2773build/genconstants.o : genconstants.c $(BCONFIG_H) $(SYSTEM_H)		\
2774  $(CORETYPES_H) errors.h $(READ_MD_H)
2775build/genemit.o : genemit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
2776  $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) internal-fn.def
2777build/genenums.o : genenums.c $(BCONFIG_H) $(SYSTEM_H)			\
2778  $(CORETYPES_H) errors.h $(READ_MD_H)
2779build/genextract.o : genextract.c $(RTL_BASE_H) $(BCONFIG_H)		\
2780  $(SYSTEM_H) $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
2781build/genflags.o : genflags.c $(RTL_BASE_H) $(OBSTACK_H) $(BCONFIG_H)	\
2782  $(SYSTEM_H) $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
2783build/gentarget-def.o : gentarget-def.c $(BCONFIG_H) $(SYSTEM_H)	\
2784  $(CORETYPES_H) $(GTM_H) $(RTL_BASE_H) errors.h $(READ_MD_H)		\
2785  $(GENSUPPORT_H) $(HASH_TABLE_H) target-insns.def
2786build/gengenrtl.o : gengenrtl.c $(BCONFIG_H) $(SYSTEM_H) rtl.def
2787
2788# The gengtype generator program is special: Two versions are built.
2789# One is for the build machine, and one is for the host to allow
2790# plugins to define their types and generate the supporting GGC
2791# datastructures and routines with GTY markers.
2792# The host object files depend on CONFIG_H, and the build objects
2793# on BCONFIG_H.  For the build objects, add -DGENERATOR_FILE manually,
2794# the build-%: rule doesn't apply to them.
2795
2796GENGTYPE_OBJS = gengtype.o gengtype-parse.o gengtype-state.o \
2797  gengtype-lex.o errors.o
2798
2799gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H)
2800CFLAGS-gengtype-lex.o += -DHOST_GENERATOR_FILE
2801build/gengtype-lex.o: $(BCONFIG_H)
2802
2803gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
2804  $(SYSTEM_H)
2805CFLAGS-gengtype-parse.o += -DHOST_GENERATOR_FILE
2806build/gengtype-parse.o: $(BCONFIG_H)
2807
2808gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
2809  gengtype.h errors.h version.h $(HASHTAB_H) $(OBSTACK_H) \
2810  $(XREGEX_H)
2811CFLAGS-gengtype-state.o += -DHOST_GENERATOR_FILE
2812build/gengtype-state.o: $(BCONFIG_H)
2813gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h 	\
2814  rtl.def insn-notes.def errors.h version.h     		\
2815  $(HASHTAB_H) $(OBSTACK_H) $(XREGEX_H)
2816CFLAGS-gengtype.o += -DHOST_GENERATOR_FILE
2817build/gengtype.o: $(BCONFIG_H)
2818
2819CFLAGS-errors.o += -DHOST_GENERATOR_FILE
2820
2821build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H)	\
2822  errors.h $(READ_MD_H)
2823build/genmodes.o : genmodes.c $(BCONFIG_H) $(SYSTEM_H) errors.h		\
2824  $(HASHTAB_H) machmode.def $(extra_modes_file)
2825build/genopinit.o : genopinit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
2826  $(CORETYPES_H) $(GTM_H) errors.h $(GENSUPPORT_H) optabs.def
2827build/genoutput.o : genoutput.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
2828  $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
2829build/genpeep.o : genpeep.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
2830  $(CORETYPES_H) $(GTM_H) errors.h $(GENSUPPORT_H) toplev.h		\
2831  $(DIAGNOSTIC_CORE_H)
2832build/genpreds.o : genpreds.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
2833  $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) $(OBSTACK_H)
2834build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
2835  $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)		\
2836  $(HASH_TABLE_H) inchash.h
2837build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF)		\
2838  $(COMMON_TARGET_DEF) $(D_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h
2839build/genmddump.o : genmddump.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
2840  $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
2841build/genmatch.o : genmatch.c $(BCONFIG_H) $(SYSTEM_H) \
2842  $(CORETYPES_H) errors.h $(HASH_TABLE_H) hash-map.h $(GGC_H) is-a.h \
2843  tree.def builtins.def internal-fn.def case-cfn-macros.h $(CPPLIB_H)
2844build/gencfn-macros.o : gencfn-macros.c $(BCONFIG_H) $(SYSTEM_H)	\
2845  $(CORETYPES_H) errors.h $(HASH_TABLE_H) hash-set.h builtins.def	\
2846  internal-fn.def
2847
2848# Compile the programs that generate insn-* from the machine description.
2849# They are compiled with $(COMPILER_FOR_BUILD), and associated libraries,
2850# since they need to run on this machine
2851# even if GCC is being compiled to run on some other machine.
2852
2853# All these programs use the RTL reader ($(BUILD_RTL)).
2854genprogrtl = attr attr-common attrtab automata codes conditions config emit \
2855	     extract flags mddump opinit output peep preds recog target-def
2856$(genprogrtl:%=build/gen%$(build_exeext)): $(BUILD_RTL)
2857
2858# All these programs use the MD reader ($(BUILD_MD)).
2859genprogmd = $(genprogrtl) mddeps constants enums
2860$(genprogmd:%=build/gen%$(build_exeext)): $(BUILD_MD)
2861
2862# All these programs need to report errors.
2863genprogerr = $(genprogmd) genrtl modes gtype hooks cfn-macros condmd
2864$(genprogerr:%=build/gen%$(build_exeext)): $(BUILD_ERRORS)
2865
2866# Remaining build programs.
2867genprog = $(genprogerr) check checksum match
2868
2869# These programs need libs over and above what they get from the above list.
2870build/genautomata$(build_exeext) : BUILD_LIBS += -lm
2871
2872build/genrecog$(build_exeext) : build/hash-table.o build/inchash.o
2873build/gencfn-macros$(build_exeext) : build/hash-table.o build/vec.o \
2874  build/ggc-none.o build/sort.o
2875
2876# For stage1 and when cross-compiling use the build libcpp which is
2877# built with NLS disabled.  For stage2+ use the host library and
2878# its dependencies.
2879ifeq ($(build_objdir),$(build_libobjdir))
2880BUILD_CPPLIB = $(build_libobjdir)/libcpp/libcpp.a
2881else
2882BUILD_CPPLIB = $(CPPLIB) $(LIBIBERTY)
2883build/genmatch$(build_exeext): BUILD_LIBDEPS += $(LIBINTL_DEP) $(LIBICONV_DEP)
2884build/genmatch$(build_exeext): BUILD_LIBS += $(LIBINTL) $(LIBICONV)
2885endif
2886
2887build/genmatch$(build_exeext) : $(BUILD_CPPLIB) \
2888  $(BUILD_ERRORS) build/vec.o build/hash-table.o build/sort.o
2889
2890# These programs are not linked with the MD reader.
2891build/gengtype$(build_exeext) : build/gengtype-lex.o build/gengtype-parse.o \
2892              build/gengtype-state.o build/version.o build/errors.o
2893
2894gengtype$(exeext) : gengtype.o gengtype-lex.o gengtype-parse.o \
2895              gengtype-state.o version.o errors.o $(LIBDEPS)
2896	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
2897	    $(filter-out ($LIBDEPS), $^) $(LIBS)
2898
2899# Rule for the generator programs:
2900$(genprog:%=build/gen%$(build_exeext)): build/gen%$(build_exeext): build/gen%.o $(BUILD_LIBDEPS)
2901	+$(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ \
2902	    $(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS)
2903
2904omp-general.o: omp-device-properties.h
2905
2906omp_device_properties = @omp_device_properties@
2907omp-device-properties.h: s-omp-device-properties-h ; @true
2908s-omp-device-properties-h: @omp_device_property_deps@
2909	-rm -f tmp-omp-device-properties.h; \
2910	for kind in kind arch isa; do \
2911	  echo 'const char omp_offload_device_'$${kind}'[] = ' \
2912	    >> tmp-omp-device-properties.h; \
2913	  for prop in none $(omp_device_properties); do \
2914	    [ "$$prop" = "none" ] && continue; \
2915	    tgt=`echo "$$prop" | sed 's/=.*$$//'`; \
2916	    props=`echo "$$prop" | sed 's/.*=//'`; \
2917	    echo "\"$$tgt\\0\"" >> tmp-omp-device-properties.h; \
2918	    sed -n 's/^'$${kind}': //p' $${props} \
2919	      | sed 's/[[:blank:]]/ /g;s/  */ /g;s/^ //;s/ $$//;s/ /\\0/g;s/^/"/;s/$$/\\0\\0"/' \
2920	      >> tmp-omp-device-properties.h; \
2921	  done; \
2922	  echo '"";' >> tmp-omp-device-properties.h; \
2923	done; \
2924	$(SHELL) $(srcdir)/../move-if-change tmp-omp-device-properties.h \
2925	  omp-device-properties.h
2926	$(STAMP) s-omp-device-properties-h
2927
2928# Generated source files for gengtype.  Prepend inclusion of
2929# config.h/bconfig.h because AIX requires _LARGE_FILES to be defined before
2930# any system header is included.
2931gengtype-lex.c : gengtype-lex.l
2932	-$(FLEX) $(FLEXFLAGS) -o$@ $< && { \
2933	  echo '#ifdef HOST_GENERATOR_FILE' > $@.tmp; \
2934	  echo '#include "config.h"'       >> $@.tmp; \
2935	  echo '#else'                     >> $@.tmp; \
2936	  echo '#include "bconfig.h"'      >> $@.tmp; \
2937	  echo '#endif'                    >> $@.tmp; \
2938	  cat $@ >> $@.tmp; \
2939	  mv $@.tmp $@; \
2940	}
2941
2942#
2943# Remake internationalization support.
2944CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
2945
2946#
2947# Remake cpp.
2948
2949PREPROCESSOR_DEFINES = \
2950  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
2951  -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
2952  -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
2953  -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
2954  -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_noncanonical)\" \
2955  -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
2956  -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
2957  -DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
2958  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
2959  -DNATIVE_SYSTEM_HEADER_DIR=\"$(NATIVE_SYSTEM_HEADER_DIR)\" \
2960  -DPREFIX=\"$(prefix)/\" \
2961  -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
2962  @TARGET_SYSTEM_ROOT_DEFINE@
2963
2964CFLAGS-cppbuiltin.o += $(PREPROCESSOR_DEFINES) -DBASEVER=$(BASEVER_s)
2965cppbuiltin.o: $(BASEVER)
2966
2967CFLAGS-cppdefault.o += $(PREPROCESSOR_DEFINES)
2968
2969# Note for the stamp targets, we run the program `true' instead of
2970# having an empty command (nothing following the semicolon).
2971
2972# gcov-iov.c is run on the build machine to generate gcov-iov.h from version.c
2973build/gcov-iov.o: gcov-iov.c $(BCONFIG_H) $(CORETYPES_H) $(GTM_H) \
2974  $(SYSTEM_H) $(CORETYPES_H) $(TM_H)
2975
2976build/gcov-iov$(build_exeext): build/gcov-iov.o
2977	+$(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) \
2978		build/gcov-iov.o -o $@
2979
2980gcov-iov.h: s-iov; @true
2981s-iov: build/gcov-iov$(build_exeext) $(BASEVER) $(DEVPHASE)
2982	build/gcov-iov$(build_exeext) '$(BASEVER_c)' '$(DEVPHASE_c)' \
2983	    > tmp-gcov-iov.h
2984	$(SHELL) $(srcdir)/../move-if-change tmp-gcov-iov.h gcov-iov.h
2985	$(STAMP) s-iov
2986
2987# gcov.o needs $(ZLIBINC) added to the include flags.
2988CFLAGS-gcov.o += $(ZLIBINC)
2989
2990GCOV_OBJS = gcov.o json.o
2991gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS)
2992	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_OBJS) \
2993		hash-table.o ggc-none.o $(LIBS) $(ZLIB) -o $@
2994GCOV_DUMP_OBJS = gcov-dump.o
2995gcov-dump$(exeext): $(GCOV_DUMP_OBJS) $(LIBDEPS)
2996	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_DUMP_OBJS) \
2997		hash-table.o ggc-none.o\
2998		$(LIBS) -o $@
2999
3000GCOV_TOOL_DEP_FILES = $(srcdir)/../libgcc/libgcov-util.c gcov-io.c $(GCOV_IO_H) \
3001  $(srcdir)/../libgcc/libgcov-driver.c $(srcdir)/../libgcc/libgcov-driver-system.c \
3002  $(srcdir)/../libgcc/libgcov-merge.c $(srcdir)/../libgcc/libgcov.h \
3003  $(SYSTEM_H) coretypes.h $(TM_H) $(CONFIG_H) version.h intl.h $(DIAGNOSTIC_H)
3004libgcov-util.o: $(srcdir)/../libgcc/libgcov-util.c $(GCOV_TOOL_DEP_FILES)
3005	+$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -o $@ $<
3006libgcov-driver-tool.o: $(srcdir)/../libgcc/libgcov-driver.c $(GCOV_TOOL_DEP_FILES)
3007	+$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
3008	  -DIN_GCOV_TOOL=1 -o $@ $<
3009libgcov-merge-tool.o: $(srcdir)/../libgcc/libgcov-merge.c $(GCOV_TOOL_DEP_FILES)
3010	+$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
3011	  -DIN_GCOV_TOOL=1 -o $@ $<
3012GCOV_TOOL_OBJS = gcov-tool.o libgcov-util.o libgcov-driver-tool.o libgcov-merge-tool.o
3013gcov-tool$(exeext): $(GCOV_TOOL_OBJS) $(LIBDEPS)
3014	+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_TOOL_OBJS) $(LIBS) -o $@
3015#
3016# Build the include directories.  The stamp files are stmp-* rather than
3017# s-* so that mostlyclean does not force the include directory to
3018# be rebuilt.
3019
3020# Build the include directories.
3021stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) fixinc_list
3022# Copy in the headers provided with gcc.
3023#
3024# The sed command gets just the last file name component;
3025# this is necessary because VPATH could add a dirname.
3026# Using basename would be simpler, but some systems don't have it.
3027#
3028# The touch command is here to workaround an AIX/Linux NFS bug.
3029#
3030# The move-if-change + cp -p twists for limits.h are intended to preserve
3031# the time stamp when we regenerate, to prevent pointless rebuilds during
3032# e.g. install-no-fixedincludes.
3033	-if [ -d include ] ; then true; else mkdir include; chmod a+rx include; fi
3034	-if [ -d include-fixed ] ; then true; else mkdir include-fixed; chmod a+rx include-fixed; fi
3035	for file in .. $(USER_H); do \
3036	  if [ X$$file != X.. ]; then \
3037	    realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
3038	    $(STAMP) include/$$realfile; \
3039	    rm -f include/$$realfile; \
3040	    cp $$file include; \
3041	    chmod a+r include/$$realfile; \
3042	  fi; \
3043	done
3044	for file in .. $(USER_H_INC_NEXT_PRE); do \
3045	  if [ X$$file != X.. ]; then \
3046            mv include/$$file include/x_$$file; \
3047            echo "#include_next <$$file>" >include/$$file; \
3048            cat include/x_$$file >>include/$$file; \
3049            rm -f include/x_$$file; \
3050	    chmod a+r include/$$file; \
3051	  fi; \
3052	done
3053	for file in .. $(USER_H_INC_NEXT_POST); do \
3054	  if [ X$$file != X.. ]; then \
3055	    echo "#include_next <$$file>" >>include/$$file; \
3056	    chmod a+r include/$$file; \
3057	  fi; \
3058	done
3059	rm -f include/stdint.h
3060	if [ $(USE_GCC_STDINT) = wrap ]; then \
3061	  rm -f include/stdint-gcc.h; \
3062	  cp $(srcdir)/ginclude/stdint-gcc.h include/stdint-gcc.h; \
3063	  chmod a+r include/stdint-gcc.h; \
3064	  cp $(srcdir)/ginclude/stdint-wrap.h include/stdint.h; \
3065	  chmod a+r include/stdint.h; \
3066	elif [ $(USE_GCC_STDINT) = provide ]; then \
3067	  cp $(srcdir)/ginclude/stdint-gcc.h include/stdint.h; \
3068	  chmod a+r include/stdint.h; \
3069	fi
3070	set -e; for ml in `cat fixinc_list`; do \
3071	  sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \
3072	  multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
3073	  fix_dir=include-fixed$${multi_dir}; \
3074	  if $(LIMITS_H_TEST) ; then \
3075	    cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \
3076	  else \
3077	    cat $(srcdir)/glimits.h > tmp-xlimits.h; \
3078	  fi; \
3079	  $(mkinstalldirs) $${fix_dir}; \
3080	  chmod a+rx $${fix_dir} || true; \
3081	  $(SHELL) $(srcdir)/../move-if-change \
3082	    tmp-xlimits.h  tmp-limits.h; \
3083	  rm -f $${fix_dir}/limits.h; \
3084	  cp -p tmp-limits.h $${fix_dir}/limits.h; \
3085	  chmod a+r $${fix_dir}/limits.h; \
3086	done
3087# Install the README
3088	rm -f include-fixed/README
3089	cp $(srcdir)/../fixincludes/README-fixinc include-fixed/README
3090	chmod a+r include-fixed/README
3091	$(STAMP) $@
3092
3093.PHONY: install-gcc-tooldir
3094install-gcc-tooldir:
3095	$(mkinstalldirs) $(DESTDIR)$(gcc_tooldir)
3096
3097macro_list: s-macro_list; @true
3098s-macro_list : $(GCC_PASSES) cc1$(exeext)
3099	echo | $(GCC_FOR_TARGET) -E -dM - | \
3100	  sed -n -e 's/^#define \([^_][a-zA-Z0-9_]*\).*/\1/p' \
3101		 -e 's/^#define \(_[^_A-Z][a-zA-Z0-9_]*\).*/\1/p' | \
3102	  sort -u > tmp-macro_list
3103	$(SHELL) $(srcdir)/../move-if-change tmp-macro_list macro_list
3104	$(STAMP) s-macro_list
3105
3106fixinc_list: s-fixinc_list; @true
3107s-fixinc_list : $(GCC_PASSES)
3108# Build up a list of multilib directories and corresponding sysroot
3109# suffixes, in form sysroot;multilib.
3110	if $(GCC_FOR_TARGET) -print-sysroot-headers-suffix > /dev/null 2>&1; then \
3111	  set -e; for ml in `$(GCC_FOR_TARGET) -print-multi-lib`; do \
3112	    multi_dir=`echo $${ml} | sed -e 's/;.*$$//'`; \
3113	    flags=`echo $${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
3114	    sfx=`$(GCC_FOR_TARGET) $${flags} -print-sysroot-headers-suffix`; \
3115	    if [ "$${multi_dir}" = "." ]; \
3116	      then multi_dir=""; \
3117	    else \
3118	      multi_dir=/$${multi_dir}; \
3119	    fi; \
3120	    echo "$${sfx};$${multi_dir}"; \
3121	  done; \
3122	else \
3123	  echo ";"; \
3124	fi > tmp-fixinc_list
3125	$(SHELL) $(srcdir)/../move-if-change tmp-fixinc_list fixinc_list
3126	$(STAMP) s-fixinc_list
3127
3128# The line below is supposed to avoid accidentally matching the
3129# built-in suffix rule `.o:' to build fixincl out of fixincl.o.  You'd
3130# expect fixincl to be newer than fixincl.o, such that this situation
3131# would never come up.  As it turns out, if you use ccache with
3132# CCACHE_HARDLINK enabled, the compiler doesn't embed the current
3133# working directory in object files (-g absent, or -fno-working-dir
3134# present), and build and host are the same, fixincl for the host will
3135# build after fixincl for the build machine, getting a cache hit,
3136# thereby updating the timestamp of fixincl.o in the host tree.
3137# Because of CCACHE_HARDLINK, this will also update the timestamp in
3138# the build tree, and so fixincl in the build tree will appear to be
3139# out of date.  Yuck.
3140../$(build_subdir)/fixincludes/fixincl: ; @ :
3141
3142# Build fixed copies of system files.
3143# Abort if no system headers available, unless building a crosscompiler.
3144# FIXME: abort unless building --without-headers would be more accurate and less ugly
3145stmp-fixinc: gsyslimits.h macro_list fixinc_list \
3146  $(build_objdir)/fixincludes/fixincl \
3147  $(build_objdir)/fixincludes/fixinc.sh
3148	rm -rf include-fixed; mkdir include-fixed
3149	-chmod a+rx include-fixed
3150	if [ -d ../prev-gcc ]; then \
3151	  cd ../prev-gcc && \
3152	  $(MAKE) real-$(INSTALL_HEADERS_DIR) DESTDIR=`pwd`/../gcc/ \
3153	    libsubdir=. ; \
3154	else \
3155	  set -e; for ml in `cat fixinc_list`; do \
3156	    sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \
3157	    multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
3158	    fix_dir=include-fixed$${multi_dir}; \
3159	    if ! $(inhibit_libc) && test ! -d ${BUILD_SYSTEM_HEADER_DIR}; then \
3160	      echo The directory that should contain system headers does not exist: >&2 ; \
3161	      echo "  ${BUILD_SYSTEM_HEADER_DIR}" >&2 ; \
3162	      tooldir_sysinc=`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`; \
3163	      if test "x${BUILD_SYSTEM_HEADER_DIR}" = "x$${tooldir_sysinc}"; \
3164	      then sleep 1; else exit 1; fi; \
3165	    fi; \
3166	    $(mkinstalldirs) $${fix_dir}; \
3167	    chmod a+rx $${fix_dir} || true; \
3168	    (TARGET_MACHINE='$(target)'; srcdir=`cd $(srcdir); ${PWD_COMMAND}`; \
3169	      SHELL='$(SHELL)'; MACRO_LIST=`${PWD_COMMAND}`/macro_list ; \
3170	      gcc_dir=`${PWD_COMMAND}` ; \
3171	      export TARGET_MACHINE srcdir SHELL MACRO_LIST && \
3172	      cd $(build_objdir)/fixincludes && \
3173	      $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \
3174	        $(BUILD_SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \
3175	    rm -f $${fix_dir}/syslimits.h; \
3176	    if [ -f $${fix_dir}/limits.h ]; then \
3177	      mv $${fix_dir}/limits.h $${fix_dir}/syslimits.h; \
3178	    else \
3179	      cp $(srcdir)/gsyslimits.h $${fix_dir}/syslimits.h; \
3180	    fi; \
3181	    chmod a+r $${fix_dir}/syslimits.h; \
3182	  done; \
3183	fi
3184	$(STAMP) stmp-fixinc
3185#
3186
3187# Install with the gcc headers files, not the fixed include files, which we
3188# are typically not allowed to distribute.  The general idea is to:
3189#  - Get to "install" with a bare set of internal headers, not the
3190#    fixed system ones,
3191#  - Prevent rebuilds of what normally depends on the headers, which is
3192#    useless for installation purposes and would rely on improper headers.
3193#  - Restore as much of the original state as possible.
3194
3195.PHONY: install-no-fixedincludes
3196
3197install-no-fixedincludes:
3198	# Stash the current set of headers away, save stamps we're going to
3199	# alter explicitly, and arrange for fixincludes not to run next time
3200	# we trigger a headers rebuild.
3201	-rm -rf tmp-include
3202	-mv include tmp-include 2>/dev/null
3203	-mv include-fixed tmp-include-fixed 2>/dev/null
3204	-mv stmp-int-hdrs tmp-stmp-int-hdrs 2>/dev/null
3205	-mv stmp-fixinc tmp-stmp-fixinc 2>/dev/null
3206	-mkdir include
3207	-cp -p $(srcdir)/gsyslimits.h include/syslimits.h
3208	-touch stmp-fixinc
3209
3210	# Rebuild our internal headers, restore the original stamps so that
3211	# "install" doesn't trigger pointless rebuilds because of that update,
3212	# then do install
3213	$(MAKE) $(FLAGS_TO_PASS) stmp-int-hdrs
3214	-mv tmp-stmp-int-hdrs stmp-int-hdrs 2>/dev/null
3215	-mv tmp-stmp-fixinc stmp-fixinc 2>/dev/null
3216	$(MAKE) $(FLAGS_TO_PASS) install
3217
3218	# Restore the original set of maybe-fixed headers
3219	-rm -rf include; mv tmp-include include 2>/dev/null
3220	-rm -rf include-fixed; mv tmp-include-fixed include-fixed 2>/dev/null
3221
3222# Remake the info files.
3223
3224doc: $(BUILD_INFO) $(GENERATED_MANPAGES)
3225
3226INFOFILES = doc/cpp.info doc/gcc.info doc/gccint.info \
3227            doc/gccinstall.info doc/cppinternals.info
3228
3229info: $(INFOFILES) lang.info @GENINSRC@ srcinfo lang.srcinfo
3230
3231srcinfo: $(INFOFILES)
3232	-cp -p $^ $(srcdir)/doc
3233
3234TEXI_CPP_FILES = cpp.texi fdl.texi cppenv.texi cppopts.texi		\
3235	 gcc-common.texi gcc-vers.texi
3236
3237TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi frontends.texi	\
3238	 standards.texi invoke.texi extend.texi md.texi objc.texi	\
3239	 gcov.texi trouble.texi bugreport.texi service.texi		\
3240	 contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi	\
3241	 fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi	\
3242	 implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi \
3243	 lto-dump.texi
3244
3245# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
3246# the generated tm.texi; the latter might have a more recent timestamp,
3247# but we don't want to rebuild the info files unless the contents of
3248# the *.texi files have changed.
3249TEXI_GCCINT_FILES = gccint.texi gcc-common.texi gcc-vers.texi		\
3250	 contribute.texi makefile.texi configterms.texi options.texi	\
3251	 portability.texi interface.texi passes.texi rtl.texi md.texi	\
3252	 $(srcdir)/doc/tm.texi hostconfig.texi fragments.texi	\
3253	 configfiles.texi collect2.texi headerdirs.texi funding.texi	\
3254	 gnu.texi gpl_v3.texi fdl.texi contrib.texi languages.texi	\
3255	 sourcebuild.texi gty.texi libgcc.texi cfg.texi tree-ssa.texi	\
3256	 loop.texi generic.texi gimple.texi plugins.texi optinfo.texi   \
3257	 match-and-simplify.texi analyzer.texi ux.texi poly-int.texi
3258
3259TEXI_GCCINSTALL_FILES = install.texi install-old.texi fdl.texi		\
3260	 gcc-common.texi gcc-vers.texi
3261
3262TEXI_CPPINT_FILES = cppinternals.texi gcc-common.texi gcc-vers.texi
3263
3264# gcc-vers.texi is generated from the version files.
3265gcc-vers.texi: $(BASEVER) $(DEVPHASE)
3266	(echo "@set version-GCC $(BASEVER_c)"; \
3267	 if [ "$(DEVPHASE_c)" = "experimental" ]; \
3268	 then echo "@set DEVELOPMENT"; \
3269	 else echo "@clear DEVELOPMENT"; \
3270	 fi) > $@T
3271	$(build_file_translate) echo @set srcdir $(abs_srcdir) >> $@T
3272	if [ -n "$(PKGVERSION)" ]; then \
3273	  echo "@set VERSION_PACKAGE $(PKGVERSION)" >> $@T; \
3274	fi
3275	echo "@set BUGURL $(BUGURL_TEXI)" >> $@T; \
3276	mv -f $@T $@
3277
3278
3279# The *.1, *.7, *.info, *.dvi, and *.pdf files are being generated from implicit
3280# patterns.  To use them, put each of the specific targets with its
3281# specific dependencies but no build commands.
3282
3283doc/cpp.info: $(TEXI_CPP_FILES)
3284doc/gcc.info: $(TEXI_GCC_FILES)
3285doc/gccint.info: $(TEXI_GCCINT_FILES)
3286doc/cppinternals.info: $(TEXI_CPPINT_FILES)
3287
3288doc/%.info: %.texi
3289	if [ x$(BUILD_INFO) = xinfo ]; then \
3290		$(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
3291			-I $(gcc_docdir)/include -o $@ $<; \
3292	fi
3293
3294# Duplicate entry to handle renaming of gccinstall.info
3295doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
3296	if [ x$(BUILD_INFO) = xinfo ]; then \
3297		$(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
3298			-I $(gcc_docdir)/include -o $@ $<; \
3299	fi
3300
3301doc/cpp.dvi: $(TEXI_CPP_FILES)
3302doc/gcc.dvi: $(TEXI_GCC_FILES)
3303doc/gccint.dvi: $(TEXI_GCCINT_FILES)
3304doc/cppinternals.dvi: $(TEXI_CPPINT_FILES)
3305
3306doc/cpp.pdf: $(TEXI_CPP_FILES)
3307doc/gcc.pdf: $(TEXI_GCC_FILES)
3308doc/gccint.pdf: $(TEXI_GCCINT_FILES)
3309doc/cppinternals.pdf: $(TEXI_CPPINT_FILES)
3310
3311$(build_htmldir)/cpp/index.html: $(TEXI_CPP_FILES)
3312$(build_htmldir)/gcc/index.html: $(TEXI_GCC_FILES)
3313$(build_htmldir)/gccint/index.html: $(TEXI_GCCINT_FILES)
3314$(build_htmldir)/cppinternals/index.html: $(TEXI_CPPINT_FILES)
3315
3316dvi:: doc/gcc.dvi doc/gccint.dvi doc/gccinstall.dvi doc/cpp.dvi \
3317      doc/cppinternals.dvi lang.dvi
3318
3319doc/%.dvi: %.texi
3320	$(TEXI2DVI) -I . -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
3321
3322# Duplicate entry to handle renaming of gccinstall.dvi
3323doc/gccinstall.dvi: $(TEXI_GCCINSTALL_FILES)
3324	$(TEXI2DVI) -I . -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
3325
3326PDFFILES = doc/gcc.pdf doc/gccint.pdf doc/gccinstall.pdf doc/cpp.pdf \
3327           doc/cppinternals.pdf
3328
3329pdf:: $(PDFFILES) lang.pdf
3330
3331doc/%.pdf: %.texi
3332	$(TEXI2PDF) -I . -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
3333
3334# Duplicate entry to handle renaming of gccinstall.pdf
3335doc/gccinstall.pdf: $(TEXI_GCCINSTALL_FILES)
3336	$(TEXI2PDF) -I . -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
3337
3338# List the directories or single hmtl files which are installed by
3339# install-html. The lang.html file triggers language fragments to build
3340# html documentation.
3341HTMLS_INSTALL=$(build_htmldir)/cpp $(build_htmldir)/gcc \
3342       $(build_htmldir)/gccinstall $(build_htmldir)/gccint \
3343       $(build_htmldir)/cppinternals
3344
3345# List the html file targets.
3346HTMLS_BUILD=$(build_htmldir)/cpp/index.html $(build_htmldir)/gcc/index.html \
3347       $(build_htmldir)/gccinstall/index.html $(build_htmldir)/gccint/index.html \
3348       $(build_htmldir)/cppinternals/index.html lang.html
3349
3350html:: $(HTMLS_BUILD)
3351
3352$(build_htmldir)/%/index.html: %.texi
3353	$(mkinstalldirs) $(@D)
3354	rm -f $(@D)/*
3355	$(TEXI2HTML) -I $(abs_docdir) -I $(abs_docdir)/include -o $(@D) $<
3356
3357# Duplicate entry to handle renaming of gccinstall
3358$(build_htmldir)/gccinstall/index.html: $(TEXI_GCCINSTALL_FILES)
3359	$(mkinstalldirs) $(@D)
3360	echo rm -f $(@D)/*
3361	SOURCEDIR=$(abs_docdir) \
3362	DESTDIR=$(@D) \
3363	$(SHELL) $(srcdir)/doc/install.texi2html
3364
3365MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 doc/gfdl.7 doc/gpl.7 \
3366           doc/fsf-funding.7 doc/gcov-tool.1 doc/gcov-dump.1 \
3367	   $(if $(filter yes,@enable_lto@),doc/lto-dump.1)
3368
3369generated-manpages: man
3370
3371man: $(MANFILES) lang.man @GENINSRC@ srcman lang.srcman
3372
3373srcman: $(MANFILES)
3374	-cp -p $^ $(srcdir)/doc
3375
3376doc/%.1: %.pod
3377	$(STAMP) $@
3378	-($(POD2MAN) --section=1 $< > $(@).T$$$$ && \
3379		mv -f $(@).T$$$$ $@) || \
3380		(rm -f $(@).T$$$$ && exit 1)
3381
3382doc/%.7: %.pod
3383	$(STAMP) $@
3384	-($(POD2MAN) --section=7 $< > $(@).T$$$$ && \
3385		mv -f $(@).T$$$$ $@) || \
3386		(rm -f $(@).T$$$$ && exit 1)
3387
3388%.pod: %.texi
3389	$(STAMP) $@
3390	-$(TEXI2POD) -DBUGURL="$(BUGURL_TEXI)" $< > $@
3391
3392.INTERMEDIATE: cpp.pod gcc.pod gfdl.pod fsf-funding.pod gpl.pod
3393cpp.pod: cpp.texi cppenv.texi cppopts.texi
3394
3395# These next rules exist because the output name is not the same as
3396# the input name, so our implicit %.pod rule will not work.
3397
3398gcc.pod: invoke.texi cppenv.texi cppopts.texi gcc-vers.texi
3399	$(STAMP) $@
3400	-$(TEXI2POD) $< > $@
3401gfdl.pod: fdl.texi
3402	$(STAMP) $@
3403	-$(TEXI2POD) $< > $@
3404fsf-funding.pod: funding.texi
3405	$(STAMP) $@
3406	-$(TEXI2POD) $< > $@
3407gpl.pod: gpl_v3.texi
3408	$(STAMP) $@
3409	-$(TEXI2POD) $< > $@
3410
3411#
3412# Deletion of files made during compilation.
3413# There are four levels of this:
3414#   `mostlyclean', `clean', `distclean' and `maintainer-clean'.
3415# `mostlyclean' is useful while working on a particular type of machine.
3416# It deletes most, but not all, of the files made by compilation.
3417# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
3418# `clean' deletes everything made by running `make all'.
3419# `distclean' also deletes the files made by config.
3420# `maintainer-clean' also deletes everything that could be regenerated
3421# automatically, except for `configure'.
3422# We remove as much from the language subdirectories as we can
3423# (less duplicated code).
3424
3425mostlyclean: lang.mostlyclean
3426	-rm -f $(MOSTLYCLEANFILES)
3427	-rm -f *$(objext) c-family/*$(objext)
3428	-rm -f *$(coverageexts)
3429# Delete build programs
3430	-rm -f build/*
3431	-rm -f mddeps.mk
3432# Delete other built files.
3433	-rm -f specs.h options.c options.h options-save.c
3434# Delete the stamp and temporary files.
3435	-rm -f s-* tmp-* stamp-* stmp-*
3436	-rm -f */stamp-* */tmp-*
3437# Delete debugging dump files.
3438	-rm -f *.[0-9][0-9].* */*.[0-9][0-9].*
3439# Delete some files made during installation.
3440	-rm -f specs $(SPECS)
3441	-rm -f collect collect2 mips-tfile mips-tdump
3442# Delete unwanted output files from TeX.
3443	-rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
3444	-rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg
3445# Delete sorted indices we don't actually use.
3446	-rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
3447# Delete core dumps.
3448	-rm -f core */core
3449# Delete file generated for gengtype
3450	-rm -f gtyp-input.list
3451# Delete files generated by gengtype
3452	-rm -f gtype-*
3453	-rm -f gt-*
3454	-rm -f gtype.state
3455# Delete genchecksum outputs
3456	-rm -f *-checksum.c
3457# Delete lock-and-run bits
3458	-rm -rf linkfe.lck lock-stamp.*
3459
3460# Delete all files made by compilation
3461# that don't exist in the distribution.
3462clean: mostlyclean lang.clean
3463	-rm -f libgcc.a libgcc_eh.a libgcov.a
3464	-rm -f libgcc_s*
3465	-rm -f libunwind*
3466	-rm -f config.h tconfig.h bconfig.h tm_p.h tm.h
3467	-rm -f options.c options.h optionlist
3468	-rm -f cs-*
3469	-rm -f doc/*.dvi
3470	-rm -f doc/*.pdf
3471# Delete the include directories.
3472	-rm -rf include include-fixed
3473# Delete files used by the "multilib" facility (including libgcc subdirs).
3474	-rm -f multilib.h tmpmultilib*
3475	-if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \
3476	  rm -rf $(MULTILIB_DIRNAMES); \
3477	else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \
3478	  rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \
3479	fi ; fi
3480
3481# Delete all files that users would normally create
3482# while building and installing GCC.
3483distclean: clean lang.distclean
3484	-rm -f auto-host.h auto-build.h
3485	-rm -f cstamp-h
3486	-rm -f config.status config.run config.cache config.bak
3487	-rm -f Make-lang Make-hooks Make-host Make-target
3488	-rm -f Makefile *.oaux
3489	-rm -f gthr-default.h
3490	-rm -f TAGS */TAGS
3491	-rm -f *.asm
3492	-rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak
3493	-rm -f testsuite/*.log testsuite/*.sum
3494	-cd testsuite && rm -f x *.x *.x? *.exe *.rpo *.o *.s *.S *.c
3495	-cd testsuite && rm -f *.out *.gcov *$(coverageexts)
3496	-rm -rf ${QMTEST_DIR} stamp-qmtest
3497	-rm -f cxxmain.c
3498	-rm -f .gdbinit configargs.h
3499	-rm -f gcov.pod
3500# Delete po/*.gmo only if we are not building in the source directory.
3501	-if [ ! -f po/exgettext ]; then rm -f po/*.gmo; fi
3502	-rmdir ada cp f java objc intl po testsuite plugin 2>/dev/null
3503
3504# Get rid of every file that's generated from some other file, except for `configure'.
3505# Most of these files ARE PRESENT in the GCC distribution.
3506maintainer-clean:
3507	@echo 'This command is intended for maintainers to use; it'
3508	@echo 'deletes files that may need special tools to rebuild.'
3509	$(MAKE) lang.maintainer-clean distclean
3510	-rm -f cpp.??s cpp.*aux
3511	-rm -f gcc.??s gcc.*aux
3512	-rm -f $(gcc_docdir)/*.info $(gcc_docdir)/*.1 $(gcc_docdir)/*.7 $(gcc_docdir)/*.dvi $(gcc_docdir)/*.pdf
3513#
3514# Entry points `install', `install-strip', and `uninstall'.
3515# Also use `install-collect2' to install collect2 when the config files don't.
3516
3517# Copy the compiler files into directories where they will be run.
3518# Install the driver last so that the window when things are
3519# broken is small.
3520install: install-common $(INSTALL_HEADERS) \
3521    install-cpp install-man install-info install-@POSUB@ \
3522    install-driver install-lto-wrapper install-gcc-ar
3523
3524ifeq ($(enable_plugin),yes)
3525install: install-plugin
3526endif
3527
3528install-strip: override INSTALL_PROGRAM = $(INSTALL_STRIP_PROGRAM)
3529ifneq ($(STRIP),)
3530install-strip: STRIPPROG = $(STRIP)
3531export STRIPPROG
3532endif
3533install-strip: install
3534
3535# Handle cpp installation.
3536install-cpp: installdirs cpp$(exeext)
3537	-if test "$(enable_as_accelerator)" != "yes" ; then \
3538	  rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext); \
3539	  $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext); \
3540	  if [ x$(cpp_install_dir) != x ]; then \
3541	    rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
3542	    $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
3543	  else true; fi; \
3544	fi
3545
3546# Create the installation directories.
3547# $(libdir)/gcc/include isn't currently searched by cpp.
3548installdirs:
3549	$(mkinstalldirs) $(DESTDIR)$(libsubdir)
3550	$(mkinstalldirs) $(DESTDIR)$(libexecsubdir)
3551	$(mkinstalldirs) $(DESTDIR)$(bindir)
3552	$(mkinstalldirs) $(DESTDIR)$(includedir)
3553	$(mkinstalldirs) $(DESTDIR)$(infodir)
3554	$(mkinstalldirs) $(DESTDIR)$(man1dir)
3555	$(mkinstalldirs) $(DESTDIR)$(man7dir)
3556
3557PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
3558  toplev.h $(DIAGNOSTIC_CORE_H) $(BASIC_BLOCK_H) $(HASH_TABLE_H) \
3559  tree-ssa-alias.h $(INTERNAL_FN_H) gimple-fold.h tree-eh.h gimple-expr.h \
3560  gimple.h is-a.h memmodel.h $(TREE_PASS_H) $(GCC_PLUGIN_H) \
3561  $(GGC_H) $(TREE_DUMP_H) $(PRETTY_PRINT_H) $(OPTS_H) $(PARAMS_H) \
3562  $(tm_file_list) $(tm_include_list) $(tm_p_file_list) $(tm_p_include_list) \
3563  $(host_xm_file_list) $(host_xm_include_list) $(xm_include_list) \
3564  intl.h $(PLUGIN_VERSION_H) $(DIAGNOSTIC_H) ${C_TREE_H} \
3565  $(C_COMMON_H) c-family/c-objc.h $(C_PRETTY_PRINT_H) \
3566  tree-iterator.h $(PLUGIN_H) $(TREE_SSA_H) langhooks.h incpath.h debug.h \
3567  $(EXCEPT_H) tree-ssa-sccvn.h real.h output.h $(IPA_UTILS_H) \
3568  ipa-param-manipulation.h $(C_PRAGMA_H)  $(CPPLIB_H)  $(FUNCTION_H) \
3569  cppdefault.h flags.h $(MD5_H) params.def params.h params-enum.h \
3570  prefix.h tree-inline.h $(GIMPLE_PRETTY_PRINT_H) realmpfr.h \
3571  $(IPA_PROP_H) $(TARGET_H) $(RTL_H) $(TM_P_H) $(CFGLOOP_H) $(EMIT_RTL_H) \
3572  version.h stringpool.h gimplify.h gimple-iterator.h gimple-ssa.h \
3573  fold-const.h fold-const-call.h tree-cfg.h tree-into-ssa.h tree-ssanames.h \
3574  print-tree.h varasm.h context.h tree-phinodes.h stor-layout.h \
3575  ssa-iterators.h $(RESOURCE_H) tree-cfgcleanup.h attribs.h calls.h \
3576  cfgexpand.h diagnostic-color.h gcc-symtab.h gimple-builder.h gimple-low.h \
3577  gimple-walk.h gimplify-me.h pass_manager.h print-rtl.h stmt.h \
3578  tree-dfa.h tree-hasher.h tree-nested.h tree-object-size.h tree-outof-ssa.h \
3579  tree-parloops.h tree-ssa-address.h tree-ssa-coalesce.h tree-ssa-dom.h \
3580  tree-ssa-loop.h tree-ssa-loop-ivopts.h tree-ssa-loop-manip.h \
3581  tree-ssa-loop-niter.h tree-ssa-ter.h tree-ssa-threadedge.h \
3582  tree-ssa-threadupdate.h inchash.h wide-int.h signop.h hash-map.h \
3583  hash-set.h dominance.h cfg.h cfgrtl.h cfganal.h cfgbuild.h cfgcleanup.h \
3584  lcm.h cfgloopmanip.h file-prefix-map.h builtins.def $(INSN_ATTR_H) \
3585  pass-instances.def params.list $(srcdir)/../include/gomp-constants.h \
3586  $(EXPR_H)
3587
3588# generate the 'build fragment' b-header-vars
3589s-header-vars: Makefile
3590	rm -f tmp-header-vars
3591# The first sed gets the list "header variables" as the list variables
3592# assigned in Makefile and having _H at the end of the name.  "sed -n" proved
3593# more portable than a trailing "-e d" to filter out the uninteresting lines,
3594# in particular on ia64-hpux where "s/.../p" only prints if -n was requested
3595# as well.
3596	$(foreach header_var,$(shell sed < Makefile -n -e 's/^\([A-Z0-9_]*_H\)[ 	]*=.*/\1/p'),echo $(header_var)=$(shell echo $($(header_var):$(srcdir)/%=.../%) | sed -e 's~\.\.\./config/~config/~' -e 's~\.\.\./common/config/~common/config/~' -e 's~\.\.\.[^ 	]*/~~g') >> tmp-header-vars;)
3597	$(SHELL) $(srcdir)/../move-if-change tmp-header-vars b-header-vars
3598	$(STAMP) s-header-vars
3599
3600# Install gengtype
3601install-gengtype: installdirs gengtype$(exeext) gtype.state
3602	$(mkinstalldirs) $(DESTDIR)$(plugin_resourcesdir)
3603	$(INSTALL_DATA) gtype.state $(DESTDIR)$(plugin_resourcesdir)/gtype.state
3604	$(mkinstalldirs) $(DESTDIR)$(plugin_bindir)
3605	$(INSTALL_PROGRAM) gengtype$(exeext) $(DESTDIR)$(plugin_bindir)/gengtype$(exeext)
3606
3607# Install the headers needed to build a plugin.
3608install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
3609# We keep the directory structure for files in config, common/config or
3610# c-family and .def files. All other files are flattened to a single directory.
3611	$(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
3612	headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
3613	srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
3614	for file in $$headers; do \
3615	  if [ -f $$file ] ; then \
3616	    path=$$file; \
3617	  elif [ -f $(srcdir)/$$file ]; then \
3618	    path=$(srcdir)/$$file; \
3619	  else continue; \
3620	  fi; \
3621	  case $$path in \
3622	  "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \
3623	  | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \
3624	    base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \
3625	  *) base=`basename $$path` ;; \
3626	  esac; \
3627	  dest=$(plugin_includedir)/$$base; \
3628	  echo $(INSTALL_DATA) $$path $(DESTDIR)$$dest; \
3629	  dir=`dirname $$dest`; \
3630	  $(mkinstalldirs) $(DESTDIR)$$dir; \
3631	  $(INSTALL_DATA) $$path $(DESTDIR)$$dest; \
3632	done
3633	$(INSTALL_DATA) b-header-vars $(DESTDIR)$(plugin_includedir)/b-header-vars
3634
3635# Install the compiler executables built during cross compilation.
3636install-common: native lang.install-common installdirs
3637	for file in $(COMPILERS); do \
3638	  if [ -f $$file ] ; then \
3639	    rm -f $(DESTDIR)$(libexecsubdir)/$$file; \
3640	    $(INSTALL_PROGRAM) $$file $(DESTDIR)$(libexecsubdir)/$$file; \
3641	  else true; \
3642	  fi; \
3643	done
3644	for file in $(EXTRA_PROGRAMS) $(COLLECT2) ..; do \
3645	  if [ x"$$file" != x.. ]; then \
3646	    rm -f $(DESTDIR)$(libexecsubdir)/$$file; \
3647	    $(INSTALL_PROGRAM) $$file $(DESTDIR)$(libexecsubdir)/$$file; \
3648	  else true; fi; \
3649	done
3650# We no longer install the specs file because its presence makes the
3651# driver slower, and because people who need it can recreate it by
3652# using -dumpspecs.  We remove any old version because it would
3653# otherwise override the specs built into the driver.
3654	rm -f $(DESTDIR)$(libsubdir)/specs
3655# Install gcov if it was compiled.
3656	-if test "$(enable_as_accelerator)" != "yes" ; then \
3657	  if [ -f gcov$(exeext) ]; \
3658	  then \
3659	    rm -f $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \
3660	    $(INSTALL_PROGRAM) gcov$(exeext) $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \
3661	  fi; \
3662	fi
3663# Install gcov-tool if it was compiled.
3664	-if test "$(enable_as_accelerator)" != "yes" ; then \
3665	  if [ -f gcov-tool$(exeext) ]; \
3666	  then \
3667	    rm -f $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
3668	    $(INSTALL_PROGRAM) \
3669	    gcov-tool$(exeext) $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
3670	  fi; \
3671	fi
3672# Install gcov-dump if it was compiled.
3673	-if test "$(enable_as_accelerator)" != "yes" ; then \
3674	  if [ -f gcov-dump$(exeext) ]; \
3675	  then \
3676	    rm -f $(DESTDIR)$(bindir)/$(GCOV_DUMP_INSTALL_NAME)$(exeext); \
3677	    $(INSTALL_PROGRAM) \
3678	    gcov-dump$(exeext) $(DESTDIR)$(bindir)/$(GCOV_DUMP_INSTALL_NAME)$(exeext); \
3679	  fi; \
3680	fi
3681
3682# Install the driver program as $(target_noncanonical)-gcc,
3683# $(target_noncanonical)-gcc-$(version), and also as gcc if native.
3684install-driver: installdirs xgcc$(exeext)
3685	-rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
3686	-$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
3687	-if test "$(enable_as_accelerator)" != "yes" ; then \
3688	  if [ "$(GCC_INSTALL_NAME)" != "$(target_noncanonical)-gcc-$(version)" ]; then \
3689	    rm -f $(DESTDIR)$(bindir)/$(FULL_DRIVER_NAME); \
3690	    ( cd $(DESTDIR)$(bindir) && \
3691	      $(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \
3692	  fi; \
3693	  if [ ! -f gcc-cross$(exeext) ] \
3694	      && [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; then \
3695	    rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \
3696	    ( cd $(DESTDIR)$(bindir) && \
3697	      $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \
3698	      mv -f $(target_noncanonical)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \
3699	  fi; \
3700	fi
3701
3702# Install the info files.
3703# $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
3704# to do the install.
3705install-info:: doc installdirs \
3706	$(DESTDIR)$(infodir)/cpp.info \
3707	$(DESTDIR)$(infodir)/gcc.info \
3708	$(DESTDIR)$(infodir)/cppinternals.info \
3709	$(DESTDIR)$(infodir)/gccinstall.info \
3710	$(DESTDIR)$(infodir)/gccint.info \
3711	lang.install-info
3712
3713$(DESTDIR)$(infodir)/%.info: doc/%.info installdirs
3714	rm -f $@
3715	if [ -f $< ]; then \
3716	  for f in $(<)*; do \
3717	    realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
3718	    $(INSTALL_DATA) $$f $(DESTDIR)$(infodir)/$$realfile; \
3719	    chmod a-x $(DESTDIR)$(infodir)/$$realfile; \
3720	  done; \
3721	else true; fi
3722	-if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
3723	  if [ -f $@ ]; then \
3724	    install-info --dir-file=$(DESTDIR)$(infodir)/dir $@; \
3725	  else true; fi; \
3726	else true; fi;
3727
3728pdf__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
3729
3730install-pdf: $(PDFFILES) lang.install-pdf
3731	@$(NORMAL_INSTALL)
3732	test -z "$(pdfdir)/gcc" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
3733	@list='$(PDFFILES)'; for p in $$list; do \
3734	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
3735	  f=$(pdf__strip_dir) \
3736	  echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
3737	  $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
3738	done
3739
3740html__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
3741
3742install-html: $(HTMLS_BUILD) lang.install-html
3743	@$(NORMAL_INSTALL)
3744	test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)"
3745	@list='$(HTMLS_INSTALL)'; for p in $$list; do \
3746	  if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
3747	  f=$(html__strip_dir) \
3748	  if test -d "$$d$$p"; then \
3749	    echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \
3750	    $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
3751	    echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
3752	    $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
3753	  else \
3754	    echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
3755	    $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
3756	  fi; \
3757	done
3758
3759# Install the man pages.
3760install-man: lang.install-man \
3761	$(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext) \
3762	$(DESTDIR)$(man1dir)/$(CPP_INSTALL_NAME)$(man1ext) \
3763	$(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext) \
3764	$(DESTDIR)$(man1dir)/$(GCOV_TOOL_INSTALL_NAME)$(man1ext) \
3765	$(DESTDIR)$(man1dir)/$(GCOV_DUMP_INSTALL_NAME)$(man1ext) \
3766	$(if $(filter yes,@enable_lto@),$(DESTDIR)$(man1dir)/$(LTO_DUMP_INSTALL_NAME)$(man1ext)) \
3767	$(DESTDIR)$(man7dir)/fsf-funding$(man7ext) \
3768	$(DESTDIR)$(man7dir)/gfdl$(man7ext) \
3769	$(DESTDIR)$(man7dir)/gpl$(man7ext)
3770
3771$(DESTDIR)$(man7dir)/%$(man7ext): doc/%.7 installdirs
3772	-rm -f $@
3773	-$(INSTALL_DATA) $< $@
3774	-chmod a-x $@
3775
3776$(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext): doc/gcc.1 installdirs
3777	-rm -f $@
3778	-$(INSTALL_DATA) $< $@
3779	-chmod a-x $@
3780
3781$(DESTDIR)$(man1dir)/$(CPP_INSTALL_NAME)$(man1ext): doc/cpp.1 installdirs
3782	-rm -f $@
3783	-$(INSTALL_DATA) $< $@
3784	-chmod a-x $@
3785
3786$(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext): doc/gcov.1 installdirs
3787	-rm -f $@
3788	-$(INSTALL_DATA) $< $@
3789	-chmod a-x $@
3790
3791$(DESTDIR)$(man1dir)/$(GCOV_TOOL_INSTALL_NAME)$(man1ext): doc/gcov-tool.1 installdirs
3792	-rm -f $@
3793	-$(INSTALL_DATA) $< $@
3794	-chmod a-x $@
3795
3796$(DESTDIR)$(man1dir)/$(GCOV_DUMP_INSTALL_NAME)$(man1ext): doc/gcov-dump.1 installdirs
3797	-rm -f $@
3798	-$(INSTALL_DATA) $< $@
3799	-chmod a-x $@
3800
3801$(DESTDIR)$(man1dir)/$(LTO_DUMP_INSTALL_NAME)$(man1ext): doc/lto-dump.1 installdirs
3802	-rm -f $@
3803	-$(INSTALL_DATA) $< $@
3804	-chmod a-x $@
3805
3806# Install all the header files built in the include subdirectory.
3807install-headers: $(INSTALL_HEADERS_DIR)
3808# Fix symlinks to absolute paths in the installed include directory to
3809# point to the installed directory, not the build directory.
3810# Don't need to use LN_S here since we really do need ln -s and no substitutes.
3811	-files=`cd $(DESTDIR)$(libsubdir)/include-fixed; find . -type l -print 2>/dev/null`; \
3812	if [ $$? -eq 0 ]; then \
3813	  dir=`cd include-fixed; ${PWD_COMMAND}`; \
3814	  for i in $$files; do \
3815	    dest=`ls -ld $(DESTDIR)$(libsubdir)/include-fixed/$$i | sed -n 's/.*-> //p'`; \
3816	    if expr "$$dest" : "$$dir.*" > /dev/null; then \
3817	      rm -f $(DESTDIR)$(libsubdir)/include-fixed/$$i; \
3818	      ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(DESTDIR)$(libsubdir)/include-fixed/$$i; \
3819	    fi; \
3820	  done; \
3821	fi
3822
3823# Create or recreate the gcc private include file directory.
3824install-include-dir: installdirs
3825	$(mkinstalldirs) $(DESTDIR)$(libsubdir)/include
3826	-rm -rf $(DESTDIR)$(libsubdir)/include-fixed
3827	mkdir $(DESTDIR)$(libsubdir)/include-fixed
3828	-chmod a+rx $(DESTDIR)$(libsubdir)/include-fixed
3829
3830# Create or recreate the install-tools include file directory.
3831itoolsdir = $(libexecsubdir)/install-tools
3832itoolsdatadir = $(libsubdir)/install-tools
3833install-itoolsdirs: installdirs
3834	$(mkinstalldirs) $(DESTDIR)$(itoolsdatadir)/include
3835	$(mkinstalldirs) $(DESTDIR)$(itoolsdir)
3836
3837# Install the include directory using tar.
3838install-headers-tar: stmp-int-hdrs install-include-dir
3839# We use `pwd`/include instead of just include to problems with CDPATH
3840# Unless a full pathname is provided, some shells would print the new CWD,
3841# found in CDPATH, corrupting the output.  We could just redirect the
3842# output of `cd', but some shells lose on redirection within `()'s
3843	(cd `${PWD_COMMAND}`/include ; \
3844	 tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include; tar xpf - )
3845	(cd `${PWD_COMMAND}`/include-fixed ; \
3846	 tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include-fixed; tar xpf - )
3847# /bin/sh on some systems returns the status of the first tar,
3848# and that can lose with GNU tar which always writes a full block.
3849# So use `exit 0' to ignore its exit status.
3850
3851# Install the include directory using cpio.
3852install-headers-cpio: stmp-int-hdrs install-include-dir
3853# See discussion about the use of `pwd` above
3854	cd `${PWD_COMMAND}`/include ; \
3855	find . -print | cpio -pdum $(DESTDIR)$(libsubdir)/include
3856	cd `${PWD_COMMAND}`/include-fixed ; \
3857	find . -print | cpio -pdum $(DESTDIR)$(libsubdir)/include-fixed
3858
3859# Install the include directory using cp.
3860install-headers-cp: stmp-int-hdrs install-include-dir
3861	cp -p -r include $(DESTDIR)$(libsubdir)
3862	cp -p -r include-fixed $(DESTDIR)$(libsubdir)
3863
3864# Targets without dependencies, for use in prev-gcc during bootstrap.
3865real-install-headers-tar:
3866	(cd `${PWD_COMMAND}`/include-fixed ; \
3867	 tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include-fixed; tar xpf - )
3868
3869real-install-headers-cpio:
3870	cd `${PWD_COMMAND}`/include-fixed ; \
3871	find . -print | cpio -pdum $(DESTDIR)$(libsubdir)/include-fixed
3872
3873real-install-headers-cp:
3874	cp -p -r include-fixed $(DESTDIR)$(libsubdir)
3875
3876# Install supporting files for fixincludes to be run later.
3877install-mkheaders: stmp-int-hdrs install-itoolsdirs \
3878  macro_list fixinc_list
3879	$(INSTALL_DATA) $(srcdir)/gsyslimits.h \
3880	  $(DESTDIR)$(itoolsdatadir)/gsyslimits.h
3881	$(INSTALL_DATA) macro_list $(DESTDIR)$(itoolsdatadir)/macro_list
3882	$(INSTALL_DATA) fixinc_list $(DESTDIR)$(itoolsdatadir)/fixinc_list
3883	set -e; for ml in `cat fixinc_list`; do \
3884	  multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
3885	  $(mkinstalldirs) $(DESTDIR)$(itoolsdatadir)/include$${multi_dir}; \
3886	  $(INSTALL_DATA) include-fixed$${multi_dir}/limits.h $(DESTDIR)$(itoolsdatadir)/include$${multi_dir}/limits.h; \
3887	done
3888	$(INSTALL_SCRIPT) $(srcdir)/../mkinstalldirs \
3889		$(DESTDIR)$(itoolsdir)/mkinstalldirs ; \
3890	sysroot_headers_suffix='$${sysroot_headers_suffix}'; \
3891		echo 'SYSTEM_HEADER_DIR="'"$(SYSTEM_HEADER_DIR)"'"' \
3892		> $(DESTDIR)$(itoolsdatadir)/mkheaders.conf
3893	echo 'OTHER_FIXINCLUDES_DIRS="$(OTHER_FIXINCLUDES_DIRS)"' \
3894		>> $(DESTDIR)$(itoolsdatadir)/mkheaders.conf
3895	echo 'STMP_FIXINC="$(STMP_FIXINC)"' \
3896		>> $(DESTDIR)$(itoolsdatadir)/mkheaders.conf
3897
3898# Use this target to install the program `collect2' under the name `collect2'.
3899install-collect2: collect2 installdirs
3900	$(INSTALL_PROGRAM) collect2$(exeext) $(DESTDIR)$(libexecsubdir)/collect2$(exeext)
3901# Install the driver program as $(libsubdir)/gcc for collect2.
3902	$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(libexecsubdir)/gcc$(exeext)
3903
3904# Install lto-wrapper.
3905install-lto-wrapper: lto-wrapper$(exeext)
3906	$(INSTALL_PROGRAM) lto-wrapper$(exeext) $(DESTDIR)$(libexecsubdir)/lto-wrapper$(exeext)
3907
3908install-gcc-ar: installdirs gcc-ar$(exeext) gcc-nm$(exeext) gcc-ranlib$(exeext)
3909	if test "$(enable_as_accelerator)" != "yes" ; then \
3910	  for i in gcc-ar gcc-nm gcc-ranlib; do \
3911	    install_name=`echo $$i|sed '$(program_transform_name)'` ;\
3912	    target_install_name=$(target_noncanonical)-`echo $$i|sed '$(program_transform_name)'` ; \
3913	    rm -f $(DESTDIR)$(bindir)/$$install_name$(exeext) ; \
3914	    $(INSTALL_PROGRAM) $$i$(exeext) $(DESTDIR)$(bindir)/$$install_name$(exeext) ;\
3915	    if test -f gcc-cross$(exeext); then \
3916	      :; \
3917	    else \
3918	      rm -f $(DESTDIR)$(bindir)/$$target_install_name$(exeext); \
3919	      ( cd $(DESTDIR)$(bindir) && \
3920		$(LN) $$install_name$(exeext) $$target_install_name$(exeext) ) ; \
3921	    fi ; \
3922	  done; \
3923	fi
3924
3925# Cancel installation by deleting the installed files.
3926uninstall: lang.uninstall
3927	-rm -rf $(DESTDIR)$(libsubdir)
3928	-rm -rf $(DESTDIR)$(libexecsubdir)
3929	-rm -rf $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
3930	-rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
3931	-if [ x$(cpp_install_dir) != x ]; then \
3932	  rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
3933	else true; fi
3934	-rm -rf $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext)
3935	-rm -rf $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext)
3936	-rm -rf $(DESTDIR)$(man1dir)/cpp$(man1ext)
3937	-rm -f $(DESTDIR)$(infodir)/cpp.info* $(DESTDIR)$(infodir)/gcc.info*
3938	-rm -f $(DESTDIR)$(infodir)/cppinternals.info* $(DESTDIR)$(infodir)/gccint.info*
3939	for i in ar nm ranlib ; do \
3940	  install_name=`echo gcc-$$i|sed '$(program_transform_name)'`$(exeext) ;\
3941	  target_install_name=$(target_noncanonical)-`echo gcc-$$i|sed '$(program_transform_name)'`$(exeext) ; \
3942	  rm -f $(DESTDIR)$(bindir)/$$install_name ; \
3943	  rm -f $(DESTDIR)$(bindir)/$$target_install_name ; \
3944	done
3945#
3946# These targets are for the dejagnu testsuites. The file site.exp
3947# contains global variables that all the testsuites will use.
3948
3949target_subdir = @target_subdir@
3950
3951site.exp: ./config.status Makefile
3952	@echo "Making a new config file..."
3953	-@rm -f ./site.tmp
3954	@$(STAMP) site.exp
3955	-@mv site.exp site.bak
3956	@echo "## these variables are automatically generated by make ##" > ./site.tmp
3957	@echo "# Do not edit here. If you wish to override these values" >> ./site.tmp
3958	@echo "# add them to the last section" >> ./site.tmp
3959	@echo "set rootme \"`${PWD_COMMAND}`\"" >> ./site.tmp
3960	@echo "set srcdir \"`cd ${srcdir}; ${PWD_COMMAND}`\"" >> ./site.tmp
3961	@echo "set host_triplet $(host)" >> ./site.tmp
3962	@echo "set build_triplet $(build)" >> ./site.tmp
3963	@echo "set target_triplet $(target)" >> ./site.tmp
3964	@echo "set target_alias $(target_noncanonical)" >> ./site.tmp
3965	@echo "set libiconv \"$(LIBICONV)\"" >> ./site.tmp
3966# CFLAGS is set even though it's empty to show we reserve the right to set it.
3967	@echo "set CFLAGS \"\"" >> ./site.tmp
3968	@echo "set CXXFLAGS \"\"" >> ./site.tmp
3969	@echo "set HOSTCC \"$(CC)\"" >> ./site.tmp
3970	@echo "set HOSTCXX \"$(CXX)\"" >> ./site.tmp
3971	@echo "set HOSTCFLAGS \"$(CFLAGS)\"" >> ./site.tmp
3972	@echo "set HOSTCXXFLAGS \"$(CXXFLAGS)\"" >> ./site.tmp
3973# TEST_ALWAYS_FLAGS are flags that should be passed to every compilation.
3974# They are passed first to allow individual tests to override them.
3975	@echo "set TEST_ALWAYS_FLAGS \"$(SYSROOT_CFLAGS_FOR_TARGET)\"" >> ./site.tmp
3976# When running the tests we set GCC_EXEC_PREFIX to the install tree so that
3977# files that have already been installed there will be found.  The -B option
3978# overrides it, so use of GCC_EXEC_PREFIX will not result in using GCC files
3979# from the install tree.
3980	@echo "set TEST_GCC_EXEC_PREFIX \"$(libdir)/gcc/\"" >> ./site.tmp
3981	@echo "set TESTING_IN_BUILD_TREE 1" >> ./site.tmp
3982	@echo "set HAVE_LIBSTDCXX_V3 1" >> ./site.tmp
3983	@if test "@enable_plugin@" = "yes" ; then \
3984	  echo "set ENABLE_PLUGIN 1" >> ./site.tmp; \
3985	  echo "set PLUGINCC \"$(PLUGINCC)\"" >> ./site.tmp; \
3986	  echo "set PLUGINCFLAGS \"$(PLUGINCFLAGS)\"" >> ./site.tmp; \
3987	  echo "set GMPINC \"$(GMPINC)\"" >> ./site.tmp; \
3988	fi
3989# If newlib has been configured, we need to pass -B to gcc so it can find
3990# newlib's crt0.o if it exists.  This will cause a "path prefix not used"
3991# message if it doesn't, but the testsuite is supposed to ignore the message -
3992# it's too difficult to tell when to and when not to pass -B (not all targets
3993# have crt0's).  We could only add the -B if ../newlib/crt0.o exists, but that
3994# seems like too selective a test.
3995# ??? Another way to solve this might be to rely on linker scripts.  Then
3996# theoretically the -B won't be needed.
3997# We also need to pass -L ../ld so that the linker can find ldscripts.
3998	@if [ -d $(objdir)/../$(target_subdir)/newlib ] \
3999	    && [ "${host}" != "${target}" ]; then \
4000	  echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)/newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./site.tmp; \
4001	  echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)/newlib/\"" >> ./site.tmp; \
4002	  echo "append CFLAGS \" \$$newlib_cflags\"" >> ./site.tmp; \
4003	  echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./site.tmp; \
4004	  echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./site.tmp; \
4005	else true; \
4006	fi
4007	@if [ -d $(objdir)/../ld ] ; then \
4008	  echo "append LDFLAGS \" -L$(objdir)/../ld\"" >> ./site.tmp; \
4009	else true; \
4010	fi
4011	echo "set tmpdir $(objdir)/testsuite" >> ./site.tmp
4012	@echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./site.tmp
4013	@if [ "X$(ALT_CC_UNDER_TEST)" != "X" ] ; then \
4014	  echo "set ALT_CC_UNDER_TEST \"$(ALT_CC_UNDER_TEST)\"" >> ./site.tmp; \
4015	else true; \
4016	fi
4017	@if [ "X$(ALT_CXX_UNDER_TEST)" != "X" ] ; then \
4018	  echo "set ALT_CXX_UNDER_TEST \"$(ALT_CXX_UNDER_TEST)\"" >> ./site.tmp; \
4019	else true; \
4020	fi
4021	@if [ "X$(COMPAT_OPTIONS)" != "X" ] ; then \
4022	  echo "set COMPAT_OPTIONS \"$(COMPAT_OPTIONS)\"" >> ./site.tmp; \
4023	else true; \
4024	fi
4025	@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./site.tmp
4026	@cat ./site.tmp > site.exp
4027	@cat site.bak | sed \
4028		-e '1,/^## All variables above are.*##/ d' >> site.exp
4029	-@rm -f ./site.tmp
4030
4031CHECK_TARGETS = @check_languages@
4032
4033check: $(CHECK_TARGETS)
4034
4035check-subtargets: $(patsubst %,%-subtargets,$(CHECK_TARGETS))
4036
4037# The idea is to parallelize testing of multilibs, for example:
4038#   make -j3 check-gcc//sh-hms-sim/{-m1,-m2,-m3,-m3e,-m4}/{,-nofpu}
4039# will run 3 concurrent sessions of check-gcc, eventually testing
4040# all 10 combinations.  GNU make is required, as is a shell that expands
4041# alternations within braces.
4042lang_checks_parallel = $(lang_checks:=//%)
4043$(lang_checks_parallel): site.exp
4044	target=`echo "$@" | sed 's,//.*,,'`; \
4045	variant=`echo "$@" | sed 's,^[^/]*//,,'`; \
4046	vardots=`echo "$$variant" | sed 's,/,.,g'`; \
4047	$(MAKE) TESTSUITEDIR="testsuite.$$vardots" \
4048	  RUNTESTFLAGS="--target_board=$$variant $(RUNTESTFLAGS)" \
4049	  "$$target"
4050
4051TESTSUITEDIR = testsuite
4052
4053$(TESTSUITEDIR)/site.exp: site.exp
4054	-test -d $(TESTSUITEDIR) || mkdir $(TESTSUITEDIR)
4055	-rm -f $@
4056	sed '/set tmpdir/ s|testsuite$$|$(TESTSUITEDIR)|' < site.exp > $@
4057
4058# This is only used for check-% targets that aren't parallelized.
4059$(filter-out $(lang_checks_parallelized),$(lang_checks)): check-% : site.exp
4060	-test -d plugin || mkdir plugin
4061	-test -d $(TESTSUITEDIR) || mkdir $(TESTSUITEDIR)
4062	test -d $(TESTSUITEDIR)/$* || mkdir $(TESTSUITEDIR)/$*
4063	-(rootme=`${PWD_COMMAND}`; export rootme; \
4064	srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ; \
4065	cd $(TESTSUITEDIR)/$*; \
4066	rm -f tmp-site.exp; \
4067	sed '/set tmpdir/ s|testsuite$$|$(TESTSUITEDIR)/$*|' \
4068		< ../../site.exp > tmp-site.exp; \
4069	$(SHELL) $${srcdir}/../move-if-change tmp-site.exp site.exp; \
4070	EXPECT=${EXPECT} ; export EXPECT ; \
4071	if [ -f $${rootme}/../expect/expect ] ; then  \
4072	   TCL_LIBRARY=`cd .. ; cd $${srcdir}/../tcl/library ; ${PWD_COMMAND}` ; \
4073	    export TCL_LIBRARY ; fi ; \
4074	$(RUNTEST) --tool $* $(RUNTESTFLAGS))
4075
4076$(patsubst %,%-subtargets,$(lang_checks)): check-%-subtargets:
4077	@echo check-$*
4078
4079check_p_tool=$(firstword $(subst _, ,$*))
4080check_p_count=$(check_$(check_p_tool)_parallelize)
4081check_p_subno=$(word 2,$(subst _, ,$*))
4082check_p_numbers0:=1 2 3 4 5 6 7 8 9
4083check_p_numbers1:=0 $(check_p_numbers0)
4084check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
4085check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
4086check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
4087check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
4088check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
4089check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
4090check_p_subdir=$(subst _,,$*)
4091check_p_subdirs=$(wordlist 1,$(check_p_count),$(wordlist 1, \
4092		$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),128), \
4093		$(check_p_numbers)))
4094
4095# For parallelized check-% targets, this decides whether parallelization
4096# is desirable (if -jN is used).  If desirable, recursive make is run with
4097# check-parallel-$lang{,1,2,3,4,5} etc. goals, which can be executed in
4098# parallel, as they are run in separate directories.
4099# check-parallel-$lang{,1,2,3,4,5} etc. goals invoke runtest with
4100# GCC_RUNTEST_PARALLELIZE_DIR var in the environment and runtest_file_p
4101# dejaGNU procedure is overridden to additionally synchronize through
4102# a $lang-parallel directory which tests will be run by which runtest instance.
4103# Afterwards contrib/dg-extract-results.sh is used to merge the sum and log
4104# files.  If parallelization isn't desirable, only one recursive make
4105# is run with check-parallel-$lang goal and check_$lang_parallelize variable
4106# cleared to say that no additional arguments beyond $(RUNTESTFLAGS)
4107# should be passed to runtest.
4108#
4109# To parallelize some language check, add the corresponding check-$lang
4110# to lang_checks_parallelized variable and define check_$lang_parallelize
4111# variable.  This is the upper limit to which it is useful to parallelize the
4112# check-$lang target.  It doesn't make sense to try e.g. 128 goals for small
4113# testsuites like objc or go.
4114$(lang_checks_parallelized): check-% : site.exp
4115	-rm -rf $(TESTSUITEDIR)/$*-parallel
4116	@if [ -n "$(filter -j%, $(MFLAGS))" ]; then \
4117	  test -d $(TESTSUITEDIR) || mkdir $(TESTSUITEDIR) || true; \
4118	  test -d $(TESTSUITEDIR)/$*-parallel || mkdir $(TESTSUITEDIR)/$*-parallel || true; \
4119	  GCC_RUNTEST_PARALLELIZE_DIR=`${PWD_COMMAND}`/$(TESTSUITEDIR)/$(check_p_tool)-parallel ; \
4120	  export GCC_RUNTEST_PARALLELIZE_DIR ; \
4121	  $(MAKE) TESTSUITEDIR="$(TESTSUITEDIR)" RUNTESTFLAGS="$(RUNTESTFLAGS)" \
4122	    check-parallel-$* \
4123	    $(patsubst %,check-parallel-$*_%, $(check_p_subdirs)); \
4124	  sums= ; logs= ; \
4125	  for dir in $(TESTSUITEDIR)/$* \
4126		     $(patsubst %,$(TESTSUITEDIR)/$*%,$(check_p_subdirs));\
4127	  do \
4128	    if [ -d $$dir ]; then \
4129	      mv -f $$dir/$*.sum $$dir/$*.sum.sep; mv -f $$dir/$*.log $$dir/$*.log.sep; \
4130	      sums="$$sums $$dir/$*.sum.sep"; logs="$$logs $$dir/$*.log.sep"; \
4131	    fi; \
4132	  done; \
4133	  $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh $$sums \
4134	    > $(TESTSUITEDIR)/$*/$*.sum; \
4135	  $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh -L $$logs \
4136	    > $(TESTSUITEDIR)/$*/$*.log; \
4137	  rm -rf $(TESTSUITEDIR)/$*-parallel || true; \
4138	else \
4139	  $(MAKE) TESTSUITEDIR="$(TESTSUITEDIR)" RUNTESTFLAGS="$(RUNTESTFLAGS)" \
4140	    check_$*_parallelize= check-parallel-$*; \
4141	fi
4142
4143check-parallel-% : site.exp
4144	-@test -d plugin || mkdir plugin
4145	-@test -d $(TESTSUITEDIR) || mkdir $(TESTSUITEDIR)
4146	@test -d $(TESTSUITEDIR)/$(check_p_subdir) || mkdir $(TESTSUITEDIR)/$(check_p_subdir)
4147	-$(if $(check_p_subno),@)(rootme=`${PWD_COMMAND}`; export rootme; \
4148	srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ; \
4149	if [ -n "$(check_p_subno)" ] \
4150	   && [ -n "$$GCC_RUNTEST_PARALLELIZE_DIR" ] \
4151	   && [ -f $(TESTSUITEDIR)/$(check_p_tool)-parallel/finished ]; then \
4152	  rm -rf $(TESTSUITEDIR)/$(check_p_subdir); \
4153	else \
4154	  cd $(TESTSUITEDIR)/$(check_p_subdir); \
4155	  rm -f tmp-site.exp; \
4156	  sed '/set tmpdir/ s|testsuite$$|$(TESTSUITEDIR)/$(check_p_subdir)|' \
4157		< ../../site.exp > tmp-site.exp; \
4158	  $(SHELL) $${srcdir}/../move-if-change tmp-site.exp site.exp; \
4159	  EXPECT=${EXPECT} ; export EXPECT ; \
4160	  if [ -f $${rootme}/../expect/expect ] ; then  \
4161	    TCL_LIBRARY=`cd .. ; cd $${srcdir}/../tcl/library ; ${PWD_COMMAND}` ; \
4162	    export TCL_LIBRARY ; \
4163	  fi ; \
4164	  $(RUNTEST) --tool $(check_p_tool) $(RUNTESTFLAGS); \
4165	  if [ -n "$$GCC_RUNTEST_PARALLELIZE_DIR" ] ; then \
4166	    touch $${rootme}/$(TESTSUITEDIR)/$(check_p_tool)-parallel/finished; \
4167	  fi ; \
4168	fi )
4169
4170# QMTest targets
4171
4172# The path to qmtest.
4173QMTEST_PATH=qmtest
4174
4175# The flags to pass to qmtest.
4176QMTESTFLAGS=
4177
4178# The flags to pass to "qmtest run".
4179QMTESTRUNFLAGS=-f none --result-stream dejagnu_stream.DejaGNUStream
4180
4181# The command to use to invoke qmtest.
4182QMTEST=${QMTEST_PATH} ${QMTESTFLAGS}
4183
4184# The tests (or suites) to run.
4185QMTEST_GPP_TESTS=g++
4186
4187# The subdirectory of the OBJDIR that will be used to store the QMTest
4188# test database configuration and that will be used for temporary
4189# scratch space during QMTest's execution.
4190QMTEST_DIR=qmtestsuite
4191
4192# Create the QMTest database configuration.
4193${QMTEST_DIR} stamp-qmtest:
4194	${QMTEST} -D ${QMTEST_DIR} create-tdb \
4195	    -c gcc_database.GCCDatabase \
4196	    -a srcdir=`cd ${srcdir}/testsuite && ${PWD_COMMAND}` && \
4197	    $(STAMP) stamp-qmtest
4198
4199# Create the QMTest context file.
4200${QMTEST_DIR}/context: stamp-qmtest
4201	rm -f $@
4202	echo "CompilerTable.languages=c cplusplus" >> $@
4203	echo "CompilerTable.c_kind=GCC" >> $@
4204	echo "CompilerTable.c_path=${objdir}/xgcc" >> $@
4205	echo "CompilerTable.c_options=-B${objdir}/" >> $@
4206	echo "CompilerTable.cplusplus_kind=GCC" >> $@
4207	echo "CompilerTable.cplusplus_path=${objdir}/xg++" >> $@
4208	echo "CompilerTable.cplusplus_options=-B${objdir}/" >> $@
4209	echo "DejaGNUTest.target=${target_noncanonical}" >> $@
4210
4211# Run the G++ testsuite using QMTest.
4212qmtest-g++: ${QMTEST_DIR}/context
4213	cd ${QMTEST_DIR} && ${QMTEST} run ${QMTESTRUNFLAGS} -C context \
4214	   -o g++.qmr ${QMTEST_GPP_TESTS}
4215
4216# Use the QMTest GUI.
4217qmtest-gui: ${QMTEST_DIR}/context
4218	cd ${QMTEST_DIR} && ${QMTEST} gui -C context
4219
4220.PHONY: qmtest-g++
4221
4222# Run Paranoia on real.c.
4223
4224paranoia.o: $(srcdir)/../contrib/paranoia.cc $(CONFIG_H) $(SYSTEM_H) $(TREE_H)
4225	g++ -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION)
4226
4227paranoia: paranoia.o real.o $(LIBIBERTY)
4228	g++ -o $@ paranoia.o real.o $(LIBIBERTY)
4229
4230# These exist for maintenance purposes.
4231
4232# Update the tags table.
4233TAGS: lang.tags
4234	(cd $(srcdir);					\
4235	incs= ;						\
4236	list='$(SUBDIRS)'; for dir in $$list; do	\
4237	  if test -f $$dir/TAGS; then			\
4238	    incs="$$incs --include $$dir/TAGS.sub";	\
4239	  fi;						\
4240	done;						\
4241	etags -o TAGS.sub c-family/*.h c-family/*.c c-family/*.cc \
4242	      *.h *.c *.cc \
4243	      ../include/*.h ../libiberty/*.c \
4244	      ../libcpp/*.c ../libcpp/include/*.h \
4245	      --language=none --regex="/\(char\|unsigned int\|int\|bool\|void\|HOST_WIDE_INT\|enum [A-Za-z_0-9]+\) [*]?\([A-Za-z_0-9]+\)/\2/" common.opt	\
4246	      --language=none --regex="/\(DEF_RTL_EXPR\|DEFTREECODE\|DEFGSCODE\|DEFTIMEVAR\|DEFPARAM\|DEFPARAMENUM5\)[ ]?(\([A-Za-z_0-9]+\)/\2/" rtl.def tree.def gimple.def timevar.def params.def \
4247		; \
4248	etags --include TAGS.sub $$incs)
4249
4250# -----------------------------------------------------
4251# Rules for generating translated message descriptions.
4252# Disabled by autoconf if the tools are not available.
4253# -----------------------------------------------------
4254
4255XGETTEXT = @XGETTEXT@
4256GMSGFMT = @GMSGFMT@
4257MSGMERGE = msgmerge
4258CATALOGS = $(patsubst %,po/%,@CATALOGS@)
4259
4260.PHONY: build- install- build-po install-po update-po
4261
4262# Dummy rules to deal with dependencies produced by use of
4263# "build-@POSUB@" and "install-@POSUB@" above, when NLS is disabled.
4264build-: ; @true
4265install-: ; @true
4266
4267build-po: $(CATALOGS)
4268
4269# This notation should be acceptable to all Make implementations used
4270# by people who are interested in updating .po files.
4271update-po: $(CATALOGS:.gmo=.pox)
4272
4273# N.B. We do not attempt to copy these into $(srcdir).  The snapshot
4274# script does that.
4275.po.gmo:
4276	$(mkinstalldirs) po
4277	$(GMSGFMT) --statistics -o $@ $<
4278
4279# The new .po has to be gone over by hand, so we deposit it into
4280# build/po with a different extension.
4281# If build/po/gcc.pot exists, use it (it was just created),
4282# else use the one in srcdir.
4283.po.pox:
4284	$(mkinstalldirs) po
4285	$(MSGMERGE) $< `if test -f po/gcc.pot; \
4286			then echo po/gcc.pot; \
4287			else echo $(srcdir)/po/gcc.pot; fi` -o $@
4288
4289# This rule has to look for .gmo modules in both srcdir and
4290# the cwd, and has to check that we actually have a catalog
4291# for each language, in case they weren't built or included
4292# with the distribution.
4293install-po:
4294	$(mkinstalldirs) $(DESTDIR)$(datadir)
4295	cats="$(CATALOGS)"; for cat in $$cats; do \
4296	  lang=`basename $$cat | sed 's/\.gmo$$//'`; \
4297	  if [ -f $$cat ]; then :; \
4298	  elif [ -f $(srcdir)/$$cat ]; then cat=$(srcdir)/$$cat; \
4299	  else continue; \
4300	  fi; \
4301	  dir=$(localedir)/$$lang/LC_MESSAGES; \
4302	  echo $(mkinstalldirs) $(DESTDIR)$$dir; \
4303	  $(mkinstalldirs) $(DESTDIR)$$dir || exit 1; \
4304	  echo $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/gcc.mo; \
4305	  $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/gcc.mo; \
4306	done
4307
4308# Rule for regenerating the message template (gcc.pot).
4309# Instead of forcing everyone to edit POTFILES.in, which proved impractical,
4310# this rule has no dependencies and always regenerates gcc.pot.  This is
4311# relatively harmless since the .po files do not directly depend on it.
4312# Note that exgettext has an awk script embedded in it which requires a
4313# fairly modern (POSIX-compliant) awk.
4314# The .pot file is left in the build directory.
4315gcc.pot: po/gcc.pot
4316po/gcc.pot: force
4317	$(mkinstalldirs) po
4318	$(MAKE) srcextra
4319	AWK=$(AWK) $(SHELL) $(srcdir)/po/exgettext \
4320		$(XGETTEXT) gcc $(srcdir)
4321
4322#
4323
4324# Dependency information.
4325
4326# In order for parallel make to really start compiling the expensive
4327# objects from $(OBJS) as early as possible, build all their
4328# prerequisites strictly before all objects.
4329$(ALL_HOST_OBJS) : | $(generated_files)
4330
4331# Include the auto-generated dependencies for all host objects.
4332DEPFILES = \
4333  $(foreach obj,$(ALL_HOST_OBJS),\
4334    $(dir $(obj))$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $(obj))))
4335-include $(DEPFILES)
4336