Makefile.in revision 18334
118334Speter# Makefile for GNU C compiler.
218334Speter#   Copyright (C) 1987, 88, 90-94, 1995 Free Software Foundation, Inc.
318334Speter
418334Speter#This file is part of GNU CC.
518334Speter
618334Speter#GNU CC is free software; you can redistribute it and/or modify
718334Speter#it under the terms of the GNU General Public License as published by
818334Speter#the Free Software Foundation; either version 2, or (at your option)
918334Speter#any later version.
1018334Speter
1118334Speter#GNU CC is distributed in the hope that it will be useful,
1218334Speter#but WITHOUT ANY WARRANTY; without even the implied warranty of
1318334Speter#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1418334Speter#GNU General Public License for more details.
1518334Speter
1618334Speter#You should have received a copy of the GNU General Public License
1718334Speter#along with GNU CC; see the file COPYING.  If not, write to
1818334Speter#the Free Software Foundation, 59 Temple Place - Suite 330,
1918334Speter#Boston MA 02111-1307, USA.
2018334Speter
2118334Speter# The targets for external use include:
2218334Speter# all, doc, proto, install, install-cross, install-cross-rest,
2318334Speter# uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean,
2418334Speter# stage1, stage2, stage3, stage4.
2518334Speter
2618334Speter# Suppress smart makes who think they know how to automake Yacc files
2718334Speter.y.c:
2818334Speter
2918334Speter# Variables that exist for you to override.
3018334Speter# See below for how to change them for certain systems.
3118334Speter
3218334Speter# List of language subdirectories.
3318334Speter# This is overridden by configure.
3418334SpeterSUBDIRS =
3518334Speter
3618334Speter# Selection of languages to be made.
3718334Speter# This is overridden by configure.
3818334SpeterLANGUAGES = c objective-c proto
3918334Speter
4018334SpeterALLOCA =
4118334SpeterALLOCA_FLAGS =
4218334SpeterALLOCA_FINISH = true
4318334Speter
4418334Speter# Various ways of specifying flags for compilations:  
4518334Speter# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
4618334Speter# BOOT_CFLAGS is the value of CFLAGS to pass
4718334Speter# to the stage2 and stage3 compilations
4818334Speter# XCFLAGS is used for most compilations but not when using the GCC just built.
4918334SpeterXCFLAGS =
5018334SpeterCFLAGS = -g
5118334SpeterBOOT_CFLAGS = -O $(CFLAGS)
5218334Speter# These exists to be overridden by the x-* and t-* files, respectively.
5318334SpeterX_CFLAGS =
5418334SpeterT_CFLAGS =
5518334Speter
5618334SpeterX_CPPFLAGS =
5718334SpeterT_CPPFLAGS =
5818334Speter
5918334SpeterCC = cc
6018334SpeterBISON = bison
6118334SpeterBISONFLAGS =
6218334SpeterLEX = flex
6318334SpeterLEXFLAGS =
6418334SpeterAR = ar
6518334SpeterOLDAR_FLAGS = qc
6618334SpeterAR_FLAGS = rc
6718334SpeterSHELL = /bin/sh
6818334Speter# on sysV, define this as cp.
6918334SpeterINSTALL = install -c
7018334Speter# These permit overriding just for certain files.
7118334SpeterINSTALL_PROGRAM = $(INSTALL)
7218334SpeterINSTALL_DATA = $(INSTALL)
7318334SpeterMAKEINFO = makeinfo
7418334SpeterTEXI2DVI = texi2dvi
7518334Speter# For GNUmake: let us decide what gets passed to recursive makes.
7618334SpeterMAKEOVERRIDES =
7718334Speter
7818334Speter# Define this as & to perform parallel make on a Sequent.
7918334Speter# Note that this has some bugs, and it seems currently necessary 
8018334Speter# to compile all the gen* files first by hand to avoid erroneous results.
8118334SpeterP =
8218334Speter
8318334Speter# How to invoke ranlib.
8418334SpeterRANLIB = ranlib
8518334Speter# Test to use to see whether ranlib exists on the system.
8618334SpeterRANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
8718334Speter
8818334Speter# Compiler to use for compiling libgcc1.a.
8918334Speter# OLDCC should not be the GNU C compiler,
9018334Speter# since that would compile typical libgcc1.a functions such as mulsi3
9118334Speter# into infinite recursions.
9218334SpeterOLDCC = cc
9318334Speter
9418334Speter# CFLAGS for use with OLDCC, for compiling libgcc1.a.
9518334Speter# NOTE: -O does not work on some Unix systems!
9618334SpeterCCLIBFLAGS = -O
9718334Speter
9818334Speter# Version of ar to use when compiling libgcc1.a.
9918334SpeterOLDAR = ar
10018334Speter
10118334Speter# Target to use when installing include directory.  Either
10218334Speter# install-headers-tar or install-headers-cpio.
10318334SpeterINSTALL_HEADERS_DIR = install-headers-tar
10418334Speter
10518334Speter# Header files that are made available under the same name
10618334Speter# to programs compiled with GCC.
10718334SpeterUSER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/stddef.h \
10818334Speter    $(srcdir)/ginclude/varargs.h $(srcdir)/ginclude/va-alpha.h \
10918334Speter    $(srcdir)/ginclude/va-h8300.h $(srcdir)/ginclude/va-i860.h \
11018334Speter    $(srcdir)/ginclude/va-i960.h $(srcdir)/ginclude/va-mips.h \
11118334Speter    $(srcdir)/ginclude/va-m88k.h $(srcdir)/ginclude/va-pa.h \
11218334Speter    $(srcdir)/ginclude/va-pyr.h $(srcdir)/ginclude/va-sparc.h \
11318334Speter    $(srcdir)/ginclude/va-clipper.h $(srcdir)/ginclude/va-spur.h \
11418334Speter    $(srcdir)/ginclude/iso646.h $(srcdir)/ginclude/va-ppc.h \
11518334Speter    $(srcdir)/ginclude/proto.h $(EXTRA_HEADERS)
11618334Speter
11718334Speter# Target to use whe installing assert.h.  Some systems may
11818334Speter# want to set this empty.
11918334SpeterINSTALL_ASSERT_H = install-assert-h
12018334Speter
12118334Speter# The GCC to use for compiling libgcc2.a, enquire, and libgcc1-test.
12218334Speter# Usually the one we just built.
12318334Speter# Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS).
12418334SpeterGCC_FOR_TARGET = ./xgcc -B./
12518334Speter
12618334Speter# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
12718334Speter# It omits XCFLAGS, and specifies -B./.
12818334Speter# It also specifies -I./include to find, e.g., stddef.h.
12918334SpeterGCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -I./include
13018334Speter
13118334Speter# Special flags for compiling enquire.
13218334Speter# We disable optimization to make floating point more reliable.
13318334SpeterENQUIRE_CFLAGS = -DNO_MEM -DNO_LONG_DOUBLE_IO -O0
13418334SpeterENQUIRE_LDFLAGS = $(LDFLAGS)
13518334Speter
13618334Speter# Sed command to transform gcc to installed name.  Overwritten by configure.
13718334Speterprogram_transform_name = -e s,x,x,
13818334Speterprogram_transform_cross_name = -e s,^,$(target)-,
13918334Speter
14018334Speter# Tools to use when building a cross-compiler.
14118334Speter# These are used because `configure' appends `cross-make'
14218334Speter# to the makefile when making a cross-compiler.
14318334Speter
14418334SpeterTARGET_TOOLPREFIX = $(tooldir)/bin/
14518334SpeterAR_FOR_TARGET = $(TARGET_TOOLPREFIX)ar
14618334SpeterAR_FOR_TARGET_FLAGS = rc
14718334SpeterRANLIB_FOR_TARGET = $(TARGET_TOOLPREFIX)ranlib
14818334SpeterRANLIB_TEST_FOR_TARGET = [ -f $(TARGET_TOOLPREFIX)ranlib ]
14918334Speter
15018334Speter# Dir to search for system headers.  Overridden by cross-make.
15118334SpeterSYSTEM_HEADER_DIR = /usr/include
15218334Speter
15318334Speter# Control whether to run fixproto.
15418334SpeterSTMP_FIXPROTO = stmp-fixproto
15518334Speter
15618334Speter# Test to see whether <limits.h> exists in the system header files.
15718334SpeterLIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
15818334Speter
15918334Speter# There may be a premade insn-attrtab.c for this machine.
16018334Speter# (You could rebuild it with genattrtab as usual, but it takes a long time.)
16118334Speter# PREMADE_ATTRTAB is the file name of the file to use.
16218334Speter# PREMADE_ATTRTAB_MD is the md file it corresponds to.
16318334SpeterPREMADE_ATTRTAB_MD = Makefile  # Guaranteed not to cmp equal to md.
16418334SpeterPREMADE_ATTRTAB = 
16518334Speter
16618334Spetertarget= ... `configure' substitutes actual target name here.
16718334Speterxmake_file= ... `configure' substitutes actual x- file name here.
16818334Spetertmake_file= ... `configure' substitutes actual t- file name here.
16918334Speterout_file= ... `configure' substitutes actual out file name here.
17018334Speterout_object_file= ... `configure' substitutes actual out object file name here.
17118334Spetermd_file= ... `configure' substitutes actual md file name here.
17218334Spetertm_file= ... `configure' substitutes actual tm file name here.
17318334Speterbuild_xm_file= ... `configure' substitutes actual build xm- file name here.
17418334Speterhost_xm_file= ... `configure' substitutes actual host xm- file name here.
17518334Speterlang_specs_files= ... `configure' substitutes actual lang spec file names here.
17618334Speterlang_options_files= ... `configure' puts actual lang options file names here.
17718334Speterversion=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
17818334Spetermainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
17918334Speter
18018334Speter# Directory where sources are, from where we are.
18118334Spetersrcdir = .
18218334Speter# Common prefix for installation directories.
18318334Speter# NOTE: This directory must exist when you start installation.
18418334Speterprefix = /usr/local
18518334Speter# Directory in which to put localized header files. On the systems with
18618334Speter# gcc as the native cc, `local_prefix' may not be `prefix' which is
18718334Speter# `/usr'.
18818334Speter# NOTE: local_prefix *should not* default from prefix.
18918334Speterlocal_prefix = /usr/local
19018334Speter# Directory in which to put host dependent programs and libraries
19118334Speterexec_prefix = $(prefix)
19218334Speter# Directory in which to put the executable for the command `gcc'
19318334Speterbindir = $(exec_prefix)/bin
19418334Speter# Directory in which to put the directories used by the compiler.
19518334Speterlibdir = $(exec_prefix)/lib
19618334Speter# Directory in which the compiler finds executables, libraries, etc.
19718334Speterlibsubdir = $(libdir)/gcc-lib/$(target)/$(version)
19818334Speter# Directory in which the compiler finds g++ includes.
19918334Spetergxx_include_dir= $(libdir)/g++-include
20018334Speter# Directory to search for site-specific includes.
20118334Speterincludedir = $(local_prefix)/include
20218334Speter# assertdir is overridden in cross-make.
20318334Speter# (But this currently agrees with what is in cross-make.)
20418334Speterassertdir = $(tooldir)/include
20518334Speter# where the info files go
20618334Speterinfodir = $(prefix)/info
20718334Speter# Extension (if any) to put in installed man-page filename.
20818334Spetermanext = .1
20918334Speterobjext = .o
21018334Speterexeext =
21118334Speter
21218334Speter# Directory in which to put man pages.
21318334Spetermandir = $(prefix)/man/man1
21418334Speter# Directory in which to find other cross-compilation tools and headers.
21518334Speter# Used in install-cross.
21618334Spetertooldir = $(exec_prefix)/$(target)
21718334Speter# Dir for temp files.
21818334Spetertmpdir = /tmp
21918334Speter
22018334Speter# Additional system libraries to link with.
22118334SpeterCLIB=
22218334Speter
22318334Speter# Change this to a null string if obstacks are installed in the
22418334Speter# system library.
22518334SpeterOBSTACK=obstack.o
22618334Speter
22718334Speter# Specify the rule for actually making libgcc.a,
22818334SpeterLIBGCC = libgcc.a
22918334Speter# and the rule for installing it.
23018334SpeterINSTALL_LIBGCC = install-libgcc
23118334Speter
23218334Speter# Specify the rule for actually making libgcc1.a.
23318334Speter# The value may be empty; that means to do absolutely nothing
23418334Speter# with or for libgcc1.a.
23518334SpeterLIBGCC1 = libgcc1.a
23618334Speter
23718334Speter# Specify the rule for making libgcc1.a for a cross-compiler.
23818334Speter# The default rule assumes that libgcc1.a is supplied by the user.
23918334SpeterCROSS_LIBGCC1 = libgcc1.cross
24018334Speter
24118334Speter# Specify the rule for actually making libgcc2.a.
24218334SpeterLIBGCC2 = libgcc2.a
24318334Speter
24418334Speter# Options to use when compiling libgcc2.a.
24518334Speter# -g1 causes output of debug info only for file-scope entities.
24618334Speter# we use this here because that should be enough, and also
24718334Speter# so that -g1 will be tested.
24818334SpeterLIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) -g1
24918334Speter
25018334Speter# Additional options to use when compiling libgcc2.a.
25118334Speter# Some targets override this to -Iinclude
25218334SpeterLIBGCC2_INCLUDES =
25318334Speter
25418334Speter# Additional target-dependent options for compiling libgcc2.a.
25518334SpeterTARGET_LIBGCC2_CFLAGS = 
25618334Speter
25718334Speter# Things which must be built before building libgcc2.a.
25818334Speter# Some targets override this to stmp-int-hdrs
25918334SpeterLIBGCC2_DEPS =
26018334Speter
26118334Speter# Enquire target (This is a variable so that a target can choose not to
26218334Speter# build it.)
26318334SpeterENQUIRE = enquire
26418334Speter
26518334Speter# libgcc1-test target (must also be overridable for a target)
26618334SpeterLIBGCC1_TEST = libgcc1-test
26718334Speter
26818334Speter# List of extra executables that should be compiled for this target machine
26918334Speter# that are used for compiling from source code to object code.
27018334Speter# The rules for compiling them should be in the t-* file for the machine.
27118334SpeterEXTRA_PASSES =
27218334Speter
27318334Speter# Like EXTRA_PASSES, but these are used when linking.
27418334SpeterEXTRA_PROGRAMS = 
27518334Speter
27618334Speter# List of extra object files that should be compiled for this target machine.
27718334Speter# The rules for compiling them should be in the t-* file for the machine.
27818334SpeterEXTRA_PARTS =
27918334Speter
28018334Speter# List of extra object files that should be compiled and linked with
28118334Speter# compiler proper (cc1, cc1obj, cc1plus).
28218334SpeterEXTRA_OBJS =
28318334Speter
28418334Speter# List of extra object files that should be compiled and linked with
28518334Speter# the gcc driver.
28618334SpeterEXTRA_GCC_OBJS =
28718334Speter
28818334Speter# List of additional header files to install.
28918334Speter# Often this is edited directly by `configure'.
29018334SpeterEXTRA_HEADERS =
29118334Speter
29218334Speter# Set this to `ld' to enable use of collect2.
29318334Speter# USE_COLLECT2 =
29418334Speter# It is convenient for configure to add the assignment at the beginning,
29518334Speter# so don't override it here.
29618334Speter
29718334Speter# List of extra C and assembler files to add to libgcc1.a.
29818334Speter# Assembler files should have names ending in `.asm'.
29918334SpeterLIB1FUNCS_EXTRA = 
30018334Speter
30118334Speter# List of extra C and assembler files to add to libgcc2.a.
30218334Speter# Assembler files should have names ending in `.asm'.
30318334SpeterLIB2FUNCS_EXTRA = 
30418334Speter
30518334Speter# Default float.h source to use for cross-compiler.
30618334SpeterCROSS_FLOAT_H=float.h-cross
30718334Speter
30818334Speter# Program to convert libraries.
30918334SpeterLIBCONVERT = 
31018334Speter
31118334Speter# Control whether header files are installed.
31218334SpeterINSTALL_HEADERS=install-headers
31318334Speter
31418334Speter# Options for tar when copying trees.  So HPUX can override it.
31518334SpeterTAROUTOPTS = xpBf
31618334Speter
31718334Speter# Select which version of fixincludes to use (I.E. regular versus SVR4)
31818334Speter# This value is overridden directly by configure.
31918334SpeterFIXINCLUDES=fixincludes
32018334Speter
32118334Speter# Additional directories of header files to run fixincludes on.
32218334Speter# These should be directories searched automatically by default
32318334Speter# just as /usr/include is.
32418334Speter# *Do not* use this for directories that happen to contain 
32518334Speter# header files, but are not searched automatically by default.
32618334Speter# On most systems, this is empty.
32718334SpeterOTHER_FIXINCLUDES_DIRS=
32818334Speter
32918334Speter# List of things which should already be built whenever we try to use xgcc
33018334Speter# to compile anything (without linking).
33118334SpeterGCC_PASSES=xgcc cc1 cpp $(EXTRA_PASSES)
33218334Speter
33318334Speter# List of things which should already be built whenever we try to use xgcc
33418334Speter# to link anything.
33518334SpeterGCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
33618334Speter
33718334Speter# Directory to link to, when using the target `maketest'.
33818334SpeterDIR = ../gcc
33918334Speter
34018334Speter# Guaranteed to not exist when not passing md through cpp.
34118334Speter# This value is overridden directly by configure.
34218334SpeterMD_FILE = md-cpp-not-used
34318334Speter
34418334Speter# Flags to use when cross-building GCC.
34518334Speter# Prefix to apply to names of object files when using them
34618334Speter# to run on the machine we are compiling on.
34718334SpeterHOST_PREFIX=
34818334Speter# Prefix to apply to names of object files when compiling them
34918334Speter# to run on the machine we are compiling on.
35018334Speter# The default for this variable is chosen to keep these rules 
35118334Speter# out of the way of the other rules for compiling the same source files.
35218334SpeterHOST_PREFIX_1=loser-
35318334SpeterHOST_CC=$(CC)
35418334SpeterHOST_CFLAGS=$(ALL_CFLAGS)
35518334SpeterHOST_CLIB=$(CLIB)
35618334SpeterHOST_LDFLAGS=$(LDFLAGS)
35718334SpeterHOST_CPPFLAGS=$(ALL_CPPFLAGS)
35818334SpeterHOST_ALLOCA=$(ALLOCA)
35918334SpeterHOST_MALLOC=$(MALLOC)
36018334SpeterHOST_OBSTACK=$(OBSTACK)
36118334Speter
36218334Speter# Actual name to use when installing a native compiler.
36318334SpeterGCC_INSTALL_NAME = `t='$(program_transform_name)'; echo gcc | sed $$t`
36418334Speter
36518334Speter# Actual name to use when installing a cross-compiler.
36618334SpeterGCC_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcc | sed $$t`
36718334Speter
36818334Speter# Choose the real default target.
36918334SpeterALL=all.internal
37018334Speter
37118334Speter# Choose the real install target.
37218334SpeterINSTALL_TARGET=install-normal
37318334Speter
37418334Speter# Source for float.h.  Overridden by cross-make.
37518334SpeterFLOAT_H=float.h-nat
37618334Speter
37718334Speter# Extra symbols for fixproto to define when parsing headers.
37818334SpeterFIXPROTO_DEFINES = 
37918334Speter
38018334Speter# Extra flags to use when compiling crt{begin,end}.o.
38118334SpeterCRTSTUFF_T_CFLAGS = 
38218334Speter
38318334Speter# End of variables for you to override.
38418334Speter
38518334Speter# Definition of `all' is here so that new rules inserted by sed
38618334Speter# do not specify the default target.
38718334Speter# The real definition is under `all.internal' (for native compilers)
38818334Speter# or `all.cross' (for cross compilers).
38918334Speterall: all.indirect
39018334Speter
39118334Speter# This tells GNU Make version 3 not to put all variables in the environment.
39218334Speter.NOEXPORT:
39318334Speter
39418334Speter# sed inserts variable overrides after the following line.
39518334Speter####target overrides
39618334Speter####host overrides
39718334Speter####cross overrides
39818334Speter####build overrides
39918334Speter
40018334Speter# Now figure out from those variables how to compile and link.
40118334Speter
40218334Speterall.indirect: $(ALL)
40318334Speter
40418334Speter# IN_GCC tells obstack.h that we are using gcc's <stddef.h> file.
40518334Speter# ??? IN_GCC should be obsolete now.
40618334SpeterINTERNAL_CFLAGS = $(CROSS) -DIN_GCC
40718334Speter
40818334Speter# This is the variable actually used when we compile.
40918334SpeterALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
41018334Speter
41118334Speter# Likewise.
41218334SpeterALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
41318334Speter
41418334Speter# Even if ALLOCA is set, don't use it if compiling with GCC.
41518334SpeterUSE_ALLOCA= ` case "${CC}" in "${OLDCC}") echo "${ALLOCA}" ;; esac `
41618334SpeterUSE_HOST_ALLOCA= ` case "${HOST_CC}"@"${HOST_ALLOCA}" in "${OLDCC}"@?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
41718334SpeterUSE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac `
41818334SpeterUSE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac `
41918334Speter
42018334Speter# Dependency on obstack, alloca, malloc or whatever library facilities
42118334Speter# are not installed in the system libraries.
42218334Speter# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
42318334SpeterLIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC)
42418334Speter
42518334Speter# Likewise, for use in the tools that must run on this machine
42618334Speter# even if we are cross-building GCC.
42718334Speter# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
42818334SpeterHOST_LIBDEPS= $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC)
42918334Speter
43018334Speter# How to link with both our special library facilities
43118334Speter# and the system's installed libraries.
43218334SpeterLIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(CLIB)
43318334Speter
43418334Speter# Likewise, for use in the tools that must run on this machine
43518334Speter# even if we are cross-building GCC.
43618334SpeterHOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC)  \
43718334Speter	    $(HOST_CLIB)
43818334Speter
43918334SpeterHOST_RTL = $(HOST_PREFIX)rtl.o
44018334SpeterHOST_RTLANAL = $(HOST_PREFIX)rtlanal.o
44118334SpeterHOST_PRINT = $(HOST_PREFIX)print-rtl.o
44218334Speter
44318334Speter# Specify the directories to be searched for header files.
44418334Speter# Both . and srcdir are used, in that order,
44518334Speter# so that tm.h and config.h will be found in the compilation
44618334Speter# subdirectory rather than in the source directory.
44718334SpeterINCLUDES = -I. -I$(srcdir) -I$(srcdir)/config
44818334Speter
44918334Speter# Always use -I$(srcdir)/config when compiling.
45018334Speter.c.o:
45118334Speter	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
45218334Speter
45318334Speter# This tells GNU make version 3 not to export all the variables
45418334Speter# defined in this file into the environment.
45518334Speter.NOEXPORT:
45618334Speter
45718334Speter# Support for additional languages (other than c and objc).
45818334Speter# ??? objc can be supported this way too (leave for later).
45918334Speter
46018334Speter# These next lines are overridden by configure.
46118334SpeterLANG_MAKEFILES =
46218334SpeterLANG_STAGESTUFF =
46318334SpeterLANG_DIFF_EXCLUDES =
46418334Speter
46518334Speter# Flags to pass to recursive makes.
46618334Speter# CC is set by configure.  Hosts without symlinks need special handling
46718334Speter# because we need CC="stage1/xgcc -Bstage1/" to work in the language
46818334Speter# subdirectories.
46918334Speter# ??? The choices here will need some experimenting with.
47018334SpeterFLAGS_TO_PASS = \
47118334Speter	"AR_FLAGS=$(AR_FLAGS)" \
47218334Speter	"AR_FOR_TARGET=$(AR_FOR_TARGET)" \
47318334Speter	"BISON=$(BISON)" \
47418334Speter	"BISONFLAGS=$(BISONFLAGS)" \
47518334Speter	"CC=set-by-configure" \
47618334Speter	"CFLAGS=$(CFLAGS)" \
47718334Speter	"GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
47818334Speter	"LDFLAGS=$(LDFLAGS)" \
47918334Speter	"LEX=$(LEX)" \
48018334Speter	"LEXFLAGS=$(LEXFLAGS)" \
48118334Speter	"MAKEINFO=$(MAKEINFO)" \
48218334Speter	"MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
48318334Speter	"RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
48418334Speter	"RANLIB_TEST_FOR_TARGET=$(RANLIB_TEST_FOR_TARGET)" \
48518334Speter	"SHELL=$(SHELL)" \
48618334Speter	"exeext=$(exeext)" \
48718334Speter	"objext=$(objext)" \
48818334Speter	"exec_prefix=$(exec_prefix)" \
48918334Speter	"prefix=$(prefix)" \
49018334Speter	"tooldir=$(tooldir)" \
49118334Speter	"bindir=$(bindir)" \
49218334Speter	"libsubdir=$(libsubdir)"
49318334Speter
49418334Speter# Lists of files for various purposes.
49518334Speter
49618334Speter# A list of all the language-specific executables.
49718334Speter# This is overridden by configure.
49818334SpeterCOMPILERS = cc1$(exeext) cc1obj$(exeext)
49918334Speter
50018334Speter# Language-specific object files for C.
50118334SpeterC_OBJS = c-parse.o c-lang.o c-lex.o c-pragma.o \
50218334Speter   c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-iterate.o
50318334Speter
50418334Speter# Language-specific object files for Objective C.
50518334SpeterOBJC_OBJS = objc-parse.o objc-act.o c-lex.o c-pragma.o \
50618334Speter   c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-iterate.o
50718334Speter
50818334Speter# Files specific to the C interpreter bytecode compiler(s).
50918334SpeterBC_OBJS = bc-emit.o bc-optab.o
51018334Speter
51118334Speter# Bytecode header files constructed at build time; vmsconfig.com wants this.
51218334SpeterBC_ALL = bc-arity.h bc-opcode.h bc-opname.h
51318334Speter
51418334Speter# Language-independent object files.
51518334SpeterOBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
51618334Speter function.o stmt.o expr.o calls.o expmed.o explow.o optabs.o varasm.o \
51718334Speter rtl.o print-rtl.o rtlanal.o emit-rtl.o real.o \
51818334Speter dbxout.o sdbout.o dwarfout.o xcoffout.o \
51918334Speter integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o \
52018334Speter regclass.o local-alloc.o global.o reload.o reload1.o caller-save.o \
52118334Speter insn-peep.o reorg.o sched.o final.o recog.o reg-stack.o \
52218334Speter insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \
52318334Speter insn-attrtab.o $(out_object_file) getpwd.o convert.o $(EXTRA_OBJS)
52418334Speter
52518334Speter# GEN files are listed separately, so they can be built before doing parallel
52618334Speter#  makes for cc1 or cc1plus.  Otherwise sequent parallel make attempts to load
52718334Speter#  them before rtl.o is compiled.
52818334SpeterGEN= genemit genoutput genrecog genextract genflags gencodes genconfig genpeep
52918334Speter
53018334SpeterCCCP=cccp
53118334Speter# Uncomment this line if you want to use cppmain (w/cpplib) as cpp.
53218334Speter#CCCP=cppmain
53318334Speter
53418334Speter# Files to be copied away after each stage in building.
53518334SpeterSTAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \
53618334Speter insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
53718334Speter insn-attr.h insn-attrtab.c insn-opinit.c \
53818334Speter stamp-flags stamp-config stamp-codes \
53918334Speter stamp-output stamp-recog stamp-emit stamp-extract stamp-peep \
54018334Speter stamp-attr stamp-attrtab stamp-opinit stamp-proto stamp-crt stamp-crtS \
54118334Speter genemit$(exeext) genoutput$(exeext) genrecog$(exeext) genextract$(exeext) \
54218334Speter genflags$(exeext) gencodes$(exeext) genconfig$(exeext) genpeep$(exeext) \
54318334Speter genattrtab$(exeext) genattr$(exeext) genopinit$(exeext) \
54418334Speter $(BC_ALL) \
54518334Speter stamp-bcarity stamp-bcopcode stamp-bcopname \
54618334Speter bi-arity$(exeext) bi-opcode$(exeext) bi-opname$(exeext) \
54718334Speter $(GCC_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
54818334Speter $(CCCP)$(exeext) cc1obj$(exeext) enquire$(exeext) \
54918334Speter protoize$(exeext) unprotoize$(exeext) \
55018334Speter specs collect2$(exeext) $(USE_COLLECT2) underscore.c \
55118334Speter *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop \
55218334Speter *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack \
55318334Speter *.[si] \
55418334Speter $(LANG_STAGESTUFF)
55518334Speter
55618334Speter# Members of libgcc1.a.
55718334SpeterLIB1FUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
55818334Speter   _lshrsi3 _ashrsi3 _ashlsi3 \
55918334Speter   _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \
56018334Speter   _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \
56118334Speter   _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \
56218334Speter   _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
56318334Speter   _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
56418334Speter
56518334Speter# Library members defined in libgcc2.c.
56618334SpeterLIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
56718334Speter     _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 \
56818334Speter    _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
56918334Speter    _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
57018334Speter    _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
57118334Speter    _fixtfdi _fixunstfdi _floatditf \
57218334Speter    __gcc_bcmp _varargs _eprintf _op_new _op_vnew _new_handler _op_delete \
57318334Speter    _op_vdel _bb _shtab _clear_cache _trampoline __main _exit _ctors _eh \
57418334Speter    _pure
57518334Speter
57618334Speter# The files that "belong" in CONFIG_H are deliberately omitted
57718334Speter# because having them there would not be useful in actual practice.
57818334Speter# All they would do is cause complete recompilation every time
57918334Speter# one of the machine description files is edited.
58018334Speter# That may or may not be what one wants to do.
58118334Speter# If it is, rm *.o is an easy way to do it.
58218334Speter# CONFIG_H = $(host_xm_file) $(tm_file)
58318334SpeterCONFIG_H =
58418334SpeterRTL_H = rtl.h rtl.def machmode.h machmode.def
58518334SpeterTREE_H = tree.h real.h tree.def machmode.h machmode.def
58618334SpeterBYTECODE_H = bytecode.h bc-emit.h bc-optab.h
58718334Speter
58818334Speter# Language makefile fragments.
58918334Speter
59018334Speter# The following targets define the interface between us and the languages.
59118334Speter#
59218334Speter# all.build, all.cross, start.encap, rest.encap,
59318334Speter# info, dvi,
59418334Speter# install-normal, install-common, install-info, install-man,
59518334Speter# uninstall, distdir,
59618334Speter# mostlyclean, clean, distclean, extraclean, maintainer-clean,
59718334Speter# stage1, stage2, stage3, stage4
59818334Speter#
59918334Speter# Each language is linked in with a series of hooks (since we can't use `::'
60018334Speter# targets).  The name of each hooked is "lang.${target_name}" (eg: lang.info).
60118334Speter# Configure computes and adds these here.
60218334Speter
60318334Speter####language hooks
60418334Speter
60518334Speter# sed inserts language fragments after the following line.
60618334Speter####language fragments
60718334Speter
60818334Speter# End of language makefile fragments.
60918334Speter
61018334Speter# Avoid a lot of time thinking about remaking Makefile.in and *.def.
61118334Speter.SUFFIXES: .in .def
61218334Speter
61318334SpeterMakefile: $(srcdir)/Makefile.in $(srcdir)/configure $(srcdir)/version.c \
61418334Speter   $(srcdir)/config/$(xmake_file) $(srcdir)/config/$(tmake_file) \
61518334Speter   $(LANG_MAKEFILES)
61618334Speter	cp config.status config.run
61718334Speter	$(SHELL) config.run
61818334Speter	rm -f config.run
61918334Speter
62018334Speterall.internal: start.encap rest.encap
62118334Speter# This is what to compile if making a cross-compiler.
62218334Speter# Note that we can compile enquire using the cross-compiler just built,
62318334Speter# although we can't run it on this machine.
62418334Speterall.cross: native gcc-cross specs stmp-headers $(LIBGCC) $(STMP_FIXPROTO) \
62518334Speter	$(LIBGCC1_TEST) $(EXTRA_PARTS) lang.all.cross
62618334Speter# This is what to compile if making gcc with a cross-compiler.
62718334Speterall.build: native xgcc $(EXTRA_PARTS) lang.all.build
62818334Speter# This is what must be made before installing GCC and converting libraries.
62918334Speterstart.encap: native xgcc specs $(LIBGCC1) xlimits.h lang.start.encap
63018334Speter# These can't be made until after GCC can run.
63118334Speterrest.encap: stmp-headers $(LIBGCC) $(STMP_FIXPROTO) $(EXTRA_PARTS) lang.rest.encap
63218334Speter# This is what is made with the host's compiler
63318334Speter# whether making a cross compiler or not.
63418334Speternative: config.status cpp $(LANGUAGES) $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
63518334Speter
63618334Speter# Define the names for selecting languages in LANGUAGES.
63718334SpeterC c: cc1
63818334SpeterOBJC objc: cc1obj objc-runtime
63918334SpeterOBJECTIVE-C objective-c: cc1obj objc-runtime
64018334SpeterPROTO: proto
64118334Speter
64218334Speter# Tell GNU make these are phony targets.
64318334Speter.PHONY: C c OBJC objc OBJECTIVE-C objective-c PROTO proto
64418334Speter
64518334Speter# Really, really stupid make features, such as SUN's KEEP_STATE, may force
64618334Speter# a target to build even if it is up-to-date.  So we must verify that
64718334Speter# config.status does not exist before failing.
64818334Speterconfig.status:
64918334Speter	@if [ ! -f config.status ] ; then \
65018334Speter	  echo You must configure gcc.  Look at the INSTALL file for details.; \
65118334Speter	  false; \
65218334Speter	else \
65318334Speter	  true; \
65418334Speter	fi
65518334Speter
65618334Speter# On the target machine, finish building a cross compiler.
65718334Speter# This does the things that can't be done on the host machine.
65818334Speterrest.cross: $(LIBGCC) gfloat.h specs
65918334Speter
66018334Speter# Verify that it works to compile and link libgcc1-test.
66118334Speter# If it does, then there are sufficient replacements for libgcc1.a.
66218334Speterlibgcc1-test: libgcc1-test.o native $(GCC_PARTS)
66318334Speter	@echo "Testing libgcc1.  Ignore linker warning messages."
66418334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) libgcc1-test.o -o libgcc1-test \
66518334Speter	  -nostartfiles -nostdlib `$(GCC_FOR_TARGET) --print-libgcc-file-name`
66618334Speterlibgcc1-test.o: libgcc1-test.c native xgcc
66718334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/libgcc1-test.c
66818334Speter
66918334Speter# Recompile all the language-independent object files.
67018334Speter# This is used only if the user explicitly asks for it.
67118334Spetercompilations: ${OBJS}
67218334Speter
67318334Speter# Create a list of the language-independent object files so the language
67418334Speter# subdirectories needn't mention their names explicitly.
67518334Speterstamp-objlist: Makefile $(OBJS) $(BC_OBJS)
67618334Speter	echo " $(OBJS) $(BC_OBJS)" | sed -e 's, \([a-z]\), ../\1,g' -e 's/\.o/$(objext)/g' >stamp-objlist
67718334Speter
67818334Speter# We call this executable `xgcc' rather than `gcc'
67918334Speter# to avoid confusion if the current directory is in the path
68018334Speter# and CC is `gcc'.  It is renamed to `gcc' when it is installed.
68118334Speterxgcc: gcc.o version.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
68218334Speter	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o version.o $(EXTRA_GCC_OBJS) $(LIBS)
68318334Speter
68418334Speter# Dump a specs file to make -B./ read these specs over installed ones.
68518334Speterspecs: xgcc
68618334Speter	$(GCC_FOR_TARGET) -dumpspecs > tmp-specs
68718334Speter	mv tmp-specs specs
68818334Speter
68918334Speter# We do want to create an executable named `xgcc', so we can use it to
69018334Speter# compile libgcc2.a.
69118334Speter# Also create gcc-cross, so that install-common will install properly.
69218334Spetergcc-cross: xgcc
69318334Speter	cp xgcc$(exeext) gcc-cross$(exeext)
69418334Speter
69518334Spetercc1: $(P) $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
69618334Speter	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
69718334Speter
69818334Spetercc1obj: $(P) $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
69918334Speter	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
70018334Speter
70118334Speter# Copy float.h from its source.
70218334Spetergfloat.h: $(FLOAT_H)
70318334Speter	-rm -f gfloat.h
70418334Speter	cp $(FLOAT_H) gfloat.h
70518334Speter
70618334Speter# Create float.h source for the native machine.
70718334Speterfloat.h-nat: enquire
70818334Speter	-./enquire -f > tmp-float.h
70918334Speter	mv tmp-float.h float.h-nat
71018334Speter
71118334Speter# Create a dummy float.h source for a cross-compiler.
71218334Speterfloat.h-cross:
71318334Speter	echo "#error float.h values not known for cross-compiler" > t-float.h-cross
71418334Speter	mv t-float.h-cross float.h-cross
71518334Speter
71618334Speter# Used to compile enquire with standard cc, but have forgotten why.
71718334Speter# Let's try with GCC.
71818334Speterenquire: enquire.o $(GCC_PARTS)
71918334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o $@
72018334Speterenquire.o: $(srcdir)/enquire.c $(GCC_PASSES) stmp-int-hdrs
72118334Speter# Breaking this line caused a problem with one version of GNU make.
72218334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) -I. -c $(srcdir)/enquire.c
72318334Speter
72418334Speter# Build the version of limits.h that we will install.
72518334Speterxlimits.h: glimits.h limitx.h limity.h
72618334Speter	if $(LIMITS_H_TEST) ; then \
72718334Speter	  cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \
72818334Speter	else \
72918334Speter	  cat $(srcdir)/glimits.h > tmp-xlimits.h; \
73018334Speter	fi
73118334Speter	mv tmp-xlimits.h xlimits.h
73218334Speter
73318334Speter# Build libgcc.a.
73418334Speter# This is done in two parts because some functions, in libgcc1.c,
73518334Speter# must be compiled with something other than GCC,
73618334Speter# while the rest, in libgcc2.c, must be compiled with xgcc.
73718334Speter# That means we can't do libgcc2.c until after xgcc, cc1, etc.
73818334Speter
73918334Speter# Use this as value of LIBGCC1 to cause conversion to GNU library format.
74018334Speter# LIBCONVERT should put its output in libgcc1.conv.
74118334Speterlibgcc1.conv: libgcc1.a
74218334Speter	$(LIBCONVERT) libgcc1.a libgcc1.conv
74318334Speter
74418334Speter# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely.
74518334Speter# Make an empty file instead.
74618334Speterlibgcc1.null: $(GCC_PASSES)
74718334Speter	echo "__foo () {}" > dummy.c
74818334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c
74918334Speter	$(OLDAR) $(OLDAR_FLAGS) libgcc1.null dummy$(objext)
75018334Speter	rm -f dummy$(objext) dummy.c
75118334Speter
75218334Speter# This is $(LIBGCC1) for a cross-compiler.
75318334Speter# We have no automatic way of building libgcc1.a, 
75418334Speter# so it's up to the installer to find a way to do that.
75518334Speter# This rule deliberately does not depend on libgcc1.a
75618334Speter# so that it will fail if the installer hasn't provided it.
75718334Speterlibgcc1.cross:
75818334Speter	mv libgcc1.a libgcc1.cross || (echo You must find a way to make libgcc1.a; false)
75918334Speter
76018334Speter# Compile the library of arithmetic subroutines with the native compiler.
76118334Speter# Don't compile it with GCC!
76218334Speter# (That would cause most arithmetic functions to call themselves.)
76318334Speterlibgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
76418334Speter	-rm -f tmplibgcc1.a
76518334Speter# Actually build it in tmplibgcc1.a, then rename at end,
76618334Speter# so that libgcc1.a itself remains nonexistent if compilation is aborted.
76718334Speter# -e causes any failing command to make this rule fail.
76818334Speter# -e doesn't work in certain shells, so we test $$? as well.
76918334Speter# lynx has a broken ar, it always complains when the initial library is
77018334Speter# empty, thus this command works only if we don't do -e
77118334Speter# There is a trailing backslash (\) deleted from the following line.
77218334Speter#	set -e;
77318334Speter	for name in $(LIB1FUNCS); \
77418334Speter	do \
77518334Speter	  echo $${name}; \
77618334Speter	  rm -f $${name}$(objext); \
77718334Speter	  $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
77818334Speter	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
77918334Speter	  mv libgcc1$(objext) $${name}$(objext); \
78018334Speter	  $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
78118334Speter	  rm -f $${name}$(objext); \
78218334Speter	done
78318334Speter# Some shells crash when a loop has no items.
78418334Speter# So make sure there is always at least one--`..'.
78518334Speter# Then ignore it.
78618334Speter# We don't use -e here because there are if statements
78718334Speter# that should not make the command give up when the if condition is false.
78818334Speter# Instead, we test for failure after each command where it matters.
78918334Speter	for file in .. $(LIB1FUNCS_EXTRA); \
79018334Speter	do \
79118334Speter	  if [ x$${file} != x.. ]; then \
79218334Speter	    name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//'`; \
79318334Speter	    echo $${name}; \
79418334Speter	    if [ $${name}.asm = $${file} ]; then \
79518334Speter	      cp $${file} $${name}.s || exit 1; file=$${name}.s; \
79618334Speter	    else true; fi; \
79718334Speter	    $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
79818334Speter	    if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
79918334Speter	    $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
80018334Speter	    if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
80118334Speter	    rm -f $${name}.s $${name}$(objext); \
80218334Speter	  else true; \
80318334Speter	  fi; \
80418334Speter	done
80518334Speter	-if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc1.a; else true; fi
80618334Speter	mv tmplibgcc1.a libgcc1.a
80718334Speter
80818334Speter# Build libgcc1.a from assembler source.  LIB1ASMFUNCS is the list of
80918334Speter# functions.  LIB1ASMSRC is the name of the source file in the config
81018334Speter# subdirectory.
81118334Speterlibgcc1-asm.a: libgcc2.ready config.status $(srcdir)/config/$(LIB1ASMSRC)
81218334Speter	-rm -f tmplibgcc1.a libgcc1.S
81318334Speter	cp $(srcdir)/config/$(LIB1ASMSRC) libgcc1.S
81418334Speter# Actually build it in tmplibgcc1.a, then rename at end,
81518334Speter# so that libgcc1-asm.a itself remains nonexistent if compilation is aborted.
81618334Speter# -e causes any failing command to make this rule fail.
81718334Speter# -e doesn't work in certain shells, so we test $$? as well.
81818334Speter# lynx has a broken ar, it always complains when the initial library is
81918334Speter# empty, thus this command works only if we don't do -e
82018334Speter# There is a trailing backslash (\) deleted from the following line.
82118334Speter#	set -e;
82218334Speter	for name in $(LIB1ASMFUNCS); \
82318334Speter	do \
82418334Speter	  echo $${name}; \
82518334Speter	  $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} libgcc1.S; \
82618334Speter	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
82718334Speter	  mv libgcc1$(objext) $${name}$(objext); \
82818334Speter	  $(AR) $(AR_FLAGS) tmplibgcc1.a $${name}$(objext); \
82918334Speter	  rm -f $${name}$(objext); \
83018334Speter	done
83118334Speter	-rm -f libgcc1.S
83218334Speter	mv tmplibgcc1.a libgcc1-asm.a
83318334Speter
83418334Speter# Generate assembly versions of the functions required for libgcc1.
83518334Speter# You'll still need to massage the code by hand (possibly hacking
83618334Speter# underscores and local labels) but this will get you started.
83718334Speterlibgcc1.S: libgcc1.c $(CONFIG_H) config.status
83818334Speter	-rm -f libgcc1.S
83918334Speter	touch libgcc1.S
84018334Speter	for name in $(LIB1FUNCS); \
84118334Speter	do \
84218334Speter	  echo $${name}; \
84318334Speter	  $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -S -DL$${name} $(srcdir)/libgcc1.c; \
84418334Speter	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
84518334Speter	  echo '#ifdef ' L$${name} >> libgcc1.S; \
84618334Speter	  cat  libgcc1.s >> libgcc1.S; \
84718334Speter	  echo '#endif /*' L$${name} '*/' >> libgcc1.S; \
84818334Speter	  echo "" >> libgcc1.S; \
84918334Speter	done
85018334Speter
85118334Speter# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
85218334Speter# But recompiling cc1 should not force recompilation of libgcc2.a.
85318334Speter# If you want to force recompilation, delete libgcc2.a.
85418334Speterlibgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs
85518334Speter	-if [ -f libgcc2.ready ] ; then \
85618334Speter		true; \
85718334Speter	else \
85818334Speter		touch libgcc2.ready; \
85918334Speter	fi
86018334Speter
86118334Speterlibgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \
86218334Speter   machmode.h longlong.h gbl-ctors.h config.status
86318334Speter# Actually build it in tmplibgcc2.a, then rename at end,
86418334Speter# so that libgcc2.a itself remains nonexistent if compilation is aborted.
86518334Speter	-rm -f tmplibgcc2.a
86618334Speter# -e causes any failing command to make this rule fail.
86718334Speter# -e doesn't work in certain shells, so we test $$? as well.
86818334Speter# lynx has a broken ar, it always complains when the initial library is
86918334Speter# empty, thus this command works only if we don't do -e
87018334Speter# There is a trailing backslash (\) deleted from the following line.
87118334Speter#	set -e;
87218334Speter	for name in $(LIB2FUNCS); \
87318334Speter	do \
87418334Speter	  echo $${name}; \
87518334Speter	  $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
87618334Speter	      $(srcdir)/libgcc2.c -o $${name}$(objext); \
87718334Speter	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
87818334Speter	  $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}$(objext); \
87918334Speter	  rm -f $${name}$(objext); \
88018334Speter	done
88118334Speter# Some shells crash when a loop has no items.
88218334Speter# So make sure there is always at least one--`..'.
88318334Speter# Then ignore it.
88418334Speter# We don't use -e here because there are if statements
88518334Speter# that should not make the command give up when the if condition is false.
88618334Speter# Instead, we test for failure after each command where it matters.
88718334Speter	for file in .. $(LIB2FUNCS_EXTRA); \
88818334Speter	do \
88918334Speter	  if [ x$${file} != x.. ]; then \
89018334Speter	    name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//'`; \
89118334Speter	    oname=` echo $${name} | sed -e 's,.*/,,'`; \
89218334Speter	    echo $${name}; \
89318334Speter	    if [ $${name}.asm = $${file} ]; then \
89418334Speter	      cp $${file} $${name}.s || exit 1; file=$${name}.s; \
89518334Speter	    else true; fi; \
89618334Speter	    $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
89718334Speter	    if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
89818334Speter	    $(AR) $(AR_FLAGS) tmplibgcc2.a $${oname}$(objext); \
89918334Speter	    rm -f $${name}.s $${oname}$(objext); \
90018334Speter	  else true; \
90118334Speter	  fi; \
90218334Speter	done
90318334Speter	mv tmplibgcc2.a libgcc2.a
90418334Speter# These lines were deleted from above the mv command
90518334Speter# because ranlibing libgcc.a itself should suffice.
90618334Speter#	-if [ x${HPUX_GAS} = x ] ; then \
90718334Speter#	  if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc2.a; else true; fi; \
90818334Speter#	else true; fi
90918334Speter
91018334Speter# Combine the various libraries into a single library, libgcc.a.
91118334Speterlibgcc.a: $(LIBGCC1) $(LIBGCC2)
91218334Speter	-rm -rf tmplibgcc.a libgcc.a tmpcopy
91318334Speter	mkdir tmpcopy
91418334Speter	-if [ x$(LIBGCC1) != x ];			\
91518334Speter	then (cd tmpcopy; $(AR) x ../$(LIBGCC1));	\
91618334Speter	else true;					\
91718334Speter	fi
91818334Speter# Some versions of ar (specifically the one in RISC/os 5.x), create an
91918334Speter# unwritable table of contents file, and then print an error message when
92018334Speter# the second ar command tries to overwrite this file.  To avoid the error
92118334Speter# message from ar, we make sure all files are writable.
92218334Speter	-(cd tmpcopy; chmod +w * > /dev/null 2>&1)
92318334Speter	(cd tmpcopy; $(AR) x ../$(LIBGCC2))
92418334Speter	(cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *$(objext))
92518334Speter	rm -rf tmpcopy
92618334Speter	-if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
92718334Speter# Actually build it in tmplibgcc.a, then rename at end,
92818334Speter# so that libgcc.a itself remains nonexistent if compilation is aborted.
92918334Speter	mv tmplibgcc.a libgcc.a
93018334Speter
93118334Speter# Use the genmultilib shell script to generate the information the gcc
93218334Speter# driver program needs to select the library directory based on the
93318334Speter# switches.
93418334Spetermultilib.h: $(srcdir)/genmultilib Makefile
93518334Speter	$(SHELL) $(srcdir)/genmultilib "$(MULTILIB_OPTIONS)" \
93618334Speter	  "$(MULTILIB_DIRNAMES)" "$(MULTILIB_MATCHES)" > multilib.h
93718334Speter
93818334Speter# Build multiple copies of libgcc.a, one for each target switch.
93918334Speterstmp-multilib: $(LIBGCC1) libgcc2.c libgcc2.ready $(CONFIG_H) \
94018334Speter   $(LIB2FUNCS_EXTRA) machmode.h longlong.h gbl-ctors.h config.status
94118334Speter	for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
94218334Speter	  dir=`echo $$i | sed -e 's/;.*$$//'`; \
94318334Speter	  flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
94418334Speter	  $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
94518334Speter	    AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
94618334Speter	    RANLIB="$(RANLIB)" RANLIB_TEST="$(RANLIB_TEST)" \
94718334Speter	    HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
94818334Speter	    LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" \
94918334Speter	    LIBGCC1="$(LIBGCC1)" LIBGCC2="$(LIBGCC2)" \
95018334Speter	    dir="$${dir}" stmp-multilib-sub; \
95118334Speter	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
95218334Speter	done
95318334Speter	touch stmp-multilib
95418334Speter
95518334Speter# Subroutine of stmp-multilib so make -n works.
95618334Speterstmp-multilib-sub:
95718334Speter	rm -f $(dir)/libgcc.a $(LIBGCC2)
95818334Speter	$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
95918334Speter	  AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
96018334Speter	  HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
96118334Speter	  LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC2)
96218334Speter	if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
96318334Speter	then true; \
96418334Speter	else rm -f $(LIBGCC1); \
96518334Speter	fi
96618334Speter	if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
96718334Speter	then true; \
96818334Speter	else \
96918334Speter	  $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
97018334Speter	    AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
97118334Speter	    HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
97218334Speter	    LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC1); \
97318334Speter	fi
97418334Speter	rm -rf tmplibgcc.a tmpcopy
97518334Speter	mkdir tmpcopy
97618334Speter	if [ x$(LIBGCC1) != x ]; \
97718334Speter	then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
97818334Speter	else true; \
97918334Speter	fi
98018334Speter	(cd tmpcopy; $(AR) x ../$(LIBGCC2))
98118334Speter	(cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *$(objext))
98218334Speter	rm -rf libgcc2.a tmpcopy
98318334Speter	if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
98418334Speter	if [ -d $(dir) ]; then true; else mkdir $(dir); fi
98518334Speter	mv tmplibgcc.a $(dir)/libgcc.a
98618334Speter
98718334Speterobjc-runtime: libobjc.a
98818334Speter
98918334Speter# Build the Objective C runtime library.
99018334Speterlibobjc.a: cc1obj stmp-int-hdrs libgcc2.ready $(USE_COLLECT2) $(EXTRA_PARTS)
99118334Speter	if [ -d objc ]; then true; else mkdir objc; fi
99218334Speter	thisdir1=`pwd`; \
99318334Speter	srcdir1=`cd $(srcdir); pwd`; \
99418334Speter	cd objc; \
99518334Speter	$(MAKE) -f $${srcdir1}/objc/Makefile libobjc.a \
99618334Speter	  srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
99718334Speter	  GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
99818334Speter	  GCC_CFLAGS="$(GCC_CFLAGS)"
99918334Speter	-rm -f libobjc.a
100018334Speter	ln objc/libobjc.a . >/dev/null 2>&1 || cp objc/libobjc.a .
100118334Speter	-if $(RANLIB_TEST) ; then $(RANLIB) libobjc.a; else true; fi
100218334Speter
100318334Speter# This is used by objc/Makefile if the user runs that directly.
100418334Spetersublibobjc.a: cc1obj stmp-int-hdrs libgcc2.ready
100518334Speter	thisdir1=`pwd`; \
100618334Speter	srcdir1=`cd $(srcdir); pwd`; \
100718334Speter	cd objc; \
100818334Speter	$(MAKE) -f $$srcdir1/objc/Makefile libobjc.a \
100918334Speter	  srcdir=$$srcdir1 tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
101018334Speter	  GCC_FOR_TARGET="$$thisdir1/xgcc -B$$thisdir1/" \
101118334Speter	  GCC_CFLAGS="$(GCC_CFLAGS)"
101218334Speter
101318334Speter# Compile two additional files that are linked with every program
101418334Speter# linked using GCC on systems using COFF or ELF, for the sake of C++
101518334Speter# constructors.
101618334Spetercrtbegin.o: stamp-crt ; @true
101718334Spetercrtend.o: stamp-crt; @true
101818334Speter
101918334Speterstamp-crt:	crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
102018334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS) \
102118334Speter	  -DCRT_BEGIN -finhibit-size-directive -fno-inline-functions \
102218334Speter	  -g0 -c $(srcdir)/crtstuff.c
102318334Speter	mv crtstuff$(objext) crtbegin$(objext)
102418334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS) \
102518334Speter	  -DCRT_END -finhibit-size-directive -fno-inline-functions \
102618334Speter	  -g0 -c $(srcdir)/crtstuff.c
102718334Speter	mv crtstuff$(objext) crtend$(objext)
102818334Speter	touch stamp-crt
102918334Speter
103018334Speter# On some systems we also want to install versions of these files
103118334Speter# compiled using PIC for use in shared libraries.
103218334SpetercrtbeginS.o crtendS.o: stamp-crtS ; @true
103318334Speter
103418334Speterstamp-crtS:	crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
103518334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS) \
103618334Speter	  -DCRT_BEGIN -finhibit-size-directive -fno-inline-functions \
103718334Speter	  -g0 -c $(srcdir)/crtstuff.c -fPIC
103818334Speter	mv crtstuff$(objext) crtbeginS$(objext)
103918334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS) \
104018334Speter	  -DCRT_END -finhibit-size-directive -fno-inline-functions \
104118334Speter	  -g0 -c $(srcdir)/crtstuff.c -fPIC
104218334Speter	mv crtstuff$(objext) crtendS$(objext)
104318334Speter	touch stamp-crtS
104418334Speter
104518334Speter# Compiling object files from source files.
104618334Speter
104718334Speter# Note that dependencies on obstack.h are not written
104818334Speter# because that file is not part of GCC.
104918334Speter
105018334Speter# C language specific files.
105118334Speter
105218334Speterc-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
105318334Speter    $(srcdir)/c-parse.h c-tree.h input.h flags.h
105418334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
105518334Speter$(srcdir)/c-parse.h: $(srcdir)/c-parse.c
105618334Speter$(srcdir)/c-parse.c: $(srcdir)/c-parse.y
105718334Speter	cd $(srcdir); $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
105818334Speter$(srcdir)/c-parse.y: c-parse.in
105918334Speter	sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
106018334Speter	  -e "/^ifc$$/d" -e "/^end ifc$$/d" \
106118334Speter	  $(srcdir)/c-parse.in >tmp-c-parse.y
106218334Speter	$(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y
106318334Speter
106418334Speter$(srcdir)/c-gperf.h: c-parse.gperf
106518334Speter	gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \
106618334Speter	   $(srcdir)/c-parse.gperf >tmp-gperf.h
106718334Speter	 $(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
106818334Speter
106918334Speterc-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h output.h
107018334Speterc-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h output.h
107118334Speterc-lang.o : c-lang.c $(CONFIG_H) $(TREE_H)
107218334Speterc-lex.o : c-lex.c $(CONFIG_H) $(TREE_H) c-lex.h c-tree.h $(srcdir)/c-parse.h \
107318334Speter    input.h flags.h $(srcdir)/c-gperf.h c-pragma.h
107418334Speterc-aux-info.o : c-aux-info.c  $(CONFIG_H) $(TREE_H) c-tree.h flags.h
107518334Speterc-convert.o : c-convert.c $(CONFIG_H) $(TREE_H) flags.h
107618334Speterc-pragma.o: c-pragma.c $(CONFIG_H) $(TREE_H) c-pragma.h
107718334Speterc-iterate.o: c-iterate.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h flags.h
107818334Speter
107918334Speter# To make a configuration always use collect2, set USE_COLLECT2 to ld.
108018334Speterld: collect2
108118334Speter	rm -f ld$(exeext)
108218334Speter	ln collect2$(exeext) ld$(exeext) > /dev/null 2>&1 \
108318334Speter	   || cp collect2$(exeext) ld$(exeext)
108418334Speter
108518334Spetercollect2 : collect2.o cplus-dem.o underscore.o version.o $(LIBDEPS)
108618334Speter# Don't try modifying collect2 (aka ld) in place--it might be linking this.
108718334Speter	-rm -f collect2$(exeext)
108818334Speter	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ collect2.o \
108918334Speter	  cplus-dem.o underscore.o version.o $(LIBS)
109018334Speter
109118334Spetercollect2.o : collect2.c $(CONFIG_H) gstab.h obstack.h demangle.h
109218334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES)  \
109318334Speter	-DTARGET_MACHINE=\"$(target)\" $(MAYBE_USE_COLLECT2) \
109418334Speter	-c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
109518334Speter
109618334Spetercplus-dem.o: cplus-dem.c demangle.h
109718334Speter
109818334Speterunderscore.c: stamp-under ; @true
109918334Speter
110018334Speterstamp-under: $(GCC_PASSES)
110118334Speter	echo "int xxy_us_dummy;" >tmp-dum.c
110218334Speter	$(GCC_FOR_TARGET) -S tmp-dum.c
110318334Speter	echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c
110418334Speter	if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \
110518334Speter	  echo "int prepends_underscore = 1;" >>tmp-under.c; \
110618334Speter	else \
110718334Speter	  echo "int prepends_underscore = 0;" >>tmp-under.c; \
110818334Speter	fi
110918334Speter	$(srcdir)/move-if-change tmp-under.c underscore.c
111018334Speter	-rm -f tmp-dum.c tmp-dum.s
111118334Speter	touch stamp-under
111218334Speter
111318334Speter# Objective C language specific files.
111418334Speter
111518334Speterobjc-parse.o : $(srcdir)/objc-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
111618334Speter   c-tree.h input.h flags.h objc-act.h
111718334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/objc-parse.c
111818334Speter$(srcdir)/objc-parse.c : $(srcdir)/objc-parse.y
111918334Speter	cd $(srcdir); $(BISON) $(BISONFLAGS) objc-parse.y -o objc-parse.c
112018334Speter$(srcdir)/objc-parse.y: $(srcdir)/c-parse.in
112118334Speter	sed -e "/^ifc$$/,/^end ifc$$/d" \
112218334Speter	  -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
112318334Speter	  $(srcdir)/c-parse.in >tmp-objc-prs.y
112418334Speter	$(srcdir)/move-if-change tmp-objc-prs.y $(srcdir)/objc-parse.y
112518334Speter
112618334Speterobjc-act.o : objc-act.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h c-lex.h \
112718334Speter   flags.h objc-act.h input.h function.h $(srcdir)/c-parse.h
112818334Speter
112918334Speter# A file used by all variants of C.
113018334Speter
113118334Speterc-common.o : c-common.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
113218334Speter
113318334Speter# Language-independent files.
113418334Speter
113518334Spetergcc.o: gcc.c $(CONFIG_H) multilib.h config.status $(lang_specs_files)
113618334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
113718334Speter  -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
113818334Speter  -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
113918334Speter  -DDEFAULT_TARGET_VERSION=\"$(version)\" \
114018334Speter  -DDEFAULT_TARGET_MACHINE=\"$(target)\" \
114118334Speter  -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\" \
114218334Speter  $(MAYBE_TARGET_DEFAULT) \
114318334Speter  -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
114418334Speter
114518334Speterdumpvers: dumpvers.c
114618334Speter
114718334Speterversion.o: version.c
114818334Speterobstack.o: obstack.c
114918334Speter
115018334Speterconvert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h
115118334Speter
115218334Spetertree.o : tree.c $(CONFIG_H) $(TREE_H) flags.h function.h
115318334Speterprint-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
115418334Speterstor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) flags.h function.h
115518334Speterfold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h 
115618334Spetertoplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) bytecode.h bc-emit.h \
115718334Speter   flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \
115818334Speter   $(lang_options_files)
115918334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
116018334Speter	  $(MAYBE_TARGET_DEFAULT) $(MAYBE_USE_COLLECT2) \
116118334Speter	  -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
116218334Speter
116318334Speterrtl.o : rtl.c $(CONFIG_H) $(RTL_H)
116418334Speter
116518334Speterprint-rtl.o : print-rtl.c $(CONFIG_H) $(RTL_H)
116618334Speterrtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
116718334Speter
116818334Spetervarasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h function.h \
116918334Speter   defaults.h insn-codes.h expr.h hard-reg-set.h regs.h xcoffout.h \
117018334Speter   output.h bytecode.h c-pragma.h
117118334Speterfunction.o : function.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h  \
117218334Speter   insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
117318334Speter   recog.h output.h bytecode.h
117418334Speterstmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h  \
117518334Speter   insn-flags.h insn-config.h insn-codes.h hard-reg-set.h expr.h loop.h \
117618334Speter   recog.h bytecode.h bc-typecd.h bc-typecd.def bc-opcode.h bc-optab.h \
117718334Speter   bc-emit.h
117818334Speterexpr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h regs.h \
117918334Speter   insn-flags.h insn-codes.h expr.h insn-config.h recog.h output.h \
118018334Speter   typeclass.h bytecode.h bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h \
118118334Speter   bc-emit.h modemap.def
118218334Spetercalls.o : calls.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-codes.h \
118318334Speter   insn-flags.h
118418334Speterexpmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h  \
118518334Speter   insn-flags.h insn-config.h insn-codes.h expr.h recog.h real.h
118618334Speterexplow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h hard-reg-set.h \
118718334Speter   insn-config.h expr.h recog.h insn-flags.h insn-codes.h
118818334Speteroptabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h  \
118918334Speter   insn-flags.h insn-config.h insn-codes.h expr.h recog.h reload.h
119018334Speterdbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h regs.h \
119118334Speter   insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h
119218334Spetersdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) gsyms.h flags.h \
119318334Speter   insn-config.h reload.h
119418334Speterdwarfout.o : dwarfout.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf.h flags.h \
119518334Speter   insn-config.h reload.h output.h defaults.h
119618334Speterxcoffout.o : xcoffout.c $(CONFIG_H) $(TREE_H) $(RTL_H) xcoffout.h flags.h
119718334Speteremit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
119818334Speter   function.h regs.h insn-config.h insn-codes.h real.h expr.h bytecode.h \
119918334Speter   bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h bc-emit.h bc-opname.h
120018334Speterreal.o : real.c $(CONFIG_H) $(TREE_H)
120118334Spetergetpwd.o : getpwd.c $(CONFIG_H)
120218334Speter
120318334Speterintegrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h integrate.h \
120418334Speter   insn-flags.h insn-config.h insn-codes.h expr.h real.h function.h \
120518334Speter   bytecode.h
120618334Speter
120718334Speterjump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
120818334Speter   insn-config.h insn-flags.h insn-codes.h expr.h real.h
120918334Speterstupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h
121018334Speter
121118334Spetercse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h real.h \
121218334Speter   insn-config.h recog.h
121318334Speterloop.o : loop.c $(CONFIG_H) $(RTL_H) flags.h loop.h insn-config.h \
121418334Speter   insn-flags.h insn-codes.h regs.h hard-reg-set.h recog.h expr.h real.h
121518334Speterunroll.o : unroll.c $(CONFIG_H) $(RTL_H) insn-config.h insn-codes.h \
121618334Speter   integrate.h regs.h flags.h expr.h loop.h
121718334Speterflow.o : flow.c $(CONFIG_H) $(RTL_H) flags.h insn-config.h \
121818334Speter   basic-block.h regs.h hard-reg-set.h output.h
121918334Spetercombine.o : combine.c $(CONFIG_H) $(RTL_H) flags.h  \
122018334Speter   insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \
122118334Speter   basic-block.h recog.h real.h hard-reg-set.h
122218334Speterregclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
122318334Speter   basic-block.h regs.h insn-config.h recog.h reload.h real.h bytecode.h
122418334Speterlocal-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h basic-block.h \
122518334Speter   regs.h hard-reg-set.h insn-config.h recog.h output.h
122618334Speterglobal.o : global.c $(CONFIG_H) $(RTL_H) flags.h  \
122718334Speter   basic-block.h regs.h hard-reg-set.h insn-config.h output.h
122818334Speter
122918334Speterreload.o : reload.c $(CONFIG_H) $(RTL_H) flags.h output.h \
123018334Speter   reload.h recog.h hard-reg-set.h insn-config.h insn-codes.h regs.h real.h
123118334Speterreload1.o : reload1.c $(CONFIG_H) $(RTL_H) real.h flags.h expr.h \
123218334Speter   reload.h regs.h hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
123318334Speter   basic-block.h recog.h output.h
123418334Spetercaller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \
123518334Speter   regs.h hard-reg-set.h insn-codes.h insn-config.h basic-block.h recog.h \
123618334Speter   reload.h expr.h
123718334Speterreorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
123818334Speter   basic-block.h regs.h insn-config.h insn-attr.h insn-flags.h recog.h \
123918334Speter   flags.h output.h
124018334Spetersched.o : sched.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h \
124118334Speter   flags.h insn-config.h insn-attr.h
124218334Speterfinal.o : final.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h regs.h \
124318334Speter   recog.h conditions.h insn-config.h insn-attr.h real.h output.h \
124418334Speter   hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
124518334Speterrecog.o : recog.c $(CONFIG_H) $(RTL_H)  \
124618334Speter   regs.h recog.h hard-reg-set.h flags.h insn-config.h insn-attr.h \
124718334Speter   insn-flags.h insn-codes.h real.h
124818334Speterreg-stack.o : reg-stack.c $(CONFIG_H) $(RTL_H) $(TREE_H) \
124918334Speter   regs.h hard-reg-set.h flags.h insn-config.h
125018334Speter
125118334Speter$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \
125218334Speter   $(RTL_H) regs.h hard-reg-set.h real.h insn-config.h conditions.h \
125318334Speter   insn-flags.h output.h insn-attr.h insn-codes.h
125418334Speter	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file)
125518334Speter
125618334Speter# Build auxiliary files that support ecoff format.
125718334Spetermips-tfile: mips-tfile.o version.o $(LIBDEPS)
125818334Speter	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS)
125918334Speter
126018334Spetermips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H)
126118334Speter
126218334Spetermips-tdump: mips-tdump.o version.o $(LIBDEPS)
126318334Speter	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tdump.o version.o $(LIBS)
126418334Speter
126518334Spetermips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H)
126618334Speter
126718334Speter# Build file to support OSF/rose half-pic format.
126818334Speterhalfpic.o: halfpic.c $(CONFIG_H) $(RTL_H) $(TREE_H)
126918334Speter
127018334Speter# Normally this target is not used; but it is used if you
127118334Speter# define ALLOCA=alloca.o.  In that case, you must get a suitable alloca.c
127218334Speter# from the GNU Emacs distribution.
127318334Speteralloca.o:	alloca.c
127418334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
127518334Speter	  -c `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
127618334Speter	$(ALLOCA_FINISH)
127718334Speter
127818334Speter# Generate header and source files from the machine description, 
127918334Speter# and compile them.
128018334Speter
128118334Speter.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
128218334Speter  insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
128318334Speter  insn-attr.h insn-attrtab.c
128418334Speter
128518334Speter# The following pair of rules has this effect:
128618334Speter# genconfig is run only if the md has changed since genconfig was last run;
128718334Speter# but the file insn-config.h is touched only when its contents actually change.
128818334Speter
128918334Speter# Each of the other insn-* files is handled by a similar pair of rules.
129018334Speter
129118334Speter# This causes an anomaly in the results of make -n
129218334Speter# because insn-* is older than stamp-*
129318334Speter# and thus make -n thinks that insn-* will be updated
129418334Speter# and force recompilation of things that depend on it.
129518334Speter# We use move-if-change precisely to avoid such recompilation.
129618334Speter# But there is no way to teach make -n that it will be avoided.
129718334Speter
129818334Speter# Each of the insn-*.[ch] rules has a semicolon at the end,
129918334Speter# for otherwise the system Make on SunOS 4.1 never tries
130018334Speter# to recompile insn-*.o.  To avoid problems and extra noise from
130118334Speter# versions of make which don't like empty commands (nothing after the
130218334Speter# trailing `;'), we call true for each.
130318334Speter
130418334Speterinsn-config.h: stamp-config ; @true
130518334Speterstamp-config : $(md_file) genconfig $(srcdir)/move-if-change
130618334Speter	./genconfig $(md_file) > tmp-config.h
130718334Speter	$(srcdir)/move-if-change tmp-config.h insn-config.h
130818334Speter	touch stamp-config
130918334Speter
131018334Speterinsn-flags.h: stamp-flags ; @true
131118334Speterstamp-flags : $(md_file) genflags $(srcdir)/move-if-change
131218334Speter	./genflags $(md_file) > tmp-flags.h
131318334Speter	$(srcdir)/move-if-change tmp-flags.h insn-flags.h
131418334Speter	touch stamp-flags
131518334Speter
131618334Speterinsn-codes.h: stamp-codes ; @true
131718334Speterstamp-codes : $(md_file) gencodes $(srcdir)/move-if-change
131818334Speter	./gencodes $(md_file) > tmp-codes.h
131918334Speter	$(srcdir)/move-if-change tmp-codes.h insn-codes.h
132018334Speter	touch stamp-codes
132118334Speter
132218334Speterinsn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h real.h output.h \
132318334Speter  insn-config.h insn-flags.h insn-codes.h
132418334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
132518334Speter
132618334Speterinsn-emit.c: stamp-emit ; @true
132718334Speterstamp-emit : $(md_file) genemit $(srcdir)/move-if-change
132818334Speter	./genemit $(md_file) > tmp-emit.c
132918334Speter	$(srcdir)/move-if-change tmp-emit.c insn-emit.c
133018334Speter	touch stamp-emit
133118334Speter
133218334Speterinsn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h recog.h \
133318334Speter  real.h output.h flags.h
133418334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
133518334Speter
133618334Speterinsn-recog.c: stamp-recog ; @true
133718334Speterstamp-recog : $(md_file) genrecog $(srcdir)/move-if-change
133818334Speter	./genrecog $(md_file) > tmp-recog.c
133918334Speter	$(srcdir)/move-if-change tmp-recog.c insn-recog.c
134018334Speter	touch stamp-recog
134118334Speter
134218334Speterinsn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
134318334Speter  insn-config.h flags.h rtl.h recog.h expr.h reload.h
134418334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
134518334Speter
134618334Speterinsn-opinit.c: stamp-opinit ; @true
134718334Speterstamp-opinit : $(md_file) genopinit $(srcdir)/move-if-change
134818334Speter	./genopinit $(md_file) > tmp-opinit.c
134918334Speter	$(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
135018334Speter	touch stamp-opinit
135118334Speter
135218334Speterinsn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H)
135318334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
135418334Speter
135518334Speterinsn-extract.c: stamp-extract ; @true
135618334Speterstamp-extract : $(md_file) genextract $(srcdir)/move-if-change
135718334Speter	./genextract $(md_file) > tmp-extract.c
135818334Speter	$(srcdir)/move-if-change tmp-extract.c insn-extract.c
135918334Speter	touch stamp-extract
136018334Speter
136118334Speterinsn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h output.h real.h
136218334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
136318334Speter
136418334Speterinsn-peep.c: stamp-peep ; @true
136518334Speterstamp-peep : $(md_file) genpeep $(srcdir)/move-if-change
136618334Speter	./genpeep $(md_file) > tmp-peep.c
136718334Speter	$(srcdir)/move-if-change tmp-peep.c insn-peep.c
136818334Speter	touch stamp-peep
136918334Speter
137018334Speterinsn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) regs.h real.h output.h \
137118334Speter     insn-attr.h insn-config.h
137218334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
137318334Speter
137418334Speterinsn-attr.h: stamp-attr ; @true
137518334Speterstamp-attr : $(md_file) genattr $(srcdir)/move-if-change
137618334Speter	./genattr $(md_file) > tmp-attr.h
137718334Speter	$(srcdir)/move-if-change tmp-attr.h insn-attr.h
137818334Speter	touch stamp-attr
137918334Speter
138018334Speterinsn-attrtab.c: stamp-attrtab ; @true
138118334Speterstamp-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change
138218334Speter	if cmp -s $(PREMADE_ATTRTAB_MD) $(md_file);	\
138318334Speter	then					\
138418334Speter	  echo Using $(PREMADE_ATTRTAB);	\
138518334Speter	  cp $(PREMADE_ATTRTAB) tmp-attrtab.c;	\
138618334Speter	else					\
138718334Speter	  ./genattrtab $(md_file) > tmp-attrtab.c;	\
138818334Speter	fi
138918334Speter	$(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
139018334Speter	touch stamp-attrtab
139118334Speter
139218334Speterinsn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
139318334Speter    hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h recog.h \
139418334Speter    insn-codes.h
139518334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
139618334Speter
139718334Speterinsn-output.c: stamp-output ; @true
139818334Speterstamp-output : $(md_file) genoutput $(srcdir)/move-if-change
139918334Speter	./genoutput $(md_file) > tmp-output.c
140018334Speter	$(srcdir)/move-if-change tmp-output.c insn-output.c
140118334Speter	touch stamp-output
140218334Speter
140318334Speter# Compile the programs that generate insn-* from the machine description.
140418334Speter# They are compiled with $(HOST_CC), and associated libraries,
140518334Speter# since they need to run on this machine
140618334Speter# even if GCC is being compiled to run on some other machine.
140718334Speter
140818334Speter# $(CONFIG_H) is omitted from the deps of the gen*.o
140918334Speter# because these programs don't really depend on anything 
141018334Speter# about the target machine.  They do depend on config.h itself,
141118334Speter# since that describes the host machine.
141218334Speter
141318334Speter# Pass the md file through cpp if the target requests it.
141418334Speter$(MD_FILE): $(MD_DEPS)
141518334Speter	rm -f $@
141618334Speter	$(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@
141718334Speter	mv tmp-$@ $@
141818334Speter
141918334Spetergenconfig : genconfig.o $(HOST_RTL) $(HOST_LIBDEPS)
142018334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
142118334Speter	  genconfig.o $(HOST_RTL) $(HOST_LIBS)
142218334Speter
142318334Spetergenconfig.o : genconfig.c $(RTL_H) $(build_xm_file)
142418334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
142518334Speter
142618334Spetergenflags : genflags.o $(HOST_RTL) $(HOST_LIBDEPS)
142718334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
142818334Speter	 genflags.o $(HOST_RTL) $(HOST_LIBS)
142918334Speter
143018334Spetergenflags.o : genflags.c $(RTL_H) $(build_xm_file)
143118334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
143218334Speter
143318334Spetergencodes : gencodes.o $(HOST_RTL) $(HOST_LIBDEPS)
143418334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
143518334Speter	 gencodes.o $(HOST_RTL) $(HOST_LIBS)
143618334Speter
143718334Spetergencodes.o : gencodes.c $(RTL_H) $(build_xm_file)
143818334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
143918334Speter
144018334Spetergenemit : genemit.o $(HOST_RTL) $(HOST_LIBDEPS)
144118334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
144218334Speter	 genemit.o $(HOST_RTL) $(HOST_LIBS)
144318334Speter
144418334Spetergenemit.o : genemit.c $(RTL_H) $(build_xm_file)
144518334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
144618334Speter
144718334Spetergenopinit : genopinit.o $(HOST_RTL) $(HOST_LIBDEPS)
144818334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
144918334Speter	 genopinit.o $(HOST_RTL) $(HOST_LIBS)
145018334Speter
145118334Spetergenopinit.o : genopinit.c $(RTL_H) $(build_xm_file)
145218334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
145318334Speter
145418334Spetergenrecog : genrecog.o $(HOST_RTL) $(HOST_LIBDEPS)
145518334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
145618334Speter	 genrecog.o $(HOST_RTL) $(HOST_LIBS)
145718334Speter
145818334Spetergenrecog.o : genrecog.c $(RTL_H) $(build_xm_file)
145918334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
146018334Speter
146118334Spetergenextract : genextract.o $(HOST_RTL) $(HOST_LIBDEPS)
146218334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
146318334Speter	 genextract.o $(HOST_RTL) $(HOST_LIBS)
146418334Speter
146518334Spetergenextract.o : genextract.c $(RTL_H) $(build_xm_file) insn-config.h
146618334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
146718334Speter
146818334Spetergenpeep : genpeep.o $(HOST_RTL) $(HOST_LIBDEPS)
146918334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
147018334Speter	 genpeep.o $(HOST_RTL) $(HOST_LIBS)
147118334Speter
147218334Spetergenpeep.o : genpeep.c $(RTL_H) $(build_xm_file)
147318334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
147418334Speter
147518334Spetergenattr : genattr.o $(HOST_RTL) $(HOST_LIBDEPS)
147618334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
147718334Speter	 genattr.o $(HOST_RTL) $(HOST_LIBS)
147818334Speter
147918334Spetergenattr.o : genattr.c $(RTL_H) $(build_xm_file)
148018334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
148118334Speter
148218334Spetergenattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
148318334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
148418334Speter	 genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
148518334Speter
148618334Spetergenattrtab.o : genattrtab.c $(RTL_H)  $(build_xm_file) insn-config.h
148718334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
148818334Speter
148918334Spetergenoutput : genoutput.o $(HOST_RTL) $(HOST_LIBDEPS)
149018334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
149118334Speter	 genoutput.o $(HOST_RTL) $(HOST_LIBS)
149218334Speter
149318334Spetergenoutput.o : genoutput.c $(RTL_H) $(build_xm_file)
149418334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
149518334Speter
149618334Speter# Compile the libraries to be used by gen*.
149718334Speter# If we are not cross-building, gen* use the same .o's that cc1 will use,
149818334Speter# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
149918334Speter# with the rules for rtl.o, alloca.o, etc.
150018334Speter$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) $(RTL_H)
150118334Speter	rm -f $(HOST_PREFIX)rtl.c
150218334Speter	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
150318334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
150418334Speter
150518334Speter$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H)
150618334Speter	rm -f $(HOST_PREFIX)print-rtl.c
150718334Speter	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
150818334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
150918334Speter
151018334Speter$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
151118334Speter	rm -f $(HOST_PREFIX)rtlanal.c
151218334Speter	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
151318334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
151418334Speter
151518334Speter$(HOST_PREFIX_1)alloca.o: alloca.c
151618334Speter	rm -f $(HOST_PREFIX)alloca.c
151718334Speter	cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
151818334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
151918334Speter
152018334Speter$(HOST_PREFIX_1)obstack.o: obstack.c
152118334Speter	rm -f $(HOST_PREFIX)obstack.c
152218334Speter	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/obstack.c > $(HOST_PREFIX)obstack.c
152318334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
152418334Speter
152518334Speter$(HOST_PREFIX_1)malloc.o: malloc.c
152618334Speter	rm -f $(HOST_PREFIX)malloc.c
152718334Speter	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
152818334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
152918334Speter
153018334Speter# This satisfies the dependency that we get if you cross-compile a compiler
153118334Speter# that does not need to compile alloca, malloc or whatever.
153218334Speter$(HOST_PREFIX_1): 
153318334Speter	touch $(HOST_PREFIX_1)
153418334Speter
153518334Speter# Remake bytecode files.
153618334SpeterBI_OBJ=bi-parser.o bi-lexer.o bi-reverse.o
153718334Speter
153818334Speterbc-emit.o : bc-emit.c $(CONFIG_H) $(RTL_H) real.h $(BYTECODE_H) \
153918334Speter   bc-arity.h bc-opcode.h bc-typecd.h bc-typecd.def bi-run.h bytetypes.h
154018334Speterbc-optab.o : bc-optab.c $(CONFIG_H) $(REAL_H) $(BYTECODE_H) \
154118334Speter   bc-opcode.h bc-typecd.h bc-typecd.def
154218334Speter
154318334Speterbi-arity: bi-arity.o $(BI_OBJ) $(HOST_LIBDEPS)
154418334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
154518334Speter	 bi-arity.o $(BI_OBJ) $(HOST_LIBS)
154618334Speterbi-opcode: bi-opcode.o $(BI_OBJ) $(HOST_LIBDEPS)
154718334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
154818334Speter	 bi-opcode.o $(BI_OBJ) $(HOST_LIBS)
154918334Speterbi-opname: bi-opname.o $(BI_OBJ) $(HOST_LIBDEPS)
155018334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
155118334Speter	 bi-opname.o $(BI_OBJ) $(HOST_LIBS)
155218334Speter
155318334Speter$(srcdir)/bi-parser.h: $(srcdir)/bi-parser.c
155418334Speter$(srcdir)/bi-parser.c: $(srcdir)/bi-parser.y
155518334Speter	cd $(srcdir); $(BISON) $(BISONFLAGS) -d bi-parser.y -o bi-parser.c
155618334Speter
155718334Speterbi-parser.o: $(srcdir)/bi-parser.c bi-defs.h $(build_xm_file)
155818334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
155918334Speter	   $(srcdir)/bi-parser.c
156018334Speterbi-lexer.o: bi-lexer.c $(srcdir)/bi-parser.h $(build_xm_file)
156118334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
156218334Speter	   $(srcdir)/bi-lexer.c
156318334Speterbi-arity.o: bi-arity.c bi-defs.h $(build_xm_file)
156418334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
156518334Speter	   $(srcdir)/bi-arity.c
156618334Speterbi-opcode.o: bi-opcode.c bi-defs.h $(build_xm_file)
156718334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
156818334Speter	   $(srcdir)/bi-opcode.c
156918334Speterbi-opname.o: bi-opname.c bi-defs.h $(build_xm_file)
157018334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
157118334Speter	   $(srcdir)/bi-opname.c
157218334Speterbi-reverse.o: bi-reverse.c bi-defs.h
157318334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
157418334Speter	   $(srcdir)/bi-reverse.c
157518334Speter
157618334Speterbc-arity.h: stamp-bcarity ; @true
157718334Speterstamp-bcarity : $(srcdir)/bytecode.def bi-arity $(srcdir)/move-if-change
157818334Speter	./bi-arity < $(srcdir)/bytecode.def >tmp-bc-arity.h
157918334Speter	$(srcdir)/move-if-change tmp-bc-arity.h bc-arity.h
158018334Speter	touch stamp-bcarity
158118334Speter
158218334Speterbc-opcode.h: stamp-bcopcode ; @true
158318334Speterstamp-bcopcode : $(srcdir)/bytecode.def bi-opcode $(srcdir)/move-if-change
158418334Speter	./bi-opcode < $(srcdir)/bytecode.def >tmp-bcopcd.h
158518334Speter	$(srcdir)/move-if-change tmp-bcopcd.h bc-opcode.h
158618334Speter	touch stamp-bcopcode
158718334Speter
158818334Speterbc-opname.h: stamp-bcopname ; @true
158918334Speterstamp-bcopname : $(srcdir)/bytecode.def bi-opname $(srcdir)/move-if-change
159018334Speter	./bi-opname < $(srcdir)/bytecode.def >tmp-bcopnm.h
159118334Speter	$(srcdir)/move-if-change tmp-bcopnm.h bc-opname.h
159218334Speter	touch stamp-bcopname
159318334Speter
159418334Speterbytecode.mostlyclean:
159518334Speter	-rm -f bc-arity.h bc-opcode.h bc-opname.h
159618334Speter
159718334Speterbytecode.distclean bytecode.clean:	bytecode.mostlyclean
159818334Speter	-rm -f bi-arity bi-opcode bi-opname bi-lexer
159918334Speter
160018334Speterbytecode.maintainer-clean: bytecode.clean
160118334Speter	-rm -f bi-parser.c bi-parser.h
160218334Speter
160318334Speter
160418334Speter# Remake cpp and protoize.
160518334Speter
160618334Speter# Making the preprocessor
160718334Spetercpp: $(CCCP)
160818334Speter	-rm -f cpp$(exeext)
160918334Speter	ln $(CCCP)$(exeext) cpp$(exeext) > /dev/null 2>&1 \
161018334Speter	 || cp $(CCCP)$(exeext) cpp$(exeext)
161118334Spetercccp: cccp.o cexp.o version.o $(LIBDEPS)
161218334Speter	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cccp.o cexp.o \
161318334Speter	  version.o $(LIBS)
161418334Spetercexp.o: $(srcdir)/cexp.c $(CONFIG_H)
161518334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
161618334Speter$(srcdir)/cexp.c: $(srcdir)/cexp.y
161718334Speter	cd $(srcdir); $(BISON) -o cexp.c cexp.y
161818334Speter
161918334Spetercccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status
162018334Speter# The reason we use $(libdir)/g++-include rather than using libsubdir
162118334Speter# is for compatibility with the current version of libg++.
162218334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
162318334Speter	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
162418334Speter	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
162518334Speter	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
162618334Speter	  -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
162718334Speter	  -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
162818334Speter	  -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
162918334Speter
163018334Spetercppmain: cppmain.o cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o \
163118334Speter  version.o $(LIBDEPS)
163218334Speter	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cppmain.o cpplib.o cpphash.o \
163318334Speter	  cppalloc.o cpperror.o cppexp.o version.o $(LIBS)
163418334Speter
163518334Spetercpplib.o: cpplib.c $(CONFIG_H) cpplib.h cpphash.h config.status
163618334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
163718334Speter	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
163818334Speter	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
163918334Speter	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
164018334Speter	  -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
164118334Speter	  -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
164218334Speter	  -c `echo $(srcdir)/cpplib.c | sed 's,^\./,,'`
164318334Speter
164418334Spetercpperror.o: cpperror.c $(CONFIG_H) cpplib.h
164518334Speter
164618334Spetercppexp.o: cppexp.c $(CONFIG_H) cpplib.h
164718334Speter
164818334Spetercpphash.o: cpphash.c cpplib.h cpphash.h
164918334Speter
165018334Spetercppalloc.o: cppalloc.c $(CONFIG_H)
165118334Speter
165218334Speter# Note for the stamp targets, we run the program `true' instead of
165318334Speter# having an empty command (nothing following the semicolon).
165418334Speter
165518334Speterproto: config.status protoize unprotoize SYSCALLS.c.X
165618334Speter
165718334Speterprotoize: protoize.o getopt.o getopt1.o getpwd.o version.o $(LIBDEPS)
165818334Speter	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
165918334Speter	  protoize.o getopt.o getopt1.o getpwd.o version.o $(LIBS)
166018334Speterprotoize.o: stamp-proto ; @true
166118334Speter
166218334Speterunprotoize: unprotoize.o getopt.o getopt1.o getpwd.o version.o $(LIBDEPS)
166318334Speter	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
166418334Speter	  unprotoize.o getopt.o getopt1.o getpwd.o version.o $(LIBS)
166518334Speterunprotoize.o:	stamp-proto ; @true
166618334Speter
166718334Speterstamp-proto: protoize.c getopt.h $(CONFIG_H)
166818334Speter	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
166918334Speter          -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
167018334Speter	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
167118334Speter          -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
167218334Speter	  -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
167318334Speter	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
167418334Speter	  -DSTD_PROTO_DIR=\"$(libsubdir)\" \
167518334Speter	  -DUNPROTOIZE $(srcdir)/protoize.c
167618334Speter	mv protoize$(objext) unprotoize$(objext)
167718334Speter	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
167818334Speter          -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
167918334Speter	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
168018334Speter          -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
168118334Speter	  -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
168218334Speter	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
168318334Speter	  -DSTD_PROTO_DIR=\"$(libsubdir)\" \
168418334Speter	  $(srcdir)/protoize.c
168518334Speter	touch stamp-proto
168618334Speter
168718334Spetergetopt.o: getopt.c getopt.h
168818334Speter	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt.c
168918334Spetergetopt1.o: getopt1.c getopt.h
169018334Speter	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt1.c
169118334Speter
169218334Speter# This info describes the target machine, so compile with GCC just built.
169318334SpeterSYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \
169418334Speter   stmp-int-hdrs
169518334Speter	-rm -f SYSCALLS.c tmp-SYSCALLS.s
169618334Speter	cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
169718334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
169818334Speter	  -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
169918334Speter	-rm -f SYSCALLS.c tmp-SYSCALLS.s
170018334Speter
170118334Speter
170218334Spetertest-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
170318334Speter	-rm -f tmp-proto.[cso]
170418334Speter	cp $(srcdir)/protoize.c tmp-proto.c
170518334Speter	chmod u+w tmp-proto.c
170618334Speter	./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
170718334Speter	  $(CFLAGS) $(INCLUDES) \
170818334Speter	  -DGCC_INCLUDE_DIR=0 \
170918334Speter	  -DGPLUSPLUS_INCLUDE_DIR=0 \
171018334Speter	  -DCROSS_INCLUDE_DIR=0 \
171118334Speter	  -DTOOL_INCLUDE_DIR=0 \
171218334Speter	  -DSTD_PROTO_DIR=0" tmp-proto.c
171318334Speter	@echo '**********' Expect 400 lines of differences.
171418334Speter	-diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
171518334Speter	-wc -l tmp-proto.diff
171618334Speter	./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
171718334Speter	  $(CFLAGS) $(INCLUDES) \
171818334Speter	  -DGCC_INCLUDE_DIR=0 \
171918334Speter	  -DGPLUSPLUS_INCLUDE_DIR=0 \
172018334Speter	  -DCROSS_INCLUDE_DIR=0 \
172118334Speter	  -DTOOL_INCLUDE_DIR=0 \
172218334Speter	  -DSTD_PROTO_DIR=0" tmp-proto.c
172318334Speter	@echo Expect zero differences.
172418334Speter	diff $(srcdir)/protoize.c tmp-proto.c | cat
172518334Speter	-rm -f tmp-proto.[cs] tmp-proto$(objext)
172618334Speter
172718334Speter# Build the include directory.  The stamp files are stmp-* rather than
172818334Speter# stamp-* so that mostlyclean does not force the include directory to
172918334Speter# be rebuilt.
173018334Speter
173118334Speter# Build the include directory except for float.h (which depends upon
173218334Speter# enquire).
173318334Speterstmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h objc-headers
173418334Speter# Copy in the headers provided with gcc.
173518334Speter# The sed command gets just the last file name component;
173618334Speter# this is necessary because VPATH could add a dirname.
173718334Speter# Using basename would be simpler, but some systems don't have it.
173818334Speter	objdir=`pwd`; \
173918334Speter	cd $(srcdir); \
174018334Speter	for file in .. $(USER_H); do \
174118334Speter	  if [ X$$file != X.. ]; then \
174218334Speter	    realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
174318334Speter	    rm -f $$objdir/include/$$realfile; \
174418334Speter	    cp ginclude/$$realfile $$objdir/include; \
174518334Speter	    chmod a+r $$objdir/include/$$realfile; \
174618334Speter	  fi; \
174718334Speter	done
174818334Speter	rm -f include/limits.h
174918334Speter	cp xlimits.h include/limits.h
175018334Speter	chmod a+r include/limits.h
175118334Speter# Install the README
175218334Speter	rm -f include/README
175318334Speter	cp $(srcdir)/README-fixinc include/README
175418334Speter	chmod a+r include/README
175518334Speter	touch stmp-int-hdrs
175618334Speter
175718334Speter# Build the complete include directory.
175818334Speterstmp-headers: stmp-int-hdrs gfloat.h
175918334Speter	rm -f include/float.h
176018334Speter	cp gfloat.h include/float.h
176118334Speter	chmod a+r include/float.h
176218334Speter	touch stmp-headers
176318334Speter
176418334Speter# Build fixed copies of system files.
176518334Speterstmp-fixinc: $(FIXINCLUDES) gsyslimits.h
176618334Speter	rm -rf include
176718334Speter	mkdir include
176818334Speter	if [ x$(FIXINCLUDES) != xMakefile.in ]; \
176918334Speter	then \
177018334Speter	  for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
177118334Speter	    if [ -d $$dir ]; \
177218334Speter	    then \
177318334Speter	      $(SHELL) $(srcdir)/$(FIXINCLUDES) include $$dir; \
177418334Speter	    else true; fi; \
177518334Speter	  done; \
177618334Speter	else true; \
177718334Speter	fi
177818334Speter	rm -f include/syslimits.h
177918334Speter	if [ -f include/limits.h ]; then \
178018334Speter	  mv include/limits.h include/syslimits.h; \
178118334Speter	else \
178218334Speter	  cp $(srcdir)/gsyslimits.h include/syslimits.h; \
178318334Speter	fi
178418334Speter	chmod a+r include/syslimits.h
178518334Speter	touch stmp-fixinc
178618334Speter
178718334Speter# copy objc header files into build directory
178818334Speterobjc-headers: stmp-fixinc
178918334Speter	if [ -d include ]; then true; else mkdir include; fi
179018334Speter	if [ -d objc ]; then true; else mkdir objc; fi
179118334Speter	thisdir1=`pwd`; \
179218334Speter	srcdir1=`cd $(srcdir); pwd`; \
179318334Speter	cd objc; \
179418334Speter	$(MAKE) -f $${srcdir1}/objc/Makefile copy-headers \
179518334Speter	srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
179618334Speter	GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
179718334Speter	GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=$${thisdir1}/include
179818334Speter	touch objc-headers
179918334Speter
180018334Speter# Files related to the fixproto script.
180118334Speter
180218334Speterdeduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
180318334Speter	CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -Iinclude -I${SYSTEM_HEADER_DIR}"; \
180418334Speter	  export CC; \
180518334Speter	  $(SHELL) $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h
180618334Speter	mv tmp-deduced.h deduced.h
180718334Speter
180818334Spetergen-protos: gen-protos.o scan.o cppalloc.o $(HOST_LIBDEPS)
180918334Speter	${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
181018334Speter	  gen-protos.o scan.o cppalloc.o $(HOST_LIBS)
181118334Speter
181218334Spetergen-protos.o: gen-protos.c scan.h $(build_xm_file)
181318334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c
181418334Speter
181518334Speterscan.o: scan.c scan.h $(build_xm_file)
181618334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c
181718334Speter
181818334Speterxsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
181918334Speter	cat deduced.h $(srcdir)/sys-protos.h > tmp-fixtmp.c
182018334Speter	mv tmp-fixtmp.c fixtmp.c
182118334Speter	$(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
182218334Speter	  | sed -e 's/	/ /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
182318334Speter	  | ./gen-protos >xsys-protos.hT
182418334Speter	mv xsys-protos.hT xsys-protos.h
182518334Speter	rm -rf fixtmp.c
182618334Speter
182718334Speterfix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS) \
182818334Speter   cpplib.o cpphash.o cppalloc.o cppexp.o cpperror.o version.o
182918334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ fix-header.o \
183018334Speter	   scan-decls.o scan.o cpplib.o cpphash.o cppalloc.o version.o \
183118334Speter	   cppexp.o $(HOST_LIBS)
183218334Speter
183318334Speterfix-header.o: fix-header.c obstack.h scan.h xsys-protos.h $(build_xm_file)
183418334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c
183518334Speter
183618334Speterscan-decls.o: scan-decls.c scan.h cpplib.h $(build_xm_file)
183718334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c
183818334Speter
183918334Speter# stmp-fixproto depends on this, not on fix-header directly.
184018334Speter# The idea is to make sure fix-header gets built,
184118334Speter# but not rerun fixproto after each stage
184218334Speter# just because fix-header's mtime has changed.
184318334Speterfixhdr.ready: fix-header
184418334Speter	-if [ -f fixhdr.ready ] ; then \
184518334Speter		true; \
184618334Speter	else \
184718334Speter		touch fixhdr.ready; \
184818334Speter	fi
184918334Speter
185018334Speter# stmp-headers is to make sure fixincludes has already finished.
185118334Speter# The if statement is so that we don't run fixproto a second time
185218334Speter# if it has already been run on the files in `include'.
185318334Speterstmp-fixproto: fixhdr.ready fixproto stmp-headers
185418334Speter	@echo "Various warnings and error messages from fixproto are normal"
185518334Speter	-if [ -d include ] ; then true; else mkdir include; fi
185618334Speter	-if [ -f include/fixed ] ; then true; \
185718334Speter	else \
185818334Speter	  : This line works around a 'make' bug in BSDI 1.1.; \
185918334Speter	  FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
186018334Speter	  $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
186118334Speter	  touch include/fixed; \
186218334Speter	fi
186318334Speter	touch stmp-fixproto
186418334Speter
186518334Speter# Remake the info files.
186618334Speter
186718334Speterdoc: info
186818334Speterinfo: $(srcdir)/cpp.info $(srcdir)/gcc.info lang.info
186918334Speter
187018334Speter$(srcdir)/cpp.info: cpp.texi
187118334Speter	cd $(srcdir); $(MAKEINFO) cpp.texi
187218334Speter
187318334Speter$(srcdir)/gcc.info: gcc.texi extend.texi install.texi invoke.texi \
187418334Speter		md.texi rtl.texi tm.texi 
187518334Speter	cd $(srcdir); $(MAKEINFO) gcc.texi
187618334Speter
187718334Speterdvi: $(srcdir)/gcc.dvi $(srcdir)/cpp.dvi lang.dvi
187818334Speter
187918334Speter# This works with GNU Make's default rule.
188018334Speter$(srcdir)/gcc.dvi: gcc.texi extend.texi install.texi invoke.texi \
188118334Speter		md.texi rtl.texi tm.texi 
188218334Speter	$(TEXI2DVI) $<
188318334Speter
188418334Speter# This works with GNU Make's default rule.
188518334Speter$(srcdir)/cpp.dvi: cpp.texi
188618334Speter	$(TEXI2DVI) $<
188718334Speter
188818334Speter$(srcdir)/INSTALL: install1.texi install.texi
188918334Speter	$(MAKEINFO) -D INSTALLONLY --no-header --no-split \
189018334Speter	  `echo $(srcdir)/install1.texi | sed 's,^\./,,'`
189118334Speter
189218334Speter# Deletion of files made during compilation.
189318334Speter# There are four levels of this:
189418334Speter#   `mostlyclean', `clean', `distclean' and `maintainer-clean'.
189518334Speter# `mostlyclean' is useful while working on a particular type of machine.
189618334Speter# It deletes most, but not all, of the files made by compilation.
189718334Speter# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
189818334Speter# `clean' deletes everything made by running `make all'.
189918334Speter# `distclean' also deletes the files made by config.
190018334Speter# `maintainer-clean' also deletes everything that could be regenerated
190118334Speter# automatically.  We remove as much from the language subdirectories as we can
190218334Speter# (less duplicated code).
190318334Speter
190418334Speter
190518334Spetermostlyclean: bytecode.mostlyclean lang.mostlyclean
190618334Speter	-rm -f $(STAGESTUFF)
190718334Speter# Clean the objc subdir if we created one.
190818334Speter	if [ -d objc ]; then \
190918334Speter	  srcdir1=`cd $(srcdir); pwd`; \
191018334Speter	  cd objc; $(MAKE) -f $$srcdir1/objc/Makefile mostlyclean; \
191118334Speter	else true; fi
191218334Speter	-rm -f libobjc.a
191318334Speter# Delete the temporary source copies for cross compilation.
191418334Speter	-rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
191518334Speter	-rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
191618334Speter	-rm -f $(HOST_PREFIX_1)obstack.c 
191718334Speter# Delete the temp files made in the course of building libgcc.a.
191818334Speter	-rm -f tmplibgcc* tmpcopy xlimits.h
191918334Speter	for name in $(LIB1FUNCS); do rm -f $${name}.c; done
192018334Speter# Delete other temporary files.
192118334Speter	-rm -f tmp-float.h tmp-gcc.xtar.gz
192218334Speter	-rm -f tmp-foo1 tmp-foo2 tmp-proto.* tmp-unproto.1 tmp-SYSCALLS.s
192318334Speter	-rm -f tmp-c-parse.y tmp-objc-prs.y tmp-gperf.h
192418334Speter	-rm -f tmp-specs t-float.h-cross tmp-xlimits.h
192518334Speter	-rm -f tmp-fixtmp.c xsys-protos.hT
192618334Speter# Delete the stamp files.
192718334Speter	-rm -f stamp-* tmp-*
192818334Speter	-rm -f */stamp-* */tmp-*
192918334Speter# Delete debugging dump files.
193018334Speter	-rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
193118334Speter	-rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack
193218334Speter	-rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl
193318334Speter	-rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2
193418334Speter	-rm -f */*.sched2 */*.stack
193518334Speter# Delete some files made during installation.
193618334Speter	-rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
193718334Speter	-rm -f collect collect2 mips-tfile mips-tdump alloca.s
193818334Speter# Delete files generated for fixproto
193918334Speter	-rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \
194018334Speter	  gen-protos fixproto.list fixtmp.* fixhdr.ready
194118334Speter# Delete unwanted output files from TeX.
194218334Speter	-rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
194318334Speter	-rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg
194418334Speter# Delete sorted indices we don't actually use.
194518334Speter	-rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
194618334Speter# Delete core dumps.
194718334Speter	-rm -f core */core
194818334Speter
194918334Speter# Delete all files made by compilation
195018334Speter# that don't exist in the distribution.
195118334Speterclean: mostlyclean bytecode.clean lang.clean
195218334Speter# It may not be quite desirable to delete unprotoize.c here,
195318334Speter# but the spec for `make clean' requires it.
195418334Speter# Using unprotoize.c is not quite right in the first place, 
195518334Speter# but what better way is there?
195618334Speter	-rm -f libgcc.a libgcc1.a libgcc1-asm.a libgcc2.a libgcc2.ready
195718334Speter	-rm -f libgcc1.null
195818334Speter	-rm -f *.dvi
195918334Speter	-rm -f */*.dvi
196018334Speter	-if [ -f md.pre-cpp ]; then \
196118334Speter	  rm -f md ; \
196218334Speter	fi
196318334Speter# Delete the include directory.
196418334Speter	-rm -rf stmp-* include objc-headers
196518334Speter	-rm -f */stmp-*
196618334Speter# Delete files used by the "multilib" facility (including libgcc subdirs).
196718334Speter	-rm -f multilib.h tmpmultilib*
196818334Speter	-if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \
196918334Speter	  rm -rf $(MULTILIB_DIRNAMES); \
197018334Speter	else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \
197118334Speter	  rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \
197218334Speter	fi ; fi
197318334Speter
197418334Speter# Delete all files that users would normally create
197518334Speter# while building and installing GCC.
197618334Speterdistclean: clean bytecode.distclean lang.distclean
197718334Speter	-rm -f tm.h config.h tconfig.h hconfig.h md
197818334Speter	-rm -f config.status config.run
197918334Speter	-rm -f Makefile specs.h options.h *.oaux
198018334Speter	-rm -fr stage1 stage2 stage3 stage4
198118334Speter	-rm -f */stage1 */stage2 */stage3 */stage4 */include
198218334Speter	-rm -f objc-parse.output
198318334Speter	-rm -f c-parse.output
198418334Speter	-rm -f *.asm
198518334Speter
198618334Speter# Delete anything likely to be found in the source directory
198718334Speter# that shouldn't be in the distribution.
198818334Speterextraclean: distclean lang.extraclean
198918334Speter	-rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
199018334Speter	-rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
199118334Speter	-rm -f config/*/=* config/*/"#"* config/*/*~*
199218334Speter	-rm -f config/*/*.orig config/*/*.rej
199318334Speter	-rm -f *.dvi *.ps *.oaux *.d *.[zZ] *.gz
199418334Speter	-rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
199518334Speter	-rm -f *lose config/*lose config/*/*lose
199618334Speter	-rm -f *.s *.s[0-9] *.i install1.texi config/ChangeLog
199718334Speter	-rm -f */=* */"#"* */*~*
199818334Speter	-rm -f */patch* */*.orig */*.rej
199918334Speter	-rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz
200018334Speter	-rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs
200118334Speter	-rm -f */*lose */*.s */*.s[0-9] */*.i
200218334Speter
200318334Speter# Get rid of every file that's generated from some other file.
200418334Speter# Most of these files ARE PRESENT in the GCC distribution.
200518334Spetermaintainer-clean: distclean bytecode.maintainer-clean lang.maintainer-clean
200618334Speter	-rm -f c-parse.y c-gperf.h objc-parse.y
200718334Speter	-rm -f objc-parse.c objc-parse.output
200818334Speter	-rm -f c-parse.c c-parse.h c-parse.output
200918334Speter	-rm -f cexp.c cexp.output TAGS 
201018334Speter	-rm -f cpp.info* cpp.??s cpp.*aux
201118334Speter	-rm -f gcc.info* gcc.??s gcc.*aux
201218334Speter
201318334Speter# Entry points `install' and `uninstall'.
201418334Speter# Also use `install-collect2' to install collect2 when the config files don't.
201518334Speter
201618334Speter# The semicolon is to prevent the install.sh -> install default rule
201718334Speter# from doing anything.  Having it run true helps avoid problems and
201818334Speter# noise from versions of make which don't like to have null commands.
201918334Speterinstall: $(INSTALL_TARGET) ; @true
202018334Speter
202118334Speter# Copy the compiler files into directories where they will be run.
202218334Speter# Install the driver last so that the window when things are
202318334Speter# broken is small.
202418334Speterinstall-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
202518334Speter    install-libobjc install-man install-info lang.install-normal install-driver
202618334Speter
202718334Speter# Do nothing while making gcc with a cross-compiler. The person who
202818334Speter# makes gcc for the target machine has to know how to put a complete
202918334Speter# gcc together by hand.
203018334Speterinstall-build: force
203118334Speter	@echo You have to install gcc on your target machine by hand.
203218334Speter
203318334Speter# Run this on the target machine
203418334Speter# to finish installation of cross compiler.
203518334Speterinstall-cross-rest: install-float-h-cross
203618334Speter
203718334Speter# Install float.h for cross compiler.
203818334Speter# Run this on the target machine!
203918334Speterinstall-float-h-cross: install-dir
204018334Speter#	if [ -f enquire ] ; then true; else false; fi
204118334Speter# Note: don't use -.  We should fail right away if enquire was not made.
204218334Speter	./enquire -f > $(tmpdir)/float.h
204318334Speter	-rm -f $(libsubdir)/include/float.h
204418334Speter	$(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
204518334Speter	-rm -f $(tmpdir)/float.h
204618334Speter	chmod a-x $(libsubdir)/include/float.h
204718334Speter
204818334Speter# Create the installation directory.
204918334Speterinstall-dir:
205018334Speter	-if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
205118334Speter	-if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi
205218334Speter# This dir isn't currently searched by cpp.
205318334Speter#	-if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
205418334Speter	-if [ -d $(libdir)/gcc-lib/$(target) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target) ; chmod a+rx $(libdir)/gcc-lib/$(target) ; fi
205518334Speter	-if [ -d $(libdir)/gcc-lib/$(target)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version) ; chmod a+rx $(libdir)/gcc-lib/$(target)/$(version) ; fi
205618334Speter	-if [ -d $(libdir)/gcc-lib/$(target)/$(version)/include ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version)/include ; chmod a+rx $(libdir)/gcc-lib/$(target)/$(version)/include ; fi
205718334Speter	-if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
205818334Speter	-if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
205918334Speter	-if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; chmod a+rx $(tooldir) ; fi
206018334Speter	-if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
206118334Speter	-if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
206218334Speter# We don't use mkdir -p to create the parents of mandir,
206318334Speter# because some systems don't support it.
206418334Speter# Instead, we use this technique to create the immediate parent of mandir.
206518334Speter	-parent=`echo $(mandir)|sed -e 's@/[^/]*$$@@'`; \
206618334Speter	if [ -d $$parent ] ; then true ; else mkdir $$parent ; chmod a+rx $$parent ; fi
206718334Speter	-if [ -d $(mandir) ] ; then true ; else mkdir $(mandir) ; chmod a+rx $(mandir) ; fi
206818334Speter
206918334Speter# Install the compiler executables built during cross compilation.
207018334Speterinstall-common: native install-dir $(EXTRA_PARTS) lang.install-common
207118334Speter	for file in $(COMPILERS); do \
207218334Speter	  if [ -f $$file ] ; then \
207318334Speter	    rm -f $(libsubdir)/$$file; \
207418334Speter	    $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
207518334Speter	  else true; \
207618334Speter	  fi; \
207718334Speter	done
207818334Speter	for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
207918334Speter	  if [ x"$$file" != x.. ]; then \
208018334Speter	    rm -f $(libsubdir)/$$file; \
208118334Speter	    $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
208218334Speter	  else true; fi; \
208318334Speter	done
208418334Speter	for file in $(EXTRA_PARTS) ..; do \
208518334Speter	  if [ x"$$file" != x.. ]; then \
208618334Speter	    rm -f $(libsubdir)/$$file; \
208718334Speter	    $(INSTALL_DATA) $$file $(libsubdir)/$$file; \
208818334Speter	  else true; fi; \
208918334Speter	done
209018334Speter# Don't mess with specs if it doesn't exist yet.
209118334Speter	-if [ -f specs ] ; then \
209218334Speter	  rm -f $(libsubdir)/specs; \
209318334Speter	  $(INSTALL_DATA) specs $(libsubdir)/specs; \
209418334Speter	fi
209518334Speter# Install protoize if it was compiled.
209618334Speter	-if [ -f protoize$(exeext) ]; \
209718334Speter	then \
209818334Speter	    rm -f $(bindir)/protoize$(exeext); \
209918334Speter	    $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/protoize$(exeext); \
210018334Speter	    rm -f $(bindir)/unprotoize$(exeext); \
210118334Speter	    $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/unprotoize$(exeext); \
210218334Speter	    rm -f $(libsubdir)/SYSCALLS.c.X; \
210318334Speter	    $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
210418334Speter	    chmod a-x $(libsubdir)/SYSCALLS.c.X; \
210518334Speter	fi
210618334Speter	-rm -f $(libsubdir)/cpp$(exeext)
210718334Speter	$(INSTALL_PROGRAM) cpp$(exeext) $(libsubdir)/cpp$(exeext)
210818334Speter
210918334Speter# Install the driver program as $(target)-gcc
211018334Speter# and also as either gcc (if native) or $(tooldir)/bin/gcc.
211118334Speterinstall-driver: xgcc
211218334Speter	-if [ -f gcc-cross$(exeext) ] ; then \
211318334Speter	  rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
211418334Speter	  $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
211518334Speter	  if [ -d $(tooldir)/bin/. ] ; then \
211618334Speter	    rm -f $(tooldir)/bin/gcc$(exeext); \
211718334Speter	    $(INSTALL_PROGRAM) gcc-cross$(exeext) $(tooldir)/bin/gcc$(exeext); \
211818334Speter	  else true; fi; \
211918334Speter	else \
212018334Speter	  rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
212118334Speter	  $(INSTALL_PROGRAM) xgcc$(exeext) $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
212218334Speter	  rm -f $(bindir)/$(target)-gcc-1$(exeext); \
212318334Speter	  ln $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target)-gcc-1$(exeext) \
212418334Speter	    > /dev/null 2>&1 \
212518334Speter	    || cp $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target)-gcc-1$(exeext); \
212618334Speter	  mv $(bindir)/$(target)-gcc-1$(exeext) $(bindir)/$(target)-gcc$(exeext); \
212718334Speter	fi
212818334Speter
212918334Speter# Install the info files.
213018334Speterinstall-info: doc install-dir lang.install-info
213118334Speter	-rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
213218334Speter	cd $(srcdir); for f in cpp.info* gcc.info*; \
213318334Speter	do $(INSTALL_DATA) $$f $(infodir)/$$f; done
213418334Speter	-chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
213518334Speter
213618334Speter# Install the man pages.
213718334Speterinstall-man: install-dir $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man
213818334Speter	-if [ -f gcc-cross ] ; then \
213918334Speter	  rm -f $(mandir)/$(GCC_CROSS_NAME)$(manext); \
214018334Speter	  $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/$(GCC_CROSS_NAME)$(manext); \
214118334Speter	  chmod a-x $(mandir)/$(GCC_CROSS_NAME)$(manext); \
214218334Speter	else \
214318334Speter	  rm -f $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
214418334Speter	  $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
214518334Speter	  chmod a-x $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
214618334Speter	fi
214718334Speter	-rm -f $(mandir)/cccp$(manext)
214818334Speter	-$(INSTALL_DATA) $(srcdir)/cccp.1 $(mandir)/cccp$(manext)
214918334Speter	-chmod a-x $(mandir)/cccp$(manext)
215018334Speter
215118334Speter# Install the library.
215218334Speterinstall-libgcc: libgcc.a install-dir
215318334Speter	-if [ -f libgcc.a ] ; then \
215418334Speter	  rm -f $(libsubdir)/libgcc.a; \
215518334Speter	  $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
215618334Speter	  if $(RANLIB_TEST) ; then \
215718334Speter	    (cd $(libsubdir); $(RANLIB) libgcc.a); else true; fi; \
215818334Speter	  chmod a-x $(libsubdir)/libgcc.a; \
215918334Speter	else true; fi
216018334Speter
216118334Speter# Install multiple versions of libgcc.a.
216218334Speterinstall-multilib: stmp-multilib install-dir
216318334Speter	for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
216418334Speter	  dir=`echo $$i | sed -e 's/;.*$$//'`; \
216518334Speter	  if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \
216618334Speter	  rm -f $(libsubdir)/$${dir}/libgcc.a; \
216718334Speter	  $(INSTALL_DATA) $${dir}/libgcc.a $(libsubdir)/$${dir}/libgcc.a; \
216818334Speter	  if $(RANLIB_TEST); then \
216918334Speter	    (cd $(libsubdir)/$${dir}; $(RANLIB) libgcc.a); else true; fi; \
217018334Speter	  chmod a-x $(libsubdir)/$${dir}/libgcc.a; \
217118334Speter	done
217218334Speter
217318334Speter# Install the objc run time library.
217418334Speterinstall-libobjc: install-dir
217518334Speter	-if [ -f libobjc.a ] ; then \
217618334Speter	  rm -f $(libsubdir)/libobjc.a; \
217718334Speter	  $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \
217818334Speter	  if $(RANLIB_TEST) ; then \
217918334Speter	    (cd $(libsubdir); $(RANLIB) libobjc.a); else true; fi; \
218018334Speter	  chmod a-x $(libsubdir)/libobjc.a; \
218118334Speter	else true; fi
218218334Speter
218318334Speter# Install all the header files built in the include subdirectory.
218418334Speterinstall-headers: install-include-dir $(INSTALL_HEADERS_DIR) $(INSTALL_ASSERT_H)
218518334Speter# Fix symlinks to absolute paths in the installed include directory to
218618334Speter# point to the installed directory, not the build directory.
218718334Speter	-files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
218818334Speter	if [ $$? -eq 0 ]; then \
218918334Speter	  dir=`cd include; pwd`; \
219018334Speter	  for i in $$files; do \
219118334Speter	    dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
219218334Speter	    if expr "$$dest" : "$$dir.*" > /dev/null; then \
219318334Speter	      rm -f $(libsubdir)/include/$$i; \
219418334Speter	      ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
219518334Speter	    fi; \
219618334Speter	  done; \
219718334Speter	fi
219818334Speter
219918334Speter# Create or recreate the gcc private include file directory.
220018334Speterinstall-include-dir: install-dir
220118334Speter	-rm -rf $(libsubdir)/include
220218334Speter	mkdir $(libsubdir)/include
220318334Speter	-chmod a+rx $(libsubdir)/include
220418334Speter
220518334Speter# Install the include directory using tar.
220618334Speterinstall-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
220718334Speter	(cd include; \
220818334Speter	 tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
220918334Speter# /bin/sh on some systems returns the status of the first tar,
221018334Speter# and that can lose with GNU tar which always writes a full block.
221118334Speter# So use `exit 0' to ignore its exit status.
221218334Speter
221318334Speter# Install the include directory using cpio.
221418334Speterinstall-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
221518334Speter	(cd include; find . -print) | (cd include; cpio -pdum $(libsubdir)/include)
221618334Speter
221718334Speter# Put assert.h where it won't override GNU libc's assert.h.
221818334Speter# It goes in a dir that is searched after GNU libc's headers;
221918334Speter# thus, the following conditionals are no longer needed.
222018334Speter# But it's not worth deleting them now.
222118334Speter## Don't replace the assert.h already there if it is not from GCC.
222218334Speter## This code would be simpler if it tested for -f ... && ! grep ...
222318334Speter## but supposedly the ! operator is missing in sh on some systems.
222418334Speterinstall-assert-h: assert.h install-dir
222518334Speter	if [ -f $(assertdir)/assert.h ]; \
222618334Speter	then \
222718334Speter	  if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
222818334Speter	    then \
222918334Speter	    rm -f $(assertdir)/assert.h; \
223018334Speter	    $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
223118334Speter	    chmod a-x $(assertdir)/assert.h; \
223218334Speter	  else true; \
223318334Speter	  fi; \
223418334Speter	else \
223518334Speter	  rm -f $(assertdir)/assert.h; \
223618334Speter	  $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
223718334Speter	  chmod a-x $(assertdir)/assert.h; \
223818334Speter	fi
223918334Speter
224018334Speter# Use this target to install the program `collect2' under the name `ld'.
224118334Speterinstall-collect2: collect2 install-dir
224218334Speter	$(INSTALL_PROGRAM) collect2$(exeext) $(libsubdir)/ld$(exeext)
224318334Speter# Install the driver program as $(libsubdir)/gcc for collect2.
224418334Speter	$(INSTALL_PROGRAM) xgcc$(exeext) $(libsubdir)/gcc$(exeext)
224518334Speter
224618334Speter# Cancel installation by deleting the installed files.
224718334Speteruninstall: lang.uninstall
224818334Speter	-rm -rf $(libsubdir)
224918334Speter	-rm -rf $(bindir)/$(GCC_INSTALL_NAME)$(exeext)
225018334Speter	-rm -rf $(bindir)/$(GCC_CROSS_NAME)$(exeext)
225118334Speter	-rm -rf $(bindir)/protoize$(exeext)
225218334Speter	-rm -rf $(bindir)/unprotoize$(exeext)
225318334Speter	-rm -rf $(mandir)/$(GCC_INSTALL_NAME)$(manext)
225418334Speter	-rm -rf $(mandir)/$(GCC_CROSS_NAME)$(manext)
225518334Speter	-rm -rf $(mandir)/cccp$(manext)
225618334Speter	-rm -rf $(mandir)/protoize$(manext)
225718334Speter	-rm -rf $(mandir)/unprotoize$(manext)
225818334Speter
225918334Speter# These exist for maintenance purposes.
226018334Speter
226118334Speter# Update the tags table.
226218334SpeterTAGS: force
226318334Speter	cd $(srcdir);							\
226418334Speter	mkdir temp;							\
226518334Speter	mv -f c-parse.[ch] objc-parse.c cexp.c =*.[chy] temp;		\
226618334Speter	etags *.y *.h *.c;						\
226718334Speter	mv temp/* .;							\
226818334Speter	rmdir temp
226918334Speter
227018334Speter# Create the distribution tar file.
227118334Speter#dist: gcc-$(version).tar.gz
227218334Speterdist: gcc.xtar.gz
227318334Speter
227418334Spetergcc.xtar.gz: gcc.xtar
227518334Speter	gzip --best < gcc.xtar > tmp-gcc.xtar.gz
227618334Speter	mv tmp-gcc.xtar.gz gcc.xtar.gz
227718334Speter
227818334Speter#gcc-$(version).tar.gz: gcc-$(version).tar
227918334Speter#	gzip < gcc-$(version).tar > gcc-$(version).tar.gz
228018334Speter
228118334Speter#gcc-$(version).tar:
228218334Spetergcc.xtar: distdir
228318334Speter# Make the distribution.
228418334Speter	tar -chf gcc.xtar gcc-$(version)
228518334Speter
228618334Speter# This target exists to do the initial work before the language specific
228718334Speter# stuff gets done.
228818334Speterdistdir-start: doc $(srcdir)/INSTALL $(srcdir)/c-parse.y $(srcdir)/c-gperf.h \
228918334Speter  $(srcdir)/objc-parse.y $(srcdir)/c-parse.c $(srcdir)/objc-parse.c \
229018334Speter  $(srcdir)/cexp.c
229118334Speter	@if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \
229218334Speter	then true; \
229318334Speter	else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
229418334Speter	fi
229518334Speter# Update the version number in README
229618334Speter	awk '$$1 " " $$2 " " $$3 == "This directory contains" \
229718334Speter		{ $$6 = version; print $$0 } \
229818334Speter	     $$1 " " $$2 " " $$3 != "This directory contains"' \
229918334Speter	  version=$(version) README > tmp.README
230018334Speter	mv tmp.README README
230118334Speter	-rm -rf gcc-$(version) tmp	
230218334Speter# Put all the files in a temporary subdirectory
230318334Speter# which has the name that we want to have in the tar file.
230418334Speter	mkdir tmp
230518334Speter	mkdir tmp/config
230618334Speter	mkdir tmp/ginclude
230718334Speter	mkdir tmp/objc
230818334Speter	for file in *[0-9a-zA-Z+]; do \
230918334Speter	  ln $$file tmp > /dev/null 2>&1 || cp $$file tmp; \
231018334Speter	done
231118334Speter	cd config; \
231218334Speter	for file in *[0-9a-zA-Z+]; do \
231318334Speter	  if test -d $$file && test "$$file" != RCS; then \
231418334Speter	    mkdir ../tmp/config/$$file; \
231518334Speter	    cd $$file; \
231618334Speter	    for subfile in *[0-9a-zA-Z+]; do \
231718334Speter	      ln $$subfile ../../tmp/config/$$file >/dev/null 2>&1 \
231818334Speter	      || cp $$subfile ../../tmp/config/$$file; \
231918334Speter	    done; \
232018334Speter	    cd ..; \
232118334Speter	  else \
232218334Speter	    ln $$file ../tmp/config >/dev/null 2>&1 \
232318334Speter	    || cp $$file ../tmp/config; \
232418334Speter	  fi; \
232518334Speter	done
232618334Speter	cd ginclude; \
232718334Speter	for file in *[0-9a-zA-Z+]; do \
232818334Speter	  ln $$file ../tmp/ginclude >/dev/null 2>&1 \
232918334Speter	   || cp $$file ../tmp/ginclude; \
233018334Speter	done
233118334Speter	cd objc; \
233218334Speter	for file in *[0-9a-zA-Z+]; do \
233318334Speter	  ln $$file ../tmp/objc >/dev/null 2>&1 || cp $$file ../tmp/objc; \
233418334Speter	done
233518334Speter	ln .gdbinit tmp
233618334Speter
233718334Speter# Finish making `distdir', after the languages have done their thing.
233818334Speterdistdir-finish:
233918334Speter	mv tmp gcc-$(version)
234018334Speter# Get rid of everything we don't want in the distribution.  We'd want
234118334Speter# this to use Makefile.in, but it doesn't have the `lang.foo' targets
234218334Speter# expanded.
234318334Speter	cd gcc-$(version); make extraclean
234418334Speter
234518334Speterdistdir: distdir-start lang.distdir distdir-finish
234618334Speter
234718334Speter# make diff oldversion=M.N 
234818334Speter# creates a diff file between an older distribution and this one.
234918334Speter# The -P option assumes this is GNU diff.
235018334Speterdiff:
235118334Speter	diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \
235218334Speter	  -x cexp.c -x bi-parser.c -x objc-parse.y -x objc-parse.c \
235318334Speter	  -x TAGS \
235418334Speter	  -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \
235518334Speter	  -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \
235618334Speter	  $(LANG_DIFF_EXCLUDES) \
235718334Speter	  gcc-$(oldversion) gcc-$(version) > diffs
235818334Speter
235918334Speterbootstrap: force
236018334Speter# Only build the C compiler for stage1, because that is the only one that
236118334Speter# we can guarantee will build with the native compiler, and also it is the
236218334Speter# only thing useful for building stage2.
236318334Speter	$(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES=c
236418334Speter	$(MAKE) stage1
236518334Speter# This used to define ALLOCA as empty, but that would lead to bad results
236618334Speter# for a subsequent `make install' since that would not have ALLOCA empty.
236718334Speter# To prevent `make install' from compiling alloca.o and then relinking cc1
236818334Speter# because alloca.o is newer, we permit these recursive makes to compile
236918334Speter# alloca.o.  Then cc1 is newer, so it won't have to be relinked.
237018334Speter	$(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
237118334Speter	$(MAKE) stage2
237218334Speter	$(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
237318334Speter
237418334Speterbootstrap2: force
237518334Speter	$(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
237618334Speter	$(MAKE) stage2
237718334Speter	$(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
237818334Speter
237918334Speterbootstrap3: force
238018334Speter	$(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
238118334Speter
238218334Speter# Compare the object files in the current directory with those in the
238318334Speter# stage2 directory.
238418334Speter
238518334Speter# ./ avoids bug in some versions of tail.
238618334Spetercompare: force
238718334Speter	for file in *$(objext); do \
238818334Speter	  tail +16c ./$$file > tmp-foo1; \
238918334Speter	  tail +16c stage2/$$file > tmp-foo2 2>/dev/null \
239018334Speter	    && (cmp tmp-foo1 tmp-foo2 || echo $$file differs) || true; \
239118334Speter	done
239218334Speter	for dir in tmp-foo $(SUBDIRS); do \
239318334Speter	  if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
239418334Speter	    for file in $$dir/*$(objext); do \
239518334Speter	      tail +16c ./$$file > tmp-foo1; \
239618334Speter	      tail +16c stage2/$$file > tmp-foo2 2>/dev/null \
239718334Speter	        && (cmp tmp-foo1 tmp-foo2 || echo $$file differs) || true; \
239818334Speter	    done; \
239918334Speter	  fi; \
240018334Speter	done
240118334Speter	-rm -f tmp-foo*
240218334Speter
240318334Speter# Similar, but compare with stage3 directory
240418334Spetercompare3: force
240518334Speter	for file in *$(objext); do \
240618334Speter	  tail +16c ./$$file > tmp-foo1; \
240718334Speter	  tail +16c stage3/$$file > tmp-foo2 2>/dev/null \
240818334Speter	    && (cmp tmp-foo1 tmp-foo2 || echo $$file differs) || true; \
240918334Speter	done
241018334Speter	for dir in tmp-foo $(SUBDIRS); do \
241118334Speter	  if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
241218334Speter	    for file in $$dir/*$(objext); do \
241318334Speter	      tail +16c ./$$file > tmp-foo1; \
241418334Speter	      tail +16c stage3/$$file > tmp-foo2 2>/dev/null \
241518334Speter	        && (cmp tmp-foo1 tmp-foo2 || echo $$file differs) || true; \
241618334Speter	    done; \
241718334Speter	  fi; \
241818334Speter	done
241918334Speter	-rm -f tmp-foo*
242018334Speter
242118334Speter# Compare the object files in the current directory with those in the
242218334Speter# stage2 directory.  Use gnu cmp (diffutils v2.4 or later) to avoid
242318334Speter# running tail and the overhead of twice copying each object file.
242418334Speter
242518334Spetergnucompare: force
242618334Speter	for file in *$(objext); do \
242718334Speter	  cmp --ignore-initial=16 $$file stage2/$$file || true ; \
242818334Speter	done
242918334Speter	for dir in tmp-foo $(SUBDIRS); do \
243018334Speter	  if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
243118334Speter	    for file in $$dir/*$(objext); do \
243218334Speter	      cmp --ignore-initial=16 $$file stage2/$$file || true ; \
243318334Speter	    done; \
243418334Speter	  fi; \
243518334Speter	done
243618334Speter
243718334Speter# Similar, but compare with stage3 directory
243818334Spetergnucompare3: force
243918334Speter	for file in *$(objext); do \
244018334Speter	  cmp --ignore-initial=16 $$file stage3/$$file || true ; \
244118334Speter	done
244218334Speter	for dir in tmp-foo $(SUBDIRS); do \
244318334Speter	  if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
244418334Speter	    for file in $$dir/*$(objext); do \
244518334Speter	      cmp --ignore-initial=16 $$file stage3/$$file || true ; \
244618334Speter	    done; \
244718334Speter	  fi; \
244818334Speter	done
244918334Speter
245018334Speter# Copy the object files from a particular stage into a subdirectory.
245118334Speterstage1-start:
245218334Speter	-if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
245318334Speter	-for dir in . $(SUBDIRS) ; \
245418334Speter	 do \
245518334Speter	   if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \
245618334Speter	 done
245718334Speter	-mv $(STAGESTUFF) stage1
245818334Speter# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
245918334Speter# dir will work properly.
246018334Speter	-if [ -f as$(exeext) ] ; then ln -s ../as$(exeext) stage1 || cp as$(exeext) stage1 ; else true ; fi
246118334Speter	-if [ -f ld$(exeext) ] ; then ln -s ../ld$(exeext) stage1 || cp ld$(exeext) stage1 ; else true ; fi
246218334Speter	-if [ -f collect-ld$(exeext) ] ; then ln -s ../collect-ld$(exeext) stage1 || cp collect-ld$(exeext) stage1 ; else true ; fi
246318334Speter	-rm -f stage1/libgcc.a
246418334Speter	-cp libgcc.a stage1
246518334Speter	-if $(RANLIB_TEST) ; then $(RANLIB) stage1/libgcc.a; else true; fi
246618334Speterstage1: force stage1-start lang.stage1
246718334Speter
246818334Speterstage2-start:
246918334Speter	-if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
247018334Speter	-for dir in . $(SUBDIRS) ; \
247118334Speter	 do \
247218334Speter	   if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \
247318334Speter	 done
247418334Speter	-mv $(STAGESTUFF) stage2
247518334Speter# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
247618334Speter# dir will work properly.
247718334Speter	-if [ -f as$(exeext) ] ; then ln -s ../as$(exeext) stage2 || cp as$(exeext) stage2 ; else true ; fi
247818334Speter	-if [ -f ld$(exeext) ] ; then ln -s ../ld$(exeext) stage2 || cp ld$(exeext) stage2 ; else true ; fi
247918334Speter	-if [ -f collect-ld ] ; then ln -s ../collect-ld$(exeext) stage2 || cp collect-ld$(exeext) stage2 ; else true ; fi
248018334Speter	-rm -f stage2/libgcc.a
248118334Speter	-cp libgcc.a stage2
248218334Speter	-if $(RANLIB_TEST) ; then $(RANLIB) stage2/libgcc.a; else true; fi
248318334Speterstage2: force stage2-start lang.stage2
248418334Speter
248518334Speterstage3-start:
248618334Speter	-if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
248718334Speter	-for dir in . $(SUBDIRS) ; \
248818334Speter	 do \
248918334Speter	   if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \
249018334Speter	 done
249118334Speter	-mv $(STAGESTUFF) stage3
249218334Speter# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
249318334Speter# dir will work properly.
249418334Speter	-if [ -f as$(exeext) ] ; then ln -s ../as$(exeext) stage3 || cp as$(exeext) stage3 ; else true ; fi
249518334Speter	-if [ -f ld$(exeext) ] ; then ln -s ../ld$(exeext) stage3 || cp ld$(exeext) stage3 ; else true ; fi
249618334Speter	-if [ -f collect-ld$(exeext) ] ; then ln -s ../collect-ld$(exeext) stage3 || cp collect-ld$(exeext) stage3 ; else true ; fi
249718334Speter	-rm -f stage3/libgcc.a
249818334Speter	-cp libgcc.a stage3
249918334Speter	-if $(RANLIB_TEST) ; then $(RANLIB) stage3/libgcc.a; else true; fi
250018334Speterstage3: force stage3-start lang.stage3
250118334Speter
250218334Speterstage4-start:
250318334Speter	-if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
250418334Speter	-for dir in . $(SUBDIRS) ; \
250518334Speter	 do \
250618334Speter	   if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \
250718334Speter	 done
250818334Speter	-mv $(STAGESTUFF) stage4
250918334Speter# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
251018334Speter# dir will work properly.
251118334Speter	-if [ -f as$(exeext) ] ; then ln -s ../as$(exeext) stage4 || cp as$(exeext) stage4 ; else true ; fi
251218334Speter	-if [ -f ld$(exeext) ] ; then ln -s ../ld$(exeext) stage4 || cp ld$(exeext) stage4 ; else true ; fi
251318334Speter	-if [ -f collect-ld$(exeext) ] ; then ln -s ../collect-ld$(exeext) stage4 || cp collect-ld$(exeext) stage4 ; else true ; fi
251418334Speter	-rm -f stage4/libgcc.a
251518334Speter	-cp libgcc.a stage4
251618334Speter	-if $(RANLIB_TEST) ; then $(RANLIB) stage4/libgcc.a; else true; fi
251718334Speterstage4: force stage4-start lang.stage4
251818334Speter
251918334Speter# Copy just the executable files from a particular stage into a subdirectory,
252018334Speter# and delete the object files.  Use this if you're just verifying a version
252118334Speter# that is pretty sure to work, and you are short of disk space.
252218334Speterrisky-stage1: stage1
252318334Speter	- make clean
252418334Speter
252518334Speterrisky-stage2: stage2
252618334Speter	-make clean
252718334Speter
252818334Speterrisky-stage3: stage3
252918334Speter	-make clean
253018334Speter
253118334Speterrisky-stage4: stage4
253218334Speter	-make clean
253318334Speter
253418334Speter#In GNU Make, ignore whether `stage*' exists.
253518334Speter.PHONY: stage1 stage2 stage3 stage4 clean maintainer-clean TAGS bootstrap
253618334Speter.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
253718334Speter
253818334Speterforce:
2539