]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/Makefile.in
Initial revision
[thirdparty/gcc.git] / gcc / Makefile.in
CommitLineData
32e6d418 1# Makefile for GNU C compiler.
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
61fad423 124# Control whether to run fixproto.
125STMP_FIXPROTO = stmp-fixproto
a5889b74 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.
047c2b8b 508# Note that it would be nice to move the dependency on g++
509# into the C++ rule, but that needs a little bit of work
510# to do the right thing within all.cross.
32e6d418 511C c: cc1
512C++ c++: cc1plus
ed2f1f67 513# The next two ought to depend on objc-runtime, but that doesn't work yet.
514OBJC objc: cc1obj
515OBJECTIVE-C objective-c: cc1obj
32e6d418 516PROTO: proto
517
c6396a0b 518# Really, really stupid make features, such as SUN's KEEP_STATE, may force
519# a target to build even if it is up-to-date. So we must verify that
520# config.status does not exist before failing.
32e6d418 521config.status:
c6396a0b 522 @if [ ! -f config.status ] ; then \
523 echo You must configure gcc. Look at the INSTALL file for details.; \
524 false; \
525 else \
526 true; \
527 fi
32e6d418 528
840a6e8d 529# On the target machine, finish building a cross compiler.
530# This does the things that can't be done on the host machine.
2289acd7 531rest.cross: $(LIBGCC) gfloat.h specs
840a6e8d 532
d7330690 533# Verify that it works to compile and link cross-test.
534# If it does, then there are sufficient replacements for libgcc1.a.
2289acd7 535cross-test: cross-test.o native gcc-cross $(LIBGCC) $(GCC_PARTS)
d7330690 536 $(GCC_FOR_TARGET) $(GCC_CFLAGS) cross-test.o -o $@
537cross-test.o: cross-test.c native gcc-cross
538 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/cross-test.c
539
840a6e8d 540# Recompile all the language-independent object files.
541# This is used only if the user explicitly asks for it.
32e6d418 542compilations: ${OBJS}
543
77a164d8 544# We call this executable `xgcc' rather than `gcc'
545# to avoid confusion if the current directory is in the path
546# and CC is `gcc'. It is renamed to `gcc' when it is installed.
547xgcc: gcc.o version.o $(LIBDEPS)
548 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o xgcc gcc.o version.o $(LIBS)
840a6e8d 549
550# Dump a specs file to make -B./ read these specs over installed ones.
77a164d8 551specs: xgcc
c666179a 552 $(GCC_FOR_TARGET) -dumpspecs > specs
32e6d418 553
22a266b1 554# Create the compiler driver for g++.
555g++: g++.o $(LIBDEPS)
556 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o g++ g++.o $(LIBS)
557
77a164d8 558# We do want to create an executable named `xgcc', so we can use it to
32e6d418 559# compile libgcc2.a.
560# Also create gcc-cross, so that install-common will install properly.
77a164d8 561gcc-cross: xgcc
562 cp xgcc gcc-cross
32e6d418 563
22a266b1 564# Create a version of the g++ driver which calls the cross-compiler.
565g++-cross: $(srcdir)/g++.c
566 $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o g++-cross \
567 -DGCC_NAME=\"$(target)-gcc\" $(srcdir)/g++.c version.o $(LIBS)
568
675fc1b6 569cc1: $(P) $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
649d8da6 570 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
32e6d418 571
675fc1b6 572cc1plus: $(P) $(CPLUS_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
649d8da6 573 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1plus $(CPLUS_OBJS) $(BC_OBJS) $(OBJS) $(LIBS)
32e6d418 574
675fc1b6 575cc1obj: $(P) $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
649d8da6 576 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1obj $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
32e6d418 577
2cfd79fe 578# Copy float.h from its source.
d82b9c93 579gfloat.h: $(FLOAT_H)
580 cp $(FLOAT_H) gfloat.h
2cfd79fe 581
582# Create float.h source for the native machine.
583float.h-nat: enquire
121c5e86 584 -./enquire -f > tmp-float.h
585 mv tmp-float.h float.h-nat
2cfd79fe 586
587# Create a dummy float.h source for a cross-compiler.
588float.h-cross:
589 echo "#error float.h values not known for cross-compiler" > float.h-cross
32e6d418 590
591# Used to compile enquire with standard cc, but have forgotten why.
592# Let's try with GCC.
593enquire: enquire.o $(GCC_PARTS)
594 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o $@
595enquire.o: $(srcdir)/enquire.c $(GCC_PASSES)
1a754c64 596# -if [ "$(srcdir)" != "." ]; then rm -f ./enquire.c; else true; fi
597# -cp $(srcdir)/enquire.c . > /dev/null 2>&1
c6396a0b 598# Breaking this line caused a problem with one version of GNU make.
1a754c64 599 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) -I. -c $(srcdir)/enquire.c
3f69fed5 600
601# Build the version of limits.h that we will install.
602xlimits.h: glimits.h limitx.h limity.h
603 if [ -f $(SYSTEM_HEADER_DIR)/limits.h ] ; then \
604 cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > xlimits.h; \
605 else \
606 cat $(srcdir)/glimits.h > xlimits.h; \
607 fi
32e6d418 608\f
609# Build libgcc.a.
610# This is done in two parts because some functions, in libgcc1.c,
77a164d8 611# must be compiled with something other than GCC,
612# while the rest, in libgcc2.c, must be compiled with xgcc.
613# That means we can't do libgcc2.c until after xgcc, cc1, etc.
32e6d418 614
615# Use this as value of LIBGCC1 to cause conversion to GNU library format.
616# LIBCONVERT should put its output in libgcc1.conv.
617libgcc1.conv: libgcc1.a
618 $(LIBCONVERT) libgcc1.a libgcc1.conv
619
620# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely.
621# Make an empty file instead.
66e9b81a 622libgcc1.null: $(GCC_PASSES)
32e6d418 623 echo "__foo () {}" > dummy.c
624 $(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c
625 $(OLDAR) $(OLDAR_FLAGS) libgcc1.null dummy.o
626 rm -f dummy.o dummy.c
627
fe918d35 628# This is $(LIBGCC1) for a cross-compiler.
629# We have no automatic way of building libgcc1.a,
630# so it's up to the installer to find a way to do that.
631# This rule deliberately does not depend on libgcc1.a
632# so that it will fail if the installer hasn't provided it.
633libgcc1.cross:
634 mv libgcc1.a libgcc1.cross || (echo You must find a way to make libgcc1.a; false)
635
32e6d418 636# Compile the library of arithmetic subroutines with the native compiler.
77a164d8 637# Don't compile it with GCC!
32e6d418 638# (That would cause most arithmetic functions to call themselves.)
639libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
640 -rm -f tmplibgcc1.a
641# Actually build it in tmplibgcc1.a, then rename at end,
642# so that libgcc1.a itself remains nonexistent if compilation is aborted.
643# -e causes any failing command to make this rule fail.
644# -e doesn't work in certain shells, so we test $$? as well.
547e1b60 645# lynx has a broken ar, it always complains when the initial library is
646# empty, thus this command works only if we don't do -e
647# There is a trailing backslash (\) deleted from the following line.
648# set -e;
32e6d418 649 for name in $(LIB1FUNCS); \
650 do \
651 echo $${name}; \
652 rm -f $${name}.o; \
653 $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
654 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
655 mv libgcc1.o $${name}.o; \
656 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
657 rm -f $${name}.o; \
658 done
659# Some shells crash when a loop has no items.
660# So make sure there is always at least one--`..'.
661# Then ignore it.
662# We don't use -e here because there are if statements
663# that should not make the command give up when the if condition is false.
664# Instead, we test for failure after each command where it matters.
c6396a0b 665 -for file in .. $(LIB1FUNCS_EXTRA); \
32e6d418 666 do \
667 if [ x$${file} != x.. ]; then \
668 name=`echo $${file} | sed -e 's/[.]c$$//' -e 's/[.]asm$$//'`; \
669 echo $${name}; \
670 if [ $${name}.asm = $${file} ]; then \
f32abccb 671 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
32e6d418 672 else true; fi; \
673 $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
674 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
675 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
676 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
677 rm -f $${name}.[so]; \
678 else true; \
679 fi; \
680 done
681 mv tmplibgcc1.a libgcc1.a
682
683# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
684# But recompiling cc1 should not force recompilation of libgcc2.a.
685# If you want to force recompilation, delete libgcc2.a.
690a93ea 686libgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS)
32e6d418 687 -if [ -f libgcc2.ready ] ; then \
688 true; \
689 else \
690 touch libgcc2.ready; \
691 fi
692
693libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \
33927595 694 machmode.h longlong.h gbl-ctors.h config.status
32e6d418 695# Actually build it in tmplibgcc2.a, then rename at end,
696# so that libgcc2.a itself remains nonexistent if compilation is aborted.
697 -rm -f tmplibgcc2.a
698# -e causes any failing command to make this rule fail.
699# -e doesn't work in certain shells, so we test $$? as well.
547e1b60 700# lynx has a broken ar, it always complains when the initial library is
701# empty, thus this command works only if we don't do -e
702# There is a trailing backslash (\) deleted from the following line.
703# set -e;
32e6d418 704 for name in $(LIB2FUNCS); \
705 do \
706 echo $${name}; \
c6396a0b 707 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
32e6d418 708 $(srcdir)/libgcc2.c -o $${name}.o; \
709 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
710 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
711 rm -f $${name}.o; \
712 done
713# Some shells crash when a loop has no items.
714# So make sure there is always at least one--`..'.
715# Then ignore it.
716# We don't use -e here because there are if statements
717# that should not make the command give up when the if condition is false.
718# Instead, we test for failure after each command where it matters.
c6396a0b 719 -for file in .. $(LIB2FUNCS_EXTRA); \
32e6d418 720 do \
721 if [ x$${file} != x.. ]; then \
722 name=`echo $${file} | sed -e 's/[.]c$$//' -e 's/[.]asm$$//'`; \
723 echo $${name}; \
724 if [ $${name}.asm = $${file} ]; then \
f32abccb 725 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
32e6d418 726 else true; fi; \
c6396a0b 727 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
32e6d418 728 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
729 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
730 rm -f $${name}.[so]; \
731 else true; \
732 fi; \
733 done
734 mv tmplibgcc2.a libgcc2.a
735# These lines were deleted from above the mv command
736# because ranlibing libgcc.a itself should suffice.
737# -if [ x${HPUX_GAS} = x ] ; then \
738# if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc2.a; else true; fi \
739# else true; fi
740
741# Combine the various libraries into a single library, libgcc.a.
742libgcc.a: $(LIBGCC1) $(LIBGCC2)
743 -rm -rf tmplibgcc.a libgcc.a tmpcopy
744 mkdir tmpcopy
c6396a0b 745 -if [ x$(LIBGCC1) != x ]; \
746 then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
747 else true; \
748 fi
edf5976e 749# Some versions of ar (specifically the one in RISC/os 5.x), create an
750# unwritable table of contents file, and then print an error message when
751# the second ar command tries to overwrite this file. To avoid the error
752# message from ar, we make sure all files are writable.
753 (cd tmpcopy; chmod +w * > /dev/null 2>&1)
32e6d418 754 (cd tmpcopy; $(AR) x ../$(LIBGCC2))
755 (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *.o)
756 rm -rf tmpcopy
757 -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
758# Actually build it in tmplibgcc.a, then rename at end,
759# so that libgcc.a itself remains nonexistent if compilation is aborted.
760 mv tmplibgcc.a libgcc.a
761
4f1fd857 762objc-runtime: libobjc.a
763
bd594491 764# Build the Objective C runtime library.
58df976d 765libobjc.a: cc1obj libgcc2.ready $(USE_COLLECT2) $(EXTRA_PARTS)
d6518ea8 766 if [ -d objc ]; then true; else mkdir objc; fi
4f1fd857 767 thisdir1=`pwd`; \
e5190fd1 768 srcdir1=`cd $(srcdir); pwd`; \
4f1fd857 769 cd objc; \
72bce1c3 770 $(MAKE) -f $${srcdir1}/objc/Makefile libobjc.a \
771 srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
772 GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
4f1fd857 773 GCC_CFLAGS="$(GCC_CFLAGS)"
553479e8 774 -rm -f libobjc.a
8281617f 775 ln objc/libobjc.a . >/dev/null 2>&1 || cp objc/libobjc.a .
4f1fd857 776 -if $(RANLIB_TEST) ; then $(RANLIB) libobjc.a; else true; fi
777
778# This is used by objc/Makefile if the user runs that directly.
779sublibobjc.a: cc1obj libgcc2.ready
e5190fd1 780 thisdir1=`pwd`; \
781 srcdir1=`cd $(srcdir); pwd`; \
782 cd objc; \
553479e8 783 $(MAKE) -f $$srcdir1/objc/Makefile libobjc.a \
e5190fd1 784 srcdir=$$srcdir1 tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
785 GCC_FOR_TARGET="$$thisdir1/xgcc -B$$thisdir1/" \
786 GCC_CFLAGS="$(GCC_CFLAGS)"
32e6d418 787
788# Compile two additional files that are linked with every program
789# linked using GCC on system V, for the sake of C++ constructors.
790crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
791 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -DCRT_BEGIN \
7bb7a2e8 792 -finhibit-size-directive -fno-inline-functions \
793 -g0 -c $(srcdir)/crtstuff.c -o crtbegin.o
32e6d418 794
795crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
796 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -DCRT_END \
7bb7a2e8 797 -finhibit-size-directive -fno-inline-functions \
798 -g0 -c $(srcdir)/crtstuff.c -o crtend.o
32e6d418 799\f
800# Compiling object files from source files.
801
802# Note that dependencies on obstack.h are not written
803# because that file is not part of GCC.
804# Dependencies on gvarargs.h are not written
805# because all that file does, when not compiling with GCC,
806# is include the system varargs.h.
807
808# C language specific files.
809
f678532a 810c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h c-parse.h \
811 c-tree.h input.h flags.h
32e6d418 812 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
ab2562cb 813$(srcdir)/c-parse.c $(srcdir)/c-parse.h: $(srcdir)/c-parse.y
814 cd $(srcdir); $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
d7c691fa 815$(srcdir)/c-parse.y: $(srcdir)/c-parse.in
816 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
817 -e "/^ifc$$/d" -e "/^end ifc$$/d" \
818 $(srcdir)/c-parse.in > $(srcdir)/c-parse.y
819
32e6d418 820c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
821c-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
822c-lang.o : c-lang.c $(CONFIG_H) $(TREE_H)
823c-lex.o : c-lex.c $(CONFIG_H) $(TREE_H) c-lex.h c-tree.h c-parse.h \
824 input.h flags.h
825c-aux-info.o : c-aux-info.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
826c-convert.o : c-convert.c $(CONFIG_H) $(TREE_H) flags.h
b3781cc4 827c-pragma.o: c-pragma.c $(CONFIG_H) $(TREE_H)
1294913b 828c-iterate.o: c-iterate.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h flags.h
32e6d418 829
830# C++ language specific files.
831
2ee73e3e 832cp-parse.o : $(srcdir)/cp-parse.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h cp-lex.h
32e6d418 833 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
834 `echo $(srcdir)/cp-parse.c | sed 's,^\./,,'`
835
836$(srcdir)/cp-parse.c $(srcdir)/cp-parse.h : $(srcdir)/cp-parse.y
a51a07fd 837 @echo expect 29 shift/reduce conflicts and 13 reduce/reduce conflicts
32e6d418 838 cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o cp-parse.c cp-parse.y
fe918d35 839 cd $(srcdir); grep '^#define[ ]*YYEMPTY' cp-parse.c >>cp-parse.h
32e6d418 840
841cp-spew.o : cp-spew.c $(CONFIG_H) $(CPLUS_TREE_H) \
2ee73e3e 842 $(srcdir)/cp-parse.h flags.h cp-lex.h
32e6d418 843cp-lex.o : cp-lex.c $(CONFIG_H) $(CPLUS_TREE_H) \
2ee73e3e 844 $(srcdir)/cp-parse.h $(srcdir)/cp-input.c flags.h cp-hash.h cp-lex.h
32e6d418 845cp-decl.o : cp-decl.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h \
846 cp-lex.h cp-decl.h stack.h
847cp-decl2.o : cp-decl2.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h \
848 cp-lex.h cp-decl.h
849cp-type2.o : cp-type2.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
2ee73e3e 850cp-typeck.o : cp-typeck.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h $(RTL_H)
851cp-class.o : cp-class.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
852cp-call.o : cp-call.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
853cp-init.o : cp-init.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h $(RTL_H)
32e6d418 854cp-method.o : cp-method.c $(CONFIG_H) $(CPLUS_TREE_H)
855cp-cvt.o : cp-cvt.c $(CONFIG_H) $(CPLUS_TREE_H)
856cp-search.o : cp-search.c $(CONFIG_H) $(CPLUS_TREE_H) stack.h flags.h
857cp-tree.o : cp-tree.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
858cp-ptree.o : cp-ptree.c $(CONFIG_H) $(CPLUS_TREE_H)
859cp-gc.o : cp-gc.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
2ee73e3e 860cp-except.o : cp-except.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h $(RTL_H)
32e6d418 861cp-expr.o : cp-expr.c $(CONFIG_H) $(CPLUS_TREE_H) $(RTL_H) flags.h \
862 expr.h insn-codes.h
863cp-edsel.o : cp-edsel.c $(CONFIG_H) $(CPLUS_TREE_H) stack.h flags.h
2ee73e3e 864cp-xref.o : cp-xref.c $(CONFIG_H) $(CPLUS_TREE_H) input.h
32e6d418 865cp-pt.o : cp-pt.c $(CONFIG_H) $(CPLUS_TREE_H) cp-decl.h cp-parse.h
2c560fb4 866cp-error.o : cp-error.c $(CONFIG_H) $(CPLUS_TREE_H)
867cp-errfn.o : cp-errfn.c $(CONFIG_H) $(CPLUS_TREE_H)
32e6d418 868
047c2b8b 869g++.o : g++.c $(CONFIG_H) gvarargs.h
870
79f818d0 871# To make a configuration always use collect2, set USE_COLLECT2 to ld.
872ld: collect2
873 rm -f ld
874 ln collect2 ld
875
32e6d418 876collect2 : collect2.o version.o $(LIBDEPS)
e77fd588 877# Don't try modifying collect2 (aka ld) in place--it might be linking this.
878 -rm -f collect2
32e6d418 879 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o collect2 collect2.o version.o $(LIBS)
880
881collect2.o : collect2.c $(CONFIG_H) gstab.h
5e03c63d 882 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
883 -DTARGET_MACHINE=\"$(target)\" \
884 -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
32e6d418 885
8dff2b2b 886# Objective C language specific files.
32e6d418 887
888objc-parse.o : $(srcdir)/objc-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
222e139b 889 c-tree.h input.h flags.h objc-act.h
32e6d418 890 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/objc-parse.c
891$(srcdir)/objc-parse.c : $(srcdir)/objc-parse.y
892 cd $(srcdir); $(BISON) $(BISONFLAGS) objc-parse.y -o objc-parse.c
ab2562cb 893$(srcdir)/objc-parse.y: $(srcdir)/c-parse.in
894 sed -e "/^ifc$$/,/^end ifc$$/d" \
895 -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
896 $(srcdir)/c-parse.in > $(srcdir)/objc-parse.y
32e6d418 897
7c4f0e88 898objc-act.o : objc-act.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h c-lex.h \
899 flags.h objc-act.h input.h function.h $(srcdir)/c-parse.h
32e6d418 900
901# A file used by all variants of C.
902
903c-common.o : c-common.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
904
905# Language-independent files.
906
1294913b 907gcc.o: gcc.c $(CONFIG_H) gvarargs.h config.status
32e6d418 908 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
909 -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
c6396a0b 910 -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
32e6d418 911 -DDEFAULT_TARGET_MACHINE=\"$(target)\" \
556d8d24 912 -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\" \
ae0fea3a 913 -DTOOLDIR=\"$(tooldir)/\" \
8618ef50 914 $(MAYBE_TARGET_DEFAULT) \
32e6d418 915 -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
916
917dumpvers: dumpvers.c
918
919version.o: version.c
920obstack.o: obstack.c
921
beb68ac1 922convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h
923
32e6d418 924tree.o : tree.c $(CONFIG_H) $(TREE_H) gvarargs.h flags.h function.h
925print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
926stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) function.h
927fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h
c6396a0b 928toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h input.h \
aadb7c33 929 insn-attr.h xcoffout.h defaults.h
79f818d0 930 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
fe918d35 931 $(MAYBE_TARGET_DEFAULT) $(MAYBE_USE_COLLECT2) \
932 -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
32e6d418 933
934rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
935
936print-rtl.o : print-rtl.c $(CONFIG_H) $(RTL_H)
937rtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
938
832bfff4 939toplev.o: bytecode.h bc-emit.h
35325097 940varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h function.h \
832bfff4 941 defaults.h insn-codes.h expr.h hard-reg-set.h regs.h xcoffout.h bytecode.h
32e6d418 942function.o : function.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
943 insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
832bfff4 944 recog.h output.h bytecode.h
32e6d418 945stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
da98194a 946 insn-flags.h insn-config.h insn-codes.h hard-reg-set.h expr.h loop.h \
e83ee760 947 recog.h bytecode.h bc-typecd.h bc-typecd.def bc-opcode.h bc-optab.h \
948 bc-emit.h
d077a015 949expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
e83ee760 950 insn-flags.h insn-codes.h expr.h insn-config.h recog.h output.h \
951 typeclass.h bytecode.h bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h \
952 bc-emit.h modemap.def
32e6d418 953calls.o : calls.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-codes.h \
d077a015 954 insn-flags.h gvarargs.h
32e6d418 955expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
956 insn-flags.h insn-config.h insn-codes.h expr.h recog.h real.h
957explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h hard-reg-set.h \
958 insn-config.h expr.h recog.h insn-flags.h insn-codes.h
959optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
a8a33ff5 960 insn-flags.h insn-config.h insn-codes.h expr.h recog.h reload.h
32e6d418 961dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h regs.h \
e7748130 962 insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h
32e6d418 963sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) gsyms.h flags.h \
964 insn-config.h reload.h
965dwarfout.o : dwarfout.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf.h flags.h \
8a19d0d5 966 insn-config.h reload.h output.h defaults.h
79f818d0 967xcoffout.o : xcoffout.c $(CONFIG_H) $(TREE_H) $(RTL_H) xcoffout.h flags.h
32e6d418 968emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) flags.h gvarargs.h function.h \
832bfff4 969 regs.h insn-config.h insn-codes.h real.h expr.h bytecode.h bc-opcode.h \
e83ee760 970 bc-typecd.h bc-typecd.def bc-optab.h bc-emit.h bc-opname.h
6d9f2c4c 971real.o : real.c $(CONFIG_H) $(TREE_H)
c6396a0b 972getpwd.o : getpwd.c $(CONFIG_H)
32e6d418 973
974integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h integrate.h \
832bfff4 975 insn-flags.h insn-config.h insn-codes.h expr.h real.h function.h \
976 bytecode.h
32e6d418 977
978jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
979 insn-config.h insn-flags.h insn-codes.h expr.h real.h
980stupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h
981
982cse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h real.h \
983 insn-config.h recog.h
984loop.o : loop.c $(CONFIG_H) $(RTL_H) flags.h loop.h insn-config.h \
985 insn-flags.h insn-codes.h regs.h hard-reg-set.h recog.h expr.h real.h
986unroll.o : unroll.c $(CONFIG_H) $(RTL_H) insn-config.h insn-codes.h \
987 integrate.h regs.h flags.h expr.h loop.h
988flow.o : flow.c $(CONFIG_H) $(RTL_H) flags.h insn-config.h \
989 basic-block.h regs.h hard-reg-set.h output.h
990combine.o : combine.c $(CONFIG_H) $(RTL_H) gvarargs.h flags.h \
991 insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \
f0a903c4 992 basic-block.h recog.h real.h hard-reg-set.h
32e6d418 993regclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
832bfff4 994 basic-block.h regs.h insn-config.h recog.h reload.h real.h bytecode.h
32e6d418 995local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h basic-block.h \
996 regs.h hard-reg-set.h insn-config.h recog.h output.h
8a4b1e01 997global.o : global.c $(CONFIG_H) $(RTL_H) flags.h \
32e6d418 998 basic-block.h regs.h hard-reg-set.h insn-config.h output.h
999
1000reload.o : reload.c $(CONFIG_H) $(RTL_H) flags.h \
1001 reload.h recog.h hard-reg-set.h insn-config.h insn-codes.h regs.h real.h
1002reload1.o : reload1.c $(CONFIG_H) $(RTL_H) flags.h expr.h \
1003 reload.h regs.h hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
1004 basic-block.h recog.h output.h
1005caller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \
1006 regs.h hard-reg-set.h insn-config.h basic-block.h recog.h reload.h expr.h
1007reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
1008 basic-block.h regs.h insn-config.h insn-attr.h insn-flags.h recog.h \
1009 flags.h output.h
1010sched.o : sched.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h \
1011 flags.h insn-config.h insn-attr.h
543e7f6c 1012final.o : final.c $(CONFIG_H) $(RTL_H) $(TREE_H) gvarargs.h flags.h regs.h \
32e6d418 1013 recog.h conditions.h insn-config.h insn-attr.h real.h output.h \
fe918d35 1014 hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
32e6d418 1015recog.o : recog.c $(CONFIG_H) $(RTL_H) \
1016 regs.h recog.h hard-reg-set.h flags.h insn-config.h insn-attr.h \
1017 insn-flags.h insn-codes.h real.h
1018reg-stack.o : reg-stack.c $(CONFIG_H) $(RTL_H) $(TREE_H) \
1019 regs.h hard-reg-set.h flags.h insn-config.h
48c6936b 1020
32e6d418 1021aux-output.o : aux-output.c $(CONFIG_H) \
1022 $(RTL_H) regs.h hard-reg-set.h real.h insn-config.h conditions.h \
1023 insn-flags.h output.h insn-attr.h insn-codes.h
1024
f213fcf9 1025# Build auxiliary files that support ecoff format.
1026mips-tfile: mips-tfile.o version.o $(LIBDEPS)
1027 $(CC) $(CFLAGS) $(LDFLAGS) -o mips-tfile mips-tfile.o version.o $(LIBS)
1028
1029mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H)
1030
1031mips-tdump: mips-tdump.o version.o $(LIBDEPS)
1032 $(CC) $(CFLAGS) $(LDFLAGS) -o mips-tdump mips-tdump.o version.o $(LIBS)
1033
1034mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H)
1035
32e6d418 1036# Normally this target is not used; but it is used if you
1037# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
1038# from the GNU Emacs distribution.
32e6d418 1039alloca.o: alloca.c
32e6d418 1040 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
cc2af6ca 1041 -c `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
32e6d418 1042 $(ALLOCA_FINISH)
1043\f
1044# Generate header and source files from the machine description,
1045# and compile them.
1046
1047.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
1048 insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
1049 insn-attr.h insn-attrtab.c
1050
1051# The following pair of rules has this effect:
1052# genconfig is run only if the md has changed since genconfig was last run;
1053# but the file insn-config.h is touched only when its contents actually change.
1054
1055# Each of the other insn-* files is handled by a similar pair of rules.
1056
3f69fed5 1057# This causes an anomaly in the results of make -n
1058# because insn-* is older than stamp-*
1059# and thus make -n thinks that insn-* will be updated
1060# and force recompilation of things that depend on it.
9ac790c5 1061# We use move-if-change precisely to avoid such recompilation.
3f69fed5 1062# But there is no way to teach make -n that it will be avoided.
1063
32e6d418 1064# Each of the insn-*.[ch] rules has a semicolon at the end,
1065# for otherwise the system Make on SunOS 4.1 never tries
876dc5b0 1066# to recompile insn-*.o. To avoid problems and extra noise from
1067# versions of make which don't like empty commands (nothing after the
1068# trailing `;'), we call true for each.
32e6d418 1069
c2a18965 1070insn-config.h: stamp-config ; @true
32e6d418 1071stamp-config : md genconfig $(srcdir)/move-if-change
1072 ./genconfig md > tmp-config.h
1073 $(srcdir)/move-if-change tmp-config.h insn-config.h
1074 touch stamp-config
1075
c2a18965 1076insn-flags.h: stamp-flags ; @true
32e6d418 1077stamp-flags : md genflags $(srcdir)/move-if-change
1078 ./genflags md > tmp-flags.h
1079 $(srcdir)/move-if-change tmp-flags.h insn-flags.h
1080 touch stamp-flags
1081
c2a18965 1082insn-codes.h: stamp-codes ; @true
32e6d418 1083stamp-codes : md gencodes $(srcdir)/move-if-change
1084 ./gencodes md > tmp-codes.h
1085 $(srcdir)/move-if-change tmp-codes.h insn-codes.h
1086 touch stamp-codes
1087
1088insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h real.h output.h \
1089 insn-config.h insn-flags.h insn-codes.h
1090 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
1091
c2a18965 1092insn-emit.c: stamp-emit ; @true
32e6d418 1093stamp-emit : md genemit $(srcdir)/move-if-change
1094 ./genemit md > tmp-emit.c
1095 $(srcdir)/move-if-change tmp-emit.c insn-emit.c
1096 touch stamp-emit
1097
1098insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h recog.h \
1099 real.h output.h flags.h
1100 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
1101
c2a18965 1102insn-recog.c: stamp-recog ; @true
32e6d418 1103stamp-recog : md genrecog $(srcdir)/move-if-change
1104 ./genrecog md > tmp-recog.c
1105 $(srcdir)/move-if-change tmp-recog.c insn-recog.c
1106 touch stamp-recog
1107
bdb66cef 1108insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
1109 insn-config.h flags.h rtl.h recog.h expr.h reload.h
1110 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
1111
1112insn-opinit.c: stamp-opinit ; @true
1113stamp-opinit : md genopinit $(srcdir)/move-if-change
1114 ./genopinit md > tmp-opinit.c
1115 $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
1116 touch stamp-opinit
1117
32e6d418 1118insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H)
1119 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
1120
c2a18965 1121insn-extract.c: stamp-extract ; @true
32e6d418 1122stamp-extract : md genextract $(srcdir)/move-if-change
1123 ./genextract md > tmp-extract.c
1124 $(srcdir)/move-if-change tmp-extract.c insn-extract.c
1125 touch stamp-extract
1126
1127insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h output.h real.h
1128 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
1129
c2a18965 1130insn-peep.c: stamp-peep ; @true
32e6d418 1131stamp-peep : md genpeep $(srcdir)/move-if-change
1132 ./genpeep md > tmp-peep.c
1133 $(srcdir)/move-if-change tmp-peep.c insn-peep.c
1134 touch stamp-peep
1135
1136insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) regs.h real.h output.h \
1137 insn-attr.h insn-config.h
1138 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
1139
c2a18965 1140insn-attr.h: stamp-attr ; @true
32e6d418 1141stamp-attr : md genattr $(srcdir)/move-if-change
1142 ./genattr md > tmp-attr.h
1143 $(srcdir)/move-if-change tmp-attr.h insn-attr.h
1144 touch stamp-attr
1145
c2a18965 1146insn-attrtab.c: stamp-attrtab ; @true
32e6d418 1147stamp-attrtab : md genattrtab $(srcdir)/move-if-change
8bd8ea06 1148 if cmp -s $(PREMADE_ATTRTAB_MD) md; \
1149 then \
1150 echo Using $(PREMADE_ATTRTAB); \
ab866dde 1151 cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \
8bd8ea06 1152 else \
1153 ./genattrtab md > tmp-attrtab.c; \
1154 fi
32e6d418 1155 $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
1156 touch stamp-attrtab
1157
1158insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
1159 hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h recog.h \
1160 insn-codes.h
1161 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
1162
c2a18965 1163insn-output.c: stamp-output ; @true
32e6d418 1164stamp-output : md genoutput $(srcdir)/move-if-change
1165 ./genoutput md > tmp-output.c
1166 $(srcdir)/move-if-change tmp-output.c insn-output.c
1167 touch stamp-output
1168\f
1169# Compile the programs that generate insn-* from the machine description.
1170# They are compiled with $(HOST_CC), and associated libraries,
1171# since they need to run on this machine
1172# even if GCC is being compiled to run on some other machine.
1173
1174# $(CONFIG_H) is omitted from the deps of the gen*.o
1175# because these programs don't really depend on anything
1176# about the target machine. They do depend on config.h itself,
1177# since that describes the host machine.
1178
89e36a04 1179# Pass the md file through cpp if the target requests it.
1180$(MD_FILE): $(CPP_MD)
1181 -if [ -f md.pre-cpp ]; then \
1182 rm -f md ; ./cpp $(CPP_MD_FLAGS) md.pre-cpp | sed 's/^# /; /g' > md ; \
1183 else true ; \
1184 fi
1185
32e6d418 1186genconfig : genconfig.o $(HOST_RTL) $(HOST_LIBDEPS)
1187 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genconfig \
1188 genconfig.o $(HOST_RTL) $(HOST_LIBS)
1189
e77fd588 1190genconfig.o : genconfig.c $(RTL_H) hconfig.h
32e6d418 1191 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
1192
1193genflags : genflags.o $(HOST_RTL) $(HOST_LIBDEPS)
1194 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genflags \
1195 genflags.o $(HOST_RTL) $(HOST_LIBS)
1196
e77fd588 1197genflags.o : genflags.c $(RTL_H) hconfig.h
32e6d418 1198 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
1199
1200gencodes : gencodes.o $(HOST_RTL) $(HOST_LIBDEPS)
1201 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o gencodes \
1202 gencodes.o $(HOST_RTL) $(HOST_LIBS)
1203
e77fd588 1204gencodes.o : gencodes.c $(RTL_H) hconfig.h
32e6d418 1205 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
1206
1207genemit : genemit.o $(HOST_RTL) $(HOST_LIBDEPS)
1208 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genemit \
1209 genemit.o $(HOST_RTL) $(HOST_LIBS)
1210
e77fd588 1211genemit.o : genemit.c $(RTL_H) hconfig.h
32e6d418 1212 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
1213
bdb66cef 1214genopinit : genopinit.o $(HOST_RTL) $(HOST_LIBDEPS)
1215 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genopinit \
1216 genopinit.o $(HOST_RTL) $(HOST_LIBS)
1217
1218genopinit.o : genopinit.c $(RTL_H) hconfig.h
1219 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
1220
32e6d418 1221genrecog : genrecog.o $(HOST_RTL) $(HOST_LIBDEPS)
1222 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genrecog \
1223 genrecog.o $(HOST_RTL) $(HOST_LIBS)
1224
e77fd588 1225genrecog.o : genrecog.c $(RTL_H) hconfig.h
32e6d418 1226 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
1227
1228genextract : genextract.o $(HOST_RTL) $(HOST_LIBDEPS)
1229 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genextract \
1230 genextract.o $(HOST_RTL) $(HOST_LIBS)
1231
e77fd588 1232genextract.o : genextract.c $(RTL_H) hconfig.h insn-config.h
32e6d418 1233 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
1234
1235genpeep : genpeep.o $(HOST_RTL) $(HOST_LIBDEPS)
1236 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genpeep \
1237 genpeep.o $(HOST_RTL) $(HOST_LIBS)
1238
e77fd588 1239genpeep.o : genpeep.c $(RTL_H) hconfig.h
32e6d418 1240 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
1241
1242genattr : genattr.o $(HOST_RTL) $(HOST_LIBDEPS)
1243 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genattr \
1244 genattr.o $(HOST_RTL) $(HOST_LIBS)
1245
e77fd588 1246genattr.o : genattr.c $(RTL_H) hconfig.h
32e6d418 1247 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
1248
262d46de 1249genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
32e6d418 1250 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genattrtab \
262d46de 1251 genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
32e6d418 1252
e77fd588 1253genattrtab.o : genattrtab.c $(RTL_H) hconfig.h insn-config.h
32e6d418 1254 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
1255
1256genoutput : genoutput.o $(HOST_RTL) $(HOST_LIBDEPS)
1257 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genoutput \
1258 genoutput.o $(HOST_RTL) $(HOST_LIBS)
1259
e77fd588 1260genoutput.o : genoutput.c $(RTL_H) hconfig.h
32e6d418 1261 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
1262\f
1263# Compile the libraries to be used by gen*.
1264# If we are not cross-building, gen* use the same .o's that cc1 will use,
1265# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
1266# with the rules for rtl.o, alloca.o, etc.
1267$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) $(RTL_H)
1268 rm -f $(HOST_PREFIX)rtl.c
e77fd588 1269 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
32e6d418 1270 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
1271
262d46de 1272$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H)
1273 rm -f $(HOST_PREFIX)print-rtl.c
e77fd588 1274 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
262d46de 1275 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
1276
32e6d418 1277$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
1278 rm -f $(HOST_PREFIX)rtlanal.c
e77fd588 1279 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
32e6d418 1280 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
1281
1282$(HOST_PREFIX_1)alloca.o: alloca.c
1283 rm -f $(HOST_PREFIX)alloca.c
1284 cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
1285 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
1286
1287$(HOST_PREFIX_1)obstack.o: obstack.c
1288 rm -f $(HOST_PREFIX)obstack.c
e77fd588 1289 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/obstack.c > $(HOST_PREFIX)obstack.c
32e6d418 1290 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
1291
1292$(HOST_PREFIX_1)malloc.o: malloc.c
1293 rm -f $(HOST_PREFIX)malloc.c
e77fd588 1294 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
32e6d418 1295 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
1296
1297# This satisfies the dependency that we get if you cross-compile a compiler
1298# that does not need to compile alloca, malloc or whatever.
1299$(HOST_PREFIX_1):
1300 touch $(HOST_PREFIX_1)
1301\f
649d8da6 1302# Remake bytecode files.
1303# BI_ALL=bi-run.o
1304BI_ALL=
1305BC_ALL=bc-opname.h bc-opcode.h bc-arity.h
1306BI_OBJ=bi-parser.o bi-lexer.o bi-reverse.o
1307
1308
7e20ea39 1309bc-emit.o : bc-emit.c $(CONFIG_H) $(RTL_H) real.h $(BYTECODE_H) \
f698a3d1 1310 bc-arity.h bc-opcode.h bc-typecd.h bc-typecd.def bi-run.h bytetypes.h
7e20ea39 1311bc-optab.o : bc-optab.c $(CONFIG_H) $(REAL_H) $(BYTECODE_H) \
1312 bc-opcode.h bc-typecd.h bc-typecd.def
649d8da6 1313
1314
1315bytecode: $(BI_ALL) $(BC_ALL)
1316
7e20ea39 1317bi-arity: bi-arity.o $(BI_OBJ) $(HOST_LIBDEPS)
1318 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o bi-arity \
c3eff1f2 1319 bi-arity.o $(BI_OBJ) $(HOST_LIBS)
7e20ea39 1320bi-opcode: bi-opcode.o $(BI_OBJ) $(HOST_LIBDEPS)
1321 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o bi-opcode \
c3eff1f2 1322 bi-opcode.o $(BI_OBJ) $(HOST_LIBS)
7e20ea39 1323bi-opname: bi-opname.o $(BI_OBJ) $(HOST_LIBDEPS)
1324 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o bi-opname \
c3eff1f2 1325 bi-opname.o $(BI_OBJ) $(HOST_LIBS)
7e20ea39 1326
e83ee760 1327bi-run.o: $(srcdir)/bi-run.c $(srcdir)/bi-run.h $(srcdir)/bc-typecd.h \
1328 bc-opname.h bc-arity.h bc-opcode.h
6fc7cea4 1329 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/bi-run.c
7e20ea39 1330$(srcdir)/bi-parser.c $(srcdir)/bi-parser.h: $(srcdir)/bi-parser.y
1331 cd $(srcdir); $(BISON) $(BISONFLAGS) -d bi-parser.y -o bi-parser.c
3a346d9d 1332bi-parser.o: $(srcdir)/bi-parser.c $(srcdir)/bi-defs.h hconfig.h
7e20ea39 1333 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1334 $(srcdir)/bi-parser.c
3a346d9d 1335bi-lexer.o: $(srcdir)/bi-lexer.c $(srcdir)/bi-parser.h hconfig.h
7e20ea39 1336 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1337 $(srcdir)/bi-lexer.c
3a346d9d 1338bi-arity.o: bi-arity.c $(srcdir)/bi-defs.h hconfig.h
7e20ea39 1339 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1340 $(srcdir)/bi-arity.c
2cba3cbb 1341bi-opcode.o: bi-opcode.c $(srcdir)/bi-defs.h hconfig.h
7e20ea39 1342 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1343 $(srcdir)/bi-opcode.c
3a346d9d 1344bi-opname.o: bi-opname.c $(srcdir)/bi-defs.h hconfig.h
7e20ea39 1345 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1346 $(srcdir)/bi-opname.c
1347bi-reverse.o: bi-reverse.c $(srcdir)/bi-defs.h
1348 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1349 $(srcdir)/bi-reverse.c
832bfff4 1350
1351
e6baec2f 1352bc-arity.h: stamp-bcarity ; @true
1353stamp-bcarity : $(srcdir)/bytecode.def bi-arity $(srcdir)/move-if-change
e78095bc 1354 ./bi-arity < $(srcdir)/bytecode.def >tmp-bc-arity.h
1355 $(srcdir)/move-if-change tmp-bc-arity.h bc-arity.h
675fc1b6 1356 touch stamp-bcarity
649d8da6 1357
e6baec2f 1358bc-opcode.h: stamp-bcopcode ; @true
1359stamp-bcopcode : $(srcdir)/bytecode.def bi-opcode $(srcdir)/move-if-change
f698a3d1 1360 ./bi-opcode < $(srcdir)/bytecode.def >tmp-bcopcd.h
1361 $(srcdir)/move-if-change tmp-bcopcd.h bc-opcode.h
675fc1b6 1362 touch stamp-bcopcode
649d8da6 1363
e6baec2f 1364bc-opname.h: stamp-bcopname ; @true
1365stamp-bcopname : $(srcdir)/bytecode.def bi-opname $(srcdir)/move-if-change
f698a3d1 1366 ./bi-opname < $(srcdir)/bytecode.def >tmp-bcopnm.h
1367 $(srcdir)/move-if-change tmp-bcopnm.h bc-opname.h
675fc1b6 1368 touch stamp-bcopname
649d8da6 1369
1370bytecode.mostlyclean:
1371 -rm -f bc-arity.h bc-opcode.h bc-opname.h
1372
1373bytecode.distclean bytecode.clean: bytecode.mostlyclean
7e20ea39 1374 -rm -f bi-arity bi-opcode bi-opname bi-lexer
649d8da6 1375
1376bytecode.realclean: bytecode.clean
91cbf3f1 1377 -rm -f bi-parser.c bi-parser.h
649d8da6 1378
1379\f
32e6d418 1380# Remake cpp and protoize.
1381
1382# Making the preprocessor
1383cpp: cccp
1384 -rm -f cpp
1385 ln cccp cpp
1386cccp: cccp.o cexp.o version.o $(LIBDEPS)
1387 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cccp cccp.o cexp.o version.o $(LIBS)
1388cexp.o: $(srcdir)/cexp.c $(CONFIG_H)
1389 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
1390$(srcdir)/cexp.c: $(srcdir)/cexp.y
1391 cd $(srcdir); $(BISON) -o cexp.c cexp.y
d6b50af2 1392cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status
32e6d418 1393# The reason we use $(libdir)/g++-include rather than using libsubdir
1394# is for compatibility with the current version of libg++.
1395 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
c6396a0b 1396 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
1397 -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
2ffdcadf 1398 -DLOCAL_INCLUDE_DIR=\"$(local_prefix)/include\" \
c6396a0b 1399 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1400 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
ae0fea3a 1401 -DTOOLDIR=\"$(tooldir)/\" \
32e6d418 1402 -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
1403
876dc5b0 1404# Note for the stamp targets, we run the program `true' instead of
1405# having an empty command (nothing following the semicolon).
1406
77a164d8 1407proto: config.status protoize unprotoize SYSCALLS.c.X
32e6d418 1408
c6396a0b 1409protoize: protoize.o getopt.o getopt1.o getpwd.o version.o $(LIBDEPS)
32e6d418 1410 $(CC) $(ALL_CFLAGS) $(LDFLAGS) \
c6396a0b 1411 protoize.o getopt.o getopt1.o getpwd.o version.o $(LIBS) -o $@
c2a18965 1412protoize.o: stamp-proto ; @true
ab866dde 1413
1414unprotoize: unprotoize.o getopt.o getopt1.o getpwd.o version.o $(LIBDEPS)
1415 $(CC) $(ALL_CFLAGS) $(LDFLAGS) \
1416 unprotoize.o getopt.o getopt1.o getpwd.o version.o $(LIBS) -o $@
c2a18965 1417unprotoize.o: stamp-proto ; @true
ab866dde 1418
1419stamp-proto: $(srcdir)/protoize.c getopt.h $(CONFIG_H)
32e6d418 1420 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1421 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
c6396a0b 1422 -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
32e6d418 1423 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1424 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
67154a35 1425 -DLOCAL_INCLUDE_DIR=\"$(local_prefix)/include\" \
32e6d418 1426 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
ab866dde 1427 -DUNPROTOIZE $(srcdir)/protoize.c
1428 mv protoize.o unprotoize.o
32e6d418 1429 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1430 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
c6396a0b 1431 -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
32e6d418 1432 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1433 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
67154a35 1434 -DLOCAL_INCLUDE_DIR=\"$(local_prefix)/include\" \
32e6d418 1435 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
ab866dde 1436 $(srcdir)/protoize.c
77a164d8 1437 touch stamp-proto
32e6d418 1438
1439getopt.o: $(srcdir)/getopt.c getopt.h
1440 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt.c
1441getopt1.o: $(srcdir)/getopt1.c getopt.h
1442 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt1.c
1443
32e6d418 1444# This info describes the target machine, so compile with GCC just built.
79f818d0 1445SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES)
f678532a 1446 -rm -f SYSCALLS.c tmp-SYSCALLS.s
79f818d0 1447 cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
32e6d418 1448 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
f678532a 1449 -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
1450 -rm -f SYSCALLS.c tmp-SYSCALLS.s
0b20f012 1451
a5889b74 1452
0b20f012 1453test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
c548e550 1454 -rm -f tmp-proto.[cso]
262d46de 1455 cp $(srcdir)/protoize.c tmp-proto.c
1456 chmod u+w tmp-proto.c
c548e550 1457 ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1458 $(CFLAGS) $(INCLUDES) \
0b20f012 1459 -DGCC_INCLUDE_DIR=0 \
1460 -DGPLUSPLUS_INCLUDE_DIR=0 \
1461 -DCROSS_INCLUDE_DIR=0 \
46073b39 1462 -DTOOL_INCLUDE_DIR=0 \
262d46de 1463 -DSTD_PROTO_DIR=0" tmp-proto.c
1a754c64 1464 @echo '**********' Expect 400 lines of differences.
c548e550 1465 -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
1466 -wc -l tmp-proto.diff
1467 ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1468 $(CFLAGS) $(INCLUDES) \
0b20f012 1469 -DGCC_INCLUDE_DIR=0 \
1470 -DGPLUSPLUS_INCLUDE_DIR=0 \
1471 -DCROSS_INCLUDE_DIR=0 \
46073b39 1472 -DTOOL_INCLUDE_DIR=0 \
262d46de 1473 -DSTD_PROTO_DIR=0" tmp-proto.c
0b20f012 1474 @echo Expect zero differences.
262d46de 1475 diff $(srcdir)/protoize.c tmp-proto.c | cat
c548e550 1476 -rm -f tmp-proto.[cso]
32e6d418 1477\f
2cfd79fe 1478# Build the include directory. The stamp files are stmp-* rather than
1479# stamp-* so that mostlyclean does not force the include directory to
1480# be rebuilt.
1481
690a93ea 1482# Build the include directory except for float.h (which depends upon
1483# enquire).
b7d4d520 1484stmp-int-hdrs: stmp-fixinc $(USER_H) gvarargs.h gstdarg.h gstddef.h \
1485 xlimits.h objc-headers
2cfd79fe 1486# Copy in the headers provided with gcc.
1487# The sed command gets just the last file name component;
1488# this is necessary because VPATH could add a dirname.
1489# Using basename would be simpler, but some systems don't have it.
1490 objdir=`pwd`; \
1491 cd $(srcdir); \
1492 for file in $(USER_H); do \
1493 realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
b5850e21 1494 rm -f $$objdir/include/$$realfile; \
2cfd79fe 1495 cp $$realfile $$objdir/include; \
1496 chmod a+r $$objdir/include/$$realfile; \
1497 done
b5850e21 1498 rm -f include/varargs.h
2cfd79fe 1499 cp $(srcdir)/gvarargs.h include/varargs.h
1500 chmod a+r include/varargs.h
b5850e21 1501 rm -f include/stdarg.h
2cfd79fe 1502 cp $(srcdir)/gstdarg.h include/stdarg.h
1503 chmod a+r include/stdarg.h
b5850e21 1504 rm -f include/stddef.h
2cfd79fe 1505 cp $(srcdir)/gstddef.h include/stddef.h
1506 chmod a+r include/stddef.h
b5850e21 1507 rm -f include/limits.h
2cfd79fe 1508 cp xlimits.h include/limits.h
1509 chmod a+r include/limits.h
2cfd79fe 1510# Install the README
b5850e21 1511 rm -f include/README
2cfd79fe 1512 cp $(srcdir)/README-fixinc include/README
1513 chmod a+r include/README
690a93ea 1514 touch stmp-int-hdrs
1515
1516# Build the complete include directory.
1517stmp-headers: stmp-int-hdrs gfloat.h
1518 rm -f include/float.h
1519 cp gfloat.h include/float.h
1520 chmod a+r include/float.h
2cfd79fe 1521 touch stmp-headers
1522
e21960f1 1523# Running fixincludes requires making sure that xgcc and cpp have been
1524# compiled (they are used to get the value of __SIZE_TYPE__).
1525# But recompiling xgcc should not force the the header files to be
1526# fixed again. If you want to do that, delete stmp-fixinc.
1527fixinc.ready: xgcc cpp
1528 -if [ -f fixinc.ready ] ; then \
1529 true; \
1530 else \
1531 touch fixinc.ready; \
1532 fi
1533
2cfd79fe 1534# Build fixed copies of system files.
e21960f1 1535stmp-fixinc: $(srcdir)/$(FIXINCLUDES) gsyslimits.h fixinc.ready
2cfd79fe 1536 rm -rf include
1537 mkdir include
92d223d1 1538 if [ x$(FIXINCLUDES) != xMakefile.in ]; \
6848a9c6 1539 then \
1540 for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
1541 if [ -d $$dir ]; \
1542 then \
2ecf1d02 1543 $(srcdir)/$(FIXINCLUDES) include $$dir $(srcdir) "`pwd`/xgcc -B`pwd`/"; \
6848a9c6 1544 else true; fi; \
92d223d1 1545 done; \
6848a9c6 1546 else true; \
1547 fi
b7d4d520 1548 rm -f include/syslimits.h
1549 if [ -f include/limits.h ]; then \
1550 mv include/limits.h include/syslimits.h; \
1551 else \
1552 cp $(srcdir)/gsyslimits.h include/syslimits.h; \
1553 fi
1554 chmod a+r include/syslimits.h
9e74f24f 1555 touch stmp-fixinc
7c4f0e88 1556
15045969 1557# copy objc header files into build directory
9fdf517e 1558objc-headers: stmp-fixinc
a5199ad9 1559 if [ -d objc ]; then true; else mkdir objc; fi
7c4f0e88 1560 thisdir1=`pwd`; \
1561 srcdir1=`cd $(srcdir); pwd`; \
1562 cd objc; \
1563 $(MAKE) -f $${srcdir1}/objc/Makefile copy-headers \
1564 srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
1565 GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
1566 GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=$${thisdir1}/include
15045969 1567 touch objc-headers
a5889b74 1568
1569# Files related to the fixproto script.
1570
047c2b8b 1571deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
553c2c6d 1572 CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -Iinclude -I${SYSTEM_HEADER_DIR}"; \
a5889b74 1573 export CC; \
9541a717 1574 $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h
a5889b74 1575 mv tmp-deduced.h deduced.h
1576
1577gen-protos: gen-protos.o scan.o
4631ecda 1578 ${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o gen-protos \
1579 gen-protos.o scan.o
a5889b74 1580
9541a717 1581gen-protos.o: gen-protos.c scan.h
1582scan.o: scan.c scan.h
1583
047c2b8b 1584xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
d7c4552e 1585 cat deduced.h $(srcdir)/sys-protos.h > fixtmp.c
1586 $(GCC_FOR_TARGET) fixtmp.c -E \
6fc3eafd 1587 | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
1588 | ./gen-protos >xsys-protos.h
d7c4552e 1589 rm -rf fixtmp.c
a5889b74 1590
15dece2a 1591fix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_OBSTACK)
4631ecda 1592 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o fix-header \
1593 fix-header.o scan-decls.o scan.o $(HOST_OBSTACK)
a5889b74 1594
9541a717 1595fix-header.o: fix-header.c obstack.h scan.h xsys-protos.h
1596scan-decls.o: scan-decls.c scan.h
a5889b74 1597
047c2b8b 1598# stmp-fixproto depends on this, not on fix-header directly.
1599# The idea is to make sure fix-header gets built,
1600# but not rerun fixproto after each stage
1601# just because fix-header's mtime has changed.
1602fixhdr.ready: fix-header
1603 -if [ -f fixhdr.ready ] ; then \
1604 true; \
1605 else \
1606 touch fixhdr.ready; \
1607 fi
1608
7bf27989 1609# stmp-headers is to make sure fixincludes has already finished.
047c2b8b 1610stmp-fixproto: fixhdr.ready xsys-protos.h fixproto stmp-headers
a5889b74 1611 CPP="$(GCC_FOR_TARGET) -E"; export CPP; \
1612 ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR)
1613 touch stmp-fixproto
2cfd79fe 1614\f
32e6d418 1615# Remake the info files.
1616
627defc4 1617doc: info
1618info: $(srcdir)/cpp.info $(srcdir)/gcc.info
32e6d418 1619
630c76ba 1620$(srcdir)/cpp.info: cpp.texi
4b0206c0 1621 cd $(srcdir); $(MAKEINFO) cpp.texi
32e6d418 1622
630c76ba 1623#$(srcdir)/gplus.info: gplus.texi
bc51108a 1624# $(MAKEINFO) `echo $(srcdir)/gplus.texi | sed 's,^\./,,'`
32e6d418 1625
630c76ba 1626$(srcdir)/gcc.info: gcc.texi extend.texi install.texi invoke.texi \
1627 md.texi rtl.texi tm.texi
4b0206c0 1628 cd $(srcdir); $(MAKEINFO) gcc.texi
630c76ba 1629
627defc4 1630dvi: $(srcdir)/gcc.dvi $(srcdir)/cpp.dvi
1631
64616031 1632# This works with GNU Make's default rule.
1633$(srcdir)/gcc.dvi: gcc.texi extend.texi install.texi invoke.texi \
1634 md.texi rtl.texi tm.texi
f345940f 1635 $(TEXI2DVI) $<
64616031 1636
1637# This works with GNU Make's default rule.
1638$(srcdir)/cpp.dvi: cpp.texi
f345940f 1639 $(TEXI2DVI) $<
64616031 1640
630c76ba 1641$(srcdir)/INSTALL: install1.texi install.texi
0b9e1f1f 1642 $(MAKEINFO) -D INSTALLONLY --no-header --no-split \
1643 `echo $(srcdir)/install1.texi | sed 's,^\./,,'`
32e6d418 1644\f
1645# Deletion of files made during compilation.
1646# There are four levels of this:
79f818d0 1647# `mostlyclean', `clean', `distclean' and `realclean'.
32e6d418 1648# `mostlyclean' is useful while working on a particular type of machine.
c6396a0b 1649# It deletes most, but not all, of the files made by compilation.
32e6d418 1650# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
c6396a0b 1651# `clean' deletes everything made by running `make all'.
79f818d0 1652# `distclean' also deletes the files made by config.
32e6d418 1653# `realclean' also deletes everything that could be regenerated automatically.
1654
79f818d0 1655
649d8da6 1656mostlyclean: bytecode.mostlyclean
32e6d418 1657 -rm -f $(STAGESTUFF)
343505c4 1658# Clean the objc subdir if we created one.
1659 if [ -d objc ]; then \
1660 srcdir1=`cd $(srcdir); pwd`; \
8c6da369 1661 cd objc; $(MAKE) -f $$srcdir1/objc/Makefile mostlyclean; \
343505c4 1662 else true; fi
bd594491 1663 -rm -f libobjc.a
32e6d418 1664# Delete the temporary source copies for cross compilation.
1665 -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
1666 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
1667 -rm -f $(HOST_PREFIX_1)obstack.c
1668# Delete the temp files made in the course of building libgcc.a.
590613c7 1669 -rm -f tmplibgcc* tmpcopy xlimits.h
32e6d418 1670 for name in $(LIB1FUNCS); do rm -f $${name}.c; done
1671# Delete other temporary files.
e5b63666 1672 -rm -f tmp-float.h tmp-gcc.xtar.gz
f678532a 1673 -rm -f tmp-foo1 tmp-foo2 tmp-proto.* tmp-unproto.1 tmp-SYSCALLS.s
32e6d418 1674# Delete the stamp files.
1675 -rm -f stamp-* tmp-*
c6396a0b 1676# Delete debugging dump files.
32e6d418 1677 -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
c6396a0b 1678 -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack
1679# Delete some files made during installation.
d82b9c93 1680 -rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
79f818d0 1681 -rm -f collect collect2 ld mips-tfile mips-tdump alloca.s
a5889b74 1682# Delete files generated for fixproto
15dece2a 1683 -rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \
553c2c6d 1684 gen-protos fixproto.list fixtmp.*
c6396a0b 1685# Delete unwanted output files from TeX.
1686 -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
79f818d0 1687# Delete sorted indices we don't actually use.
1688 -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
c6396a0b 1689# Delete core dumps.
8d14a5ba 1690 -rm -f core config/core
32e6d418 1691
79f818d0 1692# Delete all files made by compilation
1693# that don't exist in the distribution.
649d8da6 1694clean: mostlyclean bytecode.clean
8bd8ea06 1695# It may not be quite desirable to delete unprotoize.c here,
1696# but the spec for `make clean' requires it.
1697# Using unprotoize.c is not quite right in the first place,
1698# but what better way is there?
840a6e8d 1699 -rm -f libgcc.a libgcc1.a libgcc2.a libgcc2.ready libgcc1.null
131b361e 1700 -rm -f *.dvi
89e36a04 1701 -if [ -f md.pre-cpp ]; then \
1702 rm -f md ; \
1703 fi
2cfd79fe 1704# Delete the include directory.
e21960f1 1705 -rm -rf stmp-* fixinc.ready include objc-headers
047c2b8b 1706 -rm -rf fixhdr.ready
32e6d418 1707
79f818d0 1708# Delete all files that users would normally create
1709# while building and installing GCC.
649d8da6 1710distclean: clean bytecode.distclean
89e36a04 1711 -rm -f tm.h aux-output.c config.h config.status tconfig.h hconfig.h
1712 -rm -f md md.pre-cpp
ab866dde 1713 -rm -f Makefile *.oaux
79f818d0 1714 -rm -fr stage1 stage2 stage3 stage4
08d7a103 1715 -rm -f cp-parse.output
1716 -rm -f objc-parse.output
1717 -rm -f c-parse.output
c6396a0b 1718
1719# Delete anything likely to be found in the source directory
1720# that shouldn't be in the distribution.
1721extraclean: distclean
bbbdbddd 1722 -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
131b361e 1723 -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
08d7a103 1724 -rm -f config/*/=* config/*/"#"* config/*/*~*
1725 -rm -f config/*/*.orig config/*/*.rej
e66de667 1726 -rm -f objc/=* objc/"#"* objc/*~*
1727 -rm -f objc/*.orig objc/*.rej
13da1009 1728 -rm -f *.dvi *.oaux *.d *.[zZ] *.gz
1729 -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
08d7a103 1730 -rm -f *lose config/*lose config/*/*lose
3a0781a0 1731 -rm -f *.s *.s[0-9] *.i install1.texi config/ChangeLog
092f28a2 1732 -rm -f djefoo
32e6d418 1733
1734# Get rid of every file that's generated from some other file.
1735# Most of these files ARE PRESENT in the GCC distribution.
649d8da6 1736realclean: distclean bytecode.realclean
c373bd56 1737 -rm -f c-parse.y objc-parse.y
32e6d418 1738 -rm -f cp-parse.c cp-parse.h cp-parse.output
1739 -rm -f objc-parse.c objc-parse.output
32e6d418 1740 -rm -f c-parse.c c-parse.h c-parse.output
1741 -rm -f cexp.c cexp.output TAGS
c6396a0b 1742 -rm -f cpp.info* cpp.??s cpp.*aux
1743 -rm -f gcc.info* gcc.??s gcc.*aux
1744 -rm -f gplus.info* gplus.??s gplus.*aux
32e6d418 1745\f
1746# Entry points `install' and `uninstall'.
c6396a0b 1747# Also use `install-collect2' to install collect2 when the config files don't.
32e6d418 1748
3f69fed5 1749# The semicolon is to prevent the install.sh -> install default rule
876dc5b0 1750# from doing anything. Having it run true helps avoid problems and
1751# noise from versions of make which don't like to have null commands.
c2a18965 1752install: $(INSTALL_TARGET) ; @true
32e6d418 1753
2cfd79fe 1754# Copy the compiler files into directories where they will be run.
2289acd7 1755install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
1756 install-man install-info
32e6d418 1757
e77fd588 1758# Do nothing while making gcc with a cross-compiler. The person who
1759# makes gcc for the target machine has to know how to put a complete
1760# gcc together by hand.
1761install-build: force
1762 @echo You have to install gcc on your target machine by hand.
1763
32e6d418 1764# Run this on the target machine
1765# to finish installation of cross compiler.
1766install-cross-rest: install-float-h-cross
1767
1768# Install float.h for cross compiler.
1769# Run this on the target machine!
aa02423a 1770install-float-h-cross: install-dir
9f10de4b 1771# if [ -f enquire ] ; then true; else false; fi
1772# Note: don't use -. We should fail right away if enquire was not made.
1773 ./enquire -f > $(tmpdir)/float.h
32e6d418 1774 -rm -f $(libsubdir)/include/float.h
f32abccb 1775 $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
1776 -rm -f $(tmpdir)/float.h
32e6d418 1777 chmod a-x $(libsubdir)/include/float.h
1778
1779# Create the installation directory.
1780install-dir:
2388f67d 1781 -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi
1782 -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; fi
444c3fb0 1783# This dir isn't currently searched by cpp.
d0561ed0 1784# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; fi
2388f67d 1785 -if [ -d $(libdir)/gcc-lib/$(target) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target) ; fi
1786 -if [ -d $(libdir)/gcc-lib/$(target)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version) ; fi
630c76ba 1787 -if [ -d $(libdir)/gcc-lib/$(target)/$(version)/include ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version)/include ; fi
2388f67d 1788 -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; fi
69184f78 1789 -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; fi
67aebfdd 1790 -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; fi
9d8314a9 1791 -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; fi
a2aa0fc1 1792 -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; fi
32e6d418 1793# We don't use mkdir -p to create the parents of mandir,
1794# because some systems don't support it.
1795# Instead, we use this technique to create the immediate parent of mandir.
2388f67d 1796 -parent=`echo $(mandir)|sed -e 's@/[^/]*$$@@'`; \
32e6d418 1797 if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
1798 -if [ -d $(mandir) ] ; then true ; else mkdir $(mandir) ; fi
1799
1800# Install the compiler executables built during cross compilation.
eb778650 1801install-common: native install-dir xgcc $(EXTRA_PARTS)
32e6d418 1802 for file in $(COMPILERS); do \
1803 if [ -f $$file ] ; then \
1804 rm -f $(libsubdir)/$$file; \
1805 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
1806 else true; \
1807 fi; \
1808 done
79f818d0 1809 for file in $(EXTRA_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
32e6d418 1810 if [ x"$$file" != x.. ]; then \
1811 rm -f $(libsubdir)/$$file; \
1812 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
1813 else true; fi; \
1814 done
8a4b1e01 1815# Don't mess with specs if it doesn't exist yet.
94c53b91 1816 -if [ -f specs ] ; then \
1817 rm -f $(libsubdir)/specs; \
8a4b1e01 1818 $(INSTALL_DATA) specs $(libsubdir)/specs; \
1819 fi
6005991e 1820# Install the driver program as $(target)-gcc
32e6d418 1821# and also as either gcc (if native) or $(tooldir)/bin/gcc.
1822 -if [ -f gcc-cross ] ; then \
7fdd7d43 1823 rm -f $(bindir)/$(target)-gcc; \
6005991e 1824 $(INSTALL_PROGRAM) gcc-cross $(bindir)/$(target)-gcc; \
32e6d418 1825 if [ -d $(tooldir)/bin/. ] ; then \
1826 rm -f $(tooldir)/bin/gcc; \
1827 $(INSTALL_PROGRAM) gcc-cross $(tooldir)/bin/gcc; \
32e6d418 1828 else true; fi; \
22a266b1 1829 if [ -f cc1plus ] ; then \
1830 rm -f $(bindir)/$(target)-g++; \
1831 $(INSTALL_PROGRAM) g++-cross $(bindir)/$(target)-g++; \
1832 chmod a+x $(bindir)/$(target)-g++; \
1833 rm -f $(bindir)/$(target)-c++; \
1834 ln $(bindir)/$(target)-g++ $(bindir)/$(target)-c++; \
1835 fi ; \
32e6d418 1836 else \
1837 rm -f $(bindir)/gcc; \
77a164d8 1838 $(INSTALL_PROGRAM) xgcc $(bindir)/gcc; \
6005991e 1839 rm -f $(bindir)/$(target)-gcc-1; \
1840 ln $(bindir)/gcc $(bindir)/$(target)-gcc-1; \
1841 mv $(bindir)/$(target)-gcc-1 $(bindir)/$(target)-gcc; \
a2678ef6 1842 if [ -f cc1plus ] ; then \
444c3fb0 1843 rm -f $(bindir)/g++; \
1844 $(INSTALL_PROGRAM) g++ $(bindir)/g++; \
1845 chmod a+x $(bindir)/g++; \
1846 rm -f $(bindir)/c++; \
1847 ln $(bindir)/g++ $(bindir)/c++; \
a2678ef6 1848 fi ; \
32e6d418 1849 fi
9cee99f7 1850# Install protoize if it was compiled.
ae0fea3a 1851 -if [ -f protoize ]; \
9cee99f7 1852 then \
1853 rm -f $(bindir)/protoize; \
1854 $(INSTALL_PROGRAM) protoize $(bindir)/protoize; \
1855 rm -f $(bindir)/unprotoize; \
1856 $(INSTALL_PROGRAM) unprotoize $(bindir)/unprotoize; \
1857 rm -f $(libsubdir)/SYSCALLS.c.X; \
1858 $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
1859 chmod a-x $(libsubdir)/SYSCALLS.c.X; \
1860 fi
32e6d418 1861 -rm -f $(libsubdir)/cpp
1862 $(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
1863
a2aa0fc1 1864# Install the info files.
aa02423a 1865install-info: doc install-dir
a2aa0fc1 1866 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
1867 cd $(srcdir); for f in cpp.info* gcc.info*; \
1868 do $(INSTALL_DATA) $$f $(infodir)/$$f; done
1869 -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
1870
32e6d418 1871# Install the man pages.
77a164d8 1872install-man: install-dir $(srcdir)/gcc.1 $(srcdir)/cccp.1 $(srcdir)/g++.1
32e6d418 1873 -rm -f $(mandir)/gcc$(manext)
ab866dde 1874 -$(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/gcc$(manext)
1875 -chmod a-x $(mandir)/gcc$(manext)
c6396a0b 1876 -rm -f $(mandir)/cccp$(manext)
ab866dde 1877 -$(INSTALL_DATA) $(srcdir)/cccp.1 $(mandir)/cccp$(manext)
1878 -chmod a-x $(mandir)/cccp$(manext)
ab866dde 1879 -$(INSTALL_DATA) $(srcdir)/g++.1 $(mandir)/g++$(manext)
1880 -chmod a-x $(mandir)/g++$(manext)
32e6d418 1881
1882# Install the library.
807a86f6 1883install-libgcc: libgcc.a install-dir
32e6d418 1884 -if [ -f libgcc.a ] ; then \
1885 rm -f $(libsubdir)/libgcc.a; \
1886 $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
1887 if $(RANLIB_TEST) ; then \
1888 (cd $(libsubdir); $(RANLIB) libgcc.a); else true; fi; \
1889 chmod a-x $(libsubdir)/libgcc.a; \
1890 else true; fi
1891
f32abccb 1892# Install the objc run time library.
1893install-libobjc: libobjc.a install-dir
1894 -if [ -f libobjc.a ] ; then \
1895 rm -f $(libsubdir)/libobjc.a; \
1896 $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \
1897 if $(RANLIB_TEST) ; then \
1898 (cd $(libsubdir); $(RANLIB) libobjc.a); else true; fi; \
1899 chmod a-x $(libsubdir)/libobjc.a; \
1900 else true; fi
1901
2cfd79fe 1902# Install all the header files built in the include subdirectory.
1903install-headers: install-include-dir $(INSTALL_HEADERS_DIR) install-assert-h
1904# Fix symlinks to absolute paths in the installed include directory to
1905# point to the installed directory, not the build directory.
1906 -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
1907 if [ $$? -eq 0 ]; then \
1908 dir=`cd include; pwd`; \
1909 for i in $$files; do \
1910 dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
1911 if expr "$$dest" : "$$dir.*" > /dev/null; then \
1912 rm -f $(libsubdir)/include/$$i; \
5822e312 1913 ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
2cfd79fe 1914 fi; \
1915 done; \
1916 fi
32e6d418 1917
2cfd79fe 1918# Create or recreate the gcc private include file directory.
2fc395f6 1919install-include-dir: install-dir
2cfd79fe 1920 -rm -rf $(libsubdir)/include
1921 mkdir $(libsubdir)/include
1922 -chmod a+rx $(libsubdir)/include
1923
1924# Install the include directory using tar.
a5889b74 1925install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
16db1e2d 1926 cd include; \
1927 (tar cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
1928# /bin/sh on some systems returns the status of the first tar,
1929# and that can lose with GNU tar which always writes a full block.
1930# So use `exit 0' to ignore its exit status.
2cfd79fe 1931
1932# Install the include directory using cpio.
a5889b74 1933install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
bea171c6 1934 cd include; find . -print | cpio -pdum $(libsubdir)/include
32e6d418 1935
35df828f 1936# Put assert.h where it won't override GNU libc's assert.h.
1937# It goes in a dir that is searched after GNU libc's headers;
1938# thus, the following conditionals are no longer needed.
1939# But it's not worth deleting them now.
1940## Don't replace the assert.h already there if it is not from GCC.
1941## This code would be simpler if it tested for -f ... && ! grep ...
1942## but supposedly the ! operator is missing in sh on some systems.
2cfd79fe 1943install-assert-h: assert.h install-dir
eb5a0caa 1944 if [ -f $(assertdir)/assert.h ]; \
1945 then \
95856242 1946 if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
a953974c 1947 then \
eb5a0caa 1948 rm -f $(assertdir)/assert.h; \
1949 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
04873c54 1950 chmod a-x $(assertdir)/assert.h; \
eb5a0caa 1951 else true; \
1952 fi; \
2ba284c3 1953 else \
db9a0b19 1954 rm -f $(assertdir)/assert.h; \
1955 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
04873c54 1956 chmod a-x $(assertdir)/assert.h; \
2ba284c3 1957 fi
32e6d418 1958
c6396a0b 1959# Use this target to install the program `collect2' under the name `ld'.
aa02423a 1960install-collect2: collect2 install-dir
c6396a0b 1961 $(INSTALL_PROGRAM) collect2 $(libsubdir)/ld
1962# Install the driver program as $(libsubdir)/gcc for collect2.
77a164d8 1963 $(INSTALL_PROGRAM) xgcc $(libsubdir)/gcc
c6396a0b 1964
32e6d418 1965# Cancel installation by deleting the installed files.
1966uninstall:
1967 -rm -rf $(libsubdir)
1968 -rm -rf $(bindir)/gcc
32e6d418 1969 -rm -rf $(bindir)/protoize
1970 -rm -rf $(bindir)/unprotoize
1971 -rm -rf $(mandir)/gcc$(manext)
3b50af09 1972 -rm -rf $(mandir)/g++$(manext)
c6396a0b 1973 -rm -rf $(mandir)/cccp$(manext)
32e6d418 1974 -rm -rf $(mandir)/protoize$(manext)
1975 -rm -rf $(mandir)/unprotoize$(manext)
1976\f
1977# These exist for maintenance purposes.
1978
1979# Update the tags table.
1980TAGS: force
1981 cd $(srcdir); \
1982 mkdir temp; \
8c1b3852 1983 mv -f c-parse.[ch] cp-parse.[ch] objc-parse.c cexp.c =*.[chy] temp; \
32e6d418 1984 etags *.y *.h *.c; \
1985 mv temp/* .; \
1986 rmdir temp
1987
1988# Create the distribution tar file.
e5b63666 1989#dist: gcc-$(version).tar.gz
1990dist: gcc.xtar.gz
32e6d418 1991
e5b63666 1992gcc.xtar.gz: gcc.xtar
1993 gzip < gcc.xtar > tmp-gcc.xtar.gz
1994 mv tmp-gcc.xtar.gz gcc.xtar.gz
32e6d418 1995
e5b63666 1996#gcc-$(version).tar.gz: gcc-$(version).tar
1997# gzip < gcc-$(version).tar > gcc-$(version).tar.gz
32e6d418 1998
1999#gcc-$(version).tar:
6c76e6ec 2000gcc.xtar: distdir
2001# Make the distribution.
2002 tar chf gcc.xtar gcc-$(version)
2003
3b50af09 2004distdir: doc $(srcdir)/INSTALL c-parse.y objc-parse.y cp-parse.y \
2005 c-parse.c cp-parse.c objc-parse.c cexp.c
630c76ba 2006 if grep -s "for version ${version}" gcc.texi; \
2007 then true; \
0dce1b01 2008 else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
630c76ba 2009 fi
131b361e 2010# Update the version number in README
2011 awk '$$1 " " $$2 " " $$3 == "This directory contains" \
2012 { $$6 = version; print $$0 } \
2013 $$1 " " $$2 " " $$3 != "This directory contains"' \
2014 version=$(version) README > tmp.README
2015 mv tmp.README README
c6396a0b 2016 -rm -rf gcc-$(version) tmp
32e6d418 2017# Put all the files in a temporary subdirectory
2018# which has the name that we want to have in the tar file.
c6396a0b 2019 mkdir tmp
2020 mkdir tmp/config
4f1fd857 2021 mkdir tmp/objc
c6396a0b 2022 for file in *[0-9a-zA-Z+]; do \
131b361e 2023 ln $$file tmp > /dev/null 2>&1 || cp $$file tmp; \
c6396a0b 2024 done
2025 cd config; \
2026 for file in *[0-9a-zA-Z+]; do \
57e88ef9 2027 if test -d $$file && test "$$file" != RCS; then \
8a32ef6f 2028 mkdir ../tmp/config/$$file; \
2029 cd $$file; \
2030 for subfile in *[0-9a-zA-Z+]; do \
2031 ln $$subfile ../../tmp/config/$$file >/dev/null 2>&1 \
2032 || cp $$subfile ../../tmp/config/$$file; \
2033 done; \
2034 cd ..; \
2035 else \
2036 ln $$file ../tmp/config >/dev/null 2>&1 \
2037 || cp $$file ../tmp/config; \
2038 fi; \
32e6d418 2039 done
4f1fd857 2040 cd objc; \
2041 for file in *[0-9a-zA-Z+]; do \
e77fd588 2042 ln $$file ../tmp/objc >/dev/null 2>&1 || cp $$file ../tmp/objc; \
4f1fd857 2043 done
c6396a0b 2044 ln .gdbinit tmp
2045 mv tmp gcc-$(version)
32e6d418 2046# Get rid of everything we don't want in the distribution.
c6396a0b 2047 cd gcc-$(version); make -f Makefile.in extraclean
32e6d418 2048
2049# do make -f ../gcc/Makefile maketest DIR=../gcc
2050# in the intended test directory to make it a suitable test directory.
2051# THIS IS OBSOLETE; use the -srcdir operand in configure instead.
2052maketest:
2053 ln -s $(DIR)/*.[chy] .
2054 ln -s $(DIR)/configure .
2055 ln -s $(DIR)/*.def .
2056 -rm -f =*
2057 ln -s $(DIR)/.gdbinit .
2058 ln -s $(DIR)/$(FIXINCLUDES) .
2059 -ln -s $(DIR)/bison.simple .
2060 ln -s $(DIR)/config .
2061 ln -s $(DIR)/move-if-change .
2062# The then and else were swapped to avoid a problem on Ultrix.
2063 if [ ! -f Makefile ] ; then ln -s $(DIR)/Makefile .; else false; fi
2064 -rm tm.h aux-output.c config.h md
2065 make clean
2066# You must then run config to set up for compilation.
77a164d8 2067
41f63c60 2068bootstrap: force
2069# Only build the C compiler for stage1, because that is the only one that
2070# we can guarantee will build with the native compiler, and also it is the
2071# only thing useful for building stage2.
3ef0efe3 2072 $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES=c
32e6d418 2073 $(MAKE) stage1
c6396a0b 2074# This used to define ALLOCA as empty, but that would lead to bad results
2075# for a subsequent `make install' since that would not have ALLOCA empty.
2076# To prevent `make install' from compiling alloca.o and then relinking cc1
2077# because alloca.o is newer, we permit these recursive makes to compile
2078# alloca.o. Then cc1 is newer, so it won't have to be relinked.
12343c6a 2079 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
32e6d418 2080 $(MAKE) stage2
12343c6a 2081 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
32e6d418 2082
2083bootstrap2: force
12343c6a 2084 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
32e6d418 2085 $(MAKE) stage2
12343c6a 2086 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
32e6d418 2087
2088bootstrap3: force
12343c6a 2089 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
32e6d418 2090
48c6936b 2091# Compare the object files in the current directory with those in the
2092# stage2 directory.
2093
639b13ee 2094# ./ avoids bug in some versions of tail.
48c6936b 2095compare: force
2096 for file in *.o; do \
639b13ee 2097 tail +16c ./$$file > tmp-foo1; \
77a164d8 2098 tail +16c stage2/$$file > tmp-foo2 2>/dev/null \
2099 && (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
48c6936b 2100 done
2101 -rm -f tmp-foo*
2102
2103# Similar, but compare with stage3 directory
2104compare3: force
2105 for file in *.o; do \
77a164d8 2106 tail +16c $$file > tmp-foo1; \
2107 tail +16c stage3/$$file > tmp-foo2 2>/dev/null \
2108 && (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
48c6936b 2109 done
2110 -rm -f tmp-foo*
2111
32e6d418 2112# Copy the object files from a particular stage into a subdirectory.
2113stage1: force
c6396a0b 2114 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
32e6d418 2115 -mv $(STAGESTUFF) stage1
2116 -rm -f stage1/libgcc.a
2117 -cp libgcc.a stage1
2118 -if $(RANLIB_TEST) ; then $(RANLIB) stage1/libgcc.a; else true; fi
2119
2120stage2: force
c6396a0b 2121 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
32e6d418 2122 -mv $(STAGESTUFF) stage2
2123 -rm -f stage2/libgcc.a
2124 -cp libgcc.a stage2
2125 -if $(RANLIB_TEST) ; then $(RANLIB) stage2/libgcc.a; else true; fi
2126
2127stage3: force
2388f67d 2128 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
32e6d418 2129 -mv $(STAGESTUFF) stage3
2130 -rm -f stage3/libgcc.a
2131 -cp libgcc.a stage3
2132 -if $(RANLIB_TEST) ; then $(RANLIB) stage3/libgcc.a; else true; fi
2133
2134stage4: force
2388f67d 2135 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
32e6d418 2136 -mv $(STAGESTUFF) stage4
2137 -rm -f stage4/libgcc.a
2138 -cp libgcc.a stage4
2139 -if $(RANLIB_TEST) ; then $(RANLIB) stage4/libgcc.a; else true; fi
2140
2141# Copy just the executable files from a particular stage into a subdirectory,
2142# and delete the object files. Use this if you're just verifying a version
2143# that is pretty sure to work, and you are short of disk space.
2144risky-stage1: force
2388f67d 2145 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
e650197c 2146 -mv $(GCC_PARTS) stage1
32e6d418 2147 -rm -f stage1/libgcc.a
2148 -cp libgcc.a stage1 && $(RANLIB) stage1/libgcc.a
2149 -make clean
2150
2151risky-stage2: force
2388f67d 2152 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
e650197c 2153 -mv $(GCC_PARTS) stage2
32e6d418 2154 -rm -f stage2/libgcc.a
2155 -cp libgcc.a stage2 && $(RANLIB) stage2/libgcc.a
2156 -make clean
2157
2158risky-stage3: force
2388f67d 2159 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
e650197c 2160 -mv $(GCC_PARTS) stage3
32e6d418 2161 -rm -f stage3/libgcc.a
2162 -cp libgcc.a stage3 && $(RANLIB) stage3/libgcc.a
2163 -make clean
2164
2165risky-stage4: force
2388f67d 2166 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
e650197c 2167 -mv $(GCC_PARTS) stage4
32e6d418 2168 -rm -f stage4/libgcc.a
2169 -cp libgcc.a stage4 && $(RANLIB) stage4/libgcc.a
2170 -make clean
2171
2172#In GNU Make, ignore whether `stage*' exists.
2173.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
2174.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
2175
2176force: