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