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