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