]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/Makefile.in
Warning fixes:
[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 \
b170964a 648 mbchar.o dyn-string.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
e09e14e9 864cc1$(exeext): $(P) $(C_OBJS) $(OBJS) $(LIBDEPS)
b93a436e 865 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) $(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
e5e809f4 1322underscore.c: s-under ; @true
7af4e697 1323
e5e809f4 1324s-under: $(GCC_PASSES)
7ac16ba0
RK
1325 echo "int xxy_us_dummy;" >tmp-dum.c
1326 $(GCC_FOR_TARGET) -S tmp-dum.c
1327 echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c
1328 if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \
1329 echo "int prepends_underscore = 1;" >>tmp-under.c; \
a3184468 1330 else \
7ac16ba0 1331 echo "int prepends_underscore = 0;" >>tmp-under.c; \
a3184468 1332 fi
7ac16ba0
RK
1333 $(srcdir)/move-if-change tmp-under.c underscore.c
1334 -rm -f tmp-dum.c tmp-dum.s
e5e809f4 1335 touch s-under
a3184468 1336
79d8453e
RS
1337# A file used by all variants of C.
1338
a0c8e1b2 1339c-common.o : c-common.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h \
d6f4ec51 1340 flags.h toplev.h output.h
79d8453e
RS
1341
1342# Language-independent files.
1343
610c62ac 1344DRIVER_DEFINES = \
4c2f8346 1345 -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
2e494f70 1346 -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
964ceda1 1347 -DDEFAULT_TARGET_VERSION=\"$(version)\" \
8b06b20a 1348 -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \
4c2f8346 1349 -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\"
670ee920 1350gcc.o: gcc.c $(CONFIG_H) system.h gansidecl.h multilib.h Makefile \
8e85ff2c 1351 $(lang_specs_files)
610c62ac
BK
1352 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1353 $(DRIVER_DEFINES) \
79d8453e
RS
1354 -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
1355
12b195d9 1356tree-check.h: s-check ; @true
b00c2351 1357s-check : gencheck $(srcdir)/move-if-change
12b195d9
ML
1358 ./gencheck > tmp-check.h
1359 $(srcdir)/move-if-change tmp-check.h tree-check.h
1360 touch s-check
1361
3103b7db 1362gencheck : gencheck.o tree.def $(lang_tree_files) $(HOST_LIBDEPS)
12b195d9
ML
1363 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
1364 gencheck.o $(HOST_LIBS)
1365
c84e2712 1366gencheck.o : gencheck.c hconfig.h system.h gansidecl.h
1a4bf22f
MK
1367 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencheck.c
1368
79d8453e
RS
1369dumpvers: dumpvers.c
1370
1371version.o: version.c
2bdfeefa
JL
1372obstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H)
1373 rm -f obstack.c
1374 $(LN_S) $(srcdir)/../libiberty/obstack.c obstack.c
1375 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) obstack.c
1376
423f265c
JL
1377choose-temp.o: $(srcdir)/../libiberty/choose-temp.c $(CONFIG_H) gansidecl.h \
1378 system.h
1379 rm -f choose-temp.c
1380 $(LN_S) $(srcdir)/../libiberty/choose-temp.c choose-temp.c
1381 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) choose-temp.c
1382
1383mkstemp.o: $(srcdir)/../libiberty/mkstemp.c $(CONFIG_H) gansidecl.h system.h
1384 rm -f mkstemp.c
1385 $(LN_S) $(srcdir)/../libiberty/mkstemp.c mkstemp.c
1386 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) mkstemp.c
1387
670ee920 1388prefix.o: prefix.c $(CONFIG_H) system.h gansidecl.h Makefile
e9a25f70
JL
1389 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1390 -DPREFIX=\"$(prefix)\" \
1391 -c `echo $(srcdir)/prefix.c | sed 's,^\./,,'`
79d8453e 1392
a0c8e1b2 1393convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h toplev.h
c5d3565c 1394
d05a5492 1395tree.o : tree.c $(CONFIG_H) system.h $(TREE_H) flags.h function.h toplev.h except.h
670ee920 1396print-tree.o : print-tree.c $(CONFIG_H) system.h $(TREE_H)
234042f4 1397stor-layout.o : stor-layout.c $(CONFIG_H) system.h $(TREE_H) flags.h \
50793ea3 1398 function.h $(EXPR_H) $(RTL_H) toplev.h except.h
efe3eb65
KG
1399fold-const.o : fold-const.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h \
1400 $(RTL_H)
670ee920 1401toplev.o : toplev.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) \
c40d5de4 1402 flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \
50793ea3 1403 insn-codes.h insn-config.h $(RECOG_H) Makefile toplev.h dwarfout.h \
114791ea 1404 dwarf2out.h sdbout.h dbxout.h $(EXPR_H) \
c40d5de4 1405 $(lang_options_files)
9c6e68c2 1406 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
8b06b20a 1407 -DTARGET_NAME=\"$(target_alias)\" \
b7ac21e3 1408 -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
79d8453e 1409
0dfa1860 1410rtl.o : rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
79d8453e 1411
487a6e06 1412print-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
670ee920 1413rtlanal.o : rtlanal.c $(CONFIG_H) system.h $(RTL_H)
79d8453e 1414
670ee920 1415varasm.o : varasm.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h \
6feacd09 1416 function.h defaults.h $(EXPR_H) hard-reg-set.h $(REGS_H) \
296433e1 1417 xcoffout.h output.h c-pragma.h toplev.h except.h dbxout.h sdbout.h
670ee920 1418function.o : function.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
6feacd09 1419 function.h insn-flags.h insn-codes.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
82ce5b75 1420 insn-config.h $(RECOG_H) output.h toplev.h except.h
670ee920 1421stmt.o : stmt.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \
50793ea3 1422 insn-flags.h insn-config.h insn-codes.h hard-reg-set.h $(EXPR_H) except.h \
d6f4ec51 1423 loop.h $(RECOG_H) toplev.h output.h
670ee920 1424except.o : except.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
6feacd09 1425 function.h insn-flags.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
a0c8e1b2 1426 insn-config.h $(RECOG_H) output.h except.h toplev.h
670ee920 1427expr.o : expr.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \
6feacd09 1428 $(REGS_H) insn-flags.h insn-codes.h $(EXPR_H) insn-config.h $(RECOG_H) output.h \
1cd93963 1429 typeclass.h hard-reg-set.h toplev.h hard-reg-set.h except.h
50793ea3 1430calls.o : calls.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(EXPR_H) \
6feacd09 1431 insn-flags.h $(REGS_H) toplev.h output.h
670ee920 1432expmed.o : expmed.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
50793ea3 1433 insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) real.h
670ee920 1434explow.o : explow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
50793ea3 1435 hard-reg-set.h insn-config.h $(EXPR_H) $(RECOG_H) insn-flags.h insn-codes.h
670ee920 1436optabs.o : optabs.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
50793ea3 1437 insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) reload.h
6feacd09 1438dbxout.o : dbxout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h $(REGS_H) \
487a6e06
KG
1439 insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h dbxout.h \
1440 toplev.h
670ee920 1441sdbout.o : sdbout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h except.h \
6feacd09 1442 function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) defaults.h real.h \
2bdfeefa
JL
1443 insn-config.h $(srcdir)/../include/obstack.h xcoffout.h c-pragma.h \
1444 sdbout.h toplev.h
670ee920 1445dwarfout.o : dwarfout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf.h \
76ead72b 1446 flags.h insn-config.h reload.h output.h defaults.h toplev.h dwarfout.h
670ee920 1447dwarf2out.o : dwarf2out.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf2.h \
50793ea3 1448 flags.h insn-config.h reload.h output.h defaults.h \
b170964a 1449 hard-reg-set.h $(REGS_H) $(EXPR_H) toplev.h dwarf2out.h dyn-string.h
670ee920 1450xcoffout.o : xcoffout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) xcoffout.h \
296b8152 1451 flags.h toplev.h output.h dbxout.h
670ee920 1452emit-rtl.o : emit-rtl.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
6feacd09 1453 except.h function.h $(REGS_H) insn-config.h $(RECOG_H) real.h \
2bdfeefa 1454 $(EXPR_H) $(srcdir)/../include/obstack.h hard-reg-set.h bitmap.h
a0c8e1b2 1455real.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h
670ee920
KG
1456getpwd.o : getpwd.c $(CONFIG_H) system.h
1457
1458integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
6feacd09 1459 integrate.h insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \
d6f4ec51 1460 function.h output.h $(RECOG_H) except.h toplev.h
670ee920 1461
6feacd09 1462jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
50793ea3 1463 insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h \
2e107e9e 1464 toplev.h
6feacd09 1465stupid.o : stupid.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h \
cad6f7d0 1466 $(BASIC_BLOCK_H) insn-config.h reload.h flags.h toplev.h
79d8453e 1467
6feacd09 1468cse.o : cse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
50793ea3 1469 real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h output.h
6feacd09 1470gcse.o : gcse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
50793ea3 1471 real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) output.h
670ee920 1472profile.o : profile.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-flags.h \
e61fab19 1473 gcov-io.h $(TREE_H) output.h $(REGS_H) toplev.h insn-config.h
670ee920 1474loop.o : loop.c $(CONFIG_H) system.h $(RTL_H) flags.h loop.h insn-config.h \
6feacd09 1475 insn-flags.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \
2e107e9e 1476 toplev.h
50793ea3 1477unroll.o : unroll.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
6feacd09 1478 integrate.h $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) loop.h toplev.h
670ee920 1479flow.o : flow.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-config.h \
79c9824e 1480 $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h recog.h
670ee920 1481combine.o : combine.c $(CONFIG_H) system.h $(RTL_H) flags.h \
6feacd09 1482 insn-config.h insn-flags.h insn-codes.h insn-attr.h $(REGS_H) $(EXPR_H) \
2e107e9e 1483 $(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h toplev.h
670ee920 1484regclass.o : regclass.c $(CONFIG_H) system.h $(RTL_H) hard-reg-set.h flags.h \
6feacd09 1485 $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(RECOG_H) reload.h real.h toplev.h \
d6f4ec51 1486 output.h
670ee920 1487local-alloc.o : local-alloc.c $(CONFIG_H) system.h $(RTL_H) flags.h \
6feacd09 1488 $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) output.h \
2e107e9e 1489 insn-attr.h toplev.h
670ee920 1490bitmap.o : bitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H) \
6feacd09 1491 $(REGS_H)
cad6f7d0 1492global.o : global.c $(CONFIG_H) system.h $(RTL_H) flags.h reload.h \
6feacd09
MM
1493 $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h output.h toplev.h
1494varray.o : varray.c $(CONFIG_H) system.h varray.h $(RTL_H) $(TREE_H) bitmap.h
79d8453e 1495
50793ea3 1496reload.o : reload.c $(CONFIG_H) system.h $(RTL_H) flags.h output.h $(EXPR_H) \
6feacd09 1497 reload.h $(RECOG_H) hard-reg-set.h insn-config.h insn-codes.h $(REGS_H) \
a0c8e1b2 1498 real.h toplev.h
50793ea3 1499reload1.o : reload1.c $(CONFIG_H) system.h $(RTL_H) real.h flags.h $(EXPR_H) \
6feacd09 1500 reload.h $(REGS_H) hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
a0c8e1b2 1501 $(BASIC_BLOCK_H) $(RECOG_H) output.h toplev.h
670ee920 1502caller-save.o : caller-save.c $(CONFIG_H) system.h $(RTL_H) flags.h \
6feacd09 1503 $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) \
50793ea3 1504 $(RECOG_H) reload.h $(EXPR_H) toplev.h
670ee920 1505reorg.o : reorg.c $(CONFIG_H) system.h $(RTL_H) conditions.h hard-reg-set.h \
6feacd09 1506 $(BASIC_BLOCK_H) $(REGS_H) insn-config.h insn-attr.h \
50793ea3 1507 insn-flags.h $(RECOG_H) flags.h output.h $(EXPR_H)
52fe52e2 1508alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \
264fac34 1509 $(REGS_H) toplev.h output.h $(EXPR_H)
670ee920 1510regmove.o : regmove.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
6feacd09 1511 $(RECOG_H) output.h reload.h $(REGS_H) hard-reg-set.h flags.h \
50793ea3 1512 $(EXPR_H) insn-flags.h $(BASIC_BLOCK_H) toplev.h
670ee920 1513$(SCHED_PREFIX)sched.o : $(SCHED_PREFIX)sched.c $(CONFIG_H) system.h $(RTL_H) \
e51712db
KG
1514 $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h \
1515 insn-attr.h toplev.h recog.h
6feacd09 1516final.o : final.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(REGS_H) \
956d6950 1517 $(RECOG_H) conditions.h insn-config.h insn-attr.h except.h real.h output.h \
a0c8e1b2 1518 hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h \
76ead72b 1519 toplev.h reload.h dwarfout.h dwarf2out.h sdbout.h dbxout.h
670ee920 1520recog.o : recog.c $(CONFIG_H) system.h $(RTL_H) \
6feacd09 1521 $(REGS_H) $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \
79d8453e 1522 insn-flags.h insn-codes.h real.h
670ee920 1523reg-stack.o : reg-stack.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) \
6feacd09 1524 $(REGS_H) hard-reg-set.h flags.h insn-config.h insn-flags.h toplev.h
b170964a 1525dyn-string.o: dyn-string.c dyn-string.h $(CONFIG_H) system.h gansidecl.h
dcfedcd0 1526
b4978ce7 1527$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \
6feacd09 1528 $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
487a6e06 1529 insn-flags.h output.h insn-attr.h insn-codes.h system.h toplev.h
9c6e68c2 1530 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file)
79d8453e 1531
4e0db2ce
RK
1532# Build auxiliary files that support ecoff format.
1533mips-tfile: mips-tfile.o version.o $(LIBDEPS)
aab26e16 1534 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS)
4e0db2ce 1535
092f7be3 1536mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H) system.h machmode.h
4e0db2ce
RK
1537
1538mips-tdump: mips-tdump.o version.o $(LIBDEPS)
aab26e16 1539 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tdump.o version.o $(LIBS)
4e0db2ce 1540
90fbb8c9 1541mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H) system.h
4e0db2ce 1542
579d0ecf 1543# Build file to support OSF/rose half-pic format.
b04cd507 1544halfpic.o: halfpic.c $(CONFIG_H) $(RTL_H) $(TREE_H) system.h
579d0ecf 1545
79d8453e
RS
1546# Normally this target is not used; but it is used if you
1547# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
1548# from the GNU Emacs distribution.
39802f41
JL
1549alloca.o: $(srcdir)/../libiberty/alloca.c
1550 rm -f alloca.c
1551 $(LN_S) $(srcdir)/../libiberty/alloca.c alloca.c
79d8453e 1552 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
39802f41 1553 -c `echo alloca.c | sed 's,^\./,,'`
79d8453e 1554 $(ALLOCA_FINISH)
544eb21e 1555#\f
79d8453e
RS
1556# Generate header and source files from the machine description,
1557# and compile them.
1558
1559.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
1560 insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
1561 insn-attr.h insn-attrtab.c
1562
1563# The following pair of rules has this effect:
1564# genconfig is run only if the md has changed since genconfig was last run;
1565# but the file insn-config.h is touched only when its contents actually change.
1566
1567# Each of the other insn-* files is handled by a similar pair of rules.
1568
1402d22c 1569# This causes an anomaly in the results of make -n
e5e809f4 1570# because insn-* is older than s-*
1402d22c
RS
1571# and thus make -n thinks that insn-* will be updated
1572# and force recompilation of things that depend on it.
424aa086 1573# We use move-if-change precisely to avoid such recompilation.
1402d22c
RS
1574# But there is no way to teach make -n that it will be avoided.
1575
79d8453e
RS
1576# Each of the insn-*.[ch] rules has a semicolon at the end,
1577# for otherwise the system Make on SunOS 4.1 never tries
7bd95cc1
BK
1578# to recompile insn-*.o. To avoid problems and extra noise from
1579# versions of make which don't like empty commands (nothing after the
1580# trailing `;'), we call true for each.
79d8453e 1581
e5e809f4
JL
1582insn-config.h: s-config ; @true
1583s-config : $(md_file) genconfig $(srcdir)/move-if-change
7ac16ba0 1584 ./genconfig $(md_file) > tmp-config.h
79d8453e 1585 $(srcdir)/move-if-change tmp-config.h insn-config.h
e5e809f4 1586 touch s-config
79d8453e 1587
e5e809f4
JL
1588insn-flags.h: s-flags ; @true
1589s-flags : $(md_file) genflags $(srcdir)/move-if-change
7ac16ba0 1590 ./genflags $(md_file) > tmp-flags.h
79d8453e 1591 $(srcdir)/move-if-change tmp-flags.h insn-flags.h
e5e809f4 1592 touch s-flags
79d8453e 1593
e5e809f4
JL
1594insn-codes.h: s-codes ; @true
1595s-codes : $(md_file) gencodes $(srcdir)/move-if-change
7ac16ba0 1596 ./gencodes $(md_file) > tmp-codes.h
79d8453e 1597 $(srcdir)/move-if-change tmp-codes.h insn-codes.h
e5e809f4 1598 touch s-codes
79d8453e 1599
50793ea3 1600insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) $(EXPR_H) real.h output.h \
9ec36da5 1601 insn-config.h insn-flags.h insn-codes.h system.h reload.h
79d8453e
RS
1602 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
1603
e5e809f4
JL
1604insn-emit.c: s-emit ; @true
1605s-emit : $(md_file) genemit $(srcdir)/move-if-change
7ac16ba0 1606 ./genemit $(md_file) > tmp-emit.c
79d8453e 1607 $(srcdir)/move-if-change tmp-emit.c insn-emit.c
e5e809f4 1608 touch s-emit
79d8453e 1609
956d6950 1610insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(RECOG_H) \
e9eaed43 1611 real.h output.h flags.h system.h
79d8453e
RS
1612 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
1613
e5e809f4
JL
1614insn-recog.c: s-recog ; @true
1615s-recog : $(md_file) genrecog $(srcdir)/move-if-change
7ac16ba0 1616 ./genrecog $(md_file) > tmp-recog.c
79d8453e 1617 $(srcdir)/move-if-change tmp-recog.c insn-recog.c
e5e809f4 1618 touch s-recog
79d8453e 1619
118bdbf8 1620insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
50793ea3 1621 insn-config.h flags.h $(RECOG_H) $(EXPR_H) reload.h system.h
118bdbf8
RK
1622 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
1623
e5e809f4
JL
1624insn-opinit.c: s-opinit ; @true
1625s-opinit : $(md_file) genopinit $(srcdir)/move-if-change
7ac16ba0 1626 ./genopinit $(md_file) > tmp-opinit.c
118bdbf8 1627 $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
e5e809f4 1628 touch s-opinit
118bdbf8 1629
0a578fee
BS
1630insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H) system.h toplev.h \
1631 insn-config.h recog.h
79d8453e
RS
1632 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
1633
e5e809f4
JL
1634insn-extract.c: s-extract ; @true
1635s-extract : $(md_file) genextract $(srcdir)/move-if-change
7ac16ba0 1636 ./genextract $(md_file) > tmp-extract.c
79d8453e 1637 $(srcdir)/move-if-change tmp-extract.c insn-extract.c
e5e809f4 1638 touch s-extract
79d8453e 1639
6feacd09 1640insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) $(REGS_H) output.h real.h system.h
79d8453e
RS
1641 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
1642
e5e809f4
JL
1643insn-peep.c: s-peep ; @true
1644s-peep : $(md_file) genpeep $(srcdir)/move-if-change
7ac16ba0 1645 ./genpeep $(md_file) > tmp-peep.c
79d8453e 1646 $(srcdir)/move-if-change tmp-peep.c insn-peep.c
e5e809f4 1647 touch s-peep
79d8453e 1648
114791ea
KG
1649insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h \
1650 output.h insn-attr.h insn-config.h system.h toplev.h
79d8453e
RS
1651 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
1652
e5e809f4
JL
1653insn-attr.h: s-attr ; @true
1654s-attr : $(md_file) genattr $(srcdir)/move-if-change
7ac16ba0 1655 ./genattr $(md_file) > tmp-attr.h
79d8453e 1656 $(srcdir)/move-if-change tmp-attr.h insn-attr.h
e5e809f4 1657 touch s-attr
79d8453e 1658
e5e809f4
JL
1659insn-attrtab.c: s-attrtab ; @true
1660s-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change
7ac16ba0 1661 if cmp -s $(PREMADE_ATTRTAB_MD) $(md_file); \
20bd0ab1
RS
1662 then \
1663 echo Using $(PREMADE_ATTRTAB); \
2e0b13db 1664 cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \
20bd0ab1 1665 else \
7ac16ba0 1666 ./genattrtab $(md_file) > tmp-attrtab.c; \
20bd0ab1 1667 fi
79d8453e 1668 $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
e5e809f4 1669 touch s-attrtab
79d8453e 1670
6feacd09 1671insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h conditions.h \
956d6950 1672 hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h $(RECOG_H) \
e9eaed43 1673 insn-codes.h system.h
79d8453e
RS
1674 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
1675
e5e809f4
JL
1676insn-output.c: s-output ; @true
1677s-output : $(md_file) genoutput $(srcdir)/move-if-change
7ac16ba0 1678 ./genoutput $(md_file) > tmp-output.c
79d8453e 1679 $(srcdir)/move-if-change tmp-output.c insn-output.c
e5e809f4 1680 touch s-output
3b80f6ca 1681
560bd19e 1682genrtl.o : genrtl.c $(CONFIG_H) $(RTL_H) system.h
e5e809f4 1683genrtl.c genrtl.h : s-genrtl
a3f80023
AS
1684 @true # force gnu make to recheck modification times.
1685
e5e809f4 1686s-genrtl: gengenrtl $(srcdir)/move-if-change $(RTL_BASE_H)
3b80f6ca
RH
1687 ./gengenrtl tmp-genrtl.h tmp-genrtl.c
1688 $(srcdir)/move-if-change tmp-genrtl.h genrtl.h
1689 $(srcdir)/move-if-change tmp-genrtl.c genrtl.c
e5e809f4 1690 touch s-genrtl
3b80f6ca 1691
544eb21e 1692#\f
79d8453e
RS
1693# Compile the programs that generate insn-* from the machine description.
1694# They are compiled with $(HOST_CC), and associated libraries,
1695# since they need to run on this machine
1696# even if GCC is being compiled to run on some other machine.
1697
1698# $(CONFIG_H) is omitted from the deps of the gen*.o
1699# because these programs don't really depend on anything
1700# about the target machine. They do depend on config.h itself,
1701# since that describes the host machine.
1702
c3efc7c4 1703# Pass the md file through cpp if the target requests it.
aa90345a
RK
1704$(MD_FILE): $(MD_DEPS)
1705 rm -f $@
7ac16ba0 1706 $(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@
d521a023 1707 mv tmp-$@ $@
c3efc7c4 1708
4db83042 1709genconfig : genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1710 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1711 genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1712
0b93b64e 1713genconfig.o : genconfig.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1714 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
1715
4db83042 1716genflags : genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1717 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1718 genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1719
0b93b64e 1720genflags.o : genflags.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1721 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
1722
4db83042 1723gencodes : gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1724 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1725 gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1726
0b93b64e 1727gencodes.o : gencodes.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1728 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
1729
4db83042 1730genemit : genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1731 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1732 genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1733
0b93b64e 1734genemit.o : genemit.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1735 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
1736
4db83042 1737genopinit : genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1738 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1739 genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
118bdbf8 1740
0b93b64e 1741genopinit.o : genopinit.c $(RTL_H) $(build_xm_file) system.h
118bdbf8
RK
1742 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
1743
4db83042 1744genrecog : genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1745 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1746 genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1747
0b93b64e 1748genrecog.o : genrecog.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1749 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
1750
4db83042 1751genextract : genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1752 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1753 genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1754
0b93b64e 1755genextract.o : genextract.c $(RTL_H) $(build_xm_file) system.h insn-config.h
79d8453e
RS
1756 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
1757
4db83042 1758genpeep : genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1759 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1760 genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1761
0b93b64e 1762genpeep.o : genpeep.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1763 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
1764
4db83042 1765genattr : genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1766 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1767 genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1768
0b93b64e 1769genattr.o : genattr.c $(RTL_H) $(build_xm_file) system.h
79d8453e
RS
1770 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
1771
d3614a37 1772genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
aab26e16 1773 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
d3614a37 1774 genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
79d8453e 1775
0b93b64e 1776genattrtab.o : genattrtab.c $(RTL_H) $(build_xm_file) system.h insn-config.h
79d8453e
RS
1777 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
1778
4db83042 1779genoutput : genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
aab26e16 1780 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
4db83042 1781 genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
79d8453e 1782
0b93b64e 1783genoutput.o : genoutput.c $(RTL_H) $(build_xm_file) system.h
79d8453e 1784 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
3b80f6ca
RH
1785
1786gengenrtl : gengenrtl.o $(HOST_LIBDEPS)
1787 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
1788 gengenrtl.o $(HOST_LIBS)
1789
b04cd507 1790gengenrtl.o : gengenrtl.c $(RTL_BASE_H) system.h
3b80f6ca
RH
1791 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gengenrtl.c
1792
544eb21e 1793#\f
79d8453e
RS
1794# Compile the libraries to be used by gen*.
1795# If we are not cross-building, gen* use the same .o's that cc1 will use,
1796# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
1797# with the rules for rtl.o, alloca.o, etc.
0dfa1860 1798$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
79d8453e 1799 rm -f $(HOST_PREFIX)rtl.c
057f494b 1800 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
79d8453e
RS
1801 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
1802
d3614a37
RS
1803$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H)
1804 rm -f $(HOST_PREFIX)print-rtl.c
057f494b 1805 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
d3614a37
RS
1806 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
1807
0dfa1860 1808$(HOST_PREFIX_1)bitmap.o: $(srcdir)/bitmap.c $(CONFIG_H) system.h $(RTL_H) \
6feacd09 1809 flags.h $(BASIC_BLOCK_H) $(REGS_H)
0dfa1860
MM
1810 rm -f $(HOST_PREFIX)bitmap.c
1811 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/bitmap.c > $(HOST_PREFIX)bitmap.c
1812 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)bitmap.c
1813
79d8453e
RS
1814$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
1815 rm -f $(HOST_PREFIX)rtlanal.c
057f494b 1816 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
79d8453e
RS
1817 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
1818
39802f41 1819$(HOST_PREFIX_1)alloca.o: $(srcdir)/../libiberty/alloca.c
79d8453e 1820 rm -f $(HOST_PREFIX)alloca.c
39802f41 1821 $(LN_S) $(srcdir)/../libiberty/alloca.c $(HOST_PREFIX)alloca.c
79d8453e
RS
1822 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
1823
2bdfeefa 1824$(HOST_PREFIX_1)obstack.o: $(srcdir)/../libiberty/obstack.c
79d8453e 1825 rm -f $(HOST_PREFIX)obstack.c
2bdfeefa 1826 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/obstack.c > $(HOST_PREFIX)obstack.c
79d8453e
RS
1827 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
1828
2a63377c 1829$(HOST_PREFIX_1)vfprintf.o: $(srcdir)/../libiberty/vfprintf.c
76b4b31e 1830 rm -f $(HOST_PREFIX)vfprintf.c
39802f41 1831 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/vfprintf.c > $(HOST_PREFIX)vfprintf.c
76b4b31e
KG
1832 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)vfprintf.c
1833
1834$(HOST_PREFIX_1)doprint.o: doprint.c
1835 rm -f $(HOST_PREFIX)doprint.c
1836 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/doprint.c > $(HOST_PREFIX)doprint.c
1837 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)doprint.c
1838
79d8453e
RS
1839$(HOST_PREFIX_1)malloc.o: malloc.c
1840 rm -f $(HOST_PREFIX)malloc.c
057f494b 1841 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
79d8453e
RS
1842 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
1843
1844# This satisfies the dependency that we get if you cross-compile a compiler
1845# that does not need to compile alloca, malloc or whatever.
1846$(HOST_PREFIX_1):
1847 touch $(HOST_PREFIX_1)
ca695ac9 1848
544eb21e 1849#\f
79d8453e
RS
1850# Remake cpp and protoize.
1851
1852# Making the preprocessor
e09e14e9 1853cpp$(exeext): $(CCCP)$(exeext)
173712fb 1854 -rm -f cpp$(exeext)
ac64120e 1855 $(LN) $(CCCP)$(exeext) cpp$(exeext)
56f48ce9
DB
1856cccp$(exeext): cccp.o cexp.o version.o prefix.o mbchar.o @extra_cpp_objs@ $(LIBDEPS)
1857 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cccp.o cexp.o prefix.o mbchar.o \
1858 version.o @extra_cpp_objs@ $(LIBS)
76b4b31e 1859cexp.o: $(srcdir)/cexp.c $(CONFIG_H) system.h gansidecl.h
79d8453e
RS
1860 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
1861$(srcdir)/cexp.c: $(srcdir)/cexp.y
1862 cd $(srcdir); $(BISON) -o cexp.c cexp.y
aab26e16 1863
1f72bfca
JL
1864# We use $(libsubdir)/$(unlibsubdir) to match the
1865# -iprefix argument which gcc will pass if GCC_EXEC_PREFIX is used.
56f48ce9
DB
1866cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status system.h gansidecl.h \
1867 mbchar.h
79d8453e 1868 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
2e494f70 1869 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
6f144c9c
AO
1870 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
1871 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
1872 -DCROSS_INCLUDE_DIR=\"$(tooldir)/sys-include\" \
1873 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
79d8453e
RS
1874 -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
1875
e09e14e9 1876cppmain$(exeext): cppmain.o cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o \
56f48ce9 1877 prefix.o version.o mbchar.o @extra_cpp_objs@ $(LIBDEPS)
aab26e16 1878 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cppmain.o cpplib.o cpphash.o \
56f48ce9 1879 mbchar.o @extra_cpp_objs@ \
e9a25f70 1880 cppalloc.o cpperror.o cppexp.o prefix.o version.o $(LIBS)
59949f60 1881
487a6e06 1882cppmain.o: cppmain.c $(CONFIG_H) cpplib.h system.h gansidecl.h
66334b64 1883
487a6e06
KG
1884cpplib.o: cpplib.c $(CONFIG_H) cpplib.h cpphash.h config.status system.h \
1885 gansidecl.h
59949f60 1886 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
6f144c9c
AO
1887 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
1888 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
1889 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
1890 -DCROSS_INCLUDE_DIR=\"$(tooldir)/sys-include\" \
1891 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
59949f60
PB
1892 -c `echo $(srcdir)/cpplib.c | sed 's,^\./,,'`
1893
487a6e06 1894cpperror.o: cpperror.c $(CONFIG_H) cpplib.h system.h gansidecl.h
594f6fc5 1895
487a6e06 1896cppexp.o: cppexp.c $(CONFIG_H) cpplib.h system.h gansidecl.h
594f6fc5 1897
487a6e06 1898cpphash.o: cpphash.c cpplib.h cpphash.h $(CONFIG_H) system.h gansidecl.h
594f6fc5 1899
487a6e06 1900cppalloc.o: cppalloc.c $(CONFIG_H) cpplib.h system.h gansidecl.h
293af484 1901
7bd95cc1
BK
1902# Note for the stamp targets, we run the program `true' instead of
1903# having an empty command (nothing following the semicolon).
1904
e09e14e9 1905proto: config.status protoize$(exeext) unprotoize$(exeext) SYSCALLS.c.X
79d8453e 1906
e09e14e9 1907protoize$(exeext): protoize.o getopt.o getopt1.o getpwd.o version.o \
003ac91d 1908 pexecute.o choose-temp.o mkstemp.o $(LIBDEPS)
aab26e16 1909 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
c6e087c5 1910 protoize.o getopt.o getopt1.o getpwd.o version.o \
003ac91d 1911 pexecute.o choose-temp.o mkstemp.o $(LIBS)
2e0b13db 1912
e09e14e9 1913unprotoize$(exeext): unprotoize.o getopt.o getopt1.o getpwd.o version.o \
003ac91d 1914 pexecute.o choose-temp.o mkstemp.o $(LIBDEPS)
aab26e16 1915 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
c6e087c5 1916 unprotoize.o getopt.o getopt1.o getpwd.o version.o \
003ac91d 1917 pexecute.o choose-temp.o mkstemp.o $(LIBS)
2e0b13db 1918
8cfa5320 1919protoize.o: protoize.c $(srcdir)/../include/getopt.h $(CONFIG_H) system.h
79d8453e
RS
1920 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1921 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
89b3e3b4 1922 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
6f144c9c 1923 -DCROSS_INCLUDE_DIR=\"$(tooldir)/sys-include\" \
14b18068 1924 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
3d5e2367 1925 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
79d8453e 1926 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
6c32c807
BH
1927 $(srcdir)/protoize.c
1928
8cfa5320 1929unprotoize.o: unprotoize.c protoize.c $(srcdir)/../include/getopt.h $(CONFIG_H) system.h
79d8453e
RS
1930 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1931 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
89b3e3b4 1932 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
6f144c9c 1933 -DCROSS_INCLUDE_DIR=\"$(tooldir)/sys-include\" \
14b18068 1934 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
3d5e2367 1935 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
79d8453e 1936 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
6c32c807 1937 $(srcdir)/unprotoize.c
79d8453e 1938
8cfa5320
JL
1939getopt.o: $(srcdir)/../libiberty/getopt.c $(srcdir)/../include/getopt.h
1940 rm -f getopt.c
1941 $(LN_S) $(srcdir)/../libiberty/getopt.c getopt.c
1942 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) getopt.c
1943
1944getopt1.o: $(srcdir)/../libiberty/getopt1.c $(srcdir)/../include/getopt.h
1945 rm -f getopt1.c
1946 $(LN_S) $(srcdir)/../libiberty/getopt1.c getopt1.c
1947 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) getopt1.c
79d8453e 1948
79d8453e 1949# This info describes the target machine, so compile with GCC just built.
aab26e16
RK
1950SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \
1951 stmp-int-hdrs
c21cf0a7 1952 -rm -f SYSCALLS.c tmp-SYSCALLS.s
47547081 1953 cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
79d8453e 1954 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
c21cf0a7
RS
1955 -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
1956 -rm -f SYSCALLS.c tmp-SYSCALLS.s
9c0022f6 1957
ac1284f9 1958
9c0022f6 1959test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
4803a34a 1960 -rm -f tmp-proto.[cso]
d3614a37
RS
1961 cp $(srcdir)/protoize.c tmp-proto.c
1962 chmod u+w tmp-proto.c
4803a34a
RK
1963 ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1964 $(CFLAGS) $(INCLUDES) \
9c0022f6
RS
1965 -DGCC_INCLUDE_DIR=0 \
1966 -DGPLUSPLUS_INCLUDE_DIR=0 \
1967 -DCROSS_INCLUDE_DIR=0 \
14b18068 1968 -DTOOL_INCLUDE_DIR=0 \
d3614a37 1969 -DSTD_PROTO_DIR=0" tmp-proto.c
e3e873d2 1970 @echo '**********' Expect 400 lines of differences.
4803a34a
RK
1971 -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
1972 -wc -l tmp-proto.diff
1973 ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1974 $(CFLAGS) $(INCLUDES) \
9c0022f6
RS
1975 -DGCC_INCLUDE_DIR=0 \
1976 -DGPLUSPLUS_INCLUDE_DIR=0 \
1977 -DCROSS_INCLUDE_DIR=0 \
14b18068 1978 -DTOOL_INCLUDE_DIR=0 \
d3614a37 1979 -DSTD_PROTO_DIR=0" tmp-proto.c
9c0022f6 1980 @echo Expect zero differences.
d3614a37 1981 diff $(srcdir)/protoize.c tmp-proto.c | cat
aab26e16 1982 -rm -f tmp-proto.[cs] tmp-proto$(objext)
59a64126 1983
b04cd507 1984gcov.o: gcov.c gcov-io.h system.h
59a64126 1985
2ea9a965
NC
1986# Only one of 'gcov' or 'gcov.exe' is actually built, depending
1987# upon whether $(exeext) is empty or not.
1988gcov$(exeext): gcov.o $(LIBDEPS)
59a64126 1989 $(CC) $(ALL_CFLAGS) $(LDFLAGS) gcov.o $(LIBS) -o $@
544eb21e 1990#\f
ba1811f1 1991# Build the include directory. The stamp files are stmp-* rather than
e5e809f4 1992# s-* so that mostlyclean does not force the include directory to
ba1811f1
ILT
1993# be rebuilt.
1994
e7f62ad3 1995# Build the include directory including float.h (which no longer depends upon
56f9206d 1996# enquire).
e7f62ad3 1997stmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h gfloat.h
ba1811f1
ILT
1998# Copy in the headers provided with gcc.
1999# The sed command gets just the last file name component;
2000# this is necessary because VPATH could add a dirname.
2001# Using basename would be simpler, but some systems don't have it.
c85f7c16 2002# The touch command is here to workaround an AIX/Linux NFS bug.
d7371761
RK
2003 for file in .. $(USER_H); do \
2004 if [ X$$file != X.. ]; then \
2005 realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
c85f7c16 2006 touch include/$$realfile; \
ae678a13
JW
2007 rm -f include/$$realfile; \
2008 cp $$file include; \
2009 chmod a+r include/$$realfile; \
d7371761 2010 fi; \
ba1811f1 2011 done
1f050b9b 2012 rm -f include/limits.h
ba1811f1
ILT
2013 cp xlimits.h include/limits.h
2014 chmod a+r include/limits.h
56f9206d 2015 rm -f include/float.h
e9a25f70
JL
2016 if [ -s gfloat.h ]; then \
2017 cp gfloat.h include/float.h && \
2018 chmod a+r include/float.h; \
2019 else :; fi
e7f62ad3
MH
2020# Install the README
2021 rm -f include/README
2022 cp $(srcdir)/README-fixinc include/README
2023 chmod a+r include/README
2024 touch $@
2025
2026# Now that gfloat.h no longer depends upon enquire, this is actually a no-op.
2027stmp-headers:
2028 touch $@
ba1811f1 2029
4b104d6e 2030fixinc.sh :
b5662334
BK
2031 DEST=`cd $(srcdir) ; pwd`/$@ CC=$(CC) MAKE=$(MAKE) CFLAGS="$(CFLAGS)" \
2032 export DEST CC MAKE CFLAGS ; \
2033 echo DEST=$$DEST CC=$$CC MAKE=$$MAKE CFLAGS=$$CFLAGS ; \
2034 cd ../contrib/fixinc ; \
2035 $(SHELL) mkfixinc.sh $(target) $$DEST
4b104d6e 2036
ba1811f1 2037# Build fixed copies of system files.
aab26e16 2038stmp-fixinc: $(FIXINCLUDES) gsyslimits.h
ba1811f1
ILT
2039 rm -rf include
2040 mkdir include
b82a0ad9 2041 if [ x$(FIXINCLUDES) != xMakefile.in ]; \
98e4b835
RS
2042 then \
2043 for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
2044 if [ -d $$dir ]; \
2045 then \
eb3af43c 2046 $(SHELL) $(srcdir)/$(FIXINCLUDES) include $$dir; \
98e4b835 2047 else true; fi; \
b82a0ad9 2048 done; \
7f94849f
JS
2049 if [ x$(INSTALL_ASSERT_H) != x ] ; \
2050 then \
2051 rm -f include/assert.h; \
2052 cp $(srcdir)/assert.h include/assert.h; \
2053 chmod a+r include/assert.h; \
2054 fi \
98e4b835
RS
2055 else true; \
2056 fi
3dc4a939
RK
2057 rm -f include/syslimits.h
2058 if [ -f include/limits.h ]; then \
2059 mv include/limits.h include/syslimits.h; \
2060 else \
2061 cp $(srcdir)/gsyslimits.h include/syslimits.h; \
2062 fi
2063 chmod a+r include/syslimits.h
1f72bfca
JL
2064# If $(SYSTEM_HEADER_DIR) is $(tooldir)/sys-include, and
2065# that directory exists, then make sure that $(libsubdir) exists.
2066# This is because cpp is compiled to find $(tooldir)/include via
2067# $(libsubdir)/$(unlibsubdir), which will only work if $(libsubdir)
2068# exists.
2069 if [ "$(SYSTEM_HEADER_DIR)" = "$(tooldir)/sys-include" ] \
2070 && [ -d $(tooldir)/sys-include ]; then \
2071 if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi; \
2072 if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib; fi; \
2073 if [ -d $(libdir)/gcc-lib/$(target_alias) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias) ; fi; \
2074 if [ -d $(libdir)/gcc-lib/$(target_alias)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias)/$(version) ; fi; \
2075 else true; fi
2076
49b6e255 2077 touch stmp-fixinc
469778e2 2078
ac1284f9
PB
2079# Files related to the fixproto script.
2080
74bb4fdf 2081deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
40859b41
JL
2082 if [ -d $(SYSTEM_HEADER_DIR) ]; \
2083 then \
2084 CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -Iinclude -I${SYSTEM_HEADER_DIR}"; \
ac1284f9 2085 export CC; \
40859b41
JL
2086 $(SHELL) $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h; \
2087 mv tmp-deduced.h deduced.h; \
2088 else \
2089 touch deduced.h; \
2090 fi
ac1284f9 2091
b3ca463c 2092gen-protos: gen-protos.o scan.o cppalloc.o $(HOST_LIBDEPS)
aab26e16 2093 ${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
b3ca463c 2094 gen-protos.o scan.o cppalloc.o $(HOST_LIBS)
ac1284f9 2095
b04cd507 2096gen-protos.o: gen-protos.c scan.h $(build_xm_file) system.h
c192da27
RK
2097 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c
2098
b04cd507 2099scan.o: scan.c scan.h $(build_xm_file) system.h
c192da27 2100 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c
7b41f815 2101
74bb4fdf 2102xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
d521a023
RK
2103 cat deduced.h $(srcdir)/sys-protos.h > tmp-fixtmp.c
2104 mv tmp-fixtmp.c fixtmp.c
c061c5d7 2105 $(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
c1b9947f 2106 | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
d521a023
RK
2107 | ./gen-protos >xsys-protos.hT
2108 mv xsys-protos.hT xsys-protos.h
d7a58f93 2109 rm -rf fixtmp.c
ac1284f9 2110
aab26e16 2111fix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS) \
4f70758f 2112 cpplib.o cpphash.o cppalloc.o cppexp.o prefix.o version.o
aab26e16 2113 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ fix-header.o \
e9a25f70
JL
2114 scan-decls.o scan.o cpplib.o cpphash.o cppalloc.o prefix.o \
2115 version.o cppexp.o $(HOST_LIBS)
ac1284f9 2116
2bdfeefa
JL
2117fix-header.o: fix-header.c $(srcdir)/../include/obstack.h scan.h \
2118 xsys-protos.h $(build_xm_file) system.h cpplib.h cpphash.h
c192da27
RK
2119 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c
2120
487a6e06 2121scan-decls.o: scan-decls.c scan.h cpplib.h $(build_xm_file) system.h gansidecl.h
c192da27 2122 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c
ac1284f9 2123
74bb4fdf
RS
2124# stmp-fixproto depends on this, not on fix-header directly.
2125# The idea is to make sure fix-header gets built,
2126# but not rerun fixproto after each stage
2127# just because fix-header's mtime has changed.
2128fixhdr.ready: fix-header
2129 -if [ -f fixhdr.ready ] ; then \
2130 true; \
2131 else \
2132 touch fixhdr.ready; \
2133 fi
2134
ccaf7a07 2135# stmp-headers is to make sure fixincludes has already finished.
700ba19c
RS
2136# The if statement is so that we don't run fixproto a second time
2137# if it has already been run on the files in `include'.
c28464ad 2138stmp-fixproto: fixhdr.ready fixproto stmp-headers
db4e119f 2139 @echo "Various warnings and error messages from fixproto are normal"
70fbceee 2140 -if [ -d include ] ; then true; else mkdir include; fi
6e5bea54 2141 -if [ -f include/fixed ] ; then true; \
700ba19c 2142 else \
b1f99e2f 2143 : This line works around a 'make' bug in BSDI 1.1.; \
b3ca463c 2144 FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
aef1617c
JL
2145 if [ -d $(SYSTEM_HEADER_DIR) ] ; then \
2146 $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
2147 else true; fi; \
700ba19c
RS
2148 touch include/fixed; \
2149 fi
ac1284f9 2150 touch stmp-fixproto
544eb21e 2151#\f
79d8453e
RS
2152# Remake the info files.
2153
8dbda01e 2154doc: info
8be52aaa 2155info: cpp.info gcc.info lang.info
79d8453e 2156
8be52aaa 2157cpp.info: $(srcdir)/cpp.texi
c1879238 2158 $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o cpp.info $(srcdir)/cpp.texi
79d8453e 2159
8be52aaa
JL
2160gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
2161 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
2162 $(srcdir)/tm.texi $(srcdir)/gcov.texi
c1879238 2163 $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o gcc.info $(srcdir)/gcc.texi
f780d21b 2164
8be52aaa 2165dvi: gcc.dvi cpp.dvi lang.dvi
8dbda01e 2166
dd08cdda 2167# This works with GNU Make's default rule.
8be52aaa
JL
2168gcc.dvi: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
2169 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
2170 $(srcdir)/tm.texi $(srcdir)/gcov.texi
2171 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
2172 texindex gcc.??
2173 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
2174
2175cpp.dvi: $(srcdir)/cpp.texi
2176 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
2177 texindex cpp.??
2178 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
2179
2180
2181INSTALL: $(srcdir)/install1.texi $(srcdir)/install.texi
b4ea9a9d 2182 cd $(srcdir); $(MAKEINFO) -D INSTALLONLY \
1442f4eb 2183 --no-split -o INSTALL install1.texi
544eb21e 2184#\f
79d8453e
RS
2185# Deletion of files made during compilation.
2186# There are four levels of this:
f1908d70 2187# `mostlyclean', `clean', `distclean' and `maintainer-clean'.
79d8453e 2188# `mostlyclean' is useful while working on a particular type of machine.
2e494f70 2189# It deletes most, but not all, of the files made by compilation.
79d8453e 2190# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
2e494f70 2191# `clean' deletes everything made by running `make all'.
47547081 2192# `distclean' also deletes the files made by config.
f1908d70 2193# `maintainer-clean' also deletes everything that could be regenerated
63d9b81c
RK
2194# automatically, except for `configure'.
2195# We remove as much from the language subdirectories as we can
013a2ee0 2196# (less duplicated code).
79d8453e 2197
47547081 2198
b93a436e 2199mostlyclean: lang.mostlyclean
79d8453e
RS
2200 -rm -f $(STAGESTUFF)
2201# Delete the temporary source copies for cross compilation.
2202 -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
2203 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
2204 -rm -f $(HOST_PREFIX_1)obstack.c
2205# Delete the temp files made in the course of building libgcc.a.
ee291069 2206 -rm -f tmplibgcc* tmpcopy xlimits.h libgcc1-test
79d8453e 2207 for name in $(LIB1FUNCS); do rm -f $${name}.c; done
e5e809f4
JL
2208# Delete other built files.
2209 -rm -f t-float.h-cross xsys-protos.hT fp-bit.c dp-bit.c
2210# Delete the stamp and temporary files.
2211 -rm -f s-* tmp-* stamp-* stmp-*
013a2ee0 2212 -rm -f */stamp-* */tmp-*
2e494f70 2213# Delete debugging dump files.
79d8453e 2214 -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
7506f491
DE
2215 -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.addressof
2216 -rm -f *.regmove *.mach *.bp *.gcse
013a2ee0
DE
2217 -rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl
2218 -rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2
7506f491 2219 -rm -f */*.sched2 */*.stack */*.regmove */*.gcse
2e494f70 2220# Delete some files made during installation.
42118350 2221 -rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
813fc11c 2222 -rm -f collect collect2 mips-tfile mips-tdump alloca.s
ac1284f9 2223# Delete files generated for fixproto
1162b3a6 2224 -rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \
02521409 2225 gen-protos fixproto.list fixtmp.* fixhdr.ready
2e494f70
RS
2226# Delete unwanted output files from TeX.
2227 -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
013a2ee0 2228 -rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg
47547081
RS
2229# Delete sorted indices we don't actually use.
2230 -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
2e494f70 2231# Delete core dumps.
013a2ee0 2232 -rm -f core */core
59a64126 2233 -rm -f *.bp */*.bp
79d8453e 2234
47547081
RS
2235# Delete all files made by compilation
2236# that don't exist in the distribution.
b93a436e 2237clean: mostlyclean lang.clean
20bd0ab1
RS
2238# It may not be quite desirable to delete unprotoize.c here,
2239# but the spec for `make clean' requires it.
2240# Using unprotoize.c is not quite right in the first place,
2241# but what better way is there?
8521c499 2242 -rm -f libgcc.a libgcc1.a libgcc1-asm.a libgcc2.a libgcc2.ready
43554690 2243 -rm -f libgcc1.null
be0d23ff 2244 -rm -f *.dvi
013a2ee0 2245 -rm -f */*.dvi
c3efc7c4
DE
2246 -if [ -f md.pre-cpp ]; then \
2247 rm -f md ; \
2248 fi
ba1811f1 2249# Delete the include directory.
e5e809f4 2250 -rm -rf include
75ed5d8b 2251# Delete files used by the "multilib" facility (including libgcc subdirs).
f6cdc7ea 2252 -rm -f multilib.h tmpmultilib*
75ed5d8b
DE
2253 -if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \
2254 rm -rf $(MULTILIB_DIRNAMES); \
2255 else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \
2256 rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \
2257 fi ; fi
5768f211 2258 -rm -fr stage1 stage2 stage3 stage4
79d8453e 2259
47547081
RS
2260# Delete all files that users would normally create
2261# while building and installing GCC.
b93a436e 2262distclean: clean lang.distclean
b7cb92ad
JL
2263 -rm -f tm.h config.h auto-host.h auto-build.h tconfig.h hconfig.h
2264 -rm -f md cstamp-h
63d9b81c 2265 -rm -f config.status config.run config.cache config.bak
d232dfa4 2266 -rm -f Make-lang Make-hooks Make-host Make-target
3103b7db 2267 -rm -f Makefile specs.h options.h gencheck.h *.oaux
f24af81b 2268 -rm -f gthr-default.h
26f887e5 2269 -rm -f */stage1 */stage2 */stage3 */stage4 */include
3dab45b7 2270 -rm -f c-parse.output
338023d4 2271 -rm -f *.asm
67446ffe 2272 -rm -f float.h
a051ad3a
JL
2273 -rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak
2274 -rm -f testsuite/{gcc,g++}.{log,sum}
2e494f70
RS
2275
2276# Delete anything likely to be found in the source directory
2277# that shouldn't be in the distribution.
013a2ee0 2278extraclean: distclean lang.extraclean
fb92d909 2279 -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
be0d23ff 2280 -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
3dab45b7
RS
2281 -rm -f config/*/=* config/*/"#"* config/*/*~*
2282 -rm -f config/*/*.orig config/*/*.rej
d72a7857 2283 -rm -f *.dvi *.ps *.oaux *.d *.[zZ] *.gz
184be4bf 2284 -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
3dab45b7 2285 -rm -f *lose config/*lose config/*/*lose
e5e809f4 2286 -rm -f *.s *.s[0-9] *.i config/ChangeLog
013a2ee0
DE
2287 -rm -f */=* */"#"* */*~*
2288 -rm -f */patch* */*.orig */*.rej
2289 -rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz
2290 -rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs
2291 -rm -f */*lose */*.s */*.s[0-9] */*.i
79d8453e 2292
63d9b81c 2293# Get rid of every file that's generated from some other file, except for `configure'.
79d8453e 2294# Most of these files ARE PRESENT in the GCC distribution.
63d9b81c
RK
2295maintainer-clean:
2296 @echo 'This command is intended for maintainers to use; it'
2297 @echo 'deletes files that may need special tools to rebuild.'
b93a436e 2298 $(MAKE) distclean lang.maintainer-clean
3379e8ef 2299 -rm -f c-parse.y c-gperf.h
79d8453e
RS
2300 -rm -f c-parse.c c-parse.h c-parse.output
2301 -rm -f cexp.c cexp.output TAGS
2e494f70
RS
2302 -rm -f cpp.info* cpp.??s cpp.*aux
2303 -rm -f gcc.info* gcc.??s gcc.*aux
544eb21e 2304#\f
79d8453e 2305# Entry points `install' and `uninstall'.
2e494f70 2306# Also use `install-collect2' to install collect2 when the config files don't.
79d8453e 2307
1402d22c 2308# The semicolon is to prevent the install.sh -> install default rule
7bd95cc1
BK
2309# from doing anything. Having it run true helps avoid problems and
2310# noise from versions of make which don't like to have null commands.
d960abef 2311install: $(INSTALL_TARGET) ; @true
79d8453e 2312
ba1811f1 2313# Copy the compiler files into directories where they will be run.
aab26e16
RK
2314# Install the driver last so that the window when things are
2315# broken is small.
b583eed8 2316install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
3379e8ef 2317 install-man install-info lang.install-normal install-driver
79d8453e 2318
057f494b
RS
2319# Do nothing while making gcc with a cross-compiler. The person who
2320# makes gcc for the target machine has to know how to put a complete
2321# gcc together by hand.
2322install-build: force
2323 @echo You have to install gcc on your target machine by hand.
2324
79d8453e
RS
2325# Run this on the target machine
2326# to finish installation of cross compiler.
2327install-cross-rest: install-float-h-cross
2328
2329# Install float.h for cross compiler.
2330# Run this on the target machine!
69cbb85a 2331install-float-h-cross: installdirs
3f7531db
RS
2332# if [ -f enquire ] ; then true; else false; fi
2333# Note: don't use -. We should fail right away if enquire was not made.
2334 ./enquire -f > $(tmpdir)/float.h
79d8453e 2335 -rm -f $(libsubdir)/include/float.h
62c13b81
RS
2336 $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
2337 -rm -f $(tmpdir)/float.h
79d8453e
RS
2338 chmod a-x $(libsubdir)/include/float.h
2339
69cbb85a
RK
2340# Create the installation directories.
2341installdirs:
2342 -if [ -d $(prefix) ] ; then true ; else mkdir $(prefix) ; chmod a+rx $(prefix) ; fi
2343 -if [ -d $(exec_prefix) ] ; then true ; else mkdir $(exec_prefix) ; chmod a+rx $(exec_prefix) ; fi
394fa7c8
JW
2344 -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
2345 -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi
9eb91772 2346# This dir isn't currently searched by cpp.
394fa7c8 2347# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
05fd993d
MH
2348 -fdir= ; for dir in `echo $(libsubdir) | tr '/' ' '`; do \
2349 fdir=$${fdir}/$${dir}; \
2350 if [ -d $${fdir} ] ; then true ; else mkdir $${fdir}; chmod a+rx $${fdir}; fi ; \
2351 done
394fa7c8
JW
2352 -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
2353 -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
2354 -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; chmod a+rx $(tooldir) ; fi
2355 -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
2356 -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
79d8453e
RS
2357# We don't use mkdir -p to create the parents of mandir,
2358# because some systems don't support it.
2359# Instead, we use this technique to create the immediate parent of mandir.
935e11b0 2360 -parent=`echo $(mandir)|sed -e 's@/[^/]*$$@@'`; \
394fa7c8
JW
2361 if [ -d $$parent ] ; then true ; else mkdir $$parent ; chmod a+rx $$parent ; fi
2362 -if [ -d $(mandir) ] ; then true ; else mkdir $(mandir) ; chmod a+rx $(mandir) ; fi
79d8453e
RS
2363
2364# Install the compiler executables built during cross compilation.
69cbb85a 2365install-common: native installdirs $(EXTRA_PARTS) lang.install-common
79d8453e
RS
2366 for file in $(COMPILERS); do \
2367 if [ -f $$file ] ; then \
2368 rm -f $(libsubdir)/$$file; \
2369 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
2370 else true; \
2371 fi; \
2372 done
2fe8d2d6 2373 for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
79d8453e
RS
2374 if [ x"$$file" != x.. ]; then \
2375 rm -f $(libsubdir)/$$file; \
2376 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
2377 else true; fi; \
2378 done
2fe8d2d6
RK
2379 for file in $(EXTRA_PARTS) ..; do \
2380 if [ x"$$file" != x.. ]; then \
2381 rm -f $(libsubdir)/$$file; \
2382 $(INSTALL_DATA) $$file $(libsubdir)/$$file; \
e9a25f70 2383 chmod a-x $(libsubdir)/$$file; \
2fe8d2d6
RK
2384 else true; fi; \
2385 done
f0ec1f64 2386# Don't mess with specs if it doesn't exist yet.
2a7bccbb
TG
2387 -if [ -f specs ] ; then \
2388 rm -f $(libsubdir)/specs; \
f0ec1f64 2389 $(INSTALL_DATA) specs $(libsubdir)/specs; \
e9a25f70 2390 chmod a-x $(libsubdir)/specs; \
f0ec1f64 2391 fi
aab26e16
RK
2392# Install protoize if it was compiled.
2393 -if [ -f protoize$(exeext) ]; \
2394 then \
225695a4
JW
2395 if [ -f gcc-cross$(exeext) ] ; then \
2396 rm -f $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \
2397 $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \
2398 rm -f $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \
2399 $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \
2400 else \
2401 rm -f $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \
2402 $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \
2403 rm -f $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \
2404 $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \
2405 fi ; \
aab26e16
RK
2406 rm -f $(libsubdir)/SYSCALLS.c.X; \
2407 $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
2408 chmod a-x $(libsubdir)/SYSCALLS.c.X; \
2409 fi
2410 -rm -f $(libsubdir)/cpp$(exeext)
2411 $(INSTALL_PROGRAM) cpp$(exeext) $(libsubdir)/cpp$(exeext)
ca363bb6 2412# Install gcov if it was compiled.
59a64126
DE
2413 -if [ -f gcov$(exeext) ]; \
2414 then \
2415 rm -f $(bindir)/gcov$(exeext); \
2416 $(INSTALL_PROGRAM) gcov$(exeext) $(bindir)/gcov$(exeext); \
2417 chmod a+x $(bindir)/gcov$(exeext); \
2418 fi
aab26e16 2419
8b06b20a 2420# Install the driver program as $(target_alias)-gcc
79d8453e 2421# and also as either gcc (if native) or $(tooldir)/bin/gcc.
e09e14e9 2422install-driver: xgcc$(exeext)
173712fb
RK
2423 -if [ -f gcc-cross$(exeext) ] ; then \
2424 rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
94a8b9fe 2425 $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
79d8453e 2426 if [ -d $(tooldir)/bin/. ] ; then \
173712fb
RK
2427 rm -f $(tooldir)/bin/gcc$(exeext); \
2428 $(INSTALL_PROGRAM) gcc-cross$(exeext) $(tooldir)/bin/gcc$(exeext); \
79d8453e
RS
2429 else true; fi; \
2430 else \
173712fb
RK
2431 rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
2432 $(INSTALL_PROGRAM) xgcc$(exeext) $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
8b06b20a 2433 rm -f $(bindir)/$(target_alias)-gcc-1$(exeext); \
ac64120e 2434 $(LN) $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext); \
8b06b20a 2435 mv $(bindir)/$(target_alias)-gcc-1$(exeext) $(bindir)/$(target_alias)-gcc$(exeext); \
79d8453e 2436 fi
79d8453e 2437
0b2fbcb2 2438# Install the info files.
feb9ea1a 2439# $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
ee5b121e 2440# to do the install.
69cbb85a 2441install-info: doc installdirs lang.install-info
0b2fbcb2 2442 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
8be52aaa 2443 for f in cpp.info* gcc.info*; do \
ee5b121e 2444 $(INSTALL_DATA) $$f $(infodir)/$$f; \
feb9ea1a 2445 done
ee5b121e 2446 -if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
f8c86b58 2447 if [ -f $(infodir)/dir ] ; then \
265ce5bb 2448 for f in cpp.info gcc.info; do \
ee5b121e 2449 install-info --dir-file=$(infodir)/dir $(infodir)/$$f; \
265ce5bb 2450 done; \
f8c86b58 2451 else true; fi; \
265ce5bb 2452 else true; fi;
0b2fbcb2
RS
2453 -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
2454
79d8453e 2455# Install the man pages.
69cbb85a 2456install-man: installdirs $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man
e9a25f70 2457 -if [ -f gcc-cross$(exeext) ] ; then \
338023d4
DE
2458 rm -f $(mandir)/$(GCC_CROSS_NAME)$(manext); \
2459 $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/$(GCC_CROSS_NAME)$(manext); \
2460 chmod a-x $(mandir)/$(GCC_CROSS_NAME)$(manext); \
2461 else \
2462 rm -f $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
2463 $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
2464 chmod a-x $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
2465 fi
2e494f70 2466 -rm -f $(mandir)/cccp$(manext)
2e0b13db
RS
2467 -$(INSTALL_DATA) $(srcdir)/cccp.1 $(mandir)/cccp$(manext)
2468 -chmod a-x $(mandir)/cccp$(manext)
79d8453e
RS
2469
2470# Install the library.
69cbb85a 2471install-libgcc: libgcc.a installdirs
79d8453e
RS
2472 -if [ -f libgcc.a ] ; then \
2473 rm -f $(libsubdir)/libgcc.a; \
2474 $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
2475 if $(RANLIB_TEST) ; then \
2476 (cd $(libsubdir); $(RANLIB) libgcc.a); else true; fi; \
2477 chmod a-x $(libsubdir)/libgcc.a; \
2478 else true; fi
2479
f6cdc7ea 2480# Install multiple versions of libgcc.a.
69cbb85a 2481install-multilib: stmp-multilib installdirs
f6cdc7ea
DE
2482 for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
2483 dir=`echo $$i | sed -e 's/;.*$$//'`; \
2484 if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \
47a22692
JM
2485 for f in libgcc.a $(EXTRA_MULTILIB_PARTS); do \
2486 rm -f $(libsubdir)/$${dir}/$${f}; \
2487 $(INSTALL_DATA) $${dir}/$${f} $(libsubdir)/$${dir}/$${f}; \
2488 done; \
f6cdc7ea
DE
2489 if $(RANLIB_TEST); then \
2490 (cd $(libsubdir)/$${dir}; $(RANLIB) libgcc.a); else true; fi; \
2491 chmod a-x $(libsubdir)/$${dir}/libgcc.a; \
2492 done
2493
ba1811f1 2494# Install all the header files built in the include subdirectory.
d7371761 2495install-headers: install-include-dir $(INSTALL_HEADERS_DIR) $(INSTALL_ASSERT_H)
ba1811f1
ILT
2496# Fix symlinks to absolute paths in the installed include directory to
2497# point to the installed directory, not the build directory.
ac64120e 2498# Don't need to use LN_S here since we really do need ln -s and no substitutes.
ba1811f1
ILT
2499 -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
2500 if [ $$? -eq 0 ]; then \
2501 dir=`cd include; pwd`; \
2502 for i in $$files; do \
2503 dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
2504 if expr "$$dest" : "$$dir.*" > /dev/null; then \
2505 rm -f $(libsubdir)/include/$$i; \
44735512 2506 ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
ba1811f1
ILT
2507 fi; \
2508 done; \
2509 fi
79d8453e 2510
ba1811f1 2511# Create or recreate the gcc private include file directory.
69cbb85a 2512install-include-dir: installdirs
ba1811f1
ILT
2513 -rm -rf $(libsubdir)/include
2514 mkdir $(libsubdir)/include
2515 -chmod a+rx $(libsubdir)/include
2516
2517# Install the include directory using tar.
ac1284f9 2518install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
78ea9cda 2519 (cd include; \
6e5bea54 2520 tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
e6431ec5
RS
2521# /bin/sh on some systems returns the status of the first tar,
2522# and that can lose with GNU tar which always writes a full block.
2523# So use `exit 0' to ignore its exit status.
ba1811f1
ILT
2524
2525# Install the include directory using cpio.
ac1284f9 2526install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
609f7031 2527 (cd include; find . -print) | (cd include; cpio -pdum $(libsubdir)/include)
79d8453e 2528
49ba557e
RS
2529# Put assert.h where it won't override GNU libc's assert.h.
2530# It goes in a dir that is searched after GNU libc's headers;
2531# thus, the following conditionals are no longer needed.
2532# But it's not worth deleting them now.
2533## Don't replace the assert.h already there if it is not from GCC.
2534## This code would be simpler if it tested for -f ... && ! grep ...
2535## but supposedly the ! operator is missing in sh on some systems.
69cbb85a 2536install-assert-h: assert.h installdirs
c9d929d7
RS
2537 if [ -f $(assertdir)/assert.h ]; \
2538 then \
998812ac 2539 if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
396f9edb 2540 then \
c9d929d7
RS
2541 rm -f $(assertdir)/assert.h; \
2542 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
0cd4060d 2543 chmod a-x $(assertdir)/assert.h; \
c9d929d7
RS
2544 else true; \
2545 fi; \
9fcedbef 2546 else \
6204c24f
RS
2547 rm -f $(assertdir)/assert.h; \
2548 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
0cd4060d 2549 chmod a-x $(assertdir)/assert.h; \
9fcedbef 2550 fi
79d8453e 2551
10da1131 2552# Use this target to install the program `collect2' under the name `collect2'.
69cbb85a 2553install-collect2: collect2 installdirs
10da1131 2554 $(INSTALL_PROGRAM) collect2$(exeext) $(libsubdir)/collect2$(exeext)
2e494f70 2555# Install the driver program as $(libsubdir)/gcc for collect2.
173712fb 2556 $(INSTALL_PROGRAM) xgcc$(exeext) $(libsubdir)/gcc$(exeext)
2e494f70 2557
79d8453e 2558# Cancel installation by deleting the installed files.
013a2ee0 2559uninstall: lang.uninstall
79d8453e 2560 -rm -rf $(libsubdir)
173712fb
RK
2561 -rm -rf $(bindir)/$(GCC_INSTALL_NAME)$(exeext)
2562 -rm -rf $(bindir)/$(GCC_CROSS_NAME)$(exeext)
2563 -rm -rf $(bindir)/protoize$(exeext)
2564 -rm -rf $(bindir)/unprotoize$(exeext)
9ec36da5 2565 -rm -rf $(bindir)/gcov$(exeext)
338023d4
DE
2566 -rm -rf $(mandir)/$(GCC_INSTALL_NAME)$(manext)
2567 -rm -rf $(mandir)/$(GCC_CROSS_NAME)$(manext)
2e494f70 2568 -rm -rf $(mandir)/cccp$(manext)
79d8453e
RS
2569 -rm -rf $(mandir)/protoize$(manext)
2570 -rm -rf $(mandir)/unprotoize$(manext)
9ec36da5 2571 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
544eb21e 2572#\f
e933cbe0
JL
2573# These targets are for the dejagnu testsuites. The file site.exp
2574# contains global variables that all the testsuites will use.
2575
2576# Set to $(target_alias)/ for cross.
2577target_subdir = @target_subdir@
2578
2579site.exp: ./config.status Makefile
2580 @echo "Making a new config file..."
2581 -@rm -f ./tmp?
2582 @touch site.exp
2583 -@mv site.exp site.bak
2584 @echo "## these variables are automatically generated by make ##" > ./tmp0
2585 @echo "# Do not edit here. If you wish to override these values" >> ./tmp0
2586 @echo "# add them to the last section" >> ./tmp0
2587 @echo "set rootme \"`pwd`\"" >> ./tmp0
2588 @echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0
2589 @echo "set host_triplet $(host_canonical)" >> ./tmp0
2590 @echo "set build_triplet $(build_canonical)" >> ./tmp0
2591 @echo "set target_triplet $(target)" >> ./tmp0
2592 @echo "set target_alias $(target_alias)" >> ./tmp0
2593# CFLAGS is set even though it's empty to show we reserve the right to set it.
2594 @echo "set CFLAGS \"\"" >> ./tmp0
2595 @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
2596# If newlib has been configured, we need to pass -B to gcc so it can find
2597# newlib's crt0.o if it exists. This will cause a "path prefix not used"
2598# message if it doesn't, but the testsuite is supposed to ignore the message -
2599# it's too difficult to tell when to and when not to pass -B (not all targets
2600# have crt0's). We could only add the -B if ../newlib/crt0.o exists, but that
2601# seems like too selective a test.
2602# ??? Another way to solve this might be to rely on linker scripts. Then
2603# theoretically the -B won't be needed.
2604# We also need to pass -L ../ld so that the linker can find ldscripts.
2605 @if [ -d $(objdir)/../$(target_subdir)newlib ] ; then \
2606 echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \
2607 echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)newlib/\"" >> ./tmp0; \
2608 echo "append CFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
2609 echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
2610 echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./tmp0; \
2611 else true; \
2612 fi
2613 @if [ -d $(objdir)/../ld ] ; then \
2614 echo "append LDFLAGS \" -L$(objdir)/../ld\"" >> ./tmp0; \
2615 else true; \
2616 fi
ccdb9251 2617 echo "set tmpdir $(objdir)/testsuite" >> ./tmp0
e933cbe0
JL
2618 @echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0
2619 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
2620 @cat ./tmp0 > site.exp
2621 @cat site.bak | sed \
2622 -e '1,/^## All variables above are.*##/ d' >> site.exp
2623 -@rm -f ./tmp?
2624
d8bb17c8 2625CHECK_TARGETS = check-gcc check-g++ check-g77 check-objc
e933cbe0
JL
2626
2627check: $(CHECK_TARGETS)
2628
3979dfb8 2629testsuite/site.exp: site.exp
e933cbe0
JL
2630 if [ -d testsuite ]; then \
2631 true; \
2632 else \
2633 mkdir testsuite; \
2634 fi
2635 rm -rf testsuite/site.exp
2636 cp site.exp testsuite/site.exp
3979dfb8
JW
2637
2638check-g++: testsuite/site.exp
2639 -rootme=`pwd`; export rootme; \
e933cbe0
JL
2640 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2641 cd testsuite; \
2642 EXPECT=${EXPECT} ; export EXPECT ; \
2643 if [ -f $${rootme}/../expect/expect ] ; then \
2644 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2645 export TCL_LIBRARY ; fi ; \
2646 $(RUNTEST) --tool g++ $(RUNTESTFLAGS)
2647
3979dfb8
JW
2648check-gcc: testsuite/site.exp
2649 -rootme=`pwd`; export rootme; \
e933cbe0
JL
2650 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2651 cd testsuite; \
2652 EXPECT=${EXPECT} ; export EXPECT ; \
2653 if [ -f $${rootme}/../expect/expect ] ; then \
2654 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2655 export TCL_LIBRARY ; fi ; \
2656 $(RUNTEST) --tool gcc $(RUNTESTFLAGS)
2657
dc84d7bc
JL
2658check-g77: testsuite/site.exp
2659 -rootme=`pwd`; export rootme; \
2660 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2661 cd testsuite; \
2662 EXPECT=${EXPECT} ; export EXPECT ; \
2663 if [ -f $${rootme}/../expect/expect ] ; then \
2664 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2665 export TCL_LIBRARY ; fi ; \
2666 $(RUNTEST) --tool g77 $(RUNTESTFLAGS)
2667
d8bb17c8
OP
2668check-objc: testsuite/site.exp
2669 -rootme=`pwd`; export rootme; \
2670 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2671 cd testsuite; \
2672 EXPECT=${EXPECT} ; export EXPECT ; \
2673 if [ -f $${rootme}/../expect/expect ] ; then \
2674 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2675 export TCL_LIBRARY ; fi ; \
2676 $(RUNTEST) --tool objc $(RUNTESTFLAGS)
2677
79d8453e
RS
2678# These exist for maintenance purposes.
2679
2680# Update the tags table.
2681TAGS: force
2682 cd $(srcdir); \
e5e809f4
JL
2683 mkdir tmp-tags; \
2684 mv -f c-parse.[ch] cexp.c =*.[chy] tmp-tags; \
79d8453e 2685 etags *.y *.h *.c; \
e5e809f4
JL
2686 mv tmp-tags/* .; \
2687 rmdir tmp-tags
79d8453e 2688
e5e809f4
JL
2689# Create the distribution tar.gz file.
2690dist: tmp-gcc.xtar
2691 gzip --best < tmp-gcc.xtar > tmp-gcc.xtar.gz
2692 mv tmp-gcc.xtar.gz gcc-$(version).tar.gz
79d8453e 2693
e5e809f4 2694tmp-gcc.xtar: distdir
7d27b36c 2695# Make the distribution.
e5e809f4
JL
2696 tar -chf tmp-gcc.xtar gcc-$(version)
2697
2698distdir-cvs: force
2699 if [ -d $(srcdir)/CVS ]; then cvs -r update; fi
7d27b36c 2700
013a2ee0
DE
2701# This target exists to do the initial work before the language specific
2702# stuff gets done.
3ff34537 2703distdir-start: doc $(srcdir)/INSTALL $(srcdir)/c-parse.y $(srcdir)/c-gperf.h \
e5e809f4 2704 $(srcdir)/c-parse.c $(srcdir)/cexp.c $(srcdir)/config.in \
ee5254ff 2705 $(srcdir)/version.c TAGS
db4e119f 2706 @if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \
f780d21b 2707 then true; \
96b5daff 2708 else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
f780d21b 2709 fi
be0d23ff
RS
2710# Update the version number in README
2711 awk '$$1 " " $$2 " " $$3 == "This directory contains" \
2712 { $$6 = version; print $$0 } \
2713 $$1 " " $$2 " " $$3 != "This directory contains"' \
2714 version=$(version) README > tmp.README
2715 mv tmp.README README
2e494f70 2716 -rm -rf gcc-$(version) tmp
79d8453e
RS
2717# Put all the files in a temporary subdirectory
2718# which has the name that we want to have in the tar file.
2e494f70
RS
2719 mkdir tmp
2720 mkdir tmp/config
eb3a6507 2721 mkdir tmp/ginclude
2e494f70 2722 for file in *[0-9a-zA-Z+]; do \
ac64120e 2723 $(LN) $$file tmp; \
2e494f70
RS
2724 done
2725 cd config; \
2726 for file in *[0-9a-zA-Z+]; do \
e5e809f4 2727 if test -d $$file && test "$$file" != RCS && test "$$file" != CVS; then \
e52114f8
RM
2728 mkdir ../tmp/config/$$file; \
2729 cd $$file; \
2730 for subfile in *[0-9a-zA-Z+]; do \
ac64120e 2731 $(LN) $$subfile ../../tmp/config/$$file; \
e52114f8
RM
2732 done; \
2733 cd ..; \
2734 else \
ac64120e 2735 $(LN) $$file ../tmp/config; \
e52114f8 2736 fi; \
79d8453e 2737 done
eb3a6507
RK
2738 cd ginclude; \
2739 for file in *[0-9a-zA-Z+]; do \
ac64120e 2740 $(LN) $$file ../tmp/ginclude; \
eb3a6507 2741 done
ea727bbf
RS
2742 cd objc; \
2743 for file in *[0-9a-zA-Z+]; do \
ac64120e 2744 $(LN) $$file ../tmp/objc; \
ea727bbf 2745 done
ac64120e 2746 $(LN) .gdbinit tmp
013a2ee0
DE
2747
2748# Finish making `distdir', after the languages have done their thing.
2749distdir-finish:
2e494f70 2750 mv tmp gcc-$(version)
eb3a6507
RK
2751# Get rid of everything we don't want in the distribution. We'd want
2752# this to use Makefile.in, but it doesn't have the `lang.foo' targets
2753# expanded.
e5e809f4 2754 cd gcc-$(version); make extraclean VERSION_DEP=
79d8453e 2755
e5e809f4 2756distdir: distdir-cvs distdir-start lang.distdir distdir-finish
013a2ee0 2757
db4e119f
RS
2758# make diff oldversion=M.N
2759# creates a diff file between an older distribution and this one.
2760# The -P option assumes this is GNU diff.
2761diff:
f137e7dc 2762 diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \
ee5254ff 2763 -x cexp.c -x -x TAGS -x INSTALL \
e5e809f4 2764 -x configure -x config.in \
013a2ee0
DE
2765 -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \
2766 -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \
2767 $(LANG_DIFF_EXCLUDES) \
e5e809f4 2768 gcc-$(oldversion) gcc-$(version) > gcc-$(oldversion)-$(version).diff
db4e119f 2769
361e618f 2770bootstrap bootstrap-lean: force
9c4614c3
TW
2771# Only build the C compiler for stage1, because that is the only one that
2772# we can guarantee will build with the native compiler, and also it is the
2773# only thing useful for building stage2.
5e31e473 2774 $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
79d8453e 2775 $(MAKE) stage1
2e494f70
RS
2776# This used to define ALLOCA as empty, but that would lead to bad results
2777# for a subsequent `make install' since that would not have ALLOCA empty.
2778# To prevent `make install' from compiling alloca.o and then relinking cc1
2779# because alloca.o is newer, we permit these recursive makes to compile
2780# alloca.o. Then cc1 is newer, so it won't have to be relinked.
6f144c9c 2781 $(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 2782 $(MAKE) stage2
361e618f 2783 -if test $@ = bootstrap-lean; then rm -rf stage1; else true; fi
6f144c9c 2784 $(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 2785
eaed7b41 2786bootstrap2 bootstrap2-lean: force
6f144c9c 2787 $(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 2788 $(MAKE) stage2
eaed7b41 2789 -if test $@ = bootstrap2-lean; then rm -rf stage1; else true; fi
6f144c9c 2790 $(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 2791
eaed7b41 2792bootstrap3 bootstrap3-lean: force
6f144c9c 2793 $(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 2794
eaed7b41 2795bootstrap4 bootstrap4-lean: force
6f144c9c 2796 $(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 2797
dcfedcd0
RK
2798# Compare the object files in the current directory with those in the
2799# stage2 directory.
2800
9825189b 2801# ./ avoids bug in some versions of tail.
e85988b5 2802compare compare3 compare4 compare-lean compare3-lean compare4-lean: force
3fb2f401 2803 -rm -f .bad_compare
e85988b5 2804 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
aab26e16 2805 for file in *$(objext); do \
9825189b 2806 tail +16c ./$$file > tmp-foo1; \
e85988b5 2807 tail +16c stage$$stage/$$file > tmp-foo2 \
3fb2f401 2808 && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
dcfedcd0 2809 done
e85988b5 2810 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
013a2ee0 2811 for dir in tmp-foo $(SUBDIRS); do \
aab26e16
RK
2812 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2813 for file in $$dir/*$(objext); do \
013a2ee0 2814 tail +16c ./$$file > tmp-foo1; \
e85988b5 2815 tail +16c stage$$stage/$$file > tmp-foo2 \
3fb2f401 2816 && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
094ecbb0
RK
2817 done; \
2818 fi; \
013a2ee0 2819 done
dcfedcd0 2820 -rm -f tmp-foo*
4931312c 2821 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
3fb2f401
JL
2822 if [ -f .bad_compare ]; then \
2823 echo "Bootstrap comparison failure!"; \
2824 cat .bad_compare; \
2825 exit 1; \
e85988b5
MH
2826 else \
2827 case "$@" in \
2828 *-lean ) rm -rf stage$$stage ;; \
25b76cc1 2829 *) ;; \
e85988b5 2830 esac; true; \
3fb2f401 2831 fi
dcfedcd0 2832
e85988b5
MH
2833# Compare the object files in the current directory with those in the
2834# stage2 directory. Use gnu cmp (diffutils v2.4 or later) to avoid
2835# running tail and the overhead of twice copying each object file.
2836
2837gnucompare gnucompare3 gnucompare4 gnucompare-lean gnucompare3-lean gnucompare4-lean: force
b1e3ddfd 2838 -rm -f .bad_compare
e85988b5 2839 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
b1e3ddfd 2840 for file in *$(objext); do \
e85988b5 2841 (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
b1e3ddfd 2842 done
e85988b5 2843 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
b1e3ddfd
AJ
2844 for dir in tmp-foo $(SUBDIRS); do \
2845 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2846 for file in $$dir/*$(objext); do \
e85988b5 2847 (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
b1e3ddfd
AJ
2848 done; \
2849 fi; \
2850 done
4931312c 2851 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
b1e3ddfd
AJ
2852 if [ -f .bad_compare ]; then \
2853 echo "Bootstrap comparison failure!"; \
2854 cat .bad_compare; \
2855 exit 1; \
e85988b5
MH
2856 else \
2857 case "$@" in \
2858 *-lean ) rm -rf stage$$stage ;; \
2859 esac; true; \
b1e3ddfd
AJ
2860 fi
2861
79d8453e 2862# Copy the object files from a particular stage into a subdirectory.
013a2ee0 2863stage1-start:
2e494f70 2864 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
013a2ee0
DE
2865 -for dir in . $(SUBDIRS) ; \
2866 do \
9a517e7b 2867 if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \
013a2ee0 2868 done
79d8453e 2869 -mv $(STAGESTUFF) stage1
338023d4
DE
2870# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2871# dir will work properly.
ac64120e
JW
2872 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage1 ; else true ; fi
2873 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage1 ; else true ; fi
2874 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage1 ; else true ; fi
79d8453e
RS
2875 -rm -f stage1/libgcc.a
2876 -cp libgcc.a stage1
2877 -if $(RANLIB_TEST) ; then $(RANLIB) stage1/libgcc.a; else true; fi
04e95620
JM
2878 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2879 cp stage1/$${f} . ; \
db814993 2880 else true; \
04e95620 2881 fi; done
013a2ee0 2882stage1: force stage1-start lang.stage1
79d8453e 2883
013a2ee0 2884stage2-start:
2e494f70 2885 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
013a2ee0
DE
2886 -for dir in . $(SUBDIRS) ; \
2887 do \
9a517e7b 2888 if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \
013a2ee0 2889 done
79d8453e 2890 -mv $(STAGESTUFF) stage2
338023d4
DE
2891# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2892# dir will work properly.
ac64120e
JW
2893 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage2 ; else true ; fi
2894 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage2 ; else true ; fi
2895 -if [ -f collect-ld ] ; then $(LN_S) ../collect-ld$(exeext) stage2 ; else true ; fi
79d8453e
RS
2896 -rm -f stage2/libgcc.a
2897 -cp libgcc.a stage2
2898 -if $(RANLIB_TEST) ; then $(RANLIB) stage2/libgcc.a; else true; fi
04e95620
JM
2899 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2900 cp stage2/$${f} . ; \
db814993 2901 else true; \
04e95620 2902 fi; done
013a2ee0 2903stage2: force stage2-start lang.stage2
79d8453e 2904
013a2ee0 2905stage3-start:
935e11b0 2906 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
013a2ee0
DE
2907 -for dir in . $(SUBDIRS) ; \
2908 do \
9a517e7b 2909 if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \
013a2ee0 2910 done
79d8453e 2911 -mv $(STAGESTUFF) stage3
338023d4
DE
2912# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2913# dir will work properly.
ac64120e
JW
2914 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage3 ; else true ; fi
2915 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage3 ; else true ; fi
2916 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage3 ; else true ; fi
79d8453e
RS
2917 -rm -f stage3/libgcc.a
2918 -cp libgcc.a stage3
2919 -if $(RANLIB_TEST) ; then $(RANLIB) stage3/libgcc.a; else true; fi
04e95620
JM
2920 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2921 cp stage3/$${f} . ; \
db814993 2922 else true; \
04e95620 2923 fi; done
013a2ee0 2924stage3: force stage3-start lang.stage3
79d8453e 2925
013a2ee0 2926stage4-start:
935e11b0 2927 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
013a2ee0
DE
2928 -for dir in . $(SUBDIRS) ; \
2929 do \
9a517e7b 2930 if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \
013a2ee0 2931 done
79d8453e 2932 -mv $(STAGESTUFF) stage4
338023d4
DE
2933# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2934# dir will work properly.
ac64120e
JW
2935 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage4 ; else true ; fi
2936 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage4 ; else true ; fi
2937 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage4 ; else true ; fi
79d8453e
RS
2938 -rm -f stage4/libgcc.a
2939 -cp libgcc.a stage4
2940 -if $(RANLIB_TEST) ; then $(RANLIB) stage4/libgcc.a; else true; fi
04e95620
JM
2941 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2942 cp stage4/$${f} . ; \
db814993 2943 else true; \
04e95620 2944 fi; done
013a2ee0 2945stage4: force stage4-start lang.stage4
79d8453e
RS
2946
2947# Copy just the executable files from a particular stage into a subdirectory,
2948# and delete the object files. Use this if you're just verifying a version
2949# that is pretty sure to work, and you are short of disk space.
aab26e16 2950risky-stage1: stage1
003455d9 2951 -make clean
79d8453e 2952
aab26e16 2953risky-stage2: stage2
79d8453e
RS
2954 -make clean
2955
aab26e16 2956risky-stage3: stage3
79d8453e
RS
2957 -make clean
2958
aab26e16 2959risky-stage4: stage4
79d8453e
RS
2960 -make clean
2961
2962#In GNU Make, ignore whether `stage*' exists.
f1908d70 2963.PHONY: stage1 stage2 stage3 stage4 clean maintainer-clean TAGS bootstrap
79d8453e
RS
2964.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
2965
2966force:
e7f62ad3
MH
2967
2968# ---
2969# The enquire rules are still useful for building new float-anything.h.
2970# Special flags for compiling enquire.
2971# We disable optimization to make floating point more reliable.
2972ENQUIRE_CFLAGS = -DNO_MEM -DNO_LONG_DOUBLE_IO -O0
2973ENQUIRE_LDFLAGS = $(LDFLAGS)
2974
2975# Enquire target (This is a variable so that a target can choose not to
2976# build it.)
2977ENQUIRE = enquire
2978
2979# Test to see whether <float.h> exists in the system header files,
2980# and is not derived from GCC.
2981FLOAT_H_TEST = \
2982 [ -f $(SYSTEM_HEADER_DIR)/float.h ] && \
2983 if grep 'ifndef _FLOAT_H___' $(SYSTEM_HEADER_DIR)/float.h >/dev/null; \
2984 then false; \
2985 else :; fi
2986# We pretend to not having a usable <float.h>, hence disable the FLOAT_H_TEST
2987# to ensure, we're emitting a full blown <float.h> ourselves.
2988FLOAT_H_TEST = false
2989
2990# Used to compile enquire with standard cc, but have forgotten why.
2991# Let's try with GCC.
2992enquire: enquire.o $(GCC_PARTS)
2993 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o $@
2994enquire.o: $(srcdir)/enquire.c $(GCC_PASSES) stmp-int-hdrs
2995 if $(FLOAT_H_TEST); then \
2996 rm -f include/float.h; \
2997 SYS_FLOAT_H_WRAP=1; \
2998 else :; \
2999 SYS_FLOAT_H_WRAP=0; \
3000 fi; \
3001 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) \
3002 -DSYS_FLOAT_H_WRAP=$$SYS_FLOAT_H_WRAP \
3003 -I. -c $(srcdir)/enquire.c
3004
3005# Create float.h source for the native machine.
3006# Make it empty if we can use the system float.h without changes.
3007float.h-nat: enquire
3008 -./enquire -f > tmp-float.h
3009 grep '#define [^_]' tmp-float.h >/dev/null || true > tmp-float.h
3010 mv tmp-float.h float.h-nat
3011
3012# Create a dummy float.h source for a cross-compiler.
3013# ??? This isn't used anymore. Should we create config/float-unkn.h
3014# and make that the default float_format in configure?
3015float.h-cross:
3016 echo "#ifndef __GCC_FLOAT_NOT_NEEDED" > t-float.h-cross
3017 echo "#error float.h values not known for cross-compiler" >> t-float.h-cross
3018 echo "#endif" >> t-float.h-cross
3019 mv t-float.h-cross float.h-cross
3020