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