]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/Makefile.in
* lang-options.h: Add missing options.
[thirdparty/gcc.git] / gcc / Makefile.in
CommitLineData
32e6d418 1# Makefile for GNU C compiler.
dd20fff6 2# Copyright (C) 1987, 88, 90-96, 1997 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
8d62a21c 18#the Free Software Foundation, 59 Temple Place - Suite 330,
19#Boston MA 02111-1307, USA.
32e6d418 20
21# The targets for external use include:
22# all, doc, proto, install, install-cross, install-cross-rest,
a8514488 23# uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean,
32e6d418 24# stage1, stage2, stage3, stage4.
25
c6396a0b 26# Suppress smart makes who think they know how to automake Yacc files
27.y.c:
28
87c0ad1b 29# Directory where sources are, from where we are.
30srcdir = @srcdir@
31VPATH = @srcdir@
32
32e6d418 33# Variables that exist for you to override.
34# See below for how to change them for certain systems.
35
73027c94 36# List of language subdirectories.
37# This is overridden by configure.
87c0ad1b 38SUBDIRS =@subdirs@
73027c94 39
32e6d418 40# Selection of languages to be made.
73027c94 41# This is overridden by configure.
8757933b 42LANGUAGES = c proto gcov @all_languages@
32e6d418 43
e754efc9 44# Selection of languages to be made during stage1 build.
45# This is overridden by configure.
87c0ad1b 46BOOT_LANGUAGES = c @all_boot_languages@
e754efc9 47
32e6d418 48ALLOCA =
1ab99fde 49ALLOCA_FLAGS =
94c53b91 50ALLOCA_FINISH = true
32e6d418 51
52# Various ways of specifying flags for compilations:
53# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
54# BOOT_CFLAGS is the value of CFLAGS to pass
55# to the stage2 and stage3 compilations
56# XCFLAGS is used for most compilations but not when using the GCC just built.
329da2a1 57# TCFLAGS is used for compilations with the GCC just built.
32e6d418 58XCFLAGS =
329da2a1 59TCFLAGS =
32e6d418 60CFLAGS = -g
86373592 61BOOT_CFLAGS = -O2 $(CFLAGS)
32e6d418 62# These exists to be overridden by the x-* and t-* files, respectively.
63X_CFLAGS =
64T_CFLAGS =
65
66X_CPPFLAGS =
67T_CPPFLAGS =
68
38bce124 69CC = @CC@
32e6d418 70BISON = bison
3f1608f3 71BISONFLAGS =
73027c94 72LEX = flex
73LEXFLAGS =
32e6d418 74AR = ar
32e6d418 75AR_FLAGS = rc
0dbd1c74 76LN = @symbolic_link@
4664c5d5 77DLLTOOL = dlltool
32e6d418 78SHELL = /bin/sh
79# on sysV, define this as cp.
87c0ad1b 80INSTALL = @INSTALL@
ea4a6c81 81# Some systems may be missing symbolic links, regular links, or both.
82# Allow configure to check this and use "ln -s", "ln", or "cp" as appropriate.
83LN=@LN@
84LN_S=@LN_S@
32e6d418 85# These permit overriding just for certain files.
74086405 86INSTALL_PROGRAM = @INSTALL_PROGRAM@
87INSTALL_DATA = @INSTALL_DATA@
bc51108a 88MAKEINFO = makeinfo
64cda823 89MAKEINFOFLAGS =
f345940f 90TEXI2DVI = texi2dvi
73027c94 91# For GNUmake: let us decide what gets passed to recursive makes.
92MAKEOVERRIDES =
87c0ad1b 93@SET_MAKE@
32e6d418 94
95# Define this as & to perform parallel make on a Sequent.
96# Note that this has some bugs, and it seems currently necessary
97# to compile all the gen* files first by hand to avoid erroneous results.
98P =
99
100# How to invoke ranlib.
101RANLIB = ranlib
102# Test to use to see whether ranlib exists on the system.
103RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
104
105# Compiler to use for compiling libgcc1.a.
106# OLDCC should not be the GNU C compiler,
107# since that would compile typical libgcc1.a functions such as mulsi3
108# into infinite recursions.
109OLDCC = cc
110
111# CFLAGS for use with OLDCC, for compiling libgcc1.a.
112# NOTE: -O does not work on some Unix systems!
113CCLIBFLAGS = -O
114
c6396a0b 115# Version of ar to use when compiling libgcc1.a.
32e6d418 116OLDAR = ar
38bce124 117OLDAR_FLAGS = qc
32e6d418 118
2cfd79fe 119# Target to use when installing include directory. Either
120# install-headers-tar or install-headers-cpio.
87c0ad1b 121INSTALL_HEADERS_DIR = @build_install_headers_dir@
2cfd79fe 122
c8763215 123# Header files that are made available under the same name
124# to programs compiled with GCC.
125USER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/stddef.h \
126 $(srcdir)/ginclude/varargs.h $(srcdir)/ginclude/va-alpha.h \
127 $(srcdir)/ginclude/va-h8300.h $(srcdir)/ginclude/va-i860.h \
128 $(srcdir)/ginclude/va-i960.h $(srcdir)/ginclude/va-mips.h \
169dbe8d 129 $(srcdir)/ginclude/va-m88k.h $(srcdir)/ginclude/va-mn10200.h \
130 $(srcdir)/ginclude/va-mn10300.h $(srcdir)/ginclude/va-pa.h \
c8763215 131 $(srcdir)/ginclude/va-pyr.h $(srcdir)/ginclude/va-sparc.h \
132 $(srcdir)/ginclude/va-clipper.h $(srcdir)/ginclude/va-spur.h \
7820337b 133 $(srcdir)/ginclude/va-m32r.h $(srcdir)/ginclude/va-sh.h \
399e3dbb 134 $(srcdir)/ginclude/va-v850.h $(srcdir)/ginclude/va-arc.h \
c8763215 135 $(srcdir)/ginclude/iso646.h $(srcdir)/ginclude/va-ppc.h \
7820337b 136 $(srcdir)/ginclude/proto.h $(EXTRA_HEADERS) \
6143c0f8 137 $(LANG_EXTRA_HEADERS)
c8763215 138
139# Target to use whe installing assert.h. Some systems may
140# want to set this empty.
141INSTALL_ASSERT_H = install-assert-h
142
3b9b6fde 143# The GCC to use for compiling libgcc2.a, enquire, and libgcc1-test.
b3781cc4 144# Usually the one we just built.
32e6d418 145# Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS).
79613d1b 146GCC_FOR_TARGET = ./xgcc -B./
32e6d418 147
148# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
149# It omits XCFLAGS, and specifies -B./.
66820558 150# It also specifies -I./include to find, e.g., stddef.h.
329da2a1 151GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -I./include $(TCFLAGS)
32e6d418 152
153# Special flags for compiling enquire.
154# We disable optimization to make floating point more reliable.
c7341319 155ENQUIRE_CFLAGS = -DNO_MEM -DNO_LONG_DOUBLE_IO -O0
32e6d418 156ENQUIRE_LDFLAGS = $(LDFLAGS)
157
b541ad9d 158# Sed command to transform gcc to installed name. Overwritten by configure.
3271658e 159program_transform_name = @program_transform_name@
ccb6700d 160program_transform_cross_name = s,^,$(target_alias)-,
b541ad9d 161
32e6d418 162# Tools to use when building a cross-compiler.
163# These are used because `configure' appends `cross-make'
164# to the makefile when making a cross-compiler.
165
166TARGET_TOOLPREFIX = $(tooldir)/bin/
167AR_FOR_TARGET = $(TARGET_TOOLPREFIX)ar
168AR_FOR_TARGET_FLAGS = rc
169RANLIB_FOR_TARGET = $(TARGET_TOOLPREFIX)ranlib
170RANLIB_TEST_FOR_TARGET = [ -f $(TARGET_TOOLPREFIX)ranlib ]
32e6d418 171
3f69fed5 172# Dir to search for system headers. Overridden by cross-make.
173SYSTEM_HEADER_DIR = /usr/include
174
61fad423 175# Control whether to run fixproto.
176STMP_FIXPROTO = stmp-fixproto
a5889b74 177
0dbd1c74 178# Test to see whether <float.h> exists in the system header files,
179# and is not derived from GCC.
180FLOAT_H_TEST = \
181 [ -f $(SYSTEM_HEADER_DIR)/float.h ] && \
182 if grep 'ifndef _FLOAT_H___' $(SYSTEM_HEADER_DIR)/float.h >/dev/null; \
183 then false; \
184 else :; fi
185
0848b369 186# Test to see whether <limits.h> exists in the system header files.
187LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
188
8bd8ea06 189# There may be a premade insn-attrtab.c for this machine.
190# (You could rebuild it with genattrtab as usual, but it takes a long time.)
191# PREMADE_ATTRTAB is the file name of the file to use.
192# PREMADE_ATTRTAB_MD is the md file it corresponds to.
193PREMADE_ATTRTAB_MD = Makefile # Guaranteed not to cmp equal to md.
194PREMADE_ATTRTAB =
195
87c0ad1b 196target=@target@
71d9c015 197target_alias=@target_alias@
87c0ad1b 198xmake_file=@dep_host_xmake_file@
199tmake_file=@dep_tmake_file@
200out_file=$(srcdir)/config/@out_file@
201out_object_file=@out_object_file@
202md_file=$(srcdir)/config/@md_file@
203tm_file=@tm_file_list@
204build_xm_file=@build_xm_file_list@
205host_xm_file=@host_xm_file_list@
206lang_specs_files=@lang_specs_files@
207lang_options_files=@lang_options_files@
714fe809 208GCC_THREAD_FILE=@thread_file@
58febf9e 209GTHREAD_FLAGS=@gthread_flags@
87c0ad1b 210version=@version@
2b19125c 211mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
32e6d418 212
32e6d418 213# Common prefix for installation directories.
214# NOTE: This directory must exist when you start installation.
87c0ad1b 215prefix = @prefix@
2ffdcadf 216# Directory in which to put localized header files. On the systems with
217# gcc as the native cc, `local_prefix' may not be `prefix' which is
218# `/usr'.
a2aa0fc1 219# NOTE: local_prefix *should not* default from prefix.
87c0ad1b 220local_prefix = @local_prefix@
c6396a0b 221# Directory in which to put host dependent programs and libraries
87c0ad1b 222exec_prefix = @exec_prefix@
32e6d418 223# Directory in which to put the executable for the command `gcc'
87c0ad1b 224bindir = @bindir@
32e6d418 225# Directory in which to put the directories used by the compiler.
87c0ad1b 226libdir = @libdir@
32e6d418 227# Directory in which the compiler finds executables, libraries, etc.
67cb4bc1 228libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(version)
3bf5d4dc 229# Directory in which the compiler finds g++ includes.
df693a69 230gxx_include_dir= @gxx_include_dir@
ac2f5cba 231# Directory in which the old g++ header files may be found.
232old_gxx_include_dir= $(libdir)/g++-include
35df828f 233# Directory to search for site-specific includes.
9671ce48 234includedir = $(local_prefix)/include
db9a0b19 235# assertdir is overridden in cross-make.
9d8314a9 236# (But this currently agrees with what is in cross-make.)
237assertdir = $(tooldir)/include
a2aa0fc1 238# where the info files go
87c0ad1b 239infodir = @infodir@
32e6d418 240# Extension (if any) to put in installed man-page filename.
241manext = .1
f403cbcb 242objext = .o
2aa3e87b 243exeext = @host_exeext@
244build_exeext = @build_exeext@
f403cbcb 245
32e6d418 246# Directory in which to put man pages.
87c0ad1b 247mandir = @mandir@/man1
32e6d418 248# Directory in which to find other cross-compilation tools and headers.
249# Used in install-cross.
67cb4bc1 250tooldir = $(exec_prefix)/$(target_alias)
f32abccb 251# Dir for temp files.
252tmpdir = /tmp
32e6d418 253
254# Additional system libraries to link with.
255CLIB=
256
257# Change this to a null string if obstacks are installed in the
258# system library.
259OBSTACK=obstack.o
260
2289acd7 261# Specify the rule for actually making libgcc.a,
262LIBGCC = libgcc.a
263# and the rule for installing it.
264INSTALL_LIBGCC = install-libgcc
265
32e6d418 266# Specify the rule for actually making libgcc1.a.
c6396a0b 267# The value may be empty; that means to do absolutely nothing
268# with or for libgcc1.a.
32e6d418 269LIBGCC1 = libgcc1.a
270
b0d230b7 271# Specify the rule for making libgcc1.a for a cross-compiler.
272# The default rule assumes that libgcc1.a is supplied by the user.
273CROSS_LIBGCC1 = libgcc1.cross
274
32e6d418 275# Specify the rule for actually making libgcc2.a.
276LIBGCC2 = libgcc2.a
277
278# Options to use when compiling libgcc2.a.
279# -g1 causes output of debug info only for file-scope entities.
280# we use this here because that should be enough, and also
281# so that -g1 will be tested.
cce804d3 282#
283# -fexceptions is necessary for eh.o now that the exceptions are
284# the default for g++ only.
b1e0e993 285LIBGCC2_DEBUG_CFLAGS = -g1
58febf9e 286LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fexceptions @inhibit_libc@
690a93ea 287
288# Additional options to use when compiling libgcc2.a.
289# Some targets override this to -Iinclude
290LIBGCC2_INCLUDES =
291
b5dba0c7 292# Additional target-dependent options for compiling libgcc2.a.
293TARGET_LIBGCC2_CFLAGS =
294
690a93ea 295# Things which must be built before building libgcc2.a.
296# Some targets override this to stmp-int-hdrs
297LIBGCC2_DEPS =
32e6d418 298
17886975 299# Enquire target (This is a variable so that a target can choose not to
300# build it.)
301ENQUIRE = enquire
302
3b9b6fde 303# libgcc1-test target (must also be overridable for a target)
304LIBGCC1_TEST = libgcc1-test
17886975 305
32e6d418 306# List of extra executables that should be compiled for this target machine
307# that are used for compiling from source code to object code.
308# The rules for compiling them should be in the t-* file for the machine.
87c0ad1b 309EXTRA_PASSES =@extra_passes@
32e6d418 310
c6396a0b 311# Like EXTRA_PASSES, but these are used when linking.
87c0ad1b 312EXTRA_PROGRAMS = @extra_programs@
c6396a0b 313
314# List of extra object files that should be compiled for this target machine.
32e6d418 315# The rules for compiling them should be in the t-* file for the machine.
87c0ad1b 316EXTRA_PARTS = @extra_parts@
32e6d418 317
c6396a0b 318# List of extra object files that should be compiled and linked with
319# compiler proper (cc1, cc1obj, cc1plus).
87c0ad1b 320EXTRA_OBJS = @extra_objs@
c6396a0b 321
17108b2b 322# List of extra object files that should be compiled and linked with
323# the gcc driver.
87c0ad1b 324EXTRA_GCC_OBJS =@host_extra_gcc_objs@
17108b2b 325
630c76ba 326# List of additional header files to install.
327# Often this is edited directly by `configure'.
87c0ad1b 328EXTRA_HEADERS =@extra_headers_list@
630c76ba 329
79f818d0 330# Set this to `ld' to enable use of collect2.
87c0ad1b 331USE_COLLECT2 = @will_use_collect2@
23029fe8 332MAYBE_USE_COLLECT2 = @maybe_use_collect2@
79f818d0 333# It is convenient for configure to add the assignment at the beginning,
334# so don't override it here.
94ca3aab 335USE_COLLECT2 = ld
79f818d0 336
32e6d418 337# List of extra C and assembler files to add to libgcc1.a.
338# Assembler files should have names ending in `.asm'.
339LIB1FUNCS_EXTRA =
340
341# List of extra C and assembler files to add to libgcc2.a.
342# Assembler files should have names ending in `.asm'.
343LIB2FUNCS_EXTRA =
344
2cfd79fe 345# Default float.h source to use for cross-compiler.
ad87de1e 346# This is overridden by configure.
87c0ad1b 347CROSS_FLOAT_H=$(srcdir)/config/float-@float_format@.h
2cfd79fe 348
32e6d418 349# Program to convert libraries.
350LIBCONVERT =
351
352# Control whether header files are installed.
32e6d418 353INSTALL_HEADERS=install-headers
354
ed2f1f67 355# Options for tar when copying trees. So HPUX can override it.
356TAROUTOPTS = xpBf
357
32e6d418 358# Select which version of fixincludes to use (I.E. regular versus SVR4)
6848a9c6 359# This value is overridden directly by configure.
87c0ad1b 360FIXINCLUDES = @fixincludes@
32e6d418 361
106a27e5 362# Additional directories of header files to run fixincludes on.
af731fc2 363# These should be directories searched automatically by default
364# just as /usr/include is.
365# *Do not* use this for directories that happen to contain
366# header files, but are not searched automatically by default.
106a27e5 367# On most systems, this is empty.
368OTHER_FIXINCLUDES_DIRS=
369
fc0b8ef8 370# A list of all the language-specific executables.
371# This is overridden by configure.
8757933b 372COMPILERS = cc1$(exeext) @all_compilers@
fc0b8ef8 373
77a164d8 374# List of things which should already be built whenever we try to use xgcc
32e6d418 375# to compile anything (without linking).
d1871a55 376GCC_PASSES=xgcc cc1 cpp $(EXTRA_PASSES)
32e6d418 377
77a164d8 378# List of things which should already be built whenever we try to use xgcc
32e6d418 379# to link anything.
2289acd7 380GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
32e6d418 381
32e6d418 382# Directory to link to, when using the target `maketest'.
383DIR = ../gcc
384
89e36a04 385# Guaranteed to not exist when not passing md through cpp.
2c352995 386# This value is overridden directly by configure.
89e36a04 387MD_FILE = md-cpp-not-used
388
32e6d418 389# Flags to use when cross-building GCC.
390# Prefix to apply to names of object files when using them
391# to run on the machine we are compiling on.
392HOST_PREFIX=
393# Prefix to apply to names of object files when compiling them
394# to run on the machine we are compiling on.
395# The default for this variable is chosen to keep these rules
396# out of the way of the other rules for compiling the same source files.
397HOST_PREFIX_1=loser-
398HOST_CC=$(CC)
399HOST_CFLAGS=$(ALL_CFLAGS)
c6396a0b 400HOST_CLIB=$(CLIB)
32e6d418 401HOST_LDFLAGS=$(LDFLAGS)
402HOST_CPPFLAGS=$(ALL_CPPFLAGS)
c6396a0b 403HOST_ALLOCA=$(ALLOCA)
404HOST_MALLOC=$(MALLOC)
405HOST_OBSTACK=$(OBSTACK)
32e6d418 406
b541ad9d 407# Actual name to use when installing a native compiler.
ccb6700d 408GCC_INSTALL_NAME = `t='$(program_transform_name)'; echo gcc | sed -e $$t`
b541ad9d 409
410# Actual name to use when installing a cross-compiler.
ccb6700d 411GCC_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcc | sed -e $$t`
b541ad9d 412
32e6d418 413# Choose the real default target.
414ALL=all.internal
415
416# Choose the real install target.
2cfd79fe 417INSTALL_TARGET=install-normal
418
419# Source for float.h. Overridden by cross-make.
420FLOAT_H=float.h-nat
32e6d418 421
6c08487b 422# Setup the testing framework, if you have one
423EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \
424 echo $${rootme}/../expect/expect ; \
425 else echo expect ; fi`
426
427RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
428 echo $${srcdir}/../dejagnu/runtest ; \
429 else echo runtest; fi`
430RUNTESTFLAGS =
431
b33b80ed 432# Extra symbols for fixproto to define when parsing headers.
433FIXPROTO_DEFINES =
434
b7c87ff2 435# Extra flags to use when compiling crt{begin,end}.o.
436CRTSTUFF_T_CFLAGS =
437
4d3c962c 438# Extra flags to use when compiling [m]crt0.o.
439CRT0STUFF_T_CFLAGS =
440
0dbd1c74 441# "t" or nothing, for building multilibbed versions of, say, crtbegin.o.
442T =
443
32e6d418 444# End of variables for you to override.
445
446# Definition of `all' is here so that new rules inserted by sed
447# do not specify the default target.
448# The real definition is under `all.internal' (for native compilers)
449# or `all.cross' (for cross compilers).
c6396a0b 450all: all.indirect
32e6d418 451
131b361e 452# This tells GNU Make version 3 not to put all variables in the environment.
453.NOEXPORT:
454
32e6d418 455# sed inserts variable overrides after the following line.
a0a99f10 456####target overrides
87c0ad1b 457@target_overrides@
458
a0a99f10 459####host overrides
87c0ad1b 460@host_overrides@
461
a0a99f10 462####cross overrides
87c0ad1b 463@cross_defines@
464@cross_overrides@
465
e77fd588 466####build overrides
87c0ad1b 467@build_overrides@
2e9d8ccf 468#\f
32e6d418 469# Now figure out from those variables how to compile and link.
470
c6396a0b 471all.indirect: $(ALL)
472
335ebf8f 473# IN_GCC tells obstack.h that we are using gcc's <stddef.h> file.
474# ??? IN_GCC should be obsolete now.
6cba4ca3 475INTERNAL_CFLAGS = $(CROSS) -DIN_GCC @extra_c_flags@
32e6d418 476
477# This is the variable actually used when we compile.
5539b206 478ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) \
3eb9a99d 479 @DEFS@ $(SCHED_CFLAGS)
32e6d418 480
481# Likewise.
482ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
483
484# Even if ALLOCA is set, don't use it if compiling with GCC.
c1f5b841 485USE_ALLOCA= ${ALLOCA}
486USE_HOST_ALLOCA= ` case "${HOST_ALLOCA}" in ?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
c6396a0b 487USE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac `
488USE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac `
32e6d418 489
490# Dependency on obstack, alloca, malloc or whatever library facilities
491# are not installed in the system libraries.
492# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
493LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC)
494
495# Likewise, for use in the tools that must run on this machine
496# even if we are cross-building GCC.
497# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
c6396a0b 498HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC)
32e6d418 499
500# How to link with both our special library facilities
501# and the system's installed libraries.
502LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(CLIB)
503
504# Likewise, for use in the tools that must run on this machine
505# even if we are cross-building GCC.
c6396a0b 506HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \
507 $(HOST_CLIB)
32e6d418 508
509HOST_RTL = $(HOST_PREFIX)rtl.o
510HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o
262d46de 511HOST_PRINT = $(HOST_PREFIX)print-rtl.o
32e6d418 512
513# Specify the directories to be searched for header files.
514# Both . and srcdir are used, in that order,
515# so that tm.h and config.h will be found in the compilation
516# subdirectory rather than in the source directory.
517INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config
32e6d418 518
519# Always use -I$(srcdir)/config when compiling.
520.c.o:
521 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
522
523# This tells GNU make version 3 not to export all the variables
524# defined in this file into the environment.
525.NOEXPORT:
2e9d8ccf 526#\f
73027c94 527# Support for additional languages (other than c and objc).
528# ??? objc can be supported this way too (leave for later).
529
530# These next lines are overridden by configure.
87c0ad1b 531LANG_MAKEFILES = @all_lang_makefiles@
532LANG_STAGESTUFF = @all_stagestuff@
533LANG_DIFF_EXCLUDES = @all_diff_excludes@
534LANG_LIB2FUNCS = @all_lib2funcs@
535LANG_EXTRA_HEADERS = @all_headers@
73027c94 536
537# Flags to pass to recursive makes.
538# CC is set by configure. Hosts without symlinks need special handling
539# because we need CC="stage1/xgcc -Bstage1/" to work in the language
540# subdirectories.
541# ??? The choices here will need some experimenting with.
542FLAGS_TO_PASS = \
543 "AR_FLAGS=$(AR_FLAGS)" \
544 "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
545 "BISON=$(BISON)" \
546 "BISONFLAGS=$(BISONFLAGS)" \
87c0ad1b 547 "CC=@cc_set_by_configure@" \
73027c94 548 "CFLAGS=$(CFLAGS)" \
2feda28e 549 "CLIB=$(CLIB)" \
c1a2e040 550 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
73027c94 551 "LDFLAGS=$(LDFLAGS)" \
552 "LEX=$(LEX)" \
553 "LEXFLAGS=$(LEXFLAGS)" \
ea4a6c81 554 "LN=$(LN)" \
555 "LN_S=$(LN_S)" \
73027c94 556 "MAKEINFO=$(MAKEINFO)" \
557 "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
73027c94 558 "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
559 "RANLIB_TEST_FOR_TARGET=$(RANLIB_TEST_FOR_TARGET)" \
560 "SHELL=$(SHELL)" \
87c0ad1b 561 "STAGE_PREFIX=@stage_prefix_set_by_configure@" \
62268150 562 "exeext=$(exeext)" \
2aa3e87b 563 "build_exeext=$(build_exeext)" \
62268150 564 "objext=$(objext)" \
73027c94 565 "exec_prefix=$(exec_prefix)" \
566 "prefix=$(prefix)" \
567 "tooldir=$(tooldir)" \
568 "bindir=$(bindir)" \
569 "libsubdir=$(libsubdir)"
2e9d8ccf 570#\f
32e6d418 571# Lists of files for various purposes.
572
ee8f5350 573# Language-specific object files for C and Objective C.
574C_AND_OBJC_OBJS = c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o \
575 c-aux-info.o c-common.o c-iterate.o @extra_c_objs@
576
32e6d418 577# Language-specific object files for C.
ee8f5350 578C_OBJS = c-parse.o c-lang.o $(C_AND_OBJC_OBJS)
6cba4ca3 579
649d8da6 580# Files specific to the C interpreter bytecode compiler(s).
581BC_OBJS = bc-emit.o bc-optab.o
582
84a49858 583# Bytecode header files constructed at build time; vmsconfig.com wants this.
584BC_ALL = bc-arity.h bc-opcode.h bc-opname.h
585
3eb9a99d 586SCHED_PREFIX = @sched_prefix@
587SCHED_CFLAGS = @sched_cflags@
588
32e6d418 589# Language-independent object files.
590OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
037a5228 591 function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o \
3ad7bb1c 592 varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o genrtl.o real.o regmove.o \
3eb9a99d 593 dbxout.o sdbout.o dwarfout.o dwarf2out.o xcoffout.o bitmap.o alias.o \
32e6d418 594 integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o \
8a4b1e01 595 regclass.o local-alloc.o global.o reload.o reload1.o caller-save.o \
3eb9a99d 596 insn-peep.o reorg.o $(SCHED_PREFIX)sched.o final.o recog.o reg-stack.o \
bdb66cef 597 insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \
8f220b93 598 profile.o insn-attrtab.o $(out_object_file) getpwd.o convert.o $(EXTRA_OBJS)
32e6d418 599
600# GEN files are listed separately, so they can be built before doing parallel
601# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load
602# them before rtl.o is compiled.
3ad7bb1c 603GEN= genemit genoutput genrecog genextract genflags gencodes genconfig \
604 genpeep gengenrtl
32e6d418 605
3e4227af 606CCCP=cccp
607# Uncomment this line if you want to use cppmain (w/cpplib) as cpp.
608#CCCP=cppmain
609
32e6d418 610# Files to be copied away after each stage in building.
62268150 611STAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \
32e6d418 612 insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
d95fa18c 613 insn-attr.h insn-attrtab.c insn-opinit.c \
3d97d965 614 stamp-flags stamp-config stamp-codes stamp-mlib \
32e6d418 615 stamp-output stamp-recog stamp-emit stamp-extract stamp-peep \
4d3c962c 616 stamp-attr stamp-attrtab stamp-opinit stamp-proto stamp-crt stamp-crtS stamp-crt0 \
2aa3e87b 617 genemit$(build_exeext) genoutput$(build_exeext) genrecog$(build_exeext) \
618 genextract$(build_exeext) genflags$(build_exeext) gencodes$(build_exeext) \
619 genconfig$(build_exeext) genpeep$(build_exeext) genattrtab$(build_exeext) \
620 genattr$(build_exeext) genopinit$(build_exeext) \
84a49858 621 $(BC_ALL) \
8bb62f3d 622 stamp-bcarity stamp-bcopcode stamp-bcopname \
2aa3e87b 623 bi-arity$(build_exeext) bi-opcode$(build_exeext) bi-opname$(build_exeext) \
d1871a55 624 xgcc$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES) \
625 $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
62268150 626 $(CCCP)$(exeext) cc1obj$(exeext) enquire$(exeext) \
627 protoize$(exeext) unprotoize$(exeext) \
c20b28d5 628 specs collect2$(exeext) $(USE_COLLECT2) underscore.c \
2b55270a 629 gcov$(exeext) *.bp \
389cd241 630 *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop \
631 *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack \
632 *.[si] \
73027c94 633 $(LANG_STAGESTUFF)
32e6d418 634
635# Members of libgcc1.a.
636LIB1FUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
799330a9 637 _lshrsi3 _ashrsi3 _ashlsi3 \
32e6d418 638 _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \
639 _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \
640 _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \
641 _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
642 _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
643
644# Library members defined in libgcc2.c.
645LIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
799330a9 646 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 \
4b8f50a8 647 _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
32e6d418 648 _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
619c3e71 649 _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
d055d75f 650 _fixtfdi _fixunstfdi _floatditf \
4b7a79e2 651 __gcc_bcmp _varargs __dummy _eprintf \
652 _bb _shtab _clear_cache _trampoline __main _exit \
dc44ba4b 653 _ctors _eh _pure
32e6d418 654
04ddb594 655FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
656 _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
657 _lt_sf _le_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
658 _sf_to_df
659
660DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
661 _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
662 _lt_df _le_df _si_to_df _df_to_si _negate_df _make_df \
663 _df_to_sf
664
32e6d418 665# The files that "belong" in CONFIG_H are deliberately omitted
666# because having them there would not be useful in actual practice.
667# All they would do is cause complete recompilation every time
668# one of the machine description files is edited.
669# That may or may not be what one wants to do.
670# If it is, rm *.o is an easy way to do it.
c20b28d5 671# CONFIG_H = $(host_xm_file) $(tm_file)
32e6d418 672CONFIG_H =
3ad7bb1c 673RTL_BASE_H = rtl.h rtl.def gansidecl.h machmode.h machmode.def
674RTL_H = $(RTL_BASE_H) genrtl.h
ad87de1e 675TREE_H = tree.h real.h tree.def gansidecl.h machmode.h machmode.def
649d8da6 676BYTECODE_H = bytecode.h bc-emit.h bc-optab.h
8f220b93 677BASIC_BLOCK_H = basic-block.h bitmap.h
ad87de1e 678DEMANGLE_H = demangle.h gansidecl.h
679RECOG_H = recog.h gansidecl.h
2e9d8ccf 680#\f
73027c94 681# Language makefile fragments.
682
683# The following targets define the interface between us and the languages.
684#
685# all.build, all.cross, start.encap, rest.encap,
686# info, dvi,
687# install-normal, install-common, install-info, install-man,
688# uninstall, distdir,
a8514488 689# mostlyclean, clean, distclean, extraclean, maintainer-clean,
73027c94 690# stage1, stage2, stage3, stage4
691#
692# Each language is linked in with a series of hooks (since we can't use `::'
693# targets). The name of each hooked is "lang.${target_name}" (eg: lang.info).
694# Configure computes and adds these here.
695
696####language hooks
87c0ad1b 697@language_hooks@
73027c94 698
699# sed inserts language fragments after the following line.
700####language fragments
87c0ad1b 701@language_fragments@
73027c94 702
703# End of language makefile fragments.
2e9d8ccf 704#\f
32e6d418 705# Avoid a lot of time thinking about remaking Makefile.in and *.def.
706.SUFFIXES: .in .def
707
d44645af 708Makefile: $(srcdir)/Makefile.in config.status $(srcdir)/version.c \
160b6fa9 709 $(xmake_file) $(tmake_file) $(LANG_MAKEFILES)
710 $(SHELL) $(srcdir)/configure.frag $(srcdir) "$(SUBDIRS)" \
711 "$(xmake_file)" "$(tmake_file)"
f403cbcb 712 cp config.status config.run
713 $(SHELL) config.run
5484bc67 714 rm -f config.run
32e6d418 715
82470d2e 716$(srcdir)/configure: $(srcdir)/configure.in
87c0ad1b 717 cd $(srcdir); autoconf
718
0d9d9ae4 719# cstamp-h.in controls rebuilding of config.in.
d44645af 720# It is named cstamp-h.in and not stamp-h.in so the mostlyclean rule doesn't
721# delete it. A stamp file is needed as autoheader won't update the file if
722# nothing has changed.
0d9d9ae4 723# It remains in the source directory and is part of the distribution.
724# This follows what is done in shellutils, fileutils, etc.
c3b8daa3 725# "echo timestamp" is used instead of touch to be consistent with other
726# packages that use autoconf (??? perhaps also to avoid problems with patch?).
0d9d9ae4 727# ??? Newer versions have a maintainer mode that may be useful here.
728$(srcdir)/config.in: $(srcdir)/cstamp-h.in
729$(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h
d211e301 730 cd $(srcdir) && autoheader
c3b8daa3 731 echo timestamp > $(srcdir)/cstamp-h.in
0dbd1c74 732auto-config.h: cstamp-h ; @true
0d9d9ae4 733cstamp-h: config.in config.status
0dbd1c74 734 CONFIG_HEADERS=auto-config.h:config.in $(SHELL) config.status
5539b206 735
d44645af 736# Really, really stupid make features, such as SUN's KEEP_STATE, may force
737# a target to build even if it is up-to-date. So we must verify that
738# config.status does not exist before failing.
9bec654d 739config.status: configure version.c
d44645af 740 @if [ ! -f config.status ] ; then \
741 echo You must configure gcc. Look at the INSTALL file for details.; \
742 false; \
743 else \
744 $(SHELL) config.status --recheck; \
745 fi
746
32e6d418 747all.internal: start.encap rest.encap
748# This is what to compile if making a cross-compiler.
73027c94 749# Note that we can compile enquire using the cross-compiler just built,
87540b0a 750# although we can't run it on this machine.
73027c94 751all.cross: native gcc-cross specs stmp-headers $(LIBGCC) $(STMP_FIXPROTO) \
3b9b6fde 752 $(LIBGCC1_TEST) $(EXTRA_PARTS) lang.all.cross
e77fd588 753# This is what to compile if making gcc with a cross-compiler.
73027c94 754all.build: native xgcc $(EXTRA_PARTS) lang.all.build
32e6d418 755# This is what must be made before installing GCC and converting libraries.
73027c94 756start.encap: native xgcc specs $(LIBGCC1) xlimits.h lang.start.encap
335ebf8f 757# These can't be made until after GCC can run.
73027c94 758rest.encap: stmp-headers $(LIBGCC) $(STMP_FIXPROTO) $(EXTRA_PARTS) lang.rest.encap
32e6d418 759# This is what is made with the host's compiler
760# whether making a cross compiler or not.
0dbd1c74 761native: config.status auto-config.h cpp $(LANGUAGES) \
3ded972d 762 $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
32e6d418 763
764# Define the names for selecting languages in LANGUAGES.
765C c: cc1
32e6d418 766PROTO: proto
767
ee4720a9 768# Tell GNU make these are phony targets.
8757933b 769.PHONY: C c PROTO proto
ee4720a9 770
840a6e8d 771# On the target machine, finish building a cross compiler.
772# This does the things that can't be done on the host machine.
2289acd7 773rest.cross: $(LIBGCC) gfloat.h specs
840a6e8d 774
3b9b6fde 775# Verify that it works to compile and link libgcc1-test.
d7330690 776# If it does, then there are sufficient replacements for libgcc1.a.
3b9b6fde 777libgcc1-test: libgcc1-test.o native $(GCC_PARTS)
55e40402 778 @echo "Testing libgcc1. Ignore linker warning messages."
3b9b6fde 779 $(GCC_FOR_TARGET) $(GCC_CFLAGS) libgcc1-test.o -o libgcc1-test \
b6f6ec68 780 -nostartfiles -nostdlib `$(GCC_FOR_TARGET) --print-libgcc-file-name`
3b9b6fde 781libgcc1-test.o: libgcc1-test.c native xgcc
782 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/libgcc1-test.c
d7330690 783
840a6e8d 784# Recompile all the language-independent object files.
785# This is used only if the user explicitly asks for it.
32e6d418 786compilations: ${OBJS}
787
03f51dea 788# Create a list of the language-independent object files so the language
789# subdirectories needn't mention their names explicitly.
6143c0f8 790stamp-objlist: $(OBJS) $(BC_OBJS)
247746d7 791 echo " $(OBJS) $(BC_OBJS)" | sed -e 's, \([a-z0-9]\), ../\1,g' -e 's/\.o/$(objext)/g' >stamp-objlist
03f51dea 792
77a164d8 793# We call this executable `xgcc' rather than `gcc'
794# to avoid confusion if the current directory is in the path
795# and CC is `gcc'. It is renamed to `gcc' when it is installed.
0dbd1c74 796xgcc: gcc.o version.o choose-temp.o pexecute.o prefix.o version.o \
797 $(LIBDEPS) $(EXTRA_GCC_OBJS)
798 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o prefix.o version.o \
c90a87d1 799 choose-temp.o pexecute.o $(EXTRA_GCC_OBJS) $(LIBS)
840a6e8d 800
801# Dump a specs file to make -B./ read these specs over installed ones.
17108b2b 802specs: xgcc
c92e16d4 803 $(GCC_FOR_TARGET) -dumpspecs > tmp-specs
804 mv tmp-specs specs
32e6d418 805
77a164d8 806# We do want to create an executable named `xgcc', so we can use it to
32e6d418 807# compile libgcc2.a.
808# Also create gcc-cross, so that install-common will install properly.
77a164d8 809gcc-cross: xgcc
62268150 810 cp xgcc$(exeext) gcc-cross$(exeext)
32e6d418 811
675fc1b6 812cc1: $(P) $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
62268150 813 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
32e6d418 814
2cfd79fe 815# Copy float.h from its source.
d82b9c93 816gfloat.h: $(FLOAT_H)
98d3f9df 817 -rm -f gfloat.h
d82b9c93 818 cp $(FLOAT_H) gfloat.h
2cfd79fe 819
820# Create float.h source for the native machine.
0dbd1c74 821# Make it empty if we can use the system float.h without changes.
2cfd79fe 822float.h-nat: enquire
121c5e86 823 -./enquire -f > tmp-float.h
ad87de1e 824 grep '#define [^_]' tmp-float.h >/dev/null || true > tmp-float.h
121c5e86 825 mv tmp-float.h float.h-nat
2cfd79fe 826
827# Create a dummy float.h source for a cross-compiler.
ae115421 828# ??? This isn't used anymore. Should we create config/float-unkn.h
829# and make that the default float_format in configure?
2cfd79fe 830float.h-cross:
329da2a1 831 echo "#ifndef __GCC_FLOAT_NOT_NEEDED" > t-float.h-cross
832 echo "#error float.h values not known for cross-compiler" >> t-float.h-cross
833 echo "#endif" >> t-float.h-cross
c92e16d4 834 mv t-float.h-cross float.h-cross
32e6d418 835
836# Used to compile enquire with standard cc, but have forgotten why.
837# Let's try with GCC.
838enquire: enquire.o $(GCC_PARTS)
62268150 839 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o $@
25407fa4 840enquire.o: $(srcdir)/enquire.c $(GCC_PASSES) stmp-int-hdrs
0dbd1c74 841 rm -f include/float.h
842 if $(FLOAT_H_TEST); then \
843 SYS_FLOAT_H_WRAP=1; \
844 else :; \
845 SYS_FLOAT_H_WRAP=0; \
846 fi; \
847 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) \
848 -DSYS_FLOAT_H_WRAP=$$SYS_FLOAT_H_WRAP \
849 -I. -c $(srcdir)/enquire.c
3f69fed5 850
851# Build the version of limits.h that we will install.
852xlimits.h: glimits.h limitx.h limity.h
0848b369 853 if $(LIMITS_H_TEST) ; then \
c92e16d4 854 cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \
3f69fed5 855 else \
c92e16d4 856 cat $(srcdir)/glimits.h > tmp-xlimits.h; \
3f69fed5 857 fi
c92e16d4 858 mv tmp-xlimits.h xlimits.h
2e9d8ccf 859#\f
32e6d418 860# Build libgcc.a.
861# This is done in two parts because some functions, in libgcc1.c,
77a164d8 862# must be compiled with something other than GCC,
863# while the rest, in libgcc2.c, must be compiled with xgcc.
864# That means we can't do libgcc2.c until after xgcc, cc1, etc.
32e6d418 865
866# Use this as value of LIBGCC1 to cause conversion to GNU library format.
867# LIBCONVERT should put its output in libgcc1.conv.
868libgcc1.conv: libgcc1.a
869 $(LIBCONVERT) libgcc1.a libgcc1.conv
870
871# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely.
872# Make an empty file instead.
66e9b81a 873libgcc1.null: $(GCC_PASSES)
32e6d418 874 echo "__foo () {}" > dummy.c
875 $(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c
62268150 876 $(OLDAR) $(OLDAR_FLAGS) libgcc1.null dummy$(objext)
877 rm -f dummy$(objext) dummy.c
32e6d418 878
fe918d35 879# This is $(LIBGCC1) for a cross-compiler.
880# We have no automatic way of building libgcc1.a,
881# so it's up to the installer to find a way to do that.
882# This rule deliberately does not depend on libgcc1.a
883# so that it will fail if the installer hasn't provided it.
884libgcc1.cross:
885 mv libgcc1.a libgcc1.cross || (echo You must find a way to make libgcc1.a; false)
886
32e6d418 887# Compile the library of arithmetic subroutines with the native compiler.
77a164d8 888# Don't compile it with GCC!
32e6d418 889# (That would cause most arithmetic functions to call themselves.)
5eef7030 890#
891# NOTE: If you modify these rules substantially, please be sure to
892# check at least config/i386/t-sco5 and possibly other makefile
893# fragments.
32e6d418 894libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
895 -rm -f tmplibgcc1.a
896# Actually build it in tmplibgcc1.a, then rename at end,
897# so that libgcc1.a itself remains nonexistent if compilation is aborted.
898# -e causes any failing command to make this rule fail.
899# -e doesn't work in certain shells, so we test $$? as well.
547e1b60 900# lynx has a broken ar, it always complains when the initial library is
901# empty, thus this command works only if we don't do -e
902# There is a trailing backslash (\) deleted from the following line.
903# set -e;
32e6d418 904 for name in $(LIB1FUNCS); \
905 do \
906 echo $${name}; \
62268150 907 rm -f $${name}$(objext); \
5eef7030 908 $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
32e6d418 909 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
62268150 910 mv libgcc1$(objext) $${name}$(objext); \
911 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
912 rm -f $${name}$(objext); \
32e6d418 913 done
914# Some shells crash when a loop has no items.
915# So make sure there is always at least one--`..'.
916# Then ignore it.
917# We don't use -e here because there are if statements
918# that should not make the command give up when the if condition is false.
919# Instead, we test for failure after each command where it matters.
4daa2154 920 for file in .. $(LIB1FUNCS_EXTRA); \
32e6d418 921 do \
922 if [ x$${file} != x.. ]; then \
24f83907 923 name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//'`; \
32e6d418 924 echo $${name}; \
925 if [ $${name}.asm = $${file} ]; then \
f32abccb 926 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
32e6d418 927 else true; fi; \
5eef7030 928 $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
32e6d418 929 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
62268150 930 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
32e6d418 931 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
62268150 932 rm -f $${name}.s $${name}$(objext); \
32e6d418 933 else true; \
934 fi; \
935 done
0f557c81 936 -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc1.a; else true; fi
32e6d418 937 mv tmplibgcc1.a libgcc1.a
938
cf80c04b 939# Build libgcc1.a from assembler source. LIB1ASMFUNCS is the list of
940# functions. LIB1ASMSRC is the name of the source file in the config
941# subdirectory.
942libgcc1-asm.a: libgcc2.ready config.status $(srcdir)/config/$(LIB1ASMSRC)
943 -rm -f tmplibgcc1.a libgcc1.S
944 cp $(srcdir)/config/$(LIB1ASMSRC) libgcc1.S
945# Actually build it in tmplibgcc1.a, then rename at end,
946# so that libgcc1-asm.a itself remains nonexistent if compilation is aborted.
947# -e causes any failing command to make this rule fail.
948# -e doesn't work in certain shells, so we test $$? as well.
949# lynx has a broken ar, it always complains when the initial library is
950# empty, thus this command works only if we don't do -e
951# There is a trailing backslash (\) deleted from the following line.
952# set -e;
953 for name in $(LIB1ASMFUNCS); \
954 do \
955 echo $${name}; \
956 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} libgcc1.S; \
957 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
62268150 958 mv libgcc1$(objext) $${name}$(objext); \
959 $(AR) $(AR_FLAGS) tmplibgcc1.a $${name}$(objext); \
960 rm -f $${name}$(objext); \
cf80c04b 961 done
962 -rm -f libgcc1.S
963 mv tmplibgcc1.a libgcc1-asm.a
964
a20b21eb 965# Generate assembly versions of the functions required for libgcc1.
966# You'll still need to massage the code by hand (possibly hacking
967# underscores and local labels) but this will get you started.
968libgcc1.S: libgcc1.c $(CONFIG_H) config.status
969 -rm -f libgcc1.S
970 touch libgcc1.S
971 for name in $(LIB1FUNCS); \
972 do \
973 echo $${name}; \
5eef7030 974 $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -S -DL$${name} $(srcdir)/libgcc1.c; \
a20b21eb 975 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
976 echo '#ifdef ' L$${name} >> libgcc1.S; \
977 cat libgcc1.s >> libgcc1.S; \
978 echo '#endif /*' L$${name} '*/' >> libgcc1.S; \
979 echo "" >> libgcc1.S; \
980 done
981
32e6d418 982# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
983# But recompiling cc1 should not force recompilation of libgcc2.a.
984# If you want to force recompilation, delete libgcc2.a.
732b8330 985libgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs
32e6d418 986 -if [ -f libgcc2.ready ] ; then \
987 true; \
988 else \
989 touch libgcc2.ready; \
990 fi
991
447a9eb9 992LIB2ADD = $(srcdir)/frame.c $(LIB2FUNCS_EXTRA) $(LANG_LIB2FUNCS)
04ddb594 993libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(FPBIT) $(DPBIT) $(LIB2ADD) \
ad87de1e 994 machmode.h longlong.h frame.h gansidecl.h gbl-ctors.h config.status
32e6d418 995# Actually build it in tmplibgcc2.a, then rename at end,
996# so that libgcc2.a itself remains nonexistent if compilation is aborted.
997 -rm -f tmplibgcc2.a
998# -e causes any failing command to make this rule fail.
999# -e doesn't work in certain shells, so we test $$? as well.
547e1b60 1000# lynx has a broken ar, it always complains when the initial library is
1001# empty, thus this command works only if we don't do -e
1002# There is a trailing backslash (\) deleted from the following line.
1003# set -e;
32e6d418 1004 for name in $(LIB2FUNCS); \
1005 do \
1006 echo $${name}; \
c6396a0b 1007 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
62268150 1008 $(srcdir)/libgcc2.c -o $${name}$(objext); \
32e6d418 1009 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
62268150 1010 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}$(objext); \
1011 rm -f $${name}$(objext); \
32e6d418 1012 done
04ddb594 1013 if [ x$(FPBIT) != x ]; then \
1014 for name in $(FPBIT_FUNCS); \
1015 do \
1016 echo $${name}; \
1017 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
1018 -DFINE_GRAINED_LIBRARIES $(FPBIT) -o $${name}$(objext); \
1019 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
1020 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}$(objext); \
1021 rm -f $${name}$(objext); \
1022 done; \
1023 else true; fi;
1024 if [ x$(DPBIT) != x ]; then \
1025 for name in $(DPBIT_FUNCS); \
1026 do \
1027 echo $${name}; \
1028 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
1029 -DFINE_GRAINED_LIBRARIES $(DPBIT) -o $${name}$(objext); \
1030 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
1031 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}$(objext); \
1032 rm -f $${name}$(objext); \
1033 done; \
1034 else true; fi;
32e6d418 1035# Some shells crash when a loop has no items.
1036# So make sure there is always at least one--`..'.
1037# Then ignore it.
1038# We don't use -e here because there are if statements
1039# that should not make the command give up when the if condition is false.
1040# Instead, we test for failure after each command where it matters.
447a9eb9 1041 for file in $(LIB2ADD); do \
1042 name=`echo $${file} | sed -e 's/[.][cSo]$$//' -e 's/[.]asm$$//' -e 's/[.]txt$$//'`; \
1043 oname=` echo $${name} | sed -e 's,.*/,,'`; \
1044 if [ $${name}.txt = $${file} ]; then \
1045 for f in .. `cat $${file}`; do if [ x$${f} != x.. ]; then \
1046 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
1047 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" \
1048 CFLAGS="$(CFLAGS)" HOST_PREFIX="$(HOST_PREFIX)" \
1049 HOST_PREFIX_1="$(HOST_PREFIX_1)" \
1050 LANGUAGES="$(LANGUAGES)" \
1051 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $${f}; \
6143c0f8 1052 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
447a9eb9 1053 $(AR) $(AR_FLAGS) tmplibgcc2.a $${f}; \
1054 rm -f $${f}; \
1055 else true; \
1056 fi; done; \
1057 else \
1058 echo $${name}; \
1059 if [ $${name}.asm = $${file} ]; then \
1060 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
1061 else true; fi; \
1062 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
1063 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
1064 $(AR) $(AR_FLAGS) tmplibgcc2.a $${oname}$(objext); \
1065 rm -f $${name}.s $${oname}$(objext); \
32e6d418 1066 fi; \
1067 done
1068 mv tmplibgcc2.a libgcc2.a
1069# These lines were deleted from above the mv command
1070# because ranlibing libgcc.a itself should suffice.
1071# -if [ x${HPUX_GAS} = x ] ; then \
13194ea9 1072# if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc2.a; else true; fi; \
32e6d418 1073# else true; fi
1074
1075# Combine the various libraries into a single library, libgcc.a.
1076libgcc.a: $(LIBGCC1) $(LIBGCC2)
1077 -rm -rf tmplibgcc.a libgcc.a tmpcopy
1078 mkdir tmpcopy
c6396a0b 1079 -if [ x$(LIBGCC1) != x ]; \
1080 then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
1081 else true; \
1082 fi
edf5976e 1083# Some versions of ar (specifically the one in RISC/os 5.x), create an
1084# unwritable table of contents file, and then print an error message when
1085# the second ar command tries to overwrite this file. To avoid the error
1086# message from ar, we make sure all files are writable.
75c6d942 1087 -(cd tmpcopy; chmod +w * > /dev/null 2>&1)
32e6d418 1088 (cd tmpcopy; $(AR) x ../$(LIBGCC2))
62268150 1089 (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *$(objext))
32e6d418 1090 rm -rf tmpcopy
1091 -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
1092# Actually build it in tmplibgcc.a, then rename at end,
1093# so that libgcc.a itself remains nonexistent if compilation is aborted.
1094 mv tmplibgcc.a libgcc.a
1095
f1ad3130 1096# Use the genmultilib shell script to generate the information the gcc
1097# driver program needs to select the library directory based on the
1098# switches.
3d97d965 1099multilib.h: stamp-mlib; @true
1100stamp-mlib: $(srcdir)/genmultilib Makefile
1101 $(SHELL) $(srcdir)/genmultilib \
1102 "$(MULTILIB_OPTIONS)" \
1103 "$(MULTILIB_DIRNAMES)" \
1104 "$(MULTILIB_MATCHES)" \
1105 "$(MULTILIB_EXCEPTIONS)" \
1106 "$(MULTILIB_EXTRA_OPTS)" > tmp-mlib.h
1107 $(srcdir)/move-if-change tmp-mlib.h multilib.h
1108 touch stamp-mlib
f1ad3130 1109
1110# Build multiple copies of libgcc.a, one for each target switch.
1111stmp-multilib: $(LIBGCC1) libgcc2.c libgcc2.ready $(CONFIG_H) \
ad87de1e 1112 frame.h gansidecl.h \
447a9eb9 1113 $(LIB2ADD) machmode.h longlong.h gbl-ctors.h config.status
f1ad3130 1114 for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
1115 dir=`echo $$i | sed -e 's/;.*$$//'`; \
1116 flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
f1ad3130 1117 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
3ab62051 1118 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
00075505 1119 RANLIB="$(RANLIB)" RANLIB_TEST="$(RANLIB_TEST)" \
93ed8bee 1120 LANGUAGES="$(LANGUAGES)" \
f1ad3130 1121 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
00075505 1122 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" \
cdc96909 1123 MULTILIB_CFLAGS="$${flags}" \
00075505 1124 LIBGCC1="$(LIBGCC1)" LIBGCC2="$(LIBGCC2)" \
1125 dir="$${dir}" stmp-multilib-sub; \
ee4720a9 1126 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
f1ad3130 1127 done
1128 touch stmp-multilib
1129
00075505 1130# Subroutine of stmp-multilib so make -n works.
1131stmp-multilib-sub:
cdc96909 1132 rm -f $(LIBGCC2)
1133 if [ -d $(dir) ]; then \
1134 cd $(dir); \
1135 rm -f libgcc.a $(EXTRA_MULTILIB_PARTS); \
a123fd67 1136 else true; \
cdc96909 1137 fi
00075505 1138 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
3ab62051 1139 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
00075505 1140 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
93ed8bee 1141 LANGUAGES="$(LANGUAGES)" \
00075505 1142 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC2)
1143 if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
1144 then true; \
1145 else rm -f $(LIBGCC1); \
1146 fi
1147 if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
1148 then true; \
1149 else \
1150 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
3ab62051 1151 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
00075505 1152 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
93ed8bee 1153 LANGUAGES="$(LANGUAGES)" \
00075505 1154 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC1); \
1155 fi
1156 rm -rf tmplibgcc.a tmpcopy
1157 mkdir tmpcopy
1158 if [ x$(LIBGCC1) != x ]; \
1159 then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
1160 else true; \
1161 fi
1162 (cd tmpcopy; $(AR) x ../$(LIBGCC2))
601520ec 1163 (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *$(objext))
00075505 1164 rm -rf libgcc2.a tmpcopy
1165 if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
1166 if [ -d $(dir) ]; then true; else mkdir $(dir); fi
1167 mv tmplibgcc.a $(dir)/libgcc.a
cdc96909 1168 for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
1169 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
1170 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
1171 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
0d0b968b 1172 LANGUAGES="$(LANGUAGES)" \
cdc96909 1173 MULTILIB_CFLAGS="$(MULTILIB_CFLAGS)" T="t" t$${f}; \
1174 mv t$${f} $(dir)/$${f}; \
a123fd67 1175 else true; \
cdc96909 1176 fi; done
00075505 1177
32e6d418 1178# Compile two additional files that are linked with every program
6bcd7097 1179# linked using GCC on systems using COFF or ELF, for the sake of C++
1180# constructors.
ad87de1e 1181$(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
1182 defaults.h frame.h gbl-ctors.h
6efd403b 1183 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
447a9eb9 1184 -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS) \
6efd403b 1185 -c $(srcdir)/crtstuff.c -DCRT_BEGIN -o $(T)crtbegin$(objext)
cdc96909 1186
ad87de1e 1187$(T)crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
1188 defaults.h frame.h gbl-ctors.h
6efd403b 1189 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
447a9eb9 1190 -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS) \
6efd403b 1191 -c $(srcdir)/crtstuff.c -DCRT_END -o $(T)crtend$(objext)
6bcd7097 1192
1193# On some systems we also want to install versions of these files
1194# compiled using PIC for use in shared libraries.
1195crtbeginS.o crtendS.o: stamp-crtS ; @true
1196
ad87de1e 1197stamp-crtS: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
1198 defaults.h frame.h gbl-ctors.h
5eef7030 1199 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \
6bcd7097 1200 -DCRT_BEGIN -finhibit-size-directive -fno-inline-functions \
5eef7030 1201 -g0 -c $(srcdir)/crtstuff.c
6bcd7097 1202 mv crtstuff$(objext) crtbeginS$(objext)
5eef7030 1203 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \
6bcd7097 1204 -DCRT_END -finhibit-size-directive -fno-inline-functions \
e5cfbd5b 1205 -g0 -c $(srcdir)/crtstuff.c -o crtendS$(objext)
6bcd7097 1206 touch stamp-crtS
4d3c962c 1207
1208# Compile the start modules crt0.o and mcrt0.o that are linked with every program
1209crt0.o: stamp-crt0 ; @true
1210mcrt0.o: stamp-crt0; @true
1211
1212stamp-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
1213 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
1214 -o crt0.o -c $(CRT0_S)
1215 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
1216 -o mcrt0.o -c $(MCRT0_S)
1217 touch stamp-crt0
2e9d8ccf 1218#\f
32e6d418 1219# Compiling object files from source files.
1220
1221# Note that dependencies on obstack.h are not written
1222# because that file is not part of GCC.
32e6d418 1223
1224# C language specific files.
1225
41b06fe4 1226c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
1227 $(srcdir)/c-parse.h c-tree.h input.h flags.h
32e6d418 1228 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
112e5dd0 1229$(srcdir)/c-parse.h: $(srcdir)/c-parse.c
1230$(srcdir)/c-parse.c: $(srcdir)/c-parse.y
ab2562cb 1231 cd $(srcdir); $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
0f557c81 1232$(srcdir)/c-parse.y: c-parse.in
04e167f4 1233 echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y
d7c691fa 1234 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
1235 -e "/^ifc$$/d" -e "/^end ifc$$/d" \
04e167f4 1236 $(srcdir)/c-parse.in >>tmp-c-parse.y
a58045a1 1237 $(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y
d7c691fa 1238
0f557c81 1239$(srcdir)/c-gperf.h: c-parse.gperf
6a4a0b58 1240 gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \
a58045a1 1241 $(srcdir)/c-parse.gperf >tmp-gperf.h
1242 $(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
6a4a0b58 1243
66a1f274 1244c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h output.h
1245c-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h output.h
32e6d418 1246c-lang.o : c-lang.c $(CONFIG_H) $(TREE_H)
3ad7bb1c 1247c-lex.o : c-lex.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-lex.h c-tree.h \
1248 $(srcdir)/c-parse.h input.h flags.h $(srcdir)/c-gperf.h c-pragma.h
32e6d418 1249c-aux-info.o : c-aux-info.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
1250c-convert.o : c-convert.c $(CONFIG_H) $(TREE_H) flags.h
2feda28e 1251c-pragma.o: c-pragma.c $(CONFIG_H) $(TREE_H) except.h function.h \
1252 defaults.h c-pragma.h
1294913b 1253c-iterate.o: c-iterate.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h flags.h
32e6d418 1254
79f818d0 1255# To make a configuration always use collect2, set USE_COLLECT2 to ld.
1256ld: collect2
f403cbcb 1257 rm -f ld$(exeext)
ea4a6c81 1258 $(LN) collect2$(exeext) ld$(exeext)
79f818d0 1259
94ca3aab 1260collect2: collect2.o tlink.o hash.o cplus-dem.o underscore.o version.o \
6c468b11 1261 choose-temp.o $(LIBDEPS)
e77fd588 1262# Don't try modifying collect2 (aka ld) in place--it might be linking this.
62268150 1263 -rm -f collect2$(exeext)
94ca3aab 1264 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ collect2.o tlink.o hash.o \
6c468b11 1265 cplus-dem.o underscore.o version.o choose-temp.o $(LIBS)
32e6d418 1266
ad87de1e 1267collect2.o : collect2.c $(CONFIG_H) gansidecl.h gstab.h obstack.h $(DEMANGLE_H)
5e03c63d 1268 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
67cb4bc1 1269 -DTARGET_MACHINE=\"$(target_alias)\" $(MAYBE_USE_COLLECT2) \
5e03c63d 1270 -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
32e6d418 1271
ad87de1e 1272tlink.o: tlink.c $(DEMANGLE_H) hash.h $(CONFIG_H)
94ca3aab 1273hash.o: hash.c hash.h
ad87de1e 1274cplus-dem.o: cplus-dem.c $(DEMANGLE_H)
d2f0b724 1275
7306ddcf 1276underscore.c: stamp-under ; @true
1277
1278stamp-under: $(GCC_PASSES)
c20b28d5 1279 echo "int xxy_us_dummy;" >tmp-dum.c
1280 $(GCC_FOR_TARGET) -S tmp-dum.c
1281 echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c
1282 if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \
1283 echo "int prepends_underscore = 1;" >>tmp-under.c; \
d2f0b724 1284 else \
c20b28d5 1285 echo "int prepends_underscore = 0;" >>tmp-under.c; \
d2f0b724 1286 fi
c20b28d5 1287 $(srcdir)/move-if-change tmp-under.c underscore.c
1288 -rm -f tmp-dum.c tmp-dum.s
7306ddcf 1289 touch stamp-under
d2f0b724 1290
32e6d418 1291# A file used by all variants of C.
1292
1293c-common.o : c-common.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
1294
1295# Language-independent files.
1296
4813bdd4 1297DRIVER_DEFINES = \
32e6d418 1298 -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
c6396a0b 1299 -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
7df9e578 1300 -DDEFAULT_TARGET_VERSION=\"$(version)\" \
67cb4bc1 1301 -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \
4813bdd4 1302 -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\"
ad87de1e 1303gcc.o: gcc.c $(CONFIG_H) gansidecl.h multilib.h Makefile $(lang_specs_files)
4813bdd4 1304 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1305 $(DRIVER_DEFINES) \
32e6d418 1306 -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
1307
1308dumpvers: dumpvers.c
1309
1310version.o: version.c
ad87de1e 1311obstack.o: obstack.c $(CONFIG_H)
1312choose-temp.o: choose-temp.c $(CONFIG_H) gansidecl.h
1313pexecute.o: pexecute.c $(CONFIG_H) gansidecl.h
1314prefix.o: prefix.c $(CONFIG_H) gansidecl.h Makefile
0dbd1c74 1315 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1316 -DPREFIX=\"$(prefix)\" \
1317 -c `echo $(srcdir)/prefix.c | sed 's,^\./,,'`
32e6d418 1318
beb68ac1 1319convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h
1320
335ebf8f 1321tree.o : tree.c $(CONFIG_H) $(TREE_H) flags.h function.h
32e6d418 1322print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
a6a1ab64 1323stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) flags.h function.h
32e6d418 1324fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h
636fef92 1325toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) bytecode.h bc-emit.h \
1326 flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \
1327 $(lang_options_files)
b600804e 1328 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
67cb4bc1 1329 -DTARGET_NAME=\"$(target_alias)\" \
fe918d35 1330 -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
32e6d418 1331
1332rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
1333
1334print-rtl.o : print-rtl.c $(CONFIG_H) $(RTL_H)
1335rtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
1336
35325097 1337varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h function.h \
66a1f274 1338 defaults.h insn-codes.h expr.h hard-reg-set.h regs.h xcoffout.h \
917aa082 1339 output.h bytecode.h c-pragma.h
32e6d418 1340function.o : function.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
1341 insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
ad87de1e 1342 $(RECOG_H) output.h bytecode.h bc-emit.h
32e6d418 1343stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
037a5228 1344 insn-flags.h insn-config.h insn-codes.h hard-reg-set.h expr.h except.h \
ad87de1e 1345 loop.h $(RECOG_H) bytecode.h bc-typecd.h bc-typecd.def bc-opcode.h \
037a5228 1346 bc-optab.h bc-emit.h
1347except.o : except.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
1348 insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
ad87de1e 1349 $(RECOG_H) output.h except.h
93ad9ce9 1350expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h regs.h \
ad87de1e 1351 insn-flags.h insn-codes.h expr.h insn-config.h $(RECOG_H) output.h \
e83ee760 1352 typeclass.h bytecode.h bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h \
9af573e1 1353 bc-emit.h modemap.def hard-reg-set.h
32e6d418 1354calls.o : calls.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-codes.h \
0dbd1c74 1355 insn-flags.h regs.h
32e6d418 1356expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
ad87de1e 1357 insn-flags.h insn-config.h insn-codes.h expr.h $(RECOG_H) real.h
32e6d418 1358explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h hard-reg-set.h \
ad87de1e 1359 insn-config.h expr.h $(RECOG_H) insn-flags.h insn-codes.h
32e6d418 1360optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
ad87de1e 1361 insn-flags.h insn-config.h insn-codes.h expr.h $(RECOG_H) reload.h
32e6d418 1362dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h regs.h \
e7748130 1363 insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h
f95d8264 1364sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h except.h \
1365 function.h expr.h output.h hard-reg-set.h regs.h defaults.h real.h \
1a4c478d 1366 insn-config.h bytecode.h obstack.h xcoffout.h c-pragma.h
32e6d418 1367dwarfout.o : dwarfout.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf.h flags.h \
8a19d0d5 1368 insn-config.h reload.h output.h defaults.h
632478b5 1369dwarf2out.o : dwarf2out.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf2.h flags.h \
2abfb408 1370 insn-config.h reload.h output.h defaults.h hard-reg-set.h regs.h expr.h
79f818d0 1371xcoffout.o : xcoffout.c $(CONFIG_H) $(TREE_H) $(RTL_H) xcoffout.h flags.h
0dbd1c74 1372emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h except.h \
ad87de1e 1373 function.h regs.h insn-config.h $(RECOG_H) real.h expr.h obstack.h \
0dbd1c74 1374 bytecode.h bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h bc-emit.h \
1375 bc-opname.h
6d9f2c4c 1376real.o : real.c $(CONFIG_H) $(TREE_H)
c6396a0b 1377getpwd.o : getpwd.c $(CONFIG_H)
32e6d418 1378
1379integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h integrate.h \
beed1a9f 1380 insn-flags.h insn-config.h insn-codes.h expr.h real.h regs.h function.h \
ad87de1e 1381 bytecode.h output.h $(RECOG_H) except.h
32e6d418 1382
1383jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
ad87de1e 1384 insn-config.h insn-flags.h $(RECOG_H) expr.h real.h except.h
32e6d418 1385stupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h
1386
1387cse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h real.h \
ad87de1e 1388 insn-config.h $(RECOG_H) expr.h
2b55270a 1389profile.o : profile.c $(CONFIG_H) $(RTL_H) flags.h insn-flags.h gcov-io.h \
ad87de1e 1390 $(TREE_H) output.h regs.h
32e6d418 1391loop.o : loop.c $(CONFIG_H) $(RTL_H) flags.h loop.h insn-config.h \
ad87de1e 1392 insn-flags.h insn-codes.h regs.h hard-reg-set.h $(RECOG_H) expr.h real.h
0dbd1c74 1393unroll.o : unroll.c $(CONFIG_H) $(RTL_H) insn-config.h integrate.h regs.h \
ad87de1e 1394 $(RECOG_H) flags.h expr.h loop.h
32e6d418 1395flow.o : flow.c $(CONFIG_H) $(RTL_H) flags.h insn-config.h \
8f220b93 1396 $(BASIC_BLOCK_H) regs.h hard-reg-set.h output.h
335ebf8f 1397combine.o : combine.c $(CONFIG_H) $(RTL_H) flags.h \
32e6d418 1398 insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \
ad87de1e 1399 $(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h
32e6d418 1400regclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
ad87de1e 1401 $(BASIC_BLOCK_H) regs.h insn-config.h $(RECOG_H) reload.h real.h bytecode.h
8f220b93 1402local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h $(BASIC_BLOCK_H) \
ad87de1e 1403 regs.h hard-reg-set.h insn-config.h $(RECOG_H) output.h
8f220b93 1404bitmap.o : bitmap.c $(CONFIG_H) $(RTL_H) flags.h $(BASIC_BLOCK_H) regs.h
8a4b1e01 1405global.o : global.c $(CONFIG_H) $(RTL_H) flags.h \
8f220b93 1406 $(BASIC_BLOCK_H) regs.h hard-reg-set.h insn-config.h output.h
32e6d418 1407
64016d24 1408reload.o : reload.c $(CONFIG_H) $(RTL_H) flags.h output.h expr.h\
ad87de1e 1409 reload.h $(RECOG_H) hard-reg-set.h insn-config.h insn-codes.h regs.h real.h
067fa30b 1410reload1.o : reload1.c $(CONFIG_H) $(RTL_H) real.h flags.h expr.h \
32e6d418 1411 reload.h regs.h hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
ad87de1e 1412 $(BASIC_BLOCK_H) $(RECOG_H) output.h
32e6d418 1413caller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \
ad87de1e 1414 regs.h hard-reg-set.h insn-codes.h insn-config.h $(BASIC_BLOCK_H) $(RECOG_H) \
f8de8de7 1415 reload.h expr.h
32e6d418 1416reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
ad87de1e 1417 $(BASIC_BLOCK_H) regs.h insn-config.h insn-attr.h insn-flags.h $(RECOG_H) \
32e6d418 1418 flags.h output.h
ea0cb7ae 1419alias.o : alias.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
1420 insn-codes.h
3eb9a99d 1421regmove.o : regmove.c $(CONFIG_H) $(RTL_H) insn-config.h recog.h output.h \
1422 reload.h regs.h hard-reg-set.h flags.h expr.h insn-flags.h
1423$(SCHED_PREFIX)sched.o : $(SCHED_PREFIX)sched.c $(CONFIG_H) $(RTL_H) $(BASIC_BLOCK_H) regs.h hard-reg-set.h \
32e6d418 1424 flags.h insn-config.h insn-attr.h
335ebf8f 1425final.o : final.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h regs.h \
ad87de1e 1426 $(RECOG_H) conditions.h insn-config.h insn-attr.h except.h real.h output.h \
fe918d35 1427 hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
32e6d418 1428recog.o : recog.c $(CONFIG_H) $(RTL_H) \
ad87de1e 1429 regs.h $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \
32e6d418 1430 insn-flags.h insn-codes.h real.h
1431reg-stack.o : reg-stack.c $(CONFIG_H) $(RTL_H) $(TREE_H) \
d9bf0cf4 1432 regs.h hard-reg-set.h flags.h insn-config.h insn-flags.h
48c6936b 1433
5e7432f7 1434$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \
32e6d418 1435 $(RTL_H) regs.h hard-reg-set.h real.h insn-config.h conditions.h \
1436 insn-flags.h output.h insn-attr.h insn-codes.h
b600804e 1437 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file)
32e6d418 1438
f213fcf9 1439# Build auxiliary files that support ecoff format.
1440mips-tfile: mips-tfile.o version.o $(LIBDEPS)
62268150 1441 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS)
f213fcf9 1442
1443mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H)
1444
1445mips-tdump: mips-tdump.o version.o $(LIBDEPS)
62268150 1446 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tdump.o version.o $(LIBS)
f213fcf9 1447
1448mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H)
1449
636b182c 1450# Build file to support OSF/rose half-pic format.
1451halfpic.o: halfpic.c $(CONFIG_H) $(RTL_H) $(TREE_H)
1452
32e6d418 1453# Normally this target is not used; but it is used if you
1454# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
1455# from the GNU Emacs distribution.
32e6d418 1456alloca.o: alloca.c
32e6d418 1457 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
cc2af6ca 1458 -c `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
32e6d418 1459 $(ALLOCA_FINISH)
2e9d8ccf 1460#\f
32e6d418 1461# Generate header and source files from the machine description,
1462# and compile them.
1463
1464.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
1465 insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
1466 insn-attr.h insn-attrtab.c
1467
1468# The following pair of rules has this effect:
1469# genconfig is run only if the md has changed since genconfig was last run;
1470# but the file insn-config.h is touched only when its contents actually change.
1471
1472# Each of the other insn-* files is handled by a similar pair of rules.
1473
3f69fed5 1474# This causes an anomaly in the results of make -n
1475# because insn-* is older than stamp-*
1476# and thus make -n thinks that insn-* will be updated
1477# and force recompilation of things that depend on it.
9ac790c5 1478# We use move-if-change precisely to avoid such recompilation.
3f69fed5 1479# But there is no way to teach make -n that it will be avoided.
1480
32e6d418 1481# Each of the insn-*.[ch] rules has a semicolon at the end,
1482# for otherwise the system Make on SunOS 4.1 never tries
876dc5b0 1483# to recompile insn-*.o. To avoid problems and extra noise from
1484# versions of make which don't like empty commands (nothing after the
1485# trailing `;'), we call true for each.
32e6d418 1486
c2a18965 1487insn-config.h: stamp-config ; @true
c20b28d5 1488stamp-config : $(md_file) genconfig $(srcdir)/move-if-change
1489 ./genconfig $(md_file) > tmp-config.h
32e6d418 1490 $(srcdir)/move-if-change tmp-config.h insn-config.h
1491 touch stamp-config
1492
c2a18965 1493insn-flags.h: stamp-flags ; @true
c20b28d5 1494stamp-flags : $(md_file) genflags $(srcdir)/move-if-change
1495 ./genflags $(md_file) > tmp-flags.h
32e6d418 1496 $(srcdir)/move-if-change tmp-flags.h insn-flags.h
1497 touch stamp-flags
1498
c2a18965 1499insn-codes.h: stamp-codes ; @true
c20b28d5 1500stamp-codes : $(md_file) gencodes $(srcdir)/move-if-change
1501 ./gencodes $(md_file) > tmp-codes.h
32e6d418 1502 $(srcdir)/move-if-change tmp-codes.h insn-codes.h
1503 touch stamp-codes
1504
1505insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h real.h output.h \
1506 insn-config.h insn-flags.h insn-codes.h
1507 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
1508
c2a18965 1509insn-emit.c: stamp-emit ; @true
c20b28d5 1510stamp-emit : $(md_file) genemit $(srcdir)/move-if-change
1511 ./genemit $(md_file) > tmp-emit.c
32e6d418 1512 $(srcdir)/move-if-change tmp-emit.c insn-emit.c
1513 touch stamp-emit
1514
ad87de1e 1515insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(RECOG_H) \
32e6d418 1516 real.h output.h flags.h
1517 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
1518
c2a18965 1519insn-recog.c: stamp-recog ; @true
c20b28d5 1520stamp-recog : $(md_file) genrecog $(srcdir)/move-if-change
1521 ./genrecog $(md_file) > tmp-recog.c
32e6d418 1522 $(srcdir)/move-if-change tmp-recog.c insn-recog.c
1523 touch stamp-recog
1524
bdb66cef 1525insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
ad87de1e 1526 insn-config.h flags.h $(RECOG_H) expr.h reload.h
bdb66cef 1527 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
1528
1529insn-opinit.c: stamp-opinit ; @true
c20b28d5 1530stamp-opinit : $(md_file) genopinit $(srcdir)/move-if-change
1531 ./genopinit $(md_file) > tmp-opinit.c
bdb66cef 1532 $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
1533 touch stamp-opinit
1534
32e6d418 1535insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H)
1536 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
1537
c2a18965 1538insn-extract.c: stamp-extract ; @true
c20b28d5 1539stamp-extract : $(md_file) genextract $(srcdir)/move-if-change
1540 ./genextract $(md_file) > tmp-extract.c
32e6d418 1541 $(srcdir)/move-if-change tmp-extract.c insn-extract.c
1542 touch stamp-extract
1543
1544insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h output.h real.h
1545 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
1546
c2a18965 1547insn-peep.c: stamp-peep ; @true
c20b28d5 1548stamp-peep : $(md_file) genpeep $(srcdir)/move-if-change
1549 ./genpeep $(md_file) > tmp-peep.c
32e6d418 1550 $(srcdir)/move-if-change tmp-peep.c insn-peep.c
1551 touch stamp-peep
1552
1553insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) regs.h real.h output.h \
1554 insn-attr.h insn-config.h
1555 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
1556
c2a18965 1557insn-attr.h: stamp-attr ; @true
c20b28d5 1558stamp-attr : $(md_file) genattr $(srcdir)/move-if-change
1559 ./genattr $(md_file) > tmp-attr.h
32e6d418 1560 $(srcdir)/move-if-change tmp-attr.h insn-attr.h
1561 touch stamp-attr
1562
c2a18965 1563insn-attrtab.c: stamp-attrtab ; @true
c20b28d5 1564stamp-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change
1565 if cmp -s $(PREMADE_ATTRTAB_MD) $(md_file); \
8bd8ea06 1566 then \
1567 echo Using $(PREMADE_ATTRTAB); \
ab866dde 1568 cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \
8bd8ea06 1569 else \
c20b28d5 1570 ./genattrtab $(md_file) > tmp-attrtab.c; \
8bd8ea06 1571 fi
32e6d418 1572 $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
1573 touch stamp-attrtab
1574
1575insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
ad87de1e 1576 hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h $(RECOG_H) \
32e6d418 1577 insn-codes.h
1578 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
1579
c2a18965 1580insn-output.c: stamp-output ; @true
c20b28d5 1581stamp-output : $(md_file) genoutput $(srcdir)/move-if-change
1582 ./genoutput $(md_file) > tmp-output.c
32e6d418 1583 $(srcdir)/move-if-change tmp-output.c insn-output.c
1584 touch stamp-output
3ad7bb1c 1585
1586genrtl.o : genrtl.c $(CONFIG_H) $(RTL_H)
1587genrtl.c genrtl.h : stamp-genrtl
1588stamp-genrtl: gengenrtl $(srcdir)/move-if-change $(RTL_BASE_H)
1589 ./gengenrtl tmp-genrtl.h tmp-genrtl.c
1590 $(srcdir)/move-if-change tmp-genrtl.h genrtl.h
1591 $(srcdir)/move-if-change tmp-genrtl.c genrtl.c
1592 touch stamp-genrtl
1593
2e9d8ccf 1594#\f
32e6d418 1595# Compile the programs that generate insn-* from the machine description.
1596# They are compiled with $(HOST_CC), and associated libraries,
1597# since they need to run on this machine
1598# even if GCC is being compiled to run on some other machine.
1599
1600# $(CONFIG_H) is omitted from the deps of the gen*.o
1601# because these programs don't really depend on anything
1602# about the target machine. They do depend on config.h itself,
1603# since that describes the host machine.
1604
89e36a04 1605# Pass the md file through cpp if the target requests it.
2c352995 1606$(MD_FILE): $(MD_DEPS)
1607 rm -f $@
c20b28d5 1608 $(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@
c92e16d4 1609 mv tmp-$@ $@
89e36a04 1610
32e6d418 1611genconfig : genconfig.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1612 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1613 genconfig.o $(HOST_RTL) $(HOST_LIBS)
1614
c20b28d5 1615genconfig.o : genconfig.c $(RTL_H) $(build_xm_file)
32e6d418 1616 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
1617
1618genflags : genflags.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1619 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1620 genflags.o $(HOST_RTL) $(HOST_LIBS)
1621
c20b28d5 1622genflags.o : genflags.c $(RTL_H) $(build_xm_file)
32e6d418 1623 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
1624
1625gencodes : gencodes.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1626 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1627 gencodes.o $(HOST_RTL) $(HOST_LIBS)
1628
c20b28d5 1629gencodes.o : gencodes.c $(RTL_H) $(build_xm_file)
32e6d418 1630 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
1631
1632genemit : genemit.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1633 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1634 genemit.o $(HOST_RTL) $(HOST_LIBS)
1635
c20b28d5 1636genemit.o : genemit.c $(RTL_H) $(build_xm_file)
32e6d418 1637 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
1638
bdb66cef 1639genopinit : genopinit.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1640 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
bdb66cef 1641 genopinit.o $(HOST_RTL) $(HOST_LIBS)
1642
c20b28d5 1643genopinit.o : genopinit.c $(RTL_H) $(build_xm_file)
bdb66cef 1644 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
1645
32e6d418 1646genrecog : genrecog.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1647 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1648 genrecog.o $(HOST_RTL) $(HOST_LIBS)
1649
c20b28d5 1650genrecog.o : genrecog.c $(RTL_H) $(build_xm_file)
32e6d418 1651 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
1652
1653genextract : genextract.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1654 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1655 genextract.o $(HOST_RTL) $(HOST_LIBS)
1656
c20b28d5 1657genextract.o : genextract.c $(RTL_H) $(build_xm_file) insn-config.h
32e6d418 1658 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
1659
1660genpeep : genpeep.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1661 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1662 genpeep.o $(HOST_RTL) $(HOST_LIBS)
1663
c20b28d5 1664genpeep.o : genpeep.c $(RTL_H) $(build_xm_file)
32e6d418 1665 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
1666
1667genattr : genattr.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1668 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1669 genattr.o $(HOST_RTL) $(HOST_LIBS)
1670
c20b28d5 1671genattr.o : genattr.c $(RTL_H) $(build_xm_file)
32e6d418 1672 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
1673
262d46de 1674genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
62268150 1675 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
262d46de 1676 genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
32e6d418 1677
c20b28d5 1678genattrtab.o : genattrtab.c $(RTL_H) $(build_xm_file) insn-config.h
32e6d418 1679 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
1680
1681genoutput : genoutput.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1682 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1683 genoutput.o $(HOST_RTL) $(HOST_LIBS)
1684
c20b28d5 1685genoutput.o : genoutput.c $(RTL_H) $(build_xm_file)
32e6d418 1686 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
3ad7bb1c 1687
1688gengenrtl : gengenrtl.o $(HOST_LIBDEPS)
1689 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
1690 gengenrtl.o $(HOST_LIBS)
1691
1692gengenrtl.o : gengenrtl.c $(RTL_BASE_H)
1693 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gengenrtl.c
1694
2e9d8ccf 1695#\f
32e6d418 1696# Compile the libraries to be used by gen*.
1697# If we are not cross-building, gen* use the same .o's that cc1 will use,
1698# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
1699# with the rules for rtl.o, alloca.o, etc.
1700$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) $(RTL_H)
1701 rm -f $(HOST_PREFIX)rtl.c
e77fd588 1702 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
32e6d418 1703 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
1704
262d46de 1705$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H)
1706 rm -f $(HOST_PREFIX)print-rtl.c
e77fd588 1707 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
262d46de 1708 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
1709
32e6d418 1710$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
1711 rm -f $(HOST_PREFIX)rtlanal.c
e77fd588 1712 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
32e6d418 1713 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
1714
1715$(HOST_PREFIX_1)alloca.o: alloca.c
1716 rm -f $(HOST_PREFIX)alloca.c
1717 cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
1718 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
1719
1720$(HOST_PREFIX_1)obstack.o: obstack.c
1721 rm -f $(HOST_PREFIX)obstack.c
e77fd588 1722 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/obstack.c > $(HOST_PREFIX)obstack.c
32e6d418 1723 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
1724
1725$(HOST_PREFIX_1)malloc.o: malloc.c
1726 rm -f $(HOST_PREFIX)malloc.c
e77fd588 1727 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
32e6d418 1728 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
1729
1730# This satisfies the dependency that we get if you cross-compile a compiler
1731# that does not need to compile alloca, malloc or whatever.
1732$(HOST_PREFIX_1):
1733 touch $(HOST_PREFIX_1)
2e9d8ccf 1734#\f
649d8da6 1735# Remake bytecode files.
649d8da6 1736BI_OBJ=bi-parser.o bi-lexer.o bi-reverse.o
1737
7e20ea39 1738bc-emit.o : bc-emit.c $(CONFIG_H) $(RTL_H) real.h $(BYTECODE_H) \
62268150 1739 bc-arity.h bc-opcode.h bc-typecd.h bc-typecd.def bi-run.h bytetypes.h
7e20ea39 1740bc-optab.o : bc-optab.c $(CONFIG_H) $(REAL_H) $(BYTECODE_H) \
62268150 1741 bc-opcode.h bc-typecd.h bc-typecd.def
649d8da6 1742
7e20ea39 1743bi-arity: bi-arity.o $(BI_OBJ) $(HOST_LIBDEPS)
62268150 1744 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
c3eff1f2 1745 bi-arity.o $(BI_OBJ) $(HOST_LIBS)
7e20ea39 1746bi-opcode: bi-opcode.o $(BI_OBJ) $(HOST_LIBDEPS)
62268150 1747 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
c3eff1f2 1748 bi-opcode.o $(BI_OBJ) $(HOST_LIBS)
7e20ea39 1749bi-opname: bi-opname.o $(BI_OBJ) $(HOST_LIBDEPS)
62268150 1750 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
c3eff1f2 1751 bi-opname.o $(BI_OBJ) $(HOST_LIBS)
7e20ea39 1752
112e5dd0 1753$(srcdir)/bi-parser.h: $(srcdir)/bi-parser.c
1754$(srcdir)/bi-parser.c: $(srcdir)/bi-parser.y
7e20ea39 1755 cd $(srcdir); $(BISON) $(BISONFLAGS) -d bi-parser.y -o bi-parser.c
62268150 1756
0f557c81 1757bi-parser.o: $(srcdir)/bi-parser.c bi-defs.h $(build_xm_file)
7e20ea39 1758 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1759 $(srcdir)/bi-parser.c
0f557c81 1760bi-lexer.o: bi-lexer.c $(srcdir)/bi-parser.h $(build_xm_file)
7e20ea39 1761 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1762 $(srcdir)/bi-lexer.c
62268150 1763bi-arity.o: bi-arity.c bi-defs.h $(build_xm_file)
7e20ea39 1764 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1765 $(srcdir)/bi-arity.c
62268150 1766bi-opcode.o: bi-opcode.c bi-defs.h $(build_xm_file)
7e20ea39 1767 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1768 $(srcdir)/bi-opcode.c
62268150 1769bi-opname.o: bi-opname.c bi-defs.h $(build_xm_file)
7e20ea39 1770 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1771 $(srcdir)/bi-opname.c
62268150 1772bi-reverse.o: bi-reverse.c bi-defs.h
7e20ea39 1773 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1774 $(srcdir)/bi-reverse.c
832bfff4 1775
e6baec2f 1776bc-arity.h: stamp-bcarity ; @true
1777stamp-bcarity : $(srcdir)/bytecode.def bi-arity $(srcdir)/move-if-change
e78095bc 1778 ./bi-arity < $(srcdir)/bytecode.def >tmp-bc-arity.h
1779 $(srcdir)/move-if-change tmp-bc-arity.h bc-arity.h
675fc1b6 1780 touch stamp-bcarity
649d8da6 1781
e6baec2f 1782bc-opcode.h: stamp-bcopcode ; @true
1783stamp-bcopcode : $(srcdir)/bytecode.def bi-opcode $(srcdir)/move-if-change
f698a3d1 1784 ./bi-opcode < $(srcdir)/bytecode.def >tmp-bcopcd.h
1785 $(srcdir)/move-if-change tmp-bcopcd.h bc-opcode.h
675fc1b6 1786 touch stamp-bcopcode
649d8da6 1787
e6baec2f 1788bc-opname.h: stamp-bcopname ; @true
1789stamp-bcopname : $(srcdir)/bytecode.def bi-opname $(srcdir)/move-if-change
f698a3d1 1790 ./bi-opname < $(srcdir)/bytecode.def >tmp-bcopnm.h
1791 $(srcdir)/move-if-change tmp-bcopnm.h bc-opname.h
675fc1b6 1792 touch stamp-bcopname
649d8da6 1793
1794bytecode.mostlyclean:
1795 -rm -f bc-arity.h bc-opcode.h bc-opname.h
1796
1797bytecode.distclean bytecode.clean: bytecode.mostlyclean
7e20ea39 1798 -rm -f bi-arity bi-opcode bi-opname bi-lexer
649d8da6 1799
a8514488 1800bytecode.maintainer-clean: bytecode.clean
91cbf3f1 1801 -rm -f bi-parser.c bi-parser.h
649d8da6 1802
2e9d8ccf 1803#\f
32e6d418 1804# Remake cpp and protoize.
1805
1806# Making the preprocessor
3e4227af 1807cpp: $(CCCP)
f403cbcb 1808 -rm -f cpp$(exeext)
ea4a6c81 1809 $(LN) $(CCCP)$(exeext) cpp$(exeext)
0dbd1c74 1810cccp: cccp.o cexp.o version.o prefix.o $(LIBDEPS)
1811 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cccp.o cexp.o prefix.o \
62268150 1812 version.o $(LIBS)
0f557c81 1813cexp.o: $(srcdir)/cexp.c $(CONFIG_H)
32e6d418 1814 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
1815$(srcdir)/cexp.c: $(srcdir)/cexp.y
1816 cd $(srcdir); $(BISON) -o cexp.c cexp.y
62268150 1817
d6b50af2 1818cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status
32e6d418 1819# The reason we use $(libdir)/g++-include rather than using libsubdir
1820# is for compatibility with the current version of libg++.
1821 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
c6396a0b 1822 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1823 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
ac2f5cba 1824 -DOLD_GPLUSPLUS_INCLUDE_DIR=\"$(old_gxx_include_dir)\" \
9a4f2cdd 1825 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
c6396a0b 1826 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1827 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
32e6d418 1828 -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
1829
3e4227af 1830cppmain: cppmain.o cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o \
0dbd1c74 1831 prefix.o version.o $(LIBDEPS)
62268150 1832 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cppmain.o cpplib.o cpphash.o \
0dbd1c74 1833 cppalloc.o cpperror.o cppexp.o prefix.o version.o $(LIBS)
3e4227af 1834
f03d7bcd 1835cppmain.o: cppmain.c $(CONFIG_H) cpplib.h
1836
7d1e7284 1837cpplib.o: cpplib.c $(CONFIG_H) cpplib.h cpphash.h config.status
3e4227af 1838 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1839 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
1840 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
ac2f5cba 1841 -DOLD_GPLUSPLUS_INCLUDE_DIR=\"$(old_gxx_include_dir)\" \
3e4227af 1842 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
1843 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
1844 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
1845 -c `echo $(srcdir)/cpplib.c | sed 's,^\./,,'`
1846
7d1e7284 1847cpperror.o: cpperror.c $(CONFIG_H) cpplib.h
1848
1849cppexp.o: cppexp.c $(CONFIG_H) cpplib.h
1850
1851cpphash.o: cpphash.c cpplib.h cpphash.h
1852
885be33e 1853cppalloc.o: cppalloc.c $(CONFIG_H)
1854
876dc5b0 1855# Note for the stamp targets, we run the program `true' instead of
1856# having an empty command (nothing following the semicolon).
1857
732b8330 1858proto: config.status protoize unprotoize SYSCALLS.c.X
32e6d418 1859
c90a87d1 1860protoize: protoize.o getopt.o getopt1.o getpwd.o version.o \
1861 pexecute.o choose-temp.o $(LIBDEPS)
62268150 1862 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
c90a87d1 1863 protoize.o getopt.o getopt1.o getpwd.o version.o \
1864 pexecute.o choose-temp.o $(LIBS)
c2a18965 1865protoize.o: stamp-proto ; @true
ab866dde 1866
c90a87d1 1867unprotoize: unprotoize.o getopt.o getopt1.o getpwd.o version.o \
1868 pexecute.o choose-temp.o $(LIBDEPS)
62268150 1869 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
c90a87d1 1870 unprotoize.o getopt.o getopt1.o getpwd.o version.o \
1871 pexecute.o choose-temp.o $(LIBS)
c2a18965 1872unprotoize.o: stamp-proto ; @true
ab866dde 1873
62268150 1874stamp-proto: protoize.c getopt.h $(CONFIG_H)
32e6d418 1875 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1876 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1877 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
32e6d418 1878 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1879 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
9a4f2cdd 1880 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
32e6d418 1881 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
ab866dde 1882 -DUNPROTOIZE $(srcdir)/protoize.c
62268150 1883 mv protoize$(objext) unprotoize$(objext)
32e6d418 1884 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1885 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1886 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
32e6d418 1887 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1888 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
9a4f2cdd 1889 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
32e6d418 1890 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
ab866dde 1891 $(srcdir)/protoize.c
77a164d8 1892 touch stamp-proto
32e6d418 1893
62268150 1894getopt.o: getopt.c getopt.h
32e6d418 1895 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt.c
62268150 1896getopt1.o: getopt1.c getopt.h
32e6d418 1897 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt1.c
1898
32e6d418 1899# This info describes the target machine, so compile with GCC just built.
62268150 1900SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \
1901 stmp-int-hdrs
f678532a 1902 -rm -f SYSCALLS.c tmp-SYSCALLS.s
79f818d0 1903 cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
32e6d418 1904 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
f678532a 1905 -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
1906 -rm -f SYSCALLS.c tmp-SYSCALLS.s
0b20f012 1907
a5889b74 1908
0b20f012 1909test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
c548e550 1910 -rm -f tmp-proto.[cso]
262d46de 1911 cp $(srcdir)/protoize.c tmp-proto.c
1912 chmod u+w tmp-proto.c
c548e550 1913 ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1914 $(CFLAGS) $(INCLUDES) \
0b20f012 1915 -DGCC_INCLUDE_DIR=0 \
1916 -DGPLUSPLUS_INCLUDE_DIR=0 \
1917 -DCROSS_INCLUDE_DIR=0 \
46073b39 1918 -DTOOL_INCLUDE_DIR=0 \
262d46de 1919 -DSTD_PROTO_DIR=0" tmp-proto.c
1a754c64 1920 @echo '**********' Expect 400 lines of differences.
c548e550 1921 -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
1922 -wc -l tmp-proto.diff
1923 ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1924 $(CFLAGS) $(INCLUDES) \
0b20f012 1925 -DGCC_INCLUDE_DIR=0 \
1926 -DGPLUSPLUS_INCLUDE_DIR=0 \
1927 -DCROSS_INCLUDE_DIR=0 \
46073b39 1928 -DTOOL_INCLUDE_DIR=0 \
262d46de 1929 -DSTD_PROTO_DIR=0" tmp-proto.c
0b20f012 1930 @echo Expect zero differences.
262d46de 1931 diff $(srcdir)/protoize.c tmp-proto.c | cat
62268150 1932 -rm -f tmp-proto.[cs] tmp-proto$(objext)
2b55270a 1933
1934gcov.o: gcov.c gcov-io.h
1935
1936gcov: gcov.o $(LIBDEPS)
1937 $(CC) $(ALL_CFLAGS) $(LDFLAGS) gcov.o $(LIBS) -o $@
2e9d8ccf 1938#\f
2cfd79fe 1939# Build the include directory. The stamp files are stmp-* rather than
1940# stamp-* so that mostlyclean does not force the include directory to
1941# be rebuilt.
1942
690a93ea 1943# Build the include directory except for float.h (which depends upon
1944# enquire).
8757933b 1945stmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h
2cfd79fe 1946# Copy in the headers provided with gcc.
1947# The sed command gets just the last file name component;
1948# this is necessary because VPATH could add a dirname.
1949# Using basename would be simpler, but some systems don't have it.
c8763215 1950 for file in .. $(USER_H); do \
1951 if [ X$$file != X.. ]; then \
1952 realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
1941d7da 1953 rm -f include/$$realfile; \
1954 cp $$file include; \
1955 chmod a+r include/$$realfile; \
c8763215 1956 fi; \
2cfd79fe 1957 done
b5850e21 1958 rm -f include/limits.h
2cfd79fe 1959 cp xlimits.h include/limits.h
1960 chmod a+r include/limits.h
2cfd79fe 1961# Install the README
b5850e21 1962 rm -f include/README
2cfd79fe 1963 cp $(srcdir)/README-fixinc include/README
1964 chmod a+r include/README
690a93ea 1965 touch stmp-int-hdrs
1966
0dbd1c74 1967# Build the complete include directory, including float.h.
690a93ea 1968stmp-headers: stmp-int-hdrs gfloat.h
1969 rm -f include/float.h
0dbd1c74 1970 if [ -s gfloat.h ]; then \
1971 cp gfloat.h include/float.h && \
1972 chmod a+r include/float.h; \
1973 else :; fi
2cfd79fe 1974 touch stmp-headers
1975
1976# Build fixed copies of system files.
62268150 1977stmp-fixinc: $(FIXINCLUDES) gsyslimits.h
2cfd79fe 1978 rm -rf include
1979 mkdir include
92d223d1 1980 if [ x$(FIXINCLUDES) != xMakefile.in ]; \
6848a9c6 1981 then \
1982 for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
1983 if [ -d $$dir ]; \
1984 then \
cee3b7e3 1985 $(SHELL) $(srcdir)/$(FIXINCLUDES) include $$dir; \
6848a9c6 1986 else true; fi; \
92d223d1 1987 done; \
6848a9c6 1988 else true; \
1989 fi
b7d4d520 1990 rm -f include/syslimits.h
1991 if [ -f include/limits.h ]; then \
1992 mv include/limits.h include/syslimits.h; \
1993 else \
1994 cp $(srcdir)/gsyslimits.h include/syslimits.h; \
1995 fi
1996 chmod a+r include/syslimits.h
9e74f24f 1997 touch stmp-fixinc
7c4f0e88 1998
a5889b74 1999# Files related to the fixproto script.
2000
047c2b8b 2001deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
f55e1a13 2002 CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -Iinclude -I${SYSTEM_HEADER_DIR}"; \
a5889b74 2003 export CC; \
6518b023 2004 $(SHELL) $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h
a5889b74 2005 mv tmp-deduced.h deduced.h
2006
ff8281e4 2007gen-protos: gen-protos.o scan.o cppalloc.o $(HOST_LIBDEPS)
62268150 2008 ${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
ff8281e4 2009 gen-protos.o scan.o cppalloc.o $(HOST_LIBS)
a5889b74 2010
c20b28d5 2011gen-protos.o: gen-protos.c scan.h $(build_xm_file)
c68462d9 2012 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c
2013
c20b28d5 2014scan.o: scan.c scan.h $(build_xm_file)
c68462d9 2015 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c
9541a717 2016
047c2b8b 2017xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
c92e16d4 2018 cat deduced.h $(srcdir)/sys-protos.h > tmp-fixtmp.c
2019 mv tmp-fixtmp.c fixtmp.c
2f9d2927 2020 $(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
6fc3eafd 2021 | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
c92e16d4 2022 | ./gen-protos >xsys-protos.hT
2023 mv xsys-protos.hT xsys-protos.h
d7c4552e 2024 rm -rf fixtmp.c
a5889b74 2025
62268150 2026fix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS) \
0dbd1c74 2027 cpplib.o cpphash.o cppalloc.o cppexp.o cpperror.o prefix.o version.o
62268150 2028 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ fix-header.o \
0dbd1c74 2029 scan-decls.o scan.o cpplib.o cpphash.o cppalloc.o prefix.o \
2030 version.o cppexp.o $(HOST_LIBS)
a5889b74 2031
9d6a1aa2 2032fix-header.o: fix-header.c obstack.h scan.h xsys-protos.h $(build_xm_file)
c68462d9 2033 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c
2034
caf36bd8 2035scan-decls.o: scan-decls.c scan.h cpplib.h $(build_xm_file)
c68462d9 2036 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c
a5889b74 2037
047c2b8b 2038# stmp-fixproto depends on this, not on fix-header directly.
2039# The idea is to make sure fix-header gets built,
2040# but not rerun fixproto after each stage
2041# just because fix-header's mtime has changed.
2042fixhdr.ready: fix-header
2043 -if [ -f fixhdr.ready ] ; then \
2044 true; \
2045 else \
2046 touch fixhdr.ready; \
2047 fi
2048
7bf27989 2049# stmp-headers is to make sure fixincludes has already finished.
276709eb 2050# The if statement is so that we don't run fixproto a second time
2051# if it has already been run on the files in `include'.
6a0b7b7c 2052stmp-fixproto: fixhdr.ready fixproto stmp-headers
2deaa28d 2053 @echo "Various warnings and error messages from fixproto are normal"
4fbc622f 2054 -if [ -d include ] ; then true; else mkdir include; fi
b948f736 2055 -if [ -f include/fixed ] ; then true; \
276709eb 2056 else \
6f1f992e 2057 : This line works around a 'make' bug in BSDI 1.1.; \
ff8281e4 2058 FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
2059 $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
276709eb 2060 touch include/fixed; \
2061 fi
a5889b74 2062 touch stmp-fixproto
2e9d8ccf 2063#\f
32e6d418 2064# Remake the info files.
2065
627defc4 2066doc: info
17b258fe 2067info: cpp.info gcc.info lang.info
32e6d418 2068
17b258fe 2069cpp.info: $(srcdir)/cpp.texi
2070 $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) $(srcdir)/cpp.texi -o cpp.info
32e6d418 2071
17b258fe 2072gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
2073 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
2074 $(srcdir)/tm.texi $(srcdir)/gcov.texi
2075 $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) $(srcdir)/gcc.texi -o gcc.info
630c76ba 2076
17b258fe 2077dvi: gcc.dvi cpp.dvi lang.dvi
627defc4 2078
64616031 2079# This works with GNU Make's default rule.
17b258fe 2080gcc.dvi: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
2081 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
2082 $(srcdir)/tm.texi $(srcdir)/gcov.texi
2083 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
2084 texindex gcc.??
2085 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
2086
2087cpp.dvi: $(srcdir)/cpp.texi
2088 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
2089 texindex cpp.??
2090 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
2091
2092
2093INSTALL: $(srcdir)/install1.texi $(srcdir)/install.texi
2094 $(MAKEINFO) -D INSTALLONLY --no-header --no-split \
2095 $(srcdir)/install1.texi -o INSTALL
2e9d8ccf 2096#\f
32e6d418 2097# Deletion of files made during compilation.
2098# There are four levels of this:
a8514488 2099# `mostlyclean', `clean', `distclean' and `maintainer-clean'.
32e6d418 2100# `mostlyclean' is useful while working on a particular type of machine.
c6396a0b 2101# It deletes most, but not all, of the files made by compilation.
32e6d418 2102# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
c6396a0b 2103# `clean' deletes everything made by running `make all'.
79f818d0 2104# `distclean' also deletes the files made by config.
a8514488 2105# `maintainer-clean' also deletes everything that could be regenerated
1f42ecdc 2106# automatically, except for `configure'.
2107# We remove as much from the language subdirectories as we can
73027c94 2108# (less duplicated code).
32e6d418 2109
79f818d0 2110
73027c94 2111mostlyclean: bytecode.mostlyclean lang.mostlyclean
32e6d418 2112 -rm -f $(STAGESTUFF)
2113# Delete the temporary source copies for cross compilation.
2114 -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
2115 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
2116 -rm -f $(HOST_PREFIX_1)obstack.c
2117# Delete the temp files made in the course of building libgcc.a.
c09ccbc2 2118 -rm -f tmplibgcc* tmpcopy xlimits.h libgcc1-test
32e6d418 2119 for name in $(LIB1FUNCS); do rm -f $${name}.c; done
2120# Delete other temporary files.
e5b63666 2121 -rm -f tmp-float.h tmp-gcc.xtar.gz
f678532a 2122 -rm -f tmp-foo1 tmp-foo2 tmp-proto.* tmp-unproto.1 tmp-SYSCALLS.s
8757933b 2123 -rm -f tmp-c-parse.y tmp-gperf.h
c92e16d4 2124 -rm -f tmp-specs t-float.h-cross tmp-xlimits.h
2125 -rm -f tmp-fixtmp.c xsys-protos.hT
32e6d418 2126# Delete the stamp files.
2127 -rm -f stamp-* tmp-*
73027c94 2128 -rm -f */stamp-* */tmp-*
c6396a0b 2129# Delete debugging dump files.
32e6d418 2130 -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
0dbd1c74 2131 -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.addressof *.regmove
73027c94 2132 -rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl
2133 -rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2
b4c5e619 2134 -rm -f */*.sched2 */*.stack */*.regmove
c6396a0b 2135# Delete some files made during installation.
d82b9c93 2136 -rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
e98401fc 2137 -rm -f collect collect2 mips-tfile mips-tdump alloca.s
a5889b74 2138# Delete files generated for fixproto
15dece2a 2139 -rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \
c9c7b9d8 2140 gen-protos fixproto.list fixtmp.* fixhdr.ready
c6396a0b 2141# Delete unwanted output files from TeX.
2142 -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
73027c94 2143 -rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg
79f818d0 2144# Delete sorted indices we don't actually use.
2145 -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
c6396a0b 2146# Delete core dumps.
73027c94 2147 -rm -f core */core
2b55270a 2148 -rm -f *.bp */*.bp
32e6d418 2149
79f818d0 2150# Delete all files made by compilation
2151# that don't exist in the distribution.
73027c94 2152clean: mostlyclean bytecode.clean lang.clean
8bd8ea06 2153# It may not be quite desirable to delete unprotoize.c here,
2154# but the spec for `make clean' requires it.
2155# Using unprotoize.c is not quite right in the first place,
2156# but what better way is there?
745e3a0d 2157 -rm -f libgcc.a libgcc1.a libgcc1-asm.a libgcc2.a libgcc2.ready
17108b2b 2158 -rm -f libgcc1.null
131b361e 2159 -rm -f *.dvi
73027c94 2160 -rm -f */*.dvi
89e36a04 2161 -if [ -f md.pre-cpp ]; then \
2162 rm -f md ; \
2163 fi
2cfd79fe 2164# Delete the include directory.
8757933b 2165 -rm -rf stmp-* include
73027c94 2166 -rm -f */stmp-*
d73a48cc 2167# Delete files used by the "multilib" facility (including libgcc subdirs).
f1ad3130 2168 -rm -f multilib.h tmpmultilib*
d73a48cc 2169 -if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \
2170 rm -rf $(MULTILIB_DIRNAMES); \
2171 else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \
2172 rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \
2173 fi ; fi
119f80e4 2174 -rm -fr stage1 stage2 stage3 stage4
32e6d418 2175
79f818d0 2176# Delete all files that users would normally create
2177# while building and installing GCC.
73027c94 2178distclean: clean bytecode.distclean lang.distclean
0dbd1c74 2179 -rm -f tm.h config.h auto-config.h tconfig.h hconfig.h md cstamp-h
1f42ecdc 2180 -rm -f config.status config.run config.cache config.bak
160b6fa9 2181 -rm -f Make-lang Make-hooks Make-host Make-target
636fef92 2182 -rm -f Makefile specs.h options.h *.oaux
58febf9e 2183 -rm -f gthr-default.h
c4ed51d6 2184 -rm -f */stage1 */stage2 */stage3 */stage4 */include
08d7a103 2185 -rm -f c-parse.output
b541ad9d 2186 -rm -f *.asm
ae115421 2187 -rm -f float.h
45e01ea1 2188 -rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak
2189 -rm -f testsuite/{gcc,g++}.{log,sum}
c6396a0b 2190
2191# Delete anything likely to be found in the source directory
2192# that shouldn't be in the distribution.
73027c94 2193extraclean: distclean lang.extraclean
bbbdbddd 2194 -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
131b361e 2195 -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
08d7a103 2196 -rm -f config/*/=* config/*/"#"* config/*/*~*
2197 -rm -f config/*/*.orig config/*/*.rej
300d5cb3 2198 -rm -f *.dvi *.ps *.oaux *.d *.[zZ] *.gz
13da1009 2199 -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
08d7a103 2200 -rm -f *lose config/*lose config/*/*lose
3a0781a0 2201 -rm -f *.s *.s[0-9] *.i install1.texi config/ChangeLog
73027c94 2202 -rm -f */=* */"#"* */*~*
2203 -rm -f */patch* */*.orig */*.rej
2204 -rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz
2205 -rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs
2206 -rm -f */*lose */*.s */*.s[0-9] */*.i
32e6d418 2207
1f42ecdc 2208# Get rid of every file that's generated from some other file, except for `configure'.
32e6d418 2209# Most of these files ARE PRESENT in the GCC distribution.
1f42ecdc 2210maintainer-clean:
2211 @echo 'This command is intended for maintainers to use; it'
2212 @echo 'deletes files that may need special tools to rebuild.'
2213 $(MAKE) distclean bytecode.maintainer-clean lang.maintainer-clean
8757933b 2214 -rm -f c-parse.y c-gperf.h
32e6d418 2215 -rm -f c-parse.c c-parse.h c-parse.output
2216 -rm -f cexp.c cexp.output TAGS
c6396a0b 2217 -rm -f cpp.info* cpp.??s cpp.*aux
2218 -rm -f gcc.info* gcc.??s gcc.*aux
2e9d8ccf 2219#\f
32e6d418 2220# Entry points `install' and `uninstall'.
c6396a0b 2221# Also use `install-collect2' to install collect2 when the config files don't.
32e6d418 2222
3f69fed5 2223# The semicolon is to prevent the install.sh -> install default rule
876dc5b0 2224# from doing anything. Having it run true helps avoid problems and
2225# noise from versions of make which don't like to have null commands.
c2a18965 2226install: $(INSTALL_TARGET) ; @true
32e6d418 2227
2cfd79fe 2228# Copy the compiler files into directories where they will be run.
62268150 2229# Install the driver last so that the window when things are
2230# broken is small.
2289acd7 2231install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
8757933b 2232 install-man install-info lang.install-normal install-driver
32e6d418 2233
e77fd588 2234# Do nothing while making gcc with a cross-compiler. The person who
2235# makes gcc for the target machine has to know how to put a complete
2236# gcc together by hand.
2237install-build: force
2238 @echo You have to install gcc on your target machine by hand.
2239
32e6d418 2240# Run this on the target machine
2241# to finish installation of cross compiler.
2242install-cross-rest: install-float-h-cross
2243
2244# Install float.h for cross compiler.
2245# Run this on the target machine!
0d5bce1b 2246install-float-h-cross: installdirs
9f10de4b 2247# if [ -f enquire ] ; then true; else false; fi
2248# Note: don't use -. We should fail right away if enquire was not made.
2249 ./enquire -f > $(tmpdir)/float.h
32e6d418 2250 -rm -f $(libsubdir)/include/float.h
f32abccb 2251 $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
2252 -rm -f $(tmpdir)/float.h
32e6d418 2253 chmod a-x $(libsubdir)/include/float.h
2254
0d5bce1b 2255# Create the installation directories.
2256installdirs:
2257 -if [ -d $(prefix) ] ; then true ; else mkdir $(prefix) ; chmod a+rx $(prefix) ; fi
2258 -if [ -d $(exec_prefix) ] ; then true ; else mkdir $(exec_prefix) ; chmod a+rx $(exec_prefix) ; fi
47db7968 2259 -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
2260 -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi
444c3fb0 2261# This dir isn't currently searched by cpp.
47db7968 2262# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
67cb4bc1 2263 -if [ -d $(libdir)/gcc-lib/$(target_alias) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias) ; chmod a+rx $(libdir)/gcc-lib/$(target_alias) ; fi
2264 -if [ -d $(libdir)/gcc-lib/$(target_alias)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias)/$(version) ; chmod a+rx $(libdir)/gcc-lib/$(target_alias)/$(version) ; fi
2265 -if [ -d $(libdir)/gcc-lib/$(target_alias)/$(version)/include ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias)/$(version)/include ; chmod a+rx $(libdir)/gcc-lib/$(target_alias)/$(version)/include ; fi
47db7968 2266 -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
2267 -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
2268 -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; chmod a+rx $(tooldir) ; fi
2269 -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
2270 -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
32e6d418 2271# We don't use mkdir -p to create the parents of mandir,
2272# because some systems don't support it.
2273# Instead, we use this technique to create the immediate parent of mandir.
2388f67d 2274 -parent=`echo $(mandir)|sed -e 's@/[^/]*$$@@'`; \
47db7968 2275 if [ -d $$parent ] ; then true ; else mkdir $$parent ; chmod a+rx $$parent ; fi
2276 -if [ -d $(mandir) ] ; then true ; else mkdir $(mandir) ; chmod a+rx $(mandir) ; fi
32e6d418 2277
2278# Install the compiler executables built during cross compilation.
0d5bce1b 2279install-common: native installdirs $(EXTRA_PARTS) lang.install-common
32e6d418 2280 for file in $(COMPILERS); do \
2281 if [ -f $$file ] ; then \
2282 rm -f $(libsubdir)/$$file; \
2283 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
2284 else true; \
2285 fi; \
2286 done
1a1e7b42 2287 for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
32e6d418 2288 if [ x"$$file" != x.. ]; then \
2289 rm -f $(libsubdir)/$$file; \
2290 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
2291 else true; fi; \
2292 done
1a1e7b42 2293 for file in $(EXTRA_PARTS) ..; do \
2294 if [ x"$$file" != x.. ]; then \
2295 rm -f $(libsubdir)/$$file; \
2296 $(INSTALL_DATA) $$file $(libsubdir)/$$file; \
0dbd1c74 2297 chmod a-x $(libsubdir)/$$file; \
1a1e7b42 2298 else true; fi; \
2299 done
8a4b1e01 2300# Don't mess with specs if it doesn't exist yet.
94c53b91 2301 -if [ -f specs ] ; then \
2302 rm -f $(libsubdir)/specs; \
8a4b1e01 2303 $(INSTALL_DATA) specs $(libsubdir)/specs; \
0dbd1c74 2304 chmod a-x $(libsubdir)/specs; \
8a4b1e01 2305 fi
62268150 2306# Install protoize if it was compiled.
2307 -if [ -f protoize$(exeext) ]; \
2308 then \
2309 rm -f $(bindir)/protoize$(exeext); \
2310 $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/protoize$(exeext); \
2311 rm -f $(bindir)/unprotoize$(exeext); \
2312 $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/unprotoize$(exeext); \
2313 rm -f $(libsubdir)/SYSCALLS.c.X; \
2314 $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
2315 chmod a-x $(libsubdir)/SYSCALLS.c.X; \
2316 fi
2317 -rm -f $(libsubdir)/cpp$(exeext)
2318 $(INSTALL_PROGRAM) cpp$(exeext) $(libsubdir)/cpp$(exeext)
e2a2be99 2319# Install gcov if it was compiled.
2b55270a 2320 -if [ -f gcov$(exeext) ]; \
2321 then \
2322 rm -f $(bindir)/gcov$(exeext); \
2323 $(INSTALL_PROGRAM) gcov$(exeext) $(bindir)/gcov$(exeext); \
2324 chmod a+x $(bindir)/gcov$(exeext); \
2325 fi
62268150 2326
67cb4bc1 2327# Install the driver program as $(target_alias)-gcc
32e6d418 2328# and also as either gcc (if native) or $(tooldir)/bin/gcc.
62268150 2329install-driver: xgcc
f403cbcb 2330 -if [ -f gcc-cross$(exeext) ] ; then \
2331 rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
12d8e722 2332 $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
32e6d418 2333 if [ -d $(tooldir)/bin/. ] ; then \
f403cbcb 2334 rm -f $(tooldir)/bin/gcc$(exeext); \
2335 $(INSTALL_PROGRAM) gcc-cross$(exeext) $(tooldir)/bin/gcc$(exeext); \
32e6d418 2336 else true; fi; \
2337 else \
f403cbcb 2338 rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
2339 $(INSTALL_PROGRAM) xgcc$(exeext) $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
67cb4bc1 2340 rm -f $(bindir)/$(target_alias)-gcc-1$(exeext); \
ea4a6c81 2341 $(LN) $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext); \
67cb4bc1 2342 mv $(bindir)/$(target_alias)-gcc-1$(exeext) $(bindir)/$(target_alias)-gcc$(exeext); \
32e6d418 2343 fi
32e6d418 2344
a2aa0fc1 2345# Install the info files.
dff6b323 2346# $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
2347# to do the install. The sed rule was copied from stmp-int-hdrs.
0d5bce1b 2348install-info: doc installdirs lang.install-info
a2aa0fc1 2349 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
17b258fe 2350 for f in cpp.info* gcc.info*; do \
dff6b323 2351 realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
2352 $(INSTALL_DATA) $$f $(infodir)/$$realfile; \
2353 done
a2aa0fc1 2354 -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
2355
32e6d418 2356# Install the man pages.
0d5bce1b 2357install-man: installdirs $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man
0dbd1c74 2358 -if [ -f gcc-cross$(exeext) ] ; then \
b541ad9d 2359 rm -f $(mandir)/$(GCC_CROSS_NAME)$(manext); \
2360 $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/$(GCC_CROSS_NAME)$(manext); \
2361 chmod a-x $(mandir)/$(GCC_CROSS_NAME)$(manext); \
2362 else \
2363 rm -f $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
2364 $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
2365 chmod a-x $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
2366 fi
c6396a0b 2367 -rm -f $(mandir)/cccp$(manext)
ab866dde 2368 -$(INSTALL_DATA) $(srcdir)/cccp.1 $(mandir)/cccp$(manext)
2369 -chmod a-x $(mandir)/cccp$(manext)
32e6d418 2370
2371# Install the library.
0d5bce1b 2372install-libgcc: libgcc.a installdirs
32e6d418 2373 -if [ -f libgcc.a ] ; then \
2374 rm -f $(libsubdir)/libgcc.a; \
2375 $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
2376 if $(RANLIB_TEST) ; then \
2377 (cd $(libsubdir); $(RANLIB) libgcc.a); else true; fi; \
2378 chmod a-x $(libsubdir)/libgcc.a; \
2379 else true; fi
2380
f1ad3130 2381# Install multiple versions of libgcc.a.
0d5bce1b 2382install-multilib: stmp-multilib installdirs
f1ad3130 2383 for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
2384 dir=`echo $$i | sed -e 's/;.*$$//'`; \
2385 if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \
cdc96909 2386 for f in libgcc.a $(EXTRA_MULTILIB_PARTS); do \
2387 rm -f $(libsubdir)/$${dir}/$${f}; \
2388 $(INSTALL_DATA) $${dir}/$${f} $(libsubdir)/$${dir}/$${f}; \
2389 done; \
f1ad3130 2390 if $(RANLIB_TEST); then \
2391 (cd $(libsubdir)/$${dir}; $(RANLIB) libgcc.a); else true; fi; \
2392 chmod a-x $(libsubdir)/$${dir}/libgcc.a; \
2393 done
2394
2cfd79fe 2395# Install all the header files built in the include subdirectory.
c8763215 2396install-headers: install-include-dir $(INSTALL_HEADERS_DIR) $(INSTALL_ASSERT_H)
2cfd79fe 2397# Fix symlinks to absolute paths in the installed include directory to
2398# point to the installed directory, not the build directory.
ea4a6c81 2399# Don't need to use LN_S here since we really do need ln -s and no substitutes.
2cfd79fe 2400 -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
2401 if [ $$? -eq 0 ]; then \
2402 dir=`cd include; pwd`; \
2403 for i in $$files; do \
2404 dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
2405 if expr "$$dest" : "$$dir.*" > /dev/null; then \
2406 rm -f $(libsubdir)/include/$$i; \
5822e312 2407 ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
2cfd79fe 2408 fi; \
2409 done; \
2410 fi
32e6d418 2411
2cfd79fe 2412# Create or recreate the gcc private include file directory.
0d5bce1b 2413install-include-dir: installdirs
2cfd79fe 2414 -rm -rf $(libsubdir)/include
2415 mkdir $(libsubdir)/include
2416 -chmod a+rx $(libsubdir)/include
2417
2418# Install the include directory using tar.
a5889b74 2419install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
651b0150 2420 (cd include; \
b948f736 2421 tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
16db1e2d 2422# /bin/sh on some systems returns the status of the first tar,
2423# and that can lose with GNU tar which always writes a full block.
2424# So use `exit 0' to ignore its exit status.
2cfd79fe 2425
2426# Install the include directory using cpio.
a5889b74 2427install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
813fb313 2428 (cd include; find . -print) | (cd include; cpio -pdum $(libsubdir)/include)
32e6d418 2429
35df828f 2430# Put assert.h where it won't override GNU libc's assert.h.
2431# It goes in a dir that is searched after GNU libc's headers;
2432# thus, the following conditionals are no longer needed.
2433# But it's not worth deleting them now.
2434## Don't replace the assert.h already there if it is not from GCC.
2435## This code would be simpler if it tested for -f ... && ! grep ...
2436## but supposedly the ! operator is missing in sh on some systems.
0d5bce1b 2437install-assert-h: assert.h installdirs
eb5a0caa 2438 if [ -f $(assertdir)/assert.h ]; \
2439 then \
95856242 2440 if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
a953974c 2441 then \
eb5a0caa 2442 rm -f $(assertdir)/assert.h; \
2443 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
04873c54 2444 chmod a-x $(assertdir)/assert.h; \
eb5a0caa 2445 else true; \
2446 fi; \
2ba284c3 2447 else \
db9a0b19 2448 rm -f $(assertdir)/assert.h; \
2449 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
04873c54 2450 chmod a-x $(assertdir)/assert.h; \
2ba284c3 2451 fi
32e6d418 2452
c6396a0b 2453# Use this target to install the program `collect2' under the name `ld'.
0d5bce1b 2454install-collect2: collect2 installdirs
f403cbcb 2455 $(INSTALL_PROGRAM) collect2$(exeext) $(libsubdir)/ld$(exeext)
c6396a0b 2456# Install the driver program as $(libsubdir)/gcc for collect2.
f403cbcb 2457 $(INSTALL_PROGRAM) xgcc$(exeext) $(libsubdir)/gcc$(exeext)
c6396a0b 2458
32e6d418 2459# Cancel installation by deleting the installed files.
73027c94 2460uninstall: lang.uninstall
32e6d418 2461 -rm -rf $(libsubdir)
f403cbcb 2462 -rm -rf $(bindir)/$(GCC_INSTALL_NAME)$(exeext)
2463 -rm -rf $(bindir)/$(GCC_CROSS_NAME)$(exeext)
2464 -rm -rf $(bindir)/protoize$(exeext)
2465 -rm -rf $(bindir)/unprotoize$(exeext)
b541ad9d 2466 -rm -rf $(mandir)/$(GCC_INSTALL_NAME)$(manext)
2467 -rm -rf $(mandir)/$(GCC_CROSS_NAME)$(manext)
c6396a0b 2468 -rm -rf $(mandir)/cccp$(manext)
32e6d418 2469 -rm -rf $(mandir)/protoize$(manext)
2470 -rm -rf $(mandir)/unprotoize$(manext)
2e9d8ccf 2471#\f
6c08487b 2472# These targets are for the dejagnu testsuites. The file site.exp
2473# contains global variables that all the testsuites will use.
2474
2475# Set to $(target_alias)/ for cross.
2476target_subdir = @target_subdir@
2477
2478site.exp: ./config.status Makefile
2479 @echo "Making a new config file..."
2480 -@rm -f ./tmp?
2481 @touch site.exp
2482 -@mv site.exp site.bak
2483 @echo "## these variables are automatically generated by make ##" > ./tmp0
2484 @echo "# Do not edit here. If you wish to override these values" >> ./tmp0
2485 @echo "# add them to the last section" >> ./tmp0
2486 @echo "set rootme \"`pwd`\"" >> ./tmp0
2487 @echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0
2488 @echo "set host_triplet $(host_canonical)" >> ./tmp0
2489 @echo "set build_triplet $(build_canonical)" >> ./tmp0
2490 @echo "set target_triplet $(target)" >> ./tmp0
2491 @echo "set target_alias $(target_alias)" >> ./tmp0
2492# CFLAGS is set even though it's empty to show we reserve the right to set it.
2493 @echo "set CFLAGS \"\"" >> ./tmp0
2494 @echo "set CXXFLAGS \"-I$(objdir)/../$(target_subdir)libio -I\$$srcdir/../libg++/src -I\$$srcdir/../libio -I\$$srcdir/../libstdc++ -I\$$srcdir/../libstdc++/stl -L$(objdir)/../$(target_subdir)libg++ -L$(objdir)/../$(target_subdir)libstdc++\"" >> ./tmp0
2495# If newlib has been configured, we need to pass -B to gcc so it can find
2496# newlib's crt0.o if it exists. This will cause a "path prefix not used"
2497# message if it doesn't, but the testsuite is supposed to ignore the message -
2498# it's too difficult to tell when to and when not to pass -B (not all targets
2499# have crt0's). We could only add the -B if ../newlib/crt0.o exists, but that
2500# seems like too selective a test.
2501# ??? Another way to solve this might be to rely on linker scripts. Then
2502# theoretically the -B won't be needed.
2503# We also need to pass -L ../ld so that the linker can find ldscripts.
2504 @if [ -d $(objdir)/../$(target_subdir)newlib ] ; then \
2505 echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \
2506 echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)newlib/\"" >> ./tmp0; \
2507 echo "append CFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
2508 echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
2509 echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./tmp0; \
2510 else true; \
2511 fi
2512 @if [ -d $(objdir)/../ld ] ; then \
2513 echo "append LDFLAGS \" -L$(objdir)/../ld\"" >> ./tmp0; \
2514 else true; \
2515 fi
2516 @if [ $(build_canonical) != $(host_canonical) ] ; then \
2517 echo "set tmpdir /tmp" >> ./tmp0 ; \
2518 else echo "set tmpdir $(objdir)/testsuite" >> ./tmp0 ; \
2519 fi
2520 @echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0
2521 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
2522 @cat ./tmp0 > site.exp
2523 @cat site.bak | sed \
2524 -e '1,/^## All variables above are.*##/ d' >> site.exp
2525 -@rm -f ./tmp?
2526
4230ead8 2527CHECK_TARGETS = check-gcc check-g++ check-g77
6c08487b 2528
2529check: $(CHECK_TARGETS)
2530
20ab2c9c 2531testsuite/site.exp: site.exp
6c08487b 2532 if [ -d testsuite ]; then \
2533 true; \
2534 else \
2535 mkdir testsuite; \
2536 fi
2537 rm -rf testsuite/site.exp
2538 cp site.exp testsuite/site.exp
20ab2c9c 2539
2540check-g++: testsuite/site.exp
2541 -rootme=`pwd`; export rootme; \
6c08487b 2542 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2543 cd testsuite; \
2544 EXPECT=${EXPECT} ; export EXPECT ; \
2545 if [ -f $${rootme}/../expect/expect ] ; then \
2546 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2547 export TCL_LIBRARY ; fi ; \
2548 $(RUNTEST) --tool g++ $(RUNTESTFLAGS)
2549
20ab2c9c 2550check-gcc: testsuite/site.exp
2551 -rootme=`pwd`; export rootme; \
6c08487b 2552 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2553 cd testsuite; \
2554 EXPECT=${EXPECT} ; export EXPECT ; \
2555 if [ -f $${rootme}/../expect/expect ] ; then \
2556 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2557 export TCL_LIBRARY ; fi ; \
2558 $(RUNTEST) --tool gcc $(RUNTESTFLAGS)
2559
4230ead8 2560check-g77: testsuite/site.exp
2561 -rootme=`pwd`; export rootme; \
2562 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2563 cd testsuite; \
2564 EXPECT=${EXPECT} ; export EXPECT ; \
2565 if [ -f $${rootme}/../expect/expect ] ; then \
2566 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2567 export TCL_LIBRARY ; fi ; \
2568 $(RUNTEST) --tool g77 $(RUNTESTFLAGS)
2569
32e6d418 2570# These exist for maintenance purposes.
2571
2572# Update the tags table.
2573TAGS: force
2574 cd $(srcdir); \
2575 mkdir temp; \
0dbd1c74 2576 mv -f c-parse.[ch] cexp.c =*.[chy] temp; \
32e6d418 2577 etags *.y *.h *.c; \
2578 mv temp/* .; \
2579 rmdir temp
2580
2581# Create the distribution tar file.
e5b63666 2582#dist: gcc-$(version).tar.gz
2583dist: gcc.xtar.gz
32e6d418 2584
e5b63666 2585gcc.xtar.gz: gcc.xtar
b89eb617 2586 gzip --best < gcc.xtar > tmp-gcc.xtar.gz
e5b63666 2587 mv tmp-gcc.xtar.gz gcc.xtar.gz
32e6d418 2588
e5b63666 2589#gcc-$(version).tar.gz: gcc-$(version).tar
2590# gzip < gcc-$(version).tar > gcc-$(version).tar.gz
32e6d418 2591
2592#gcc-$(version).tar:
6c76e6ec 2593gcc.xtar: distdir
2594# Make the distribution.
b948f736 2595 tar -chf gcc.xtar gcc-$(version)
6c76e6ec 2596
73027c94 2597# This target exists to do the initial work before the language specific
2598# stuff gets done.
0f557c81 2599distdir-start: doc $(srcdir)/INSTALL $(srcdir)/c-parse.y $(srcdir)/c-gperf.h \
ad87de1e 2600 $(srcdir)/c-parse.c $(srcdir)/cexp.c $(srcdir)/config.in
2deaa28d 2601 @if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \
630c76ba 2602 then true; \
0dce1b01 2603 else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
630c76ba 2604 fi
131b361e 2605# Update the version number in README
2606 awk '$$1 " " $$2 " " $$3 == "This directory contains" \
2607 { $$6 = version; print $$0 } \
2608 $$1 " " $$2 " " $$3 != "This directory contains"' \
2609 version=$(version) README > tmp.README
2610 mv tmp.README README
c6396a0b 2611 -rm -rf gcc-$(version) tmp
32e6d418 2612# Put all the files in a temporary subdirectory
2613# which has the name that we want to have in the tar file.
c6396a0b 2614 mkdir tmp
2615 mkdir tmp/config
3bc8e4d6 2616 mkdir tmp/ginclude
c6396a0b 2617 for file in *[0-9a-zA-Z+]; do \
ea4a6c81 2618 $(LN) $$file tmp; \
c6396a0b 2619 done
2620 cd config; \
2621 for file in *[0-9a-zA-Z+]; do \
57e88ef9 2622 if test -d $$file && test "$$file" != RCS; then \
8a32ef6f 2623 mkdir ../tmp/config/$$file; \
2624 cd $$file; \
2625 for subfile in *[0-9a-zA-Z+]; do \
ea4a6c81 2626 $(LN) $$subfile ../../tmp/config/$$file; \
8a32ef6f 2627 done; \
2628 cd ..; \
2629 else \
ea4a6c81 2630 $(LN) $$file ../tmp/config; \
8a32ef6f 2631 fi; \
32e6d418 2632 done
3bc8e4d6 2633 cd ginclude; \
2634 for file in *[0-9a-zA-Z+]; do \
ea4a6c81 2635 $(LN) $$file ../tmp/ginclude; \
3bc8e4d6 2636 done
4f1fd857 2637 cd objc; \
2638 for file in *[0-9a-zA-Z+]; do \
ea4a6c81 2639 $(LN) $$file ../tmp/objc; \
4f1fd857 2640 done
ea4a6c81 2641 $(LN) .gdbinit tmp
73027c94 2642
2643# Finish making `distdir', after the languages have done their thing.
2644distdir-finish:
c6396a0b 2645 mv tmp gcc-$(version)
3bc8e4d6 2646# Get rid of everything we don't want in the distribution. We'd want
2647# this to use Makefile.in, but it doesn't have the `lang.foo' targets
2648# expanded.
2649 cd gcc-$(version); make extraclean
32e6d418 2650
73027c94 2651distdir: distdir-start lang.distdir distdir-finish
2652
2deaa28d 2653# make diff oldversion=M.N
2654# creates a diff file between an older distribution and this one.
2655# The -P option assumes this is GNU diff.
2656diff:
6a4a0b58 2657 diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \
73027c94 2658 -x cexp.c -x bi-parser.c -x objc-parse.y -x objc-parse.c \
c971af2b 2659 -x bi-parser.h -x TAGS \
73027c94 2660 -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \
2661 -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \
2662 $(LANG_DIFF_EXCLUDES) \
2deaa28d 2663 gcc-$(oldversion) gcc-$(version) > diffs
2664
58622ee7 2665bootstrap bootstrap-lean: force
41f63c60 2666# Only build the C compiler for stage1, because that is the only one that
2667# we can guarantee will build with the native compiler, and also it is the
2668# only thing useful for building stage2.
e754efc9 2669 $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
32e6d418 2670 $(MAKE) stage1
c6396a0b 2671# This used to define ALLOCA as empty, but that would lead to bad results
2672# for a subsequent `make install' since that would not have ALLOCA empty.
2673# To prevent `make install' from compiling alloca.o and then relinking cc1
2674# because alloca.o is newer, we permit these recursive makes to compile
2675# alloca.o. Then cc1 is newer, so it won't have to be relinked.
8f90ec19 2676 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
32e6d418 2677 $(MAKE) stage2
58622ee7 2678 -if test $@ = bootstrap-lean; then rm -rf stage1; else true; fi
732395de 2679 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
2680
32e6d418 2681bootstrap2: force
8f90ec19 2682 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
32e6d418 2683 $(MAKE) stage2
8f90ec19 2684 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
32e6d418 2685
2686bootstrap3: force
8f90ec19 2687 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
32e6d418 2688
58622ee7 2689bootstrap4: force
2690 $(MAKE) CC="stage3/xgcc -Bstage3/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage3/ LANGUAGES="$(LANGUAGES)"
2691
48c6936b 2692# Compare the object files in the current directory with those in the
2693# stage2 directory.
2694
639b13ee 2695# ./ avoids bug in some versions of tail.
d7fba489 2696compare compare3 compare4 compare-lean compare3-lean compare4-lean: force
20becaef 2697 -rm -f .bad_compare
d7fba489 2698 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
62268150 2699 for file in *$(objext); do \
639b13ee 2700 tail +16c ./$$file > tmp-foo1; \
d7fba489 2701 tail +16c stage$$stage/$$file > tmp-foo2 \
20becaef 2702 && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
48c6936b 2703 done
d7fba489 2704 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
73027c94 2705 for dir in tmp-foo $(SUBDIRS); do \
62268150 2706 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2707 for file in $$dir/*$(objext); do \
73027c94 2708 tail +16c ./$$file > tmp-foo1; \
d7fba489 2709 tail +16c stage$$stage/$$file > tmp-foo2 \
20becaef 2710 && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
9771451c 2711 done; \
2712 fi; \
73027c94 2713 done
48c6936b 2714 -rm -f tmp-foo*
77333ad9 2715 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
20becaef 2716 if [ -f .bad_compare ]; then \
2717 echo "Bootstrap comparison failure!"; \
2718 cat .bad_compare; \
2719 exit 1; \
d7fba489 2720 else \
2721 case "$@" in \
2722 *-lean ) rm -rf stage$$stage ;; \
05bdc491 2723 *) ;; \
d7fba489 2724 esac; true; \
20becaef 2725 fi
48c6936b 2726
d7fba489 2727# Compare the object files in the current directory with those in the
2728# stage2 directory. Use gnu cmp (diffutils v2.4 or later) to avoid
2729# running tail and the overhead of twice copying each object file.
2730
2731gnucompare gnucompare3 gnucompare4 gnucompare-lean gnucompare3-lean gnucompare4-lean: force
732395de 2732 -rm -f .bad_compare
d7fba489 2733 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
732395de 2734 for file in *$(objext); do \
d7fba489 2735 (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
732395de 2736 done
d7fba489 2737 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
732395de 2738 for dir in tmp-foo $(SUBDIRS); do \
2739 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2740 for file in $$dir/*$(objext); do \
d7fba489 2741 (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
732395de 2742 done; \
2743 fi; \
2744 done
77333ad9 2745 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
732395de 2746 if [ -f .bad_compare ]; then \
2747 echo "Bootstrap comparison failure!"; \
2748 cat .bad_compare; \
2749 exit 1; \
d7fba489 2750 else \
2751 case "$@" in \
2752 *-lean ) rm -rf stage$$stage ;; \
2753 esac; true; \
732395de 2754 fi
2755
32e6d418 2756# Copy the object files from a particular stage into a subdirectory.
73027c94 2757stage1-start:
c6396a0b 2758 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
73027c94 2759 -for dir in . $(SUBDIRS) ; \
2760 do \
21fde8a9 2761 if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \
73027c94 2762 done
32e6d418 2763 -mv $(STAGESTUFF) stage1
b541ad9d 2764# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2765# dir will work properly.
ea4a6c81 2766 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage1 ; else true ; fi
2767 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage1 ; else true ; fi
2768 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage1 ; else true ; fi
32e6d418 2769 -rm -f stage1/libgcc.a
2770 -cp libgcc.a stage1
2771 -if $(RANLIB_TEST) ; then $(RANLIB) stage1/libgcc.a; else true; fi
3efc89f0 2772 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2773 cp stage1/$${f} . ; \
7561ae90 2774 else true; \
3efc89f0 2775 fi; done
73027c94 2776stage1: force stage1-start lang.stage1
32e6d418 2777
73027c94 2778stage2-start:
c6396a0b 2779 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
73027c94 2780 -for dir in . $(SUBDIRS) ; \
2781 do \
21fde8a9 2782 if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \
73027c94 2783 done
32e6d418 2784 -mv $(STAGESTUFF) stage2
b541ad9d 2785# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2786# dir will work properly.
ea4a6c81 2787 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage2 ; else true ; fi
2788 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage2 ; else true ; fi
2789 -if [ -f collect-ld ] ; then $(LN_S) ../collect-ld$(exeext) stage2 ; else true ; fi
32e6d418 2790 -rm -f stage2/libgcc.a
2791 -cp libgcc.a stage2
2792 -if $(RANLIB_TEST) ; then $(RANLIB) stage2/libgcc.a; else true; fi
3efc89f0 2793 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2794 cp stage2/$${f} . ; \
7561ae90 2795 else true; \
3efc89f0 2796 fi; done
73027c94 2797stage2: force stage2-start lang.stage2
32e6d418 2798
73027c94 2799stage3-start:
2388f67d 2800 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
73027c94 2801 -for dir in . $(SUBDIRS) ; \
2802 do \
21fde8a9 2803 if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \
73027c94 2804 done
32e6d418 2805 -mv $(STAGESTUFF) stage3
b541ad9d 2806# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2807# dir will work properly.
ea4a6c81 2808 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage3 ; else true ; fi
2809 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage3 ; else true ; fi
2810 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage3 ; else true ; fi
32e6d418 2811 -rm -f stage3/libgcc.a
2812 -cp libgcc.a stage3
2813 -if $(RANLIB_TEST) ; then $(RANLIB) stage3/libgcc.a; else true; fi
3efc89f0 2814 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2815 cp stage3/$${f} . ; \
7561ae90 2816 else true; \
3efc89f0 2817 fi; done
73027c94 2818stage3: force stage3-start lang.stage3
32e6d418 2819
73027c94 2820stage4-start:
2388f67d 2821 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
73027c94 2822 -for dir in . $(SUBDIRS) ; \
2823 do \
21fde8a9 2824 if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \
73027c94 2825 done
32e6d418 2826 -mv $(STAGESTUFF) stage4
b541ad9d 2827# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2828# dir will work properly.
ea4a6c81 2829 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage4 ; else true ; fi
2830 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage4 ; else true ; fi
2831 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage4 ; else true ; fi
32e6d418 2832 -rm -f stage4/libgcc.a
2833 -cp libgcc.a stage4
2834 -if $(RANLIB_TEST) ; then $(RANLIB) stage4/libgcc.a; else true; fi
3efc89f0 2835 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2836 cp stage4/$${f} . ; \
7561ae90 2837 else true; \
3efc89f0 2838 fi; done
73027c94 2839stage4: force stage4-start lang.stage4
32e6d418 2840
2841# Copy just the executable files from a particular stage into a subdirectory,
2842# and delete the object files. Use this if you're just verifying a version
2843# that is pretty sure to work, and you are short of disk space.
62268150 2844risky-stage1: stage1
7cc2ce68 2845 -make clean
32e6d418 2846
62268150 2847risky-stage2: stage2
32e6d418 2848 -make clean
2849
62268150 2850risky-stage3: stage3
32e6d418 2851 -make clean
2852
62268150 2853risky-stage4: stage4
32e6d418 2854 -make clean
2855
2856#In GNU Make, ignore whether `stage*' exists.
a8514488 2857.PHONY: stage1 stage2 stage3 stage4 clean maintainer-clean TAGS bootstrap
32e6d418 2858.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
2859
2860force: