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