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