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