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