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