]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/Makefile.in
* call.c (null_ptr_cst_p): Integer type, not integral type.
[thirdparty/gcc.git] / gcc / Makefile.in
CommitLineData
32e6d418 1# Makefile for GNU C compiler.
dd20fff6 2# Copyright (C) 1987, 88, 90-96, 1997 Free Software Foundation, Inc.
32e6d418 3
4#This file is part of GNU CC.
5
6#GNU CC is free software; you can redistribute it and/or modify
7#it under the terms of the GNU General Public License as published by
8#the Free Software Foundation; either version 2, or (at your option)
9#any later version.
10
11#GNU CC is distributed in the hope that it will be useful,
12#but WITHOUT ANY WARRANTY; without even the implied warranty of
13#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14#GNU General Public License for more details.
15
16#You should have received a copy of the GNU General Public License
17#along with GNU CC; see the file COPYING. If not, write to
8d62a21c 18#the Free Software Foundation, 59 Temple Place - Suite 330,
19#Boston MA 02111-1307, USA.
32e6d418 20
21# The targets for external use include:
22# all, doc, proto, install, install-cross, install-cross-rest,
a8514488 23# uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean,
32e6d418 24# stage1, stage2, stage3, stage4.
25
c6396a0b 26# Suppress smart makes who think they know how to automake Yacc files
27.y.c:
28
87c0ad1b 29# Directory where sources are, from where we are.
30srcdir = @srcdir@
31VPATH = @srcdir@
32
32e6d418 33# Variables that exist for you to override.
34# See below for how to change them for certain systems.
35
73027c94 36# List of language subdirectories.
37# This is overridden by configure.
87c0ad1b 38SUBDIRS =@subdirs@
73027c94 39
32e6d418 40# Selection of languages to be made.
73027c94 41# This is overridden by configure.
8757933b 42LANGUAGES = c proto gcov @all_languages@
32e6d418 43
e754efc9 44# Selection of languages to be made during stage1 build.
45# This is overridden by configure.
87c0ad1b 46BOOT_LANGUAGES = c @all_boot_languages@
e754efc9 47
32e6d418 48ALLOCA =
1ab99fde 49ALLOCA_FLAGS =
94c53b91 50ALLOCA_FINISH = true
32e6d418 51
52# Various ways of specifying flags for compilations:
53# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
54# BOOT_CFLAGS is the value of CFLAGS to pass
55# to the stage2 and stage3 compilations
56# XCFLAGS is used for most compilations but not when using the GCC just built.
329da2a1 57# TCFLAGS is used for compilations with the GCC just built.
32e6d418 58XCFLAGS =
329da2a1 59TCFLAGS =
32e6d418 60CFLAGS = -g
61BOOT_CFLAGS = -O $(CFLAGS)
62# These exists to be overridden by the x-* and t-* files, respectively.
63X_CFLAGS =
64T_CFLAGS =
65
66X_CPPFLAGS =
67T_CPPFLAGS =
68
38bce124 69CC = @CC@
32e6d418 70BISON = bison
3f1608f3 71BISONFLAGS =
73027c94 72LEX = flex
73LEXFLAGS =
32e6d418 74AR = ar
32e6d418 75AR_FLAGS = rc
4664c5d5 76DLLTOOL = dlltool
32e6d418 77SHELL = /bin/sh
78# on sysV, define this as cp.
87c0ad1b 79INSTALL = @INSTALL@
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.
d9ed24f6 271LIBGCC2_DEBUG_CFLAGS = -g1
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
952libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \
6143c0f8 953 $(LANG_LIB2FUNCS) machmode.h longlong.h gbl-ctors.h config.status
32e6d418 954# Actually build it in tmplibgcc2.a, then rename at end,
955# so that libgcc2.a itself remains nonexistent if compilation is aborted.
956 -rm -f tmplibgcc2.a
957# -e causes any failing command to make this rule fail.
958# -e doesn't work in certain shells, so we test $$? as well.
547e1b60 959# lynx has a broken ar, it always complains when the initial library is
960# empty, thus this command works only if we don't do -e
961# There is a trailing backslash (\) deleted from the following line.
962# set -e;
32e6d418 963 for name in $(LIB2FUNCS); \
964 do \
965 echo $${name}; \
c6396a0b 966 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
62268150 967 $(srcdir)/libgcc2.c -o $${name}$(objext); \
32e6d418 968 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
62268150 969 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}$(objext); \
970 rm -f $${name}$(objext); \
32e6d418 971 done
972# Some shells crash when a loop has no items.
973# So make sure there is always at least one--`..'.
974# Then ignore it.
975# We don't use -e here because there are if statements
976# that should not make the command give up when the if condition is false.
977# Instead, we test for failure after each command where it matters.
6143c0f8 978 for file in .. $(LIB2FUNCS_EXTRA) $(LANG_LIB2FUNCS); \
32e6d418 979 do \
980 if [ x$${file} != x.. ]; then \
6143c0f8 981 name=`echo $${file} | sed -e 's/[.][cSo]$$//' -e 's/[.]asm$$//' -e 's/[.]txt$$//'`; \
d901718e 982 oname=` echo $${name} | sed -e 's,.*/,,'`; \
6143c0f8 983 if [ $${name}.txt = $${file} ]; then \
984 for f in .. `cat $${file}`; do if [ x$${f} != x.. ]; then \
985 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
986 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" \
987 CFLAGS="$(CFLAGS)" HOST_PREFIX="$(HOST_PREFIX)" \
988 HOST_PREFIX_1="$(HOST_PREFIX_1)" \
93ed8bee 989 LANGUAGES="$(LANGUAGES)" \
6143c0f8 990 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $${f}; \
991 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
992 $(AR) $(AR_FLAGS) tmplibgcc2.a $${f}; \
993 rm -f $${f}; \
7561ae90 994 else true; \
6143c0f8 995 fi; done; \
996 else \
997 echo $${name}; \
998 if [ $${name}.asm = $${file} ]; then \
999 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
1000 else true; fi; \
1001 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
1002 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
1003 $(AR) $(AR_FLAGS) tmplibgcc2.a $${oname}$(objext); \
1004 rm -f $${name}.s $${oname}$(objext); \
1005 fi; \
32e6d418 1006 else true; \
1007 fi; \
1008 done
1009 mv tmplibgcc2.a libgcc2.a
1010# These lines were deleted from above the mv command
1011# because ranlibing libgcc.a itself should suffice.
1012# -if [ x${HPUX_GAS} = x ] ; then \
13194ea9 1013# if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc2.a; else true; fi; \
32e6d418 1014# else true; fi
1015
1016# Combine the various libraries into a single library, libgcc.a.
1017libgcc.a: $(LIBGCC1) $(LIBGCC2)
1018 -rm -rf tmplibgcc.a libgcc.a tmpcopy
1019 mkdir tmpcopy
c6396a0b 1020 -if [ x$(LIBGCC1) != x ]; \
1021 then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
1022 else true; \
1023 fi
edf5976e 1024# Some versions of ar (specifically the one in RISC/os 5.x), create an
1025# unwritable table of contents file, and then print an error message when
1026# the second ar command tries to overwrite this file. To avoid the error
1027# message from ar, we make sure all files are writable.
75c6d942 1028 -(cd tmpcopy; chmod +w * > /dev/null 2>&1)
32e6d418 1029 (cd tmpcopy; $(AR) x ../$(LIBGCC2))
62268150 1030 (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *$(objext))
32e6d418 1031 rm -rf tmpcopy
1032 -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
1033# Actually build it in tmplibgcc.a, then rename at end,
1034# so that libgcc.a itself remains nonexistent if compilation is aborted.
1035 mv tmplibgcc.a libgcc.a
1036
f1ad3130 1037# Use the genmultilib shell script to generate the information the gcc
1038# driver program needs to select the library directory based on the
1039# switches.
3d97d965 1040multilib.h: stamp-mlib; @true
1041stamp-mlib: $(srcdir)/genmultilib Makefile
1042 $(SHELL) $(srcdir)/genmultilib \
1043 "$(MULTILIB_OPTIONS)" \
1044 "$(MULTILIB_DIRNAMES)" \
1045 "$(MULTILIB_MATCHES)" \
1046 "$(MULTILIB_EXCEPTIONS)" \
1047 "$(MULTILIB_EXTRA_OPTS)" > tmp-mlib.h
1048 $(srcdir)/move-if-change tmp-mlib.h multilib.h
1049 touch stamp-mlib
f1ad3130 1050
1051# Build multiple copies of libgcc.a, one for each target switch.
1052stmp-multilib: $(LIBGCC1) libgcc2.c libgcc2.ready $(CONFIG_H) \
0990b8d9 1053 $(LIB2FUNCS_EXTRA) $(LANG_LIB2FUNCS) machmode.h longlong.h gbl-ctors.h \
1054 config.status
f1ad3130 1055 for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
1056 dir=`echo $$i | sed -e 's/;.*$$//'`; \
1057 flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
f1ad3130 1058 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
3ab62051 1059 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
00075505 1060 RANLIB="$(RANLIB)" RANLIB_TEST="$(RANLIB_TEST)" \
93ed8bee 1061 LANGUAGES="$(LANGUAGES)" \
f1ad3130 1062 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
00075505 1063 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" \
cdc96909 1064 MULTILIB_CFLAGS="$${flags}" \
00075505 1065 LIBGCC1="$(LIBGCC1)" LIBGCC2="$(LIBGCC2)" \
1066 dir="$${dir}" stmp-multilib-sub; \
ee4720a9 1067 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
f1ad3130 1068 done
1069 touch stmp-multilib
1070
00075505 1071# Subroutine of stmp-multilib so make -n works.
1072stmp-multilib-sub:
cdc96909 1073 rm -f $(LIBGCC2)
1074 if [ -d $(dir) ]; then \
1075 cd $(dir); \
1076 rm -f libgcc.a $(EXTRA_MULTILIB_PARTS); \
a123fd67 1077 else true; \
cdc96909 1078 fi
00075505 1079 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
3ab62051 1080 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
00075505 1081 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
93ed8bee 1082 LANGUAGES="$(LANGUAGES)" \
00075505 1083 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC2)
1084 if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
1085 then true; \
1086 else rm -f $(LIBGCC1); \
1087 fi
1088 if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
1089 then true; \
1090 else \
1091 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
3ab62051 1092 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
00075505 1093 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
93ed8bee 1094 LANGUAGES="$(LANGUAGES)" \
00075505 1095 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC1); \
1096 fi
1097 rm -rf tmplibgcc.a tmpcopy
1098 mkdir tmpcopy
1099 if [ x$(LIBGCC1) != x ]; \
1100 then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
1101 else true; \
1102 fi
1103 (cd tmpcopy; $(AR) x ../$(LIBGCC2))
601520ec 1104 (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *$(objext))
00075505 1105 rm -rf libgcc2.a tmpcopy
1106 if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
1107 if [ -d $(dir) ]; then true; else mkdir $(dir); fi
1108 mv tmplibgcc.a $(dir)/libgcc.a
cdc96909 1109 for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
1110 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
1111 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
1112 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
0d0b968b 1113 LANGUAGES="$(LANGUAGES)" \
cdc96909 1114 MULTILIB_CFLAGS="$(MULTILIB_CFLAGS)" T="t" t$${f}; \
1115 mv t$${f} $(dir)/$${f}; \
a123fd67 1116 else true; \
cdc96909 1117 fi; done
00075505 1118
32e6d418 1119# Compile two additional files that are linked with every program
6bcd7097 1120# linked using GCC on systems using COFF or ELF, for the sake of C++
1121# constructors.
cdc96909 1122$(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
6efd403b 1123 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
1124 -finhibit-size-directive -fno-inline-functions $(CRTSTUFF_T_CFLAGS) \
1125 -c $(srcdir)/crtstuff.c -DCRT_BEGIN -o $(T)crtbegin$(objext)
cdc96909 1126
1127$(T)crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
6efd403b 1128 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
1129 -finhibit-size-directive -fno-inline-functions $(CRTSTUFF_T_CFLAGS) \
1130 -c $(srcdir)/crtstuff.c -DCRT_END -o $(T)crtend$(objext)
6bcd7097 1131
1132# On some systems we also want to install versions of these files
1133# compiled using PIC for use in shared libraries.
1134crtbeginS.o crtendS.o: stamp-crtS ; @true
1135
1136stamp-crtS: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
5eef7030 1137 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \
6bcd7097 1138 -DCRT_BEGIN -finhibit-size-directive -fno-inline-functions \
5eef7030 1139 -g0 -c $(srcdir)/crtstuff.c
6bcd7097 1140 mv crtstuff$(objext) crtbeginS$(objext)
5eef7030 1141 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \
6bcd7097 1142 -DCRT_END -finhibit-size-directive -fno-inline-functions \
e5cfbd5b 1143 -g0 -c $(srcdir)/crtstuff.c -o crtendS$(objext)
6bcd7097 1144 touch stamp-crtS
4d3c962c 1145
1146# Compile the start modules crt0.o and mcrt0.o that are linked with every program
1147crt0.o: stamp-crt0 ; @true
1148mcrt0.o: stamp-crt0; @true
1149
1150stamp-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
1151 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
1152 -o crt0.o -c $(CRT0_S)
1153 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
1154 -o mcrt0.o -c $(MCRT0_S)
1155 touch stamp-crt0
2e9d8ccf 1156#\f
32e6d418 1157# Compiling object files from source files.
1158
1159# Note that dependencies on obstack.h are not written
1160# because that file is not part of GCC.
32e6d418 1161
1162# C language specific files.
1163
41b06fe4 1164c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
1165 $(srcdir)/c-parse.h c-tree.h input.h flags.h
32e6d418 1166 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
112e5dd0 1167$(srcdir)/c-parse.h: $(srcdir)/c-parse.c
1168$(srcdir)/c-parse.c: $(srcdir)/c-parse.y
ab2562cb 1169 cd $(srcdir); $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
0f557c81 1170$(srcdir)/c-parse.y: c-parse.in
04e167f4 1171 echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y
d7c691fa 1172 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
1173 -e "/^ifc$$/d" -e "/^end ifc$$/d" \
04e167f4 1174 $(srcdir)/c-parse.in >>tmp-c-parse.y
a58045a1 1175 $(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y
d7c691fa 1176
0f557c81 1177$(srcdir)/c-gperf.h: c-parse.gperf
6a4a0b58 1178 gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \
a58045a1 1179 $(srcdir)/c-parse.gperf >tmp-gperf.h
1180 $(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
6a4a0b58 1181
66a1f274 1182c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h output.h
1183c-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h output.h
32e6d418 1184c-lang.o : c-lang.c $(CONFIG_H) $(TREE_H)
41b06fe4 1185c-lex.o : c-lex.c $(CONFIG_H) $(TREE_H) c-lex.h c-tree.h $(srcdir)/c-parse.h \
917aa082 1186 input.h flags.h $(srcdir)/c-gperf.h c-pragma.h
32e6d418 1187c-aux-info.o : c-aux-info.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
1188c-convert.o : c-convert.c $(CONFIG_H) $(TREE_H) flags.h
2feda28e 1189c-pragma.o: c-pragma.c $(CONFIG_H) $(TREE_H) except.h function.h \
1190 defaults.h c-pragma.h
1294913b 1191c-iterate.o: c-iterate.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h flags.h
32e6d418 1192
79f818d0 1193# To make a configuration always use collect2, set USE_COLLECT2 to ld.
1194ld: collect2
f403cbcb 1195 rm -f ld$(exeext)
ea4a6c81 1196 $(LN) collect2$(exeext) ld$(exeext)
79f818d0 1197
94ca3aab 1198collect2: collect2.o tlink.o hash.o cplus-dem.o underscore.o version.o \
6c468b11 1199 choose-temp.o $(LIBDEPS)
e77fd588 1200# Don't try modifying collect2 (aka ld) in place--it might be linking this.
62268150 1201 -rm -f collect2$(exeext)
94ca3aab 1202 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ collect2.o tlink.o hash.o \
6c468b11 1203 cplus-dem.o underscore.o version.o choose-temp.o $(LIBS)
32e6d418 1204
d2f0b724 1205collect2.o : collect2.c $(CONFIG_H) gstab.h obstack.h demangle.h
5e03c63d 1206 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
67cb4bc1 1207 -DTARGET_MACHINE=\"$(target_alias)\" $(MAYBE_USE_COLLECT2) \
5e03c63d 1208 -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
32e6d418 1209
94ca3aab 1210tlink.o: tlink.c demangle.h hash.h $(CONFIG_H)
1211hash.o: hash.c hash.h
d2f0b724 1212cplus-dem.o: cplus-dem.c demangle.h
1213
7306ddcf 1214underscore.c: stamp-under ; @true
1215
1216stamp-under: $(GCC_PASSES)
c20b28d5 1217 echo "int xxy_us_dummy;" >tmp-dum.c
1218 $(GCC_FOR_TARGET) -S tmp-dum.c
1219 echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c
1220 if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \
1221 echo "int prepends_underscore = 1;" >>tmp-under.c; \
d2f0b724 1222 else \
c20b28d5 1223 echo "int prepends_underscore = 0;" >>tmp-under.c; \
d2f0b724 1224 fi
c20b28d5 1225 $(srcdir)/move-if-change tmp-under.c underscore.c
1226 -rm -f tmp-dum.c tmp-dum.s
7306ddcf 1227 touch stamp-under
d2f0b724 1228
32e6d418 1229# A file used by all variants of C.
1230
1231c-common.o : c-common.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
1232
1233# Language-independent files.
1234
4813bdd4 1235DRIVER_DEFINES = \
32e6d418 1236 -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
c6396a0b 1237 -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
7df9e578 1238 -DDEFAULT_TARGET_VERSION=\"$(version)\" \
67cb4bc1 1239 -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \
4813bdd4 1240 -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\"
3ded972d 1241gcc.o: gcc.c $(CONFIG_H) multilib.h Makefile $(lang_specs_files)
4813bdd4 1242 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1243 $(DRIVER_DEFINES) \
32e6d418 1244 -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
1245
1246dumpvers: dumpvers.c
1247
1248version.o: version.c
1249obstack.o: obstack.c
6c468b11 1250choose-temp.o: choose-temp.c
c90a87d1 1251pexecute.o: pexecute.c
32e6d418 1252
beb68ac1 1253convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h
1254
335ebf8f 1255tree.o : tree.c $(CONFIG_H) $(TREE_H) flags.h function.h
32e6d418 1256print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
a6a1ab64 1257stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) flags.h function.h
32e6d418 1258fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h
636fef92 1259toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) bytecode.h bc-emit.h \
1260 flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \
1261 $(lang_options_files)
b600804e 1262 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
67cb4bc1 1263 -DTARGET_NAME=\"$(target_alias)\" \
fe918d35 1264 -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
32e6d418 1265
1266rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
1267
1268print-rtl.o : print-rtl.c $(CONFIG_H) $(RTL_H)
1269rtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
1270
35325097 1271varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h function.h \
66a1f274 1272 defaults.h insn-codes.h expr.h hard-reg-set.h regs.h xcoffout.h \
917aa082 1273 output.h bytecode.h c-pragma.h
32e6d418 1274function.o : function.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
1275 insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
d9bf0cf4 1276 recog.h output.h bytecode.h bc-emit.h
32e6d418 1277stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
037a5228 1278 insn-flags.h insn-config.h insn-codes.h hard-reg-set.h expr.h except.h \
1279 loop.h recog.h bytecode.h bc-typecd.h bc-typecd.def bc-opcode.h \
1280 bc-optab.h bc-emit.h
1281except.o : except.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
1282 insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
1283 recog.h output.h except.h
93ad9ce9 1284expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h regs.h \
e83ee760 1285 insn-flags.h insn-codes.h expr.h insn-config.h recog.h output.h \
1286 typeclass.h bytecode.h bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h \
9af573e1 1287 bc-emit.h modemap.def hard-reg-set.h
32e6d418 1288calls.o : calls.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-codes.h \
335ebf8f 1289 insn-flags.h
32e6d418 1290expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
1291 insn-flags.h insn-config.h insn-codes.h expr.h recog.h real.h
1292explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h hard-reg-set.h \
1293 insn-config.h expr.h recog.h insn-flags.h insn-codes.h
1294optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
a8a33ff5 1295 insn-flags.h insn-config.h insn-codes.h expr.h recog.h reload.h
32e6d418 1296dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h regs.h \
e7748130 1297 insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h
f95d8264 1298sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h except.h \
1299 function.h expr.h output.h hard-reg-set.h regs.h defaults.h real.h \
1a4c478d 1300 insn-config.h bytecode.h obstack.h xcoffout.h c-pragma.h
32e6d418 1301dwarfout.o : dwarfout.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf.h flags.h \
8a19d0d5 1302 insn-config.h reload.h output.h defaults.h
632478b5 1303dwarf2out.o : dwarf2out.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf2.h flags.h \
2abfb408 1304 insn-config.h reload.h output.h defaults.h hard-reg-set.h regs.h expr.h
79f818d0 1305xcoffout.o : xcoffout.c $(CONFIG_H) $(TREE_H) $(RTL_H) xcoffout.h flags.h
335ebf8f 1306emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
5e93c400 1307 function.h regs.h insn-config.h insn-codes.h real.h expr.h bytecode.h \
1308 bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h bc-emit.h bc-opname.h
6d9f2c4c 1309real.o : real.c $(CONFIG_H) $(TREE_H)
c6396a0b 1310getpwd.o : getpwd.c $(CONFIG_H)
32e6d418 1311
1312integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h integrate.h \
beed1a9f 1313 insn-flags.h insn-config.h insn-codes.h expr.h real.h regs.h function.h \
832bfff4 1314 bytecode.h
32e6d418 1315
1316jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
1317 insn-config.h insn-flags.h insn-codes.h expr.h real.h
1318stupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h
1319
1320cse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h real.h \
1321 insn-config.h recog.h
2b55270a 1322profile.o : profile.c $(CONFIG_H) $(RTL_H) flags.h insn-flags.h gcov-io.h \
1323 tree.h output.h
32e6d418 1324loop.o : loop.c $(CONFIG_H) $(RTL_H) flags.h loop.h insn-config.h \
1325 insn-flags.h insn-codes.h regs.h hard-reg-set.h recog.h expr.h real.h
1326unroll.o : unroll.c $(CONFIG_H) $(RTL_H) insn-config.h insn-codes.h \
1327 integrate.h regs.h flags.h expr.h loop.h
1328flow.o : flow.c $(CONFIG_H) $(RTL_H) flags.h insn-config.h \
8f220b93 1329 $(BASIC_BLOCK_H) regs.h hard-reg-set.h output.h
335ebf8f 1330combine.o : combine.c $(CONFIG_H) $(RTL_H) flags.h \
32e6d418 1331 insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \
8f220b93 1332 $(BASIC_BLOCK_H) recog.h real.h hard-reg-set.h
32e6d418 1333regclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
8f220b93 1334 $(BASIC_BLOCK_H) regs.h insn-config.h recog.h reload.h real.h bytecode.h
1335local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h $(BASIC_BLOCK_H) \
32e6d418 1336 regs.h hard-reg-set.h insn-config.h recog.h output.h
8f220b93 1337bitmap.o : bitmap.c $(CONFIG_H) $(RTL_H) flags.h $(BASIC_BLOCK_H) regs.h
8a4b1e01 1338global.o : global.c $(CONFIG_H) $(RTL_H) flags.h \
8f220b93 1339 $(BASIC_BLOCK_H) regs.h hard-reg-set.h insn-config.h output.h
32e6d418 1340
64016d24 1341reload.o : reload.c $(CONFIG_H) $(RTL_H) flags.h output.h expr.h\
32e6d418 1342 reload.h recog.h hard-reg-set.h insn-config.h insn-codes.h regs.h real.h
067fa30b 1343reload1.o : reload1.c $(CONFIG_H) $(RTL_H) real.h flags.h expr.h \
32e6d418 1344 reload.h regs.h hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
8f220b93 1345 $(BASIC_BLOCK_H) recog.h output.h
32e6d418 1346caller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \
8f220b93 1347 regs.h hard-reg-set.h insn-codes.h insn-config.h $(BASIC_BLOCK_H) recog.h \
f8de8de7 1348 reload.h expr.h
32e6d418 1349reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
8f220b93 1350 $(BASIC_BLOCK_H) regs.h insn-config.h insn-attr.h insn-flags.h recog.h \
32e6d418 1351 flags.h output.h
ea0cb7ae 1352alias.o : alias.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
1353 insn-codes.h
3eb9a99d 1354regmove.o : regmove.c $(CONFIG_H) $(RTL_H) insn-config.h recog.h output.h \
1355 reload.h regs.h hard-reg-set.h flags.h expr.h insn-flags.h
1356$(SCHED_PREFIX)sched.o : $(SCHED_PREFIX)sched.c $(CONFIG_H) $(RTL_H) $(BASIC_BLOCK_H) regs.h hard-reg-set.h \
32e6d418 1357 flags.h insn-config.h insn-attr.h
335ebf8f 1358final.o : final.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h regs.h \
037a5228 1359 recog.h conditions.h insn-config.h insn-attr.h except.h real.h output.h \
fe918d35 1360 hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
32e6d418 1361recog.o : recog.c $(CONFIG_H) $(RTL_H) \
1362 regs.h recog.h hard-reg-set.h flags.h insn-config.h insn-attr.h \
1363 insn-flags.h insn-codes.h real.h
1364reg-stack.o : reg-stack.c $(CONFIG_H) $(RTL_H) $(TREE_H) \
d9bf0cf4 1365 regs.h hard-reg-set.h flags.h insn-config.h insn-flags.h
48c6936b 1366
5e7432f7 1367$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \
32e6d418 1368 $(RTL_H) regs.h hard-reg-set.h real.h insn-config.h conditions.h \
1369 insn-flags.h output.h insn-attr.h insn-codes.h
b600804e 1370 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file)
32e6d418 1371
f213fcf9 1372# Build auxiliary files that support ecoff format.
1373mips-tfile: mips-tfile.o version.o $(LIBDEPS)
62268150 1374 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS)
f213fcf9 1375
1376mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H)
1377
1378mips-tdump: mips-tdump.o version.o $(LIBDEPS)
62268150 1379 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tdump.o version.o $(LIBS)
f213fcf9 1380
1381mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H)
1382
636b182c 1383# Build file to support OSF/rose half-pic format.
1384halfpic.o: halfpic.c $(CONFIG_H) $(RTL_H) $(TREE_H)
1385
32e6d418 1386# Normally this target is not used; but it is used if you
1387# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
1388# from the GNU Emacs distribution.
32e6d418 1389alloca.o: alloca.c
32e6d418 1390 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
cc2af6ca 1391 -c `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
32e6d418 1392 $(ALLOCA_FINISH)
2e9d8ccf 1393#\f
32e6d418 1394# Generate header and source files from the machine description,
1395# and compile them.
1396
1397.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
1398 insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
1399 insn-attr.h insn-attrtab.c
1400
1401# The following pair of rules has this effect:
1402# genconfig is run only if the md has changed since genconfig was last run;
1403# but the file insn-config.h is touched only when its contents actually change.
1404
1405# Each of the other insn-* files is handled by a similar pair of rules.
1406
3f69fed5 1407# This causes an anomaly in the results of make -n
1408# because insn-* is older than stamp-*
1409# and thus make -n thinks that insn-* will be updated
1410# and force recompilation of things that depend on it.
9ac790c5 1411# We use move-if-change precisely to avoid such recompilation.
3f69fed5 1412# But there is no way to teach make -n that it will be avoided.
1413
32e6d418 1414# Each of the insn-*.[ch] rules has a semicolon at the end,
1415# for otherwise the system Make on SunOS 4.1 never tries
876dc5b0 1416# to recompile insn-*.o. To avoid problems and extra noise from
1417# versions of make which don't like empty commands (nothing after the
1418# trailing `;'), we call true for each.
32e6d418 1419
c2a18965 1420insn-config.h: stamp-config ; @true
c20b28d5 1421stamp-config : $(md_file) genconfig $(srcdir)/move-if-change
1422 ./genconfig $(md_file) > tmp-config.h
32e6d418 1423 $(srcdir)/move-if-change tmp-config.h insn-config.h
1424 touch stamp-config
1425
c2a18965 1426insn-flags.h: stamp-flags ; @true
c20b28d5 1427stamp-flags : $(md_file) genflags $(srcdir)/move-if-change
1428 ./genflags $(md_file) > tmp-flags.h
32e6d418 1429 $(srcdir)/move-if-change tmp-flags.h insn-flags.h
1430 touch stamp-flags
1431
c2a18965 1432insn-codes.h: stamp-codes ; @true
c20b28d5 1433stamp-codes : $(md_file) gencodes $(srcdir)/move-if-change
1434 ./gencodes $(md_file) > tmp-codes.h
32e6d418 1435 $(srcdir)/move-if-change tmp-codes.h insn-codes.h
1436 touch stamp-codes
1437
1438insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h real.h output.h \
1439 insn-config.h insn-flags.h insn-codes.h
1440 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
1441
c2a18965 1442insn-emit.c: stamp-emit ; @true
c20b28d5 1443stamp-emit : $(md_file) genemit $(srcdir)/move-if-change
1444 ./genemit $(md_file) > tmp-emit.c
32e6d418 1445 $(srcdir)/move-if-change tmp-emit.c insn-emit.c
1446 touch stamp-emit
1447
1448insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h recog.h \
1449 real.h output.h flags.h
1450 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
1451
c2a18965 1452insn-recog.c: stamp-recog ; @true
c20b28d5 1453stamp-recog : $(md_file) genrecog $(srcdir)/move-if-change
1454 ./genrecog $(md_file) > tmp-recog.c
32e6d418 1455 $(srcdir)/move-if-change tmp-recog.c insn-recog.c
1456 touch stamp-recog
1457
bdb66cef 1458insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
1459 insn-config.h flags.h rtl.h recog.h expr.h reload.h
1460 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
1461
1462insn-opinit.c: stamp-opinit ; @true
c20b28d5 1463stamp-opinit : $(md_file) genopinit $(srcdir)/move-if-change
1464 ./genopinit $(md_file) > tmp-opinit.c
bdb66cef 1465 $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
1466 touch stamp-opinit
1467
32e6d418 1468insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H)
1469 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
1470
c2a18965 1471insn-extract.c: stamp-extract ; @true
c20b28d5 1472stamp-extract : $(md_file) genextract $(srcdir)/move-if-change
1473 ./genextract $(md_file) > tmp-extract.c
32e6d418 1474 $(srcdir)/move-if-change tmp-extract.c insn-extract.c
1475 touch stamp-extract
1476
1477insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h output.h real.h
1478 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
1479
c2a18965 1480insn-peep.c: stamp-peep ; @true
c20b28d5 1481stamp-peep : $(md_file) genpeep $(srcdir)/move-if-change
1482 ./genpeep $(md_file) > tmp-peep.c
32e6d418 1483 $(srcdir)/move-if-change tmp-peep.c insn-peep.c
1484 touch stamp-peep
1485
1486insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) regs.h real.h output.h \
1487 insn-attr.h insn-config.h
1488 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
1489
c2a18965 1490insn-attr.h: stamp-attr ; @true
c20b28d5 1491stamp-attr : $(md_file) genattr $(srcdir)/move-if-change
1492 ./genattr $(md_file) > tmp-attr.h
32e6d418 1493 $(srcdir)/move-if-change tmp-attr.h insn-attr.h
1494 touch stamp-attr
1495
c2a18965 1496insn-attrtab.c: stamp-attrtab ; @true
c20b28d5 1497stamp-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change
1498 if cmp -s $(PREMADE_ATTRTAB_MD) $(md_file); \
8bd8ea06 1499 then \
1500 echo Using $(PREMADE_ATTRTAB); \
ab866dde 1501 cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \
8bd8ea06 1502 else \
c20b28d5 1503 ./genattrtab $(md_file) > tmp-attrtab.c; \
8bd8ea06 1504 fi
32e6d418 1505 $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
1506 touch stamp-attrtab
1507
1508insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
1509 hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h recog.h \
1510 insn-codes.h
1511 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
1512
c2a18965 1513insn-output.c: stamp-output ; @true
c20b28d5 1514stamp-output : $(md_file) genoutput $(srcdir)/move-if-change
1515 ./genoutput $(md_file) > tmp-output.c
32e6d418 1516 $(srcdir)/move-if-change tmp-output.c insn-output.c
1517 touch stamp-output
2e9d8ccf 1518#\f
32e6d418 1519# Compile the programs that generate insn-* from the machine description.
1520# They are compiled with $(HOST_CC), and associated libraries,
1521# since they need to run on this machine
1522# even if GCC is being compiled to run on some other machine.
1523
1524# $(CONFIG_H) is omitted from the deps of the gen*.o
1525# because these programs don't really depend on anything
1526# about the target machine. They do depend on config.h itself,
1527# since that describes the host machine.
1528
89e36a04 1529# Pass the md file through cpp if the target requests it.
2c352995 1530$(MD_FILE): $(MD_DEPS)
1531 rm -f $@
c20b28d5 1532 $(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@
c92e16d4 1533 mv tmp-$@ $@
89e36a04 1534
32e6d418 1535genconfig : genconfig.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1536 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1537 genconfig.o $(HOST_RTL) $(HOST_LIBS)
1538
c20b28d5 1539genconfig.o : genconfig.c $(RTL_H) $(build_xm_file)
32e6d418 1540 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
1541
1542genflags : genflags.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1543 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1544 genflags.o $(HOST_RTL) $(HOST_LIBS)
1545
c20b28d5 1546genflags.o : genflags.c $(RTL_H) $(build_xm_file)
32e6d418 1547 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
1548
1549gencodes : gencodes.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1550 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1551 gencodes.o $(HOST_RTL) $(HOST_LIBS)
1552
c20b28d5 1553gencodes.o : gencodes.c $(RTL_H) $(build_xm_file)
32e6d418 1554 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
1555
1556genemit : genemit.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1557 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1558 genemit.o $(HOST_RTL) $(HOST_LIBS)
1559
c20b28d5 1560genemit.o : genemit.c $(RTL_H) $(build_xm_file)
32e6d418 1561 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
1562
bdb66cef 1563genopinit : genopinit.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1564 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
bdb66cef 1565 genopinit.o $(HOST_RTL) $(HOST_LIBS)
1566
c20b28d5 1567genopinit.o : genopinit.c $(RTL_H) $(build_xm_file)
bdb66cef 1568 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
1569
32e6d418 1570genrecog : genrecog.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1571 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1572 genrecog.o $(HOST_RTL) $(HOST_LIBS)
1573
c20b28d5 1574genrecog.o : genrecog.c $(RTL_H) $(build_xm_file)
32e6d418 1575 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
1576
1577genextract : genextract.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1578 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1579 genextract.o $(HOST_RTL) $(HOST_LIBS)
1580
c20b28d5 1581genextract.o : genextract.c $(RTL_H) $(build_xm_file) insn-config.h
32e6d418 1582 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
1583
1584genpeep : genpeep.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1585 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1586 genpeep.o $(HOST_RTL) $(HOST_LIBS)
1587
c20b28d5 1588genpeep.o : genpeep.c $(RTL_H) $(build_xm_file)
32e6d418 1589 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
1590
1591genattr : genattr.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1592 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1593 genattr.o $(HOST_RTL) $(HOST_LIBS)
1594
c20b28d5 1595genattr.o : genattr.c $(RTL_H) $(build_xm_file)
32e6d418 1596 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
1597
262d46de 1598genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
62268150 1599 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
262d46de 1600 genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
32e6d418 1601
c20b28d5 1602genattrtab.o : genattrtab.c $(RTL_H) $(build_xm_file) insn-config.h
32e6d418 1603 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
1604
1605genoutput : genoutput.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1606 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1607 genoutput.o $(HOST_RTL) $(HOST_LIBS)
1608
c20b28d5 1609genoutput.o : genoutput.c $(RTL_H) $(build_xm_file)
32e6d418 1610 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
2e9d8ccf 1611#\f
32e6d418 1612# Compile the libraries to be used by gen*.
1613# If we are not cross-building, gen* use the same .o's that cc1 will use,
1614# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
1615# with the rules for rtl.o, alloca.o, etc.
1616$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) $(RTL_H)
1617 rm -f $(HOST_PREFIX)rtl.c
e77fd588 1618 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
32e6d418 1619 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
1620
262d46de 1621$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H)
1622 rm -f $(HOST_PREFIX)print-rtl.c
e77fd588 1623 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
262d46de 1624 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
1625
32e6d418 1626$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
1627 rm -f $(HOST_PREFIX)rtlanal.c
e77fd588 1628 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
32e6d418 1629 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
1630
1631$(HOST_PREFIX_1)alloca.o: alloca.c
1632 rm -f $(HOST_PREFIX)alloca.c
1633 cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
1634 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
1635
1636$(HOST_PREFIX_1)obstack.o: obstack.c
1637 rm -f $(HOST_PREFIX)obstack.c
e77fd588 1638 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/obstack.c > $(HOST_PREFIX)obstack.c
32e6d418 1639 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
1640
1641$(HOST_PREFIX_1)malloc.o: malloc.c
1642 rm -f $(HOST_PREFIX)malloc.c
e77fd588 1643 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
32e6d418 1644 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
1645
1646# This satisfies the dependency that we get if you cross-compile a compiler
1647# that does not need to compile alloca, malloc or whatever.
1648$(HOST_PREFIX_1):
1649 touch $(HOST_PREFIX_1)
2e9d8ccf 1650#\f
649d8da6 1651# Remake bytecode files.
649d8da6 1652BI_OBJ=bi-parser.o bi-lexer.o bi-reverse.o
1653
7e20ea39 1654bc-emit.o : bc-emit.c $(CONFIG_H) $(RTL_H) real.h $(BYTECODE_H) \
62268150 1655 bc-arity.h bc-opcode.h bc-typecd.h bc-typecd.def bi-run.h bytetypes.h
7e20ea39 1656bc-optab.o : bc-optab.c $(CONFIG_H) $(REAL_H) $(BYTECODE_H) \
62268150 1657 bc-opcode.h bc-typecd.h bc-typecd.def
649d8da6 1658
7e20ea39 1659bi-arity: bi-arity.o $(BI_OBJ) $(HOST_LIBDEPS)
62268150 1660 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
c3eff1f2 1661 bi-arity.o $(BI_OBJ) $(HOST_LIBS)
7e20ea39 1662bi-opcode: bi-opcode.o $(BI_OBJ) $(HOST_LIBDEPS)
62268150 1663 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
c3eff1f2 1664 bi-opcode.o $(BI_OBJ) $(HOST_LIBS)
7e20ea39 1665bi-opname: bi-opname.o $(BI_OBJ) $(HOST_LIBDEPS)
62268150 1666 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
c3eff1f2 1667 bi-opname.o $(BI_OBJ) $(HOST_LIBS)
7e20ea39 1668
112e5dd0 1669$(srcdir)/bi-parser.h: $(srcdir)/bi-parser.c
1670$(srcdir)/bi-parser.c: $(srcdir)/bi-parser.y
7e20ea39 1671 cd $(srcdir); $(BISON) $(BISONFLAGS) -d bi-parser.y -o bi-parser.c
62268150 1672
0f557c81 1673bi-parser.o: $(srcdir)/bi-parser.c bi-defs.h $(build_xm_file)
7e20ea39 1674 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1675 $(srcdir)/bi-parser.c
0f557c81 1676bi-lexer.o: bi-lexer.c $(srcdir)/bi-parser.h $(build_xm_file)
7e20ea39 1677 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1678 $(srcdir)/bi-lexer.c
62268150 1679bi-arity.o: bi-arity.c bi-defs.h $(build_xm_file)
7e20ea39 1680 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1681 $(srcdir)/bi-arity.c
62268150 1682bi-opcode.o: bi-opcode.c bi-defs.h $(build_xm_file)
7e20ea39 1683 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1684 $(srcdir)/bi-opcode.c
62268150 1685bi-opname.o: bi-opname.c bi-defs.h $(build_xm_file)
7e20ea39 1686 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1687 $(srcdir)/bi-opname.c
62268150 1688bi-reverse.o: bi-reverse.c bi-defs.h
7e20ea39 1689 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1690 $(srcdir)/bi-reverse.c
832bfff4 1691
e6baec2f 1692bc-arity.h: stamp-bcarity ; @true
1693stamp-bcarity : $(srcdir)/bytecode.def bi-arity $(srcdir)/move-if-change
e78095bc 1694 ./bi-arity < $(srcdir)/bytecode.def >tmp-bc-arity.h
1695 $(srcdir)/move-if-change tmp-bc-arity.h bc-arity.h
675fc1b6 1696 touch stamp-bcarity
649d8da6 1697
e6baec2f 1698bc-opcode.h: stamp-bcopcode ; @true
1699stamp-bcopcode : $(srcdir)/bytecode.def bi-opcode $(srcdir)/move-if-change
f698a3d1 1700 ./bi-opcode < $(srcdir)/bytecode.def >tmp-bcopcd.h
1701 $(srcdir)/move-if-change tmp-bcopcd.h bc-opcode.h
675fc1b6 1702 touch stamp-bcopcode
649d8da6 1703
e6baec2f 1704bc-opname.h: stamp-bcopname ; @true
1705stamp-bcopname : $(srcdir)/bytecode.def bi-opname $(srcdir)/move-if-change
f698a3d1 1706 ./bi-opname < $(srcdir)/bytecode.def >tmp-bcopnm.h
1707 $(srcdir)/move-if-change tmp-bcopnm.h bc-opname.h
675fc1b6 1708 touch stamp-bcopname
649d8da6 1709
1710bytecode.mostlyclean:
1711 -rm -f bc-arity.h bc-opcode.h bc-opname.h
1712
1713bytecode.distclean bytecode.clean: bytecode.mostlyclean
7e20ea39 1714 -rm -f bi-arity bi-opcode bi-opname bi-lexer
649d8da6 1715
a8514488 1716bytecode.maintainer-clean: bytecode.clean
91cbf3f1 1717 -rm -f bi-parser.c bi-parser.h
649d8da6 1718
2e9d8ccf 1719#\f
32e6d418 1720# Remake cpp and protoize.
1721
1722# Making the preprocessor
3e4227af 1723cpp: $(CCCP)
f403cbcb 1724 -rm -f cpp$(exeext)
ea4a6c81 1725 $(LN) $(CCCP)$(exeext) cpp$(exeext)
32e6d418 1726cccp: cccp.o cexp.o version.o $(LIBDEPS)
62268150 1727 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cccp.o cexp.o \
1728 version.o $(LIBS)
0f557c81 1729cexp.o: $(srcdir)/cexp.c $(CONFIG_H)
32e6d418 1730 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
1731$(srcdir)/cexp.c: $(srcdir)/cexp.y
1732 cd $(srcdir); $(BISON) -o cexp.c cexp.y
62268150 1733
d6b50af2 1734cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status
32e6d418 1735# The reason we use $(libdir)/g++-include rather than using libsubdir
1736# is for compatibility with the current version of libg++.
1737 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
c6396a0b 1738 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1739 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
ac2f5cba 1740 -DOLD_GPLUSPLUS_INCLUDE_DIR=\"$(old_gxx_include_dir)\" \
9a4f2cdd 1741 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
c6396a0b 1742 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1743 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
32e6d418 1744 -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
1745
3e4227af 1746cppmain: cppmain.o cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o \
1747 version.o $(LIBDEPS)
62268150 1748 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cppmain.o cpplib.o cpphash.o \
1749 cppalloc.o cpperror.o cppexp.o version.o $(LIBS)
3e4227af 1750
f03d7bcd 1751cppmain.o: cppmain.c $(CONFIG_H) cpplib.h
1752
7d1e7284 1753cpplib.o: cpplib.c $(CONFIG_H) cpplib.h cpphash.h config.status
3e4227af 1754 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1755 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
1756 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
ac2f5cba 1757 -DOLD_GPLUSPLUS_INCLUDE_DIR=\"$(old_gxx_include_dir)\" \
3e4227af 1758 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
1759 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
1760 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
1761 -c `echo $(srcdir)/cpplib.c | sed 's,^\./,,'`
1762
7d1e7284 1763cpperror.o: cpperror.c $(CONFIG_H) cpplib.h
1764
1765cppexp.o: cppexp.c $(CONFIG_H) cpplib.h
1766
1767cpphash.o: cpphash.c cpplib.h cpphash.h
1768
885be33e 1769cppalloc.o: cppalloc.c $(CONFIG_H)
1770
876dc5b0 1771# Note for the stamp targets, we run the program `true' instead of
1772# having an empty command (nothing following the semicolon).
1773
732b8330 1774proto: config.status protoize unprotoize SYSCALLS.c.X
32e6d418 1775
c90a87d1 1776protoize: protoize.o getopt.o getopt1.o getpwd.o version.o \
1777 pexecute.o choose-temp.o $(LIBDEPS)
62268150 1778 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
c90a87d1 1779 protoize.o getopt.o getopt1.o getpwd.o version.o \
1780 pexecute.o choose-temp.o $(LIBS)
c2a18965 1781protoize.o: stamp-proto ; @true
ab866dde 1782
c90a87d1 1783unprotoize: unprotoize.o getopt.o getopt1.o getpwd.o version.o \
1784 pexecute.o choose-temp.o $(LIBDEPS)
62268150 1785 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
c90a87d1 1786 unprotoize.o getopt.o getopt1.o getpwd.o version.o \
1787 pexecute.o choose-temp.o $(LIBS)
c2a18965 1788unprotoize.o: stamp-proto ; @true
ab866dde 1789
62268150 1790stamp-proto: protoize.c getopt.h $(CONFIG_H)
32e6d418 1791 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1792 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1793 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
32e6d418 1794 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1795 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
9a4f2cdd 1796 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
32e6d418 1797 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
ab866dde 1798 -DUNPROTOIZE $(srcdir)/protoize.c
62268150 1799 mv protoize$(objext) unprotoize$(objext)
32e6d418 1800 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1801 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1802 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
32e6d418 1803 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1804 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
9a4f2cdd 1805 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
32e6d418 1806 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
ab866dde 1807 $(srcdir)/protoize.c
77a164d8 1808 touch stamp-proto
32e6d418 1809
62268150 1810getopt.o: getopt.c getopt.h
32e6d418 1811 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt.c
62268150 1812getopt1.o: getopt1.c getopt.h
32e6d418 1813 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt1.c
1814
32e6d418 1815# This info describes the target machine, so compile with GCC just built.
62268150 1816SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \
1817 stmp-int-hdrs
f678532a 1818 -rm -f SYSCALLS.c tmp-SYSCALLS.s
79f818d0 1819 cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
32e6d418 1820 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
f678532a 1821 -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
1822 -rm -f SYSCALLS.c tmp-SYSCALLS.s
0b20f012 1823
a5889b74 1824
0b20f012 1825test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
c548e550 1826 -rm -f tmp-proto.[cso]
262d46de 1827 cp $(srcdir)/protoize.c tmp-proto.c
1828 chmod u+w tmp-proto.c
c548e550 1829 ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1830 $(CFLAGS) $(INCLUDES) \
0b20f012 1831 -DGCC_INCLUDE_DIR=0 \
1832 -DGPLUSPLUS_INCLUDE_DIR=0 \
1833 -DCROSS_INCLUDE_DIR=0 \
46073b39 1834 -DTOOL_INCLUDE_DIR=0 \
262d46de 1835 -DSTD_PROTO_DIR=0" tmp-proto.c
1a754c64 1836 @echo '**********' Expect 400 lines of differences.
c548e550 1837 -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
1838 -wc -l tmp-proto.diff
1839 ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1840 $(CFLAGS) $(INCLUDES) \
0b20f012 1841 -DGCC_INCLUDE_DIR=0 \
1842 -DGPLUSPLUS_INCLUDE_DIR=0 \
1843 -DCROSS_INCLUDE_DIR=0 \
46073b39 1844 -DTOOL_INCLUDE_DIR=0 \
262d46de 1845 -DSTD_PROTO_DIR=0" tmp-proto.c
0b20f012 1846 @echo Expect zero differences.
262d46de 1847 diff $(srcdir)/protoize.c tmp-proto.c | cat
62268150 1848 -rm -f tmp-proto.[cs] tmp-proto$(objext)
2b55270a 1849
1850gcov.o: gcov.c gcov-io.h
1851
1852gcov: gcov.o $(LIBDEPS)
1853 $(CC) $(ALL_CFLAGS) $(LDFLAGS) gcov.o $(LIBS) -o $@
2e9d8ccf 1854#\f
2cfd79fe 1855# Build the include directory. The stamp files are stmp-* rather than
1856# stamp-* so that mostlyclean does not force the include directory to
1857# be rebuilt.
1858
690a93ea 1859# Build the include directory except for float.h (which depends upon
1860# enquire).
8757933b 1861stmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h
2cfd79fe 1862# Copy in the headers provided with gcc.
1863# The sed command gets just the last file name component;
1864# this is necessary because VPATH could add a dirname.
1865# Using basename would be simpler, but some systems don't have it.
c8763215 1866 for file in .. $(USER_H); do \
1867 if [ X$$file != X.. ]; then \
1868 realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
1941d7da 1869 rm -f include/$$realfile; \
1870 cp $$file include; \
1871 chmod a+r include/$$realfile; \
c8763215 1872 fi; \
2cfd79fe 1873 done
b5850e21 1874 rm -f include/limits.h
2cfd79fe 1875 cp xlimits.h include/limits.h
1876 chmod a+r include/limits.h
2cfd79fe 1877# Install the README
b5850e21 1878 rm -f include/README
2cfd79fe 1879 cp $(srcdir)/README-fixinc include/README
1880 chmod a+r include/README
690a93ea 1881 touch stmp-int-hdrs
1882
1883# Build the complete include directory.
1884stmp-headers: stmp-int-hdrs gfloat.h
1885 rm -f include/float.h
1886 cp gfloat.h include/float.h
1887 chmod a+r include/float.h
2cfd79fe 1888 touch stmp-headers
1889
1890# Build fixed copies of system files.
62268150 1891stmp-fixinc: $(FIXINCLUDES) gsyslimits.h
2cfd79fe 1892 rm -rf include
1893 mkdir include
92d223d1 1894 if [ x$(FIXINCLUDES) != xMakefile.in ]; \
6848a9c6 1895 then \
1896 for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
1897 if [ -d $$dir ]; \
1898 then \
cee3b7e3 1899 $(SHELL) $(srcdir)/$(FIXINCLUDES) include $$dir; \
6848a9c6 1900 else true; fi; \
92d223d1 1901 done; \
6848a9c6 1902 else true; \
1903 fi
b7d4d520 1904 rm -f include/syslimits.h
1905 if [ -f include/limits.h ]; then \
1906 mv include/limits.h include/syslimits.h; \
1907 else \
1908 cp $(srcdir)/gsyslimits.h include/syslimits.h; \
1909 fi
1910 chmod a+r include/syslimits.h
9e74f24f 1911 touch stmp-fixinc
7c4f0e88 1912
a5889b74 1913# Files related to the fixproto script.
1914
047c2b8b 1915deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
f55e1a13 1916 CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -Iinclude -I${SYSTEM_HEADER_DIR}"; \
a5889b74 1917 export CC; \
6518b023 1918 $(SHELL) $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h
a5889b74 1919 mv tmp-deduced.h deduced.h
1920
ff8281e4 1921gen-protos: gen-protos.o scan.o cppalloc.o $(HOST_LIBDEPS)
62268150 1922 ${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
ff8281e4 1923 gen-protos.o scan.o cppalloc.o $(HOST_LIBS)
a5889b74 1924
c20b28d5 1925gen-protos.o: gen-protos.c scan.h $(build_xm_file)
c68462d9 1926 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c
1927
c20b28d5 1928scan.o: scan.c scan.h $(build_xm_file)
c68462d9 1929 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c
9541a717 1930
047c2b8b 1931xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
c92e16d4 1932 cat deduced.h $(srcdir)/sys-protos.h > tmp-fixtmp.c
1933 mv tmp-fixtmp.c fixtmp.c
2f9d2927 1934 $(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
6fc3eafd 1935 | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
c92e16d4 1936 | ./gen-protos >xsys-protos.hT
1937 mv xsys-protos.hT xsys-protos.h
d7c4552e 1938 rm -rf fixtmp.c
a5889b74 1939
62268150 1940fix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS) \
1941 cpplib.o cpphash.o cppalloc.o cppexp.o cpperror.o version.o
1942 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ fix-header.o \
1943 scan-decls.o scan.o cpplib.o cpphash.o cppalloc.o version.o \
1944 cppexp.o $(HOST_LIBS)
a5889b74 1945
9d6a1aa2 1946fix-header.o: fix-header.c obstack.h scan.h xsys-protos.h $(build_xm_file)
c68462d9 1947 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c
1948
caf36bd8 1949scan-decls.o: scan-decls.c scan.h cpplib.h $(build_xm_file)
c68462d9 1950 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c
a5889b74 1951
047c2b8b 1952# stmp-fixproto depends on this, not on fix-header directly.
1953# The idea is to make sure fix-header gets built,
1954# but not rerun fixproto after each stage
1955# just because fix-header's mtime has changed.
1956fixhdr.ready: fix-header
1957 -if [ -f fixhdr.ready ] ; then \
1958 true; \
1959 else \
1960 touch fixhdr.ready; \
1961 fi
1962
7bf27989 1963# stmp-headers is to make sure fixincludes has already finished.
276709eb 1964# The if statement is so that we don't run fixproto a second time
1965# if it has already been run on the files in `include'.
6a0b7b7c 1966stmp-fixproto: fixhdr.ready fixproto stmp-headers
2deaa28d 1967 @echo "Various warnings and error messages from fixproto are normal"
4fbc622f 1968 -if [ -d include ] ; then true; else mkdir include; fi
b948f736 1969 -if [ -f include/fixed ] ; then true; \
276709eb 1970 else \
6f1f992e 1971 : This line works around a 'make' bug in BSDI 1.1.; \
ff8281e4 1972 FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
1973 $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
276709eb 1974 touch include/fixed; \
1975 fi
a5889b74 1976 touch stmp-fixproto
2e9d8ccf 1977#\f
32e6d418 1978# Remake the info files.
1979
627defc4 1980doc: info
17b258fe 1981info: cpp.info gcc.info lang.info
32e6d418 1982
17b258fe 1983cpp.info: $(srcdir)/cpp.texi
1984 $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) $(srcdir)/cpp.texi -o cpp.info
32e6d418 1985
17b258fe 1986gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
1987 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
1988 $(srcdir)/tm.texi $(srcdir)/gcov.texi
1989 $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) $(srcdir)/gcc.texi -o gcc.info
630c76ba 1990
17b258fe 1991dvi: gcc.dvi cpp.dvi lang.dvi
627defc4 1992
64616031 1993# This works with GNU Make's default rule.
17b258fe 1994gcc.dvi: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
1995 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
1996 $(srcdir)/tm.texi $(srcdir)/gcov.texi
1997 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
1998 texindex gcc.??
1999 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
2000
2001cpp.dvi: $(srcdir)/cpp.texi
2002 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
2003 texindex cpp.??
2004 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
2005
2006
2007INSTALL: $(srcdir)/install1.texi $(srcdir)/install.texi
2008 $(MAKEINFO) -D INSTALLONLY --no-header --no-split \
2009 $(srcdir)/install1.texi -o INSTALL
2e9d8ccf 2010#\f
32e6d418 2011# Deletion of files made during compilation.
2012# There are four levels of this:
a8514488 2013# `mostlyclean', `clean', `distclean' and `maintainer-clean'.
32e6d418 2014# `mostlyclean' is useful while working on a particular type of machine.
c6396a0b 2015# It deletes most, but not all, of the files made by compilation.
32e6d418 2016# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
c6396a0b 2017# `clean' deletes everything made by running `make all'.
79f818d0 2018# `distclean' also deletes the files made by config.
a8514488 2019# `maintainer-clean' also deletes everything that could be regenerated
1f42ecdc 2020# automatically, except for `configure'.
2021# We remove as much from the language subdirectories as we can
73027c94 2022# (less duplicated code).
32e6d418 2023
79f818d0 2024
73027c94 2025mostlyclean: bytecode.mostlyclean lang.mostlyclean
32e6d418 2026 -rm -f $(STAGESTUFF)
2027# Delete the temporary source copies for cross compilation.
2028 -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
2029 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
2030 -rm -f $(HOST_PREFIX_1)obstack.c
2031# Delete the temp files made in the course of building libgcc.a.
c09ccbc2 2032 -rm -f tmplibgcc* tmpcopy xlimits.h libgcc1-test
32e6d418 2033 for name in $(LIB1FUNCS); do rm -f $${name}.c; done
2034# Delete other temporary files.
e5b63666 2035 -rm -f tmp-float.h tmp-gcc.xtar.gz
f678532a 2036 -rm -f tmp-foo1 tmp-foo2 tmp-proto.* tmp-unproto.1 tmp-SYSCALLS.s
8757933b 2037 -rm -f tmp-c-parse.y tmp-gperf.h
c92e16d4 2038 -rm -f tmp-specs t-float.h-cross tmp-xlimits.h
2039 -rm -f tmp-fixtmp.c xsys-protos.hT
32e6d418 2040# Delete the stamp files.
2041 -rm -f stamp-* tmp-*
73027c94 2042 -rm -f */stamp-* */tmp-*
c6396a0b 2043# Delete debugging dump files.
32e6d418 2044 -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
c6396a0b 2045 -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack
73027c94 2046 -rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl
2047 -rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2
2048 -rm -f */*.sched2 */*.stack
c6396a0b 2049# Delete some files made during installation.
d82b9c93 2050 -rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
e98401fc 2051 -rm -f collect collect2 mips-tfile mips-tdump alloca.s
a5889b74 2052# Delete files generated for fixproto
15dece2a 2053 -rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \
c9c7b9d8 2054 gen-protos fixproto.list fixtmp.* fixhdr.ready
c6396a0b 2055# Delete unwanted output files from TeX.
2056 -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
73027c94 2057 -rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg
79f818d0 2058# Delete sorted indices we don't actually use.
2059 -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
c6396a0b 2060# Delete core dumps.
73027c94 2061 -rm -f core */core
2b55270a 2062 -rm -f *.bp */*.bp
32e6d418 2063
79f818d0 2064# Delete all files made by compilation
2065# that don't exist in the distribution.
73027c94 2066clean: mostlyclean bytecode.clean lang.clean
8bd8ea06 2067# It may not be quite desirable to delete unprotoize.c here,
2068# but the spec for `make clean' requires it.
2069# Using unprotoize.c is not quite right in the first place,
2070# but what better way is there?
745e3a0d 2071 -rm -f libgcc.a libgcc1.a libgcc1-asm.a libgcc2.a libgcc2.ready
17108b2b 2072 -rm -f libgcc1.null
131b361e 2073 -rm -f *.dvi
73027c94 2074 -rm -f */*.dvi
89e36a04 2075 -if [ -f md.pre-cpp ]; then \
2076 rm -f md ; \
2077 fi
2cfd79fe 2078# Delete the include directory.
8757933b 2079 -rm -rf stmp-* include
73027c94 2080 -rm -f */stmp-*
d73a48cc 2081# Delete files used by the "multilib" facility (including libgcc subdirs).
f1ad3130 2082 -rm -f multilib.h tmpmultilib*
d73a48cc 2083 -if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \
2084 rm -rf $(MULTILIB_DIRNAMES); \
2085 else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \
2086 rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \
2087 fi ; fi
32e6d418 2088
79f818d0 2089# Delete all files that users would normally create
2090# while building and installing GCC.
73027c94 2091distclean: clean bytecode.distclean lang.distclean
0d9d9ae4 2092 -rm -f tm.h config.h config2.h tconfig.h hconfig.h md cstamp-h
1f42ecdc 2093 -rm -f config.status config.run config.cache config.bak
160b6fa9 2094 -rm -f Make-lang Make-hooks Make-host Make-target
636fef92 2095 -rm -f Makefile specs.h options.h *.oaux
79f818d0 2096 -rm -fr stage1 stage2 stage3 stage4
c4ed51d6 2097 -rm -f */stage1 */stage2 */stage3 */stage4 */include
08d7a103 2098 -rm -f c-parse.output
b541ad9d 2099 -rm -f *.asm
ae115421 2100 -rm -f float.h
45e01ea1 2101 -rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak
2102 -rm -f testsuite/{gcc,g++}.{log,sum}
c6396a0b 2103
2104# Delete anything likely to be found in the source directory
2105# that shouldn't be in the distribution.
73027c94 2106extraclean: distclean lang.extraclean
bbbdbddd 2107 -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
131b361e 2108 -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
08d7a103 2109 -rm -f config/*/=* config/*/"#"* config/*/*~*
2110 -rm -f config/*/*.orig config/*/*.rej
300d5cb3 2111 -rm -f *.dvi *.ps *.oaux *.d *.[zZ] *.gz
13da1009 2112 -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
08d7a103 2113 -rm -f *lose config/*lose config/*/*lose
3a0781a0 2114 -rm -f *.s *.s[0-9] *.i install1.texi config/ChangeLog
73027c94 2115 -rm -f */=* */"#"* */*~*
2116 -rm -f */patch* */*.orig */*.rej
2117 -rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz
2118 -rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs
2119 -rm -f */*lose */*.s */*.s[0-9] */*.i
32e6d418 2120
1f42ecdc 2121# Get rid of every file that's generated from some other file, except for `configure'.
32e6d418 2122# Most of these files ARE PRESENT in the GCC distribution.
1f42ecdc 2123maintainer-clean:
2124 @echo 'This command is intended for maintainers to use; it'
2125 @echo 'deletes files that may need special tools to rebuild.'
2126 $(MAKE) distclean bytecode.maintainer-clean lang.maintainer-clean
8757933b 2127 -rm -f c-parse.y c-gperf.h
32e6d418 2128 -rm -f c-parse.c c-parse.h c-parse.output
2129 -rm -f cexp.c cexp.output TAGS
c6396a0b 2130 -rm -f cpp.info* cpp.??s cpp.*aux
2131 -rm -f gcc.info* gcc.??s gcc.*aux
2e9d8ccf 2132#\f
32e6d418 2133# Entry points `install' and `uninstall'.
c6396a0b 2134# Also use `install-collect2' to install collect2 when the config files don't.
32e6d418 2135
3f69fed5 2136# The semicolon is to prevent the install.sh -> install default rule
876dc5b0 2137# from doing anything. Having it run true helps avoid problems and
2138# noise from versions of make which don't like to have null commands.
c2a18965 2139install: $(INSTALL_TARGET) ; @true
32e6d418 2140
2cfd79fe 2141# Copy the compiler files into directories where they will be run.
62268150 2142# Install the driver last so that the window when things are
2143# broken is small.
2289acd7 2144install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
8757933b 2145 install-man install-info lang.install-normal install-driver
32e6d418 2146
e77fd588 2147# Do nothing while making gcc with a cross-compiler. The person who
2148# makes gcc for the target machine has to know how to put a complete
2149# gcc together by hand.
2150install-build: force
2151 @echo You have to install gcc on your target machine by hand.
2152
32e6d418 2153# Run this on the target machine
2154# to finish installation of cross compiler.
2155install-cross-rest: install-float-h-cross
2156
2157# Install float.h for cross compiler.
2158# Run this on the target machine!
0d5bce1b 2159install-float-h-cross: installdirs
9f10de4b 2160# if [ -f enquire ] ; then true; else false; fi
2161# Note: don't use -. We should fail right away if enquire was not made.
2162 ./enquire -f > $(tmpdir)/float.h
32e6d418 2163 -rm -f $(libsubdir)/include/float.h
f32abccb 2164 $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
2165 -rm -f $(tmpdir)/float.h
32e6d418 2166 chmod a-x $(libsubdir)/include/float.h
2167
0d5bce1b 2168# Create the installation directories.
2169installdirs:
2170 -if [ -d $(prefix) ] ; then true ; else mkdir $(prefix) ; chmod a+rx $(prefix) ; fi
2171 -if [ -d $(exec_prefix) ] ; then true ; else mkdir $(exec_prefix) ; chmod a+rx $(exec_prefix) ; fi
47db7968 2172 -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
2173 -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi
444c3fb0 2174# This dir isn't currently searched by cpp.
47db7968 2175# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
67cb4bc1 2176 -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
2177 -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
2178 -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 2179 -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
2180 -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
2181 -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; chmod a+rx $(tooldir) ; fi
2182 -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
2183 -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
32e6d418 2184# We don't use mkdir -p to create the parents of mandir,
2185# because some systems don't support it.
2186# Instead, we use this technique to create the immediate parent of mandir.
2388f67d 2187 -parent=`echo $(mandir)|sed -e 's@/[^/]*$$@@'`; \
47db7968 2188 if [ -d $$parent ] ; then true ; else mkdir $$parent ; chmod a+rx $$parent ; fi
2189 -if [ -d $(mandir) ] ; then true ; else mkdir $(mandir) ; chmod a+rx $(mandir) ; fi
32e6d418 2190
2191# Install the compiler executables built during cross compilation.
0d5bce1b 2192install-common: native installdirs $(EXTRA_PARTS) lang.install-common
32e6d418 2193 for file in $(COMPILERS); do \
2194 if [ -f $$file ] ; then \
2195 rm -f $(libsubdir)/$$file; \
2196 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
2197 else true; \
2198 fi; \
2199 done
1a1e7b42 2200 for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
32e6d418 2201 if [ x"$$file" != x.. ]; then \
2202 rm -f $(libsubdir)/$$file; \
2203 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
2204 else true; fi; \
2205 done
1a1e7b42 2206 for file in $(EXTRA_PARTS) ..; do \
2207 if [ x"$$file" != x.. ]; then \
2208 rm -f $(libsubdir)/$$file; \
2209 $(INSTALL_DATA) $$file $(libsubdir)/$$file; \
2210 else true; fi; \
2211 done
8a4b1e01 2212# Don't mess with specs if it doesn't exist yet.
94c53b91 2213 -if [ -f specs ] ; then \
2214 rm -f $(libsubdir)/specs; \
8a4b1e01 2215 $(INSTALL_DATA) specs $(libsubdir)/specs; \
2216 fi
62268150 2217# Install protoize if it was compiled.
2218 -if [ -f protoize$(exeext) ]; \
2219 then \
2220 rm -f $(bindir)/protoize$(exeext); \
2221 $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/protoize$(exeext); \
2222 rm -f $(bindir)/unprotoize$(exeext); \
2223 $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/unprotoize$(exeext); \
2224 rm -f $(libsubdir)/SYSCALLS.c.X; \
2225 $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
2226 chmod a-x $(libsubdir)/SYSCALLS.c.X; \
2227 fi
2228 -rm -f $(libsubdir)/cpp$(exeext)
2229 $(INSTALL_PROGRAM) cpp$(exeext) $(libsubdir)/cpp$(exeext)
e2a2be99 2230# Install gcov if it was compiled.
2b55270a 2231 -if [ -f gcov$(exeext) ]; \
2232 then \
2233 rm -f $(bindir)/gcov$(exeext); \
2234 $(INSTALL_PROGRAM) gcov$(exeext) $(bindir)/gcov$(exeext); \
2235 chmod a+x $(bindir)/gcov$(exeext); \
2236 fi
62268150 2237
67cb4bc1 2238# Install the driver program as $(target_alias)-gcc
32e6d418 2239# and also as either gcc (if native) or $(tooldir)/bin/gcc.
62268150 2240install-driver: xgcc
f403cbcb 2241 -if [ -f gcc-cross$(exeext) ] ; then \
2242 rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
12d8e722 2243 $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
32e6d418 2244 if [ -d $(tooldir)/bin/. ] ; then \
f403cbcb 2245 rm -f $(tooldir)/bin/gcc$(exeext); \
2246 $(INSTALL_PROGRAM) gcc-cross$(exeext) $(tooldir)/bin/gcc$(exeext); \
32e6d418 2247 else true; fi; \
2248 else \
f403cbcb 2249 rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
2250 $(INSTALL_PROGRAM) xgcc$(exeext) $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
67cb4bc1 2251 rm -f $(bindir)/$(target_alias)-gcc-1$(exeext); \
ea4a6c81 2252 $(LN) $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext); \
67cb4bc1 2253 mv $(bindir)/$(target_alias)-gcc-1$(exeext) $(bindir)/$(target_alias)-gcc$(exeext); \
32e6d418 2254 fi
32e6d418 2255
a2aa0fc1 2256# Install the info files.
dff6b323 2257# $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
2258# to do the install. The sed rule was copied from stmp-int-hdrs.
0d5bce1b 2259install-info: doc installdirs lang.install-info
a2aa0fc1 2260 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
17b258fe 2261 for f in cpp.info* gcc.info*; do \
dff6b323 2262 realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
2263 $(INSTALL_DATA) $$f $(infodir)/$$realfile; \
2264 done
a2aa0fc1 2265 -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
2266
32e6d418 2267# Install the man pages.
0d5bce1b 2268install-man: installdirs $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man
b541ad9d 2269 -if [ -f gcc-cross ] ; then \
2270 rm -f $(mandir)/$(GCC_CROSS_NAME)$(manext); \
2271 $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/$(GCC_CROSS_NAME)$(manext); \
2272 chmod a-x $(mandir)/$(GCC_CROSS_NAME)$(manext); \
2273 else \
2274 rm -f $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
2275 $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
2276 chmod a-x $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
2277 fi
c6396a0b 2278 -rm -f $(mandir)/cccp$(manext)
ab866dde 2279 -$(INSTALL_DATA) $(srcdir)/cccp.1 $(mandir)/cccp$(manext)
2280 -chmod a-x $(mandir)/cccp$(manext)
32e6d418 2281
2282# Install the library.
0d5bce1b 2283install-libgcc: libgcc.a installdirs
32e6d418 2284 -if [ -f libgcc.a ] ; then \
2285 rm -f $(libsubdir)/libgcc.a; \
2286 $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
2287 if $(RANLIB_TEST) ; then \
2288 (cd $(libsubdir); $(RANLIB) libgcc.a); else true; fi; \
2289 chmod a-x $(libsubdir)/libgcc.a; \
2290 else true; fi
2291
f1ad3130 2292# Install multiple versions of libgcc.a.
0d5bce1b 2293install-multilib: stmp-multilib installdirs
f1ad3130 2294 for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
2295 dir=`echo $$i | sed -e 's/;.*$$//'`; \
2296 if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \
cdc96909 2297 for f in libgcc.a $(EXTRA_MULTILIB_PARTS); do \
2298 rm -f $(libsubdir)/$${dir}/$${f}; \
2299 $(INSTALL_DATA) $${dir}/$${f} $(libsubdir)/$${dir}/$${f}; \
2300 done; \
f1ad3130 2301 if $(RANLIB_TEST); then \
2302 (cd $(libsubdir)/$${dir}; $(RANLIB) libgcc.a); else true; fi; \
2303 chmod a-x $(libsubdir)/$${dir}/libgcc.a; \
2304 done
2305
2cfd79fe 2306# Install all the header files built in the include subdirectory.
c8763215 2307install-headers: install-include-dir $(INSTALL_HEADERS_DIR) $(INSTALL_ASSERT_H)
2cfd79fe 2308# Fix symlinks to absolute paths in the installed include directory to
2309# point to the installed directory, not the build directory.
ea4a6c81 2310# Don't need to use LN_S here since we really do need ln -s and no substitutes.
2cfd79fe 2311 -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
2312 if [ $$? -eq 0 ]; then \
2313 dir=`cd include; pwd`; \
2314 for i in $$files; do \
2315 dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
2316 if expr "$$dest" : "$$dir.*" > /dev/null; then \
2317 rm -f $(libsubdir)/include/$$i; \
5822e312 2318 ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
2cfd79fe 2319 fi; \
2320 done; \
2321 fi
32e6d418 2322
2cfd79fe 2323# Create or recreate the gcc private include file directory.
0d5bce1b 2324install-include-dir: installdirs
2cfd79fe 2325 -rm -rf $(libsubdir)/include
2326 mkdir $(libsubdir)/include
2327 -chmod a+rx $(libsubdir)/include
2328
2329# Install the include directory using tar.
a5889b74 2330install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
651b0150 2331 (cd include; \
b948f736 2332 tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
16db1e2d 2333# /bin/sh on some systems returns the status of the first tar,
2334# and that can lose with GNU tar which always writes a full block.
2335# So use `exit 0' to ignore its exit status.
2cfd79fe 2336
2337# Install the include directory using cpio.
a5889b74 2338install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
813fb313 2339 (cd include; find . -print) | (cd include; cpio -pdum $(libsubdir)/include)
32e6d418 2340
35df828f 2341# Put assert.h where it won't override GNU libc's assert.h.
2342# It goes in a dir that is searched after GNU libc's headers;
2343# thus, the following conditionals are no longer needed.
2344# But it's not worth deleting them now.
2345## Don't replace the assert.h already there if it is not from GCC.
2346## This code would be simpler if it tested for -f ... && ! grep ...
2347## but supposedly the ! operator is missing in sh on some systems.
0d5bce1b 2348install-assert-h: assert.h installdirs
eb5a0caa 2349 if [ -f $(assertdir)/assert.h ]; \
2350 then \
95856242 2351 if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
a953974c 2352 then \
eb5a0caa 2353 rm -f $(assertdir)/assert.h; \
2354 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
04873c54 2355 chmod a-x $(assertdir)/assert.h; \
eb5a0caa 2356 else true; \
2357 fi; \
2ba284c3 2358 else \
db9a0b19 2359 rm -f $(assertdir)/assert.h; \
2360 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
04873c54 2361 chmod a-x $(assertdir)/assert.h; \
2ba284c3 2362 fi
32e6d418 2363
c6396a0b 2364# Use this target to install the program `collect2' under the name `ld'.
0d5bce1b 2365install-collect2: collect2 installdirs
f403cbcb 2366 $(INSTALL_PROGRAM) collect2$(exeext) $(libsubdir)/ld$(exeext)
c6396a0b 2367# Install the driver program as $(libsubdir)/gcc for collect2.
f403cbcb 2368 $(INSTALL_PROGRAM) xgcc$(exeext) $(libsubdir)/gcc$(exeext)
c6396a0b 2369
32e6d418 2370# Cancel installation by deleting the installed files.
73027c94 2371uninstall: lang.uninstall
32e6d418 2372 -rm -rf $(libsubdir)
f403cbcb 2373 -rm -rf $(bindir)/$(GCC_INSTALL_NAME)$(exeext)
2374 -rm -rf $(bindir)/$(GCC_CROSS_NAME)$(exeext)
2375 -rm -rf $(bindir)/protoize$(exeext)
2376 -rm -rf $(bindir)/unprotoize$(exeext)
b541ad9d 2377 -rm -rf $(mandir)/$(GCC_INSTALL_NAME)$(manext)
2378 -rm -rf $(mandir)/$(GCC_CROSS_NAME)$(manext)
c6396a0b 2379 -rm -rf $(mandir)/cccp$(manext)
32e6d418 2380 -rm -rf $(mandir)/protoize$(manext)
2381 -rm -rf $(mandir)/unprotoize$(manext)
2e9d8ccf 2382#\f
6c08487b 2383# These targets are for the dejagnu testsuites. The file site.exp
2384# contains global variables that all the testsuites will use.
2385
2386# Set to $(target_alias)/ for cross.
2387target_subdir = @target_subdir@
2388
2389site.exp: ./config.status Makefile
2390 @echo "Making a new config file..."
2391 -@rm -f ./tmp?
2392 @touch site.exp
2393 -@mv site.exp site.bak
2394 @echo "## these variables are automatically generated by make ##" > ./tmp0
2395 @echo "# Do not edit here. If you wish to override these values" >> ./tmp0
2396 @echo "# add them to the last section" >> ./tmp0
2397 @echo "set rootme \"`pwd`\"" >> ./tmp0
2398 @echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0
2399 @echo "set host_triplet $(host_canonical)" >> ./tmp0
2400 @echo "set build_triplet $(build_canonical)" >> ./tmp0
2401 @echo "set target_triplet $(target)" >> ./tmp0
2402 @echo "set target_alias $(target_alias)" >> ./tmp0
2403# CFLAGS is set even though it's empty to show we reserve the right to set it.
2404 @echo "set CFLAGS \"\"" >> ./tmp0
2405 @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
2406# If newlib has been configured, we need to pass -B to gcc so it can find
2407# newlib's crt0.o if it exists. This will cause a "path prefix not used"
2408# message if it doesn't, but the testsuite is supposed to ignore the message -
2409# it's too difficult to tell when to and when not to pass -B (not all targets
2410# have crt0's). We could only add the -B if ../newlib/crt0.o exists, but that
2411# seems like too selective a test.
2412# ??? Another way to solve this might be to rely on linker scripts. Then
2413# theoretically the -B won't be needed.
2414# We also need to pass -L ../ld so that the linker can find ldscripts.
2415 @if [ -d $(objdir)/../$(target_subdir)newlib ] ; then \
2416 echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \
2417 echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)newlib/\"" >> ./tmp0; \
2418 echo "append CFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
2419 echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
2420 echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./tmp0; \
2421 else true; \
2422 fi
2423 @if [ -d $(objdir)/../ld ] ; then \
2424 echo "append LDFLAGS \" -L$(objdir)/../ld\"" >> ./tmp0; \
2425 else true; \
2426 fi
2427 @if [ $(build_canonical) != $(host_canonical) ] ; then \
2428 echo "set tmpdir /tmp" >> ./tmp0 ; \
2429 else echo "set tmpdir $(objdir)/testsuite" >> ./tmp0 ; \
2430 fi
2431 @echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0
2432 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
2433 @cat ./tmp0 > site.exp
2434 @cat site.bak | sed \
2435 -e '1,/^## All variables above are.*##/ d' >> site.exp
2436 -@rm -f ./tmp?
2437
2438CHECK_TARGETS = check-gcc check-g++
2439
2440check: $(CHECK_TARGETS)
2441
20ab2c9c 2442testsuite/site.exp: site.exp
6c08487b 2443 if [ -d testsuite ]; then \
2444 true; \
2445 else \
2446 mkdir testsuite; \
2447 fi
2448 rm -rf testsuite/site.exp
2449 cp site.exp testsuite/site.exp
20ab2c9c 2450
2451check-g++: testsuite/site.exp
2452 -rootme=`pwd`; export rootme; \
6c08487b 2453 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2454 cd testsuite; \
2455 EXPECT=${EXPECT} ; export EXPECT ; \
2456 if [ -f $${rootme}/../expect/expect ] ; then \
2457 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2458 export TCL_LIBRARY ; fi ; \
2459 $(RUNTEST) --tool g++ $(RUNTESTFLAGS)
2460
20ab2c9c 2461check-gcc: testsuite/site.exp
2462 -rootme=`pwd`; export rootme; \
6c08487b 2463 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2464 cd testsuite; \
2465 EXPECT=${EXPECT} ; export EXPECT ; \
2466 if [ -f $${rootme}/../expect/expect ] ; then \
2467 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2468 export TCL_LIBRARY ; fi ; \
2469 $(RUNTEST) --tool gcc $(RUNTESTFLAGS)
2470
32e6d418 2471# These exist for maintenance purposes.
2472
2473# Update the tags table.
2474TAGS: force
2475 cd $(srcdir); \
2476 mkdir temp; \
73027c94 2477 mv -f c-parse.[ch] objc-parse.c cexp.c =*.[chy] temp; \
32e6d418 2478 etags *.y *.h *.c; \
2479 mv temp/* .; \
2480 rmdir temp
2481
2482# Create the distribution tar file.
e5b63666 2483#dist: gcc-$(version).tar.gz
2484dist: gcc.xtar.gz
32e6d418 2485
e5b63666 2486gcc.xtar.gz: gcc.xtar
b89eb617 2487 gzip --best < gcc.xtar > tmp-gcc.xtar.gz
e5b63666 2488 mv tmp-gcc.xtar.gz gcc.xtar.gz
32e6d418 2489
e5b63666 2490#gcc-$(version).tar.gz: gcc-$(version).tar
2491# gzip < gcc-$(version).tar > gcc-$(version).tar.gz
32e6d418 2492
2493#gcc-$(version).tar:
6c76e6ec 2494gcc.xtar: distdir
2495# Make the distribution.
b948f736 2496 tar -chf gcc.xtar gcc-$(version)
6c76e6ec 2497
73027c94 2498# This target exists to do the initial work before the language specific
2499# stuff gets done.
0f557c81 2500distdir-start: doc $(srcdir)/INSTALL $(srcdir)/c-parse.y $(srcdir)/c-gperf.h \
2501 $(srcdir)/objc-parse.y $(srcdir)/c-parse.c $(srcdir)/objc-parse.c \
2502 $(srcdir)/cexp.c
2deaa28d 2503 @if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \
630c76ba 2504 then true; \
0dce1b01 2505 else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
630c76ba 2506 fi
131b361e 2507# Update the version number in README
2508 awk '$$1 " " $$2 " " $$3 == "This directory contains" \
2509 { $$6 = version; print $$0 } \
2510 $$1 " " $$2 " " $$3 != "This directory contains"' \
2511 version=$(version) README > tmp.README
2512 mv tmp.README README
c6396a0b 2513 -rm -rf gcc-$(version) tmp
32e6d418 2514# Put all the files in a temporary subdirectory
2515# which has the name that we want to have in the tar file.
c6396a0b 2516 mkdir tmp
2517 mkdir tmp/config
3bc8e4d6 2518 mkdir tmp/ginclude
4f1fd857 2519 mkdir tmp/objc
c6396a0b 2520 for file in *[0-9a-zA-Z+]; do \
ea4a6c81 2521 $(LN) $$file tmp; \
c6396a0b 2522 done
2523 cd config; \
2524 for file in *[0-9a-zA-Z+]; do \
57e88ef9 2525 if test -d $$file && test "$$file" != RCS; then \
8a32ef6f 2526 mkdir ../tmp/config/$$file; \
2527 cd $$file; \
2528 for subfile in *[0-9a-zA-Z+]; do \
ea4a6c81 2529 $(LN) $$subfile ../../tmp/config/$$file; \
8a32ef6f 2530 done; \
2531 cd ..; \
2532 else \
ea4a6c81 2533 $(LN) $$file ../tmp/config; \
8a32ef6f 2534 fi; \
32e6d418 2535 done
3bc8e4d6 2536 cd ginclude; \
2537 for file in *[0-9a-zA-Z+]; do \
ea4a6c81 2538 $(LN) $$file ../tmp/ginclude; \
3bc8e4d6 2539 done
4f1fd857 2540 cd objc; \
2541 for file in *[0-9a-zA-Z+]; do \
ea4a6c81 2542 $(LN) $$file ../tmp/objc; \
4f1fd857 2543 done
ea4a6c81 2544 $(LN) .gdbinit tmp
73027c94 2545
2546# Finish making `distdir', after the languages have done their thing.
2547distdir-finish:
c6396a0b 2548 mv tmp gcc-$(version)
3bc8e4d6 2549# Get rid of everything we don't want in the distribution. We'd want
2550# this to use Makefile.in, but it doesn't have the `lang.foo' targets
2551# expanded.
2552 cd gcc-$(version); make extraclean
32e6d418 2553
73027c94 2554distdir: distdir-start lang.distdir distdir-finish
2555
2deaa28d 2556# make diff oldversion=M.N
2557# creates a diff file between an older distribution and this one.
2558# The -P option assumes this is GNU diff.
2559diff:
6a4a0b58 2560 diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \
73027c94 2561 -x cexp.c -x bi-parser.c -x objc-parse.y -x objc-parse.c \
c971af2b 2562 -x bi-parser.h -x TAGS \
73027c94 2563 -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \
2564 -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \
2565 $(LANG_DIFF_EXCLUDES) \
2deaa28d 2566 gcc-$(oldversion) gcc-$(version) > diffs
2567
41f63c60 2568bootstrap: force
2569# Only build the C compiler for stage1, because that is the only one that
2570# we can guarantee will build with the native compiler, and also it is the
2571# only thing useful for building stage2.
e754efc9 2572 $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
32e6d418 2573 $(MAKE) stage1
c6396a0b 2574# This used to define ALLOCA as empty, but that would lead to bad results
2575# for a subsequent `make install' since that would not have ALLOCA empty.
2576# To prevent `make install' from compiling alloca.o and then relinking cc1
2577# because alloca.o is newer, we permit these recursive makes to compile
2578# alloca.o. Then cc1 is newer, so it won't have to be relinked.
8f90ec19 2579 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
32e6d418 2580 $(MAKE) stage2
8f90ec19 2581 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
32e6d418 2582
2583bootstrap2: force
8f90ec19 2584 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
32e6d418 2585 $(MAKE) stage2
8f90ec19 2586 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
32e6d418 2587
2588bootstrap3: force
8f90ec19 2589 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
32e6d418 2590
48c6936b 2591# Compare the object files in the current directory with those in the
2592# stage2 directory.
2593
639b13ee 2594# ./ avoids bug in some versions of tail.
48c6936b 2595compare: force
20becaef 2596 -rm -f .bad_compare
62268150 2597 for file in *$(objext); do \
639b13ee 2598 tail +16c ./$$file > tmp-foo1; \
20becaef 2599 tail +16c stage2/$$file > tmp-foo2 \
2600 && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
48c6936b 2601 done
73027c94 2602 for dir in tmp-foo $(SUBDIRS); do \
62268150 2603 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2604 for file in $$dir/*$(objext); do \
73027c94 2605 tail +16c ./$$file > tmp-foo1; \
20becaef 2606 tail +16c stage2/$$file > tmp-foo2 \
2607 && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
9771451c 2608 done; \
2609 fi; \
73027c94 2610 done
48c6936b 2611 -rm -f tmp-foo*
20becaef 2612 if [ -f .bad_compare ]; then \
2613 echo "Bootstrap comparison failure!"; \
2614 cat .bad_compare; \
2615 exit 1; \
2616 else true; \
2617 fi
48c6936b 2618
2619# Similar, but compare with stage3 directory
2620compare3: force
62268150 2621 for file in *$(objext); do \
73027c94 2622 tail +16c ./$$file > tmp-foo1; \
77a164d8 2623 tail +16c stage3/$$file > tmp-foo2 2>/dev/null \
14ce54a4 2624 && (cmp tmp-foo1 tmp-foo2 || echo $$file differs) || true; \
48c6936b 2625 done
73027c94 2626 for dir in tmp-foo $(SUBDIRS); do \
62268150 2627 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2628 for file in $$dir/*$(objext); do \
73027c94 2629 tail +16c ./$$file > tmp-foo1; \
2630 tail +16c stage3/$$file > tmp-foo2 2>/dev/null \
14ce54a4 2631 && (cmp tmp-foo1 tmp-foo2 || echo $$file differs) || true; \
9771451c 2632 done; \
2633 fi; \
73027c94 2634 done
48c6936b 2635 -rm -f tmp-foo*
2636
f72bf186 2637# Compare the object files in the current directory with those in the
2638# stage2 directory. Use gnu cmp (diffutils v2.4 or later) to avoid
2639# running tail and the overhead of twice copying each object file.
2640
2641gnucompare: force
62268150 2642 for file in *$(objext); do \
f72bf186 2643 cmp --ignore-initial=16 $$file stage2/$$file || true ; \
2644 done
73027c94 2645 for dir in tmp-foo $(SUBDIRS); do \
62268150 2646 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
601520ec 2647 for file in $$dir/*$(objext); do \
73027c94 2648 cmp --ignore-initial=16 $$file stage2/$$file || true ; \
9771451c 2649 done; \
2650 fi; \
73027c94 2651 done
f72bf186 2652
2653# Similar, but compare with stage3 directory
2654gnucompare3: force
62268150 2655 for file in *$(objext); do \
f72bf186 2656 cmp --ignore-initial=16 $$file stage3/$$file || true ; \
2657 done
73027c94 2658 for dir in tmp-foo $(SUBDIRS); do \
62268150 2659 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2660 for file in $$dir/*$(objext); do \
73027c94 2661 cmp --ignore-initial=16 $$file stage3/$$file || true ; \
9771451c 2662 done; \
2663 fi; \
73027c94 2664 done
f72bf186 2665
32e6d418 2666# Copy the object files from a particular stage into a subdirectory.
73027c94 2667stage1-start:
c6396a0b 2668 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
73027c94 2669 -for dir in . $(SUBDIRS) ; \
2670 do \
21fde8a9 2671 if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \
73027c94 2672 done
32e6d418 2673 -mv $(STAGESTUFF) stage1
b541ad9d 2674# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2675# dir will work properly.
ea4a6c81 2676 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage1 ; else true ; fi
2677 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage1 ; else true ; fi
2678 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage1 ; else true ; fi
32e6d418 2679 -rm -f stage1/libgcc.a
2680 -cp libgcc.a stage1
2681 -if $(RANLIB_TEST) ; then $(RANLIB) stage1/libgcc.a; else true; fi
3efc89f0 2682 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2683 cp stage1/$${f} . ; \
7561ae90 2684 else true; \
3efc89f0 2685 fi; done
73027c94 2686stage1: force stage1-start lang.stage1
32e6d418 2687
73027c94 2688stage2-start:
c6396a0b 2689 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
73027c94 2690 -for dir in . $(SUBDIRS) ; \
2691 do \
21fde8a9 2692 if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \
73027c94 2693 done
32e6d418 2694 -mv $(STAGESTUFF) stage2
b541ad9d 2695# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2696# dir will work properly.
ea4a6c81 2697 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage2 ; else true ; fi
2698 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage2 ; else true ; fi
2699 -if [ -f collect-ld ] ; then $(LN_S) ../collect-ld$(exeext) stage2 ; else true ; fi
32e6d418 2700 -rm -f stage2/libgcc.a
2701 -cp libgcc.a stage2
2702 -if $(RANLIB_TEST) ; then $(RANLIB) stage2/libgcc.a; else true; fi
3efc89f0 2703 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2704 cp stage2/$${f} . ; \
7561ae90 2705 else true; \
3efc89f0 2706 fi; done
73027c94 2707stage2: force stage2-start lang.stage2
32e6d418 2708
73027c94 2709stage3-start:
2388f67d 2710 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
73027c94 2711 -for dir in . $(SUBDIRS) ; \
2712 do \
21fde8a9 2713 if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \
73027c94 2714 done
32e6d418 2715 -mv $(STAGESTUFF) stage3
b541ad9d 2716# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2717# dir will work properly.
ea4a6c81 2718 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage3 ; else true ; fi
2719 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage3 ; else true ; fi
2720 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage3 ; else true ; fi
32e6d418 2721 -rm -f stage3/libgcc.a
2722 -cp libgcc.a stage3
2723 -if $(RANLIB_TEST) ; then $(RANLIB) stage3/libgcc.a; else true; fi
3efc89f0 2724 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2725 cp stage3/$${f} . ; \
7561ae90 2726 else true; \
3efc89f0 2727 fi; done
73027c94 2728stage3: force stage3-start lang.stage3
32e6d418 2729
73027c94 2730stage4-start:
2388f67d 2731 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
73027c94 2732 -for dir in . $(SUBDIRS) ; \
2733 do \
21fde8a9 2734 if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \
73027c94 2735 done
32e6d418 2736 -mv $(STAGESTUFF) stage4
b541ad9d 2737# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2738# dir will work properly.
ea4a6c81 2739 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage4 ; else true ; fi
2740 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage4 ; else true ; fi
2741 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage4 ; else true ; fi
32e6d418 2742 -rm -f stage4/libgcc.a
2743 -cp libgcc.a stage4
2744 -if $(RANLIB_TEST) ; then $(RANLIB) stage4/libgcc.a; else true; fi
3efc89f0 2745 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2746 cp stage4/$${f} . ; \
7561ae90 2747 else true; \
3efc89f0 2748 fi; done
73027c94 2749stage4: force stage4-start lang.stage4
32e6d418 2750
2751# Copy just the executable files from a particular stage into a subdirectory,
2752# and delete the object files. Use this if you're just verifying a version
2753# that is pretty sure to work, and you are short of disk space.
62268150 2754risky-stage1: stage1
7cc2ce68 2755 -make clean
32e6d418 2756
62268150 2757risky-stage2: stage2
32e6d418 2758 -make clean
2759
62268150 2760risky-stage3: stage3
32e6d418 2761 -make clean
2762
62268150 2763risky-stage4: stage4
32e6d418 2764 -make clean
2765
2766#In GNU Make, ignore whether `stage*' exists.
a8514488 2767.PHONY: stage1 stage2 stage3 stage4 clean maintainer-clean TAGS bootstrap
32e6d418 2768.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
2769
2770force: