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