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