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