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