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