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