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