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