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