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