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