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