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