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