]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/Makefile.in
(thread_prologue_and_epilogue_insns): When constructing USE chain, set both NEXT_INSN...
[thirdparty/gcc.git] / gcc / Makefile.in
CommitLineData
79d8453e 1# Makefile for GNU C compiler.
ac155eb2 2# Copyright (C) 1987, 88, 90, 91, 92, 1993 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
18#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20# The targets for external use include:
21# all, doc, proto, install, install-cross, install-cross-rest,
2e494f70 22# uninstall, TAGS, mostlyclean, clean, distclean, realclean,
79d8453e
RS
23# stage1, stage2, stage3, stage4.
24
2e494f70
RS
25# Suppress smart makes who think they know how to automake Yacc files
26.y.c:
27
79d8453e
RS
28# Variables that exist for you to override.
29# See below for how to change them for certain systems.
30
31# Selection of languages to be made.
32LANGUAGES = c c++ objective-c proto
33
34ALLOCA =
8d86aaea 35ALLOCA_FLAGS =
2a7bccbb 36ALLOCA_FINISH = true
79d8453e
RS
37
38# Various ways of specifying flags for compilations:
39# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
40# BOOT_CFLAGS is the value of CFLAGS to pass
41# to the stage2 and stage3 compilations
42# XCFLAGS is used for most compilations but not when using the GCC just built.
43XCFLAGS =
44CFLAGS = -g
45BOOT_CFLAGS = -O $(CFLAGS)
46# These exists to be overridden by the x-* and t-* files, respectively.
47X_CFLAGS =
48T_CFLAGS =
49
50X_CPPFLAGS =
51T_CPPFLAGS =
52
53CC = cc
54BISON = bison
0777e4c6 55BISONFLAGS =
79d8453e
RS
56AR = ar
57OLDAR_FLAGS = qc
58AR_FLAGS = rc
59SHELL = /bin/sh
60# on sysV, define this as cp.
61INSTALL = install -c
62# These permit overriding just for certain files.
63INSTALL_PROGRAM = $(INSTALL)
64INSTALL_DATA = $(INSTALL)
65SYMLINK = ln -s
fcd40e95 66MAKEINFO = makeinfo
d8984b6e 67TEXI2DVI = texi2dvi
79d8453e
RS
68
69# Define this as & to perform parallel make on a Sequent.
70# Note that this has some bugs, and it seems currently necessary
71# to compile all the gen* files first by hand to avoid erroneous results.
72P =
73
74# How to invoke ranlib.
75RANLIB = ranlib
76# Test to use to see whether ranlib exists on the system.
77RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
78
79# Compiler to use for compiling libgcc1.a.
80# OLDCC should not be the GNU C compiler,
81# since that would compile typical libgcc1.a functions such as mulsi3
82# into infinite recursions.
83OLDCC = cc
84
85# CFLAGS for use with OLDCC, for compiling libgcc1.a.
86# NOTE: -O does not work on some Unix systems!
87CCLIBFLAGS = -O
88
2e494f70 89# Version of ar to use when compiling libgcc1.a.
79d8453e
RS
90OLDAR = ar
91
ba1811f1
ILT
92# Target to use when installing include directory. Either
93# install-headers-tar or install-headers-cpio.
94INSTALL_HEADERS_DIR = install-headers-tar
95
bf428f48
RS
96# The GCC to use for compiling libgcc2.a, enquire, and cross-test.
97# Usually the one we just built.
79d8453e 98# Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS).
f2e663b6 99GCC_FOR_TARGET = ./xgcc -B./
79d8453e
RS
100
101# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
102# It omits XCFLAGS, and specifies -B./.
bf428f48 103# It also specifies -B$(tooldir)/ to find as and ld for a cross compiler.
57cd2ea1 104GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS)
79d8453e
RS
105
106# Special flags for compiling enquire.
107# We disable optimization to make floating point more reliable.
e18eb523 108ENQUIRE_CFLAGS = -DNO_MEM -DNO_STDDEF -DNO_LONG_DOUBLE_IO -O0
79d8453e
RS
109ENQUIRE_LDFLAGS = $(LDFLAGS)
110
111# Tools to use when building a cross-compiler.
112# These are used because `configure' appends `cross-make'
113# to the makefile when making a cross-compiler.
114
115TARGET_TOOLPREFIX = $(tooldir)/bin/
116AR_FOR_TARGET = $(TARGET_TOOLPREFIX)ar
117AR_FOR_TARGET_FLAGS = rc
118RANLIB_FOR_TARGET = $(TARGET_TOOLPREFIX)ranlib
119RANLIB_TEST_FOR_TARGET = [ -f $(TARGET_TOOLPREFIX)ranlib ]
79d8453e 120
1402d22c
RS
121# Dir to search for system headers. Overridden by cross-make.
122SYSTEM_HEADER_DIR = /usr/include
123
75b6984c
RS
124# Control whether to run fixproto.
125STMP_FIXPROTO = stmp-fixproto
ac1284f9 126
20bd0ab1
RS
127# There may be a premade insn-attrtab.c for this machine.
128# (You could rebuild it with genattrtab as usual, but it takes a long time.)
129# PREMADE_ATTRTAB is the file name of the file to use.
130# PREMADE_ATTRTAB_MD is the md file it corresponds to.
131PREMADE_ATTRTAB_MD = Makefile # Guaranteed not to cmp equal to md.
132PREMADE_ATTRTAB =
133
79d8453e
RS
134target= ... `configure' substitutes actual target name here.
135xmake_file= ... `configure' substitutes actual x- file name here.
136tmake_file= ... `configure' substitutes actual t- file name here.
2c514f26 137version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
1cf94605 138mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
79d8453e
RS
139
140# Directory where sources are, from where we are.
141srcdir = .
142# Common prefix for installation directories.
143# NOTE: This directory must exist when you start installation.
144prefix = /usr/local
c844ddda
RS
145# Directory in which to put localized header files. On the systems with
146# gcc as the native cc, `local_prefix' may not be `prefix' which is
147# `/usr'.
0b2fbcb2
RS
148# NOTE: local_prefix *should not* default from prefix.
149local_prefix = /usr/local
2e494f70
RS
150# Directory in which to put host dependent programs and libraries
151exec_prefix = $(prefix)
79d8453e 152# Directory in which to put the executable for the command `gcc'
2e494f70 153bindir = $(exec_prefix)/bin
79d8453e 154# Directory in which to put the directories used by the compiler.
2e494f70 155libdir = $(exec_prefix)/lib
79d8453e 156# Directory in which the compiler finds executables, libraries, etc.
2e494f70 157libsubdir = $(libdir)/gcc-lib/$(target)/$(version)
49ba557e 158# Directory to search for site-specific includes.
4b7179be 159includedir = $(local_prefix)/include
6204c24f 160# assertdir is overridden in cross-make.
7b4d5f42
RS
161# (But this currently agrees with what is in cross-make.)
162assertdir = $(tooldir)/include
0b2fbcb2
RS
163# where the info files go
164infodir = $(prefix)/info
79d8453e
RS
165# Extension (if any) to put in installed man-page filename.
166manext = .1
167# Directory in which to put man pages.
168mandir = $(prefix)/man/man1
169# Directory in which to find other cross-compilation tools and headers.
170# Used in install-cross.
47279178 171tooldir = $(exec_prefix)/$(target)
62c13b81
RS
172# Dir for temp files.
173tmpdir = /tmp
79d8453e
RS
174
175# Additional system libraries to link with.
176CLIB=
177
178# Change this to a null string if obstacks are installed in the
179# system library.
180OBSTACK=obstack.o
181
b583eed8
DE
182# Specify the rule for actually making libgcc.a,
183LIBGCC = libgcc.a
184# and the rule for installing it.
185INSTALL_LIBGCC = install-libgcc
186
79d8453e 187# Specify the rule for actually making libgcc1.a.
2e494f70
RS
188# The value may be empty; that means to do absolutely nothing
189# with or for libgcc1.a.
79d8453e
RS
190LIBGCC1 = libgcc1.a
191
b0bfa186
ILT
192# Specify the rule for making libgcc1.a for a cross-compiler.
193# The default rule assumes that libgcc1.a is supplied by the user.
194CROSS_LIBGCC1 = libgcc1.cross
195
79d8453e
RS
196# Specify the rule for actually making libgcc2.a.
197LIBGCC2 = libgcc2.a
198
199# Options to use when compiling libgcc2.a.
200# -g1 causes output of debug info only for file-scope entities.
201# we use this here because that should be enough, and also
202# so that -g1 will be tested.
56f9206d
ILT
203LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) -g1
204
205# Additional options to use when compiling libgcc2.a.
206# Some targets override this to -Iinclude
207LIBGCC2_INCLUDES =
208
209# Things which must be built before building libgcc2.a.
210# Some targets override this to stmp-int-hdrs
211LIBGCC2_DEPS =
79d8453e 212
0defb1d5
RS
213# Enquire target (This is a variable so that a target can choose not to
214# build it.)
215ENQUIRE = enquire
216
217# Cross-test target (must also be overridable for a target)
218CROSS_TEST = cross-test
219
79d8453e
RS
220# List of extra executables that should be compiled for this target machine
221# that are used for compiling from source code to object code.
222# The rules for compiling them should be in the t-* file for the machine.
223EXTRA_PASSES =
224
2e494f70
RS
225# Like EXTRA_PASSES, but these are used when linking.
226EXTRA_PROGRAMS =
227
228# List of extra object files that should be compiled for this target machine.
79d8453e
RS
229# The rules for compiling them should be in the t-* file for the machine.
230EXTRA_PARTS =
231
2e494f70
RS
232# List of extra object files that should be compiled and linked with
233# compiler proper (cc1, cc1obj, cc1plus).
234EXTRA_OBJS =
235
f780d21b
RS
236# List of additional header files to install.
237# Often this is edited directly by `configure'.
238EXTRA_HEADERS =
239
47547081
RS
240# Set this to `ld' to enable use of collect2.
241# USE_COLLECT2 =
242# It is convenient for configure to add the assignment at the beginning,
243# so don't override it here.
244
79d8453e
RS
245# List of extra C and assembler files to add to libgcc1.a.
246# Assembler files should have names ending in `.asm'.
247LIB1FUNCS_EXTRA =
248
249# List of extra C and assembler files to add to libgcc2.a.
250# Assembler files should have names ending in `.asm'.
251LIB2FUNCS_EXTRA =
252
ba1811f1
ILT
253# Default float.h source to use for cross-compiler.
254CROSS_FLOAT_H=float.h-cross
255
79d8453e
RS
256# Program to convert libraries.
257LIBCONVERT =
258
259# Control whether header files are installed.
79d8453e
RS
260INSTALL_HEADERS=install-headers
261
0d4d8174
RS
262# Options for tar when copying trees. So HPUX can override it.
263TAROUTOPTS = xpBf
264
79d8453e 265# Select which version of fixincludes to use (I.E. regular versus SVR4)
98e4b835 266# This value is overridden directly by configure.
79d8453e
RS
267FIXINCLUDES=fixincludes
268
66d7ffbf 269# Additional directories of header files to run fixincludes on.
4ab08223
RS
270# These should be directories searched automatically by default
271# just as /usr/include is.
272# *Do not* use this for directories that happen to contain
273# header files, but are not searched automatically by default.
66d7ffbf
RS
274# On most systems, this is empty.
275OTHER_FIXINCLUDES_DIRS=
276
acbbf3d9 277# List of things which should already be built whenever we try to use xgcc
79d8453e 278# to compile anything (without linking).
acbbf3d9 279GCC_PASSES=xgcc cc1 cpp $(EXTRA_PASSES)
79d8453e 280
acbbf3d9 281# List of things which should already be built whenever we try to use xgcc
79d8453e 282# to link anything.
b583eed8 283GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
79d8453e 284
79d8453e
RS
285# Directory to link to, when using the target `maketest'.
286DIR = ../gcc
287
c3efc7c4
DE
288# Guaranteed to not exist when not passing md through cpp.
289MD_FILE = md-cpp-not-used
290
79d8453e
RS
291# Flags to use when cross-building GCC.
292# Prefix to apply to names of object files when using them
293# to run on the machine we are compiling on.
294HOST_PREFIX=
295# Prefix to apply to names of object files when compiling them
296# to run on the machine we are compiling on.
297# The default for this variable is chosen to keep these rules
298# out of the way of the other rules for compiling the same source files.
299HOST_PREFIX_1=loser-
300HOST_CC=$(CC)
301HOST_CFLAGS=$(ALL_CFLAGS)
2e494f70 302HOST_CLIB=$(CLIB)
79d8453e
RS
303HOST_LDFLAGS=$(LDFLAGS)
304HOST_CPPFLAGS=$(ALL_CPPFLAGS)
2e494f70
RS
305HOST_ALLOCA=$(ALLOCA)
306HOST_MALLOC=$(MALLOC)
307HOST_OBSTACK=$(OBSTACK)
79d8453e
RS
308
309# Choose the real default target.
310ALL=all.internal
311
312# Choose the real install target.
ba1811f1
ILT
313INSTALL_TARGET=install-normal
314
315# Source for float.h. Overridden by cross-make.
316FLOAT_H=float.h-nat
79d8453e
RS
317
318# End of variables for you to override.
319
320# Definition of `all' is here so that new rules inserted by sed
321# do not specify the default target.
322# The real definition is under `all.internal' (for native compilers)
323# or `all.cross' (for cross compilers).
2e494f70 324all: all.indirect
79d8453e 325
be0d23ff
RS
326# This tells GNU Make version 3 not to put all variables in the environment.
327.NOEXPORT:
328
79d8453e 329# sed inserts variable overrides after the following line.
60d00117
TW
330####target overrides
331####host overrides
332####cross overrides
057f494b 333####build overrides
79d8453e
RS
334\f
335# Now figure out from those variables how to compile and link.
336
2e494f70
RS
337all.indirect: $(ALL)
338
b4f96011
RS
339# IN_GCC tells obstack.h to use gstddef.h.
340INTERNAL_CFLAGS = $(CROSS) -DIN_GCC
79d8453e
RS
341
342# This is the variable actually used when we compile.
343ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
344
345# Likewise.
346ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
347
348# Even if ALLOCA is set, don't use it if compiling with GCC.
2e494f70
RS
349USE_ALLOCA= ` case "${CC}" in "${OLDCC}") echo ${ALLOCA} ;; esac `
350USE_HOST_ALLOCA= ` case "${HOST_CC}"@"${HOST_ALLOCA}" in "${OLDCC}"@?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
351USE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac `
352USE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac `
79d8453e
RS
353
354# Dependency on obstack, alloca, malloc or whatever library facilities
355# are not installed in the system libraries.
356# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
357LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC)
358
359# Likewise, for use in the tools that must run on this machine
360# even if we are cross-building GCC.
361# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
2e494f70 362HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC)
79d8453e
RS
363
364# How to link with both our special library facilities
365# and the system's installed libraries.
366LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(CLIB)
367
368# Likewise, for use in the tools that must run on this machine
369# even if we are cross-building GCC.
2e494f70
RS
370HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \
371 $(HOST_CLIB)
79d8453e
RS
372
373HOST_RTL = $(HOST_PREFIX)rtl.o
374HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o
d3614a37 375HOST_PRINT = $(HOST_PREFIX)print-rtl.o
79d8453e
RS
376
377# Specify the directories to be searched for header files.
378# Both . and srcdir are used, in that order,
379# so that tm.h and config.h will be found in the compilation
380# subdirectory rather than in the source directory.
381INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config
382SUBDIR_INCLUDES = -I.. -I../$(srcdir) -I../$(srcdir)/config
383
384# Always use -I$(srcdir)/config when compiling.
385.c.o:
386 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
387
388# This tells GNU make version 3 not to export all the variables
389# defined in this file into the environment.
390.NOEXPORT:
391\f
392# Lists of files for various purposes.
393
394# A list of all the language-specific executables.
395COMPILERS = cc1 cc1plus cc1obj
396
397# Language-specific object files for C.
f10fec92
RS
398C_OBJS = c-parse.o c-lang.o c-lex.o c-pragma.o \
399 c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-iterate.o
79d8453e 400
ccfc4033 401# Language-specific object files for Objective C.
f10fec92
RS
402OBJC_OBJS = objc-parse.o objc-act.o c-lex.o c-pragma.o \
403 c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-iterate.o
79d8453e
RS
404
405# Language-specific object files for C++.
406CPLUS_OBJS = cp-parse.o cp-decl.o cp-decl2.o \
407 cp-typeck.o cp-type2.o cp-tree.o cp-ptree.o \
408 cp-cvt.o cp-search.o cp-lex.o cp-gc.o cp-call.o \
409 cp-class.o cp-init.o cp-method.o cp-except.o \
410 cp-expr.o cp-pt.o cp-edsel.o cp-xref.o \
7868c466 411 $(CPLUS_INPUT) cp-spew.o c-common.o cp-error.o cp-errfn.o
79d8453e 412
ca695ac9
JB
413# Files specific to the C interpreter bytecode compiler(s).
414BC_OBJS = bc-emit.o bc-optab.o
415
79d8453e
RS
416# Language-independent object files.
417OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
418 function.o stmt.o expr.o calls.o expmed.o explow.o optabs.o varasm.o \
ee7e5441 419 rtl.o print-rtl.o rtlanal.o emit-rtl.o real.o \
47547081 420 dbxout.o sdbout.o dwarfout.o xcoffout.o \
79d8453e 421 integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o \
f0ec1f64 422 regclass.o local-alloc.o global.o reload.o reload1.o caller-save.o \
79d8453e 423 insn-peep.o reorg.o sched.o final.o recog.o reg-stack.o \
118bdbf8 424 insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \
10055ae2 425 insn-attrtab.o aux-output.o getpwd.o convert.o $(EXTRA_OBJS)
79d8453e
RS
426
427# GEN files are listed separately, so they can be built before doing parallel
428# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load
429# them before rtl.o is compiled.
430GEN= genemit genoutput genrecog genextract genflags gencodes genconfig genpeep
431
432# Files to be copied away after each stage in building.
433STAGESTUFF = *.o insn-flags.h insn-config.h insn-codes.h \
434 insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
8fad1c10 435 insn-attr.h insn-attrtab.c insn-opinit.c \
79d8453e
RS
436 stamp-flags stamp-config stamp-codes \
437 stamp-output stamp-recog stamp-emit stamp-extract stamp-peep \
8fad1c10 438 stamp-attr stamp-attrtab stamp-opinit stamp-proto \
79d8453e 439 genemit genoutput genrecog genextract genflags gencodes genconfig genpeep \
8fad1c10 440 genattrtab genattr genopinit \
2da63e2a
RS
441 bc-arity.h bc-opcode.h bc-opname.h \
442 stamp-bcarity stamp-bcopcode stamp-bcopname \
443 bi-arity bi-opcode bi-opname \
5f11ca4c 444 $(GCC_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross cccp g++ g++-cross \
9c0022f6 445 cc1plus cc1obj enquire protoize unprotoize specs collect2 $(USE_COLLECT2)
79d8453e
RS
446
447# Members of libgcc1.a.
448LIB1FUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
449 _lshrsi3 _lshlsi3 _ashrsi3 _ashlsi3 \
450 _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \
451 _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \
452 _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \
453 _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
454 _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
455
456# Library members defined in libgcc2.c.
457LIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
eccf291b 458 _lshrdi3 _lshldi3 _ashldi3 _ashrdi3 _ffsdi2 \
3af18470 459 _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
79d8453e 460 _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
3971e415 461 _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
d1b4b7c1 462 _fixtfdi _fixunstfdi _floatditf \
96047291 463 __gcc_bcmp _varargs _eprintf _op_new _new_handler _op_delete \
0380c535 464 _bb _shtab _clear_cache _trampoline __main _exit _ctors
79d8453e
RS
465
466# Header files that are made available under the same name
acbbf3d9 467# to programs compiled with GCC.
a2bbfba6 468USER_H = va-alpha.h va-h8300.h va-i860.h va-i960.h va-mips.h va-m88k.h \
581ed239 469 va-pa.h va-pyr.h va-sparc.h va-clipper.h va-spur.h proto.h $(EXTRA_HEADERS)
79d8453e 470
79d8453e
RS
471# The files that "belong" in CONFIG_H are deliberately omitted
472# because having them there would not be useful in actual practice.
473# All they would do is cause complete recompilation every time
474# one of the machine description files is edited.
475# That may or may not be what one wants to do.
476# If it is, rm *.o is an easy way to do it.
477# CONFIG_H = config.h tm.h
478CONFIG_H =
479RTL_H = rtl.h rtl.def machmode.h machmode.def
480TREE_H = tree.h real.h tree.def machmode.h machmode.def
481CPLUS_TREE_H = $(TREE_H) cp-tree.h cp-tree.def
ca695ac9 482BYTECODE_H = bytecode.h bc-emit.h bc-optab.h
79d8453e
RS
483\f
484# Avoid a lot of time thinking about remaking Makefile.in and *.def.
485.SUFFIXES: .in .def
486
47547081 487Makefile: $(srcdir)/Makefile.in $(srcdir)/configure $(srcdir)/version.c \
79d8453e
RS
488 $(srcdir)/config/$(xmake_file) $(srcdir)/config/$(tmake_file)
489 sh config.status
490
491all.internal: start.encap rest.encap
492# This is what to compile if making a cross-compiler.
42396e97
RS
493# Note that we can compile enquire using the cross-compiler just build,
494# although we can't run it on this machine.
0defb1d5 495all.cross: native gcc-cross g++-cross specs $(LIBGCC) stmp-headers $(STMP_FIXPROTO) $(CROSS_TEST) $(ENQUIRE) $(EXTRA_PARTS)
057f494b 496# This is what to compile if making gcc with a cross-compiler.
5f11ca4c 497all.build: native xgcc g++ $(EXTRA_PARTS)
79d8453e 498# This is what must be made before installing GCC and converting libraries.
2bf5788b 499start.encap: native xgcc g++ specs $(LIBGCC1) xlimits.h
79d8453e 500# Use this to make a GCC that will be used only to recompile GCC.
b583eed8 501for-bootstrap: start.encap $(LIBGCC)
79d8453e 502# These can't be made, with COFF encapsulation, until after GCC can run.
ac1284f9 503rest.encap: $(LIBGCC) stmp-headers $(STMP_FIXPROTO) $(EXTRA_PARTS)
79d8453e
RS
504# This is what is made with the host's compiler
505# whether making a cross compiler or not.
d591efa1 506native: config.status cpp $(LANGUAGES) $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
79d8453e
RS
507
508# Define the names for selecting languages in LANGUAGES.
74bb4fdf
RS
509# Note that it would be nice to move the dependency on g++
510# into the C++ rule, but that needs a little bit of work
511# to do the right thing within all.cross.
79d8453e
RS
512C c: cc1
513C++ c++: cc1plus
0d4d8174
RS
514# The next two ought to depend on objc-runtime, but that doesn't work yet.
515OBJC objc: cc1obj
516OBJECTIVE-C objective-c: cc1obj
79d8453e
RS
517PROTO: proto
518
2e494f70
RS
519# Really, really stupid make features, such as SUN's KEEP_STATE, may force
520# a target to build even if it is up-to-date. So we must verify that
521# config.status does not exist before failing.
79d8453e 522config.status:
2e494f70
RS
523 @if [ ! -f config.status ] ; then \
524 echo You must configure gcc. Look at the INSTALL file for details.; \
525 false; \
526 else \
527 true; \
528 fi
79d8453e 529
3aa072f2
RS
530# On the target machine, finish building a cross compiler.
531# This does the things that can't be done on the host machine.
b583eed8 532rest.cross: $(LIBGCC) gfloat.h specs
3aa072f2 533
e97ed334
RS
534# Verify that it works to compile and link cross-test.
535# If it does, then there are sufficient replacements for libgcc1.a.
b583eed8 536cross-test: cross-test.o native gcc-cross $(LIBGCC) $(GCC_PARTS)
e97ed334
RS
537 $(GCC_FOR_TARGET) $(GCC_CFLAGS) cross-test.o -o $@
538cross-test.o: cross-test.c native gcc-cross
539 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/cross-test.c
540
3aa072f2
RS
541# Recompile all the language-independent object files.
542# This is used only if the user explicitly asks for it.
79d8453e
RS
543compilations: ${OBJS}
544
acbbf3d9
RS
545# We call this executable `xgcc' rather than `gcc'
546# to avoid confusion if the current directory is in the path
547# and CC is `gcc'. It is renamed to `gcc' when it is installed.
548xgcc: gcc.o version.o $(LIBDEPS)
549 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o xgcc gcc.o version.o $(LIBS)
3aa072f2
RS
550
551# Dump a specs file to make -B./ read these specs over installed ones.
acbbf3d9 552specs: xgcc
74c84fe6 553 $(GCC_FOR_TARGET) -dumpspecs > specs
79d8453e 554
5f11ca4c
BK
555# Create the compiler driver for g++.
556g++: g++.o $(LIBDEPS)
557 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o g++ g++.o $(LIBS)
558
acbbf3d9 559# We do want to create an executable named `xgcc', so we can use it to
79d8453e
RS
560# compile libgcc2.a.
561# Also create gcc-cross, so that install-common will install properly.
acbbf3d9
RS
562gcc-cross: xgcc
563 cp xgcc gcc-cross
79d8453e 564
5f11ca4c
BK
565# Create a version of the g++ driver which calls the cross-compiler.
566g++-cross: $(srcdir)/g++.c
567 $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o g++-cross \
568 -DGCC_NAME=\"$(target)-gcc\" $(srcdir)/g++.c version.o $(LIBS)
569
0e54aab2 570cc1: $(P) $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
ca695ac9 571 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
79d8453e 572
0e54aab2 573cc1plus: $(P) $(CPLUS_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
ca695ac9 574 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1plus $(CPLUS_OBJS) $(BC_OBJS) $(OBJS) $(LIBS)
79d8453e 575
0e54aab2 576cc1obj: $(P) $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
ca695ac9 577 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1obj $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
79d8453e 578
ba1811f1 579# Copy float.h from its source.
42118350
RK
580gfloat.h: $(FLOAT_H)
581 cp $(FLOAT_H) gfloat.h
ba1811f1
ILT
582
583# Create float.h source for the native machine.
584float.h-nat: enquire
1e558d35
RS
585 -./enquire -f > tmp-float.h
586 mv tmp-float.h float.h-nat
ba1811f1
ILT
587
588# Create a dummy float.h source for a cross-compiler.
589float.h-cross:
590 echo "#error float.h values not known for cross-compiler" > float.h-cross
79d8453e
RS
591
592# Used to compile enquire with standard cc, but have forgotten why.
593# Let's try with GCC.
594enquire: enquire.o $(GCC_PARTS)
595 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o $@
596enquire.o: $(srcdir)/enquire.c $(GCC_PASSES)
e3e873d2
RS
597# -if [ "$(srcdir)" != "." ]; then rm -f ./enquire.c; else true; fi
598# -cp $(srcdir)/enquire.c . > /dev/null 2>&1
2e494f70 599# Breaking this line caused a problem with one version of GNU make.
e3e873d2 600 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) -I. -c $(srcdir)/enquire.c
1402d22c
RS
601
602# Build the version of limits.h that we will install.
603xlimits.h: glimits.h limitx.h limity.h
604 if [ -f $(SYSTEM_HEADER_DIR)/limits.h ] ; then \
605 cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > xlimits.h; \
606 else \
607 cat $(srcdir)/glimits.h > xlimits.h; \
608 fi
79d8453e
RS
609\f
610# Build libgcc.a.
611# This is done in two parts because some functions, in libgcc1.c,
acbbf3d9
RS
612# must be compiled with something other than GCC,
613# while the rest, in libgcc2.c, must be compiled with xgcc.
614# That means we can't do libgcc2.c until after xgcc, cc1, etc.
79d8453e
RS
615
616# Use this as value of LIBGCC1 to cause conversion to GNU library format.
617# LIBCONVERT should put its output in libgcc1.conv.
618libgcc1.conv: libgcc1.a
619 $(LIBCONVERT) libgcc1.a libgcc1.conv
620
621# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely.
622# Make an empty file instead.
57cd2ea1 623libgcc1.null: $(GCC_PASSES)
79d8453e
RS
624 echo "__foo () {}" > dummy.c
625 $(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c
626 $(OLDAR) $(OLDAR_FLAGS) libgcc1.null dummy.o
627 rm -f dummy.o dummy.c
628
b7ac21e3
RS
629# This is $(LIBGCC1) for a cross-compiler.
630# We have no automatic way of building libgcc1.a,
631# so it's up to the installer to find a way to do that.
632# This rule deliberately does not depend on libgcc1.a
633# so that it will fail if the installer hasn't provided it.
634libgcc1.cross:
635 mv libgcc1.a libgcc1.cross || (echo You must find a way to make libgcc1.a; false)
636
79d8453e 637# Compile the library of arithmetic subroutines with the native compiler.
acbbf3d9 638# Don't compile it with GCC!
79d8453e
RS
639# (That would cause most arithmetic functions to call themselves.)
640libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
641 -rm -f tmplibgcc1.a
642# Actually build it in tmplibgcc1.a, then rename at end,
643# so that libgcc1.a itself remains nonexistent if compilation is aborted.
644# -e causes any failing command to make this rule fail.
645# -e doesn't work in certain shells, so we test $$? as well.
432fde52
JW
646# lynx has a broken ar, it always complains when the initial library is
647# empty, thus this command works only if we don't do -e
648# There is a trailing backslash (\) deleted from the following line.
649# set -e;
79d8453e
RS
650 for name in $(LIB1FUNCS); \
651 do \
652 echo $${name}; \
653 rm -f $${name}.o; \
654 $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
655 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
656 mv libgcc1.o $${name}.o; \
657 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
658 rm -f $${name}.o; \
659 done
660# Some shells crash when a loop has no items.
661# So make sure there is always at least one--`..'.
662# Then ignore it.
663# We don't use -e here because there are if statements
664# that should not make the command give up when the if condition is false.
665# Instead, we test for failure after each command where it matters.
2e494f70 666 -for file in .. $(LIB1FUNCS_EXTRA); \
79d8453e
RS
667 do \
668 if [ x$${file} != x.. ]; then \
669 name=`echo $${file} | sed -e 's/[.]c$$//' -e 's/[.]asm$$//'`; \
670 echo $${name}; \
671 if [ $${name}.asm = $${file} ]; then \
62c13b81 672 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
79d8453e
RS
673 else true; fi; \
674 $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
675 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
676 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
677 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
678 rm -f $${name}.[so]; \
679 else true; \
680 fi; \
681 done
682 mv tmplibgcc1.a libgcc1.a
683
684# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
685# But recompiling cc1 should not force recompilation of libgcc2.a.
686# If you want to force recompilation, delete libgcc2.a.
56f9206d 687libgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS)
79d8453e
RS
688 -if [ -f libgcc2.ready ] ; then \
689 true; \
690 else \
691 touch libgcc2.ready; \
692 fi
693
694libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \
bfe655f9 695 machmode.h longlong.h gbl-ctors.h config.status
79d8453e
RS
696# Actually build it in tmplibgcc2.a, then rename at end,
697# so that libgcc2.a itself remains nonexistent if compilation is aborted.
698 -rm -f tmplibgcc2.a
699# -e causes any failing command to make this rule fail.
700# -e doesn't work in certain shells, so we test $$? as well.
432fde52
JW
701# lynx has a broken ar, it always complains when the initial library is
702# empty, thus this command works only if we don't do -e
703# There is a trailing backslash (\) deleted from the following line.
704# set -e;
79d8453e
RS
705 for name in $(LIB2FUNCS); \
706 do \
707 echo $${name}; \
2e494f70 708 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
79d8453e
RS
709 $(srcdir)/libgcc2.c -o $${name}.o; \
710 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
711 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
712 rm -f $${name}.o; \
713 done
714# Some shells crash when a loop has no items.
715# So make sure there is always at least one--`..'.
716# Then ignore it.
717# We don't use -e here because there are if statements
718# that should not make the command give up when the if condition is false.
719# Instead, we test for failure after each command where it matters.
2e494f70 720 -for file in .. $(LIB2FUNCS_EXTRA); \
79d8453e
RS
721 do \
722 if [ x$${file} != x.. ]; then \
723 name=`echo $${file} | sed -e 's/[.]c$$//' -e 's/[.]asm$$//'`; \
724 echo $${name}; \
725 if [ $${name}.asm = $${file} ]; then \
62c13b81 726 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
79d8453e 727 else true; fi; \
2e494f70 728 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
79d8453e
RS
729 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
730 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
731 rm -f $${name}.[so]; \
732 else true; \
733 fi; \
734 done
735 mv tmplibgcc2.a libgcc2.a
736# These lines were deleted from above the mv command
737# because ranlibing libgcc.a itself should suffice.
738# -if [ x${HPUX_GAS} = x ] ; then \
739# if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc2.a; else true; fi \
740# else true; fi
741
742# Combine the various libraries into a single library, libgcc.a.
743libgcc.a: $(LIBGCC1) $(LIBGCC2)
744 -rm -rf tmplibgcc.a libgcc.a tmpcopy
745 mkdir tmpcopy
2e494f70
RS
746 -if [ x$(LIBGCC1) != x ]; \
747 then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
748 else true; \
749 fi
2516bc12
JW
750# Some versions of ar (specifically the one in RISC/os 5.x), create an
751# unwritable table of contents file, and then print an error message when
752# the second ar command tries to overwrite this file. To avoid the error
753# message from ar, we make sure all files are writable.
754 (cd tmpcopy; chmod +w * > /dev/null 2>&1)
79d8453e
RS
755 (cd tmpcopy; $(AR) x ../$(LIBGCC2))
756 (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *.o)
757 rm -rf tmpcopy
758 -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
759# Actually build it in tmplibgcc.a, then rename at end,
760# so that libgcc.a itself remains nonexistent if compilation is aborted.
761 mv tmplibgcc.a libgcc.a
762
ea727bbf
RS
763objc-runtime: libobjc.a
764
8ba23f20 765# Build the Objective C runtime library.
44659439 766libobjc.a: cc1obj libgcc2.ready $(USE_COLLECT2) $(EXTRA_PARTS)
f1553cbb 767 if [ -d objc ]; then true; else mkdir objc; fi
ea727bbf 768 thisdir1=`pwd`; \
265ce9f8 769 srcdir1=`cd $(srcdir); pwd`; \
ea727bbf 770 cd objc; \
5baa9d1f
RS
771 $(MAKE) -f $${srcdir1}/objc/Makefile libobjc.a \
772 srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
773 GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
ea727bbf 774 GCC_CFLAGS="$(GCC_CFLAGS)"
d8880fea 775 -rm -f libobjc.a
7c3b4722 776 ln objc/libobjc.a . >/dev/null 2>&1 || cp objc/libobjc.a .
ea727bbf
RS
777 -if $(RANLIB_TEST) ; then $(RANLIB) libobjc.a; else true; fi
778
779# This is used by objc/Makefile if the user runs that directly.
780sublibobjc.a: cc1obj libgcc2.ready
265ce9f8
TW
781 thisdir1=`pwd`; \
782 srcdir1=`cd $(srcdir); pwd`; \
783 cd objc; \
d8880fea 784 $(MAKE) -f $$srcdir1/objc/Makefile libobjc.a \
265ce9f8
TW
785 srcdir=$$srcdir1 tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
786 GCC_FOR_TARGET="$$thisdir1/xgcc -B$$thisdir1/" \
787 GCC_CFLAGS="$(GCC_CFLAGS)"
79d8453e
RS
788
789# Compile two additional files that are linked with every program
790# linked using GCC on system V, for the sake of C++ constructors.
791crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
792 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -DCRT_BEGIN \
7a69d725
RS
793 -finhibit-size-directive -fno-inline-functions \
794 -g0 -c $(srcdir)/crtstuff.c -o crtbegin.o
79d8453e
RS
795
796crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
797 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -DCRT_END \
7a69d725
RS
798 -finhibit-size-directive -fno-inline-functions \
799 -g0 -c $(srcdir)/crtstuff.c -o crtend.o
79d8453e
RS
800\f
801# Compiling object files from source files.
802
803# Note that dependencies on obstack.h are not written
804# because that file is not part of GCC.
805# Dependencies on gvarargs.h are not written
806# because all that file does, when not compiling with GCC,
807# is include the system varargs.h.
808
809# C language specific files.
810
c21cf0a7
RS
811c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h c-parse.h \
812 c-tree.h input.h flags.h
79d8453e 813 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
26095868
RS
814$(srcdir)/c-parse.c $(srcdir)/c-parse.h: $(srcdir)/c-parse.y
815 cd $(srcdir); $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
1c48d17e
RS
816$(srcdir)/c-parse.y: $(srcdir)/c-parse.in
817 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
818 -e "/^ifc$$/d" -e "/^end ifc$$/d" \
819 $(srcdir)/c-parse.in > $(srcdir)/c-parse.y
820
79d8453e
RS
821c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
822c-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
823c-lang.o : c-lang.c $(CONFIG_H) $(TREE_H)
824c-lex.o : c-lex.c $(CONFIG_H) $(TREE_H) c-lex.h c-tree.h c-parse.h \
825 input.h flags.h
826c-aux-info.o : c-aux-info.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
827c-convert.o : c-convert.c $(CONFIG_H) $(TREE_H) flags.h
bf428f48 828c-pragma.o: c-pragma.c $(CONFIG_H) $(TREE_H)
f10fec92 829c-iterate.o: c-iterate.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h flags.h
79d8453e
RS
830
831# C++ language specific files.
832
1b212aa8 833cp-parse.o : $(srcdir)/cp-parse.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h cp-lex.h
79d8453e
RS
834 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
835 `echo $(srcdir)/cp-parse.c | sed 's,^\./,,'`
836
837$(srcdir)/cp-parse.c $(srcdir)/cp-parse.h : $(srcdir)/cp-parse.y
0776af78 838 @echo expect 27 shift/reduce conflicts and 14 reduce/reduce conflicts
79d8453e 839 cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o cp-parse.c cp-parse.y
b7ac21e3 840 cd $(srcdir); grep '^#define[ ]*YYEMPTY' cp-parse.c >>cp-parse.h
79d8453e
RS
841
842cp-spew.o : cp-spew.c $(CONFIG_H) $(CPLUS_TREE_H) \
1b212aa8 843 $(srcdir)/cp-parse.h flags.h cp-lex.h
79d8453e 844cp-lex.o : cp-lex.c $(CONFIG_H) $(CPLUS_TREE_H) \
1b212aa8 845 $(srcdir)/cp-parse.h $(srcdir)/cp-input.c flags.h cp-hash.h cp-lex.h
79d8453e
RS
846cp-decl.o : cp-decl.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h \
847 cp-lex.h cp-decl.h stack.h
848cp-decl2.o : cp-decl2.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h \
849 cp-lex.h cp-decl.h
850cp-type2.o : cp-type2.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
1b212aa8
BK
851cp-typeck.o : cp-typeck.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h $(RTL_H)
852cp-class.o : cp-class.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
853cp-call.o : cp-call.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
854cp-init.o : cp-init.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h $(RTL_H)
79d8453e
RS
855cp-method.o : cp-method.c $(CONFIG_H) $(CPLUS_TREE_H)
856cp-cvt.o : cp-cvt.c $(CONFIG_H) $(CPLUS_TREE_H)
857cp-search.o : cp-search.c $(CONFIG_H) $(CPLUS_TREE_H) stack.h flags.h
858cp-tree.o : cp-tree.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
859cp-ptree.o : cp-ptree.c $(CONFIG_H) $(CPLUS_TREE_H)
860cp-gc.o : cp-gc.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
1b212aa8 861cp-except.o : cp-except.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h $(RTL_H)
79d8453e
RS
862cp-expr.o : cp-expr.c $(CONFIG_H) $(CPLUS_TREE_H) $(RTL_H) flags.h \
863 expr.h insn-codes.h
864cp-edsel.o : cp-edsel.c $(CONFIG_H) $(CPLUS_TREE_H) stack.h flags.h
1b212aa8 865cp-xref.o : cp-xref.c $(CONFIG_H) $(CPLUS_TREE_H) input.h
79d8453e 866cp-pt.o : cp-pt.c $(CONFIG_H) $(CPLUS_TREE_H) cp-decl.h cp-parse.h
e2381a6f
BK
867cp-error.o : cp-error.c $(CONFIG_H) $(CPLUS_TREE_H)
868cp-errfn.o : cp-errfn.c $(CONFIG_H) $(CPLUS_TREE_H)
79d8453e 869
74bb4fdf
RS
870g++.o : g++.c $(CONFIG_H) gvarargs.h
871
47547081
RS
872# To make a configuration always use collect2, set USE_COLLECT2 to ld.
873ld: collect2
874 rm -f ld
875 ln collect2 ld
876
79d8453e 877collect2 : collect2.o version.o $(LIBDEPS)
057f494b
RS
878# Don't try modifying collect2 (aka ld) in place--it might be linking this.
879 -rm -f collect2
79d8453e
RS
880 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o collect2 collect2.o version.o $(LIBS)
881
882collect2.o : collect2.c $(CONFIG_H) gstab.h
b7b08dcd
RS
883 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
884 -DTARGET_MACHINE=\"$(target)\" \
885 -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
79d8453e 886
ccfc4033 887# Objective C language specific files.
79d8453e
RS
888
889objc-parse.o : $(srcdir)/objc-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
812e2cfe 890 c-tree.h input.h flags.h objc-act.h
79d8453e
RS
891 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/objc-parse.c
892$(srcdir)/objc-parse.c : $(srcdir)/objc-parse.y
893 cd $(srcdir); $(BISON) $(BISONFLAGS) objc-parse.y -o objc-parse.c
26095868
RS
894$(srcdir)/objc-parse.y: $(srcdir)/c-parse.in
895 sed -e "/^ifc$$/,/^end ifc$$/d" \
896 -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
897 $(srcdir)/c-parse.in > $(srcdir)/objc-parse.y
79d8453e 898
469778e2
RS
899objc-act.o : objc-act.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h c-lex.h \
900 flags.h objc-act.h input.h function.h $(srcdir)/c-parse.h
79d8453e
RS
901
902# A file used by all variants of C.
903
904c-common.o : c-common.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
905
906# Language-independent files.
907
f10fec92 908gcc.o: gcc.c $(CONFIG_H) gvarargs.h config.status
79d8453e
RS
909 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
910 -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
2e494f70 911 -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
79d8453e 912 -DDEFAULT_TARGET_MACHINE=\"$(target)\" \
47279178 913 -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\" \
17d4d0e0 914 -DTOOLDIR=\"$(tooldir)/\" \
c60416cd 915 $(MAYBE_TARGET_DEFAULT) \
79d8453e
RS
916 -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
917
918dumpvers: dumpvers.c
919
920version.o: version.c
921obstack.o: obstack.c
922
c5d3565c
BK
923convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h
924
79d8453e
RS
925tree.o : tree.c $(CONFIG_H) $(TREE_H) gvarargs.h flags.h function.h
926print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
927stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) function.h
928fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h
2e494f70 929toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h input.h \
9c6a79a9 930 insn-attr.h xcoffout.h defaults.h
47547081 931 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
b7ac21e3
RS
932 $(MAYBE_TARGET_DEFAULT) $(MAYBE_USE_COLLECT2) \
933 -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
79d8453e
RS
934
935rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
936
937print-rtl.o : print-rtl.c $(CONFIG_H) $(RTL_H)
938rtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
939
672fd7e2 940toplev.o: bytecode.h bc-emit.h
88e71d24 941varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h function.h \
672fd7e2 942 defaults.h insn-codes.h expr.h hard-reg-set.h regs.h xcoffout.h bytecode.h
79d8453e
RS
943function.o : function.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
944 insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
672fd7e2 945 recog.h output.h bytecode.h
79d8453e 946stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
5b7ded0d 947 insn-flags.h insn-config.h insn-codes.h hard-reg-set.h expr.h loop.h \
b92a98fd
DE
948 recog.h bytecode.h bc-typecd.h bc-typecd.def bc-opcode.h bc-optab.h \
949 bc-emit.h
b587ed66 950expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
b92a98fd
DE
951 insn-flags.h insn-codes.h expr.h insn-config.h recog.h output.h \
952 typeclass.h bytecode.h bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h \
953 bc-emit.h modemap.def
79d8453e 954calls.o : calls.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-codes.h \
b587ed66 955 insn-flags.h gvarargs.h
79d8453e
RS
956expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
957 insn-flags.h insn-config.h insn-codes.h expr.h recog.h real.h
958explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h hard-reg-set.h \
959 insn-config.h expr.h recog.h insn-flags.h insn-codes.h
960optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
109bcc7e 961 insn-flags.h insn-config.h insn-codes.h expr.h recog.h reload.h
79d8453e 962dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h regs.h \
6aa4e0b4 963 insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h
79d8453e
RS
964sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) gsyms.h flags.h \
965 insn-config.h reload.h
966dwarfout.o : dwarfout.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf.h flags.h \
8b7ec00c 967 insn-config.h reload.h output.h defaults.h
47547081 968xcoffout.o : xcoffout.c $(CONFIG_H) $(TREE_H) $(RTL_H) xcoffout.h flags.h
32e6ec6f
RK
969emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h gvarargs.h \
970 function.h regs.h insn-config.h insn-codes.h real.h expr.h bytecode.h \
971 bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h bc-emit.h bc-opname.h
ee7e5441 972real.o : real.c $(CONFIG_H) $(TREE_H)
2e494f70 973getpwd.o : getpwd.c $(CONFIG_H)
79d8453e
RS
974
975integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h integrate.h \
672fd7e2
JB
976 insn-flags.h insn-config.h insn-codes.h expr.h real.h function.h \
977 bytecode.h
79d8453e
RS
978
979jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
980 insn-config.h insn-flags.h insn-codes.h expr.h real.h
981stupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h
982
983cse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h real.h \
984 insn-config.h recog.h
985loop.o : loop.c $(CONFIG_H) $(RTL_H) flags.h loop.h insn-config.h \
986 insn-flags.h insn-codes.h regs.h hard-reg-set.h recog.h expr.h real.h
987unroll.o : unroll.c $(CONFIG_H) $(RTL_H) insn-config.h insn-codes.h \
988 integrate.h regs.h flags.h expr.h loop.h
989flow.o : flow.c $(CONFIG_H) $(RTL_H) flags.h insn-config.h \
990 basic-block.h regs.h hard-reg-set.h output.h
991combine.o : combine.c $(CONFIG_H) $(RTL_H) gvarargs.h flags.h \
992 insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \
1717563d 993 basic-block.h recog.h real.h hard-reg-set.h
79d8453e 994regclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
672fd7e2 995 basic-block.h regs.h insn-config.h recog.h reload.h real.h bytecode.h
79d8453e
RS
996local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h basic-block.h \
997 regs.h hard-reg-set.h insn-config.h recog.h output.h
f0ec1f64 998global.o : global.c $(CONFIG_H) $(RTL_H) flags.h \
79d8453e
RS
999 basic-block.h regs.h hard-reg-set.h insn-config.h output.h
1000
1001reload.o : reload.c $(CONFIG_H) $(RTL_H) flags.h \
1002 reload.h recog.h hard-reg-set.h insn-config.h insn-codes.h regs.h real.h
1003reload1.o : reload1.c $(CONFIG_H) $(RTL_H) flags.h expr.h \
1004 reload.h regs.h hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
1005 basic-block.h recog.h output.h
1006caller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \
1007 regs.h hard-reg-set.h insn-config.h basic-block.h recog.h reload.h expr.h
1008reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
1009 basic-block.h regs.h insn-config.h insn-attr.h insn-flags.h recog.h \
1010 flags.h output.h
1011sched.o : sched.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h \
1012 flags.h insn-config.h insn-attr.h
92832bb5 1013final.o : final.c $(CONFIG_H) $(RTL_H) $(TREE_H) gvarargs.h flags.h regs.h \
79d8453e 1014 recog.h conditions.h insn-config.h insn-attr.h real.h output.h \
b7ac21e3 1015 hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
79d8453e
RS
1016recog.o : recog.c $(CONFIG_H) $(RTL_H) \
1017 regs.h recog.h hard-reg-set.h flags.h insn-config.h insn-attr.h \
1018 insn-flags.h insn-codes.h real.h
1019reg-stack.o : reg-stack.c $(CONFIG_H) $(RTL_H) $(TREE_H) \
1020 regs.h hard-reg-set.h flags.h insn-config.h
dcfedcd0 1021
79d8453e
RS
1022aux-output.o : aux-output.c $(CONFIG_H) \
1023 $(RTL_H) regs.h hard-reg-set.h real.h insn-config.h conditions.h \
1024 insn-flags.h output.h insn-attr.h insn-codes.h
1025
4e0db2ce
RK
1026# Build auxiliary files that support ecoff format.
1027mips-tfile: mips-tfile.o version.o $(LIBDEPS)
1028 $(CC) $(CFLAGS) $(LDFLAGS) -o mips-tfile mips-tfile.o version.o $(LIBS)
1029
1030mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H)
1031
1032mips-tdump: mips-tdump.o version.o $(LIBDEPS)
1033 $(CC) $(CFLAGS) $(LDFLAGS) -o mips-tdump mips-tdump.o version.o $(LIBS)
1034
1035mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H)
1036
79d8453e
RS
1037# Normally this target is not used; but it is used if you
1038# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
1039# from the GNU Emacs distribution.
79d8453e 1040alloca.o: alloca.c
79d8453e 1041 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
1d839079 1042 -c `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
79d8453e
RS
1043 $(ALLOCA_FINISH)
1044\f
1045# Generate header and source files from the machine description,
1046# and compile them.
1047
1048.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
1049 insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
1050 insn-attr.h insn-attrtab.c
1051
1052# The following pair of rules has this effect:
1053# genconfig is run only if the md has changed since genconfig was last run;
1054# but the file insn-config.h is touched only when its contents actually change.
1055
1056# Each of the other insn-* files is handled by a similar pair of rules.
1057
1402d22c
RS
1058# This causes an anomaly in the results of make -n
1059# because insn-* is older than stamp-*
1060# and thus make -n thinks that insn-* will be updated
1061# and force recompilation of things that depend on it.
424aa086 1062# We use move-if-change precisely to avoid such recompilation.
1402d22c
RS
1063# But there is no way to teach make -n that it will be avoided.
1064
79d8453e
RS
1065# Each of the insn-*.[ch] rules has a semicolon at the end,
1066# for otherwise the system Make on SunOS 4.1 never tries
7bd95cc1
BK
1067# to recompile insn-*.o. To avoid problems and extra noise from
1068# versions of make which don't like empty commands (nothing after the
1069# trailing `;'), we call true for each.
79d8453e 1070
d960abef 1071insn-config.h: stamp-config ; @true
79d8453e
RS
1072stamp-config : md genconfig $(srcdir)/move-if-change
1073 ./genconfig md > tmp-config.h
1074 $(srcdir)/move-if-change tmp-config.h insn-config.h
1075 touch stamp-config
1076
d960abef 1077insn-flags.h: stamp-flags ; @true
79d8453e
RS
1078stamp-flags : md genflags $(srcdir)/move-if-change
1079 ./genflags md > tmp-flags.h
1080 $(srcdir)/move-if-change tmp-flags.h insn-flags.h
1081 touch stamp-flags
1082
d960abef 1083insn-codes.h: stamp-codes ; @true
79d8453e
RS
1084stamp-codes : md gencodes $(srcdir)/move-if-change
1085 ./gencodes md > tmp-codes.h
1086 $(srcdir)/move-if-change tmp-codes.h insn-codes.h
1087 touch stamp-codes
1088
1089insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h real.h output.h \
1090 insn-config.h insn-flags.h insn-codes.h
1091 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
1092
d960abef 1093insn-emit.c: stamp-emit ; @true
79d8453e
RS
1094stamp-emit : md genemit $(srcdir)/move-if-change
1095 ./genemit md > tmp-emit.c
1096 $(srcdir)/move-if-change tmp-emit.c insn-emit.c
1097 touch stamp-emit
1098
1099insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h recog.h \
1100 real.h output.h flags.h
1101 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
1102
d960abef 1103insn-recog.c: stamp-recog ; @true
79d8453e
RS
1104stamp-recog : md genrecog $(srcdir)/move-if-change
1105 ./genrecog md > tmp-recog.c
1106 $(srcdir)/move-if-change tmp-recog.c insn-recog.c
1107 touch stamp-recog
1108
118bdbf8
RK
1109insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
1110 insn-config.h flags.h rtl.h recog.h expr.h reload.h
1111 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
1112
1113insn-opinit.c: stamp-opinit ; @true
1114stamp-opinit : md genopinit $(srcdir)/move-if-change
1115 ./genopinit md > tmp-opinit.c
1116 $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
1117 touch stamp-opinit
1118
79d8453e
RS
1119insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H)
1120 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
1121
d960abef 1122insn-extract.c: stamp-extract ; @true
79d8453e
RS
1123stamp-extract : md genextract $(srcdir)/move-if-change
1124 ./genextract md > tmp-extract.c
1125 $(srcdir)/move-if-change tmp-extract.c insn-extract.c
1126 touch stamp-extract
1127
1128insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h output.h real.h
1129 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
1130
d960abef 1131insn-peep.c: stamp-peep ; @true
79d8453e
RS
1132stamp-peep : md genpeep $(srcdir)/move-if-change
1133 ./genpeep md > tmp-peep.c
1134 $(srcdir)/move-if-change tmp-peep.c insn-peep.c
1135 touch stamp-peep
1136
1137insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) regs.h real.h output.h \
1138 insn-attr.h insn-config.h
1139 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
1140
d960abef 1141insn-attr.h: stamp-attr ; @true
79d8453e
RS
1142stamp-attr : md genattr $(srcdir)/move-if-change
1143 ./genattr md > tmp-attr.h
1144 $(srcdir)/move-if-change tmp-attr.h insn-attr.h
1145 touch stamp-attr
1146
d960abef 1147insn-attrtab.c: stamp-attrtab ; @true
79d8453e 1148stamp-attrtab : md genattrtab $(srcdir)/move-if-change
20bd0ab1
RS
1149 if cmp -s $(PREMADE_ATTRTAB_MD) md; \
1150 then \
1151 echo Using $(PREMADE_ATTRTAB); \
2e0b13db 1152 cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \
20bd0ab1
RS
1153 else \
1154 ./genattrtab md > tmp-attrtab.c; \
1155 fi
79d8453e
RS
1156 $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
1157 touch stamp-attrtab
1158
1159insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
1160 hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h recog.h \
1161 insn-codes.h
1162 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
1163
d960abef 1164insn-output.c: stamp-output ; @true
79d8453e
RS
1165stamp-output : md genoutput $(srcdir)/move-if-change
1166 ./genoutput md > tmp-output.c
1167 $(srcdir)/move-if-change tmp-output.c insn-output.c
1168 touch stamp-output
1169\f
1170# Compile the programs that generate insn-* from the machine description.
1171# They are compiled with $(HOST_CC), and associated libraries,
1172# since they need to run on this machine
1173# even if GCC is being compiled to run on some other machine.
1174
1175# $(CONFIG_H) is omitted from the deps of the gen*.o
1176# because these programs don't really depend on anything
1177# about the target machine. They do depend on config.h itself,
1178# since that describes the host machine.
1179
c3efc7c4
DE
1180# Pass the md file through cpp if the target requests it.
1181$(MD_FILE): $(CPP_MD)
1182 -if [ -f md.pre-cpp ]; then \
1183 rm -f md ; ./cpp $(CPP_MD_FLAGS) md.pre-cpp | sed 's/^# /; /g' > md ; \
1184 else true ; \
1185 fi
1186
79d8453e
RS
1187genconfig : genconfig.o $(HOST_RTL) $(HOST_LIBDEPS)
1188 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genconfig \
1189 genconfig.o $(HOST_RTL) $(HOST_LIBS)
1190
057f494b 1191genconfig.o : genconfig.c $(RTL_H) hconfig.h
79d8453e
RS
1192 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
1193
1194genflags : genflags.o $(HOST_RTL) $(HOST_LIBDEPS)
1195 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genflags \
1196 genflags.o $(HOST_RTL) $(HOST_LIBS)
1197
057f494b 1198genflags.o : genflags.c $(RTL_H) hconfig.h
79d8453e
RS
1199 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
1200
1201gencodes : gencodes.o $(HOST_RTL) $(HOST_LIBDEPS)
1202 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o gencodes \
1203 gencodes.o $(HOST_RTL) $(HOST_LIBS)
1204
057f494b 1205gencodes.o : gencodes.c $(RTL_H) hconfig.h
79d8453e
RS
1206 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
1207
1208genemit : genemit.o $(HOST_RTL) $(HOST_LIBDEPS)
1209 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genemit \
1210 genemit.o $(HOST_RTL) $(HOST_LIBS)
1211
057f494b 1212genemit.o : genemit.c $(RTL_H) hconfig.h
79d8453e
RS
1213 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
1214
118bdbf8
RK
1215genopinit : genopinit.o $(HOST_RTL) $(HOST_LIBDEPS)
1216 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genopinit \
1217 genopinit.o $(HOST_RTL) $(HOST_LIBS)
1218
1219genopinit.o : genopinit.c $(RTL_H) hconfig.h
1220 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
1221
79d8453e
RS
1222genrecog : genrecog.o $(HOST_RTL) $(HOST_LIBDEPS)
1223 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genrecog \
1224 genrecog.o $(HOST_RTL) $(HOST_LIBS)
1225
057f494b 1226genrecog.o : genrecog.c $(RTL_H) hconfig.h
79d8453e
RS
1227 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
1228
1229genextract : genextract.o $(HOST_RTL) $(HOST_LIBDEPS)
1230 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genextract \
1231 genextract.o $(HOST_RTL) $(HOST_LIBS)
1232
057f494b 1233genextract.o : genextract.c $(RTL_H) hconfig.h insn-config.h
79d8453e
RS
1234 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
1235
1236genpeep : genpeep.o $(HOST_RTL) $(HOST_LIBDEPS)
1237 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genpeep \
1238 genpeep.o $(HOST_RTL) $(HOST_LIBS)
1239
057f494b 1240genpeep.o : genpeep.c $(RTL_H) hconfig.h
79d8453e
RS
1241 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
1242
1243genattr : genattr.o $(HOST_RTL) $(HOST_LIBDEPS)
1244 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genattr \
1245 genattr.o $(HOST_RTL) $(HOST_LIBS)
1246
057f494b 1247genattr.o : genattr.c $(RTL_H) hconfig.h
79d8453e
RS
1248 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
1249
d3614a37 1250genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
79d8453e 1251 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genattrtab \
d3614a37 1252 genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
79d8453e 1253
057f494b 1254genattrtab.o : genattrtab.c $(RTL_H) hconfig.h insn-config.h
79d8453e
RS
1255 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
1256
1257genoutput : genoutput.o $(HOST_RTL) $(HOST_LIBDEPS)
1258 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genoutput \
1259 genoutput.o $(HOST_RTL) $(HOST_LIBS)
1260
057f494b 1261genoutput.o : genoutput.c $(RTL_H) hconfig.h
79d8453e
RS
1262 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
1263\f
1264# Compile the libraries to be used by gen*.
1265# If we are not cross-building, gen* use the same .o's that cc1 will use,
1266# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
1267# with the rules for rtl.o, alloca.o, etc.
1268$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) $(RTL_H)
1269 rm -f $(HOST_PREFIX)rtl.c
057f494b 1270 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
79d8453e
RS
1271 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
1272
d3614a37
RS
1273$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H)
1274 rm -f $(HOST_PREFIX)print-rtl.c
057f494b 1275 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
d3614a37
RS
1276 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
1277
79d8453e
RS
1278$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
1279 rm -f $(HOST_PREFIX)rtlanal.c
057f494b 1280 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
79d8453e
RS
1281 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
1282
1283$(HOST_PREFIX_1)alloca.o: alloca.c
1284 rm -f $(HOST_PREFIX)alloca.c
1285 cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
1286 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
1287
1288$(HOST_PREFIX_1)obstack.o: obstack.c
1289 rm -f $(HOST_PREFIX)obstack.c
057f494b 1290 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/obstack.c > $(HOST_PREFIX)obstack.c
79d8453e
RS
1291 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
1292
1293$(HOST_PREFIX_1)malloc.o: malloc.c
1294 rm -f $(HOST_PREFIX)malloc.c
057f494b 1295 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
79d8453e
RS
1296 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
1297
1298# This satisfies the dependency that we get if you cross-compile a compiler
1299# that does not need to compile alloca, malloc or whatever.
1300$(HOST_PREFIX_1):
1301 touch $(HOST_PREFIX_1)
1302\f
ca695ac9
JB
1303# Remake bytecode files.
1304# BI_ALL=bi-run.o
1305BI_ALL=
1306BC_ALL=bc-opname.h bc-opcode.h bc-arity.h
1307BI_OBJ=bi-parser.o bi-lexer.o bi-reverse.o
1308
1309
4f1c4914 1310bc-emit.o : bc-emit.c $(CONFIG_H) $(RTL_H) real.h $(BYTECODE_H) \
a11826d1 1311 bc-arity.h bc-opcode.h bc-typecd.h bc-typecd.def bi-run.h bytetypes.h
4f1c4914
RS
1312bc-optab.o : bc-optab.c $(CONFIG_H) $(REAL_H) $(BYTECODE_H) \
1313 bc-opcode.h bc-typecd.h bc-typecd.def
ca695ac9
JB
1314
1315
1316bytecode: $(BI_ALL) $(BC_ALL)
1317
4f1c4914
RS
1318bi-arity: bi-arity.o $(BI_OBJ) $(HOST_LIBDEPS)
1319 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o bi-arity \
258a0dd4 1320 bi-arity.o $(BI_OBJ) $(HOST_LIBS)
4f1c4914
RS
1321bi-opcode: bi-opcode.o $(BI_OBJ) $(HOST_LIBDEPS)
1322 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o bi-opcode \
258a0dd4 1323 bi-opcode.o $(BI_OBJ) $(HOST_LIBS)
4f1c4914
RS
1324bi-opname: bi-opname.o $(BI_OBJ) $(HOST_LIBDEPS)
1325 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o bi-opname \
258a0dd4 1326 bi-opname.o $(BI_OBJ) $(HOST_LIBS)
4f1c4914 1327
b92a98fd
DE
1328bi-run.o: $(srcdir)/bi-run.c $(srcdir)/bi-run.h $(srcdir)/bc-typecd.h \
1329 bc-opname.h bc-arity.h bc-opcode.h
27f32a54 1330 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/bi-run.c
4f1c4914
RS
1331$(srcdir)/bi-parser.c $(srcdir)/bi-parser.h: $(srcdir)/bi-parser.y
1332 cd $(srcdir); $(BISON) $(BISONFLAGS) -d bi-parser.y -o bi-parser.c
99f4f5b7 1333bi-parser.o: $(srcdir)/bi-parser.c $(srcdir)/bi-defs.h hconfig.h
4f1c4914
RS
1334 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1335 $(srcdir)/bi-parser.c
99f4f5b7 1336bi-lexer.o: $(srcdir)/bi-lexer.c $(srcdir)/bi-parser.h hconfig.h
4f1c4914
RS
1337 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1338 $(srcdir)/bi-lexer.c
99f4f5b7 1339bi-arity.o: bi-arity.c $(srcdir)/bi-defs.h hconfig.h
4f1c4914
RS
1340 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1341 $(srcdir)/bi-arity.c
d8fc8559 1342bi-opcode.o: bi-opcode.c $(srcdir)/bi-defs.h hconfig.h
4f1c4914
RS
1343 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1344 $(srcdir)/bi-opcode.c
99f4f5b7 1345bi-opname.o: bi-opname.c $(srcdir)/bi-defs.h hconfig.h
4f1c4914
RS
1346 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1347 $(srcdir)/bi-opname.c
1348bi-reverse.o: bi-reverse.c $(srcdir)/bi-defs.h
1349 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1350 $(srcdir)/bi-reverse.c
672fd7e2
JB
1351
1352
cd7fd682
RS
1353bc-arity.h: stamp-bcarity ; @true
1354stamp-bcarity : $(srcdir)/bytecode.def bi-arity $(srcdir)/move-if-change
bd7b47c7
JB
1355 ./bi-arity < $(srcdir)/bytecode.def >tmp-bc-arity.h
1356 $(srcdir)/move-if-change tmp-bc-arity.h bc-arity.h
0e54aab2 1357 touch stamp-bcarity
ca695ac9 1358
cd7fd682
RS
1359bc-opcode.h: stamp-bcopcode ; @true
1360stamp-bcopcode : $(srcdir)/bytecode.def bi-opcode $(srcdir)/move-if-change
a11826d1
RS
1361 ./bi-opcode < $(srcdir)/bytecode.def >tmp-bcopcd.h
1362 $(srcdir)/move-if-change tmp-bcopcd.h bc-opcode.h
0e54aab2 1363 touch stamp-bcopcode
ca695ac9 1364
cd7fd682
RS
1365bc-opname.h: stamp-bcopname ; @true
1366stamp-bcopname : $(srcdir)/bytecode.def bi-opname $(srcdir)/move-if-change
a11826d1
RS
1367 ./bi-opname < $(srcdir)/bytecode.def >tmp-bcopnm.h
1368 $(srcdir)/move-if-change tmp-bcopnm.h bc-opname.h
0e54aab2 1369 touch stamp-bcopname
ca695ac9
JB
1370
1371bytecode.mostlyclean:
1372 -rm -f bc-arity.h bc-opcode.h bc-opname.h
1373
1374bytecode.distclean bytecode.clean: bytecode.mostlyclean
4f1c4914 1375 -rm -f bi-arity bi-opcode bi-opname bi-lexer
ca695ac9
JB
1376
1377bytecode.realclean: bytecode.clean
bc573003 1378 -rm -f bi-parser.c bi-parser.h
ca695ac9
JB
1379
1380\f
79d8453e
RS
1381# Remake cpp and protoize.
1382
1383# Making the preprocessor
1384cpp: cccp
1385 -rm -f cpp
1386 ln cccp cpp
1387cccp: cccp.o cexp.o version.o $(LIBDEPS)
1388 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cccp cccp.o cexp.o version.o $(LIBS)
1389cexp.o: $(srcdir)/cexp.c $(CONFIG_H)
1390 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
1391$(srcdir)/cexp.c: $(srcdir)/cexp.y
1392 cd $(srcdir); $(BISON) -o cexp.c cexp.y
5c539087 1393cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status
79d8453e
RS
1394# The reason we use $(libdir)/g++-include rather than using libsubdir
1395# is for compatibility with the current version of libg++.
1396 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
2e494f70
RS
1397 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
1398 -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
c844ddda 1399 -DLOCAL_INCLUDE_DIR=\"$(local_prefix)/include\" \
2e494f70 1400 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
14b18068 1401 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
17d4d0e0 1402 -DTOOLDIR=\"$(tooldir)/\" \
79d8453e
RS
1403 -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
1404
7bd95cc1
BK
1405# Note for the stamp targets, we run the program `true' instead of
1406# having an empty command (nothing following the semicolon).
1407
acbbf3d9 1408proto: config.status protoize unprotoize SYSCALLS.c.X
79d8453e 1409
2e494f70 1410protoize: protoize.o getopt.o getopt1.o getpwd.o version.o $(LIBDEPS)
79d8453e 1411 $(CC) $(ALL_CFLAGS) $(LDFLAGS) \
2e494f70 1412 protoize.o getopt.o getopt1.o getpwd.o version.o $(LIBS) -o $@
d960abef 1413protoize.o: stamp-proto ; @true
2e0b13db
RS
1414
1415unprotoize: unprotoize.o getopt.o getopt1.o getpwd.o version.o $(LIBDEPS)
1416 $(CC) $(ALL_CFLAGS) $(LDFLAGS) \
1417 unprotoize.o getopt.o getopt1.o getpwd.o version.o $(LIBS) -o $@
d960abef 1418unprotoize.o: stamp-proto ; @true
2e0b13db
RS
1419
1420stamp-proto: $(srcdir)/protoize.c getopt.h $(CONFIG_H)
79d8453e
RS
1421 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1422 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
2e494f70 1423 -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
79d8453e 1424 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
14b18068 1425 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
6056afa0 1426 -DLOCAL_INCLUDE_DIR=\"$(local_prefix)/include\" \
79d8453e 1427 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
2e0b13db
RS
1428 -DUNPROTOIZE $(srcdir)/protoize.c
1429 mv protoize.o unprotoize.o
79d8453e
RS
1430 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1431 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
2e494f70 1432 -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
79d8453e 1433 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
14b18068 1434 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
6056afa0 1435 -DLOCAL_INCLUDE_DIR=\"$(local_prefix)/include\" \
79d8453e 1436 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
2e0b13db 1437 $(srcdir)/protoize.c
acbbf3d9 1438 touch stamp-proto
79d8453e
RS
1439
1440getopt.o: $(srcdir)/getopt.c getopt.h
1441 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt.c
1442getopt1.o: $(srcdir)/getopt1.c getopt.h
1443 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt1.c
1444
79d8453e 1445# This info describes the target machine, so compile with GCC just built.
47547081 1446SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES)
c21cf0a7 1447 -rm -f SYSCALLS.c tmp-SYSCALLS.s
47547081 1448 cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
79d8453e 1449 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
c21cf0a7
RS
1450 -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
1451 -rm -f SYSCALLS.c tmp-SYSCALLS.s
9c0022f6 1452
ac1284f9 1453
9c0022f6 1454test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
4803a34a 1455 -rm -f tmp-proto.[cso]
d3614a37
RS
1456 cp $(srcdir)/protoize.c tmp-proto.c
1457 chmod u+w tmp-proto.c
4803a34a
RK
1458 ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1459 $(CFLAGS) $(INCLUDES) \
9c0022f6
RS
1460 -DGCC_INCLUDE_DIR=0 \
1461 -DGPLUSPLUS_INCLUDE_DIR=0 \
1462 -DCROSS_INCLUDE_DIR=0 \
14b18068 1463 -DTOOL_INCLUDE_DIR=0 \
d3614a37 1464 -DSTD_PROTO_DIR=0" tmp-proto.c
e3e873d2 1465 @echo '**********' Expect 400 lines of differences.
4803a34a
RK
1466 -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
1467 -wc -l tmp-proto.diff
1468 ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1469 $(CFLAGS) $(INCLUDES) \
9c0022f6
RS
1470 -DGCC_INCLUDE_DIR=0 \
1471 -DGPLUSPLUS_INCLUDE_DIR=0 \
1472 -DCROSS_INCLUDE_DIR=0 \
14b18068 1473 -DTOOL_INCLUDE_DIR=0 \
d3614a37 1474 -DSTD_PROTO_DIR=0" tmp-proto.c
9c0022f6 1475 @echo Expect zero differences.
d3614a37 1476 diff $(srcdir)/protoize.c tmp-proto.c | cat
4803a34a 1477 -rm -f tmp-proto.[cso]
79d8453e 1478\f
ba1811f1
ILT
1479# Build the include directory. The stamp files are stmp-* rather than
1480# stamp-* so that mostlyclean does not force the include directory to
1481# be rebuilt.
1482
56f9206d
ILT
1483# Build the include directory except for float.h (which depends upon
1484# enquire).
3dc4a939
RK
1485stmp-int-hdrs: stmp-fixinc $(USER_H) gvarargs.h gstdarg.h gstddef.h \
1486 xlimits.h objc-headers
ba1811f1
ILT
1487# Copy in the headers provided with gcc.
1488# The sed command gets just the last file name component;
1489# this is necessary because VPATH could add a dirname.
1490# Using basename would be simpler, but some systems don't have it.
1491 objdir=`pwd`; \
1492 cd $(srcdir); \
1493 for file in $(USER_H); do \
1494 realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
1f050b9b 1495 rm -f $$objdir/include/$$realfile; \
ba1811f1
ILT
1496 cp $$realfile $$objdir/include; \
1497 chmod a+r $$objdir/include/$$realfile; \
1498 done
1f050b9b 1499 rm -f include/varargs.h
ba1811f1
ILT
1500 cp $(srcdir)/gvarargs.h include/varargs.h
1501 chmod a+r include/varargs.h
1f050b9b 1502 rm -f include/stdarg.h
ba1811f1
ILT
1503 cp $(srcdir)/gstdarg.h include/stdarg.h
1504 chmod a+r include/stdarg.h
1f050b9b 1505 rm -f include/stddef.h
ba1811f1
ILT
1506 cp $(srcdir)/gstddef.h include/stddef.h
1507 chmod a+r include/stddef.h
1f050b9b 1508 rm -f include/limits.h
ba1811f1
ILT
1509 cp xlimits.h include/limits.h
1510 chmod a+r include/limits.h
ba1811f1 1511# Install the README
1f050b9b 1512 rm -f include/README
ba1811f1
ILT
1513 cp $(srcdir)/README-fixinc include/README
1514 chmod a+r include/README
56f9206d
ILT
1515 touch stmp-int-hdrs
1516
1517# Build the complete include directory.
1518stmp-headers: stmp-int-hdrs gfloat.h
1519 rm -f include/float.h
1520 cp gfloat.h include/float.h
1521 chmod a+r include/float.h
ba1811f1
ILT
1522 touch stmp-headers
1523
fefc83ce
ILT
1524# Running fixincludes requires making sure that xgcc and cpp have been
1525# compiled (they are used to get the value of __SIZE_TYPE__).
1526# But recompiling xgcc should not force the the header files to be
1527# fixed again. If you want to do that, delete stmp-fixinc.
1528fixinc.ready: xgcc cpp
1529 -if [ -f fixinc.ready ] ; then \
1530 true; \
1531 else \
1532 touch fixinc.ready; \
1533 fi
1534
ba1811f1 1535# Build fixed copies of system files.
fefc83ce 1536stmp-fixinc: $(srcdir)/$(FIXINCLUDES) gsyslimits.h fixinc.ready
ba1811f1
ILT
1537 rm -rf include
1538 mkdir include
b82a0ad9 1539 if [ x$(FIXINCLUDES) != xMakefile.in ]; \
98e4b835
RS
1540 then \
1541 for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
1542 if [ -d $$dir ]; \
1543 then \
cc08b87d 1544 $(srcdir)/$(FIXINCLUDES) include $$dir $(srcdir) "`pwd`/xgcc -B`pwd`/"; \
98e4b835 1545 else true; fi; \
b82a0ad9 1546 done; \
98e4b835
RS
1547 else true; \
1548 fi
3dc4a939
RK
1549 rm -f include/syslimits.h
1550 if [ -f include/limits.h ]; then \
1551 mv include/limits.h include/syslimits.h; \
1552 else \
1553 cp $(srcdir)/gsyslimits.h include/syslimits.h; \
1554 fi
1555 chmod a+r include/syslimits.h
49b6e255 1556 touch stmp-fixinc
469778e2 1557
41fe5ef9 1558# copy objc header files into build directory
c2dd11d9 1559objc-headers: stmp-fixinc
d68d6b81 1560 if [ -d objc ]; then true; else mkdir objc; fi
469778e2
RS
1561 thisdir1=`pwd`; \
1562 srcdir1=`cd $(srcdir); pwd`; \
1563 cd objc; \
1564 $(MAKE) -f $${srcdir1}/objc/Makefile copy-headers \
1565 srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
1566 GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
1567 GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=$${thisdir1}/include
41fe5ef9 1568 touch objc-headers
ac1284f9
PB
1569
1570# Files related to the fixproto script.
1571
74bb4fdf 1572deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
4fc15c03 1573 CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -Iinclude -I${SYSTEM_HEADER_DIR}"; \
ac1284f9 1574 export CC; \
7b41f815 1575 $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h
ac1284f9
PB
1576 mv tmp-deduced.h deduced.h
1577
c8f09cd2 1578gen-protos: gen-protos.o scan.o $(HOST_LIBDEPS)
8d91dd28 1579 ${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o gen-protos \
c8f09cd2 1580 gen-protos.o scan.o $(HOST_LIBS)
ac1284f9 1581
c192da27
RK
1582gen-protos.o: gen-protos.c scan.h hconfig.h
1583 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c
1584
1585scan.o: scan.c scan.h hconfig.h
1586 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c
7b41f815 1587
74bb4fdf 1588xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
d7a58f93
JW
1589 cat deduced.h $(srcdir)/sys-protos.h > fixtmp.c
1590 $(GCC_FOR_TARGET) fixtmp.c -E \
c1b9947f
PB
1591 | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
1592 | ./gen-protos >xsys-protos.h
d7a58f93 1593 rm -rf fixtmp.c
ac1284f9 1594
c8f09cd2 1595fix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS)
8d91dd28 1596 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o fix-header \
c8f09cd2 1597 fix-header.o scan-decls.o scan.o $(HOST_LIBS)
ac1284f9 1598
c192da27
RK
1599fix-header.o: fix-header.c obstack.h scan.h xsys-protos.h hconfig.h
1600 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c
1601
1602scan-decls.o: scan-decls.c scan.h hconfig.h
1603 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c
ac1284f9 1604
74bb4fdf
RS
1605# stmp-fixproto depends on this, not on fix-header directly.
1606# The idea is to make sure fix-header gets built,
1607# but not rerun fixproto after each stage
1608# just because fix-header's mtime has changed.
1609fixhdr.ready: fix-header
1610 -if [ -f fixhdr.ready ] ; then \
1611 true; \
1612 else \
1613 touch fixhdr.ready; \
1614 fi
1615
ccaf7a07 1616# stmp-headers is to make sure fixincludes has already finished.
700ba19c
RS
1617# The if statement is so that we don't run fixproto a second time
1618# if it has already been run on the files in `include'.
c28464ad 1619stmp-fixproto: fixhdr.ready fixproto stmp-headers
db4e119f 1620 @echo "Various warnings and error messages from fixproto are normal"
70fbceee 1621 -if [ -d include ] ; then true; else mkdir include; fi
700ba19c
RS
1622 if [ -f include/fixed ] ; then true; \
1623 else \
1624 CPP="$(GCC_FOR_TARGET) -E"; export CPP; \
1625 ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
1626 touch include/fixed; \
1627 fi
ac1284f9 1628 touch stmp-fixproto
ba1811f1 1629\f
79d8453e
RS
1630# Remake the info files.
1631
8dbda01e
RS
1632doc: info
1633info: $(srcdir)/cpp.info $(srcdir)/gcc.info
79d8453e 1634
f780d21b 1635$(srcdir)/cpp.info: cpp.texi
1c0015c2 1636 cd $(srcdir); $(MAKEINFO) cpp.texi
79d8453e 1637
f780d21b 1638#$(srcdir)/gplus.info: gplus.texi
fcd40e95 1639# $(MAKEINFO) `echo $(srcdir)/gplus.texi | sed 's,^\./,,'`
79d8453e 1640
f780d21b
RS
1641$(srcdir)/gcc.info: gcc.texi extend.texi install.texi invoke.texi \
1642 md.texi rtl.texi tm.texi
1c0015c2 1643 cd $(srcdir); $(MAKEINFO) gcc.texi
f780d21b 1644
8dbda01e
RS
1645dvi: $(srcdir)/gcc.dvi $(srcdir)/cpp.dvi
1646
dd08cdda
RS
1647# This works with GNU Make's default rule.
1648$(srcdir)/gcc.dvi: gcc.texi extend.texi install.texi invoke.texi \
1649 md.texi rtl.texi tm.texi
d8984b6e 1650 $(TEXI2DVI) $<
dd08cdda
RS
1651
1652# This works with GNU Make's default rule.
1653$(srcdir)/cpp.dvi: cpp.texi
d8984b6e 1654 $(TEXI2DVI) $<
dd08cdda 1655
f780d21b 1656$(srcdir)/INSTALL: install1.texi install.texi
b3b08966
RS
1657 $(MAKEINFO) -D INSTALLONLY --no-header --no-split \
1658 `echo $(srcdir)/install1.texi | sed 's,^\./,,'`
79d8453e
RS
1659\f
1660# Deletion of files made during compilation.
1661# There are four levels of this:
47547081 1662# `mostlyclean', `clean', `distclean' and `realclean'.
79d8453e 1663# `mostlyclean' is useful while working on a particular type of machine.
2e494f70 1664# It deletes most, but not all, of the files made by compilation.
79d8453e 1665# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
2e494f70 1666# `clean' deletes everything made by running `make all'.
47547081 1667# `distclean' also deletes the files made by config.
79d8453e
RS
1668# `realclean' also deletes everything that could be regenerated automatically.
1669
47547081 1670
ca695ac9 1671mostlyclean: bytecode.mostlyclean
79d8453e 1672 -rm -f $(STAGESTUFF)
b7677189
RS
1673# Clean the objc subdir if we created one.
1674 if [ -d objc ]; then \
1675 srcdir1=`cd $(srcdir); pwd`; \
dbe56a66 1676 cd objc; $(MAKE) -f $$srcdir1/objc/Makefile mostlyclean; \
b7677189 1677 else true; fi
8ba23f20 1678 -rm -f libobjc.a
79d8453e
RS
1679# Delete the temporary source copies for cross compilation.
1680 -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
1681 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
1682 -rm -f $(HOST_PREFIX_1)obstack.c
1683# Delete the temp files made in the course of building libgcc.a.
7c65f72c 1684 -rm -f tmplibgcc* tmpcopy xlimits.h
79d8453e
RS
1685 for name in $(LIB1FUNCS); do rm -f $${name}.c; done
1686# Delete other temporary files.
cadb41d5 1687 -rm -f tmp-float.h tmp-gcc.xtar.gz
c21cf0a7 1688 -rm -f tmp-foo1 tmp-foo2 tmp-proto.* tmp-unproto.1 tmp-SYSCALLS.s
79d8453e
RS
1689# Delete the stamp files.
1690 -rm -f stamp-* tmp-*
2e494f70 1691# Delete debugging dump files.
79d8453e 1692 -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
2e494f70
RS
1693 -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack
1694# Delete some files made during installation.
42118350 1695 -rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
47547081 1696 -rm -f collect collect2 ld mips-tfile mips-tdump alloca.s
ac1284f9 1697# Delete files generated for fixproto
1162b3a6 1698 -rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \
02521409 1699 gen-protos fixproto.list fixtmp.* fixhdr.ready
2e494f70
RS
1700# Delete unwanted output files from TeX.
1701 -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
47547081
RS
1702# Delete sorted indices we don't actually use.
1703 -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
2e494f70 1704# Delete core dumps.
99f1660f 1705 -rm -f core config/core
79d8453e 1706
47547081
RS
1707# Delete all files made by compilation
1708# that don't exist in the distribution.
ca695ac9 1709clean: mostlyclean bytecode.clean
20bd0ab1
RS
1710# It may not be quite desirable to delete unprotoize.c here,
1711# but the spec for `make clean' requires it.
1712# Using unprotoize.c is not quite right in the first place,
1713# but what better way is there?
3aa072f2 1714 -rm -f libgcc.a libgcc1.a libgcc2.a libgcc2.ready libgcc1.null
be0d23ff 1715 -rm -f *.dvi
c3efc7c4
DE
1716 -if [ -f md.pre-cpp ]; then \
1717 rm -f md ; \
1718 fi
ba1811f1 1719# Delete the include directory.
fefc83ce 1720 -rm -rf stmp-* fixinc.ready include objc-headers
79d8453e 1721
47547081
RS
1722# Delete all files that users would normally create
1723# while building and installing GCC.
ca695ac9 1724distclean: clean bytecode.distclean
c3efc7c4
DE
1725 -rm -f tm.h aux-output.c config.h config.status tconfig.h hconfig.h
1726 -rm -f md md.pre-cpp
2e0b13db 1727 -rm -f Makefile *.oaux
47547081 1728 -rm -fr stage1 stage2 stage3 stage4
3dab45b7
RS
1729 -rm -f cp-parse.output
1730 -rm -f objc-parse.output
1731 -rm -f c-parse.output
2e494f70
RS
1732
1733# Delete anything likely to be found in the source directory
1734# that shouldn't be in the distribution.
1735extraclean: distclean
fb92d909 1736 -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
be0d23ff 1737 -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
3dab45b7
RS
1738 -rm -f config/*/=* config/*/"#"* config/*/*~*
1739 -rm -f config/*/*.orig config/*/*.rej
b5b5f410
RS
1740 -rm -f objc/=* objc/"#"* objc/*~*
1741 -rm -f objc/*.orig objc/*.rej
184be4bf
RS
1742 -rm -f *.dvi *.oaux *.d *.[zZ] *.gz
1743 -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
3dab45b7 1744 -rm -f *lose config/*lose config/*/*lose
32e6e69a 1745 -rm -f *.s *.s[0-9] *.i install1.texi config/ChangeLog
0ffe297f 1746 -rm -f djefoo
79d8453e
RS
1747
1748# Get rid of every file that's generated from some other file.
1749# Most of these files ARE PRESENT in the GCC distribution.
ca695ac9 1750realclean: distclean bytecode.realclean
75d20d4f 1751 -rm -f c-parse.y objc-parse.y
79d8453e
RS
1752 -rm -f cp-parse.c cp-parse.h cp-parse.output
1753 -rm -f objc-parse.c objc-parse.output
79d8453e
RS
1754 -rm -f c-parse.c c-parse.h c-parse.output
1755 -rm -f cexp.c cexp.output TAGS
2e494f70
RS
1756 -rm -f cpp.info* cpp.??s cpp.*aux
1757 -rm -f gcc.info* gcc.??s gcc.*aux
1758 -rm -f gplus.info* gplus.??s gplus.*aux
79d8453e
RS
1759\f
1760# Entry points `install' and `uninstall'.
2e494f70 1761# Also use `install-collect2' to install collect2 when the config files don't.
79d8453e 1762
1402d22c 1763# The semicolon is to prevent the install.sh -> install default rule
7bd95cc1
BK
1764# from doing anything. Having it run true helps avoid problems and
1765# noise from versions of make which don't like to have null commands.
d960abef 1766install: $(INSTALL_TARGET) ; @true
79d8453e 1767
ba1811f1 1768# Copy the compiler files into directories where they will be run.
b583eed8
DE
1769install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
1770 install-man install-info
79d8453e 1771
057f494b
RS
1772# Do nothing while making gcc with a cross-compiler. The person who
1773# makes gcc for the target machine has to know how to put a complete
1774# gcc together by hand.
1775install-build: force
1776 @echo You have to install gcc on your target machine by hand.
1777
79d8453e
RS
1778# Run this on the target machine
1779# to finish installation of cross compiler.
1780install-cross-rest: install-float-h-cross
1781
1782# Install float.h for cross compiler.
1783# Run this on the target machine!
f825b10f 1784install-float-h-cross: install-dir
3f7531db
RS
1785# if [ -f enquire ] ; then true; else false; fi
1786# Note: don't use -. We should fail right away if enquire was not made.
1787 ./enquire -f > $(tmpdir)/float.h
79d8453e 1788 -rm -f $(libsubdir)/include/float.h
62c13b81
RS
1789 $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
1790 -rm -f $(tmpdir)/float.h
79d8453e
RS
1791 chmod a-x $(libsubdir)/include/float.h
1792
1793# Create the installation directory.
1794install-dir:
935e11b0
TW
1795 -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi
1796 -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; fi
9eb91772 1797# This dir isn't currently searched by cpp.
316bd062 1798# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; fi
935e11b0
TW
1799 -if [ -d $(libdir)/gcc-lib/$(target) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target) ; fi
1800 -if [ -d $(libdir)/gcc-lib/$(target)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version) ; fi
f780d21b 1801 -if [ -d $(libdir)/gcc-lib/$(target)/$(version)/include ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version)/include ; fi
935e11b0 1802 -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; fi
51e787ca 1803 -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; fi
1a5e5e4b 1804 -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; fi
7b4d5f42 1805 -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; fi
0b2fbcb2 1806 -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; fi
79d8453e
RS
1807# We don't use mkdir -p to create the parents of mandir,
1808# because some systems don't support it.
1809# Instead, we use this technique to create the immediate parent of mandir.
935e11b0 1810 -parent=`echo $(mandir)|sed -e 's@/[^/]*$$@@'`; \
79d8453e
RS
1811 if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
1812 -if [ -d $(mandir) ] ; then true ; else mkdir $(mandir) ; fi
1813
1814# Install the compiler executables built during cross compilation.
939f89e1 1815install-common: native install-dir xgcc $(EXTRA_PARTS)
79d8453e
RS
1816 for file in $(COMPILERS); do \
1817 if [ -f $$file ] ; then \
1818 rm -f $(libsubdir)/$$file; \
1819 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
1820 else true; \
1821 fi; \
1822 done
47547081 1823 for file in $(EXTRA_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
79d8453e
RS
1824 if [ x"$$file" != x.. ]; then \
1825 rm -f $(libsubdir)/$$file; \
1826 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
1827 else true; fi; \
1828 done
f0ec1f64 1829# Don't mess with specs if it doesn't exist yet.
2a7bccbb
TG
1830 -if [ -f specs ] ; then \
1831 rm -f $(libsubdir)/specs; \
f0ec1f64
RS
1832 $(INSTALL_DATA) specs $(libsubdir)/specs; \
1833 fi
97ac9064 1834# Install the driver program as $(target)-gcc
79d8453e
RS
1835# and also as either gcc (if native) or $(tooldir)/bin/gcc.
1836 -if [ -f gcc-cross ] ; then \
dab8915b 1837 rm -f $(bindir)/$(target)-gcc; \
97ac9064 1838 $(INSTALL_PROGRAM) gcc-cross $(bindir)/$(target)-gcc; \
79d8453e
RS
1839 if [ -d $(tooldir)/bin/. ] ; then \
1840 rm -f $(tooldir)/bin/gcc; \
1841 $(INSTALL_PROGRAM) gcc-cross $(tooldir)/bin/gcc; \
79d8453e 1842 else true; fi; \
5f11ca4c
BK
1843 if [ -f cc1plus ] ; then \
1844 rm -f $(bindir)/$(target)-g++; \
1845 $(INSTALL_PROGRAM) g++-cross $(bindir)/$(target)-g++; \
1846 chmod a+x $(bindir)/$(target)-g++; \
1847 rm -f $(bindir)/$(target)-c++; \
1848 ln $(bindir)/$(target)-g++ $(bindir)/$(target)-c++; \
1849 fi ; \
79d8453e
RS
1850 else \
1851 rm -f $(bindir)/gcc; \
acbbf3d9 1852 $(INSTALL_PROGRAM) xgcc $(bindir)/gcc; \
97ac9064
ILT
1853 rm -f $(bindir)/$(target)-gcc-1; \
1854 ln $(bindir)/gcc $(bindir)/$(target)-gcc-1; \
1855 mv $(bindir)/$(target)-gcc-1 $(bindir)/$(target)-gcc; \
0debc007 1856 if [ -f cc1plus ] ; then \
9eb91772
DE
1857 rm -f $(bindir)/g++; \
1858 $(INSTALL_PROGRAM) g++ $(bindir)/g++; \
1859 chmod a+x $(bindir)/g++; \
1860 rm -f $(bindir)/c++; \
1861 ln $(bindir)/g++ $(bindir)/c++; \
0debc007 1862 fi ; \
79d8453e 1863 fi
cfa88f62 1864# Install protoize if it was compiled.
17d4d0e0 1865 -if [ -f protoize ]; \
cfa88f62
RS
1866 then \
1867 rm -f $(bindir)/protoize; \
1868 $(INSTALL_PROGRAM) protoize $(bindir)/protoize; \
1869 rm -f $(bindir)/unprotoize; \
1870 $(INSTALL_PROGRAM) unprotoize $(bindir)/unprotoize; \
1871 rm -f $(libsubdir)/SYSCALLS.c.X; \
1872 $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
1873 chmod a-x $(libsubdir)/SYSCALLS.c.X; \
1874 fi
79d8453e
RS
1875 -rm -f $(libsubdir)/cpp
1876 $(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
1877
0b2fbcb2 1878# Install the info files.
f825b10f 1879install-info: doc install-dir
0b2fbcb2
RS
1880 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
1881 cd $(srcdir); for f in cpp.info* gcc.info*; \
1882 do $(INSTALL_DATA) $$f $(infodir)/$$f; done
1883 -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
1884
79d8453e 1885# Install the man pages.
acbbf3d9 1886install-man: install-dir $(srcdir)/gcc.1 $(srcdir)/cccp.1 $(srcdir)/g++.1
79d8453e 1887 -rm -f $(mandir)/gcc$(manext)
2e0b13db
RS
1888 -$(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/gcc$(manext)
1889 -chmod a-x $(mandir)/gcc$(manext)
2e494f70 1890 -rm -f $(mandir)/cccp$(manext)
2e0b13db
RS
1891 -$(INSTALL_DATA) $(srcdir)/cccp.1 $(mandir)/cccp$(manext)
1892 -chmod a-x $(mandir)/cccp$(manext)
2e0b13db
RS
1893 -$(INSTALL_DATA) $(srcdir)/g++.1 $(mandir)/g++$(manext)
1894 -chmod a-x $(mandir)/g++$(manext)
79d8453e
RS
1895
1896# Install the library.
4b3c8365 1897install-libgcc: libgcc.a install-dir
79d8453e
RS
1898 -if [ -f libgcc.a ] ; then \
1899 rm -f $(libsubdir)/libgcc.a; \
1900 $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
1901 if $(RANLIB_TEST) ; then \
1902 (cd $(libsubdir); $(RANLIB) libgcc.a); else true; fi; \
1903 chmod a-x $(libsubdir)/libgcc.a; \
1904 else true; fi
1905
62c13b81
RS
1906# Install the objc run time library.
1907install-libobjc: libobjc.a install-dir
1908 -if [ -f libobjc.a ] ; then \
1909 rm -f $(libsubdir)/libobjc.a; \
1910 $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \
1911 if $(RANLIB_TEST) ; then \
1912 (cd $(libsubdir); $(RANLIB) libobjc.a); else true; fi; \
1913 chmod a-x $(libsubdir)/libobjc.a; \
1914 else true; fi
1915
ba1811f1
ILT
1916# Install all the header files built in the include subdirectory.
1917install-headers: install-include-dir $(INSTALL_HEADERS_DIR) install-assert-h
1918# Fix symlinks to absolute paths in the installed include directory to
1919# point to the installed directory, not the build directory.
1920 -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
1921 if [ $$? -eq 0 ]; then \
1922 dir=`cd include; pwd`; \
1923 for i in $$files; do \
1924 dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
1925 if expr "$$dest" : "$$dir.*" > /dev/null; then \
1926 rm -f $(libsubdir)/include/$$i; \
44735512 1927 ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
ba1811f1
ILT
1928 fi; \
1929 done; \
1930 fi
79d8453e 1931
ba1811f1 1932# Create or recreate the gcc private include file directory.
4808d7a7 1933install-include-dir: install-dir
ba1811f1
ILT
1934 -rm -rf $(libsubdir)/include
1935 mkdir $(libsubdir)/include
1936 -chmod a+rx $(libsubdir)/include
1937
1938# Install the include directory using tar.
ac1284f9 1939install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
e6431ec5
RS
1940 cd include; \
1941 (tar cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
1942# /bin/sh on some systems returns the status of the first tar,
1943# and that can lose with GNU tar which always writes a full block.
1944# So use `exit 0' to ignore its exit status.
ba1811f1
ILT
1945
1946# Install the include directory using cpio.
ac1284f9 1947install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
585ec938 1948 cd include; find . -print | cpio -pdum $(libsubdir)/include
79d8453e 1949
49ba557e
RS
1950# Put assert.h where it won't override GNU libc's assert.h.
1951# It goes in a dir that is searched after GNU libc's headers;
1952# thus, the following conditionals are no longer needed.
1953# But it's not worth deleting them now.
1954## Don't replace the assert.h already there if it is not from GCC.
1955## This code would be simpler if it tested for -f ... && ! grep ...
1956## but supposedly the ! operator is missing in sh on some systems.
ba1811f1 1957install-assert-h: assert.h install-dir
c9d929d7
RS
1958 if [ -f $(assertdir)/assert.h ]; \
1959 then \
998812ac 1960 if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
396f9edb 1961 then \
c9d929d7
RS
1962 rm -f $(assertdir)/assert.h; \
1963 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
0cd4060d 1964 chmod a-x $(assertdir)/assert.h; \
c9d929d7
RS
1965 else true; \
1966 fi; \
9fcedbef 1967 else \
6204c24f
RS
1968 rm -f $(assertdir)/assert.h; \
1969 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
0cd4060d 1970 chmod a-x $(assertdir)/assert.h; \
9fcedbef 1971 fi
79d8453e 1972
2e494f70 1973# Use this target to install the program `collect2' under the name `ld'.
f825b10f 1974install-collect2: collect2 install-dir
2e494f70
RS
1975 $(INSTALL_PROGRAM) collect2 $(libsubdir)/ld
1976# Install the driver program as $(libsubdir)/gcc for collect2.
acbbf3d9 1977 $(INSTALL_PROGRAM) xgcc $(libsubdir)/gcc
2e494f70 1978
79d8453e
RS
1979# Cancel installation by deleting the installed files.
1980uninstall:
1981 -rm -rf $(libsubdir)
1982 -rm -rf $(bindir)/gcc
79d8453e
RS
1983 -rm -rf $(bindir)/protoize
1984 -rm -rf $(bindir)/unprotoize
1985 -rm -rf $(mandir)/gcc$(manext)
976876dd 1986 -rm -rf $(mandir)/g++$(manext)
2e494f70 1987 -rm -rf $(mandir)/cccp$(manext)
79d8453e
RS
1988 -rm -rf $(mandir)/protoize$(manext)
1989 -rm -rf $(mandir)/unprotoize$(manext)
1990\f
1991# These exist for maintenance purposes.
1992
1993# Update the tags table.
1994TAGS: force
1995 cd $(srcdir); \
1996 mkdir temp; \
abd09f97 1997 mv -f c-parse.[ch] cp-parse.[ch] objc-parse.c cexp.c =*.[chy] temp; \
79d8453e
RS
1998 etags *.y *.h *.c; \
1999 mv temp/* .; \
2000 rmdir temp
2001
2002# Create the distribution tar file.
cadb41d5
RS
2003#dist: gcc-$(version).tar.gz
2004dist: gcc.xtar.gz
79d8453e 2005
cadb41d5
RS
2006gcc.xtar.gz: gcc.xtar
2007 gzip < gcc.xtar > tmp-gcc.xtar.gz
2008 mv tmp-gcc.xtar.gz gcc.xtar.gz
79d8453e 2009
cadb41d5
RS
2010#gcc-$(version).tar.gz: gcc-$(version).tar
2011# gzip < gcc-$(version).tar > gcc-$(version).tar.gz
79d8453e
RS
2012
2013#gcc-$(version).tar:
7d27b36c
RS
2014gcc.xtar: distdir
2015# Make the distribution.
2016 tar chf gcc.xtar gcc-$(version)
2017
976876dd
RS
2018distdir: doc $(srcdir)/INSTALL c-parse.y objc-parse.y cp-parse.y \
2019 c-parse.c cp-parse.c objc-parse.c cexp.c
db4e119f 2020 @if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \
f780d21b 2021 then true; \
96b5daff 2022 else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
f780d21b 2023 fi
be0d23ff
RS
2024# Update the version number in README
2025 awk '$$1 " " $$2 " " $$3 == "This directory contains" \
2026 { $$6 = version; print $$0 } \
2027 $$1 " " $$2 " " $$3 != "This directory contains"' \
2028 version=$(version) README > tmp.README
2029 mv tmp.README README
2e494f70 2030 -rm -rf gcc-$(version) tmp
79d8453e
RS
2031# Put all the files in a temporary subdirectory
2032# which has the name that we want to have in the tar file.
2e494f70
RS
2033 mkdir tmp
2034 mkdir tmp/config
ea727bbf 2035 mkdir tmp/objc
2e494f70 2036 for file in *[0-9a-zA-Z+]; do \
be0d23ff 2037 ln $$file tmp > /dev/null 2>&1 || cp $$file tmp; \
2e494f70
RS
2038 done
2039 cd config; \
2040 for file in *[0-9a-zA-Z+]; do \
f95640cc 2041 if test -d $$file && test "$$file" != RCS; then \
e52114f8
RM
2042 mkdir ../tmp/config/$$file; \
2043 cd $$file; \
2044 for subfile in *[0-9a-zA-Z+]; do \
2045 ln $$subfile ../../tmp/config/$$file >/dev/null 2>&1 \
2046 || cp $$subfile ../../tmp/config/$$file; \
2047 done; \
2048 cd ..; \
2049 else \
2050 ln $$file ../tmp/config >/dev/null 2>&1 \
2051 || cp $$file ../tmp/config; \
2052 fi; \
79d8453e 2053 done
ea727bbf
RS
2054 cd objc; \
2055 for file in *[0-9a-zA-Z+]; do \
057f494b 2056 ln $$file ../tmp/objc >/dev/null 2>&1 || cp $$file ../tmp/objc; \
ea727bbf 2057 done
2e494f70
RS
2058 ln .gdbinit tmp
2059 mv tmp gcc-$(version)
79d8453e 2060# Get rid of everything we don't want in the distribution.
2e494f70 2061 cd gcc-$(version); make -f Makefile.in extraclean
79d8453e 2062
db4e119f
RS
2063# make diff oldversion=M.N
2064# creates a diff file between an older distribution and this one.
2065# The -P option assumes this is GNU diff.
2066diff:
2067 diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x objc-parse.y \
e63a24c8 2068 -x cp-parse.c -x cp-parse.h -x cexp.c -x bi-parser.c \
ef60d313 2069 -x objc-parse.c -x TAGS -x "gcc.??" -x "gcc.??s" -x gcc.aux \
db4e119f
RS
2070 -x "cpp.??s" -x "cpp.??" -x cpp.aux -x "cpp.info*" -x "gcc.info*" \
2071 gcc-$(oldversion) gcc-$(version) > diffs
2072
79d8453e
RS
2073# do make -f ../gcc/Makefile maketest DIR=../gcc
2074# in the intended test directory to make it a suitable test directory.
2075# THIS IS OBSOLETE; use the -srcdir operand in configure instead.
2076maketest:
2077 ln -s $(DIR)/*.[chy] .
2078 ln -s $(DIR)/configure .
2079 ln -s $(DIR)/*.def .
2080 -rm -f =*
2081 ln -s $(DIR)/.gdbinit .
2082 ln -s $(DIR)/$(FIXINCLUDES) .
2083 -ln -s $(DIR)/bison.simple .
2084 ln -s $(DIR)/config .
2085 ln -s $(DIR)/move-if-change .
2086# The then and else were swapped to avoid a problem on Ultrix.
2087 if [ ! -f Makefile ] ; then ln -s $(DIR)/Makefile .; else false; fi
2088 -rm tm.h aux-output.c config.h md
2089 make clean
2090# You must then run config to set up for compilation.
acbbf3d9 2091
9c4614c3
TW
2092bootstrap: force
2093# Only build the C compiler for stage1, because that is the only one that
2094# we can guarantee will build with the native compiler, and also it is the
2095# only thing useful for building stage2.
676ce223 2096 $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES=c
79d8453e 2097 $(MAKE) stage1
2e494f70
RS
2098# This used to define ALLOCA as empty, but that would lead to bad results
2099# for a subsequent `make install' since that would not have ALLOCA empty.
2100# To prevent `make install' from compiling alloca.o and then relinking cc1
2101# because alloca.o is newer, we permit these recursive makes to compile
2102# alloca.o. Then cc1 is newer, so it won't have to be relinked.
a2ecc7b9 2103 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e 2104 $(MAKE) stage2
a2ecc7b9 2105 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e
RS
2106
2107bootstrap2: force
a2ecc7b9 2108 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e 2109 $(MAKE) stage2
a2ecc7b9 2110 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e
RS
2111
2112bootstrap3: force
a2ecc7b9 2113 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e 2114
dcfedcd0
RK
2115# Compare the object files in the current directory with those in the
2116# stage2 directory.
2117
9825189b 2118# ./ avoids bug in some versions of tail.
dcfedcd0
RK
2119compare: force
2120 for file in *.o; do \
9825189b 2121 tail +16c ./$$file > tmp-foo1; \
acbbf3d9
RS
2122 tail +16c stage2/$$file > tmp-foo2 2>/dev/null \
2123 && (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
dcfedcd0
RK
2124 done
2125 -rm -f tmp-foo*
2126
2127# Similar, but compare with stage3 directory
2128compare3: force
2129 for file in *.o; do \
acbbf3d9
RS
2130 tail +16c $$file > tmp-foo1; \
2131 tail +16c stage3/$$file > tmp-foo2 2>/dev/null \
2132 && (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
dcfedcd0
RK
2133 done
2134 -rm -f tmp-foo*
2135
79d8453e
RS
2136# Copy the object files from a particular stage into a subdirectory.
2137stage1: force
2e494f70 2138 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
79d8453e
RS
2139 -mv $(STAGESTUFF) stage1
2140 -rm -f stage1/libgcc.a
2141 -cp libgcc.a stage1
2142 -if $(RANLIB_TEST) ; then $(RANLIB) stage1/libgcc.a; else true; fi
2143
2144stage2: force
2e494f70 2145 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
79d8453e
RS
2146 -mv $(STAGESTUFF) stage2
2147 -rm -f stage2/libgcc.a
2148 -cp libgcc.a stage2
2149 -if $(RANLIB_TEST) ; then $(RANLIB) stage2/libgcc.a; else true; fi
2150
2151stage3: force
935e11b0 2152 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
79d8453e
RS
2153 -mv $(STAGESTUFF) stage3
2154 -rm -f stage3/libgcc.a
2155 -cp libgcc.a stage3
2156 -if $(RANLIB_TEST) ; then $(RANLIB) stage3/libgcc.a; else true; fi
2157
2158stage4: force
935e11b0 2159 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
79d8453e
RS
2160 -mv $(STAGESTUFF) stage4
2161 -rm -f stage4/libgcc.a
2162 -cp libgcc.a stage4
2163 -if $(RANLIB_TEST) ; then $(RANLIB) stage4/libgcc.a; else true; fi
2164
2165# Copy just the executable files from a particular stage into a subdirectory,
2166# and delete the object files. Use this if you're just verifying a version
2167# that is pretty sure to work, and you are short of disk space.
2168risky-stage1: force
935e11b0 2169 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
6fb26153 2170 -mv $(GCC_PARTS) stage1
79d8453e
RS
2171 -rm -f stage1/libgcc.a
2172 -cp libgcc.a stage1 && $(RANLIB) stage1/libgcc.a
2173 -make clean
2174
2175risky-stage2: force
935e11b0 2176 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
6fb26153 2177 -mv $(GCC_PARTS) stage2
79d8453e
RS
2178 -rm -f stage2/libgcc.a
2179 -cp libgcc.a stage2 && $(RANLIB) stage2/libgcc.a
2180 -make clean
2181
2182risky-stage3: force
935e11b0 2183 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
6fb26153 2184 -mv $(GCC_PARTS) stage3
79d8453e
RS
2185 -rm -f stage3/libgcc.a
2186 -cp libgcc.a stage3 && $(RANLIB) stage3/libgcc.a
2187 -make clean
2188
2189risky-stage4: force
935e11b0 2190 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
6fb26153 2191 -mv $(GCC_PARTS) stage4
79d8453e
RS
2192 -rm -f stage4/libgcc.a
2193 -cp libgcc.a stage4 && $(RANLIB) stage4/libgcc.a
2194 -make clean
2195
2196#In GNU Make, ignore whether `stage*' exists.
2197.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
2198.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
2199
2200force: