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