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