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