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