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