]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/Makefile.in
Define SUBTARGET_CPU_DEFAULT before including arm/coff.h
[thirdparty/gcc.git] / gcc / Makefile.in
CommitLineData
79d8453e 1# Makefile for GNU C compiler.
44ba0e93 2# Copyright (C) 1987, 88, 90-98, 1999 Free Software Foundation, Inc.
79d8453e
RS
3
4#This file is part of GNU CC.
5
6#GNU CC is free software; you can redistribute it and/or modify
7#it under the terms of the GNU General Public License as published by
8#the Free Software Foundation; either version 2, or (at your option)
9#any later version.
10
11#GNU CC is distributed in the hope that it will be useful,
12#but WITHOUT ANY WARRANTY; without even the implied warranty of
13#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14#GNU General Public License for more details.
15
16#You should have received a copy of the GNU General Public License
17#along with GNU CC; see the file COPYING. If not, write to
940d9d63
RK
18#the Free Software Foundation, 59 Temple Place - Suite 330,
19#Boston MA 02111-1307, USA.
79d8453e
RS
20
21# The targets for external use include:
22# all, doc, proto, install, install-cross, install-cross-rest,
f1908d70 23# uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean,
79d8453e
RS
24# stage1, stage2, stage3, stage4.
25
2e494f70
RS
26# Suppress smart makes who think they know how to automake Yacc files
27.y.c:
28
3c18ea24
RK
29# Directory where sources are, from where we are.
30srcdir = @srcdir@
31VPATH = @srcdir@
32
79d8453e
RS
33# Variables that exist for you to override.
34# See below for how to change them for certain systems.
35
013a2ee0
DE
36# List of language subdirectories.
37# This is overridden by configure.
3c18ea24 38SUBDIRS =@subdirs@
013a2ee0 39
79d8453e 40# Selection of languages to be made.
013a2ee0 41# This is overridden by configure.
71205e0b
MH
42CONFIG_LANGUAGES = @all_languages@
43LANGUAGES = c proto gcov$(exeext) $(CONFIG_LANGUAGES)
79d8453e 44
a6374b58
AO
45# Languages should create dependencies of $(INTL_TARGETS) on generated
46# sources in Make-lang.in. Example:
47# $(INTL_TARGETS): $(srcdir)/cp/parse.c
48INTL_TARGETS = intl.all intl.install intl.distdir
49
5e31e473
RK
50# Selection of languages to be made during stage1 build.
51# This is overridden by configure.
3c18ea24 52BOOT_LANGUAGES = c @all_boot_languages@
5e31e473 53
79d8453e 54ALLOCA =
8d86aaea 55ALLOCA_FLAGS =
2a7bccbb 56ALLOCA_FINISH = true
79d8453e
RS
57
58# Various ways of specifying flags for compilations:
59# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
60# BOOT_CFLAGS is the value of CFLAGS to pass
61# to the stage2 and stage3 compilations
61842080
MM
62# WARN_CFLAGS are the warning flags to pass to stage2 and stage3.
63# (And for stage 1 if the native compiler is GCC.) It is
cc1e5b9a
KG
64# separate from BOOT_CFLAGS because people tend to override optimization
65# flags and we'd like them to still have warnings turned on. They are free
66# to explicitly turn warnings off if they wish.
79d8453e 67# XCFLAGS is used for most compilations but not when using the GCC just built.
54577c52 68# TCFLAGS is used for compilations with the GCC just built.
79d8453e 69XCFLAGS =
54577c52 70TCFLAGS =
61842080 71CFLAGS = -g @stage1_warn_cflags@
e6493727 72BOOT_CFLAGS = -O2 $(CFLAGS)
cc1e5b9a 73WARN_CFLAGS = -W -Wall
79d8453e
RS
74# These exists to be overridden by the x-* and t-* files, respectively.
75X_CFLAGS =
76T_CFLAGS =
77
78X_CPPFLAGS =
79T_CPPFLAGS =
80
ab87f8c8 81AWK = @AWK@
b614ee64 82CC = @CC@
b0ccd8de
JL
83# srcdir might be a relative pathname which won't be valid in a subdirectory,
84# so we must use objdir/srcdir instead to make it safe. objdir is always
85# a full pathname.
86BISON = `if [ -f $(objdir)/../bison/bison ] ; then case $(srcdir) in \
87 /*) echo $(objdir)/../bison/bison -L $(srcdir)/../bison/ ;; \
88 *) echo $(objdir)/../bison/bison -L $(objdir)/$(srcdir)/../bison/ ;; \
0a682bea 89 esac; else echo bison ; fi`
0777e4c6 90BISONFLAGS =
b0ccd8de 91LEX = `if [ -f $(objdir)/../flex/flex ] ; then echo $(objdir)/../flex/flex ; else echo flex ; fi`
013a2ee0 92LEXFLAGS =
79d8453e 93AR = ar
79d8453e 94AR_FLAGS = rc
e9a25f70 95LN = @symbolic_link@
b63b5db5 96DLLTOOL = dlltool
79d8453e
RS
97SHELL = /bin/sh
98# on sysV, define this as cp.
3c18ea24 99INSTALL = @INSTALL@
ac64120e
JW
100# Some systems may be missing symbolic links, regular links, or both.
101# Allow configure to check this and use "ln -s", "ln", or "cp" as appropriate.
102LN=@LN@
103LN_S=@LN_S@
79d8453e 104# These permit overriding just for certain files.
fca9d4b0
MH
105INSTALL_PROGRAM = @INSTALL_PROGRAM@
106INSTALL_DATA = @INSTALL_DATA@
010deb4d
RL
107MAKEINFO = `if [ -f $(objdir)/../texinfo/makeinfo/Makefile ] ; \
108 then echo $(objdir)/../texinfo/makeinfo/makeinfo ; \
109 else echo makeinfo ; fi`
3ef4c269 110MAKEINFOFLAGS =
d8984b6e 111TEXI2DVI = texi2dvi
013a2ee0
DE
112# For GNUmake: let us decide what gets passed to recursive makes.
113MAKEOVERRIDES =
3c18ea24 114@SET_MAKE@
79d8453e
RS
115
116# Define this as & to perform parallel make on a Sequent.
117# Note that this has some bugs, and it seems currently necessary
118# to compile all the gen* files first by hand to avoid erroneous results.
119P =
120
121# How to invoke ranlib.
122RANLIB = ranlib
123# Test to use to see whether ranlib exists on the system.
8f25d5cd
JW
124RANLIB_TEST = \
125 [ -f $(RANLIB) ] \
b6c8f0b7 126 || [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
f6c2a93c 127
79d8453e
RS
128# Compiler to use for compiling libgcc1.a.
129# OLDCC should not be the GNU C compiler,
130# since that would compile typical libgcc1.a functions such as mulsi3
131# into infinite recursions.
132OLDCC = cc
133
134# CFLAGS for use with OLDCC, for compiling libgcc1.a.
135# NOTE: -O does not work on some Unix systems!
136CCLIBFLAGS = -O
137
2e494f70 138# Version of ar to use when compiling libgcc1.a.
79d8453e 139OLDAR = ar
b614ee64 140OLDAR_FLAGS = qc
79d8453e 141
ba1811f1
ILT
142# Target to use when installing include directory. Either
143# install-headers-tar or install-headers-cpio.
3c18ea24 144INSTALL_HEADERS_DIR = @build_install_headers_dir@
ba1811f1 145
d7371761
RK
146# Header files that are made available under the same name
147# to programs compiled with GCC.
148USER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/stddef.h \
149 $(srcdir)/ginclude/varargs.h $(srcdir)/ginclude/va-alpha.h \
150 $(srcdir)/ginclude/va-h8300.h $(srcdir)/ginclude/va-i860.h \
151 $(srcdir)/ginclude/va-i960.h $(srcdir)/ginclude/va-mips.h \
12ca7cc3
RK
152 $(srcdir)/ginclude/va-m88k.h $(srcdir)/ginclude/va-mn10200.h \
153 $(srcdir)/ginclude/va-mn10300.h $(srcdir)/ginclude/va-pa.h \
d7371761
RK
154 $(srcdir)/ginclude/va-pyr.h $(srcdir)/ginclude/va-sparc.h \
155 $(srcdir)/ginclude/va-clipper.h $(srcdir)/ginclude/va-spur.h \
5a01f362 156 $(srcdir)/ginclude/va-m32r.h $(srcdir)/ginclude/va-sh.h \
b4d940a2 157 $(srcdir)/ginclude/va-v850.h $(srcdir)/ginclude/va-arc.h \
d7371761 158 $(srcdir)/ginclude/iso646.h $(srcdir)/ginclude/va-ppc.h \
1d118f17 159 $(srcdir)/ginclude/va-c4x.h $(EXTRA_HEADERS) $(LANG_EXTRA_HEADERS) \
e2b629d7 160 $(srcdir)/ginclude/proto.h $(srcdir)/ginclude/stdbool.h
d7371761
RK
161
162# Target to use whe installing assert.h. Some systems may
163# want to set this empty.
164INSTALL_ASSERT_H = install-assert-h
165
a2d163c4 166# The GCC to use for compiling libgcc2.a, enquire, and libgcc1-test.
bf428f48 167# Usually the one we just built.
79d8453e 168# Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS).
6f144c9c 169GCC_FOR_TARGET = ./xgcc -B./ -B$(build_tooldir)/bin/
79d8453e
RS
170
171# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
172# It omits XCFLAGS, and specifies -B./.
de9253a0 173# It also specifies -I./include to find, e.g., stddef.h.
54577c52 174GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -I./include $(TCFLAGS)
79d8453e 175
338023d4 176# Sed command to transform gcc to installed name. Overwritten by configure.
e6347456 177program_transform_name = @program_transform_name@
ef85603e 178program_transform_cross_name = s,^,$(target_alias)-,
338023d4 179
88111b26
JL
180build_canonical = @build_canonical@
181host_canonical = @host_canonical@
182
79d8453e
RS
183# Tools to use when building a cross-compiler.
184# These are used because `configure' appends `cross-make'
185# to the makefile when making a cross-compiler.
186
7e717196
JL
187# Use the tools from the build tree, if they are available.
188
189# objdir is set by configure.
190objdir = @objdir@
191
192AR_FOR_TARGET = ` \
193 if [ -f $(objdir)/../binutils/ar ] ; then \
194 echo $(objdir)/../binutils/ar ; \
195 else \
196 if [ "$(host_canonical)" = "$(target)" ] ; then \
197 echo ar; \
198 else \
199 t='$(program_transform_name)'; echo ar | sed -e $$t ; \
200 fi; \
201 fi`
8f25d5cd 202AR_FLAGS_FOR_TARGET = rc
7e717196
JL
203RANLIB_FOR_TARGET = ` \
204 if [ -f $(objdir)/../binutils/ranlib ] ; then \
205 echo $(objdir)/../binutils/ranlib ; \
206 else \
207 if [ "$(host_canonical)" = "$(target)" ] ; then \
208 echo ranlib; \
209 else \
210 t='$(program_transform_name)'; echo ranlib | sed -e $$t ; \
211 fi; \
212 fi`
213RANLIB_TEST_FOR_TARGET = \
214 [ -f $(RANLIB_FOR_TARGET) ] \
215 || ( [ "$(host_canonical)" = "$(target)" ] \
216 && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )
217
1402d22c
RS
218# Dir to search for system headers. Overridden by cross-make.
219SYSTEM_HEADER_DIR = /usr/include
220
75b6984c
RS
221# Control whether to run fixproto.
222STMP_FIXPROTO = stmp-fixproto
ac1284f9 223
40dc28fc
ILT
224# Test to see whether <limits.h> exists in the system header files.
225LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
226
20bd0ab1
RS
227# There may be a premade insn-attrtab.c for this machine.
228# (You could rebuild it with genattrtab as usual, but it takes a long time.)
229# PREMADE_ATTRTAB is the file name of the file to use.
230# PREMADE_ATTRTAB_MD is the md file it corresponds to.
231PREMADE_ATTRTAB_MD = Makefile # Guaranteed not to cmp equal to md.
232PREMADE_ATTRTAB =
233
3c18ea24 234target=@target@
6920c391 235target_alias=@target_alias@
3c18ea24
RK
236xmake_file=@dep_host_xmake_file@
237tmake_file=@dep_tmake_file@
238out_file=$(srcdir)/config/@out_file@
239out_object_file=@out_object_file@
240md_file=$(srcdir)/config/@md_file@
241tm_file=@tm_file_list@
242build_xm_file=@build_xm_file_list@
243host_xm_file=@host_xm_file_list@
244lang_specs_files=@lang_specs_files@
245lang_options_files=@lang_options_files@
3103b7db 246lang_tree_files=@lang_tree_files@
f25270fc 247GCC_THREAD_FILE=@thread_file@
d8bb17c8 248OBJC_BOEHM_GC=@objc_boehm_gc@
df37e3db 249JAVAGC=@JAVAGC@
f24af81b 250GTHREAD_FLAGS=@gthread_flags@
f1943b77
MH
251# Be prepared for gcc2 merges.
252gcc_version=@gcc_version@
253gcc_version_trigger=@gcc_version_trigger@
254version=$(gcc_version)
1cf94605 255mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
79d8453e 256
79d8453e
RS
257# Common prefix for installation directories.
258# NOTE: This directory must exist when you start installation.
3c18ea24 259prefix = @prefix@
c844ddda
RS
260# Directory in which to put localized header files. On the systems with
261# gcc as the native cc, `local_prefix' may not be `prefix' which is
262# `/usr'.
0b2fbcb2 263# NOTE: local_prefix *should not* default from prefix.
3c18ea24 264local_prefix = @local_prefix@
2e494f70 265# Directory in which to put host dependent programs and libraries
3c18ea24 266exec_prefix = @exec_prefix@
79d8453e 267# Directory in which to put the executable for the command `gcc'
3c18ea24 268bindir = @bindir@
79d8453e 269# Directory in which to put the directories used by the compiler.
3c18ea24 270libdir = @libdir@
79d8453e 271# Directory in which the compiler finds executables, libraries, etc.
8b06b20a 272libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(version)
91c7bd9b 273# Used to produce a relative $(gcc_tooldir) in gcc.o
1f72bfca 274unlibsubdir = ../../..
d062c304 275# Directory in which to find other cross-compilation tools and headers.
4c112cda 276dollar = @dollar@
d062c304
JL
277# Used in install-cross.
278gcc_tooldir = @gcc_tooldir@
279# Since tooldir does not exist at build-time, use -B$(build_tooldir)/bin/
280build_tooldir = $(exec_prefix)/$(target_alias)
89b3e3b4 281# Directory in which the compiler finds g++ includes.
8f8d3278 282gcc_gxx_include_dir= @gcc_gxx_include_dir@
49ba557e 283# Directory to search for site-specific includes.
4b7179be 284includedir = $(local_prefix)/include
6204c24f 285# assertdir is overridden in cross-make.
7b4d5f42 286# (But this currently agrees with what is in cross-make.)
91c7bd9b 287assertdir = $(gcc_tooldir)/include
0b2fbcb2 288# where the info files go
3c18ea24 289infodir = @infodir@
587a4ba6
L
290# Where cpp should go besides $prefix/bin if necessary
291cpp_install_dir = @cpp_install_dir@
ab87f8c8
JL
292# where the locale files go
293datadir = $(prefix)/@DATADIRNAME@
294localedir = $(datadir)/locale
79d8453e
RS
295# Extension (if any) to put in installed man-page filename.
296manext = .1
173712fb 297objext = .o
6e26218f
ILT
298exeext = @host_exeext@
299build_exeext = @build_exeext@
173712fb 300
79d8453e 301# Directory in which to put man pages.
a76b6b40
MH
302mandir = @mandir@
303man1dir = $(mandir)/man1
62c13b81
RS
304# Dir for temp files.
305tmpdir = /tmp
79d8453e 306
ab87f8c8
JL
307# Top build directory, relative to here.
308top_builddir = .
309
310# Whether we were configured with NLS.
311USE_NLS = @USE_NLS@
312
313# Internationalization library.
314INTLLIBS = @INTLLIBS@
315
316# List of internationalization subdirectories.
317POSUB = @POSUB@
318INTL_SUBDIRS = intl $(POSUB)
319
79d8453e
RS
320# Additional system libraries to link with.
321CLIB=
322
323# Change this to a null string if obstacks are installed in the
324# system library.
325OBSTACK=obstack.o
326
76b4b31e
KG
327# Configure will set these if you need vfprintf and possibly _doprnt support.
328VFPRINTF=@vfprintf@
329DOPRINT=@doprint@
330
b583eed8
DE
331# Specify the rule for actually making libgcc.a,
332LIBGCC = libgcc.a
333# and the rule for installing it.
334INSTALL_LIBGCC = install-libgcc
335
79d8453e 336# Specify the rule for actually making libgcc1.a.
2e494f70
RS
337# The value may be empty; that means to do absolutely nothing
338# with or for libgcc1.a.
79d8453e
RS
339LIBGCC1 = libgcc1.a
340
b0bfa186
ILT
341# Specify the rule for making libgcc1.a for a cross-compiler.
342# The default rule assumes that libgcc1.a is supplied by the user.
343CROSS_LIBGCC1 = libgcc1.cross
344
79d8453e
RS
345# Specify the rule for actually making libgcc2.a.
346LIBGCC2 = libgcc2.a
347
348# Options to use when compiling libgcc2.a.
349# -g1 causes output of debug info only for file-scope entities.
350# we use this here because that should be enough, and also
351# so that -g1 will be tested.
7337c67f 352#
11f39cf4 353LIBGCC2_DEBUG_CFLAGS = -g1
624a8b3a 354LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED @inhibit_libc@
56f9206d
ILT
355
356# Additional options to use when compiling libgcc2.a.
357# Some targets override this to -Iinclude
358LIBGCC2_INCLUDES =
359
7bb7f3df
RK
360# Additional target-dependent options for compiling libgcc2.a.
361TARGET_LIBGCC2_CFLAGS =
362
56f9206d
ILT
363# Things which must be built before building libgcc2.a.
364# Some targets override this to stmp-int-hdrs
365LIBGCC2_DEPS =
79d8453e 366
a2d163c4
DE
367# libgcc1-test target (must also be overridable for a target)
368LIBGCC1_TEST = libgcc1-test
0defb1d5 369
79d8453e
RS
370# List of extra executables that should be compiled for this target machine
371# that are used for compiling from source code to object code.
372# The rules for compiling them should be in the t-* file for the machine.
3c18ea24 373EXTRA_PASSES =@extra_passes@
79d8453e 374
2e494f70 375# Like EXTRA_PASSES, but these are used when linking.
3c18ea24 376EXTRA_PROGRAMS = @extra_programs@
2e494f70
RS
377
378# List of extra object files that should be compiled for this target machine.
79d8453e 379# The rules for compiling them should be in the t-* file for the machine.
3c18ea24 380EXTRA_PARTS = @extra_parts@
79d8453e 381
2e494f70
RS
382# List of extra object files that should be compiled and linked with
383# compiler proper (cc1, cc1obj, cc1plus).
3c18ea24 384EXTRA_OBJS = @extra_objs@
2e494f70 385
43554690
RK
386# List of extra object files that should be compiled and linked with
387# the gcc driver.
3c18ea24 388EXTRA_GCC_OBJS =@host_extra_gcc_objs@
43554690 389
f780d21b
RS
390# List of additional header files to install.
391# Often this is edited directly by `configure'.
3c18ea24 392EXTRA_HEADERS =@extra_headers_list@
f780d21b 393
10da1131 394# Set this to `collect2' to enable use of collect2.
3c18ea24 395USE_COLLECT2 = @will_use_collect2@
f46fe00a 396MAYBE_USE_COLLECT2 = @maybe_use_collect2@
47547081
RS
397# It is convenient for configure to add the assignment at the beginning,
398# so don't override it here.
10da1131 399USE_COLLECT2 = collect2$(exeext)
47547081 400
79d8453e
RS
401# List of extra C and assembler files to add to libgcc1.a.
402# Assembler files should have names ending in `.asm'.
403LIB1FUNCS_EXTRA =
404
405# List of extra C and assembler files to add to libgcc2.a.
406# Assembler files should have names ending in `.asm'.
407LIB2FUNCS_EXTRA =
408
587a4ba6
L
409# Handle cpp installation.
410INSTALL_CPP=
411UNINSTALL_CPP=
412
e7f62ad3
MH
413# We do not try to build float.h anymore. Let configure select the
414# appropriate pre-built float.h file for the target.
027ea2a7 415FLOAT_H=@float_h_file@
e7f62ad3 416
79d8453e
RS
417# Program to convert libraries.
418LIBCONVERT =
419
420# Control whether header files are installed.
79d8453e
RS
421INSTALL_HEADERS=install-headers
422
0d4d8174
RS
423# Options for tar when copying trees. So HPUX can override it.
424TAROUTOPTS = xpBf
425
66d7ffbf 426# Additional directories of header files to run fixincludes on.
4ab08223
RS
427# These should be directories searched automatically by default
428# just as /usr/include is.
429# *Do not* use this for directories that happen to contain
430# header files, but are not searched automatically by default.
66d7ffbf
RS
431# On most systems, this is empty.
432OTHER_FIXINCLUDES_DIRS=
433
7c27f801
RK
434# A list of all the language-specific executables.
435# This is overridden by configure.
3379e8ef 436COMPILERS = cc1$(exeext) @all_compilers@
7c27f801 437
acbbf3d9 438# List of things which should already be built whenever we try to use xgcc
79d8453e 439# to compile anything (without linking).
e09e14e9 440GCC_PASSES=xgcc$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES)
79d8453e 441
acbbf3d9 442# List of things which should already be built whenever we try to use xgcc
79d8453e 443# to link anything.
b583eed8 444GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
79d8453e 445
79d8453e
RS
446# Directory to link to, when using the target `maketest'.
447DIR = ../gcc
448
c3efc7c4 449# Guaranteed to not exist when not passing md through cpp.
aa90345a 450# This value is overridden directly by configure.
c3efc7c4
DE
451MD_FILE = md-cpp-not-used
452
79d8453e
RS
453# Flags to use when cross-building GCC.
454# Prefix to apply to names of object files when using them
455# to run on the machine we are compiling on.
456HOST_PREFIX=
457# Prefix to apply to names of object files when compiling them
458# to run on the machine we are compiling on.
459# The default for this variable is chosen to keep these rules
460# out of the way of the other rules for compiling the same source files.
461HOST_PREFIX_1=loser-
462HOST_CC=$(CC)
463HOST_CFLAGS=$(ALL_CFLAGS)
2e494f70 464HOST_CLIB=$(CLIB)
ab87f8c8 465HOST_INTLLIBS=$(INTLLIBS)
79d8453e
RS
466HOST_LDFLAGS=$(LDFLAGS)
467HOST_CPPFLAGS=$(ALL_CPPFLAGS)
2e494f70
RS
468HOST_ALLOCA=$(ALLOCA)
469HOST_MALLOC=$(MALLOC)
470HOST_OBSTACK=$(OBSTACK)
76b4b31e
KG
471HOST_VFPRINTF=$(VFPRINTF)
472HOST_DOPRINT=$(DOPRINT)
79d8453e 473
338023d4 474# Actual name to use when installing a native compiler.
ef85603e 475GCC_INSTALL_NAME = `t='$(program_transform_name)'; echo gcc | sed -e $$t`
225695a4
JW
476PROTOIZE_INSTALL_NAME = `t='$(program_transform_name)'; echo protoize | sed -e $$t`
477UNPROTOIZE_INSTALL_NAME = `t='$(program_transform_name)'; echo unprotoize | sed -e $$t`
23473647 478GCOV_INSTALL_NAME = `t='$(program_transform_name)'; echo gcov | sed -e $$t`
338023d4
DE
479
480# Actual name to use when installing a cross-compiler.
ef85603e 481GCC_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcc | sed -e $$t`
225695a4
JW
482PROTOIZE_CROSS_NAME = `t='$(program_transform_cross_name)'; echo protoize | sed -e $$t`
483UNPROTOIZE_CROSS_NAME = `t='$(program_transform_cross_name)'; echo unprotoize | sed -e $$t`
338023d4 484
79d8453e
RS
485# Choose the real default target.
486ALL=all.internal
487
488# Choose the real install target.
ba1811f1
ILT
489INSTALL_TARGET=install-normal
490
e933cbe0
JL
491# Setup the testing framework, if you have one
492EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \
493 echo $${rootme}/../expect/expect ; \
494 else echo expect ; fi`
495
496RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
497 echo $${srcdir}/../dejagnu/runtest ; \
498 else echo runtest; fi`
499RUNTESTFLAGS =
500
aefc3801
JM
501# Extra symbols for fixproto to define when parsing headers.
502FIXPROTO_DEFINES =
503
68d69835
JM
504# Extra flags to use when compiling crt{begin,end}.o.
505CRTSTUFF_T_CFLAGS =
506
522170ca
RK
507# Extra flags to use when compiling [m]crt0.o.
508CRT0STUFF_T_CFLAGS =
509
e9a25f70
JL
510# "t" or nothing, for building multilibbed versions of, say, crtbegin.o.
511T =
512
79d8453e
RS
513# End of variables for you to override.
514
515# Definition of `all' is here so that new rules inserted by sed
516# do not specify the default target.
517# The real definition is under `all.internal' (for native compilers)
518# or `all.cross' (for cross compilers).
2e494f70 519all: all.indirect
79d8453e 520
be0d23ff
RS
521# This tells GNU Make version 3 not to put all variables in the environment.
522.NOEXPORT:
523
79d8453e 524# sed inserts variable overrides after the following line.
60d00117 525####target overrides
3c18ea24
RK
526@target_overrides@
527
60d00117 528####host overrides
3c18ea24
RK
529@host_overrides@
530
60d00117 531####cross overrides
3c18ea24
RK
532@cross_defines@
533@cross_overrides@
534
057f494b 535####build overrides
3c18ea24 536@build_overrides@
544eb21e 537#\f
79d8453e
RS
538# Now figure out from those variables how to compile and link.
539
2e494f70
RS
540all.indirect: $(ALL)
541
2bdfeefa 542# IN_GCC tells various files that system.h, toplev.c, etc are available.
2df8df36 543INTERNAL_CFLAGS = $(CROSS) -DIN_GCC $(SCHED_CFLAGS) @extra_c_flags@
79d8453e
RS
544
545# This is the variable actually used when we compile.
2df8df36
JW
546# If you change this line, you probably also need to change the definition
547# of HOST_CFLAGS in build-make to match.
d68b51ef 548ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) \
2df8df36 549 @DEFS@
79d8453e
RS
550
551# Likewise.
552ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
553
554# Even if ALLOCA is set, don't use it if compiling with GCC.
3fe40e05
JL
555USE_ALLOCA= ${ALLOCA}
556USE_HOST_ALLOCA= ` case "${HOST_ALLOCA}" in ?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
2e494f70
RS
557USE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac `
558USE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac `
76b4b31e
KG
559USE_HOST_VFPRINTF= ` case "${HOST_VFPRINTF}" in ?*) echo ${HOST_PREFIX}${HOST_VFPRINTF} ;; esac `
560USE_HOST_DOPRINT= ` case "${HOST_DOPRINT}" in ?*) echo ${HOST_PREFIX}${HOST_DOPRINT} ;; esac `
79d8453e
RS
561
562# Dependency on obstack, alloca, malloc or whatever library facilities
563# are not installed in the system libraries.
564# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
ab87f8c8 565LIBDEPS= $(INTLLIBS) $(OBSTACK) $(ALLOCA) $(MALLOC) $(VFPRINTF) $(DOPRINT)
79d8453e
RS
566
567# Likewise, for use in the tools that must run on this machine
568# even if we are cross-building GCC.
569# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
ab87f8c8 570HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_INTLLIBS) $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC) $(HOST_PREFIX)$(HOST_VFPRINTF) $(HOST_PREFIX)$(HOST_DOPRINT)
79d8453e
RS
571
572# How to link with both our special library facilities
573# and the system's installed libraries.
ab87f8c8 574LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(INTLLIBS) @LIBS@ $(VFPRINTF) $(DOPRINT) $(CLIB) ../libiberty/libiberty.a
79d8453e
RS
575
576# Likewise, for use in the tools that must run on this machine
577# even if we are cross-building GCC.
2e494f70 578HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \
ab87f8c8
JL
579 $(HOST_INTLLIBS) $(USE_HOST_VFPRINTF) $(USE_HOST_DOPRINT) \
580 $(HOST_CLIB)
79d8453e 581
0dfa1860 582HOST_RTL = $(HOST_PREFIX)rtl.o $(HOST_PREFIX)bitmap.o
79d8453e 583HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o
d3614a37 584HOST_PRINT = $(HOST_PREFIX)print-rtl.o
79d8453e
RS
585
586# Specify the directories to be searched for header files.
587# Both . and srcdir are used, in that order,
588# so that tm.h and config.h will be found in the compilation
589# subdirectory rather than in the source directory.
8cfa5320 590INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config -I$(srcdir)/../include
79d8453e
RS
591
592# Always use -I$(srcdir)/config when compiling.
593.c.o:
594 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
595
596# This tells GNU make version 3 not to export all the variables
597# defined in this file into the environment.
598.NOEXPORT:
544eb21e 599#\f
013a2ee0
DE
600# Support for additional languages (other than c and objc).
601# ??? objc can be supported this way too (leave for later).
602
603# These next lines are overridden by configure.
3c18ea24
RK
604LANG_MAKEFILES = @all_lang_makefiles@
605LANG_STAGESTUFF = @all_stagestuff@
606LANG_DIFF_EXCLUDES = @all_diff_excludes@
607LANG_LIB2FUNCS = @all_lib2funcs@
608LANG_EXTRA_HEADERS = @all_headers@
013a2ee0
DE
609
610# Flags to pass to recursive makes.
611# CC is set by configure. Hosts without symlinks need special handling
612# because we need CC="stage1/xgcc -Bstage1/" to work in the language
613# subdirectories.
614# ??? The choices here will need some experimenting with.
615FLAGS_TO_PASS = \
8f25d5cd 616 "AR_FLAGS_FOR_TARGET=$(AR_FLAGS_FOR_TARGET)" \
013a2ee0
DE
617 "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
618 "BISON=$(BISON)" \
619 "BISONFLAGS=$(BISONFLAGS)" \
3c18ea24 620 "CC=@cc_set_by_configure@" \
013a2ee0 621 "CFLAGS=$(CFLAGS)" \
89c8019a 622 "CLIB=$(CLIB)" \
dc93cff0 623 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
013a2ee0
DE
624 "LDFLAGS=$(LDFLAGS)" \
625 "LEX=$(LEX)" \
626 "LEXFLAGS=$(LEXFLAGS)" \
ac64120e
JW
627 "LN=$(LN)" \
628 "LN_S=$(LN_S)" \
013a2ee0
DE
629 "MAKEINFO=$(MAKEINFO)" \
630 "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
013a2ee0
DE
631 "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
632 "RANLIB_TEST_FOR_TARGET=$(RANLIB_TEST_FOR_TARGET)" \
633 "SHELL=$(SHELL)" \
3c18ea24 634 "STAGE_PREFIX=@stage_prefix_set_by_configure@" \
aab26e16 635 "exeext=$(exeext)" \
6e26218f 636 "build_exeext=$(build_exeext)" \
aab26e16 637 "objext=$(objext)" \
013a2ee0
DE
638 "exec_prefix=$(exec_prefix)" \
639 "prefix=$(prefix)" \
3bf810d8 640 "local_prefix=$(local_prefix)" \
8f8d3278 641 "gxx_include_dir=$(gcc_gxx_include_dir)" \
013a2ee0 642 "tooldir=$(tooldir)" \
91c7bd9b 643 "gcc_tooldir=$(gcc_tooldir)" \
013a2ee0 644 "bindir=$(bindir)" \
ab87f8c8
JL
645 "libsubdir=$(libsubdir)" \
646 "datadir=$(datadir)" \
647 "distdir=../tmp/\$$(subdir)" \
648 "localedir=$(localedir)"
649
650PREPEND_DOTDOT_TO_RELATIVE_PATHS = sed \
651 -e 's|^ *[^ /][^ /]*/|%&|' \
652 -e 's| -B| -B%|g' \
653 -e 's|% *[^- /]|%&|g' \
654 -e 's|%% *|../|g' \
655 -e 's|%||g'
656SUBDIR_FLAGS_TO_PASS = $(ORDINARY_FLAGS_TO_PASS) \
657 "CC=`echo @cc_set_by_configure@ | $(PREPEND_DOTDOT_TO_RELATIVE_PATHS)`"
544eb21e 658#\f
79d8453e
RS
659# Lists of files for various purposes.
660
3cb88565
PB
661# Language-specific object files for C and Objective C.
662C_AND_OBJC_OBJS = c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o \
663 c-aux-info.o c-common.o c-iterate.o @extra_c_objs@
664
79d8453e 665# Language-specific object files for C.
3cb88565 666C_OBJS = c-parse.o c-lang.o $(C_AND_OBJC_OBJS)
e8066a5d 667
8c660648
JL
668SCHED_PREFIX = @sched_prefix@
669SCHED_CFLAGS = @sched_cflags@
670
79d8453e
RS
671# Language-independent object files.
672OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
3d195391 673 function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o \
ab87f8c8
JL
674 intl.o varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o genrtl.o real.o \
675 dbxout.o sdbout.o dwarfout.o dwarf2out.o xcoffout.o bitmap.o alias.o gcse.o \
6feacd09 676 integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o varray.o \
ab87f8c8 677 regclass.o regmove.o local-alloc.o global.o reload.o reload1.o caller-save.o \
8c660648 678 insn-peep.o reorg.o $(SCHED_PREFIX)sched.o final.o recog.o reg-stack.o \
d2ecda27 679 insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o lcm.o \
56f48ce9 680 profile.o insn-attrtab.o $(out_object_file) getpwd.o $(EXTRA_OBJS) convert.o \
fe9b4957 681 mbchar.o dyn-string.o splay-tree.o graph.o sbitmap.o resource.o hash.o
79d8453e
RS
682
683# GEN files are listed separately, so they can be built before doing parallel
684# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load
685# them before rtl.o is compiled.
3b80f6ca 686GEN= genemit genoutput genrecog genextract genflags gencodes genconfig \
8376d400 687 genpeep gengenrtl gencheck
79d8453e 688
e061d1ce 689CCCP=@cpp_main@
59949f60 690
79d8453e 691# Files to be copied away after each stage in building.
aab26e16 692STAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \
79d8453e 693 insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
ab87f8c8 694 insn-attr.h insn-attrtab.c insn-opinit.c tree-check.h \
9ec36da5
JL
695 s-flags s-config s-codes s-mlib s-under\
696 s-output s-recog s-emit s-extract s-peep s-check \
e5e809f4 697 s-attr s-attrtab s-opinit s-crt s-crtS s-crt0 \
6e26218f
ILT
698 genemit$(build_exeext) genoutput$(build_exeext) genrecog$(build_exeext) \
699 genextract$(build_exeext) genflags$(build_exeext) gencodes$(build_exeext) \
700 genconfig$(build_exeext) genpeep$(build_exeext) genattrtab$(build_exeext) \
206ae7cf 701 genattr$(build_exeext) genopinit$(build_exeext) gengenrtl$(build_exeext) \
8376d400 702 gencheck$(build_exeext) \
21f74c82
RK
703 xgcc$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES) \
704 $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
aab26e16
RK
705 $(CCCP)$(exeext) cc1obj$(exeext) enquire$(exeext) \
706 protoize$(exeext) unprotoize$(exeext) \
7ac16ba0 707 specs collect2$(exeext) $(USE_COLLECT2) underscore.c \
59a64126 708 gcov$(exeext) *.bp \
ed8a0e58 709 *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop \
b85f4db3 710 *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.gcse *.flow2 \
f6c2a93c 711 *.[si] libcpp.a \
013a2ee0 712 $(LANG_STAGESTUFF)
79d8453e
RS
713
714# Members of libgcc1.a.
715LIB1FUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
b6eb802a 716 _lshrsi3 _ashrsi3 _ashlsi3 \
79d8453e
RS
717 _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \
718 _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \
719 _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \
720 _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
721 _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
722
723# Library members defined in libgcc2.c.
724LIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
b6eb802a 725 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 \
3af18470 726 _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
79d8453e 727 _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
3971e415 728 _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
d1b4b7c1 729 _fixtfdi _fixunstfdi _floatditf \
ced78d8b
JM
730 __gcc_bcmp _varargs __dummy _eprintf \
731 _bb _shtab _clear_cache _trampoline __main _exit \
624a8b3a
JL
732 _ctors _pure
733
734LIB2FUNCS_EH = _eh
79d8453e 735
5198352e
JL
736FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
737 _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
738 _lt_sf _le_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
739 _sf_to_df
740
741DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
742 _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
743 _lt_df _le_df _si_to_df _df_to_si _negate_df _make_df \
744 _df_to_sf
745
79d8453e
RS
746# The files that "belong" in CONFIG_H are deliberately omitted
747# because having them there would not be useful in actual practice.
748# All they would do is cause complete recompilation every time
749# one of the machine description files is edited.
750# That may or may not be what one wants to do.
751# If it is, rm *.o is an easy way to do it.
7ac16ba0 752# CONFIG_H = $(host_xm_file) $(tm_file)
79d8453e 753CONFIG_H =
0056a9b5 754RTL_BASE_H = rtl.h rtl.def machmode.h machmode.def
3b80f6ca 755RTL_H = $(RTL_BASE_H) genrtl.h
0056a9b5 756TREE_H = tree.h real.h tree.def machmode.h machmode.def tree-check.h
5f6c11d6 757BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h
2bfdc2d4 758DEMANGLE_H = $(srcdir)/../include/demangle.h
0056a9b5 759RECOG_H = recog.h
50793ea3 760EXPR_H = expr.h insn-codes.h
0056a9b5 761REGS_H = regs.h varray.h machmode.h machmode.def
544eb21e 762#\f
013a2ee0
DE
763# Language makefile fragments.
764
765# The following targets define the interface between us and the languages.
766#
767# all.build, all.cross, start.encap, rest.encap,
768# info, dvi,
769# install-normal, install-common, install-info, install-man,
770# uninstall, distdir,
f1908d70 771# mostlyclean, clean, distclean, extraclean, maintainer-clean,
013a2ee0
DE
772# stage1, stage2, stage3, stage4
773#
774# Each language is linked in with a series of hooks (since we can't use `::'
775# targets). The name of each hooked is "lang.${target_name}" (eg: lang.info).
776# Configure computes and adds these here.
777
778####language hooks
3c18ea24 779@language_hooks@
013a2ee0
DE
780
781# sed inserts language fragments after the following line.
782####language fragments
3c18ea24 783@language_fragments@
013a2ee0
DE
784
785# End of language makefile fragments.
544eb21e 786#\f
024b5658
JM
787# The only suffixes we want for implicit rules are .c and .o, so clear
788# the list and add them. This speeds up GNU Make, and allows -r to work.
789.SUFFIXES:
790.SUFFIXES: .c .o
79d8453e 791
7c0ae5f1 792Makefile: $(srcdir)/Makefile.in config.status $(srcdir)/version.c \
d232dfa4
DE
793 $(xmake_file) $(tmake_file) $(LANG_MAKEFILES)
794 $(SHELL) $(srcdir)/configure.frag $(srcdir) "$(SUBDIRS)" \
795 "$(xmake_file)" "$(tmake_file)"
173712fb 796 cp config.status config.run
71205e0b 797 LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.run
da0d7cb1 798 rm -f config.run
79d8453e 799
723778b0 800$(srcdir)/configure: $(srcdir)/configure.in
3c18ea24
RK
801 cd $(srcdir); autoconf
802
da7ece9a 803# cstamp-h.in controls rebuilding of config.in.
7c0ae5f1
DE
804# It is named cstamp-h.in and not stamp-h.in so the mostlyclean rule doesn't
805# delete it. A stamp file is needed as autoheader won't update the file if
806# nothing has changed.
da7ece9a
DE
807# It remains in the source directory and is part of the distribution.
808# This follows what is done in shellutils, fileutils, etc.
5408f8d0
DE
809# "echo timestamp" is used instead of touch to be consistent with other
810# packages that use autoconf (??? perhaps also to avoid problems with patch?).
da7ece9a
DE
811# ??? Newer versions have a maintainer mode that may be useful here.
812$(srcdir)/config.in: $(srcdir)/cstamp-h.in
813$(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h
60ee2a7a 814 cd $(srcdir) && autoheader
71d085b0 815 @rm -f $(srcdir)/cstamp-h.in
5408f8d0 816 echo timestamp > $(srcdir)/cstamp-h.in
b7cb92ad 817auto-host.h: cstamp-h ; @true
da7ece9a 818cstamp-h: config.in config.status
71205e0b 819 CONFIG_HEADERS=auto-host.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
d68b51ef 820
7c0ae5f1
DE
821# Really, really stupid make features, such as SUN's KEEP_STATE, may force
822# a target to build even if it is up-to-date. So we must verify that
823# config.status does not exist before failing.
4f91a0f8 824config.status: configure version.c
7c0ae5f1
DE
825 @if [ ! -f config.status ] ; then \
826 echo You must configure gcc. Look at the INSTALL file for details.; \
827 false; \
828 else \
71205e0b 829 LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status --recheck; \
7c0ae5f1
DE
830 fi
831
43297964 832all.internal: start.encap rest.encap doc
79d8453e 833# This is what to compile if making a cross-compiler.
013a2ee0 834# Note that we can compile enquire using the cross-compiler just built,
42396e97 835# although we can't run it on this machine.
8d45987f 836all.cross: native gcc-cross specs stmp-headers $(STMP_FIXPROTO) $(LIBGCC) \
43297964 837 $(LIBGCC1_TEST) $(EXTRA_PARTS) lang.all.cross doc
057f494b 838# This is what to compile if making gcc with a cross-compiler.
e09e14e9 839all.build: native xgcc$(exeext) $(EXTRA_PARTS) lang.all.build
79d8453e 840# This is what must be made before installing GCC and converting libraries.
e09e14e9 841start.encap: native xgcc$(exeext) specs $(LIBGCC1) xlimits.h lang.start.encap
eea77e5f 842# These can't be made until after GCC can run.
8d45987f 843rest.encap: stmp-headers $(STMP_FIXPROTO) $(LIBGCC) $(EXTRA_PARTS) lang.rest.encap
79d8453e
RS
844# This is what is made with the host's compiler
845# whether making a cross compiler or not.
ab87f8c8 846native: config.status auto-host.h cpp$(exeext) intl.all $(LANGUAGES) \
88393a07 847 $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
79d8453e
RS
848
849# Define the names for selecting languages in LANGUAGES.
e09e14e9 850C c: cc1$(exeext)
79d8453e
RS
851PROTO: proto
852
bff3fc41 853# Tell GNU make these are phony targets.
3379e8ef 854.PHONY: C c PROTO proto
bff3fc41 855
3aa072f2
RS
856# On the target machine, finish building a cross compiler.
857# This does the things that can't be done on the host machine.
027ea2a7 858rest.cross: $(LIBGCC) specs
3aa072f2 859
a2d163c4 860# Verify that it works to compile and link libgcc1-test.
e97ed334 861# If it does, then there are sufficient replacements for libgcc1.a.
a2d163c4 862libgcc1-test: libgcc1-test.o native $(GCC_PARTS)
8f28aa33 863 @echo "Testing libgcc1. Ignore linker warning messages."
a2d163c4 864 $(GCC_FOR_TARGET) $(GCC_CFLAGS) libgcc1-test.o -o libgcc1-test \
fda92428 865 -nostartfiles -nostdlib `$(GCC_FOR_TARGET) --print-libgcc-file-name`
e09e14e9 866libgcc1-test.o: libgcc1-test.c native xgcc$(exeext)
a2d163c4 867 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/libgcc1-test.c
e97ed334 868
3aa072f2
RS
869# Recompile all the language-independent object files.
870# This is used only if the user explicitly asks for it.
79d8453e
RS
871compilations: ${OBJS}
872
6c1cc7fa
DE
873# Create a list of the language-independent object files so the language
874# subdirectories needn't mention their names explicitly.
b93a436e
JL
875stamp-objlist: $(OBJS)
876 echo " $(OBJS)" | sed -e 's, \([a-z0-9]\), ../\1,g' -e 's/\.o/$(objext)/g' >stamp-objlist
6c1cc7fa 877
acbbf3d9
RS
878# We call this executable `xgcc' rather than `gcc'
879# to avoid confusion if the current directory is in the path
880# and CC is `gcc'. It is renamed to `gcc' when it is installed.
08dc830e 881xgcc$(exeext): gcc.o gccspec.o version.o intl.o prefix.o \
917acb0e 882 version.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
08dc830e
ZW
883 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o gccspec.o intl.o \
884 prefix.o version.o $(EXTRA_GCC_OBJS) $(LIBS)
3aa072f2
RS
885
886# Dump a specs file to make -B./ read these specs over installed ones.
e09e14e9 887specs: xgcc$(exeext)
d521a023
RK
888 $(GCC_FOR_TARGET) -dumpspecs > tmp-specs
889 mv tmp-specs specs
79d8453e 890
acbbf3d9 891# We do want to create an executable named `xgcc', so we can use it to
79d8453e
RS
892# compile libgcc2.a.
893# Also create gcc-cross, so that install-common will install properly.
e09e14e9 894gcc-cross: xgcc$(exeext)
aab26e16 895 cp xgcc$(exeext) gcc-cross$(exeext)
79d8453e 896
19283265
RH
897cc1$(exeext): $(P) $(OBJS) $(C_OBJS) $(LIBDEPS)
898 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(C_OBJS) $(LIBS)
79d8453e 899
1402d22c
RS
900# Build the version of limits.h that we will install.
901xlimits.h: glimits.h limitx.h limity.h
40dc28fc 902 if $(LIMITS_H_TEST) ; then \
d521a023 903 cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \
1402d22c 904 else \
d521a023 905 cat $(srcdir)/glimits.h > tmp-xlimits.h; \
1402d22c 906 fi
d521a023 907 mv tmp-xlimits.h xlimits.h
544eb21e 908#\f
79d8453e
RS
909# Build libgcc.a.
910# This is done in two parts because some functions, in libgcc1.c,
acbbf3d9
RS
911# must be compiled with something other than GCC,
912# while the rest, in libgcc2.c, must be compiled with xgcc.
913# That means we can't do libgcc2.c until after xgcc, cc1, etc.
79d8453e
RS
914
915# Use this as value of LIBGCC1 to cause conversion to GNU library format.
916# LIBCONVERT should put its output in libgcc1.conv.
917libgcc1.conv: libgcc1.a
918 $(LIBCONVERT) libgcc1.a libgcc1.conv
919
920# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely.
921# Make an empty file instead.
57cd2ea1 922libgcc1.null: $(GCC_PASSES)
f1b03ce1 923 echo "void __foo () {}" > dummy.c
79d8453e 924 $(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c
8f25d5cd 925 $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) libgcc1.null dummy$(objext)
aab26e16 926 rm -f dummy$(objext) dummy.c
79d8453e 927
b7ac21e3
RS
928# This is $(LIBGCC1) for a cross-compiler.
929# We have no automatic way of building libgcc1.a,
930# so it's up to the installer to find a way to do that.
931# This rule deliberately does not depend on libgcc1.a
932# so that it will fail if the installer hasn't provided it.
933libgcc1.cross:
934 mv libgcc1.a libgcc1.cross || (echo You must find a way to make libgcc1.a; false)
935
79d8453e 936# Compile the library of arithmetic subroutines with the native compiler.
acbbf3d9 937# Don't compile it with GCC!
79d8453e 938# (That would cause most arithmetic functions to call themselves.)
38b3fa08
RK
939#
940# NOTE: If you modify these rules substantially, please be sure to
941# check at least config/i386/t-sco5 and possibly other makefile
942# fragments.
79d8453e
RS
943libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
944 -rm -f tmplibgcc1.a
945# Actually build it in tmplibgcc1.a, then rename at end,
946# so that libgcc1.a itself remains nonexistent if compilation is aborted.
947# -e causes any failing command to make this rule fail.
948# -e doesn't work in certain shells, so we test $$? as well.
432fde52
JW
949# lynx has a broken ar, it always complains when the initial library is
950# empty, thus this command works only if we don't do -e
951# There is a trailing backslash (\) deleted from the following line.
952# set -e;
79d8453e
RS
953 for name in $(LIB1FUNCS); \
954 do \
955 echo $${name}; \
aab26e16 956 rm -f $${name}$(objext); \
38b3fa08 957 $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
79d8453e 958 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
aab26e16
RK
959 mv libgcc1$(objext) $${name}$(objext); \
960 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
961 rm -f $${name}$(objext); \
79d8453e
RS
962 done
963# Some shells crash when a loop has no items.
964# So make sure there is always at least one--`..'.
965# Then ignore it.
966# We don't use -e here because there are if statements
967# that should not make the command give up when the if condition is false.
968# Instead, we test for failure after each command where it matters.
49041557 969 for file in .. $(LIB1FUNCS_EXTRA); \
79d8453e
RS
970 do \
971 if [ x$${file} != x.. ]; then \
5918c853 972 name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//'`; \
79d8453e
RS
973 echo $${name}; \
974 if [ $${name}.asm = $${file} ]; then \
62c13b81 975 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
79d8453e 976 else true; fi; \
38b3fa08 977 $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
79d8453e 978 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
aab26e16 979 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
79d8453e 980 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
aab26e16 981 rm -f $${name}.s $${name}$(objext); \
79d8453e
RS
982 else true; \
983 fi; \
984 done
8f25d5cd
JW
985 -if $(RANLIB_TEST_FOR_TARGET) ; then \
986 $(RANLIB_FOR_TARGET) tmplibgcc1.a; \
987 else true; fi
79d8453e
RS
988 mv tmplibgcc1.a libgcc1.a
989
44d65d84
DE
990# Build libgcc1.a from assembler source. LIB1ASMFUNCS is the list of
991# functions. LIB1ASMSRC is the name of the source file in the config
992# subdirectory.
993libgcc1-asm.a: libgcc2.ready config.status $(srcdir)/config/$(LIB1ASMSRC)
994 -rm -f tmplibgcc1.a libgcc1.S
995 cp $(srcdir)/config/$(LIB1ASMSRC) libgcc1.S
996# Actually build it in tmplibgcc1.a, then rename at end,
997# so that libgcc1-asm.a itself remains nonexistent if compilation is aborted.
998# -e causes any failing command to make this rule fail.
999# -e doesn't work in certain shells, so we test $$? as well.
1000# lynx has a broken ar, it always complains when the initial library is
1001# empty, thus this command works only if we don't do -e
1002# There is a trailing backslash (\) deleted from the following line.
1003# set -e;
1004 for name in $(LIB1ASMFUNCS); \
1005 do \
1006 echo $${name}; \
1007 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} libgcc1.S; \
1008 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
aab26e16 1009 mv libgcc1$(objext) $${name}$(objext); \
8f25d5cd 1010 $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc1.a $${name}$(objext); \
aab26e16 1011 rm -f $${name}$(objext); \
44d65d84
DE
1012 done
1013 -rm -f libgcc1.S
1014 mv tmplibgcc1.a libgcc1-asm.a
1015
a2ab7f2b
DE
1016# Generate assembly versions of the functions required for libgcc1.
1017# You'll still need to massage the code by hand (possibly hacking
1018# underscores and local labels) but this will get you started.
1019libgcc1.S: libgcc1.c $(CONFIG_H) config.status
1020 -rm -f libgcc1.S
1021 touch libgcc1.S
1022 for name in $(LIB1FUNCS); \
1023 do \
1024 echo $${name}; \
38b3fa08 1025 $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -S -DL$${name} $(srcdir)/libgcc1.c; \
a2ab7f2b
DE
1026 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
1027 echo '#ifdef ' L$${name} >> libgcc1.S; \
1028 cat libgcc1.s >> libgcc1.S; \
1029 echo '#endif /*' L$${name} '*/' >> libgcc1.S; \
1030 echo "" >> libgcc1.S; \
1031 done
1032
79d8453e
RS
1033# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
1034# But recompiling cc1 should not force recompilation of libgcc2.a.
1035# If you want to force recompilation, delete libgcc2.a.
e7f62ad3 1036libgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs $(STMP_FIXPROTO)
79d8453e
RS
1037 -if [ -f libgcc2.ready ] ; then \
1038 true; \
1039 else \
1040 touch libgcc2.ready; \
1041 fi
1042
ca55abae 1043LIB2ADD = $(srcdir)/frame.c $(LIB2FUNCS_EXTRA) $(LANG_LIB2FUNCS)
5198352e 1044libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(FPBIT) $(DPBIT) $(LIB2ADD) \
0056a9b5 1045 machmode.h longlong.h frame.h gbl-ctors.h config.status
79d8453e
RS
1046# Actually build it in tmplibgcc2.a, then rename at end,
1047# so that libgcc2.a itself remains nonexistent if compilation is aborted.
1048 -rm -f tmplibgcc2.a
1049# -e causes any failing command to make this rule fail.
1050# -e doesn't work in certain shells, so we test $$? as well.
432fde52
JW
1051# lynx has a broken ar, it always complains when the initial library is
1052# empty, thus this command works only if we don't do -e
1053# There is a trailing backslash (\) deleted from the following line.
1054# set -e;
79d8453e
RS
1055 for name in $(LIB2FUNCS); \
1056 do \
1057 echo $${name}; \
2e494f70 1058 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
aab26e16 1059 $(srcdir)/libgcc2.c -o $${name}$(objext); \
79d8453e 1060 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
8f25d5cd 1061 $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \
aab26e16 1062 rm -f $${name}$(objext); \
79d8453e 1063 done
624a8b3a
JL
1064 for name in $(LIB2FUNCS_EH); \
1065 do \
1066 echo $${name}; \
1067 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -fexceptions $(INCLUDES) -c \
1068 -DL$${name} $(srcdir)/libgcc2.c -o $${name}$(objext); \
1069 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
8f25d5cd 1070 $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \
624a8b3a
JL
1071 rm -f $${name}$(objext); \
1072 done
5198352e
JL
1073 if [ x$(FPBIT) != x ]; then \
1074 for name in $(FPBIT_FUNCS); \
1075 do \
1076 echo $${name}; \
1077 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
1078 -DFINE_GRAINED_LIBRARIES $(FPBIT) -o $${name}$(objext); \
1079 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
8f25d5cd 1080 $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \
5198352e
JL
1081 rm -f $${name}$(objext); \
1082 done; \
1083 else true; fi;
1084 if [ x$(DPBIT) != x ]; then \
1085 for name in $(DPBIT_FUNCS); \
1086 do \
1087 echo $${name}; \
1088 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
1089 -DFINE_GRAINED_LIBRARIES $(DPBIT) -o $${name}$(objext); \
1090 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
8f25d5cd 1091 $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \
5198352e
JL
1092 rm -f $${name}$(objext); \
1093 done; \
1094 else true; fi;
79d8453e
RS
1095# Some shells crash when a loop has no items.
1096# So make sure there is always at least one--`..'.
1097# Then ignore it.
1098# We don't use -e here because there are if statements
1099# that should not make the command give up when the if condition is false.
1100# Instead, we test for failure after each command where it matters.
ca55abae
JM
1101 for file in $(LIB2ADD); do \
1102 name=`echo $${file} | sed -e 's/[.][cSo]$$//' -e 's/[.]asm$$//' -e 's/[.]txt$$//'`; \
1103 oname=` echo $${name} | sed -e 's,.*/,,'`; \
1104 if [ $${name}.txt = $${file} ]; then \
1105 for f in .. `cat $${file}`; do if [ x$${f} != x.. ]; then \
1106 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
8f25d5cd
JW
1107 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
1108 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" CC="$(CC)" \
ca55abae
JM
1109 CFLAGS="$(CFLAGS)" HOST_PREFIX="$(HOST_PREFIX)" \
1110 HOST_PREFIX_1="$(HOST_PREFIX_1)" \
1111 LANGUAGES="$(LANGUAGES)" \
1112 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $${f}; \
f7055b09 1113 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
8f25d5cd 1114 $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${f}; \
ca55abae
JM
1115 rm -f $${f}; \
1116 else true; \
1117 fi; done; \
1118 else \
1119 echo $${name}; \
1120 if [ $${name}.asm = $${file} ]; then \
1121 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
1122 else true; fi; \
1123 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
1124 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
8f25d5cd 1125 $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${oname}$(objext); \
ca55abae 1126 rm -f $${name}.s $${oname}$(objext); \
79d8453e
RS
1127 fi; \
1128 done
1129 mv tmplibgcc2.a libgcc2.a
1130# These lines were deleted from above the mv command
1131# because ranlibing libgcc.a itself should suffice.
1132# -if [ x${HPUX_GAS} = x ] ; then \
8f25d5cd
JW
1133# if $(RANLIB_TEST_FOR_TARGET) ; then \
1134# $(RANLIB_FOR_TARGET) tmplibgcc2.a;
1135# else true; fi; \
79d8453e
RS
1136# else true; fi
1137
1138# Combine the various libraries into a single library, libgcc.a.
1139libgcc.a: $(LIBGCC1) $(LIBGCC2)
1140 -rm -rf tmplibgcc.a libgcc.a tmpcopy
1141 mkdir tmpcopy
2e494f70 1142 -if [ x$(LIBGCC1) != x ]; \
8f25d5cd 1143 then (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC1)); \
2e494f70
RS
1144 else true; \
1145 fi
2516bc12
JW
1146# Some versions of ar (specifically the one in RISC/os 5.x), create an
1147# unwritable table of contents file, and then print an error message when
1148# the second ar command tries to overwrite this file. To avoid the error
1149# message from ar, we make sure all files are writable.
cfc327a2 1150 -(cd tmpcopy; chmod +w * > /dev/null 2>&1)
8f25d5cd
JW
1151 (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2))
1152 (cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a *$(objext))
79d8453e 1153 rm -rf tmpcopy
8f25d5cd
JW
1154 -if $(RANLIB_TEST_FOR_TARGET) ; then \
1155 $(RANLIB_FOR_TARGET) tmplibgcc.a; \
1156 else true; fi
79d8453e
RS
1157# Actually build it in tmplibgcc.a, then rename at end,
1158# so that libgcc.a itself remains nonexistent if compilation is aborted.
1159 mv tmplibgcc.a libgcc.a
1160
f6cdc7ea
DE
1161# Use the genmultilib shell script to generate the information the gcc
1162# driver program needs to select the library directory based on the
1163# switches.
e5e809f4
JL
1164multilib.h: s-mlib; @true
1165s-mlib: $(srcdir)/genmultilib Makefile
961b7009
MM
1166 $(SHELL) $(srcdir)/genmultilib \
1167 "$(MULTILIB_OPTIONS)" \
1168 "$(MULTILIB_DIRNAMES)" \
1169 "$(MULTILIB_MATCHES)" \
1170 "$(MULTILIB_EXCEPTIONS)" \
1171 "$(MULTILIB_EXTRA_OPTS)" > tmp-mlib.h
1172 $(srcdir)/move-if-change tmp-mlib.h multilib.h
e5e809f4 1173 touch s-mlib
f6cdc7ea
DE
1174
1175# Build multiple copies of libgcc.a, one for each target switch.
1176stmp-multilib: $(LIBGCC1) libgcc2.c libgcc2.ready $(CONFIG_H) \
0056a9b5 1177 frame.h \
ca55abae 1178 $(LIB2ADD) machmode.h longlong.h gbl-ctors.h config.status
f6cdc7ea
DE
1179 for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
1180 dir=`echo $$i | sed -e 's/;.*$$//'`; \
1181 flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
f6cdc7ea 1182 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
8f25d5cd
JW
1183 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
1184 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
1185 CC="$(CC)" CFLAGS="$(CFLAGS)" \
1186 RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \
1187 RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \
71abb567 1188 LANGUAGES="$(LANGUAGES)" \
f6cdc7ea 1189 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
ad3a9224 1190 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" \
47a22692 1191 MULTILIB_CFLAGS="$${flags}" \
ad3a9224
DE
1192 LIBGCC1="$(LIBGCC1)" LIBGCC2="$(LIBGCC2)" \
1193 dir="$${dir}" stmp-multilib-sub; \
bff3fc41 1194 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
f6cdc7ea
DE
1195 done
1196 touch stmp-multilib
1197
ad3a9224
DE
1198# Subroutine of stmp-multilib so make -n works.
1199stmp-multilib-sub:
47a22692
JM
1200 rm -f $(LIBGCC2)
1201 if [ -d $(dir) ]; then \
1202 cd $(dir); \
1203 rm -f libgcc.a $(EXTRA_MULTILIB_PARTS); \
88029ff8 1204 else true; \
47a22692 1205 fi
ad3a9224 1206 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
8f25d5cd
JW
1207 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
1208 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
1209 CC="$(CC)" CFLAGS="$(CFLAGS)" \
ad3a9224 1210 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
71abb567 1211 LANGUAGES="$(LANGUAGES)" \
ad3a9224
DE
1212 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC2)
1213 if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
1214 then true; \
1215 else rm -f $(LIBGCC1); \
1216 fi
1217 if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
1218 then true; \
1219 else \
1220 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
8f25d5cd
JW
1221 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
1222 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
1223 CC="$(CC)" CFLAGS="$(CFLAGS)" \
ad3a9224 1224 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
71abb567 1225 LANGUAGES="$(LANGUAGES)" \
ad3a9224
DE
1226 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC1); \
1227 fi
1228 rm -rf tmplibgcc.a tmpcopy
1229 mkdir tmpcopy
1230 if [ x$(LIBGCC1) != x ]; \
8f25d5cd 1231 then (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC1)); \
ad3a9224
DE
1232 else true; \
1233 fi
8f25d5cd
JW
1234 (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2))
1235 (cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a *$(objext))
ad3a9224 1236 rm -rf libgcc2.a tmpcopy
8f25d5cd
JW
1237 if $(RANLIB_TEST_FOR_TARGET) ; then \
1238 $(RANLIB_FOR_TARGET) tmplibgcc.a; \
1239 else true; fi
ad3a9224
DE
1240 if [ -d $(dir) ]; then true; else mkdir $(dir); fi
1241 mv tmplibgcc.a $(dir)/libgcc.a
47a22692
JM
1242 for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
1243 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
8f25d5cd
JW
1244 AR_FOR_TARGET="$(AR_FOR_TARGET)" \
1245 AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
1246 CC="$(CC)" CFLAGS="$(CFLAGS)" \
47a22692 1247 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
1c4c5851 1248 LANGUAGES="$(LANGUAGES)" \
47a22692
JM
1249 MULTILIB_CFLAGS="$(MULTILIB_CFLAGS)" T="t" t$${f}; \
1250 mv t$${f} $(dir)/$${f}; \
88029ff8 1251 else true; \
47a22692 1252 fi; done
ad3a9224 1253
79d8453e 1254# Compile two additional files that are linked with every program
32988c4a
RM
1255# linked using GCC on systems using COFF or ELF, for the sake of C++
1256# constructors.
956d6950
JL
1257$(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
1258 defaults.h frame.h gbl-ctors.h
a94dbf2c 1259 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
ca55abae 1260 -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS) \
a94dbf2c 1261 -c $(srcdir)/crtstuff.c -DCRT_BEGIN -o $(T)crtbegin$(objext)
47a22692 1262
956d6950
JL
1263$(T)crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
1264 defaults.h frame.h gbl-ctors.h
a94dbf2c 1265 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
ca55abae 1266 -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS) \
a94dbf2c 1267 -c $(srcdir)/crtstuff.c -DCRT_END -o $(T)crtend$(objext)
32988c4a
RM
1268
1269# On some systems we also want to install versions of these files
1270# compiled using PIC for use in shared libraries.
e5e809f4 1271crtbeginS.o crtendS.o: s-crtS ; @true
32988c4a 1272
e5e809f4 1273s-crtS: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
956d6950 1274 defaults.h frame.h gbl-ctors.h
38b3fa08 1275 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \
1442f4eb
L
1276 -DCRT_BEGIN -DCRTSTUFFS_O -finhibit-size-directive -fno-inline-functions \
1277 -fno-exceptions -g0 -c $(srcdir)/crtstuff.c
32988c4a 1278 mv crtstuff$(objext) crtbeginS$(objext)
38b3fa08 1279 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \
1442f4eb
L
1280 -DCRT_END -DCRTSTUFFS_O -finhibit-size-directive -fno-inline-functions \
1281 -fno-exceptions -g0 -c $(srcdir)/crtstuff.c -o crtendS$(objext)
e5e809f4 1282 touch s-crtS
522170ca
RK
1283
1284# Compile the start modules crt0.o and mcrt0.o that are linked with every program
e5e809f4
JL
1285crt0.o: s-crt0 ; @true
1286mcrt0.o: s-crt0; @true
522170ca 1287
e5e809f4 1288s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
522170ca
RK
1289 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
1290 -o crt0.o -c $(CRT0_S)
1291 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
1292 -o mcrt0.o -c $(MCRT0_S)
e5e809f4 1293 touch s-crt0
544eb21e 1294#\f
79d8453e
RS
1295# Compiling object files from source files.
1296
1297# Note that dependencies on obstack.h are not written
1298# because that file is not part of GCC.
79d8453e
RS
1299
1300# C language specific files.
1301
44dbcb17 1302c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
a0c8e1b2 1303 $(srcdir)/c-parse.h c-tree.h input.h flags.h system.h toplev.h
79d8453e 1304 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
a1fa1e22
DE
1305$(srcdir)/c-parse.h: $(srcdir)/c-parse.c
1306$(srcdir)/c-parse.c: $(srcdir)/c-parse.y
26095868 1307 cd $(srcdir); $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
3ff34537 1308$(srcdir)/c-parse.y: c-parse.in
49381011 1309 echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y
1c48d17e
RS
1310 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
1311 -e "/^ifc$$/d" -e "/^end ifc$$/d" \
49381011 1312 $(srcdir)/c-parse.in >>tmp-c-parse.y
2c33b8c2 1313 $(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y
1c48d17e 1314
3ff34537 1315$(srcdir)/c-gperf.h: c-parse.gperf
db127392
KG
1316 gperf -L KR-C -F ', 0, 0' -p -j1 -i 1 -g -o -t -G -N is_reserved_word \
1317 -k1,3,$$ $(srcdir)/c-parse.gperf >tmp-gperf.h
2c33b8c2 1318 $(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
f137e7dc 1319
670ee920 1320c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h flags.h \
a0c8e1b2 1321 output.h toplev.h
670ee920 1322c-typeck.o : c-typeck.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \
ab87f8c8 1323 intl.h output.h $(EXPR_H) $(RTL_H) toplev.h
cab634f2
KG
1324c-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h toplev.h \
1325 output.h
670ee920 1326c-lex.o : c-lex.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-lex.h c-tree.h \
ab87f8c8 1327 $(srcdir)/c-parse.h input.h intl.h flags.h $(srcdir)/c-gperf.h c-pragma.h \
56f48ce9 1328 toplev.h output.h mbchar.h
670ee920 1329c-aux-info.o : c-aux-info.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h
a0c8e1b2 1330c-convert.o : c-convert.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h
d05a5492
MM
1331c-pragma.o: c-pragma.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) except.h \
1332 function.h defaults.h c-pragma.h toplev.h
670ee920 1333c-iterate.o: c-iterate.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \
50793ea3 1334 flags.h toplev.h $(EXPR_H)
0056a9b5 1335mbchar.o: mbchar.c $(CONFIG_H) system.h mbchar.h
0c3a267b 1336graph.o: graph.c $(CONFIG_H) system.h toplev.h flags.h output.h $(RTL_H) \
5f6c11d6
RH
1337 hard-reg-set.h $(BASIC_BLOCK_H)
1338sbitmap.o: sbitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H)
79d8453e 1339
a2d25763
MK
1340COLLECT2_OBJS = collect2.o tlink.o hash.o intl.o underscore.o version.o
1341collect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS)
057f494b 1342# Don't try modifying collect2 (aka ld) in place--it might be linking this.
aab26e16 1343 -rm -f collect2$(exeext)
ab87f8c8 1344 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(COLLECT2_OBJS) $(LIBS)
79d8453e 1345
ab87f8c8 1346collect2.o : collect2.c $(CONFIG_H) system.h gstab.h intl.h \
2edfd4ee 1347 $(srcdir)/../include/obstack.h $(DEMANGLE_H) collect2.h
b7b08dcd 1348 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
8b06b20a 1349 -DTARGET_MACHINE=\"$(target_alias)\" $(MAYBE_USE_COLLECT2) \
b7b08dcd 1350 -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
79d8453e 1351
2edfd4ee 1352tlink.o: tlink.c $(DEMANGLE_H) hash.h $(CONFIG_H) system.h toplev.h collect2.h
a0c8e1b2 1353hash.o: hash.c hash.h system.h toplev.h
eaa41c8d 1354
0056a9b5 1355vfprintf.o: $(srcdir)/../libiberty/vfprintf.c $(CONFIG_H) system.h
39802f41
JL
1356 rm -f vfprintf.c
1357 $(LN_S) $(srcdir)/../libiberty/vfprintf.c vfprintf.c
1358 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) vfprintf.c
1359
3932261a 1360splay-tree.o: $(srcdir)/../libiberty/splay-tree.c \
0056a9b5 1361 $(srcdir)/../include/splay-tree.h $(srcdir)/../include/libiberty.h
3932261a
MM
1362 rm -f splay-tree.c
1363 $(LN_S) $(srcdir)/../libiberty/splay-tree.c splay-tree.c
1364 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) splay-tree.c
1365
e5e809f4 1366underscore.c: s-under ; @true
7af4e697 1367
e5e809f4 1368s-under: $(GCC_PASSES)
7ac16ba0
RK
1369 echo "int xxy_us_dummy;" >tmp-dum.c
1370 $(GCC_FOR_TARGET) -S tmp-dum.c
1371 echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c
1372 if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \
1373 echo "int prepends_underscore = 1;" >>tmp-under.c; \
a3184468 1374 else \
7ac16ba0 1375 echo "int prepends_underscore = 0;" >>tmp-under.c; \
a3184468 1376 fi
7ac16ba0
RK
1377 $(srcdir)/move-if-change tmp-under.c underscore.c
1378 -rm -f tmp-dum.c tmp-dum.s
e5e809f4 1379 touch s-under
a3184468 1380
79d8453e
RS
1381# A file used by all variants of C.
1382
a0c8e1b2 1383c-common.o : c-common.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h \
5916476f 1384 flags.h toplev.h output.h c-pragma.h $(RTL_H)
79d8453e
RS
1385
1386# Language-independent files.
1387
610c62ac 1388DRIVER_DEFINES = \
4c2f8346 1389 -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
2e494f70 1390 -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
964ceda1 1391 -DDEFAULT_TARGET_VERSION=\"$(version)\" \
8b06b20a 1392 -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \
4c2f8346 1393 -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\"
ab87f8c8
JL
1394gcc.o: gcc.c $(CONFIG_H) system.h intl.h multilib.h \
1395 Makefile $(lang_specs_files) prefix.h
610c62ac
BK
1396 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1397 $(DRIVER_DEFINES) \
79d8453e
RS
1398 -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
1399
08dc830e
ZW
1400gccspec.o: gccspec.c $(CONFIG_H) system.h
1401
12b195d9 1402tree-check.h: s-check ; @true
b00c2351 1403s-check : gencheck $(srcdir)/move-if-change
12b195d9
ML
1404 ./gencheck > tmp-check.h
1405 $(srcdir)/move-if-change tmp-check.h tree-check.h
1406 touch s-check
1407
ab87f8c8 1408gencheck : gencheck.o $(lang_tree_files) $(HOST_LIBDEPS)
12b195d9
ML
1409 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
1410 gencheck.o $(HOST_LIBS)
1411
ab87f8c8
JL
1412gencheck.o : gencheck.c tree.def $(CONFIG_H) hconfig.h system.h
1413 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1414 $(srcdir)/gencheck.c
1a4bf22f 1415
79d8453e
RS
1416dumpvers: dumpvers.c
1417
1418version.o: version.c
2bdfeefa
JL
1419obstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H)
1420 rm -f obstack.c
1421 $(LN_S) $(srcdir)/../libiberty/obstack.c obstack.c
1422 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) obstack.c
1423
460ee112 1424prefix.o: prefix.c $(CONFIG_H) system.h Makefile prefix.h
e9a25f70
JL
1425 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1426 -DPREFIX=\"$(prefix)\" \
1427 -c `echo $(srcdir)/prefix.c | sed 's,^\./,,'`
79d8453e 1428
a0c8e1b2 1429convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h toplev.h
c5d3565c 1430
d05a5492 1431tree.o : tree.c $(CONFIG_H) system.h $(TREE_H) flags.h function.h toplev.h except.h
670ee920 1432print-tree.o : print-tree.c $(CONFIG_H) system.h $(TREE_H)
234042f4 1433stor-layout.o : stor-layout.c $(CONFIG_H) system.h $(TREE_H) flags.h \
50793ea3 1434 function.h $(EXPR_H) $(RTL_H) toplev.h except.h
efe3eb65
KG
1435fold-const.o : fold-const.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h \
1436 $(RTL_H)
670ee920 1437toplev.o : toplev.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) \
c40d5de4 1438 flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \
ab87f8c8 1439 insn-codes.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h dwarfout.h \
b1eeb243 1440 dwarf2out.h sdbout.h dbxout.h $(EXPR_H) $(BASIC_BLOCK_H) \
c40d5de4 1441 $(lang_options_files)
9c6e68c2 1442 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
8b06b20a 1443 -DTARGET_NAME=\"$(target_alias)\" \
b7ac21e3 1444 -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
79d8453e 1445
0dfa1860 1446rtl.o : rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
79d8453e 1447
dbfea53d 1448print-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h basic-block.h
670ee920 1449rtlanal.o : rtlanal.c $(CONFIG_H) system.h $(RTL_H)
79d8453e 1450
670ee920 1451varasm.o : varasm.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h \
6feacd09 1452 function.h defaults.h $(EXPR_H) hard-reg-set.h $(REGS_H) \
296433e1 1453 xcoffout.h output.h c-pragma.h toplev.h except.h dbxout.h sdbout.h
670ee920 1454function.o : function.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
6feacd09 1455 function.h insn-flags.h insn-codes.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
fe9b4957 1456 insn-config.h $(RECOG_H) output.h toplev.h except.h hash.h
670ee920 1457stmt.o : stmt.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \
50793ea3 1458 insn-flags.h insn-config.h insn-codes.h hard-reg-set.h $(EXPR_H) except.h \
3ec2b590 1459 loop.h $(RECOG_H) toplev.h output.h varray.h
670ee920 1460except.o : except.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
6feacd09 1461 function.h insn-flags.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
a0c8e1b2 1462 insn-config.h $(RECOG_H) output.h except.h toplev.h
670ee920 1463expr.o : expr.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \
6feacd09 1464 $(REGS_H) insn-flags.h insn-codes.h $(EXPR_H) insn-config.h $(RECOG_H) output.h \
1cd93963 1465 typeclass.h hard-reg-set.h toplev.h hard-reg-set.h except.h
50793ea3 1466calls.o : calls.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(EXPR_H) \
6feacd09 1467 insn-flags.h $(REGS_H) toplev.h output.h
670ee920 1468expmed.o : expmed.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
50793ea3 1469 insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) real.h
670ee920 1470explow.o : explow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
50793ea3 1471 hard-reg-set.h insn-config.h $(EXPR_H) $(RECOG_H) insn-flags.h insn-codes.h
670ee920 1472optabs.o : optabs.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
50793ea3 1473 insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) reload.h
6feacd09 1474dbxout.o : dbxout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h $(REGS_H) \
487a6e06
KG
1475 insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h dbxout.h \
1476 toplev.h
670ee920 1477sdbout.o : sdbout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h except.h \
6feacd09 1478 function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) defaults.h real.h \
2bdfeefa
JL
1479 insn-config.h $(srcdir)/../include/obstack.h xcoffout.h c-pragma.h \
1480 sdbout.h toplev.h
670ee920 1481dwarfout.o : dwarfout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf.h \
76ead72b 1482 flags.h insn-config.h reload.h output.h defaults.h toplev.h dwarfout.h
670ee920 1483dwarf2out.o : dwarf2out.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf2.h \
50793ea3 1484 flags.h insn-config.h reload.h output.h defaults.h \
b170964a 1485 hard-reg-set.h $(REGS_H) $(EXPR_H) toplev.h dwarf2out.h dyn-string.h
670ee920 1486xcoffout.o : xcoffout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) xcoffout.h \
296b8152 1487 flags.h toplev.h output.h dbxout.h
670ee920 1488emit-rtl.o : emit-rtl.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
6feacd09 1489 except.h function.h $(REGS_H) insn-config.h $(RECOG_H) real.h \
2bdfeefa 1490 $(EXPR_H) $(srcdir)/../include/obstack.h hard-reg-set.h bitmap.h
a0c8e1b2 1491real.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h
670ee920
KG
1492getpwd.o : getpwd.c $(CONFIG_H) system.h
1493
1494integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
6feacd09 1495 integrate.h insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \
ab87f8c8 1496 intl.h function.h output.h $(RECOG_H) except.h toplev.h
670ee920 1497
6feacd09 1498jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
50793ea3 1499 insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h \
0c63f729 1500 toplev.h insn-attr.h
6feacd09 1501stupid.o : stupid.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h \
cad6f7d0 1502 $(BASIC_BLOCK_H) insn-config.h reload.h flags.h toplev.h
79d8453e 1503
6feacd09 1504cse.o : cse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
50793ea3 1505 real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h output.h
6feacd09 1506gcse.o : gcse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
50793ea3 1507 real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) output.h
1841f23b
BM
1508resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h system.h \
1509 $(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h
d2ecda27
JL
1510lcm.o : lcm.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
1511 real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H)
670ee920 1512profile.o : profile.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-flags.h \
e61fab19 1513 gcov-io.h $(TREE_H) output.h $(REGS_H) toplev.h insn-config.h
670ee920 1514loop.o : loop.c $(CONFIG_H) system.h $(RTL_H) flags.h loop.h insn-config.h \
6feacd09 1515 insn-flags.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \
3ec2b590 1516 toplev.h varray.h
50793ea3 1517unroll.o : unroll.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
3ec2b590 1518 integrate.h $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) loop.h toplev.h varray.h
670ee920 1519flow.o : flow.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-config.h \
dbfea53d
RH
1520 $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h recog.h \
1521 insn-flags.h
670ee920 1522combine.o : combine.c $(CONFIG_H) system.h $(RTL_H) flags.h \
6feacd09 1523 insn-config.h insn-flags.h insn-codes.h insn-attr.h $(REGS_H) $(EXPR_H) \
2e107e9e 1524 $(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h toplev.h
670ee920 1525regclass.o : regclass.c $(CONFIG_H) system.h $(RTL_H) hard-reg-set.h flags.h \
6feacd09 1526 $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(RECOG_H) reload.h real.h toplev.h \
d6f4ec51 1527 output.h
670ee920 1528local-alloc.o : local-alloc.c $(CONFIG_H) system.h $(RTL_H) flags.h \
6feacd09 1529 $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) output.h \
2e107e9e 1530 insn-attr.h toplev.h
670ee920 1531bitmap.o : bitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H) \
6feacd09 1532 $(REGS_H)
cad6f7d0 1533global.o : global.c $(CONFIG_H) system.h $(RTL_H) flags.h reload.h \
6feacd09
MM
1534 $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h output.h toplev.h
1535varray.o : varray.c $(CONFIG_H) system.h varray.h $(RTL_H) $(TREE_H) bitmap.h
79d8453e 1536
50793ea3 1537reload.o : reload.c $(CONFIG_H) system.h $(RTL_H) flags.h output.h $(EXPR_H) \
6feacd09 1538 reload.h $(RECOG_H) hard-reg-set.h insn-config.h insn-codes.h $(REGS_H) \
a0c8e1b2 1539 real.h toplev.h
50793ea3 1540reload1.o : reload1.c $(CONFIG_H) system.h $(RTL_H) real.h flags.h $(EXPR_H) \
6feacd09 1541 reload.h $(REGS_H) hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
a0c8e1b2 1542 $(BASIC_BLOCK_H) $(RECOG_H) output.h toplev.h
670ee920 1543caller-save.o : caller-save.c $(CONFIG_H) system.h $(RTL_H) flags.h \
6feacd09 1544 $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) \
50793ea3 1545 $(RECOG_H) reload.h $(EXPR_H) toplev.h
670ee920 1546reorg.o : reorg.c $(CONFIG_H) system.h $(RTL_H) conditions.h hard-reg-set.h \
6feacd09 1547 $(BASIC_BLOCK_H) $(REGS_H) insn-config.h insn-attr.h \
50793ea3 1548 insn-flags.h $(RECOG_H) flags.h output.h $(EXPR_H)
52fe52e2 1549alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \
264fac34 1550 $(REGS_H) toplev.h output.h $(EXPR_H)
670ee920 1551regmove.o : regmove.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
6feacd09 1552 $(RECOG_H) output.h reload.h $(REGS_H) hard-reg-set.h flags.h \
50793ea3 1553 $(EXPR_H) insn-flags.h $(BASIC_BLOCK_H) toplev.h
670ee920 1554$(SCHED_PREFIX)sched.o : $(SCHED_PREFIX)sched.c $(CONFIG_H) system.h $(RTL_H) \
e51712db
KG
1555 $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h \
1556 insn-attr.h toplev.h recog.h
ab87f8c8
JL
1557final.o : final.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h intl.h \
1558 $(REGS_H) $(RECOG_H) conditions.h insn-config.h insn-attr.h except.h real.h \
1559 output.h hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h \
1560 defaults.h toplev.h reload.h dwarfout.h dwarf2out.h sdbout.h dbxout.h
670ee920 1561recog.o : recog.c $(CONFIG_H) system.h $(RTL_H) \
6feacd09 1562 $(REGS_H) $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \
7f7f8214 1563 insn-flags.h insn-codes.h real.h toplev.h
f62a15e3 1564reg-stack.o : reg-stack.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) recog.h \
6feacd09 1565 $(REGS_H) hard-reg-set.h flags.h insn-config.h insn-flags.h toplev.h
0056a9b5 1566dyn-string.o: dyn-string.c dyn-string.h $(CONFIG_H) system.h
dcfedcd0 1567
b4978ce7 1568$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \
6feacd09 1569 $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
487a6e06 1570 insn-flags.h output.h insn-attr.h insn-codes.h system.h toplev.h
9c6e68c2 1571 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file)
79d8453e 1572
4e0db2ce
RK
1573# Build auxiliary files that support ecoff format.
1574mips-tfile: mips-tfile.o version.o $(LIBDEPS)
aab26e16 1575 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS)
4e0db2ce 1576
092f7be3 1577mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H) system.h machmode.h
4e0db2ce
RK
1578
1579mips-tdump: mips-tdump.o version.o $(LIBDEPS)
aab26e16 1580 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tdump.o version.o $(LIBS)
4e0db2ce 1581
90fbb8c9 1582mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H) system.h
4e0db2ce 1583
579d0ecf 1584# Build file to support OSF/rose half-pic format.
b04cd507 1585halfpic.o: halfpic.c $(CONFIG_H) $(RTL_H) $(TREE_H) system.h
579d0ecf 1586
79d8453e
RS
1587# Normally this target is not used; but it is used if you
1588# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
1589# from the GNU Emacs distribution.
39802f41
JL
1590alloca.o: $(srcdir)/../libiberty/alloca.c
1591 rm -f alloca.c
1592 $(LN_S) $(srcdir)/../libiberty/alloca.c alloca.c
79d8453e 1593 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
39802f41 1594 -c `echo alloca.c | sed 's,^\./,,'`
79d8453e 1595 $(ALLOCA_FINISH)
544eb21e 1596#\f
79d8453e
RS
1597# Generate header and source files from the machine description,
1598# and compile them.
1599
1600.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
1601 insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
1602 insn-attr.h insn-attrtab.c
1603
1604# The following pair of rules has this effect:
1605# genconfig is run only if the md has changed since genconfig was last run;
1606# but the file insn-config.h is touched only when its contents actually change.
1607
1608# Each of the other insn-* files is handled by a similar pair of rules.
1609
1402d22c 1610# This causes an anomaly in the results of make -n
e5e809f4 1611# because insn-* is older than s-*
1402d22c
RS
1612# and thus make -n thinks that insn-* will be updated
1613# and force recompilation of things that depend on it.
424aa086 1614# We use move-if-change precisely to avoid such recompilation.
1402d22c
RS
1615# But there is no way to teach make -n that it will be avoided.
1616
79d8453e
RS
1617# Each of the insn-*.[ch] rules has a semicolon at the end,
1618# for otherwise the system Make on SunOS 4.1 never tries
7bd95cc1
BK
1619# to recompile insn-*.o. To avoid problems and extra noise from
1620# versions of make which don't like empty commands (nothing after the
1621# trailing `;'), we call true for each.
79d8453e 1622
e5e809f4
JL
1623insn-config.h: s-config ; @true
1624s-config : $(md_file) genconfig $(srcdir)/move-if-change
7ac16ba0 1625 ./genconfig $(md_file) > tmp-config.h
79d8453e 1626 $(srcdir)/move-if-change tmp-config.h insn-config.h
e5e809f4 1627 touch s-config
79d8453e 1628
e5e809f4
JL
1629insn-flags.h: s-flags ; @true
1630s-flags : $(md_file) genflags $(srcdir)/move-if-change
7ac16ba0 1631 ./genflags $(md_file) > tmp-flags.h
79d8453e 1632 $(srcdir)/move-if-change tmp-flags.h insn-flags.h
e5e809f4 1633 touch s-flags
79d8453e 1634
e5e809f4
JL
1635insn-codes.h: s-codes ; @true
1636s-codes : $(md_file) gencodes $(srcdir)/move-if-change
7ac16ba0 1637 ./gencodes $(md_file) > tmp-codes.h
79d8453e 1638 $(srcdir)/move-if-change tmp-codes.h insn-codes.h
e5e809f4 1639 touch s-codes
79d8453e 1640
50793ea3 1641insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) $(EXPR_H) real.h output.h \
7f7f8214 1642 insn-config.h insn-flags.h insn-codes.h system.h reload.h recog.h
79d8453e
RS
1643 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
1644
e5e809f4
JL
1645insn-emit.c: s-emit ; @true
1646s-emit : $(md_file) genemit $(srcdir)/move-if-change
7ac16ba0 1647 ./genemit $(md_file) > tmp-emit.c
79d8453e 1648 $(srcdir)/move-if-change tmp-emit.c insn-emit.c
e5e809f4 1649 touch s-emit
79d8453e 1650
956d6950 1651insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(RECOG_H) \
e9eaed43 1652 real.h output.h flags.h system.h
79d8453e
RS
1653 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
1654
e5e809f4
JL
1655insn-recog.c: s-recog ; @true
1656s-recog : $(md_file) genrecog $(srcdir)/move-if-change
7ac16ba0 1657 ./genrecog $(md_file) > tmp-recog.c
79d8453e 1658 $(srcdir)/move-if-change tmp-recog.c insn-recog.c
e5e809f4 1659 touch s-recog
79d8453e 1660
118bdbf8 1661insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
50793ea3 1662 insn-config.h flags.h $(RECOG_H) $(EXPR_H) reload.h system.h
118bdbf8
RK
1663 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
1664
e5e809f4
JL
1665insn-opinit.c: s-opinit ; @true
1666s-opinit : $(md_file) genopinit $(srcdir)/move-if-change
7ac16ba0 1667 ./genopinit $(md_file) > tmp-opinit.c
118bdbf8 1668 $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
e5e809f4 1669 touch s-opinit
118bdbf8 1670
0a578fee
BS
1671insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H) system.h toplev.h \
1672 insn-config.h recog.h
79d8453e
RS
1673 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
1674
e5e809f4
JL
1675insn-extract.c: s-extract ; @true
1676s-extract : $(md_file) genextract $(srcdir)/move-if-change
7ac16ba0 1677 ./genextract $(md_file) > tmp-extract.c
79d8453e 1678 $(srcdir)/move-if-change tmp-extract.c insn-extract.c
e5e809f4 1679 touch s-extract
79d8453e 1680
7f7f8214
KG
1681insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) $(REGS_H) output.h real.h \
1682 system.h insn-config.h recog.h
79d8453e
RS
1683 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
1684
e5e809f4
JL
1685insn-peep.c: s-peep ; @true
1686s-peep : $(md_file) genpeep $(srcdir)/move-if-change
7ac16ba0 1687 ./genpeep $(md_file) > tmp-peep.c
79d8453e 1688 $(srcdir)/move-if-change tmp-peep.c insn-peep.c
e5e809f4 1689 touch s-peep
79d8453e 1690
114791ea
KG
1691insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h \
1692 output.h insn-attr.h insn-config.h system.h toplev.h
79d8453e
RS
1693 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
1694
e5e809f4
JL
1695insn-attr.h: s-attr ; @true
1696s-attr : $(md_file) genattr $(srcdir)/move-if-change
7ac16ba0 1697 ./genattr $(md_file) > tmp-attr.h
79d8453e 1698 $(srcdir)/move-if-change tmp-attr.h insn-attr.h
e5e809f4 1699 touch s-attr
79d8453e 1700
e5e809f4
JL
1701insn-attrtab.c: s-attrtab ; @true
1702s-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change
7ac16ba0 1703 if cmp -s $(PREMADE_ATTRTAB_MD) $(md_file); \
20bd0ab1
RS
1704 then \
1705 echo Using $(PREMADE_ATTRTAB); \
2e0b13db 1706 cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \
20bd0ab1 1707 else \
7ac16ba0 1708 ./genattrtab $(md_file) > tmp-attrtab.c; \
20bd0ab1 1709 fi
79d8453e 1710 $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
e5e809f4 1711 touch s-attrtab
79d8453e 1712
6feacd09 1713insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h conditions.h \
956d6950 1714 hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h $(RECOG_H) \
e9eaed43 1715 insn-codes.h system.h
79d8453e
RS
1716 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
1717
e5e809f4
JL
1718insn-output.c: s-output ; @true
1719s-output : $(md_file) genoutput $(srcdir)/move-if-change
7ac16ba0 1720 ./genoutput $(md_file) > tmp-output.c
79d8453e 1721 $(srcdir)/move-if-change tmp-output.c insn-output.c
e5e809f4 1722 touch s-output
3b80f6ca 1723
560bd19e 1724genrtl.o : genrtl.c $(CONFIG_H) $(RTL_H) system.h
e5e809f4 1725genrtl.c genrtl.h : s-genrtl
a3f80023
AS
1726 @true # force gnu make to recheck modification times.
1727
e5e809f4 1728s-genrtl: gengenrtl $(srcdir)/move-if-change $(RTL_BASE_H)
3b80f6ca
RH
1729 ./gengenrtl tmp-genrtl.h tmp-genrtl.c
1730 $(srcdir)/move-if-change tmp-genrtl.h genrtl.h
1731 $(srcdir)/move-if-change tmp-genrtl.c genrtl.c
e5e809f4 1732 touch s-genrtl
3b80f6ca 1733
544eb21e 1734#\f
79d8453e
RS
1735# Compile the programs that generate insn-* from the machine description.
1736# They are compiled with $(HOST_CC), and associated libraries,
1737# since they need to run on this machine
1738# even if GCC is being compiled to run on some other machine.
1739
1740# $(CONFIG_H) is omitted from the deps of the gen*.o
1741# because these programs don't really depend on anything
1742# about the target machine. They do depend on config.h itself,
1743# since that describes the host machine.
1744
c3efc7c4 1745# Pass the md file through cpp if the target requests it.
aa90345a
RK
1746$(MD_FILE): $(MD_DEPS)
1747 rm -f $@
7ac16ba0 1748 $(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@
d521a023 1749 mv tmp-$@ $@
c3efc7c4 1750
4db83042 1751genconfig : genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1752 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1753 genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1754
0b93b64e 1755genconfig.o : genconfig.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1756 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
1757
4db83042 1758genflags : genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1759 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1760 genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1761
0b93b64e 1762genflags.o : genflags.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1763 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
1764
4db83042 1765gencodes : gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1766 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1767 gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1768
0b93b64e 1769gencodes.o : gencodes.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1770 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
1771
4db83042 1772genemit : genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1773 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1774 genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1775
0b93b64e 1776genemit.o : genemit.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1777 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
1778
4db83042 1779genopinit : genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1780 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1781 genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
118bdbf8 1782
0b93b64e 1783genopinit.o : genopinit.c $(RTL_H) $(build_xm_file) system.h
118bdbf8
RK
1784 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
1785
4db83042 1786genrecog : genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1787 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1788 genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1789
0b93b64e 1790genrecog.o : genrecog.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1791 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
1792
4db83042 1793genextract : genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1794 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1795 genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1796
0b93b64e 1797genextract.o : genextract.c $(RTL_H) $(build_xm_file) system.h insn-config.h
79d8453e
RS
1798 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
1799
4db83042 1800genpeep : genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1801 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1802 genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1803
0b93b64e 1804genpeep.o : genpeep.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1805 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
1806
4db83042 1807genattr : genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1808 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1809 genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1810
0b93b64e 1811genattr.o : genattr.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1812 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
1813
d3614a37 1814genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
aab26e16 1815 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
d3614a37 1816 genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
79d8453e 1817
0b93b64e 1818genattrtab.o : genattrtab.c $(RTL_H) $(build_xm_file) system.h insn-config.h
79d8453e
RS
1819 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
1820
4db83042 1821genoutput : genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1822 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1823 genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1824
0b93b64e 1825genoutput.o : genoutput.c $(RTL_H) $(build_xm_file) system.h
79d8453e 1826 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
3b80f6ca
RH
1827
1828gengenrtl : gengenrtl.o $(HOST_LIBDEPS)
1829 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
1830 gengenrtl.o $(HOST_LIBS)
1831
b04cd507 1832gengenrtl.o : gengenrtl.c $(RTL_BASE_H) system.h
3b80f6ca
RH
1833 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gengenrtl.c
1834
544eb21e 1835#\f
79d8453e
RS
1836# Compile the libraries to be used by gen*.
1837# If we are not cross-building, gen* use the same .o's that cc1 will use,
1838# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
1839# with the rules for rtl.o, alloca.o, etc.
0dfa1860 1840$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
79d8453e 1841 rm -f $(HOST_PREFIX)rtl.c
057f494b 1842 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
79d8453e
RS
1843 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
1844
dbfea53d
RH
1845$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H) \
1846 bitmap.h basic-block.h
d3614a37 1847 rm -f $(HOST_PREFIX)print-rtl.c
057f494b 1848 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
d3614a37
RS
1849 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
1850
0dfa1860 1851$(HOST_PREFIX_1)bitmap.o: $(srcdir)/bitmap.c $(CONFIG_H) system.h $(RTL_H) \
6feacd09 1852 flags.h $(BASIC_BLOCK_H) $(REGS_H)
0dfa1860
MM
1853 rm -f $(HOST_PREFIX)bitmap.c
1854 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/bitmap.c > $(HOST_PREFIX)bitmap.c
1855 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)bitmap.c
1856
79d8453e
RS
1857$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
1858 rm -f $(HOST_PREFIX)rtlanal.c
057f494b 1859 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
79d8453e
RS
1860 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
1861
39802f41 1862$(HOST_PREFIX_1)alloca.o: $(srcdir)/../libiberty/alloca.c
79d8453e 1863 rm -f $(HOST_PREFIX)alloca.c
39802f41 1864 $(LN_S) $(srcdir)/../libiberty/alloca.c $(HOST_PREFIX)alloca.c
79d8453e
RS
1865 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
1866
2bdfeefa 1867$(HOST_PREFIX_1)obstack.o: $(srcdir)/../libiberty/obstack.c
79d8453e 1868 rm -f $(HOST_PREFIX)obstack.c
2bdfeefa 1869 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/obstack.c > $(HOST_PREFIX)obstack.c
79d8453e
RS
1870 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
1871
2a63377c 1872$(HOST_PREFIX_1)vfprintf.o: $(srcdir)/../libiberty/vfprintf.c
76b4b31e 1873 rm -f $(HOST_PREFIX)vfprintf.c
39802f41 1874 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/vfprintf.c > $(HOST_PREFIX)vfprintf.c
76b4b31e
KG
1875 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)vfprintf.c
1876
1877$(HOST_PREFIX_1)doprint.o: doprint.c
1878 rm -f $(HOST_PREFIX)doprint.c
1879 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/doprint.c > $(HOST_PREFIX)doprint.c
1880 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)doprint.c
1881
79d8453e
RS
1882$(HOST_PREFIX_1)malloc.o: malloc.c
1883 rm -f $(HOST_PREFIX)malloc.c
057f494b 1884 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
79d8453e
RS
1885 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
1886
1887# This satisfies the dependency that we get if you cross-compile a compiler
1888# that does not need to compile alloca, malloc or whatever.
1889$(HOST_PREFIX_1):
1890 touch $(HOST_PREFIX_1)
ca695ac9 1891
ab87f8c8
JL
1892
1893#\f
1894# Remake internationalization support.
1895
1896intl.o: intl.c intl.h gansidecl.h Makefile
1897 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1898 -DLOCALEDIR=\"$(localedir)\" \
1899 -c `echo $(srcdir)/intl.c | sed 's,^\./,,'`
1900
1901# This is needed to when doing a partial build after a `make clean'.
1902# libintl.a does not depend on intl.all,
1903# as that would force a lot of recompiling.
1904$(top_builddir)/intl/libintl.a:
1905 @echo "$(MAKE) intl.all"
1906 @$(MAKE) $(FLAGS_TO_PASS) intl.all
1907
1908# Make sure all the headers are there for xgettext to scan.
a6374b58
AO
1909$(INTL_TARGETS): $(srcdir)/c-gperf.h \
1910 $(srcdir)/c-parse.c $(srcdir)/c-parse.h $(srcdir)/cexp.c
ab87f8c8
JL
1911
1912intl.all intl.install intl.uninstall intl.distdir \
1913 intl.mostlyclean intl.clean intl.distclean intl.maintainer-clean:
1914 @for d in $(INTL_SUBDIRS); do \
1915 target=`expr $@ : 'intl.\(.*\)'` && \
1916 echo "(cd $$d && $(MAKE) $$target)" && \
1917 (cd $$d && AWK='$(AWK)' $(MAKE) $(SUBDIR_FLAGS_TO_PASS) $$target); \
1918 done
1919
1920# intl.distdir doesn't copy the intl makefiles (since they aren't distributed),
1921# but we need them for the `make extraclean' in distdir-finish.
1922intl.distdir-fixup:
1923 for d in $(INTL_SUBDIRS); do \
1924 ln $$d/Makefile tmp/$$d || cp $$d/Makefile tmp/$$d || exit; \
1925 done
544eb21e 1926#\f
79d8453e
RS
1927# Remake cpp and protoize.
1928
1929# Making the preprocessor
e09e14e9 1930cpp$(exeext): $(CCCP)$(exeext)
173712fb 1931 -rm -f cpp$(exeext)
ac64120e 1932 $(LN) $(CCCP)$(exeext) cpp$(exeext)
ab87f8c8
JL
1933CCCP_OBJS = cccp.o cexp.o intl.o prefix.o version.o @extra_cpp_objs@ mbchar.o
1934cccp$(exeext): $(CCCP_OBJS) $(LIBDEPS)
1935 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(CCCP_OBJS) $(LIBS)
0056a9b5 1936cexp.o: $(srcdir)/cexp.c $(CONFIG_H) system.h
79d8453e
RS
1937 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
1938$(srcdir)/cexp.c: $(srcdir)/cexp.y
1939 cd $(srcdir); $(BISON) -o cexp.c cexp.y
aab26e16 1940
1f72bfca
JL
1941# We use $(libsubdir)/$(unlibsubdir) to match the
1942# -iprefix argument which gcc will pass if GCC_EXEC_PREFIX is used.
ab87f8c8
JL
1943cccp.o: cccp.c $(CONFIG_H) intl.h pcp.h version.c config.status system.h \
1944 mbchar.h prefix.h Makefile.in
79d8453e 1945 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
2e494f70 1946 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
8f8d3278 1947 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
6f144c9c 1948 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
91c7bd9b
JL
1949 -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
1950 -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
79d8453e
RS
1951 -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
1952
add7091b 1953LIBCPP_OBJS = cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \
5538ada6 1954 cppinit.o cppulp.o prefix.o version.o mbchar.o @extra_cpp_objs@
19283265 1955
f6c2a93c
JL
1956# All the other archives built/used by this makefile are for targets. This
1957# one is strictly for the host.
1958#
19283265 1959libcpp.a: $(LIBCPP_OBJS)
8f25d5cd
JW
1960 $(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS)
1961 if $(RANLIB_TEST) ; then $(RANLIB) libcpp.a ; else true ; fi
19283265
RH
1962
1963cppmain$(exeext): cppmain.o libcpp.a $(LIBDEPS)
1964 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cppmain$(exeext) cppmain.o \
1965 libcpp.a $(LIBS)
59949f60 1966
e915b770 1967cppmain.o: cppmain.c $(CONFIG_H) cpplib.h intl.h system.h
66334b64 1968
6de1e2a9 1969cppulp.o: cppulp.c $(CONFIG_H) system.h output.h
e915b770
KG
1970cpplib.o: cpplib.c $(CONFIG_H) cpplib.h intl.h system.h cpphash.h
1971cpphash.o: cpphash.c $(CONFIG_H) cpplib.h intl.h system.h cpphash.h
1972cppalloc.o: cppalloc.c $(CONFIG_H) cpplib.h intl.h system.h
1973cpperror.o: cpperror.c $(CONFIG_H) cpplib.h intl.h system.h
1974cppexp.o: cppexp.c $(CONFIG_H) cpplib.h intl.h system.h
1975cppfiles.o: cppfiles.c $(CONFIG_H) cpplib.h intl.h system.h
1976
1977cppinit.o: cppalloc.c $(CONFIG_H) cpplib.h intl.h system.h \
6de1e2a9 1978 cpphash.h prefix.h output.h Makefile
59949f60 1979 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
6f144c9c 1980 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
8f8d3278 1981 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
6f144c9c 1982 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
91c7bd9b
JL
1983 -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
1984 -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
6de1e2a9 1985 -c `echo $(srcdir)/cppinit.c | sed 's,^\./,,'`
5538ada6 1986
7bd95cc1
BK
1987# Note for the stamp targets, we run the program `true' instead of
1988# having an empty command (nothing following the semicolon).
1989
e09e14e9 1990proto: config.status protoize$(exeext) unprotoize$(exeext) SYSCALLS.c.X
79d8453e 1991
917acb0e 1992PROTO_OBJS = getpwd.o intl.o version.o
ab87f8c8
JL
1993
1994protoize$(exeext): protoize.o $(PROTO_OBJS) $(LIBDEPS)
1995 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ protoize.o $(PROTO_OBJS) $(LIBS)
2e0b13db 1996
ab87f8c8
JL
1997unprotoize$(exeext): unprotoize.o $(PROTO_OBJS) $(LIBDEPS)
1998 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ unprotoize.o $(PROTO_OBJS) $(LIBS)
2e0b13db 1999
196fb9ff
JL
2000protoize.o: protoize.c $(srcdir)/../include/getopt.h $(CONFIG_H) system.h \
2001 Makefile
79d8453e
RS
2002 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
2003 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
8f8d3278 2004 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
91c7bd9b
JL
2005 -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
2006 -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
3d5e2367 2007 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
79d8453e 2008 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
6c32c807
BH
2009 $(srcdir)/protoize.c
2010
196fb9ff
JL
2011unprotoize.o: unprotoize.c protoize.c $(srcdir)/../include/getopt.h \
2012 $(CONFIG_H) system.h Makefile
79d8453e
RS
2013 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
2014 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
8f8d3278 2015 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
91c7bd9b
JL
2016 -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
2017 -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
3d5e2367 2018 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
79d8453e 2019 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
6c32c807 2020 $(srcdir)/unprotoize.c
79d8453e 2021
79d8453e 2022# This info describes the target machine, so compile with GCC just built.
aab26e16
RK
2023SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \
2024 stmp-int-hdrs
c21cf0a7 2025 -rm -f SYSCALLS.c tmp-SYSCALLS.s
47547081 2026 cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
79d8453e 2027 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
c21cf0a7
RS
2028 -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
2029 -rm -f SYSCALLS.c tmp-SYSCALLS.s
9c0022f6 2030
ac1284f9 2031
9c0022f6 2032test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
4803a34a 2033 -rm -f tmp-proto.[cso]
d3614a37
RS
2034 cp $(srcdir)/protoize.c tmp-proto.c
2035 chmod u+w tmp-proto.c
4803a34a
RK
2036 ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
2037 $(CFLAGS) $(INCLUDES) \
9c0022f6
RS
2038 -DGCC_INCLUDE_DIR=0 \
2039 -DGPLUSPLUS_INCLUDE_DIR=0 \
2040 -DCROSS_INCLUDE_DIR=0 \
14b18068 2041 -DTOOL_INCLUDE_DIR=0 \
d3614a37 2042 -DSTD_PROTO_DIR=0" tmp-proto.c
e3e873d2 2043 @echo '**********' Expect 400 lines of differences.
4803a34a
RK
2044 -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
2045 -wc -l tmp-proto.diff
2046 ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
2047 $(CFLAGS) $(INCLUDES) \
9c0022f6
RS
2048 -DGCC_INCLUDE_DIR=0 \
2049 -DGPLUSPLUS_INCLUDE_DIR=0 \
2050 -DCROSS_INCLUDE_DIR=0 \
14b18068 2051 -DTOOL_INCLUDE_DIR=0 \
d3614a37 2052 -DSTD_PROTO_DIR=0" tmp-proto.c
9c0022f6 2053 @echo Expect zero differences.
d3614a37 2054 diff $(srcdir)/protoize.c tmp-proto.c | cat
aab26e16 2055 -rm -f tmp-proto.[cs] tmp-proto$(objext)
59a64126 2056
ab87f8c8 2057gcov.o: gcov.c gcov-io.h intl.h system.h
59a64126 2058
2ea9a965
NC
2059# Only one of 'gcov' or 'gcov.exe' is actually built, depending
2060# upon whether $(exeext) is empty or not.
ab87f8c8
JL
2061GCOV_OBJS = gcov.o intl.o
2062gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS)
2063 $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(GCOV_OBJS) $(LIBS) -o $@
544eb21e 2064#\f
ba1811f1 2065# Build the include directory. The stamp files are stmp-* rather than
e5e809f4 2066# s-* so that mostlyclean does not force the include directory to
ba1811f1
ILT
2067# be rebuilt.
2068
e7f62ad3 2069# Build the include directory including float.h (which no longer depends upon
56f9206d 2070# enquire).
027ea2a7 2071stmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h
ba1811f1
ILT
2072# Copy in the headers provided with gcc.
2073# The sed command gets just the last file name component;
2074# this is necessary because VPATH could add a dirname.
2075# Using basename would be simpler, but some systems don't have it.
c85f7c16 2076# The touch command is here to workaround an AIX/Linux NFS bug.
d7371761
RK
2077 for file in .. $(USER_H); do \
2078 if [ X$$file != X.. ]; then \
2079 realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
c85f7c16 2080 touch include/$$realfile; \
ae678a13
JW
2081 rm -f include/$$realfile; \
2082 cp $$file include; \
2083 chmod a+r include/$$realfile; \
d7371761 2084 fi; \
ba1811f1 2085 done
1f050b9b 2086 rm -f include/limits.h
ba1811f1
ILT
2087 cp xlimits.h include/limits.h
2088 chmod a+r include/limits.h
56f9206d 2089 rm -f include/float.h
027ea2a7
JW
2090 if [ x$(FLOAT_H) != xMakefile.in ]; then \
2091 cp $(srcdir)/config/$(FLOAT_H) include/float.h && \
e9a25f70
JL
2092 chmod a+r include/float.h; \
2093 else :; fi
e7f62ad3
MH
2094# Install the README
2095 rm -f include/README
2096 cp $(srcdir)/README-fixinc include/README
2097 chmod a+r include/README
2098 touch $@
2099
027ea2a7 2100# Now that float.h no longer depends upon enquire, this is actually a no-op.
e7f62ad3
MH
2101stmp-headers:
2102 touch $@
ba1811f1 2103
9f3d1bc2
BK
2104fixinc.sh: $(srcdir)/fixinc/mkfixinc.sh
2105 MAKE="$(MAKE)"; srcdir=`cd $(srcdir)/fixinc; pwd` ; \
2106 export MAKE srcdir ; \
2107 cd ./fixinc; $(SHELL) $${srcdir}/mkfixinc.sh $(target)
2108
2109##stmp-fixinc: $(FIXINCLUDES) gsyslimits.h
2110## rm -rf include
2111## mkdir include
2112## if [ x$(FIXINCLUDES) != xMakefile.in ]; \
2113## then \
2114## for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
2115## if [ -d $$dir ]; \
2116## then \
2117## $(SHELL) $(srcdir)/$(FIXINCLUDES) include $$dir; \
2118## else true; fi; \
2119## done; \
2120## if [ x$(INSTALL_ASSERT_H) != x ] ; \
2121## then \
2122## rm -f include/assert.h; \
2123## cp $(srcdir)/assert.h include/assert.h; \
2124## chmod a+r include/assert.h; \
2125## fi \
2126## else true; \
2127## fi
4b104d6e 2128
ba1811f1 2129# Build fixed copies of system files.
9f3d1bc2
BK
2130stmp-fixinc: fixinc.sh gsyslimits.h
2131 rm -rf include; mkdir include
2132 TARGET_MACHINE=$(target); srcdir=`cd $(srcdir); pwd`; \
2133 INSTALL_ASSERT_H=$(INSTALL_ASSERT_H); \
2134 export TARGET_MACHINE srcdir INSTALL_ASSERT_H; \
2135 $(SHELL) ./fixinc.sh `pwd`/include $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS)
3dc4a939
RK
2136 rm -f include/syslimits.h
2137 if [ -f include/limits.h ]; then \
2138 mv include/limits.h include/syslimits.h; \
2139 else \
2140 cp $(srcdir)/gsyslimits.h include/syslimits.h; \
2141 fi
2142 chmod a+r include/syslimits.h
91c7bd9b 2143# If $(SYSTEM_HEADER_DIR) is $(gcc_tooldir)/sys-include, and
1f72bfca 2144# that directory exists, then make sure that $(libsubdir) exists.
91c7bd9b 2145# This is because cpp is compiled to find $(gcc_tooldir)/include via
1f72bfca
JL
2146# $(libsubdir)/$(unlibsubdir), which will only work if $(libsubdir)
2147# exists.
91c7bd9b
JL
2148 if [ "$(SYSTEM_HEADER_DIR)" = "$(gcc_tooldir)/sys-include" ] \
2149 && [ -d $(gcc_tooldir)/sys-include ]; then \
1f72bfca
JL
2150 if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi; \
2151 if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib; fi; \
2152 if [ -d $(libdir)/gcc-lib/$(target_alias) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias) ; fi; \
2153 if [ -d $(libdir)/gcc-lib/$(target_alias)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias)/$(version) ; fi; \
2154 else true; fi
2155
49b6e255 2156 touch stmp-fixinc
469778e2 2157
ac1284f9
PB
2158# Files related to the fixproto script.
2159
74bb4fdf 2160deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
40859b41
JL
2161 if [ -d $(SYSTEM_HEADER_DIR) ]; \
2162 then \
2163 CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -Iinclude -I${SYSTEM_HEADER_DIR}"; \
ac1284f9 2164 export CC; \
40859b41
JL
2165 $(SHELL) $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h; \
2166 mv tmp-deduced.h deduced.h; \
2167 else \
2168 touch deduced.h; \
2169 fi
ac1284f9 2170
850350d1 2171GEN_PROTOS_OBJS = gen-protos.o scan.o libcpp.a
ab87f8c8 2172gen-protos: $(GEN_PROTOS_OBJS) $(HOST_LIBDEPS)
850350d1 2173 ${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o gen-protos \
ab87f8c8 2174 $(GEN_PROTOS_OBJS) $(HOST_LIBS)
ac1284f9 2175
b04cd507 2176gen-protos.o: gen-protos.c scan.h $(build_xm_file) system.h
c192da27
RK
2177 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c
2178
b04cd507 2179scan.o: scan.c scan.h $(build_xm_file) system.h
c192da27 2180 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c
7b41f815 2181
74bb4fdf 2182xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
d521a023
RK
2183 cat deduced.h $(srcdir)/sys-protos.h > tmp-fixtmp.c
2184 mv tmp-fixtmp.c fixtmp.c
c061c5d7 2185 $(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
c1b9947f 2186 | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
d521a023
RK
2187 | ./gen-protos >xsys-protos.hT
2188 mv xsys-protos.hT xsys-protos.h
d7a58f93 2189 rm -rf fixtmp.c
ac1284f9 2190
aab26e16 2191fix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS) \
19283265 2192 libcpp.a
aab26e16 2193 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ fix-header.o \
19283265 2194 scan-decls.o scan.o libcpp.a $(HOST_LIBS)
ac1284f9 2195
2bdfeefa 2196fix-header.o: fix-header.c $(srcdir)/../include/obstack.h scan.h \
e915b770 2197 xsys-protos.h $(build_xm_file) system.h cpplib.h cpphash.h
c192da27
RK
2198 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c
2199
e915b770 2200scan-decls.o: scan-decls.c scan.h cpplib.h $(build_xm_file) system.h
c192da27 2201 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c
ac1284f9 2202
74bb4fdf
RS
2203# stmp-fixproto depends on this, not on fix-header directly.
2204# The idea is to make sure fix-header gets built,
2205# but not rerun fixproto after each stage
2206# just because fix-header's mtime has changed.
2207fixhdr.ready: fix-header
2208 -if [ -f fixhdr.ready ] ; then \
2209 true; \
2210 else \
2211 touch fixhdr.ready; \
2212 fi
2213
ccaf7a07 2214# stmp-headers is to make sure fixincludes has already finished.
700ba19c
RS
2215# The if statement is so that we don't run fixproto a second time
2216# if it has already been run on the files in `include'.
c28464ad 2217stmp-fixproto: fixhdr.ready fixproto stmp-headers
db4e119f 2218 @echo "Various warnings and error messages from fixproto are normal"
70fbceee 2219 -if [ -d include ] ; then true; else mkdir include; fi
6e5bea54 2220 -if [ -f include/fixed ] ; then true; \
700ba19c 2221 else \
b1f99e2f 2222 : This line works around a 'make' bug in BSDI 1.1.; \
b3ca463c 2223 FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
aef1617c
JL
2224 if [ -d $(SYSTEM_HEADER_DIR) ] ; then \
2225 $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
2226 else true; fi; \
700ba19c
RS
2227 touch include/fixed; \
2228 fi
ac1284f9 2229 touch stmp-fixproto
544eb21e 2230#\f
79d8453e
RS
2231# Remake the info files.
2232
8dbda01e 2233doc: info
8be52aaa 2234info: cpp.info gcc.info lang.info
79d8453e 2235
8be52aaa 2236cpp.info: $(srcdir)/cpp.texi
c1879238 2237 $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o cpp.info $(srcdir)/cpp.texi
79d8453e 2238
8be52aaa
JL
2239gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
2240 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
2241 $(srcdir)/tm.texi $(srcdir)/gcov.texi
c1879238 2242 $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o gcc.info $(srcdir)/gcc.texi
f780d21b 2243
8be52aaa 2244dvi: gcc.dvi cpp.dvi lang.dvi
8dbda01e 2245
dd08cdda 2246# This works with GNU Make's default rule.
8be52aaa
JL
2247gcc.dvi: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
2248 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
2249 $(srcdir)/tm.texi $(srcdir)/gcov.texi
2250 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
2251 texindex gcc.??
2252 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
2253
2254cpp.dvi: $(srcdir)/cpp.texi
2255 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
2256 texindex cpp.??
2257 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
2258
2259
2260INSTALL: $(srcdir)/install1.texi $(srcdir)/install.texi
b4ea9a9d 2261 cd $(srcdir); $(MAKEINFO) -D INSTALLONLY \
1442f4eb 2262 --no-split -o INSTALL install1.texi
544eb21e 2263#\f
79d8453e
RS
2264# Deletion of files made during compilation.
2265# There are four levels of this:
f1908d70 2266# `mostlyclean', `clean', `distclean' and `maintainer-clean'.
79d8453e 2267# `mostlyclean' is useful while working on a particular type of machine.
2e494f70 2268# It deletes most, but not all, of the files made by compilation.
79d8453e 2269# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
2e494f70 2270# `clean' deletes everything made by running `make all'.
47547081 2271# `distclean' also deletes the files made by config.
f1908d70 2272# `maintainer-clean' also deletes everything that could be regenerated
63d9b81c
RK
2273# automatically, except for `configure'.
2274# We remove as much from the language subdirectories as we can
013a2ee0 2275# (less duplicated code).
79d8453e 2276
47547081 2277
ab87f8c8 2278mostlyclean: intl.mostlyclean lang.mostlyclean
79d8453e
RS
2279 -rm -f $(STAGESTUFF)
2280# Delete the temporary source copies for cross compilation.
2281 -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
2282 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
2283 -rm -f $(HOST_PREFIX_1)obstack.c
2284# Delete the temp files made in the course of building libgcc.a.
ee291069 2285 -rm -f tmplibgcc* tmpcopy xlimits.h libgcc1-test
79d8453e 2286 for name in $(LIB1FUNCS); do rm -f $${name}.c; done
e5e809f4
JL
2287# Delete other built files.
2288 -rm -f t-float.h-cross xsys-protos.hT fp-bit.c dp-bit.c
2289# Delete the stamp and temporary files.
2290 -rm -f s-* tmp-* stamp-* stmp-*
013a2ee0 2291 -rm -f */stamp-* */tmp-*
2e494f70 2292# Delete debugging dump files.
79d8453e 2293 -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
7506f491 2294 -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.addressof
b85f4db3 2295 -rm -f *.regmove *.mach *.bp *.gcse *.flow2
013a2ee0
DE
2296 -rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl
2297 -rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2
b85f4db3 2298 -rm -f */*.sched2 */*.stack */*.regmove */*.gcse */*.flow2
2e494f70 2299# Delete some files made during installation.
027ea2a7 2300 -rm -f specs float.h-* enquire SYSCALLS.c.X SYSCALLS.c
813fc11c 2301 -rm -f collect collect2 mips-tfile mips-tdump alloca.s
ac1284f9 2302# Delete files generated for fixproto
1162b3a6 2303 -rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \
02521409 2304 gen-protos fixproto.list fixtmp.* fixhdr.ready
2e494f70
RS
2305# Delete unwanted output files from TeX.
2306 -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
013a2ee0 2307 -rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg
47547081
RS
2308# Delete sorted indices we don't actually use.
2309 -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
2e494f70 2310# Delete core dumps.
013a2ee0 2311 -rm -f core */core
59a64126 2312 -rm -f *.bp */*.bp
79d8453e 2313
47547081
RS
2314# Delete all files made by compilation
2315# that don't exist in the distribution.
ab87f8c8 2316clean: mostlyclean intl.clean lang.clean
20bd0ab1
RS
2317# It may not be quite desirable to delete unprotoize.c here,
2318# but the spec for `make clean' requires it.
2319# Using unprotoize.c is not quite right in the first place,
2320# but what better way is there?
8521c499 2321 -rm -f libgcc.a libgcc1.a libgcc1-asm.a libgcc2.a libgcc2.ready
43554690 2322 -rm -f libgcc1.null
be0d23ff 2323 -rm -f *.dvi
013a2ee0 2324 -rm -f */*.dvi
c3efc7c4
DE
2325 -if [ -f md.pre-cpp ]; then \
2326 rm -f md ; \
2327 fi
ba1811f1 2328# Delete the include directory.
e5e809f4 2329 -rm -rf include
75ed5d8b 2330# Delete files used by the "multilib" facility (including libgcc subdirs).
f6cdc7ea 2331 -rm -f multilib.h tmpmultilib*
75ed5d8b
DE
2332 -if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \
2333 rm -rf $(MULTILIB_DIRNAMES); \
2334 else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \
2335 rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \
2336 fi ; fi
5768f211 2337 -rm -fr stage1 stage2 stage3 stage4
79d8453e 2338
47547081
RS
2339# Delete all files that users would normally create
2340# while building and installing GCC.
ab87f8c8
JL
2341INTL_DISTCLEAN = intl.distclean
2342distclean: clean $(INTL_DISTCLEAN) lang.distclean
b7cb92ad
JL
2343 -rm -f tm.h config.h auto-host.h auto-build.h tconfig.h hconfig.h
2344 -rm -f md cstamp-h
63d9b81c 2345 -rm -f config.status config.run config.cache config.bak
d232dfa4 2346 -rm -f Make-lang Make-hooks Make-host Make-target
3103b7db 2347 -rm -f Makefile specs.h options.h gencheck.h *.oaux
f24af81b 2348 -rm -f gthr-default.h
26f887e5 2349 -rm -f */stage1 */stage2 */stage3 */stage4 */include
3dab45b7 2350 -rm -f c-parse.output
338023d4 2351 -rm -f *.asm
67446ffe 2352 -rm -f float.h
a051ad3a
JL
2353 -rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak
2354 -rm -f testsuite/{gcc,g++}.{log,sum}
ab87f8c8 2355 -rm -f intl/libintl.h libintl.h
2e494f70
RS
2356
2357# Delete anything likely to be found in the source directory
2358# that shouldn't be in the distribution.
013a2ee0 2359extraclean: distclean lang.extraclean
fb92d909 2360 -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
be0d23ff 2361 -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
3dab45b7
RS
2362 -rm -f config/*/=* config/*/"#"* config/*/*~*
2363 -rm -f config/*/*.orig config/*/*.rej
d72a7857 2364 -rm -f *.dvi *.ps *.oaux *.d *.[zZ] *.gz
184be4bf 2365 -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
3dab45b7 2366 -rm -f *lose config/*lose config/*/*lose
e5e809f4 2367 -rm -f *.s *.s[0-9] *.i config/ChangeLog
ab87f8c8 2368 -rm -f y.tab.c yacc.*
013a2ee0
DE
2369 -rm -f */=* */"#"* */*~*
2370 -rm -f */patch* */*.orig */*.rej
2371 -rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz
2372 -rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs
2373 -rm -f */*lose */*.s */*.s[0-9] */*.i
79d8453e 2374
63d9b81c 2375# Get rid of every file that's generated from some other file, except for `configure'.
79d8453e 2376# Most of these files ARE PRESENT in the GCC distribution.
ab87f8c8
JL
2377# We define INTL_DISTCLEAN to be empty in the submake, so that
2378# we don't descend into intl after its makefile has been removed.
63d9b81c
RK
2379maintainer-clean:
2380 @echo 'This command is intended for maintainers to use; it'
2381 @echo 'deletes files that may need special tools to rebuild.'
ab87f8c8
JL
2382 $(MAKE) INTL_DISTCLEAN= distclean \
2383 intl.maintainer-clean lang.maintainer-clean
3379e8ef 2384 -rm -f c-parse.y c-gperf.h
79d8453e
RS
2385 -rm -f c-parse.c c-parse.h c-parse.output
2386 -rm -f cexp.c cexp.output TAGS
2e494f70
RS
2387 -rm -f cpp.info* cpp.??s cpp.*aux
2388 -rm -f gcc.info* gcc.??s gcc.*aux
544eb21e 2389#\f
79d8453e 2390# Entry points `install' and `uninstall'.
2e494f70 2391# Also use `install-collect2' to install collect2 when the config files don't.
79d8453e 2392
1402d22c 2393# The semicolon is to prevent the install.sh -> install default rule
7bd95cc1
BK
2394# from doing anything. Having it run true helps avoid problems and
2395# noise from versions of make which don't like to have null commands.
d960abef 2396install: $(INSTALL_TARGET) ; @true
79d8453e 2397
ba1811f1 2398# Copy the compiler files into directories where they will be run.
aab26e16
RK
2399# Install the driver last so that the window when things are
2400# broken is small.
b583eed8 2401install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
587a4ba6
L
2402 $(INSTALL_CPP) install-man install-info intl.install lang.install-normal \
2403 install-driver
79d8453e 2404
057f494b
RS
2405# Do nothing while making gcc with a cross-compiler. The person who
2406# makes gcc for the target machine has to know how to put a complete
2407# gcc together by hand.
2408install-build: force
2409 @echo You have to install gcc on your target machine by hand.
2410
79d8453e
RS
2411# Run this on the target machine
2412# to finish installation of cross compiler.
027ea2a7 2413# This is not used anymore now that float.h does not depend on enquire.
79d8453e
RS
2414install-cross-rest: install-float-h-cross
2415
587a4ba6
L
2416# Handle cpp installation.
2417install-cpp: cpp.sh
2418 -rm -f $(bindir)/cpp
2419 $(INSTALL_PROGRAM) -m 755 cpp.sh $(bindir)/cpp
2420 if [ x$(cpp_install_dir) != x ]; then \
2421 rm -f $(prefix)/$(cpp_install_dir)/cpp; \
2422 $(INSTALL_PROGRAM) -m 755 cpp.sh $(prefix)/$(cpp_install_dir)/cpp; \
2423 else true; fi
2424
2425uninstall-cpp:
2426 -rm -f $(bindir)/cpp
2427 -if [ x$(cpp_install_dir) != x ]; then \
2428 rm -f $(prefix)/$(cpp_install_dir)/cpp; \
2429 else true; fi
2430
79d8453e
RS
2431# Install float.h for cross compiler.
2432# Run this on the target machine!
027ea2a7 2433# This is not used anymore now that float.h does not depend on enquire.
69cbb85a 2434install-float-h-cross: installdirs
3f7531db
RS
2435# if [ -f enquire ] ; then true; else false; fi
2436# Note: don't use -. We should fail right away if enquire was not made.
2437 ./enquire -f > $(tmpdir)/float.h
79d8453e 2438 -rm -f $(libsubdir)/include/float.h
62c13b81
RS
2439 $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
2440 -rm -f $(tmpdir)/float.h
79d8453e
RS
2441 chmod a-x $(libsubdir)/include/float.h
2442
69cbb85a
RK
2443# Create the installation directories.
2444installdirs:
2445 -if [ -d $(prefix) ] ; then true ; else mkdir $(prefix) ; chmod a+rx $(prefix) ; fi
2446 -if [ -d $(exec_prefix) ] ; then true ; else mkdir $(exec_prefix) ; chmod a+rx $(exec_prefix) ; fi
394fa7c8
JW
2447 -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
2448 -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi
9eb91772 2449# This dir isn't currently searched by cpp.
394fa7c8 2450# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
05fd993d
MH
2451 -fdir= ; for dir in `echo $(libsubdir) | tr '/' ' '`; do \
2452 fdir=$${fdir}/$${dir}; \
2453 if [ -d $${fdir} ] ; then true ; else mkdir $${fdir}; chmod a+rx $${fdir}; fi ; \
2454 done
394fa7c8
JW
2455 -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
2456 -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
91c7bd9b 2457 -if [ -d $(gcc_tooldir) ] ; then true ; else mkdir $(gcc_tooldir) ; chmod a+rx $(gcc_tooldir) ; fi
394fa7c8
JW
2458 -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
2459 -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
a76b6b40 2460# We don't use mkdir -p to create the parents of man1dir,
79d8453e 2461# because some systems don't support it.
a76b6b40
MH
2462# Instead, we use this technique to create the immediate parent of man1dir.
2463 -parent=`echo $(man1dir)|sed -e 's@/[^/]*$$@@'`; \
394fa7c8 2464 if [ -d $$parent ] ; then true ; else mkdir $$parent ; chmod a+rx $$parent ; fi
a76b6b40 2465 -if [ -d $(man1dir) ] ; then true ; else mkdir $(man1dir) ; chmod a+rx $(man1dir) ; fi
79d8453e
RS
2466
2467# Install the compiler executables built during cross compilation.
69cbb85a 2468install-common: native installdirs $(EXTRA_PARTS) lang.install-common
79d8453e
RS
2469 for file in $(COMPILERS); do \
2470 if [ -f $$file ] ; then \
2471 rm -f $(libsubdir)/$$file; \
2472 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
2473 else true; \
2474 fi; \
2475 done
2fe8d2d6 2476 for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
79d8453e
RS
2477 if [ x"$$file" != x.. ]; then \
2478 rm -f $(libsubdir)/$$file; \
2479 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
2480 else true; fi; \
2481 done
2fe8d2d6
RK
2482 for file in $(EXTRA_PARTS) ..; do \
2483 if [ x"$$file" != x.. ]; then \
2484 rm -f $(libsubdir)/$$file; \
2485 $(INSTALL_DATA) $$file $(libsubdir)/$$file; \
e9a25f70 2486 chmod a-x $(libsubdir)/$$file; \
2fe8d2d6
RK
2487 else true; fi; \
2488 done
f0ec1f64 2489# Don't mess with specs if it doesn't exist yet.
2a7bccbb
TG
2490 -if [ -f specs ] ; then \
2491 rm -f $(libsubdir)/specs; \
f0ec1f64 2492 $(INSTALL_DATA) specs $(libsubdir)/specs; \
e9a25f70 2493 chmod a-x $(libsubdir)/specs; \
f0ec1f64 2494 fi
aab26e16
RK
2495# Install protoize if it was compiled.
2496 -if [ -f protoize$(exeext) ]; \
2497 then \
225695a4
JW
2498 if [ -f gcc-cross$(exeext) ] ; then \
2499 rm -f $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \
2500 $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \
2501 rm -f $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \
2502 $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \
2503 else \
2504 rm -f $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \
2505 $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \
2506 rm -f $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \
2507 $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \
2508 fi ; \
aab26e16
RK
2509 rm -f $(libsubdir)/SYSCALLS.c.X; \
2510 $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
2511 chmod a-x $(libsubdir)/SYSCALLS.c.X; \
2512 fi
2513 -rm -f $(libsubdir)/cpp$(exeext)
2514 $(INSTALL_PROGRAM) cpp$(exeext) $(libsubdir)/cpp$(exeext)
ca363bb6 2515# Install gcov if it was compiled.
59a64126
DE
2516 -if [ -f gcov$(exeext) ]; \
2517 then \
2518 rm -f $(bindir)/gcov$(exeext); \
23473647 2519 $(INSTALL_PROGRAM) gcov$(exeext) $(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \
59a64126 2520 fi
aab26e16 2521
8b06b20a 2522# Install the driver program as $(target_alias)-gcc
91c7bd9b 2523# and also as either gcc (if native) or $(gcc_tooldir)/bin/gcc.
e09e14e9 2524install-driver: xgcc$(exeext)
173712fb
RK
2525 -if [ -f gcc-cross$(exeext) ] ; then \
2526 rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
94a8b9fe 2527 $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
91c7bd9b
JL
2528 if [ -d $(gcc_tooldir)/bin/. ] ; then \
2529 rm -f $(gcc_tooldir)/bin/gcc$(exeext); \
2530 $(INSTALL_PROGRAM) gcc-cross$(exeext) $(gcc_tooldir)/bin/gcc$(exeext); \
79d8453e
RS
2531 else true; fi; \
2532 else \
173712fb
RK
2533 rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
2534 $(INSTALL_PROGRAM) xgcc$(exeext) $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
8b06b20a 2535 rm -f $(bindir)/$(target_alias)-gcc-1$(exeext); \
ac64120e 2536 $(LN) $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext); \
8b06b20a 2537 mv $(bindir)/$(target_alias)-gcc-1$(exeext) $(bindir)/$(target_alias)-gcc$(exeext); \
79d8453e 2538 fi
79d8453e 2539
0b2fbcb2 2540# Install the info files.
feb9ea1a 2541# $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
ee5b121e 2542# to do the install.
69cbb85a 2543install-info: doc installdirs lang.install-info
0b2fbcb2 2544 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
8be52aaa 2545 for f in cpp.info* gcc.info*; do \
ee5b121e 2546 $(INSTALL_DATA) $$f $(infodir)/$$f; \
feb9ea1a 2547 done
ee5b121e 2548 -if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
f8c86b58 2549 if [ -f $(infodir)/dir ] ; then \
265ce5bb 2550 for f in cpp.info gcc.info; do \
ee5b121e 2551 install-info --dir-file=$(infodir)/dir $(infodir)/$$f; \
265ce5bb 2552 done; \
f8c86b58 2553 else true; fi; \
265ce5bb 2554 else true; fi;
0b2fbcb2
RS
2555 -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
2556
79d8453e 2557# Install the man pages.
69cbb85a 2558install-man: installdirs $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man
e9a25f70 2559 -if [ -f gcc-cross$(exeext) ] ; then \
a76b6b40
MH
2560 rm -f $(man1dir)/$(GCC_CROSS_NAME)$(manext); \
2561 $(INSTALL_DATA) $(srcdir)/gcc.1 $(man1dir)/$(GCC_CROSS_NAME)$(manext); \
2562 chmod a-x $(man1dir)/$(GCC_CROSS_NAME)$(manext); \
338023d4 2563 else \
a76b6b40
MH
2564 rm -f $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
2565 $(INSTALL_DATA) $(srcdir)/gcc.1 $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
2566 chmod a-x $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
338023d4 2567 fi
a76b6b40
MH
2568 -rm -f $(man1dir)/cccp$(manext)
2569 -$(INSTALL_DATA) $(srcdir)/cccp.1 $(man1dir)/cccp$(manext)
2570 -chmod a-x $(man1dir)/cccp$(manext)
79d8453e
RS
2571
2572# Install the library.
69cbb85a 2573install-libgcc: libgcc.a installdirs
79d8453e
RS
2574 -if [ -f libgcc.a ] ; then \
2575 rm -f $(libsubdir)/libgcc.a; \
2576 $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
8f25d5cd
JW
2577 if $(RANLIB_TEST_FOR_TARGET) ; then \
2578 (cd $(libsubdir); $(RANLIB_FOR_TARGET) libgcc.a); else true; fi; \
79d8453e
RS
2579 chmod a-x $(libsubdir)/libgcc.a; \
2580 else true; fi
2581
f6cdc7ea 2582# Install multiple versions of libgcc.a.
69cbb85a 2583install-multilib: stmp-multilib installdirs
f6cdc7ea
DE
2584 for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
2585 dir=`echo $$i | sed -e 's/;.*$$//'`; \
2586 if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \
47a22692
JM
2587 for f in libgcc.a $(EXTRA_MULTILIB_PARTS); do \
2588 rm -f $(libsubdir)/$${dir}/$${f}; \
2589 $(INSTALL_DATA) $${dir}/$${f} $(libsubdir)/$${dir}/$${f}; \
2590 done; \
8f25d5cd
JW
2591 if $(RANLIB_TEST_FOR_TARGET); then \
2592 (cd $(libsubdir)/$${dir}; $(RANLIB_FOR_TARGET) libgcc.a); \
2593 else true; fi; \
f6cdc7ea
DE
2594 chmod a-x $(libsubdir)/$${dir}/libgcc.a; \
2595 done
2596
ba1811f1 2597# Install all the header files built in the include subdirectory.
d7371761 2598install-headers: install-include-dir $(INSTALL_HEADERS_DIR) $(INSTALL_ASSERT_H)
ba1811f1
ILT
2599# Fix symlinks to absolute paths in the installed include directory to
2600# point to the installed directory, not the build directory.
ac64120e 2601# Don't need to use LN_S here since we really do need ln -s and no substitutes.
ba1811f1
ILT
2602 -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
2603 if [ $$? -eq 0 ]; then \
2604 dir=`cd include; pwd`; \
2605 for i in $$files; do \
2606 dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
2607 if expr "$$dest" : "$$dir.*" > /dev/null; then \
2608 rm -f $(libsubdir)/include/$$i; \
44735512 2609 ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
ba1811f1
ILT
2610 fi; \
2611 done; \
2612 fi
79d8453e 2613
ba1811f1 2614# Create or recreate the gcc private include file directory.
69cbb85a 2615install-include-dir: installdirs
ba1811f1
ILT
2616 -rm -rf $(libsubdir)/include
2617 mkdir $(libsubdir)/include
2618 -chmod a+rx $(libsubdir)/include
2619
2620# Install the include directory using tar.
ac1284f9 2621install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
78ea9cda 2622 (cd include; \
6e5bea54 2623 tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
e6431ec5
RS
2624# /bin/sh on some systems returns the status of the first tar,
2625# and that can lose with GNU tar which always writes a full block.
2626# So use `exit 0' to ignore its exit status.
ba1811f1
ILT
2627
2628# Install the include directory using cpio.
ac1284f9 2629install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
609f7031 2630 (cd include; find . -print) | (cd include; cpio -pdum $(libsubdir)/include)
79d8453e 2631
49ba557e
RS
2632# Put assert.h where it won't override GNU libc's assert.h.
2633# It goes in a dir that is searched after GNU libc's headers;
2634# thus, the following conditionals are no longer needed.
2635# But it's not worth deleting them now.
2636## Don't replace the assert.h already there if it is not from GCC.
2637## This code would be simpler if it tested for -f ... && ! grep ...
2638## but supposedly the ! operator is missing in sh on some systems.
69cbb85a 2639install-assert-h: assert.h installdirs
c9d929d7
RS
2640 if [ -f $(assertdir)/assert.h ]; \
2641 then \
998812ac 2642 if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
396f9edb 2643 then \
c9d929d7
RS
2644 rm -f $(assertdir)/assert.h; \
2645 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
0cd4060d 2646 chmod a-x $(assertdir)/assert.h; \
c9d929d7
RS
2647 else true; \
2648 fi; \
9fcedbef 2649 else \
6204c24f
RS
2650 rm -f $(assertdir)/assert.h; \
2651 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
0cd4060d 2652 chmod a-x $(assertdir)/assert.h; \
9fcedbef 2653 fi
79d8453e 2654
10da1131 2655# Use this target to install the program `collect2' under the name `collect2'.
69cbb85a 2656install-collect2: collect2 installdirs
10da1131 2657 $(INSTALL_PROGRAM) collect2$(exeext) $(libsubdir)/collect2$(exeext)
2e494f70 2658# Install the driver program as $(libsubdir)/gcc for collect2.
173712fb 2659 $(INSTALL_PROGRAM) xgcc$(exeext) $(libsubdir)/gcc$(exeext)
2e494f70 2660
79d8453e 2661# Cancel installation by deleting the installed files.
587a4ba6 2662uninstall: intl.uninstall lang.uninstall $(UNINSTALL_CPP)
79d8453e 2663 -rm -rf $(libsubdir)
173712fb
RK
2664 -rm -rf $(bindir)/$(GCC_INSTALL_NAME)$(exeext)
2665 -rm -rf $(bindir)/$(GCC_CROSS_NAME)$(exeext)
23473647
NS
2666 -rm -rf $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext)
2667 -rm -rf $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext)
2668 -rm -rf $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext)
2669 -rm -rf $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext)
2670 -rm -rf $(bindir)/$(GCOV_INSTALL_NAME)$(exeext)
a76b6b40
MH
2671 -rm -rf $(man1dir)/$(GCC_INSTALL_NAME)$(manext)
2672 -rm -rf $(man1dir)/$(GCC_CROSS_NAME)$(manext)
2673 -rm -rf $(man1dir)/cccp$(manext)
2674 -rm -rf $(man1dir)/protoize$(manext)
2675 -rm -rf $(man1dir)/unprotoize$(manext)
9ec36da5 2676 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
544eb21e 2677#\f
e933cbe0
JL
2678# These targets are for the dejagnu testsuites. The file site.exp
2679# contains global variables that all the testsuites will use.
2680
2681# Set to $(target_alias)/ for cross.
2682target_subdir = @target_subdir@
2683
2684site.exp: ./config.status Makefile
2685 @echo "Making a new config file..."
2686 -@rm -f ./tmp?
2687 @touch site.exp
2688 -@mv site.exp site.bak
2689 @echo "## these variables are automatically generated by make ##" > ./tmp0
2690 @echo "# Do not edit here. If you wish to override these values" >> ./tmp0
2691 @echo "# add them to the last section" >> ./tmp0
2692 @echo "set rootme \"`pwd`\"" >> ./tmp0
2693 @echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0
2694 @echo "set host_triplet $(host_canonical)" >> ./tmp0
2695 @echo "set build_triplet $(build_canonical)" >> ./tmp0
2696 @echo "set target_triplet $(target)" >> ./tmp0
2697 @echo "set target_alias $(target_alias)" >> ./tmp0
2698# CFLAGS is set even though it's empty to show we reserve the right to set it.
2699 @echo "set CFLAGS \"\"" >> ./tmp0
2700 @echo "set CXXFLAGS \"-I$(objdir)/../$(target_subdir)libio -I\$$srcdir/../libg++/src -I\$$srcdir/../libio -I\$$srcdir/../libstdc++ -I\$$srcdir/../libstdc++/stl -L$(objdir)/../$(target_subdir)libg++ -L$(objdir)/../$(target_subdir)libstdc++\"" >> ./tmp0
2701# If newlib has been configured, we need to pass -B to gcc so it can find
2702# newlib's crt0.o if it exists. This will cause a "path prefix not used"
2703# message if it doesn't, but the testsuite is supposed to ignore the message -
2704# it's too difficult to tell when to and when not to pass -B (not all targets
2705# have crt0's). We could only add the -B if ../newlib/crt0.o exists, but that
2706# seems like too selective a test.
2707# ??? Another way to solve this might be to rely on linker scripts. Then
2708# theoretically the -B won't be needed.
2709# We also need to pass -L ../ld so that the linker can find ldscripts.
2710 @if [ -d $(objdir)/../$(target_subdir)newlib ] ; then \
2711 echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \
2712 echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)newlib/\"" >> ./tmp0; \
2713 echo "append CFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
2714 echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
2715 echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./tmp0; \
2716 else true; \
2717 fi
2718 @if [ -d $(objdir)/../ld ] ; then \
2719 echo "append LDFLAGS \" -L$(objdir)/../ld\"" >> ./tmp0; \
2720 else true; \
2721 fi
ccdb9251 2722 echo "set tmpdir $(objdir)/testsuite" >> ./tmp0
e933cbe0
JL
2723 @echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0
2724 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
2725 @cat ./tmp0 > site.exp
2726 @cat site.bak | sed \
2727 -e '1,/^## All variables above are.*##/ d' >> site.exp
2728 -@rm -f ./tmp?
2729
d8bb17c8 2730CHECK_TARGETS = check-gcc check-g++ check-g77 check-objc
e933cbe0
JL
2731
2732check: $(CHECK_TARGETS)
2733
3979dfb8 2734testsuite/site.exp: site.exp
e933cbe0
JL
2735 if [ -d testsuite ]; then \
2736 true; \
2737 else \
2738 mkdir testsuite; \
2739 fi
2740 rm -rf testsuite/site.exp
2741 cp site.exp testsuite/site.exp
3979dfb8
JW
2742
2743check-g++: testsuite/site.exp
2744 -rootme=`pwd`; export rootme; \
e933cbe0
JL
2745 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2746 cd testsuite; \
2747 EXPECT=${EXPECT} ; export EXPECT ; \
2748 if [ -f $${rootme}/../expect/expect ] ; then \
6b106e7d 2749 TCL_LIBRARY=`cd ${srcdir}/../tcl/library ; pwd` ; \
e933cbe0
JL
2750 export TCL_LIBRARY ; fi ; \
2751 $(RUNTEST) --tool g++ $(RUNTESTFLAGS)
2752
3979dfb8
JW
2753check-gcc: testsuite/site.exp
2754 -rootme=`pwd`; export rootme; \
e933cbe0
JL
2755 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2756 cd testsuite; \
2757 EXPECT=${EXPECT} ; export EXPECT ; \
2758 if [ -f $${rootme}/../expect/expect ] ; then \
6b106e7d 2759 TCL_LIBRARY=`cd ${srcdir}/../tcl/library ; pwd` ; \
e933cbe0
JL
2760 export TCL_LIBRARY ; fi ; \
2761 $(RUNTEST) --tool gcc $(RUNTESTFLAGS)
2762
dc84d7bc
JL
2763check-g77: testsuite/site.exp
2764 -rootme=`pwd`; export rootme; \
2765 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2766 cd testsuite; \
2767 EXPECT=${EXPECT} ; export EXPECT ; \
2768 if [ -f $${rootme}/../expect/expect ] ; then \
6b106e7d 2769 TCL_LIBRARY=`cd ${srcdir}/../tcl/library ; pwd` ; \
dc84d7bc
JL
2770 export TCL_LIBRARY ; fi ; \
2771 $(RUNTEST) --tool g77 $(RUNTESTFLAGS)
2772
d8bb17c8
OP
2773check-objc: testsuite/site.exp
2774 -rootme=`pwd`; export rootme; \
2775 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2776 cd testsuite; \
2777 EXPECT=${EXPECT} ; export EXPECT ; \
2778 if [ -f $${rootme}/../expect/expect ] ; then \
6b106e7d 2779 TCL_LIBRARY=`cd ${srcdir}/../tcl/library ; pwd` ; \
d8bb17c8
OP
2780 export TCL_LIBRARY ; fi ; \
2781 $(RUNTEST) --tool objc $(RUNTESTFLAGS)
2782
79d8453e
RS
2783# These exist for maintenance purposes.
2784
2785# Update the tags table.
2786TAGS: force
2787 cd $(srcdir); \
e5e809f4
JL
2788 mkdir tmp-tags; \
2789 mv -f c-parse.[ch] cexp.c =*.[chy] tmp-tags; \
79d8453e 2790 etags *.y *.h *.c; \
e5e809f4
JL
2791 mv tmp-tags/* .; \
2792 rmdir tmp-tags
79d8453e 2793
e5e809f4
JL
2794# Create the distribution tar.gz file.
2795dist: tmp-gcc.xtar
2796 gzip --best < tmp-gcc.xtar > tmp-gcc.xtar.gz
2797 mv tmp-gcc.xtar.gz gcc-$(version).tar.gz
79d8453e 2798
e5e809f4 2799tmp-gcc.xtar: distdir
7d27b36c 2800# Make the distribution.
e5e809f4
JL
2801 tar -chf tmp-gcc.xtar gcc-$(version)
2802
2803distdir-cvs: force
298978c9 2804 if [ -d $(srcdir)/CVS ]; then cd $(srcdir) && cvs -r update; fi
7d27b36c 2805
013a2ee0
DE
2806# This target exists to do the initial work before the language specific
2807# stuff gets done.
3ff34537 2808distdir-start: doc $(srcdir)/INSTALL $(srcdir)/c-parse.y $(srcdir)/c-gperf.h \
e5e809f4 2809 $(srcdir)/c-parse.c $(srcdir)/cexp.c $(srcdir)/config.in \
ee5254ff 2810 $(srcdir)/version.c TAGS
ab87f8c8
JL
2811 @case '$(USE_NLS)' in \
2812 yes) ;; \
2813 *) echo "configure with --enable-nls before making a distribution"; \
2814 exit 1;; \
2815 esac
db4e119f 2816 @if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \
f780d21b 2817 then true; \
96b5daff 2818 else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
f780d21b 2819 fi
be0d23ff 2820# Update the version number in README
ab87f8c8 2821 $(AWK) '$$1 " " $$2 " " $$3 == "This directory contains" \
be0d23ff
RS
2822 { $$6 = version; print $$0 } \
2823 $$1 " " $$2 " " $$3 != "This directory contains"' \
298978c9 2824 version=$(version) $(srcdir)/README > tmp.README
be0d23ff 2825 mv tmp.README README
2e494f70 2826 -rm -rf gcc-$(version) tmp
79d8453e
RS
2827# Put all the files in a temporary subdirectory
2828# which has the name that we want to have in the tar file.
2e494f70
RS
2829 mkdir tmp
2830 mkdir tmp/config
eb3a6507 2831 mkdir tmp/ginclude
298978c9 2832 mkdir tmp/objc
ab87f8c8
JL
2833 mkdir tmp/intl
2834 mkdir tmp/po
298978c9
PB
2835 for file in `(cd $(srcdir) && echo *[0-9a-zA-Z+])`; do \
2836 test -f $(srcdir)/$$file && $(LN_S) $(srcdir)/$$file tmp; \
2e494f70 2837 done
298978c9
PB
2838 if test "$(srcdir)" != "." ; then \
2839 for file in c-parse.c cexp.c ; do \
2840 test -f ./$$file && $(LN_S) ../$$file tmp; \
2841 done; \
2842 fi
2843 for file in `(cd $(srcdir)/config && echo *[0-9a-zA-Z+])`; do \
2844 if test -d $(srcdir)/config/$$file \
2845 && test "$$file" != RCS && test "$$file" != CVS; then \
2846 mkdir tmp/config/$$file; \
2847 for subfile in `(cd $(srcdir)/config/$$file && echo *[0-9a-zA-Z+])`; do \
2848 $(LN_S) $(srcdir)/config/$$file/$$subfile tmp/config/$$file; \
e52114f8 2849 done; \
e52114f8 2850 else \
298978c9 2851 $(LN_S) $(srcdir)/config/$$file tmp/config; \
e52114f8 2852 fi; \
79d8453e 2853 done
298978c9
PB
2854 for file in `(cd $(srcdir)/ginclude && echo *[0-9a-zA-Z+])`; do \
2855 $(LN_S) $(srcdir)/ginclude/$$file tmp/ginclude; \
eb3a6507 2856 done
298978c9
PB
2857 for file in `(cd $(srcdir)/objc && echo *[0-9a-zA-Z+])`; do \
2858 $(LN_S) $(srcdir)/objc/$$file tmp/objc; \
ea727bbf 2859 done
298978c9 2860 $(LN_S) .gdbinit tmp
013a2ee0
DE
2861
2862# Finish making `distdir', after the languages have done their thing.
2863distdir-finish:
2e494f70 2864 mv tmp gcc-$(version)
eb3a6507
RK
2865# Get rid of everything we don't want in the distribution. We'd want
2866# this to use Makefile.in, but it doesn't have the `lang.foo' targets
2867# expanded.
ab87f8c8
JL
2868 cd gcc-$(version); make extraclean distdir-check VERSION_DEP=
2869
2870distdir-check:
2871 ($(AWK) '/^[^#]/{print} /^#[A-Za-z]/{print substr($$1, 2)}' | sort) \
2872 < po/POTFILES.in > tmp.POTFILES
2873 ls [A-Za-z]*.[ch] [a-z]*/[A-Za-z]*.[ch] \
2874 [a-z]*/[a-z]*/[A-Za-z]*.[ch] | sort > tmp.src
2875 diff tmp.POTFILES tmp.src || { \
2876 echo "po/POTFILES.in and sources do not match -- please fix"; \
2877 exit 1; \
2878 }
2879 rm -f tmp.*
79d8453e 2880
ab87f8c8
JL
2881distdir: distdir-cvs distdir-start intl.distdir intl.distdir-fixup \
2882 lang.distdir distdir-finish
013a2ee0 2883
db4e119f
RS
2884# make diff oldversion=M.N
2885# creates a diff file between an older distribution and this one.
2886# The -P option assumes this is GNU diff.
2887diff:
f137e7dc 2888 diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \
ee5254ff 2889 -x cexp.c -x -x TAGS -x INSTALL \
e5e809f4 2890 -x configure -x config.in \
013a2ee0
DE
2891 -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \
2892 -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \
2893 $(LANG_DIFF_EXCLUDES) \
e5e809f4 2894 gcc-$(oldversion) gcc-$(version) > gcc-$(oldversion)-$(version).diff
db4e119f 2895
361e618f 2896bootstrap bootstrap-lean: force
9c4614c3
TW
2897# Only build the C compiler for stage1, because that is the only one that
2898# we can guarantee will build with the native compiler, and also it is the
2899# only thing useful for building stage2.
5e31e473 2900 $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
79d8453e 2901 $(MAKE) stage1
2e494f70
RS
2902# This used to define ALLOCA as empty, but that would lead to bad results
2903# for a subsequent `make install' since that would not have ALLOCA empty.
2904# To prevent `make install' from compiling alloca.o and then relinking cc1
2905# because alloca.o is newer, we permit these recursive makes to compile
2906# alloca.o. Then cc1 is newer, so it won't have to be relinked.
6f144c9c 2907 $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
79d8453e 2908 $(MAKE) stage2
361e618f 2909 -if test $@ = bootstrap-lean; then rm -rf stage1; else true; fi
6f144c9c 2910 $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
b1e3ddfd 2911
eaed7b41 2912bootstrap2 bootstrap2-lean: force
6f144c9c 2913 $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
79d8453e 2914 $(MAKE) stage2
eaed7b41 2915 -if test $@ = bootstrap2-lean; then rm -rf stage1; else true; fi
6f144c9c 2916 $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
79d8453e 2917
eaed7b41 2918bootstrap3 bootstrap3-lean: force
6f144c9c 2919 $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
79d8453e 2920
eaed7b41 2921bootstrap4 bootstrap4-lean: force
6f144c9c 2922 $(MAKE) CC="stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage3/ LANGUAGES="$(LANGUAGES)"
361e618f 2923
dcfedcd0
RK
2924# Compare the object files in the current directory with those in the
2925# stage2 directory.
2926
9825189b 2927# ./ avoids bug in some versions of tail.
e85988b5 2928compare compare3 compare4 compare-lean compare3-lean compare4-lean: force
3fb2f401 2929 -rm -f .bad_compare
e85988b5 2930 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
aab26e16 2931 for file in *$(objext); do \
9825189b 2932 tail +16c ./$$file > tmp-foo1; \
e85988b5 2933 tail +16c stage$$stage/$$file > tmp-foo2 \
3fb2f401 2934 && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
dcfedcd0 2935 done
e85988b5 2936 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
ab87f8c8 2937 for dir in tmp-foo intl $(SUBDIRS); do \
aab26e16
RK
2938 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2939 for file in $$dir/*$(objext); do \
013a2ee0 2940 tail +16c ./$$file > tmp-foo1; \
e85988b5 2941 tail +16c stage$$stage/$$file > tmp-foo2 \
3fb2f401 2942 && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
094ecbb0 2943 done; \
7ce1e6c8 2944 else true; fi; \
013a2ee0 2945 done
dcfedcd0 2946 -rm -f tmp-foo*
4931312c 2947 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
3fb2f401
JL
2948 if [ -f .bad_compare ]; then \
2949 echo "Bootstrap comparison failure!"; \
2950 cat .bad_compare; \
2951 exit 1; \
e85988b5
MH
2952 else \
2953 case "$@" in \
2954 *-lean ) rm -rf stage$$stage ;; \
25b76cc1 2955 *) ;; \
e85988b5 2956 esac; true; \
3fb2f401 2957 fi
dcfedcd0 2958
e85988b5
MH
2959# Compare the object files in the current directory with those in the
2960# stage2 directory. Use gnu cmp (diffutils v2.4 or later) to avoid
2961# running tail and the overhead of twice copying each object file.
2962
2963gnucompare gnucompare3 gnucompare4 gnucompare-lean gnucompare3-lean gnucompare4-lean: force
b1e3ddfd 2964 -rm -f .bad_compare
e85988b5 2965 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
b1e3ddfd 2966 for file in *$(objext); do \
e85988b5 2967 (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
b1e3ddfd 2968 done
e85988b5 2969 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
ab87f8c8 2970 for dir in tmp-foo intl $(SUBDIRS); do \
b1e3ddfd
AJ
2971 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2972 for file in $$dir/*$(objext); do \
e85988b5 2973 (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
b1e3ddfd 2974 done; \
7ce1e6c8 2975 else true; fi; \
b1e3ddfd 2976 done
4931312c 2977 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
b1e3ddfd
AJ
2978 if [ -f .bad_compare ]; then \
2979 echo "Bootstrap comparison failure!"; \
2980 cat .bad_compare; \
2981 exit 1; \
e85988b5
MH
2982 else \
2983 case "$@" in \
2984 *-lean ) rm -rf stage$$stage ;; \
2985 esac; true; \
b1e3ddfd
AJ
2986 fi
2987
79d8453e 2988# Copy the object files from a particular stage into a subdirectory.
013a2ee0 2989stage1-start:
2e494f70 2990 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
ab87f8c8 2991 -for dir in intl $(SUBDIRS) ; \
013a2ee0 2992 do \
9a517e7b 2993 if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \
013a2ee0 2994 done
79d8453e 2995 -mv $(STAGESTUFF) stage1
ab87f8c8 2996 -mv intl/*$(objext) stage1/intl
338023d4
DE
2997# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2998# dir will work properly.
ac64120e
JW
2999 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage1 ; else true ; fi
3000 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage1 ; else true ; fi
3001 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage1 ; else true ; fi
79d8453e
RS
3002 -rm -f stage1/libgcc.a
3003 -cp libgcc.a stage1
8f25d5cd
JW
3004 -if $(RANLIB_TEST_FOR_TARGET) ; then \
3005 $(RANLIB_FOR_TARGET) stage1/libgcc.a; \
3006 else true; fi
04e95620
JM
3007 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
3008 cp stage1/$${f} . ; \
db814993 3009 else true; \
04e95620 3010 fi; done
013a2ee0 3011stage1: force stage1-start lang.stage1
79d8453e 3012
013a2ee0 3013stage2-start:
2e494f70 3014 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
ab87f8c8 3015 -for dir in intl $(SUBDIRS) ; \
013a2ee0 3016 do \
9a517e7b 3017 if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \
013a2ee0 3018 done
79d8453e 3019 -mv $(STAGESTUFF) stage2
ab87f8c8 3020 -mv intl/*$(objext) stage2/intl
338023d4
DE
3021# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
3022# dir will work properly.
ac64120e
JW
3023 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage2 ; else true ; fi
3024 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage2 ; else true ; fi
3025 -if [ -f collect-ld ] ; then $(LN_S) ../collect-ld$(exeext) stage2 ; else true ; fi
79d8453e
RS
3026 -rm -f stage2/libgcc.a
3027 -cp libgcc.a stage2
8f25d5cd
JW
3028 -if $(RANLIB_TEST_FOR_TARGET) ; then \
3029 $(RANLIB_FOR_TARGET) stage2/libgcc.a; \
3030 else true; fi
04e95620
JM
3031 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
3032 cp stage2/$${f} . ; \
db814993 3033 else true; \
04e95620 3034 fi; done
013a2ee0 3035stage2: force stage2-start lang.stage2
79d8453e 3036
013a2ee0 3037stage3-start:
935e11b0 3038 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
ab87f8c8 3039 -for dir in intl $(SUBDIRS) ; \
013a2ee0 3040 do \
9a517e7b 3041 if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \
013a2ee0 3042 done
79d8453e 3043 -mv $(STAGESTUFF) stage3
ab87f8c8 3044 -mv intl/*$(objext) stage3/intl
338023d4
DE
3045# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
3046# dir will work properly.
ac64120e
JW
3047 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage3 ; else true ; fi
3048 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage3 ; else true ; fi
3049 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage3 ; else true ; fi
79d8453e
RS
3050 -rm -f stage3/libgcc.a
3051 -cp libgcc.a stage3
8f25d5cd
JW
3052 -if $(RANLIB_TEST_FOR_TARGET) ; then \
3053 $(RANLIB_FOR_TARGET) stage3/libgcc.a; \
3054 else true; fi
04e95620
JM
3055 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
3056 cp stage3/$${f} . ; \
db814993 3057 else true; \
04e95620 3058 fi; done
013a2ee0 3059stage3: force stage3-start lang.stage3
79d8453e 3060
013a2ee0 3061stage4-start:
935e11b0 3062 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
ab87f8c8 3063 -for dir in intl $(SUBDIRS) ; \
013a2ee0 3064 do \
9a517e7b 3065 if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \
013a2ee0 3066 done
79d8453e 3067 -mv $(STAGESTUFF) stage4
ab87f8c8 3068 -mv intl/*$(objext) stage4/intl
338023d4
DE
3069# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
3070# dir will work properly.
ac64120e
JW
3071 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage4 ; else true ; fi
3072 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage4 ; else true ; fi
3073 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage4 ; else true ; fi
79d8453e
RS
3074 -rm -f stage4/libgcc.a
3075 -cp libgcc.a stage4
8f25d5cd
JW
3076 -if $(RANLIB_TEST_FOR_TARGET) ; then \
3077 $(RANLIB_FOR_TARGET) stage4/libgcc.a; \
3078 else true; fi
04e95620
JM
3079 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
3080 cp stage4/$${f} . ; \
db814993 3081 else true; \
04e95620 3082 fi; done
013a2ee0 3083stage4: force stage4-start lang.stage4
79d8453e
RS
3084
3085# Copy just the executable files from a particular stage into a subdirectory,
3086# and delete the object files. Use this if you're just verifying a version
3087# that is pretty sure to work, and you are short of disk space.
aab26e16 3088risky-stage1: stage1
003455d9 3089 -make clean
79d8453e 3090
aab26e16 3091risky-stage2: stage2
79d8453e
RS
3092 -make clean
3093
aab26e16 3094risky-stage3: stage3
79d8453e
RS
3095 -make clean
3096
aab26e16 3097risky-stage4: stage4
79d8453e
RS
3098 -make clean
3099
3100#In GNU Make, ignore whether `stage*' exists.
f1908d70 3101.PHONY: stage1 stage2 stage3 stage4 clean maintainer-clean TAGS bootstrap
79d8453e
RS
3102.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
3103
3104force:
e7f62ad3
MH
3105
3106# ---
3107# The enquire rules are still useful for building new float-anything.h.
3108# Special flags for compiling enquire.
3109# We disable optimization to make floating point more reliable.
3110ENQUIRE_CFLAGS = -DNO_MEM -DNO_LONG_DOUBLE_IO -O0
3111ENQUIRE_LDFLAGS = $(LDFLAGS)
3112
3113# Enquire target (This is a variable so that a target can choose not to
3114# build it.)
3115ENQUIRE = enquire
3116
3117# Test to see whether <float.h> exists in the system header files,
3118# and is not derived from GCC.
3119FLOAT_H_TEST = \
3120 [ -f $(SYSTEM_HEADER_DIR)/float.h ] && \
3121 if grep 'ifndef _FLOAT_H___' $(SYSTEM_HEADER_DIR)/float.h >/dev/null; \
3122 then false; \
3123 else :; fi
3124# We pretend to not having a usable <float.h>, hence disable the FLOAT_H_TEST
3125# to ensure, we're emitting a full blown <float.h> ourselves.
3126FLOAT_H_TEST = false
3127
3128# Used to compile enquire with standard cc, but have forgotten why.
3129# Let's try with GCC.
3130enquire: enquire.o $(GCC_PARTS)
3131 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o $@
3132enquire.o: $(srcdir)/enquire.c $(GCC_PASSES) stmp-int-hdrs
3133 if $(FLOAT_H_TEST); then \
3134 rm -f include/float.h; \
3135 SYS_FLOAT_H_WRAP=1; \
3136 else :; \
3137 SYS_FLOAT_H_WRAP=0; \
3138 fi; \
3139 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) \
3140 -DSYS_FLOAT_H_WRAP=$$SYS_FLOAT_H_WRAP \
3141 -I. -c $(srcdir)/enquire.c
3142
3143# Create float.h source for the native machine.
3144# Make it empty if we can use the system float.h without changes.
3145float.h-nat: enquire
3146 -./enquire -f > tmp-float.h
3147 grep '#define [^_]' tmp-float.h >/dev/null || true > tmp-float.h
3148 mv tmp-float.h float.h-nat
3149
3150# Create a dummy float.h source for a cross-compiler.
3151# ??? This isn't used anymore. Should we create config/float-unkn.h
3152# and make that the default float_format in configure?
3153float.h-cross:
3154 echo "#ifndef __GCC_FLOAT_NOT_NEEDED" > t-float.h-cross
3155 echo "#error float.h values not known for cross-compiler" >> t-float.h-cross
3156 echo "#endif" >> t-float.h-cross
3157 mv t-float.h-cross float.h-cross
3158