Makefile.in revision 52298
118334Speter# Makefile for GNU C compiler.
252298Sobrien#   Copyright (C) 1987, 88, 90-98, 1999 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
2152298Sobrien# $FreeBSD: head/contrib/gcc/Makefile.in 52298 1999-10-16 08:21:54Z obrien $
2252298Sobrien
2318334Speter# The targets for external use include:
2418334Speter# all, doc, proto, install, install-cross, install-cross-rest,
2518334Speter# uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean,
2618334Speter# stage1, stage2, stage3, stage4.
2718334Speter
2818334Speter# Suppress smart makes who think they know how to automake Yacc files
2918334Speter.y.c:
3018334Speter
3150448Sobrien# Directory where sources are, from where we are.
3250448Sobriensrcdir = @srcdir@
3350448SobrienVPATH = @srcdir@
3450448Sobrien
3518334Speter# Variables that exist for you to override.
3618334Speter# See below for how to change them for certain systems.
3718334Speter
3818334Speter# List of language subdirectories.
3918334Speter# This is overridden by configure.
4050448SobrienSUBDIRS =@subdirs@
4118334Speter
4218334Speter# Selection of languages to be made.
4318334Speter# This is overridden by configure.
4452298SobrienCONFIG_LANGUAGES = @all_languages@
4552298SobrienLANGUAGES = c proto gcov$(exeext) $(CONFIG_LANGUAGES)
4618334Speter
4752298Sobrien# Languages should create dependencies of $(INTL_TARGETS) on generated
4852298Sobrien# sources in Make-lang.in.  Example:
4952298Sobrien# $(INTL_TARGETS): $(srcdir)/cp/parse.c
5052298SobrienINTL_TARGETS = intl.all intl.install intl.distdir
5152298Sobrien
5250448Sobrien# Selection of languages to be made during stage1 build.
5350448Sobrien# This is overridden by configure.
5450448SobrienBOOT_LANGUAGES = c @all_boot_languages@
5550448Sobrien
5618334SpeterALLOCA =
5718334SpeterALLOCA_FLAGS =
5818334SpeterALLOCA_FINISH = true
5918334Speter
6018334Speter# Various ways of specifying flags for compilations:  
6118334Speter# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
6218334Speter# BOOT_CFLAGS is the value of CFLAGS to pass
6318334Speter# to the stage2 and stage3 compilations
6452298Sobrien# WARN_CFLAGS are the warning flags to pass to stage2 and stage3.  
6552298Sobrien# (And for stage 1 if the native compiler is GCC.)  It is
6650448Sobrien# separate from BOOT_CFLAGS because people tend to override optimization
6750448Sobrien# flags and we'd like them to still have warnings turned on.  They are free
6850448Sobrien# to explicitly turn warnings off if they wish.
6918334Speter# XCFLAGS is used for most compilations but not when using the GCC just built.
7050448Sobrien# TCFLAGS is used for compilations with the GCC just built.
7118334SpeterXCFLAGS =
7250448SobrienTCFLAGS =
7352298Sobrien# -W -Wall warnings are disabled for releases.
7418334SpeterCFLAGS = -g
7550448SobrienBOOT_CFLAGS = -O2 $(CFLAGS)
7652298Sobrien#WARN_CFLAGS = -W -Wall
7718334Speter# These exists to be overridden by the x-* and t-* files, respectively.
7818334SpeterX_CFLAGS =
7918334SpeterT_CFLAGS =
8018334Speter
8118334SpeterX_CPPFLAGS =
8218334SpeterT_CPPFLAGS =
8318334Speter
8452298SobrienAWK = @AWK@
8550448SobrienCC = @CC@
8650448Sobrien# srcdir might be a relative pathname which won't be valid in a subdirectory,
8750448Sobrien# so we must use objdir/srcdir instead to make it safe.  objdir is always
8850448Sobrien# a full pathname.
8950448SobrienBISON = `if [ -f $(objdir)/../bison/bison ] ; then case $(srcdir) in \
9050448Sobrien	/*) echo $(objdir)/../bison/bison -L $(srcdir)/../bison/ ;; \
9150448Sobrien	*) echo $(objdir)/../bison/bison -L $(objdir)/$(srcdir)/../bison/ ;; \
9252298Sobrien	esac; else echo bison ; fi`
9318334SpeterBISONFLAGS =
9450448SobrienLEX = `if [ -f $(objdir)/../flex/flex ] ; then echo $(objdir)/../flex/flex ; else echo flex ; fi`
9518334SpeterLEXFLAGS =
9618334SpeterAR = ar
9718334SpeterAR_FLAGS = rc
9850448SobrienLN = @symbolic_link@
9950448SobrienDLLTOOL = dlltool
10018334SpeterSHELL = /bin/sh
10118334Speter# on sysV, define this as cp.
10250448SobrienINSTALL = @INSTALL@
10350448Sobrien# Some systems may be missing symbolic links, regular links, or both.
10450448Sobrien# Allow configure to check this and use "ln -s", "ln", or "cp" as appropriate.
10550448SobrienLN=@LN@
10650448SobrienLN_S=@LN_S@
10718334Speter# These permit overriding just for certain files.
10850448SobrienINSTALL_PROGRAM = @INSTALL_PROGRAM@
10950448SobrienINSTALL_DATA = @INSTALL_DATA@
11052298SobrienMAKEINFO = `if [ -f $(objdir)/../texinfo/makeinfo/Makefile ] ; \
11152298Sobrien	then echo $(objdir)/../texinfo/makeinfo/makeinfo ; \
11252298Sobrien	else echo makeinfo ; fi`
11350448SobrienMAKEINFOFLAGS =
11418334SpeterTEXI2DVI = texi2dvi
11518334Speter# For GNUmake: let us decide what gets passed to recursive makes.
11618334SpeterMAKEOVERRIDES =
11750448Sobrien@SET_MAKE@
11818334Speter
11918334Speter# Define this as & to perform parallel make on a Sequent.
12018334Speter# Note that this has some bugs, and it seems currently necessary 
12118334Speter# to compile all the gen* files first by hand to avoid erroneous results.
12218334SpeterP =
12318334Speter
12418334Speter# How to invoke ranlib.
12518334SpeterRANLIB = ranlib
12618334Speter# Test to use to see whether ranlib exists on the system.
12752298SobrienRANLIB_TEST = \
12852298Sobrien  [ -f $(RANLIB) ] \
12952298Sobrien  || [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
13018334Speter
13118334Speter# Compiler to use for compiling libgcc1.a.
13218334Speter# OLDCC should not be the GNU C compiler,
13318334Speter# since that would compile typical libgcc1.a functions such as mulsi3
13418334Speter# into infinite recursions.
13518334SpeterOLDCC = cc
13618334Speter
13718334Speter# CFLAGS for use with OLDCC, for compiling libgcc1.a.
13818334Speter# NOTE: -O does not work on some Unix systems!
13918334SpeterCCLIBFLAGS = -O
14018334Speter
14118334Speter# Version of ar to use when compiling libgcc1.a.
14218334SpeterOLDAR = ar
14350448SobrienOLDAR_FLAGS = qc
14418334Speter
14518334Speter# Target to use when installing include directory.  Either
14618334Speter# install-headers-tar or install-headers-cpio.
14750448SobrienINSTALL_HEADERS_DIR = @build_install_headers_dir@
14818334Speter
14918334Speter# Header files that are made available under the same name
15018334Speter# to programs compiled with GCC.
15118334SpeterUSER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/stddef.h \
15218334Speter    $(srcdir)/ginclude/varargs.h $(srcdir)/ginclude/va-alpha.h \
15318334Speter    $(srcdir)/ginclude/va-h8300.h $(srcdir)/ginclude/va-i860.h \
15418334Speter    $(srcdir)/ginclude/va-i960.h $(srcdir)/ginclude/va-mips.h \
15550448Sobrien    $(srcdir)/ginclude/va-m88k.h $(srcdir)/ginclude/va-mn10200.h \
15650448Sobrien    $(srcdir)/ginclude/va-mn10300.h $(srcdir)/ginclude/va-pa.h \
15718334Speter    $(srcdir)/ginclude/va-pyr.h $(srcdir)/ginclude/va-sparc.h \
15818334Speter    $(srcdir)/ginclude/va-clipper.h $(srcdir)/ginclude/va-spur.h \
15950448Sobrien    $(srcdir)/ginclude/va-m32r.h $(srcdir)/ginclude/va-sh.h \
16050448Sobrien    $(srcdir)/ginclude/va-v850.h $(srcdir)/ginclude/va-arc.h \
16118334Speter    $(srcdir)/ginclude/iso646.h $(srcdir)/ginclude/va-ppc.h \
16252298Sobrien    $(srcdir)/ginclude/va-c4x.h $(EXTRA_HEADERS) $(LANG_EXTRA_HEADERS) \
16350448Sobrien    $(srcdir)/ginclude/proto.h $(srcdir)/ginclude/stdbool.h
16418334Speter
16518334Speter# Target to use whe installing assert.h.  Some systems may
16618334Speter# want to set this empty.
16718334SpeterINSTALL_ASSERT_H = install-assert-h
16818334Speter
16918334Speter# The GCC to use for compiling libgcc2.a, enquire, and libgcc1-test.
17018334Speter# Usually the one we just built.
17118334Speter# Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS).
17252298SobrienGCC_FOR_TARGET = ./xgcc -B$(build_tooldir)/bin/ -B./ -I$(build_tooldir)/include
17318334Speter
17418334Speter# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
17518334Speter# It omits XCFLAGS, and specifies -B./.
17618334Speter# It also specifies -I./include to find, e.g., stddef.h.
17750448SobrienGCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -I./include $(TCFLAGS)
17818334Speter
17918334Speter# Sed command to transform gcc to installed name.  Overwritten by configure.
18050448Sobrienprogram_transform_name = @program_transform_name@
18150448Sobrienprogram_transform_cross_name = s,^,$(target_alias)-,
18218334Speter
18350448Sobrienbuild_canonical = @build_canonical@
18450448Sobrienhost_canonical = @host_canonical@
18550448Sobrien
18618334Speter# Tools to use when building a cross-compiler.
18718334Speter# These are used because `configure' appends `cross-make'
18818334Speter# to the makefile when making a cross-compiler.
18918334Speter
19050448Sobrien# Use the tools from the build tree, if they are available.
19150448Sobrien
19250448Sobrien# objdir is set by configure.
19350448Sobrienobjdir = @objdir@
19450448Sobrien
19550448SobrienAR_FOR_TARGET = ` \
19650448Sobrien  if [ -f $(objdir)/../binutils/ar ] ; then \
19750448Sobrien    echo $(objdir)/../binutils/ar ; \
19850448Sobrien  else \
19950448Sobrien    if [ "$(host_canonical)" = "$(target)" ] ; then \
20050448Sobrien      echo ar; \
20150448Sobrien    else \
20250448Sobrien       t='$(program_transform_name)'; echo ar | sed -e $$t ; \
20350448Sobrien    fi; \
20450448Sobrien  fi`
20552298SobrienAR_FLAGS_FOR_TARGET = rc
20650448SobrienRANLIB_FOR_TARGET = ` \
20750448Sobrien  if [ -f $(objdir)/../binutils/ranlib ] ; then \
20850448Sobrien    echo $(objdir)/../binutils/ranlib ; \
20950448Sobrien  else \
21050448Sobrien    if [ "$(host_canonical)" = "$(target)" ] ; then \
21150448Sobrien      echo ranlib; \
21250448Sobrien    else \
21350448Sobrien       t='$(program_transform_name)'; echo ranlib | sed -e $$t ; \
21450448Sobrien    fi; \
21550448Sobrien  fi`
21650448SobrienRANLIB_TEST_FOR_TARGET = \
21750448Sobrien  [ -f $(RANLIB_FOR_TARGET) ] \
21850448Sobrien  || ( [ "$(host_canonical)" = "$(target)" ] \
21950448Sobrien       && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )
22018334Speter
22118334Speter# Dir to search for system headers.  Overridden by cross-make.
22218334SpeterSYSTEM_HEADER_DIR = /usr/include
22318334Speter
22418334Speter# Control whether to run fixproto.
22518334SpeterSTMP_FIXPROTO = stmp-fixproto
22618334Speter
22718334Speter# Test to see whether <limits.h> exists in the system header files.
22818334SpeterLIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
22918334Speter
23018334Speter# There may be a premade insn-attrtab.c for this machine.
23118334Speter# (You could rebuild it with genattrtab as usual, but it takes a long time.)
23218334Speter# PREMADE_ATTRTAB is the file name of the file to use.
23318334Speter# PREMADE_ATTRTAB_MD is the md file it corresponds to.
23418334SpeterPREMADE_ATTRTAB_MD = Makefile  # Guaranteed not to cmp equal to md.
23518334SpeterPREMADE_ATTRTAB = 
23618334Speter
23750448Sobrientarget=@target@
23850448Sobrientarget_alias=@target_alias@
23950448Sobrienxmake_file=@dep_host_xmake_file@
24050448Sobrientmake_file=@dep_tmake_file@
24150448Sobrienout_file=$(srcdir)/config/@out_file@
24250448Sobrienout_object_file=@out_object_file@
24350448Sobrienmd_file=$(srcdir)/config/@md_file@
24450448Sobrientm_file=@tm_file_list@
24550448Sobrienbuild_xm_file=@build_xm_file_list@
24650448Sobrienhost_xm_file=@host_xm_file_list@
24750448Sobrienlang_specs_files=@lang_specs_files@
24850448Sobrienlang_options_files=@lang_options_files@
24952298Sobrienlang_tree_files=@lang_tree_files@
25050448SobrienGCC_THREAD_FILE=@thread_file@
25152298SobrienOBJC_BOEHM_GC=@objc_boehm_gc@
25252298SobrienJAVAGC=@JAVAGC@
25350448SobrienGTHREAD_FLAGS=@gthread_flags@
25450448Sobrien# Be prepared for gcc2 merges.
25550448Sobriengcc_version=@gcc_version@
25650448Sobriengcc_version_trigger=@gcc_version_trigger@
25750448Sobrienversion=$(gcc_version)
25818334Spetermainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
25918334Speter
26018334Speter# Common prefix for installation directories.
26118334Speter# NOTE: This directory must exist when you start installation.
26250448Sobrienprefix = @prefix@
26318334Speter# Directory in which to put localized header files. On the systems with
26418334Speter# gcc as the native cc, `local_prefix' may not be `prefix' which is
26518334Speter# `/usr'.
26618334Speter# NOTE: local_prefix *should not* default from prefix.
26750448Sobrienlocal_prefix = @local_prefix@
26818334Speter# Directory in which to put host dependent programs and libraries
26950448Sobrienexec_prefix = @exec_prefix@
27018334Speter# Directory in which to put the executable for the command `gcc'
27150448Sobrienbindir = @bindir@
27218334Speter# Directory in which to put the directories used by the compiler.
27350448Sobrienlibdir = @libdir@
27418334Speter# Directory in which the compiler finds executables, libraries, etc.
27550448Sobrienlibsubdir = $(libdir)/gcc-lib/$(target_alias)/$(version)
27652298Sobrien# Used to produce a relative $(gcc_tooldir) in gcc.o
27752298Sobrienunlibsubdir = ../../..
27852298Sobrien# Directory in which to find other cross-compilation tools and headers.
27952298Sobriendollar = @dollar@
28052298Sobrien# Used in install-cross.
28152298Sobriengcc_tooldir = @gcc_tooldir@
28252298Sobrien# Since tooldir does not exist at build-time, use -B$(build_tooldir)/bin/
28352298Sobrienbuild_tooldir = $(exec_prefix)/$(target_alias)
28418334Speter# Directory in which the compiler finds g++ includes.
28552298Sobriengcc_gxx_include_dir= @gcc_gxx_include_dir@
28618334Speter# Directory to search for site-specific includes.
28718334Speterincludedir = $(local_prefix)/include
28818334Speter# assertdir is overridden in cross-make.
28918334Speter# (But this currently agrees with what is in cross-make.)
29052298Sobrienassertdir = $(gcc_tooldir)/include
29118334Speter# where the info files go
29250448Sobrieninfodir = @infodir@
29350448Sobrien# Where cpp should go besides $prefix/bin if necessary
29450448Sobriencpp_install_dir = @cpp_install_dir@
29552298Sobrien# where the locale files go
29652298Sobriendatadir = $(prefix)/@DATADIRNAME@
29752298Sobrienlocaledir = $(datadir)/locale
29818334Speter# Extension (if any) to put in installed man-page filename.
29918334Spetermanext = .1
30018334Speterobjext = .o
30150448Sobrienexeext = @host_exeext@
30250448Sobrienbuild_exeext = @build_exeext@
30318334Speter
30418334Speter# Directory in which to put man pages.
30552298Sobrienmandir = @mandir@
30652298Sobrienman1dir = $(mandir)/man1
30718334Speter# Dir for temp files.
30818334Spetertmpdir = /tmp
30918334Speter
31052298Sobrien# Top build directory, relative to here.
31152298Sobrientop_builddir = .
31252298Sobrien
31352298Sobrien# Whether we were configured with NLS.
31452298SobrienUSE_NLS = @USE_NLS@
31552298Sobrien
31652298Sobrien# Internationalization library.
31752298SobrienINTLLIBS = @INTLLIBS@
31852298Sobrien
31952298Sobrien# List of internationalization subdirectories.
32052298SobrienPOSUB = @POSUB@
32152298SobrienINTL_SUBDIRS = intl $(POSUB)
32252298Sobrien
32318334Speter# Additional system libraries to link with.
32418334SpeterCLIB=
32518334Speter
32618334Speter# Change this to a null string if obstacks are installed in the
32718334Speter# system library.
32818334SpeterOBSTACK=obstack.o
32918334Speter
33050448Sobrien# Configure will set these if you need vfprintf and possibly _doprnt support.
33150448SobrienVFPRINTF=@vfprintf@
33250448SobrienDOPRINT=@doprint@
33350448Sobrien
33418334Speter# Specify the rule for actually making libgcc.a,
33518334SpeterLIBGCC = libgcc.a
33618334Speter# and the rule for installing it.
33718334SpeterINSTALL_LIBGCC = install-libgcc
33818334Speter
33918334Speter# Specify the rule for actually making libgcc1.a.
34018334Speter# The value may be empty; that means to do absolutely nothing
34118334Speter# with or for libgcc1.a.
34218334SpeterLIBGCC1 = libgcc1.a
34318334Speter
34418334Speter# Specify the rule for making libgcc1.a for a cross-compiler.
34518334Speter# The default rule assumes that libgcc1.a is supplied by the user.
34618334SpeterCROSS_LIBGCC1 = libgcc1.cross
34718334Speter
34818334Speter# Specify the rule for actually making libgcc2.a.
34918334SpeterLIBGCC2 = libgcc2.a
35018334Speter
35118334Speter# Options to use when compiling libgcc2.a.
35218334Speter# -g1 causes output of debug info only for file-scope entities.
35318334Speter# we use this here because that should be enough, and also
35418334Speter# so that -g1 will be tested.
35550448Sobrien#
35650448SobrienLIBGCC2_DEBUG_CFLAGS = -g1
35750448SobrienLIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED @inhibit_libc@ 
35818334Speter
35918334Speter# Additional options to use when compiling libgcc2.a.
36018334Speter# Some targets override this to -Iinclude
36118334SpeterLIBGCC2_INCLUDES =
36218334Speter
36318334Speter# Additional target-dependent options for compiling libgcc2.a.
36418334SpeterTARGET_LIBGCC2_CFLAGS = 
36518334Speter
36618334Speter# Things which must be built before building libgcc2.a.
36718334Speter# Some targets override this to stmp-int-hdrs
36818334SpeterLIBGCC2_DEPS =
36918334Speter
37018334Speter# libgcc1-test target (must also be overridable for a target)
37118334SpeterLIBGCC1_TEST = libgcc1-test
37218334Speter
37318334Speter# List of extra executables that should be compiled for this target machine
37418334Speter# that are used for compiling from source code to object code.
37518334Speter# The rules for compiling them should be in the t-* file for the machine.
37650448SobrienEXTRA_PASSES =@extra_passes@
37718334Speter
37818334Speter# Like EXTRA_PASSES, but these are used when linking.
37950448SobrienEXTRA_PROGRAMS = @extra_programs@
38018334Speter
38118334Speter# List of extra object files that should be compiled for this target machine.
38218334Speter# The rules for compiling them should be in the t-* file for the machine.
38350448SobrienEXTRA_PARTS = @extra_parts@
38418334Speter
38518334Speter# List of extra object files that should be compiled and linked with
38618334Speter# compiler proper (cc1, cc1obj, cc1plus).
38750448SobrienEXTRA_OBJS = @extra_objs@
38818334Speter
38918334Speter# List of extra object files that should be compiled and linked with
39018334Speter# the gcc driver.
39150448SobrienEXTRA_GCC_OBJS =@host_extra_gcc_objs@
39218334Speter
39318334Speter# List of additional header files to install.
39418334Speter# Often this is edited directly by `configure'.
39550448SobrienEXTRA_HEADERS =@extra_headers_list@
39618334Speter
39750448Sobrien# Set this to `collect2' to enable use of collect2.
39850448SobrienUSE_COLLECT2 = @will_use_collect2@
39952298Sobrien# If we might be using collect2, then this variable will be set to
40052298Sobrien# -DUSE_COLLECT2.  toplev.c, collect2.c and libgcc2.c all need to
40152298Sobrien# if we may be using collect2.
40250448SobrienMAYBE_USE_COLLECT2 = @maybe_use_collect2@
40318334Speter# It is convenient for configure to add the assignment at the beginning,
40418334Speter# so don't override it here.
40550448SobrienUSE_COLLECT2 = collect2$(exeext)
40618334Speter
40718334Speter# List of extra C and assembler files to add to libgcc1.a.
40818334Speter# Assembler files should have names ending in `.asm'.
40918334SpeterLIB1FUNCS_EXTRA = 
41018334Speter
41118334Speter# List of extra C and assembler files to add to libgcc2.a.
41218334Speter# Assembler files should have names ending in `.asm'.
41318334SpeterLIB2FUNCS_EXTRA = 
41418334Speter
41550448Sobrien# Handle cpp installation.
41650448SobrienINSTALL_CPP=
41750448SobrienUNINSTALL_CPP=
41850448Sobrien
41950448Sobrien# We do not try to build float.h anymore.  Let configure select the
42050448Sobrien# appropriate pre-built float.h file for the target.
42152298SobrienFLOAT_H=@float_h_file@
42250448Sobrien
42318334Speter# Program to convert libraries.
42418334SpeterLIBCONVERT = 
42518334Speter
42618334Speter# Control whether header files are installed.
42718334SpeterINSTALL_HEADERS=install-headers
42818334Speter
42918334Speter# Options for tar when copying trees.  So HPUX can override it.
43018334SpeterTAROUTOPTS = xpBf
43118334Speter
43218334Speter# Additional directories of header files to run fixincludes on.
43318334Speter# These should be directories searched automatically by default
43418334Speter# just as /usr/include is.
43518334Speter# *Do not* use this for directories that happen to contain 
43618334Speter# header files, but are not searched automatically by default.
43718334Speter# On most systems, this is empty.
43818334SpeterOTHER_FIXINCLUDES_DIRS=
43918334Speter
44050448Sobrien# A list of all the language-specific executables.
44150448Sobrien# This is overridden by configure.
44250448SobrienCOMPILERS = cc1$(exeext) @all_compilers@
44350448Sobrien
44418334Speter# List of things which should already be built whenever we try to use xgcc
44518334Speter# to compile anything (without linking).
44650448SobrienGCC_PASSES=xgcc$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES)
44718334Speter
44818334Speter# List of things which should already be built whenever we try to use xgcc
44918334Speter# to link anything.
45018334SpeterGCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
45118334Speter
45218334Speter# Directory to link to, when using the target `maketest'.
45318334SpeterDIR = ../gcc
45418334Speter
45518334Speter# Guaranteed to not exist when not passing md through cpp.
45618334Speter# This value is overridden directly by configure.
45718334SpeterMD_FILE = md-cpp-not-used
45818334Speter
45918334Speter# Flags to use when cross-building GCC.
46018334Speter# Prefix to apply to names of object files when using them
46118334Speter# to run on the machine we are compiling on.
46218334SpeterHOST_PREFIX=
46318334Speter# Prefix to apply to names of object files when compiling them
46418334Speter# to run on the machine we are compiling on.
46518334Speter# The default for this variable is chosen to keep these rules 
46618334Speter# out of the way of the other rules for compiling the same source files.
46718334SpeterHOST_PREFIX_1=loser-
46818334SpeterHOST_CC=$(CC)
46918334SpeterHOST_CFLAGS=$(ALL_CFLAGS)
47018334SpeterHOST_CLIB=$(CLIB)
47152298SobrienHOST_INTLLIBS=$(INTLLIBS)
47218334SpeterHOST_LDFLAGS=$(LDFLAGS)
47318334SpeterHOST_CPPFLAGS=$(ALL_CPPFLAGS)
47418334SpeterHOST_ALLOCA=$(ALLOCA)
47518334SpeterHOST_MALLOC=$(MALLOC)
47618334SpeterHOST_OBSTACK=$(OBSTACK)
47750448SobrienHOST_VFPRINTF=$(VFPRINTF)
47850448SobrienHOST_DOPRINT=$(DOPRINT)
47918334Speter
48018334Speter# Actual name to use when installing a native compiler.
48150448SobrienGCC_INSTALL_NAME = `t='$(program_transform_name)'; echo gcc | sed -e $$t`
48252298SobrienCPP_INSTALL_NAME = `t='$(program_transform_name)'; echo cpp | sed -e $$t`
48350448SobrienPROTOIZE_INSTALL_NAME = `t='$(program_transform_name)'; echo protoize | sed -e $$t`
48450448SobrienUNPROTOIZE_INSTALL_NAME = `t='$(program_transform_name)'; echo unprotoize | sed -e $$t`
48552298SobrienGCOV_INSTALL_NAME = `t='$(program_transform_name)'; echo gcov | sed -e $$t`
48618334Speter
48718334Speter# Actual name to use when installing a cross-compiler.
48850448SobrienGCC_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcc | sed -e $$t`
48950448SobrienPROTOIZE_CROSS_NAME = `t='$(program_transform_cross_name)'; echo protoize | sed -e $$t`
49050448SobrienUNPROTOIZE_CROSS_NAME = `t='$(program_transform_cross_name)'; echo unprotoize | sed -e $$t`
49118334Speter
49218334Speter# Choose the real default target.
49318334SpeterALL=all.internal
49418334Speter
49518334Speter# Choose the real install target.
49618334SpeterINSTALL_TARGET=install-normal
49718334Speter
49850448Sobrien# Setup the testing framework, if you have one
49950448SobrienEXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \
50050448Sobrien            echo $${rootme}/../expect/expect ; \
50150448Sobrien          else echo expect ; fi`
50218334Speter
50350448SobrienRUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
50450448Sobrien	       echo $${srcdir}/../dejagnu/runtest ; \
50550448Sobrien	    else echo runtest; fi`
50650448SobrienRUNTESTFLAGS =
50750448Sobrien
50818334Speter# Extra symbols for fixproto to define when parsing headers.
50918334SpeterFIXPROTO_DEFINES = 
51018334Speter
51118334Speter# Extra flags to use when compiling crt{begin,end}.o.
51218334SpeterCRTSTUFF_T_CFLAGS = 
51318334Speter
51450448Sobrien# Extra flags to use when compiling [m]crt0.o.
51550448SobrienCRT0STUFF_T_CFLAGS = 
51650448Sobrien
51750448Sobrien# "t" or nothing, for building multilibbed versions of, say, crtbegin.o.
51850448SobrienT =
51950448Sobrien
52018334Speter# End of variables for you to override.
52118334Speter
52218334Speter# Definition of `all' is here so that new rules inserted by sed
52318334Speter# do not specify the default target.
52418334Speter# The real definition is under `all.internal' (for native compilers)
52518334Speter# or `all.cross' (for cross compilers).
52618334Speterall: all.indirect
52718334Speter
52818334Speter# This tells GNU Make version 3 not to put all variables in the environment.
52918334Speter.NOEXPORT:
53018334Speter
53118334Speter# sed inserts variable overrides after the following line.
53218334Speter####target overrides
53350448Sobrien@target_overrides@
53450448Sobrien
53518334Speter####host overrides
53650448Sobrien@host_overrides@
53750448Sobrien
53818334Speter####cross overrides
53950448Sobrien@cross_defines@
54050448Sobrien@cross_overrides@
54150448Sobrien
54218334Speter####build overrides
54350448Sobrien@build_overrides@
54450448Sobrien#
54518334Speter# Now figure out from those variables how to compile and link.
54618334Speter
54718334Speterall.indirect: $(ALL)
54818334Speter
54952298Sobrien# IN_GCC tells various files that system.h, toplev.c, etc are available.
55052298SobrienINTERNAL_CFLAGS = $(CROSS) -DIN_GCC $(SCHED_CFLAGS) @extra_c_flags@
55118334Speter
55218334Speter# This is the variable actually used when we compile.
55352298Sobrien# If you change this line, you probably also need to change the definition
55452298Sobrien# of HOST_CFLAGS in build-make to match.
55550448SobrienALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) \
55652298Sobrien	@DEFS@
55718334Speter
55818334Speter# Likewise.
55918334SpeterALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
56018334Speter
56118334Speter# Even if ALLOCA is set, don't use it if compiling with GCC.
56250448SobrienUSE_ALLOCA= ${ALLOCA}
56350448SobrienUSE_HOST_ALLOCA= ` case "${HOST_ALLOCA}" in ?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
56418334SpeterUSE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac `
56518334SpeterUSE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac `
56650448SobrienUSE_HOST_VFPRINTF= ` case "${HOST_VFPRINTF}" in ?*) echo ${HOST_PREFIX}${HOST_VFPRINTF} ;; esac `
56750448SobrienUSE_HOST_DOPRINT= ` case "${HOST_DOPRINT}" in ?*) echo ${HOST_PREFIX}${HOST_DOPRINT} ;; esac `
56818334Speter
56918334Speter# Dependency on obstack, alloca, malloc or whatever library facilities
57018334Speter# are not installed in the system libraries.
57118334Speter# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
57252298SobrienLIBDEPS= $(INTLLIBS) $(OBSTACK) $(ALLOCA) $(MALLOC) $(VFPRINTF) $(DOPRINT)
57318334Speter
57418334Speter# Likewise, for use in the tools that must run on this machine
57518334Speter# even if we are cross-building GCC.
57618334Speter# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
57752298SobrienHOST_LIBDEPS= $(HOST_PREFIX)$(HOST_INTLLIBS) $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC) $(HOST_PREFIX)$(HOST_VFPRINTF) $(HOST_PREFIX)$(HOST_DOPRINT)
57818334Speter
57918334Speter# How to link with both our special library facilities
58018334Speter# and the system's installed libraries.
58152298SobrienLIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(INTLLIBS) @LIBS@ $(VFPRINTF) $(DOPRINT) $(CLIB) ../libiberty/libiberty.a
58218334Speter
58318334Speter# Likewise, for use in the tools that must run on this machine
58418334Speter# even if we are cross-building GCC.
58518334SpeterHOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC)  \
58652298Sobrien	    $(HOST_INTLLIBS) $(USE_HOST_VFPRINTF) $(USE_HOST_DOPRINT) \
58752298Sobrien	    $(HOST_CLIB)
58818334Speter
58950448SobrienHOST_RTL = $(HOST_PREFIX)rtl.o $(HOST_PREFIX)bitmap.o
59018334SpeterHOST_RTLANAL = $(HOST_PREFIX)rtlanal.o
59118334SpeterHOST_PRINT = $(HOST_PREFIX)print-rtl.o
59218334Speter
59318334Speter# Specify the directories to be searched for header files.
59418334Speter# Both . and srcdir are used, in that order,
59518334Speter# so that tm.h and config.h will be found in the compilation
59618334Speter# subdirectory rather than in the source directory.
59752298SobrienINCLUDES = -I. -I$(srcdir) -I$(srcdir)/config -I$(srcdir)/../include
59818334Speter
59918334Speter# Always use -I$(srcdir)/config when compiling.
60018334Speter.c.o:
60118334Speter	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
60218334Speter
60318334Speter# This tells GNU make version 3 not to export all the variables
60418334Speter# defined in this file into the environment.
60518334Speter.NOEXPORT:
60650448Sobrien#
60718334Speter# Support for additional languages (other than c and objc).
60818334Speter# ??? objc can be supported this way too (leave for later).
60918334Speter
61018334Speter# These next lines are overridden by configure.
61150448SobrienLANG_MAKEFILES = @all_lang_makefiles@
61250448SobrienLANG_STAGESTUFF = @all_stagestuff@
61350448SobrienLANG_DIFF_EXCLUDES = @all_diff_excludes@
61450448SobrienLANG_LIB2FUNCS = @all_lib2funcs@
61550448SobrienLANG_EXTRA_HEADERS = @all_headers@
61618334Speter
61718334Speter# Flags to pass to recursive makes.
61818334Speter# CC is set by configure.  Hosts without symlinks need special handling
61918334Speter# because we need CC="stage1/xgcc -Bstage1/" to work in the language
62018334Speter# subdirectories.
62118334Speter# ??? The choices here will need some experimenting with.
62252298SobrienORDINARY_FLAGS_TO_PASS = \
62352298Sobrien	"AR_FLAGS_FOR_TARGET=$(AR_FLAGS_FOR_TARGET)" \
62418334Speter	"AR_FOR_TARGET=$(AR_FOR_TARGET)" \
62518334Speter	"BISON=$(BISON)" \
62618334Speter	"BISONFLAGS=$(BISONFLAGS)" \
62718334Speter	"CFLAGS=$(CFLAGS)" \
62850448Sobrien	"CLIB=$(CLIB)" \
62918334Speter	"GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
63018334Speter	"LDFLAGS=$(LDFLAGS)" \
63118334Speter	"LEX=$(LEX)" \
63218334Speter	"LEXFLAGS=$(LEXFLAGS)" \
63350448Sobrien	"LN=$(LN)" \
63450448Sobrien	"LN_S=$(LN_S)" \
63518334Speter	"MAKEINFO=$(MAKEINFO)" \
63618334Speter	"MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
63718334Speter	"RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
63818334Speter	"RANLIB_TEST_FOR_TARGET=$(RANLIB_TEST_FOR_TARGET)" \
63918334Speter	"SHELL=$(SHELL)" \
64050448Sobrien	"STAGE_PREFIX=@stage_prefix_set_by_configure@" \
64118334Speter	"exeext=$(exeext)" \
64250448Sobrien	"build_exeext=$(build_exeext)" \
64318334Speter	"objext=$(objext)" \
64418334Speter	"exec_prefix=$(exec_prefix)" \
64518334Speter	"prefix=$(prefix)" \
64650448Sobrien	"local_prefix=$(local_prefix)" \
64752298Sobrien	"gxx_include_dir=$(gcc_gxx_include_dir)" \
64818334Speter	"tooldir=$(tooldir)" \
64952298Sobrien	"gcc_tooldir=$(gcc_tooldir)" \
65018334Speter	"bindir=$(bindir)" \
65152298Sobrien	"libsubdir=$(libsubdir)" \
65252298Sobrien	"datadir=$(datadir)" \
65352298Sobrien	"distdir=../tmp/\$$(subdir)" \
65452298Sobrien	"localedir=$(localedir)"
65552298SobrienFLAGS_TO_PASS = $(ORDINARY_FLAGS_TO_PASS) "CC=@cc_set_by_configure@"
65652298SobrienPREPEND_DOTDOT_TO_RELATIVE_PATHS = sed \
65752298Sobrien	-e 's|^ *[^ /][^ /]*/|%&|' \
65852298Sobrien	-e 's| -B| -B%|g' \
65952298Sobrien	-e 's|% *[^- /]|%&|g' \
66052298Sobrien	-e 's|%% *|../|g' \
66152298Sobrien	-e 's|%||g'
66252298SobrienSUBDIR_FLAGS_TO_PASS = $(ORDINARY_FLAGS_TO_PASS) \
66352298Sobrien  "CC=`echo @quoted_cc_set_by_configure@ | $(PREPEND_DOTDOT_TO_RELATIVE_PATHS)`"
66450448Sobrien#
66518334Speter# Lists of files for various purposes.
66618334Speter
66750448Sobrien# Language-specific object files for C and Objective C.
66850448SobrienC_AND_OBJC_OBJS = c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o \
66950448Sobrien  c-aux-info.o c-common.o c-iterate.o @extra_c_objs@
67018334Speter
67118334Speter# Language-specific object files for C.
67250448SobrienC_OBJS = c-parse.o c-lang.o $(C_AND_OBJC_OBJS)
67318334Speter
67450448SobrienSCHED_PREFIX = @sched_prefix@
67550448SobrienSCHED_CFLAGS = @sched_cflags@
67618334Speter
67718334Speter# Language-independent object files.
67818334SpeterOBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
67950448Sobrien function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o \
68052298Sobrien intl.o varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o genrtl.o real.o \
68152298Sobrien dbxout.o sdbout.o dwarfout.o dwarf2out.o xcoffout.o bitmap.o alias.o gcse.o \
68250448Sobrien integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o varray.o \
68352298Sobrien regclass.o regmove.o local-alloc.o global.o reload.o reload1.o caller-save.o \
68450448Sobrien insn-peep.o reorg.o $(SCHED_PREFIX)sched.o final.o recog.o reg-stack.o \
68552298Sobrien insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o lcm.o \
68650448Sobrien profile.o insn-attrtab.o $(out_object_file) getpwd.o $(EXTRA_OBJS) convert.o \
68752298Sobrien mbchar.o dyn-string.o splay-tree.o graph.o sbitmap.o resource.o hash.o
68818334Speter
68918334Speter# GEN files are listed separately, so they can be built before doing parallel
69018334Speter#  makes for cc1 or cc1plus.  Otherwise sequent parallel make attempts to load
69118334Speter#  them before rtl.o is compiled.
69250448SobrienGEN= genemit genoutput genrecog genextract genflags gencodes genconfig \
69350448Sobrien genpeep gengenrtl gencheck
69418334Speter
69550448SobrienCCCP=@cpp_main@
69618334Speter
69718334Speter# Files to be copied away after each stage in building.
69818334SpeterSTAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \
69918334Speter insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
70052298Sobrien insn-attr.h insn-attrtab.c insn-opinit.c tree-check.h \
70150448Sobrien s-flags s-config s-codes s-mlib s-under\
70250448Sobrien s-output s-recog s-emit s-extract s-peep s-check \
70350448Sobrien s-attr s-attrtab s-opinit s-crt s-crtS s-crt0 \
70450448Sobrien genemit$(build_exeext) genoutput$(build_exeext) genrecog$(build_exeext) \
70550448Sobrien genextract$(build_exeext) genflags$(build_exeext) gencodes$(build_exeext) \
70650448Sobrien genconfig$(build_exeext) genpeep$(build_exeext) genattrtab$(build_exeext) \
70750448Sobrien genattr$(build_exeext) genopinit$(build_exeext) gengenrtl$(build_exeext) \
70850448Sobrien gencheck$(build_exeext) \
70952298Sobrien xgcc$(exeext) xcpp$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES) \
71050448Sobrien $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
71118334Speter $(CCCP)$(exeext) cc1obj$(exeext) enquire$(exeext) \
71218334Speter protoize$(exeext) unprotoize$(exeext) \
71318334Speter specs collect2$(exeext) $(USE_COLLECT2) underscore.c \
71450448Sobrien gcov$(exeext) *.bp \
71518334Speter *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop \
71652298Sobrien *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.gcse *.flow2 \
71752298Sobrien *.[si] libcpp.a \
71818334Speter $(LANG_STAGESTUFF)
71918334Speter
72018334Speter# Members of libgcc1.a.
72118334SpeterLIB1FUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
72218334Speter   _lshrsi3 _ashrsi3 _ashlsi3 \
72318334Speter   _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \
72418334Speter   _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \
72518334Speter   _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \
72618334Speter   _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
72718334Speter   _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
72818334Speter
72918334Speter# Library members defined in libgcc2.c.
73018334SpeterLIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
73118334Speter     _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 \
73218334Speter    _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
73318334Speter    _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
73418334Speter    _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
73518334Speter    _fixtfdi _fixunstfdi _floatditf \
73650448Sobrien    __gcc_bcmp _varargs __dummy _eprintf \
73750448Sobrien    _bb _shtab _clear_cache _trampoline __main _exit \
73850448Sobrien    _ctors _pure
73918334Speter
74050448SobrienLIB2FUNCS_EH = _eh
74150448Sobrien
74250448SobrienFPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
74350448Sobrien    _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
74450448Sobrien    _lt_sf _le_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
74550448Sobrien    _sf_to_df
74650448Sobrien
74750448SobrienDPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
74850448Sobrien    _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
74950448Sobrien    _lt_df _le_df _si_to_df _df_to_si _negate_df _make_df \
75050448Sobrien    _df_to_sf
75150448Sobrien
75218334Speter# The files that "belong" in CONFIG_H are deliberately omitted
75318334Speter# because having them there would not be useful in actual practice.
75418334Speter# All they would do is cause complete recompilation every time
75518334Speter# one of the machine description files is edited.
75618334Speter# That may or may not be what one wants to do.
75718334Speter# If it is, rm *.o is an easy way to do it.
75818334Speter# CONFIG_H = $(host_xm_file) $(tm_file)
75918334SpeterCONFIG_H =
76052298SobrienRTL_BASE_H = rtl.h rtl.def machmode.h machmode.def
76150448SobrienRTL_H = $(RTL_BASE_H) genrtl.h
76252298SobrienTREE_H = tree.h real.h tree.def machmode.h machmode.def tree-check.h
76352298SobrienBASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h
76452298SobrienDEMANGLE_H = $(srcdir)/../include/demangle.h
76552298SobrienRECOG_H = recog.h
76650448SobrienEXPR_H = expr.h insn-codes.h
76752298SobrienREGS_H = regs.h varray.h machmode.h machmode.def
76850448Sobrien#
76918334Speter# Language makefile fragments.
77018334Speter
77118334Speter# The following targets define the interface between us and the languages.
77218334Speter#
77318334Speter# all.build, all.cross, start.encap, rest.encap,
77418334Speter# info, dvi,
77518334Speter# install-normal, install-common, install-info, install-man,
77618334Speter# uninstall, distdir,
77718334Speter# mostlyclean, clean, distclean, extraclean, maintainer-clean,
77818334Speter# stage1, stage2, stage3, stage4
77918334Speter#
78018334Speter# Each language is linked in with a series of hooks (since we can't use `::'
78118334Speter# targets).  The name of each hooked is "lang.${target_name}" (eg: lang.info).
78218334Speter# Configure computes and adds these here.
78318334Speter
78418334Speter####language hooks
78550448Sobrien@language_hooks@
78618334Speter
78718334Speter# sed inserts language fragments after the following line.
78818334Speter####language fragments
78950448Sobrien@language_fragments@
79018334Speter
79118334Speter# End of language makefile fragments.
79250448Sobrien#
79350448Sobrien# The only suffixes we want for implicit rules are .c and .o, so clear
79450448Sobrien# the list and add them.  This speeds up GNU Make, and allows -r to work.
79550448Sobrien.SUFFIXES:
79650448Sobrien.SUFFIXES: .c .o
79718334Speter
79850448SobrienMakefile: $(srcdir)/Makefile.in config.status $(srcdir)/version.c \
79950448Sobrien   $(xmake_file) $(tmake_file) $(LANG_MAKEFILES)
80050448Sobrien	$(SHELL) $(srcdir)/configure.frag $(srcdir) "$(SUBDIRS)" \
80150448Sobrien		"$(xmake_file)" "$(tmake_file)"
80218334Speter	cp config.status config.run
80352298Sobrien	LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.run
80418334Speter	rm -f config.run
80518334Speter
80650448Sobrien$(srcdir)/configure: $(srcdir)/configure.in
80750448Sobrien	cd $(srcdir); autoconf
80850448Sobrien
80950448Sobrien# cstamp-h.in controls rebuilding of config.in.
81050448Sobrien# It is named cstamp-h.in and not stamp-h.in so the mostlyclean rule doesn't
81150448Sobrien# delete it.  A stamp file is needed as autoheader won't update the file if
81250448Sobrien# nothing has changed.
81350448Sobrien# It remains in the source directory and is part of the distribution.
81450448Sobrien# This follows what is done in shellutils, fileutils, etc.
81550448Sobrien# "echo timestamp" is used instead of touch to be consistent with other
81650448Sobrien# packages that use autoconf (??? perhaps also to avoid problems with patch?).
81750448Sobrien# ??? Newer versions have a maintainer mode that may be useful here.
81850448Sobrien$(srcdir)/config.in: $(srcdir)/cstamp-h.in
81950448Sobrien$(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h
82050448Sobrien	cd $(srcdir) && autoheader
82150448Sobrien	@rm -f $(srcdir)/cstamp-h.in
82250448Sobrien	echo timestamp > $(srcdir)/cstamp-h.in
82350448Sobrienauto-host.h: cstamp-h ; @true
82450448Sobriencstamp-h: config.in config.status
82552298Sobrien	CONFIG_HEADERS=auto-host.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
82650448Sobrien
82750448Sobrien# Really, really stupid make features, such as SUN's KEEP_STATE, may force
82850448Sobrien# a target to build even if it is up-to-date.  So we must verify that
82950448Sobrien# config.status does not exist before failing.
83050448Sobrienconfig.status: configure version.c
83150448Sobrien	@if [ ! -f config.status ] ; then \
83250448Sobrien	  echo You must configure gcc.  Look at the INSTALL file for details.; \
83350448Sobrien	  false; \
83450448Sobrien	else \
83552298Sobrien	  LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status --recheck; \
83650448Sobrien	fi
83750448Sobrien
83852298Sobrienall.internal: start.encap rest.encap doc
83918334Speter# This is what to compile if making a cross-compiler.
84018334Speter# Note that we can compile enquire using the cross-compiler just built,
84118334Speter# although we can't run it on this machine.
84250448Sobrienall.cross: native gcc-cross specs stmp-headers $(STMP_FIXPROTO) $(LIBGCC) \
84352298Sobrien	$(LIBGCC1_TEST) $(EXTRA_PARTS) lang.all.cross doc
84418334Speter# This is what to compile if making gcc with a cross-compiler.
84552298Sobrienall.build: native xgcc$(exeext) xcpp$(exeext) $(EXTRA_PARTS) lang.all.build
84618334Speter# This is what must be made before installing GCC and converting libraries.
84752298Sobrienstart.encap: native xgcc$(exeext) xcpp$(exeext) specs $(LIBGCC1) \
84852298Sobrien	xlimits.h lang.start.encap
84918334Speter# These can't be made until after GCC can run.
85050448Sobrienrest.encap: stmp-headers $(STMP_FIXPROTO) $(LIBGCC) $(EXTRA_PARTS) lang.rest.encap
85118334Speter# This is what is made with the host's compiler
85218334Speter# whether making a cross compiler or not.
85352298Sobriennative: config.status auto-host.h cpp$(exeext) intl.all $(LANGUAGES) \
85450448Sobrien	$(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
85518334Speter
85618334Speter# Define the names for selecting languages in LANGUAGES.
85750448SobrienC c: cc1$(exeext)
85818334SpeterPROTO: proto
85918334Speter
86018334Speter# Tell GNU make these are phony targets.
86150448Sobrien.PHONY: C c PROTO proto
86218334Speter
86318334Speter# On the target machine, finish building a cross compiler.
86418334Speter# This does the things that can't be done on the host machine.
86552298Sobrienrest.cross: $(LIBGCC) specs
86618334Speter
86718334Speter# Verify that it works to compile and link libgcc1-test.
86818334Speter# If it does, then there are sufficient replacements for libgcc1.a.
86918334Speterlibgcc1-test: libgcc1-test.o native $(GCC_PARTS)
87018334Speter	@echo "Testing libgcc1.  Ignore linker warning messages."
87118334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) libgcc1-test.o -o libgcc1-test \
87218334Speter	  -nostartfiles -nostdlib `$(GCC_FOR_TARGET) --print-libgcc-file-name`
87350448Sobrienlibgcc1-test.o: libgcc1-test.c native xgcc$(exeext)
87418334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/libgcc1-test.c
87518334Speter
87618334Speter# Recompile all the language-independent object files.
87718334Speter# This is used only if the user explicitly asks for it.
87818334Spetercompilations: ${OBJS}
87918334Speter
88018334Speter# Create a list of the language-independent object files so the language
88118334Speter# subdirectories needn't mention their names explicitly.
88250448Sobrienstamp-objlist: $(OBJS) 
88350448Sobrien	echo " $(OBJS)" | sed -e 's, \([a-z0-9]\), ../\1,g' -e 's/\.o/$(objext)/g' >stamp-objlist
88418334Speter
88518334Speter# We call this executable `xgcc' rather than `gcc'
88618334Speter# to avoid confusion if the current directory is in the path
88718334Speter# and CC is `gcc'.  It is renamed to `gcc' when it is installed.
88852298Sobrienxgcc$(exeext): gcc.o gccspec.o version.o intl.o prefix.o \
88952298Sobrien   version.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
89052298Sobrien	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o gccspec.o intl.o \
89152298Sobrien	  prefix.o version.o $(EXTRA_GCC_OBJS) $(LIBS)
89218334Speter
89352298Sobrien# We call this executable `xcpp' rather than `cpp'
89452298Sobrien# since the real preprocessor is named `cpp'.  It too is renamed
89552298Sobrien# when it is installed.
89652298Sobrien# The only difference from xgcc is that it's linked with cppspec.o
89752298Sobrien# instead of gccspec.o.
89852298Sobrienxcpp$(exeext): gcc.o cppspec.o version.o intl.o prefix.o \
89952298Sobrien   version.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
90052298Sobrien	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o cppspec.o intl.o \
90152298Sobrien	  prefix.o version.o $(EXTRA_GCC_OBJS) $(LIBS)
90252298Sobrien
90318334Speter# Dump a specs file to make -B./ read these specs over installed ones.
90450448Sobrienspecs: xgcc$(exeext)
90518334Speter	$(GCC_FOR_TARGET) -dumpspecs > tmp-specs
90618334Speter	mv tmp-specs specs
90718334Speter
90818334Speter# We do want to create an executable named `xgcc', so we can use it to
90918334Speter# compile libgcc2.a.
91018334Speter# Also create gcc-cross, so that install-common will install properly.
91150448Sobriengcc-cross: xgcc$(exeext)
91218334Speter	cp xgcc$(exeext) gcc-cross$(exeext)
91318334Speter
91452298Sobriencc1$(exeext): $(P) $(OBJS) $(C_OBJS) $(LIBDEPS)
91552298Sobrien	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(C_OBJS) $(LIBS)
91618334Speter
91718334Speter# Build the version of limits.h that we will install.
91818334Speterxlimits.h: glimits.h limitx.h limity.h
91918334Speter	if $(LIMITS_H_TEST) ; then \
92018334Speter	  cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \
92118334Speter	else \
92218334Speter	  cat $(srcdir)/glimits.h > tmp-xlimits.h; \
92318334Speter	fi
92418334Speter	mv tmp-xlimits.h xlimits.h
92550448Sobrien#
92618334Speter# Build libgcc.a.
92718334Speter# This is done in two parts because some functions, in libgcc1.c,
92818334Speter# must be compiled with something other than GCC,
92918334Speter# while the rest, in libgcc2.c, must be compiled with xgcc.
93018334Speter# That means we can't do libgcc2.c until after xgcc, cc1, etc.
93118334Speter
93218334Speter# Use this as value of LIBGCC1 to cause conversion to GNU library format.
93318334Speter# LIBCONVERT should put its output in libgcc1.conv.
93418334Speterlibgcc1.conv: libgcc1.a
93518334Speter	$(LIBCONVERT) libgcc1.a libgcc1.conv
93618334Speter
93718334Speter# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely.
93818334Speter# Make an empty file instead.
93918334Speterlibgcc1.null: $(GCC_PASSES)
94050448Sobrien	echo "void __foo () {}" > dummy.c
94118334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c
94252298Sobrien	$(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) libgcc1.null dummy$(objext)
94318334Speter	rm -f dummy$(objext) dummy.c
94418334Speter
94518334Speter# This is $(LIBGCC1) for a cross-compiler.
94618334Speter# We have no automatic way of building libgcc1.a, 
94718334Speter# so it's up to the installer to find a way to do that.
94818334Speter# This rule deliberately does not depend on libgcc1.a
94918334Speter# so that it will fail if the installer hasn't provided it.
95018334Speterlibgcc1.cross:
95118334Speter	mv libgcc1.a libgcc1.cross || (echo You must find a way to make libgcc1.a; false)
95218334Speter
95318334Speter# Compile the library of arithmetic subroutines with the native compiler.
95418334Speter# Don't compile it with GCC!
95518334Speter# (That would cause most arithmetic functions to call themselves.)
95650448Sobrien#
95750448Sobrien# NOTE: If you modify these rules substantially, please be sure to
95850448Sobrien# check at least config/i386/t-sco5 and possibly other makefile
95950448Sobrien# fragments.
96018334Speterlibgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
96118334Speter	-rm -f tmplibgcc1.a
96218334Speter# Actually build it in tmplibgcc1.a, then rename at end,
96318334Speter# so that libgcc1.a itself remains nonexistent if compilation is aborted.
96418334Speter# -e causes any failing command to make this rule fail.
96518334Speter# -e doesn't work in certain shells, so we test $$? as well.
96618334Speter# lynx has a broken ar, it always complains when the initial library is
96718334Speter# empty, thus this command works only if we don't do -e
96818334Speter# There is a trailing backslash (\) deleted from the following line.
96918334Speter#	set -e;
97018334Speter	for name in $(LIB1FUNCS); \
97118334Speter	do \
97218334Speter	  echo $${name}; \
97318334Speter	  rm -f $${name}$(objext); \
97450448Sobrien	  $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
97518334Speter	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
97618334Speter	  mv libgcc1$(objext) $${name}$(objext); \
97718334Speter	  $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
97818334Speter	  rm -f $${name}$(objext); \
97918334Speter	done
98018334Speter# Some shells crash when a loop has no items.
98118334Speter# So make sure there is always at least one--`..'.
98218334Speter# Then ignore it.
98318334Speter# We don't use -e here because there are if statements
98418334Speter# that should not make the command give up when the if condition is false.
98518334Speter# Instead, we test for failure after each command where it matters.
98618334Speter	for file in .. $(LIB1FUNCS_EXTRA); \
98718334Speter	do \
98818334Speter	  if [ x$${file} != x.. ]; then \
98918334Speter	    name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//'`; \
99018334Speter	    echo $${name}; \
99118334Speter	    if [ $${name}.asm = $${file} ]; then \
99218334Speter	      cp $${file} $${name}.s || exit 1; file=$${name}.s; \
99318334Speter	    else true; fi; \
99450448Sobrien	    $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
99518334Speter	    if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
99618334Speter	    $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
99718334Speter	    if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
99818334Speter	    rm -f $${name}.s $${name}$(objext); \
99918334Speter	  else true; \
100018334Speter	  fi; \
100118334Speter	done
100252298Sobrien	-if $(RANLIB_TEST_FOR_TARGET) ; then \
100352298Sobrien	  $(RANLIB_FOR_TARGET) tmplibgcc1.a; \
100452298Sobrien	else true; fi
100518334Speter	mv tmplibgcc1.a libgcc1.a
100618334Speter
100718334Speter# Build libgcc1.a from assembler source.  LIB1ASMFUNCS is the list of
100818334Speter# functions.  LIB1ASMSRC is the name of the source file in the config
100918334Speter# subdirectory.
101018334Speterlibgcc1-asm.a: libgcc2.ready config.status $(srcdir)/config/$(LIB1ASMSRC)
101118334Speter	-rm -f tmplibgcc1.a libgcc1.S
101218334Speter	cp $(srcdir)/config/$(LIB1ASMSRC) libgcc1.S
101318334Speter# Actually build it in tmplibgcc1.a, then rename at end,
101418334Speter# so that libgcc1-asm.a itself remains nonexistent if compilation is aborted.
101518334Speter# -e causes any failing command to make this rule fail.
101618334Speter# -e doesn't work in certain shells, so we test $$? as well.
101718334Speter# lynx has a broken ar, it always complains when the initial library is
101818334Speter# empty, thus this command works only if we don't do -e
101918334Speter# There is a trailing backslash (\) deleted from the following line.
102018334Speter#	set -e;
102118334Speter	for name in $(LIB1ASMFUNCS); \
102218334Speter	do \
102318334Speter	  echo $${name}; \
102418334Speter	  $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} libgcc1.S; \
102518334Speter	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
102618334Speter	  mv libgcc1$(objext) $${name}$(objext); \
102752298Sobrien	  $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc1.a $${name}$(objext); \
102818334Speter	  rm -f $${name}$(objext); \
102918334Speter	done
103018334Speter	-rm -f libgcc1.S
103118334Speter	mv tmplibgcc1.a libgcc1-asm.a
103218334Speter
103318334Speter# Generate assembly versions of the functions required for libgcc1.
103418334Speter# You'll still need to massage the code by hand (possibly hacking
103518334Speter# underscores and local labels) but this will get you started.
103618334Speterlibgcc1.S: libgcc1.c $(CONFIG_H) config.status
103718334Speter	-rm -f libgcc1.S
103818334Speter	touch libgcc1.S
103918334Speter	for name in $(LIB1FUNCS); \
104018334Speter	do \
104118334Speter	  echo $${name}; \
104250448Sobrien	  $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -S -DL$${name} $(srcdir)/libgcc1.c; \
104318334Speter	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
104418334Speter	  echo '#ifdef ' L$${name} >> libgcc1.S; \
104518334Speter	  cat  libgcc1.s >> libgcc1.S; \
104618334Speter	  echo '#endif /*' L$${name} '*/' >> libgcc1.S; \
104718334Speter	  echo "" >> libgcc1.S; \
104818334Speter	done
104918334Speter
105018334Speter# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
105118334Speter# But recompiling cc1 should not force recompilation of libgcc2.a.
105218334Speter# If you want to force recompilation, delete libgcc2.a.
105350448Sobrienlibgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs $(STMP_FIXPROTO)
105418334Speter	-if [ -f libgcc2.ready ] ; then \
105518334Speter		true; \
105618334Speter	else \
105718334Speter		touch libgcc2.ready; \
105818334Speter	fi
105918334Speter
106050448SobrienLIB2ADD = $(srcdir)/frame.c $(LIB2FUNCS_EXTRA) $(LANG_LIB2FUNCS)
106150448Sobrienlibgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(FPBIT) $(DPBIT) $(LIB2ADD) \
106252298Sobrien   machmode.h longlong.h frame.h gbl-ctors.h config.status
106318334Speter# Actually build it in tmplibgcc2.a, then rename at end,
106418334Speter# so that libgcc2.a itself remains nonexistent if compilation is aborted.
106518334Speter	-rm -f tmplibgcc2.a
106618334Speter# -e causes any failing command to make this rule fail.
106718334Speter# -e doesn't work in certain shells, so we test $$? as well.
106818334Speter# lynx has a broken ar, it always complains when the initial library is
106918334Speter# empty, thus this command works only if we don't do -e
107018334Speter# There is a trailing backslash (\) deleted from the following line.
107118334Speter#	set -e;
107218334Speter	for name in $(LIB2FUNCS); \
107318334Speter	do \
107418334Speter	  echo $${name}; \
107518334Speter	  $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
107652298Sobrien	      $(MAYBE_USE_COLLECT2) $(srcdir)/libgcc2.c -o $${name}$(objext); \
107718334Speter	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
107852298Sobrien	  $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \
107918334Speter	  rm -f $${name}$(objext); \
108018334Speter	done
108150448Sobrien	for name in $(LIB2FUNCS_EH); \
108250448Sobrien	do \
108350448Sobrien	  echo $${name}; \
108450448Sobrien	  $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -fexceptions $(INCLUDES) -c \
108550448Sobrien	      -DL$${name} $(srcdir)/libgcc2.c -o $${name}$(objext); \
108650448Sobrien	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
108752298Sobrien	  $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \
108850448Sobrien	  rm -f $${name}$(objext); \
108950448Sobrien	done
109050448Sobrien	if [ x$(FPBIT) != x ]; then \
109150448Sobrien	  for name in $(FPBIT_FUNCS); \
109250448Sobrien	  do \
109350448Sobrien	    echo $${name}; \
109450448Sobrien	    $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
109550448Sobrien	        -DFINE_GRAINED_LIBRARIES $(FPBIT) -o $${name}$(objext); \
109650448Sobrien	    if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
109752298Sobrien	    $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \
109850448Sobrien	    rm -f $${name}$(objext); \
109950448Sobrien	  done; \
110050448Sobrien	else true; fi;
110150448Sobrien	if [ x$(DPBIT) != x ]; then \
110250448Sobrien	  for name in $(DPBIT_FUNCS); \
110350448Sobrien	  do \
110450448Sobrien	    echo $${name}; \
110550448Sobrien	    $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
110650448Sobrien	        -DFINE_GRAINED_LIBRARIES $(DPBIT) -o $${name}$(objext); \
110750448Sobrien	    if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
110852298Sobrien	    $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \
110950448Sobrien	    rm -f $${name}$(objext); \
111050448Sobrien	  done; \
111150448Sobrien	else true; fi;
111218334Speter# Some shells crash when a loop has no items.
111318334Speter# So make sure there is always at least one--`..'.
111418334Speter# Then ignore it.
111518334Speter# We don't use -e here because there are if statements
111618334Speter# that should not make the command give up when the if condition is false.
111718334Speter# Instead, we test for failure after each command where it matters.
111850448Sobrien	for file in $(LIB2ADD); do \
111950448Sobrien	  name=`echo $${file} | sed -e 's/[.][cSo]$$//' -e 's/[.]asm$$//' -e 's/[.]txt$$//'`; \
112050448Sobrien	  oname=` echo $${name} | sed -e 's,.*/,,'`; \
112150448Sobrien	  if [ $${name}.txt = $${file} ]; then \
112250448Sobrien	    for f in .. `cat $${file}`; do if [ x$${f} != x.. ]; then \
112350448Sobrien	      $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
112452298Sobrien		AR_FOR_TARGET="$(AR_FOR_TARGET)" \
112552298Sobrien		AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" CC="$(CC)" \
112650448Sobrien		CFLAGS="$(CFLAGS)" HOST_PREFIX="$(HOST_PREFIX)" \
112750448Sobrien		HOST_PREFIX_1="$(HOST_PREFIX_1)" \
112850448Sobrien		LANGUAGES="$(LANGUAGES)" \
112950448Sobrien		LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $${f}; \
113050448Sobrien	      if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
113152298Sobrien	      $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${f}; \
113250448Sobrien	      rm -f $${f}; \
113350448Sobrien	    else true; \
113450448Sobrien	    fi; done; \
113550448Sobrien	  else \
113618334Speter	    echo $${name}; \
113718334Speter	    if [ $${name}.asm = $${file} ]; then \
113818334Speter	      cp $${file} $${name}.s || exit 1; file=$${name}.s; \
113918334Speter	    else true; fi; \
114018334Speter	    $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
114118334Speter	    if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
114252298Sobrien	    $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${oname}$(objext); \
114318334Speter	    rm -f $${name}.s $${oname}$(objext); \
114418334Speter	  fi; \
114518334Speter	done
114618334Speter	mv tmplibgcc2.a libgcc2.a
114718334Speter# These lines were deleted from above the mv command
114818334Speter# because ranlibing libgcc.a itself should suffice.
114918334Speter#	-if [ x${HPUX_GAS} = x ] ; then \
115052298Sobrien#	  if $(RANLIB_TEST_FOR_TARGET) ; then \
115152298Sobrien#	    $(RANLIB_FOR_TARGET) tmplibgcc2.a;
115252298Sobrien#	  else true; fi; \
115318334Speter#	else true; fi
115418334Speter
115518334Speter# Combine the various libraries into a single library, libgcc.a.
115618334Speterlibgcc.a: $(LIBGCC1) $(LIBGCC2)
115718334Speter	-rm -rf tmplibgcc.a libgcc.a tmpcopy
115818334Speter	mkdir tmpcopy
115918334Speter	-if [ x$(LIBGCC1) != x ];			\
116052298Sobrien	then (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC1));	\
116118334Speter	else true;					\
116218334Speter	fi
116318334Speter# Some versions of ar (specifically the one in RISC/os 5.x), create an
116418334Speter# unwritable table of contents file, and then print an error message when
116518334Speter# the second ar command tries to overwrite this file.  To avoid the error
116618334Speter# message from ar, we make sure all files are writable.
116718334Speter	-(cd tmpcopy; chmod +w * > /dev/null 2>&1)
116852298Sobrien	(cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2))
116952298Sobrien	(cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a *$(objext))
117018334Speter	rm -rf tmpcopy
117152298Sobrien	-if $(RANLIB_TEST_FOR_TARGET) ; then \
117252298Sobrien	  $(RANLIB_FOR_TARGET) tmplibgcc.a; \
117352298Sobrien	else true; fi
117418334Speter# Actually build it in tmplibgcc.a, then rename at end,
117518334Speter# so that libgcc.a itself remains nonexistent if compilation is aborted.
117618334Speter	mv tmplibgcc.a libgcc.a
117718334Speter
117818334Speter# Use the genmultilib shell script to generate the information the gcc
117918334Speter# driver program needs to select the library directory based on the
118018334Speter# switches.
118150448Sobrienmultilib.h: s-mlib; @true
118250448Sobriens-mlib: $(srcdir)/genmultilib Makefile
118350448Sobrien	$(SHELL) $(srcdir)/genmultilib \
118450448Sobrien	  "$(MULTILIB_OPTIONS)" \
118550448Sobrien	  "$(MULTILIB_DIRNAMES)" \
118650448Sobrien	  "$(MULTILIB_MATCHES)" \
118750448Sobrien	  "$(MULTILIB_EXCEPTIONS)" \
118850448Sobrien	  "$(MULTILIB_EXTRA_OPTS)" > tmp-mlib.h
118950448Sobrien	$(srcdir)/move-if-change tmp-mlib.h multilib.h
119050448Sobrien	touch s-mlib
119118334Speter
119218334Speter# Build multiple copies of libgcc.a, one for each target switch.
119318334Speterstmp-multilib: $(LIBGCC1) libgcc2.c libgcc2.ready $(CONFIG_H) \
119452298Sobrien   frame.h \
119550448Sobrien   $(LIB2ADD) machmode.h longlong.h gbl-ctors.h config.status
119618334Speter	for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
119718334Speter	  dir=`echo $$i | sed -e 's/;.*$$//'`; \
119818334Speter	  flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
119918334Speter	  $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
120052298Sobrien	    AR_FOR_TARGET="$(AR_FOR_TARGET)" \
120152298Sobrien	    AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
120252298Sobrien	    CC="$(CC)" CFLAGS="$(CFLAGS)" \
120352298Sobrien	    RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \
120452298Sobrien	    RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \
120550448Sobrien	    LANGUAGES="$(LANGUAGES)" \
120618334Speter	    HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
120718334Speter	    LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" \
120850448Sobrien	    MULTILIB_CFLAGS="$${flags}" \
120918334Speter	    LIBGCC1="$(LIBGCC1)" LIBGCC2="$(LIBGCC2)" \
121018334Speter	    dir="$${dir}" stmp-multilib-sub; \
121118334Speter	  if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
121218334Speter	done
121318334Speter	touch stmp-multilib
121418334Speter
121518334Speter# Subroutine of stmp-multilib so make -n works.
121618334Speterstmp-multilib-sub:
121750448Sobrien	rm -f $(LIBGCC2)
121850448Sobrien	if [ -d $(dir) ]; then \
121950448Sobrien	  cd $(dir); \
122050448Sobrien	  rm -f libgcc.a $(EXTRA_MULTILIB_PARTS); \
122150448Sobrien	else true; \
122250448Sobrien	fi
122318334Speter	$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
122452298Sobrien	  AR_FOR_TARGET="$(AR_FOR_TARGET)" \
122552298Sobrien	  AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
122652298Sobrien	  CC="$(CC)" CFLAGS="$(CFLAGS)" \
122718334Speter	  HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
122850448Sobrien	  LANGUAGES="$(LANGUAGES)" \
122918334Speter	  LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC2)
123018334Speter	if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
123118334Speter	then true; \
123218334Speter	else rm -f $(LIBGCC1); \
123318334Speter	fi
123418334Speter	if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
123518334Speter	then true; \
123618334Speter	else \
123718334Speter	  $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
123852298Sobrien	    AR_FOR_TARGET="$(AR_FOR_TARGET)" \
123952298Sobrien	    AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
124052298Sobrien	    CC="$(CC)" CFLAGS="$(CFLAGS)" \
124118334Speter	    HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
124250448Sobrien	    LANGUAGES="$(LANGUAGES)" \
124318334Speter	    LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC1); \
124418334Speter	fi
124518334Speter	rm -rf tmplibgcc.a tmpcopy
124618334Speter	mkdir tmpcopy
124718334Speter	if [ x$(LIBGCC1) != x ]; \
124852298Sobrien	then (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC1)); \
124918334Speter	else true; \
125018334Speter	fi
125152298Sobrien# Some versions of ar (specifically the one in RISC/os 5.x), create an
125252298Sobrien# unwritable table of contents file, and then print an error message when
125352298Sobrien# the second ar command tries to overwrite this file.  To avoid the error
125452298Sobrien# message from ar, we make sure all files are writable.
125552298Sobrien	-(cd tmpcopy; chmod +w * > /dev/null 2>&1)
125652298Sobrien	(cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2))
125752298Sobrien	(cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a *$(objext))
125818334Speter	rm -rf libgcc2.a tmpcopy
125952298Sobrien	if $(RANLIB_TEST_FOR_TARGET) ; then \
126052298Sobrien	  $(RANLIB_FOR_TARGET) tmplibgcc.a; \
126152298Sobrien	else true; fi
126218334Speter	if [ -d $(dir) ]; then true; else mkdir $(dir); fi
126318334Speter	mv tmplibgcc.a $(dir)/libgcc.a
126450448Sobrien	for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
126550448Sobrien	  $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
126652298Sobrien	    AR_FOR_TARGET="$(AR_FOR_TARGET)" \
126752298Sobrien	    AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \
126852298Sobrien	    CC="$(CC)" CFLAGS="$(CFLAGS)" \
126950448Sobrien	    HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
127050448Sobrien	    LANGUAGES="$(LANGUAGES)" \
127150448Sobrien	    MULTILIB_CFLAGS="$(MULTILIB_CFLAGS)" T="t" t$${f}; \
127250448Sobrien	  mv t$${f} $(dir)/$${f}; \
127350448Sobrien	else true; \
127450448Sobrien	fi; done
127518334Speter
127618334Speter# Compile two additional files that are linked with every program
127718334Speter# linked using GCC on systems using COFF or ELF, for the sake of C++
127818334Speter# constructors.
127950448Sobrien$(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
128050448Sobrien  defaults.h frame.h gbl-ctors.h
128150448Sobrien	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
128250448Sobrien	  -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS) \
128350448Sobrien	  -c $(srcdir)/crtstuff.c -DCRT_BEGIN -o $(T)crtbegin$(objext)
128418334Speter
128550448Sobrien$(T)crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
128650448Sobrien  defaults.h frame.h gbl-ctors.h
128750448Sobrien	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
128850448Sobrien	  -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS) \
128950448Sobrien	  -c $(srcdir)/crtstuff.c -DCRT_END -o $(T)crtend$(objext)
129018334Speter
129118334Speter# On some systems we also want to install versions of these files
129218334Speter# compiled using PIC for use in shared libraries.
129350448SobriencrtbeginS.o crtendS.o: s-crtS ; @true
129418334Speter
129550448Sobriens-crtS: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
129650448Sobrien  defaults.h frame.h gbl-ctors.h
129750448Sobrien	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \
129850448Sobrien	  -DCRT_BEGIN -DCRTSTUFFS_O -finhibit-size-directive -fno-inline-functions \
129950448Sobrien	  -fno-exceptions -g0 -c $(srcdir)/crtstuff.c 
130018334Speter	mv crtstuff$(objext) crtbeginS$(objext)
130150448Sobrien	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \
130250448Sobrien	  -DCRT_END -DCRTSTUFFS_O -finhibit-size-directive -fno-inline-functions \
130350448Sobrien	  -fno-exceptions -g0 -c $(srcdir)/crtstuff.c -o crtendS$(objext)
130450448Sobrien	touch s-crtS
130550448Sobrien
130650448Sobrien# Compile the start modules crt0.o and mcrt0.o that are linked with every program
130750448Sobriencrt0.o: s-crt0 ; @true
130850448Sobrienmcrt0.o: s-crt0; @true
130950448Sobrien
131050448Sobriens-crt0:	$(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
131150448Sobrien	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
131250448Sobrien	  -o crt0.o -c $(CRT0_S)
131350448Sobrien	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
131450448Sobrien	  -o mcrt0.o -c $(MCRT0_S)
131550448Sobrien	touch s-crt0
131650448Sobrien#
131718334Speter# Compiling object files from source files.
131818334Speter
131918334Speter# Note that dependencies on obstack.h are not written
132018334Speter# because that file is not part of GCC.
132118334Speter
132218334Speter# C language specific files.
132318334Speter
132418334Speterc-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
132550448Sobrien    $(srcdir)/c-parse.h c-tree.h input.h flags.h system.h toplev.h
132618334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
132718334Speter$(srcdir)/c-parse.h: $(srcdir)/c-parse.c
132818334Speter$(srcdir)/c-parse.c: $(srcdir)/c-parse.y
132952298Sobrien	cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o c-parse.c c-parse.y
133018334Speter$(srcdir)/c-parse.y: c-parse.in
133150448Sobrien	echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y
133218334Speter	sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
133318334Speter	  -e "/^ifc$$/d" -e "/^end ifc$$/d" \
133450448Sobrien	  $(srcdir)/c-parse.in >>tmp-c-parse.y
133518334Speter	$(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y
133618334Speter
133718334Speter$(srcdir)/c-gperf.h: c-parse.gperf
133852298Sobrien	gperf -L C -F ', 0, 0' -p -j1 -i 1 -g -o -t -G -N is_reserved_word \
133952298Sobrien	   -k1,3,$$ $(srcdir)/c-parse.gperf >tmp-gperf.h
134018334Speter	 $(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
134118334Speter
134250448Sobrienc-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h flags.h \
134350448Sobrien    output.h toplev.h
134450448Sobrienc-typeck.o : c-typeck.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \
134552298Sobrien    intl.h output.h $(EXPR_H) $(RTL_H) toplev.h
134650448Sobrienc-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h toplev.h \
134750448Sobrien    output.h
134850448Sobrienc-lex.o : c-lex.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-lex.h c-tree.h \
134952298Sobrien    $(srcdir)/c-parse.h input.h intl.h flags.h $(srcdir)/c-gperf.h c-pragma.h \
135052298Sobrien    toplev.h output.h mbchar.h
135152298Sobrienc-aux-info.o : c-aux-info.c  $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \
135252298Sobrien    toplev.h
135350448Sobrienc-convert.o : c-convert.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h
135450448Sobrienc-pragma.o: c-pragma.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) except.h \
135550448Sobrien    function.h defaults.h c-pragma.h toplev.h
135650448Sobrienc-iterate.o: c-iterate.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \
135750448Sobrien    flags.h toplev.h $(EXPR_H)
135852298Sobrienmbchar.o: mbchar.c $(CONFIG_H) system.h mbchar.h
135952298Sobriengraph.o: graph.c $(CONFIG_H) system.h toplev.h flags.h output.h $(RTL_H) \
136052298Sobrien    hard-reg-set.h $(BASIC_BLOCK_H)
136152298Sobriensbitmap.o: sbitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H)
136218334Speter
136352298SobrienCOLLECT2_OBJS = collect2.o tlink.o hash.o intl.o underscore.o version.o 
136452298Sobriencollect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS)
136518334Speter# Don't try modifying collect2 (aka ld) in place--it might be linking this.
136618334Speter	-rm -f collect2$(exeext)
136752298Sobrien	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(COLLECT2_OBJS) $(LIBS)
136818334Speter
136952298Sobriencollect2.o : collect2.c $(CONFIG_H) system.h gstab.h intl.h \
137052298Sobrien	$(srcdir)/../include/obstack.h $(DEMANGLE_H) collect2.h
137118334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES)  \
137250448Sobrien	-DTARGET_MACHINE=\"$(target_alias)\" $(MAYBE_USE_COLLECT2) \
137318334Speter	-c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
137418334Speter
137552298Sobrientlink.o: tlink.c $(DEMANGLE_H) hash.h $(CONFIG_H) system.h toplev.h collect2.h
137650448Sobrienhash.o: hash.c hash.h system.h toplev.h
137718334Speter
137852298Sobrienvfprintf.o: $(srcdir)/../libiberty/vfprintf.c $(CONFIG_H) system.h
137952298Sobrien	rm -f vfprintf.c
138052298Sobrien	$(LN_S) $(srcdir)/../libiberty/vfprintf.c vfprintf.c
138152298Sobrien	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) vfprintf.c
138252298Sobrien
138352298Sobriensplay-tree.o: $(srcdir)/../libiberty/splay-tree.c \
138452298Sobrien  $(srcdir)/../include/splay-tree.h $(srcdir)/../include/libiberty.h
138552298Sobrien	rm -f splay-tree.c
138652298Sobrien	$(LN_S) $(srcdir)/../libiberty/splay-tree.c splay-tree.c
138752298Sobrien	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) splay-tree.c
138852298Sobrien
138950448Sobrienunderscore.c: s-under ; @true
139018334Speter
139150448Sobriens-under: $(GCC_PASSES)
139218334Speter	echo "int xxy_us_dummy;" >tmp-dum.c
139318334Speter	$(GCC_FOR_TARGET) -S tmp-dum.c
139418334Speter	echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c
139518334Speter	if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \
139618334Speter	  echo "int prepends_underscore = 1;" >>tmp-under.c; \
139718334Speter	else \
139818334Speter	  echo "int prepends_underscore = 0;" >>tmp-under.c; \
139918334Speter	fi
140018334Speter	$(srcdir)/move-if-change tmp-under.c underscore.c
140118334Speter	-rm -f tmp-dum.c tmp-dum.s
140250448Sobrien	touch s-under
140318334Speter
140418334Speter# A file used by all variants of C.
140518334Speter
140650448Sobrienc-common.o : c-common.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h \
140752298Sobrien	flags.h toplev.h output.h c-pragma.h $(RTL_H)
140818334Speter
140918334Speter# Language-independent files.
141018334Speter
141150448SobrienDRIVER_DEFINES = \
141218334Speter  -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
141318334Speter  -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
141418334Speter  -DDEFAULT_TARGET_VERSION=\"$(version)\" \
141550448Sobrien  -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \
141650448Sobrien  -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\"
141752298Sobriengcc.o: gcc.c $(CONFIG_H) system.h intl.h multilib.h \
141852298Sobrien    Makefile $(lang_specs_files) prefix.h
141950448Sobrien	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
142050448Sobrien  $(DRIVER_DEFINES) \
142118334Speter  -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
142218334Speter
142352298Sobriengccspec.o: gccspec.c $(CONFIG_H) system.h
142452298Sobriencppspec.o: cppspec.c $(CONFIG_H) system.h
142552298Sobrien
142650448Sobrientree-check.h: s-check ; @true
142750448Sobriens-check : gencheck $(srcdir)/move-if-change
142850448Sobrien	./gencheck > tmp-check.h
142950448Sobrien	$(srcdir)/move-if-change tmp-check.h tree-check.h
143050448Sobrien	touch s-check
143150448Sobrien
143252298Sobriengencheck : gencheck.o $(lang_tree_files) $(HOST_LIBDEPS)
143350448Sobrien	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
143450448Sobrien	 gencheck.o $(HOST_LIBS)
143550448Sobrien
143652298Sobriengencheck.o : gencheck.c tree.def $(CONFIG_H) hconfig.h system.h
143752298Sobrien	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
143852298Sobrien	  $(srcdir)/gencheck.c
143950448Sobrien
144018334Speterdumpvers: dumpvers.c
144118334Speter
144218334Speterversion.o: version.c
144352298Sobrienobstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H)
144452298Sobrien	rm -f obstack.c
144552298Sobrien	$(LN_S) $(srcdir)/../libiberty/obstack.c obstack.c
144652298Sobrien	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) obstack.c
144752298Sobrien
144852298Sobrienprefix.o: prefix.c $(CONFIG_H) system.h Makefile prefix.h
144950448Sobrien	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
145050448Sobrien	-DPREFIX=\"$(prefix)\" \
145150448Sobrien	  -c `echo $(srcdir)/prefix.c | sed 's,^\./,,'`
145218334Speter
145350448Sobrienconvert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h toplev.h
145418334Speter
145550448Sobrientree.o : tree.c $(CONFIG_H) system.h $(TREE_H) flags.h function.h toplev.h except.h
145650448Sobrienprint-tree.o : print-tree.c $(CONFIG_H) system.h $(TREE_H)
145750448Sobrienstor-layout.o : stor-layout.c $(CONFIG_H) system.h $(TREE_H) flags.h \
145850448Sobrien   function.h $(EXPR_H) $(RTL_H) toplev.h except.h
145952298Sobrienfold-const.o : fold-const.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h \
146052298Sobrien   $(RTL_H)
146150448Sobrientoplev.o : toplev.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) \
146218334Speter   flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \
146352298Sobrien   insn-codes.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h dwarfout.h \
146452298Sobrien   dwarf2out.h sdbout.h dbxout.h $(EXPR_H) $(BASIC_BLOCK_H) \
146518334Speter   $(lang_options_files)
146650448Sobrien	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
146750448Sobrien	  -DTARGET_NAME=\"$(target_alias)\" \
146818334Speter	  -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
146918334Speter
147050448Sobrienrtl.o : rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
147118334Speter
147252298Sobrienprint-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h basic-block.h
147350448Sobrienrtlanal.o : rtlanal.c $(CONFIG_H) system.h $(RTL_H)
147418334Speter
147550448Sobrienvarasm.o : varasm.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h \
147650448Sobrien   function.h defaults.h $(EXPR_H) hard-reg-set.h $(REGS_H) \
147750448Sobrien   xcoffout.h output.h c-pragma.h toplev.h except.h dbxout.h sdbout.h
147850448Sobrienfunction.o : function.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
147950448Sobrien   function.h insn-flags.h insn-codes.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
148052298Sobrien   insn-config.h $(RECOG_H) output.h toplev.h except.h hash.h
148150448Sobrienstmt.o : stmt.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h  \
148250448Sobrien   insn-flags.h insn-config.h insn-codes.h hard-reg-set.h $(EXPR_H) except.h \
148352298Sobrien   loop.h $(RECOG_H) toplev.h output.h varray.h
148450448Sobrienexcept.o : except.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
148550448Sobrien   function.h insn-flags.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
148652298Sobrien   insn-config.h $(RECOG_H) output.h except.h toplev.h intl.h
148750448Sobrienexpr.o : expr.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \
148852298Sobrien   $(REGS_H) insn-flags.h insn-codes.h $(EXPR_H) insn-config.h $(RECOG_H) \
148952298Sobrien   output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h except.h
149050448Sobriencalls.o : calls.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(EXPR_H) \
149150448Sobrien   insn-flags.h $(REGS_H) toplev.h output.h
149250448Sobrienexpmed.o : expmed.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h  \
149352298Sobrien   insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) real.h toplev.h
149450448Sobrienexplow.o : explow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
149552298Sobrien   hard-reg-set.h insn-config.h $(EXPR_H) $(RECOG_H) insn-flags.h \
149652298Sobrien   insn-codes.h toplev.h
149750448Sobrienoptabs.o : optabs.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h  \
149852298Sobrien   insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) reload.h \
149952298Sobrien   toplev.h
150050448Sobriendbxout.o : dbxout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h $(REGS_H) \
150150448Sobrien   insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h dbxout.h \
150250448Sobrien   toplev.h
150350448Sobriensdbout.o : sdbout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h except.h \
150450448Sobrien   function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) defaults.h real.h \
150552298Sobrien   insn-config.h $(srcdir)/../include/obstack.h xcoffout.h c-pragma.h \
150652298Sobrien   sdbout.h toplev.h
150750448Sobriendwarfout.o : dwarfout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf.h \
150850448Sobrien   flags.h insn-config.h reload.h output.h defaults.h toplev.h dwarfout.h
150950448Sobriendwarf2out.o : dwarf2out.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf2.h \
151050448Sobrien   flags.h insn-config.h reload.h output.h defaults.h \
151150448Sobrien   hard-reg-set.h $(REGS_H) $(EXPR_H) toplev.h dwarf2out.h dyn-string.h
151250448Sobrienxcoffout.o : xcoffout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) xcoffout.h \
151350448Sobrien   flags.h toplev.h output.h dbxout.h
151450448Sobrienemit-rtl.o : emit-rtl.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
151550448Sobrien   except.h function.h $(REGS_H) insn-config.h $(RECOG_H) real.h \
151652298Sobrien   $(EXPR_H) $(srcdir)/../include/obstack.h hard-reg-set.h bitmap.h toplev.h
151750448Sobrienreal.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h
151850448Sobriengetpwd.o : getpwd.c $(CONFIG_H) system.h
151918334Speter
152050448Sobrienintegrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
152150448Sobrien   integrate.h insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \
152252298Sobrien   intl.h function.h output.h $(RECOG_H) except.h toplev.h
152318334Speter
152450448Sobrienjump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
152550448Sobrien   insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h \
152650448Sobrien   toplev.h insn-attr.h
152750448Sobrienstupid.o : stupid.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h \
152852298Sobrien   $(BASIC_BLOCK_H) insn-config.h reload.h flags.h toplev.h
152918334Speter
153050448Sobriencse.o : cse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
153152298Sobrien   real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h output.h \
153252298Sobrien   $(srcdir)/../include/splay-tree.h
153352298Sobriengcse.o : gcse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h \
153452298Sobrien   flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) \
153552298Sobrien   output.h toplev.h
153652298Sobrienresource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h system.h \
153752298Sobrien   $(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h toplev.h
153852298Sobrienlcm.o : lcm.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
153952298Sobrien   real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H)
154050448Sobrienprofile.o : profile.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-flags.h \
154152298Sobrien   gcov-io.h $(TREE_H) output.h $(REGS_H) toplev.h insn-config.h
154250448Sobrienloop.o : loop.c $(CONFIG_H) system.h $(RTL_H) flags.h loop.h insn-config.h \
154350448Sobrien   insn-flags.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \
154452298Sobrien   toplev.h varray.h
154550448Sobrienunroll.o : unroll.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
154652298Sobrien   integrate.h $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) loop.h toplev.h varray.h
154750448Sobrienflow.o : flow.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-config.h \
154852298Sobrien   $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h recog.h \
154952298Sobrien   insn-flags.h
155050448Sobriencombine.o : combine.c $(CONFIG_H) system.h $(RTL_H) flags.h  \
155150448Sobrien   insn-config.h insn-flags.h insn-codes.h insn-attr.h $(REGS_H) $(EXPR_H) \
155250448Sobrien   $(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h toplev.h
155350448Sobrienregclass.o : regclass.c $(CONFIG_H) system.h $(RTL_H) hard-reg-set.h flags.h \
155450448Sobrien   $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(RECOG_H) reload.h real.h toplev.h \
155550448Sobrien   output.h
155650448Sobrienlocal-alloc.o : local-alloc.c $(CONFIG_H) system.h $(RTL_H) flags.h \
155750448Sobrien   $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) output.h \
155850448Sobrien   insn-attr.h toplev.h
155950448Sobrienbitmap.o : bitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H) \
156050448Sobrien   $(REGS_H)
156152298Sobrienglobal.o : global.c $(CONFIG_H) system.h $(RTL_H) flags.h reload.h \
156250448Sobrien   $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h output.h toplev.h
156350448Sobrienvarray.o : varray.c $(CONFIG_H) system.h varray.h $(RTL_H) $(TREE_H) bitmap.h
156418334Speter
156550448Sobrienreload.o : reload.c $(CONFIG_H) system.h $(RTL_H) flags.h output.h $(EXPR_H) \
156650448Sobrien   reload.h $(RECOG_H) hard-reg-set.h insn-config.h insn-codes.h $(REGS_H) \
156750448Sobrien   real.h toplev.h
156850448Sobrienreload1.o : reload1.c $(CONFIG_H) system.h $(RTL_H) real.h flags.h $(EXPR_H) \
156950448Sobrien   reload.h $(REGS_H) hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
157050448Sobrien   $(BASIC_BLOCK_H) $(RECOG_H) output.h toplev.h
157150448Sobriencaller-save.o : caller-save.c $(CONFIG_H) system.h $(RTL_H) flags.h \
157250448Sobrien   $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) \
157350448Sobrien   $(RECOG_H) reload.h $(EXPR_H) toplev.h
157450448Sobrienreorg.o : reorg.c $(CONFIG_H) system.h $(RTL_H) conditions.h hard-reg-set.h \
157552298Sobrien   $(BASIC_BLOCK_H) $(REGS_H) insn-config.h insn-attr.h insn-flags.h \
157652298Sobrien   $(RECOG_H) flags.h output.h $(EXPR_H) toplev.h
157750448Sobrienalias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \
157852298Sobrien   $(REGS_H) toplev.h output.h $(EXPR_H) 
157950448Sobrienregmove.o : regmove.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
158050448Sobrien   $(RECOG_H) output.h reload.h $(REGS_H) hard-reg-set.h flags.h \
158150448Sobrien   $(EXPR_H) insn-flags.h $(BASIC_BLOCK_H) toplev.h
158250448Sobrien$(SCHED_PREFIX)sched.o : $(SCHED_PREFIX)sched.c $(CONFIG_H) system.h $(RTL_H) \
158352298Sobrien   $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h \
158452298Sobrien   insn-attr.h toplev.h recog.h
158552298Sobrienfinal.o : final.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h intl.h \
158652298Sobrien   $(REGS_H) $(RECOG_H) conditions.h insn-config.h insn-attr.h except.h real.h \
158752298Sobrien   output.h hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h \
158852298Sobrien   defaults.h toplev.h reload.h dwarfout.h dwarf2out.h sdbout.h dbxout.h
158950448Sobrienrecog.o : recog.c $(CONFIG_H) system.h $(RTL_H)  \
159050448Sobrien   $(REGS_H) $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \
159152298Sobrien   insn-flags.h insn-codes.h real.h toplev.h
159252298Sobrienreg-stack.o : reg-stack.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) recog.h \
159350448Sobrien   $(REGS_H) hard-reg-set.h flags.h insn-config.h insn-flags.h toplev.h
159452298Sobriendyn-string.o: dyn-string.c dyn-string.h $(CONFIG_H) system.h
159518334Speter
159618334Speter$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \
159750448Sobrien   $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
159850448Sobrien   insn-flags.h output.h insn-attr.h insn-codes.h system.h toplev.h
159918334Speter	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file)
160018334Speter
160118334Speter# Build auxiliary files that support ecoff format.
160218334Spetermips-tfile: mips-tfile.o version.o $(LIBDEPS)
160318334Speter	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS)
160418334Speter
160550448Sobrienmips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H) system.h machmode.h
160618334Speter
160718334Spetermips-tdump: mips-tdump.o version.o $(LIBDEPS)
160818334Speter	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tdump.o version.o $(LIBS)
160918334Speter
161050448Sobrienmips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H) system.h
161118334Speter
161218334Speter# Build file to support OSF/rose half-pic format.
161350448Sobrienhalfpic.o: halfpic.c $(CONFIG_H) $(RTL_H) $(TREE_H) system.h
161418334Speter
161518334Speter# Normally this target is not used; but it is used if you
161618334Speter# define ALLOCA=alloca.o.  In that case, you must get a suitable alloca.c
161718334Speter# from the GNU Emacs distribution.
161852298Sobrienalloca.o:	$(srcdir)/../libiberty/alloca.c
161952298Sobrien	rm -f alloca.c
162052298Sobrien	$(LN_S) $(srcdir)/../libiberty/alloca.c alloca.c
162118334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
162252298Sobrien	  -c `echo alloca.c | sed 's,^\./,,'`
162318334Speter	$(ALLOCA_FINISH)
162450448Sobrien#
162518334Speter# Generate header and source files from the machine description, 
162618334Speter# and compile them.
162718334Speter
162818334Speter.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
162918334Speter  insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
163018334Speter  insn-attr.h insn-attrtab.c
163118334Speter
163218334Speter# The following pair of rules has this effect:
163318334Speter# genconfig is run only if the md has changed since genconfig was last run;
163418334Speter# but the file insn-config.h is touched only when its contents actually change.
163518334Speter
163618334Speter# Each of the other insn-* files is handled by a similar pair of rules.
163718334Speter
163818334Speter# This causes an anomaly in the results of make -n
163950448Sobrien# because insn-* is older than s-*
164018334Speter# and thus make -n thinks that insn-* will be updated
164118334Speter# and force recompilation of things that depend on it.
164218334Speter# We use move-if-change precisely to avoid such recompilation.
164318334Speter# But there is no way to teach make -n that it will be avoided.
164418334Speter
164518334Speter# Each of the insn-*.[ch] rules has a semicolon at the end,
164618334Speter# for otherwise the system Make on SunOS 4.1 never tries
164718334Speter# to recompile insn-*.o.  To avoid problems and extra noise from
164818334Speter# versions of make which don't like empty commands (nothing after the
164918334Speter# trailing `;'), we call true for each.
165018334Speter
165150448Sobrieninsn-config.h: s-config ; @true
165250448Sobriens-config : $(md_file) genconfig $(srcdir)/move-if-change
165318334Speter	./genconfig $(md_file) > tmp-config.h
165418334Speter	$(srcdir)/move-if-change tmp-config.h insn-config.h
165550448Sobrien	touch s-config
165618334Speter
165750448Sobrieninsn-flags.h: s-flags ; @true
165850448Sobriens-flags : $(md_file) genflags $(srcdir)/move-if-change
165918334Speter	./genflags $(md_file) > tmp-flags.h
166018334Speter	$(srcdir)/move-if-change tmp-flags.h insn-flags.h
166150448Sobrien	touch s-flags
166218334Speter
166350448Sobrieninsn-codes.h: s-codes ; @true
166450448Sobriens-codes : $(md_file) gencodes $(srcdir)/move-if-change
166518334Speter	./gencodes $(md_file) > tmp-codes.h
166618334Speter	$(srcdir)/move-if-change tmp-codes.h insn-codes.h
166750448Sobrien	touch s-codes
166818334Speter
166950448Sobrieninsn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) $(EXPR_H) real.h output.h \
167052298Sobrien  insn-config.h insn-flags.h insn-codes.h system.h reload.h recog.h
167118334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
167218334Speter
167350448Sobrieninsn-emit.c: s-emit ; @true
167450448Sobriens-emit : $(md_file) genemit $(srcdir)/move-if-change
167518334Speter	./genemit $(md_file) > tmp-emit.c
167618334Speter	$(srcdir)/move-if-change tmp-emit.c insn-emit.c
167750448Sobrien	touch s-emit
167818334Speter
167950448Sobrieninsn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(RECOG_H) \
168050448Sobrien  real.h output.h flags.h system.h
168118334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
168218334Speter
168350448Sobrieninsn-recog.c: s-recog ; @true
168450448Sobriens-recog : $(md_file) genrecog $(srcdir)/move-if-change
168518334Speter	./genrecog $(md_file) > tmp-recog.c
168618334Speter	$(srcdir)/move-if-change tmp-recog.c insn-recog.c
168750448Sobrien	touch s-recog
168818334Speter
168918334Speterinsn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
169050448Sobrien  insn-config.h flags.h $(RECOG_H) $(EXPR_H) reload.h system.h
169118334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
169218334Speter
169350448Sobrieninsn-opinit.c: s-opinit ; @true
169450448Sobriens-opinit : $(md_file) genopinit $(srcdir)/move-if-change
169518334Speter	./genopinit $(md_file) > tmp-opinit.c
169618334Speter	$(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
169750448Sobrien	touch s-opinit
169818334Speter
169952298Sobrieninsn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H) system.h toplev.h \
170052298Sobrien  insn-config.h recog.h
170118334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
170218334Speter
170350448Sobrieninsn-extract.c: s-extract ; @true
170450448Sobriens-extract : $(md_file) genextract $(srcdir)/move-if-change
170518334Speter	./genextract $(md_file) > tmp-extract.c
170618334Speter	$(srcdir)/move-if-change tmp-extract.c insn-extract.c
170750448Sobrien	touch s-extract
170818334Speter
170952298Sobrieninsn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) $(REGS_H) output.h real.h \
171052298Sobrien	system.h insn-config.h recog.h
171118334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
171218334Speter
171350448Sobrieninsn-peep.c: s-peep ; @true
171450448Sobriens-peep : $(md_file) genpeep $(srcdir)/move-if-change
171518334Speter	./genpeep $(md_file) > tmp-peep.c
171618334Speter	$(srcdir)/move-if-change tmp-peep.c insn-peep.c
171750448Sobrien	touch s-peep
171818334Speter
171952298Sobrieninsn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h \
172052298Sobrien    output.h insn-attr.h insn-config.h system.h toplev.h
172118334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
172218334Speter
172350448Sobrieninsn-attr.h: s-attr ; @true
172450448Sobriens-attr : $(md_file) genattr $(srcdir)/move-if-change
172518334Speter	./genattr $(md_file) > tmp-attr.h
172618334Speter	$(srcdir)/move-if-change tmp-attr.h insn-attr.h
172750448Sobrien	touch s-attr
172818334Speter
172950448Sobrieninsn-attrtab.c: s-attrtab ; @true
173050448Sobriens-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change
173118334Speter	if cmp -s $(PREMADE_ATTRTAB_MD) $(md_file);	\
173218334Speter	then					\
173318334Speter	  echo Using $(PREMADE_ATTRTAB);	\
173418334Speter	  cp $(PREMADE_ATTRTAB) tmp-attrtab.c;	\
173518334Speter	else					\
173618334Speter	  ./genattrtab $(md_file) > tmp-attrtab.c;	\
173718334Speter	fi
173818334Speter	$(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
173950448Sobrien	touch s-attrtab
174018334Speter
174150448Sobrieninsn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h conditions.h \
174250448Sobrien    hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h $(RECOG_H) \
174350448Sobrien    insn-codes.h system.h
174418334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
174518334Speter
174650448Sobrieninsn-output.c: s-output ; @true
174750448Sobriens-output : $(md_file) genoutput $(srcdir)/move-if-change
174818334Speter	./genoutput $(md_file) > tmp-output.c
174918334Speter	$(srcdir)/move-if-change tmp-output.c insn-output.c
175050448Sobrien	touch s-output
175150448Sobrien
175250448Sobriengenrtl.o : genrtl.c $(CONFIG_H) $(RTL_H) system.h
175350448Sobriengenrtl.c genrtl.h : s-genrtl
175450448Sobrien	@true	# force gnu make to recheck modification times.
175550448Sobrien
175650448Sobriens-genrtl: gengenrtl $(srcdir)/move-if-change $(RTL_BASE_H)
175750448Sobrien	./gengenrtl tmp-genrtl.h tmp-genrtl.c
175850448Sobrien	$(srcdir)/move-if-change tmp-genrtl.h genrtl.h
175950448Sobrien	$(srcdir)/move-if-change tmp-genrtl.c genrtl.c
176050448Sobrien	touch s-genrtl
176150448Sobrien
176250448Sobrien#
176318334Speter# Compile the programs that generate insn-* from the machine description.
176418334Speter# They are compiled with $(HOST_CC), and associated libraries,
176518334Speter# since they need to run on this machine
176618334Speter# even if GCC is being compiled to run on some other machine.
176718334Speter
176818334Speter# $(CONFIG_H) is omitted from the deps of the gen*.o
176918334Speter# because these programs don't really depend on anything 
177018334Speter# about the target machine.  They do depend on config.h itself,
177118334Speter# since that describes the host machine.
177218334Speter
177318334Speter# Pass the md file through cpp if the target requests it.
177418334Speter$(MD_FILE): $(MD_DEPS)
177518334Speter	rm -f $@
177618334Speter	$(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@
177718334Speter	mv tmp-$@ $@
177818334Speter
177950448Sobriengenconfig : genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
178018334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
178150448Sobrien	  genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
178218334Speter
178350448Sobriengenconfig.o : genconfig.c $(RTL_H) $(build_xm_file) system.h
178418334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
178518334Speter
178650448Sobriengenflags : genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
178718334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
178850448Sobrien	 genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
178918334Speter
179050448Sobriengenflags.o : genflags.c $(RTL_H) $(build_xm_file) system.h
179118334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
179218334Speter
179350448Sobriengencodes : gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
179418334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
179550448Sobrien	 gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
179618334Speter
179750448Sobriengencodes.o : gencodes.c $(RTL_H) $(build_xm_file) system.h
179818334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
179918334Speter
180050448Sobriengenemit : genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
180118334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
180250448Sobrien	 genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
180318334Speter
180450448Sobriengenemit.o : genemit.c $(RTL_H) $(build_xm_file) system.h
180518334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
180618334Speter
180750448Sobriengenopinit : genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
180818334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
180950448Sobrien	 genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
181018334Speter
181150448Sobriengenopinit.o : genopinit.c $(RTL_H) $(build_xm_file) system.h
181218334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
181318334Speter
181450448Sobriengenrecog : genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
181518334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
181650448Sobrien	 genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
181718334Speter
181850448Sobriengenrecog.o : genrecog.c $(RTL_H) $(build_xm_file) system.h
181918334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
182018334Speter
182150448Sobriengenextract : genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
182218334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
182350448Sobrien	 genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
182418334Speter
182550448Sobriengenextract.o : genextract.c $(RTL_H) $(build_xm_file) system.h insn-config.h
182618334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
182718334Speter
182850448Sobriengenpeep : genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
182918334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
183050448Sobrien	 genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
183118334Speter
183250448Sobriengenpeep.o : genpeep.c $(RTL_H) $(build_xm_file) system.h
183318334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
183418334Speter
183550448Sobriengenattr : genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
183618334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
183750448Sobrien	 genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
183818334Speter
183950448Sobriengenattr.o : genattr.c $(RTL_H) $(build_xm_file) system.h
184018334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
184118334Speter
184218334Spetergenattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
184318334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
184418334Speter	 genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
184518334Speter
184650448Sobriengenattrtab.o : genattrtab.c $(RTL_H)  $(build_xm_file) system.h insn-config.h
184718334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
184818334Speter
184950448Sobriengenoutput : genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
185018334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
185150448Sobrien	 genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
185218334Speter
185350448Sobriengenoutput.o : genoutput.c $(RTL_H) $(build_xm_file) system.h
185418334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
185550448Sobrien
185650448Sobriengengenrtl : gengenrtl.o $(HOST_LIBDEPS)
185750448Sobrien	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
185850448Sobrien	 gengenrtl.o $(HOST_LIBS)
185950448Sobrien
186050448Sobriengengenrtl.o : gengenrtl.c $(RTL_BASE_H) system.h
186150448Sobrien	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gengenrtl.c
186250448Sobrien
186350448Sobrien#
186418334Speter# Compile the libraries to be used by gen*.
186518334Speter# If we are not cross-building, gen* use the same .o's that cc1 will use,
186618334Speter# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
186718334Speter# with the rules for rtl.o, alloca.o, etc.
186850448Sobrien$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
186918334Speter	rm -f $(HOST_PREFIX)rtl.c
187018334Speter	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
187118334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
187218334Speter
187352298Sobrien$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H) \
187452298Sobrien	bitmap.h basic-block.h
187518334Speter	rm -f $(HOST_PREFIX)print-rtl.c
187618334Speter	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
187718334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
187818334Speter
187950448Sobrien$(HOST_PREFIX_1)bitmap.o: $(srcdir)/bitmap.c $(CONFIG_H) system.h $(RTL_H) \
188050448Sobrien  flags.h $(BASIC_BLOCK_H) $(REGS_H)
188150448Sobrien	rm -f $(HOST_PREFIX)bitmap.c
188250448Sobrien	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/bitmap.c > $(HOST_PREFIX)bitmap.c
188350448Sobrien	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)bitmap.c
188450448Sobrien
188518334Speter$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
188618334Speter	rm -f $(HOST_PREFIX)rtlanal.c
188718334Speter	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
188818334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
188918334Speter
189052298Sobrien$(HOST_PREFIX_1)alloca.o: $(srcdir)/../libiberty/alloca.c
189118334Speter	rm -f $(HOST_PREFIX)alloca.c
189252298Sobrien	$(LN_S) $(srcdir)/../libiberty/alloca.c $(HOST_PREFIX)alloca.c
189318334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
189418334Speter
189552298Sobrien$(HOST_PREFIX_1)obstack.o: $(srcdir)/../libiberty/obstack.c
189618334Speter	rm -f $(HOST_PREFIX)obstack.c
189752298Sobrien	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/obstack.c > $(HOST_PREFIX)obstack.c
189818334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
189918334Speter
190052298Sobrien$(HOST_PREFIX_1)vfprintf.o: $(srcdir)/../libiberty/vfprintf.c
190150448Sobrien	rm -f $(HOST_PREFIX)vfprintf.c
190252298Sobrien	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/vfprintf.c > $(HOST_PREFIX)vfprintf.c
190350448Sobrien	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)vfprintf.c
190450448Sobrien
190550448Sobrien$(HOST_PREFIX_1)doprint.o: doprint.c
190650448Sobrien	rm -f $(HOST_PREFIX)doprint.c
190750448Sobrien	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/doprint.c > $(HOST_PREFIX)doprint.c
190850448Sobrien	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)doprint.c
190950448Sobrien
191018334Speter$(HOST_PREFIX_1)malloc.o: malloc.c
191118334Speter	rm -f $(HOST_PREFIX)malloc.c
191218334Speter	sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
191318334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
191418334Speter
191518334Speter# This satisfies the dependency that we get if you cross-compile a compiler
191618334Speter# that does not need to compile alloca, malloc or whatever.
191718334Speter$(HOST_PREFIX_1): 
191818334Speter	touch $(HOST_PREFIX_1)
191918334Speter
192052298Sobrien
192150448Sobrien#
192252298Sobrien# Remake internationalization support.
192352298Sobrien
192452298Sobrienintl.o: intl.c intl.h gansidecl.h Makefile
192552298Sobrien	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
192652298Sobrien	  -DLOCALEDIR=\"$(localedir)\" \
192752298Sobrien	  -c `echo $(srcdir)/intl.c | sed 's,^\./,,'`
192852298Sobrien
192952298Sobrien# This is needed to when doing a partial build after a `make clean'.
193052298Sobrien# libintl.a does not depend on intl.all,
193152298Sobrien# as that would force a lot of recompiling.
193252298Sobrien$(top_builddir)/intl/libintl.a:
193352298Sobrien	@echo "$(MAKE) intl.all"
193452298Sobrien	@$(MAKE) $(FLAGS_TO_PASS) intl.all
193552298Sobrien
193652298Sobrien# Make sure all the headers are there for xgettext to scan.
193752298Sobrien$(INTL_TARGETS): $(srcdir)/c-gperf.h \
193852298Sobrien    $(srcdir)/c-parse.c $(srcdir)/c-parse.h $(srcdir)/cexp.c
193952298Sobrien
194052298Sobrienintl.all intl.install intl.uninstall intl.distdir \
194152298Sobrien  intl.mostlyclean intl.clean intl.distclean intl.maintainer-clean:
194252298Sobrien	@for d in $(INTL_SUBDIRS); do \
194352298Sobrien	  target=`expr $@ : 'intl.\(.*\)'` && \
194452298Sobrien	  echo "(cd $$d && $(MAKE) $$target)" && \
194552298Sobrien	  (cd $$d && AWK='$(AWK)' $(MAKE) $(SUBDIR_FLAGS_TO_PASS) $$target); \
194652298Sobrien	done
194752298Sobrien
194852298Sobrien# intl.distdir doesn't copy the intl makefiles (since they aren't distributed),
194952298Sobrien# but we need them for the `make extraclean' in distdir-finish.
195052298Sobrienintl.distdir-fixup:
195152298Sobrien	for d in $(INTL_SUBDIRS); do \
195252298Sobrien	  ln $$d/Makefile tmp/$$d || cp $$d/Makefile tmp/$$d || exit; \
195352298Sobrien	done
195452298Sobrien#
195518334Speter# Remake cpp and protoize.
195618334Speter
195718334Speter# Making the preprocessor
195850448Sobriencpp$(exeext): $(CCCP)$(exeext)
195918334Speter	-rm -f cpp$(exeext)
196050448Sobrien	$(LN) $(CCCP)$(exeext) cpp$(exeext)
196152298SobrienCCCP_OBJS = cccp.o cexp.o intl.o prefix.o version.o @extra_cpp_objs@ mbchar.o 
196252298Sobriencccp$(exeext): $(CCCP_OBJS) $(LIBDEPS)
196352298Sobrien	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(CCCP_OBJS) $(LIBS)
196452298Sobriencexp.o: $(srcdir)/cexp.c $(CONFIG_H) system.h
196518334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
196618334Speter$(srcdir)/cexp.c: $(srcdir)/cexp.y
196718334Speter	cd $(srcdir); $(BISON) -o cexp.c cexp.y
196818334Speter
196952298Sobrien# We use $(libsubdir)/$(unlibsubdir) to match the
197052298Sobrien# -iprefix argument which gcc will pass if GCC_EXEC_PREFIX is used.
197152298Sobriencccp.o: cccp.c $(CONFIG_H) intl.h pcp.h version.c config.status system.h \
197252298Sobrien           mbchar.h prefix.h Makefile.in
197318334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
197418334Speter	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
197552298Sobrien	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
197618334Speter	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
197752298Sobrien	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
197852298Sobrien	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
197918334Speter	  -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
198018334Speter
198152298SobrienLIBCPP_OBJS =	cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \
198252298Sobrien		cppinit.o cppulp.o prefix.o version.o mbchar.o @extra_cpp_objs@
198318334Speter
198452298Sobrien# All the other archives built/used by this makefile are for targets.  This
198552298Sobrien# one is strictly for the host.
198652298Sobrien#
198752298Sobrienlibcpp.a: $(LIBCPP_OBJS)
198852298Sobrien	$(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS)
198952298Sobrien	if $(RANLIB_TEST) ; then $(RANLIB) libcpp.a ; else true ; fi
199050448Sobrien
199152298Sobriencppmain$(exeext): cppmain.o intl.o libcpp.a $(LIBDEPS)
199252298Sobrien	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cppmain$(exeext) cppmain.o \
199352298Sobrien	intl.o libcpp.a $(LIBS)
199452298Sobrien
199552298Sobriencppmain.o: cppmain.c $(CONFIG_H) cpplib.h intl.h system.h
199652298Sobrien
199752298Sobriencppulp.o:  cppulp.c  $(CONFIG_H) system.h output.h
199852298Sobriencpplib.o:  cpplib.c  $(CONFIG_H) cpplib.h intl.h system.h cpphash.h
199952298Sobriencpphash.o: cpphash.c $(CONFIG_H) cpplib.h intl.h system.h cpphash.h
200052298Sobriencppalloc.o: cppalloc.c $(CONFIG_H) cpplib.h intl.h system.h
200152298Sobriencpperror.o: cpperror.c $(CONFIG_H) cpplib.h intl.h system.h
200252298Sobriencppexp.o:   cppexp.c   $(CONFIG_H) cpplib.h intl.h system.h
200352298Sobriencppfiles.o: cppfiles.c $(CONFIG_H) cpplib.h intl.h system.h
200452298Sobrien
200552298Sobriencppinit.o:  cppinit.c $(CONFIG_H) cpplib.h intl.h system.h \
200652298Sobrien		cpphash.h prefix.h output.h Makefile
200718334Speter	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
200818334Speter	  -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
200952298Sobrien	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
201018334Speter	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
201152298Sobrien	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
201252298Sobrien	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
201352298Sobrien	  -c `echo $(srcdir)/cppinit.c | sed 's,^\./,,'`
201418334Speter
201518334Speter# Note for the stamp targets, we run the program `true' instead of
201618334Speter# having an empty command (nothing following the semicolon).
201718334Speter
201850448Sobrienproto: config.status protoize$(exeext) unprotoize$(exeext) SYSCALLS.c.X
201918334Speter
202052298SobrienPROTO_OBJS = getpwd.o intl.o version.o 
202118334Speter
202252298Sobrienprotoize$(exeext): protoize.o $(PROTO_OBJS) $(LIBDEPS)
202352298Sobrien	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ protoize.o $(PROTO_OBJS) $(LIBS)
202418334Speter
202552298Sobrienunprotoize$(exeext): unprotoize.o $(PROTO_OBJS) $(LIBDEPS)
202652298Sobrien	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ unprotoize.o $(PROTO_OBJS) $(LIBS)
202752298Sobrien
202852298Sobrienprotoize.o: protoize.c $(srcdir)/../include/getopt.h $(CONFIG_H) system.h \
202952298Sobrien   Makefile
203018334Speter	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
203118334Speter          -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
203252298Sobrien	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
203352298Sobrien	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
203452298Sobrien	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
203518334Speter	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
203618334Speter	  -DSTD_PROTO_DIR=\"$(libsubdir)\" \
203750448Sobrien	  $(srcdir)/protoize.c
203850448Sobrien
203952298Sobrienunprotoize.o: unprotoize.c protoize.c $(srcdir)/../include/getopt.h \
204052298Sobrien   $(CONFIG_H) system.h Makefile
204118334Speter	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
204218334Speter          -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
204352298Sobrien	  -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
204452298Sobrien	  -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
204552298Sobrien	  -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
204618334Speter	  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
204718334Speter	  -DSTD_PROTO_DIR=\"$(libsubdir)\" \
204850448Sobrien	  $(srcdir)/unprotoize.c
204918334Speter
205018334Speter# This info describes the target machine, so compile with GCC just built.
205118334SpeterSYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \
205218334Speter   stmp-int-hdrs
205318334Speter	-rm -f SYSCALLS.c tmp-SYSCALLS.s
205418334Speter	cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
205518334Speter	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
205618334Speter	  -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
205718334Speter	-rm -f SYSCALLS.c tmp-SYSCALLS.s
205818334Speter
205918334Speter
206018334Spetertest-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
206118334Speter	-rm -f tmp-proto.[cso]
206218334Speter	cp $(srcdir)/protoize.c tmp-proto.c
206318334Speter	chmod u+w tmp-proto.c
206418334Speter	./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
206518334Speter	  $(CFLAGS) $(INCLUDES) \
206618334Speter	  -DGCC_INCLUDE_DIR=0 \
206718334Speter	  -DGPLUSPLUS_INCLUDE_DIR=0 \
206818334Speter	  -DCROSS_INCLUDE_DIR=0 \
206918334Speter	  -DTOOL_INCLUDE_DIR=0 \
207018334Speter	  -DSTD_PROTO_DIR=0" tmp-proto.c
207118334Speter	@echo '**********' Expect 400 lines of differences.
207218334Speter	-diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
207318334Speter	-wc -l tmp-proto.diff
207418334Speter	./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
207518334Speter	  $(CFLAGS) $(INCLUDES) \
207618334Speter	  -DGCC_INCLUDE_DIR=0 \
207718334Speter	  -DGPLUSPLUS_INCLUDE_DIR=0 \
207818334Speter	  -DCROSS_INCLUDE_DIR=0 \
207918334Speter	  -DTOOL_INCLUDE_DIR=0 \
208018334Speter	  -DSTD_PROTO_DIR=0" tmp-proto.c
208118334Speter	@echo Expect zero differences.
208218334Speter	diff $(srcdir)/protoize.c tmp-proto.c | cat
208318334Speter	-rm -f tmp-proto.[cs] tmp-proto$(objext)
208450448Sobrien
208552298Sobriengcov.o: gcov.c gcov-io.h intl.h system.h
208650448Sobrien
208750448Sobrien# Only one of 'gcov' or 'gcov.exe' is actually built, depending
208850448Sobrien# upon whether $(exeext) is empty or not.
208952298SobrienGCOV_OBJS = gcov.o intl.o
209052298Sobriengcov$(exeext): $(GCOV_OBJS) $(LIBDEPS)
209152298Sobrien	$(CC) $(ALL_CFLAGS) $(LDFLAGS) $(GCOV_OBJS) $(LIBS) -o $@
209250448Sobrien#
209318334Speter# Build the include directory.  The stamp files are stmp-* rather than
209450448Sobrien# s-* so that mostlyclean does not force the include directory to
209518334Speter# be rebuilt.
209618334Speter
209750448Sobrien# Build the include directory including float.h (which no longer depends upon
209818334Speter# enquire).
209952298Sobrienstmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h
210018334Speter# Copy in the headers provided with gcc.
210118334Speter# The sed command gets just the last file name component;
210218334Speter# this is necessary because VPATH could add a dirname.
210318334Speter# Using basename would be simpler, but some systems don't have it.
210450448Sobrien# The touch command is here to workaround an AIX/Linux NFS bug.
210518334Speter	for file in .. $(USER_H); do \
210618334Speter	  if [ X$$file != X.. ]; then \
210718334Speter	    realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
210850448Sobrien	    touch include/$$realfile; \
210950448Sobrien	    rm -f include/$$realfile; \
211050448Sobrien	    cp $$file include; \
211150448Sobrien	    chmod a+r include/$$realfile; \
211218334Speter	  fi; \
211318334Speter	done
211418334Speter	rm -f include/limits.h
211518334Speter	cp xlimits.h include/limits.h
211618334Speter	chmod a+r include/limits.h
211750448Sobrien	rm -f include/float.h
211852298Sobrien	if [ x$(FLOAT_H) != xMakefile.in ]; then \
211952298Sobrien	  cp $(srcdir)/config/$(FLOAT_H) include/float.h && \
212050448Sobrien	  chmod a+r include/float.h; \
212150448Sobrien	else :; fi
212218334Speter# Install the README
212318334Speter	rm -f include/README
212418334Speter	cp $(srcdir)/README-fixinc include/README
212518334Speter	chmod a+r include/README
212650448Sobrien	touch $@
212718334Speter
212852298Sobrien# Now that float.h no longer depends upon enquire, this is actually a no-op.
212950448Sobrienstmp-headers:
213050448Sobrien	touch $@
213118334Speter
213252298SobrienFIXINCSRCDIR=$(srcdir)/fixinc
213352298Sobrienfixinc.sh: $(FIXINCSRCDIR)/mkfixinc.sh $(FIXINCSRCDIR)/fixincl.c \
213452298Sobrien	$(FIXINCSRCDIR)/procopen.c $(FIXINCSRCDIR)/gnu-regex.c \
213552298Sobrien	$(FIXINCSRCDIR)/server.c $(FIXINCSRCDIR)/gnu-regex.h \
213652298Sobrien	$(FIXINCSRCDIR)/server.h $(FIXINCSRCDIR)/inclhack.def 
213752298Sobrien	MAKE="$(MAKE)"; srcdir=`cd $(srcdir)/fixinc; pwd` ; \
213852298Sobrien	export MAKE srcdir ; \
213952298Sobrien	cd ./fixinc; $(SHELL) $${srcdir}/mkfixinc.sh $(target)
214050448Sobrien
214152298Sobrien##stmp-fixinc: $(FIXINCLUDES) gsyslimits.h
214252298Sobrien##	rm -rf include
214352298Sobrien##	mkdir include
214452298Sobrien##	if [ x$(FIXINCLUDES) != xMakefile.in ]; \
214552298Sobrien##	then \
214652298Sobrien##	  for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
214752298Sobrien##	    if [ -d $$dir ]; \
214852298Sobrien##	    then \
214952298Sobrien##	      $(SHELL) $(srcdir)/$(FIXINCLUDES) include $$dir; \
215052298Sobrien##	    else true; fi; \
215152298Sobrien##	  done; \
215252298Sobrien##	  if [ x$(INSTALL_ASSERT_H) != x ] ; \
215352298Sobrien##	  then \
215452298Sobrien##	    rm -f include/assert.h; \
215552298Sobrien##	    cp $(srcdir)/assert.h include/assert.h; \
215652298Sobrien##	    chmod a+r include/assert.h; \
215752298Sobrien##	  fi \
215852298Sobrien##	else true; \
215952298Sobrien##	fi
216052298Sobrien
216118334Speter# Build fixed copies of system files.
216252298Sobrienstmp-fixinc: fixinc.sh gsyslimits.h
216352298Sobrien	rm -rf include; mkdir include
216452298Sobrien	TARGET_MACHINE=$(target); srcdir=`cd $(srcdir); pwd`; \
216552298Sobrien	INSTALL_ASSERT_H=$(INSTALL_ASSERT_H); SHELL=$(SHELL) ;\
216652298Sobrien	export TARGET_MACHINE srcdir INSTALL_ASSERT_H SHELL ; \
216752298Sobrien	$(SHELL) ./fixinc.sh `pwd`/include $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS)
216818334Speter	rm -f include/syslimits.h
216918334Speter	if [ -f include/limits.h ]; then \
217018334Speter	  mv include/limits.h include/syslimits.h; \
217118334Speter	else \
217218334Speter	  cp $(srcdir)/gsyslimits.h include/syslimits.h; \
217318334Speter	fi
217418334Speter	chmod a+r include/syslimits.h
217552298Sobrien# If $(SYSTEM_HEADER_DIR) is $(tooldir)/sys-include, and
217652298Sobrien# that directory exists, then make sure that $(libsubdir) exists.
217752298Sobrien# This is because cpp is compiled to find $(tooldir)/include via
217852298Sobrien# $(libsubdir)/$(unlibsubdir), which will only work if $(libsubdir)
217952298Sobrien# exists.
218052298Sobrien# We deliberately use tooldir instead of gcc_tooldir here.  gcc_tooldir
218152298Sobrien# won't work because libsubdir doesn't exist yet.
218252298Sobrien	if [ "$(SYSTEM_HEADER_DIR)" = "$(tooldir)/sys-include" ] \
218352298Sobrien	   && [ -d $(tooldir)/sys-include ]; then \
218452298Sobrien	  if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi; \
218552298Sobrien	  if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib; fi; \
218652298Sobrien	  if [ -d $(libdir)/gcc-lib/$(target_alias) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias) ; fi; \
218752298Sobrien	  if [ -d $(libdir)/gcc-lib/$(target_alias)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias)/$(version) ; fi; \
218852298Sobrien	else true; fi
218952298Sobrien
219018334Speter	touch stmp-fixinc
219118334Speter
219218334Speter# Files related to the fixproto script.
219318334Speter
219418334Speterdeduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
219550448Sobrien	if [ -d $(SYSTEM_HEADER_DIR) ]; \
219650448Sobrien	then \
219750448Sobrien	  CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -Iinclude -I${SYSTEM_HEADER_DIR}"; \
219818334Speter	  export CC; \
219950448Sobrien	  $(SHELL) $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h; \
220050448Sobrien	  mv tmp-deduced.h deduced.h; \
220150448Sobrien	else \
220250448Sobrien	  touch deduced.h; \
220350448Sobrien	fi
220418334Speter
220552298SobrienGEN_PROTOS_OBJS = gen-protos.o scan.o libcpp.a
220652298Sobriengen-protos: $(GEN_PROTOS_OBJS) $(HOST_LIBDEPS)
220752298Sobrien	${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o gen-protos \
220852298Sobrien	  $(GEN_PROTOS_OBJS) $(HOST_LIBS)
220918334Speter
221050448Sobriengen-protos.o: gen-protos.c scan.h $(build_xm_file) system.h
221118334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c
221218334Speter
221350448Sobrienscan.o: scan.c scan.h $(build_xm_file) system.h
221418334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c
221518334Speter
221618334Speterxsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
221718334Speter	cat deduced.h $(srcdir)/sys-protos.h > tmp-fixtmp.c
221818334Speter	mv tmp-fixtmp.c fixtmp.c
221918334Speter	$(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
222018334Speter	  | sed -e 's/	/ /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
222118334Speter	  | ./gen-protos >xsys-protos.hT
222218334Speter	mv xsys-protos.hT xsys-protos.h
222318334Speter	rm -rf fixtmp.c
222418334Speter
222518334Speterfix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS) \
222652298Sobrien	    libcpp.a
222718334Speter	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ fix-header.o \
222852298Sobrien	   scan-decls.o scan.o libcpp.a $(HOST_LIBS)
222918334Speter
223052298Sobrienfix-header.o: fix-header.c $(srcdir)/../include/obstack.h scan.h \
223152298Sobrien	xsys-protos.h $(build_xm_file) system.h cpplib.h cpphash.h
223218334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c
223318334Speter
223452298Sobrienscan-decls.o: scan-decls.c scan.h cpplib.h $(build_xm_file) system.h
223518334Speter	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c
223618334Speter
223718334Speter# stmp-fixproto depends on this, not on fix-header directly.
223818334Speter# The idea is to make sure fix-header gets built,
223918334Speter# but not rerun fixproto after each stage
224018334Speter# just because fix-header's mtime has changed.
224118334Speterfixhdr.ready: fix-header
224218334Speter	-if [ -f fixhdr.ready ] ; then \
224318334Speter		true; \
224418334Speter	else \
224518334Speter		touch fixhdr.ready; \
224618334Speter	fi
224718334Speter
224818334Speter# stmp-headers is to make sure fixincludes has already finished.
224918334Speter# The if statement is so that we don't run fixproto a second time
225018334Speter# if it has already been run on the files in `include'.
225118334Speterstmp-fixproto: fixhdr.ready fixproto stmp-headers
225218334Speter	@echo "Various warnings and error messages from fixproto are normal"
225318334Speter	-if [ -d include ] ; then true; else mkdir include; fi
225418334Speter	-if [ -f include/fixed ] ; then true; \
225518334Speter	else \
225618334Speter	  : This line works around a 'make' bug in BSDI 1.1.; \
225718334Speter	  FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
225852298Sobrien	  mkinstalldirs="$(SHELL) $(srcdir)/mkinstalldirs"; \
225952298Sobrien	    export mkinstalldirs; \
226050448Sobrien	  if [ -d $(SYSTEM_HEADER_DIR) ] ; then \
226150448Sobrien	    $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
226250448Sobrien	  else true; fi; \
226318334Speter	  touch include/fixed; \
226418334Speter	fi
226518334Speter	touch stmp-fixproto
226650448Sobrien#
226718334Speter# Remake the info files.
226818334Speter
226918334Speterdoc: info
227050448Sobrieninfo: cpp.info gcc.info lang.info
227118334Speter
227250448Sobriencpp.info: $(srcdir)/cpp.texi
227350448Sobrien	$(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o cpp.info $(srcdir)/cpp.texi
227418334Speter
227550448Sobriengcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
227650448Sobrien	  $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
227750448Sobrien	  $(srcdir)/tm.texi $(srcdir)/gcov.texi
227850448Sobrien	$(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o gcc.info $(srcdir)/gcc.texi
227918334Speter
228050448Sobriendvi: gcc.dvi cpp.dvi lang.dvi
228118334Speter
228218334Speter# This works with GNU Make's default rule.
228350448Sobriengcc.dvi: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
228450448Sobrien	 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
228550448Sobrien	 $(srcdir)/tm.texi $(srcdir)/gcov.texi
228650448Sobrien	TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
228750448Sobrien	texindex gcc.??
228850448Sobrien	TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
228918334Speter
229050448Sobriencpp.dvi: $(srcdir)/cpp.texi
229150448Sobrien	TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
229250448Sobrien	texindex cpp.??
229350448Sobrien	TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
229418334Speter
229550448Sobrien
229650448SobrienINSTALL: $(srcdir)/install1.texi $(srcdir)/install.texi
229752298Sobrien	cd $(srcdir); $(MAKEINFO) -D INSTALLONLY \
229850448Sobrien		--no-split -o INSTALL install1.texi 
229950448Sobrien#
230018334Speter# Deletion of files made during compilation.
230118334Speter# There are four levels of this:
230218334Speter#   `mostlyclean', `clean', `distclean' and `maintainer-clean'.
230318334Speter# `mostlyclean' is useful while working on a particular type of machine.
230418334Speter# It deletes most, but not all, of the files made by compilation.
230518334Speter# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
230618334Speter# `clean' deletes everything made by running `make all'.
230718334Speter# `distclean' also deletes the files made by config.
230818334Speter# `maintainer-clean' also deletes everything that could be regenerated
230950448Sobrien# automatically, except for `configure'.
231050448Sobrien# We remove as much from the language subdirectories as we can
231118334Speter# (less duplicated code).
231218334Speter
231318334Speter
231452298Sobrienmostlyclean: intl.mostlyclean lang.mostlyclean
231518334Speter	-rm -f $(STAGESTUFF)
231618334Speter# Delete the temporary source copies for cross compilation.
231718334Speter	-rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
231818334Speter	-rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
231918334Speter	-rm -f $(HOST_PREFIX_1)obstack.c 
232018334Speter# Delete the temp files made in the course of building libgcc.a.
232150448Sobrien	-rm -f tmplibgcc* tmpcopy xlimits.h libgcc1-test
232218334Speter	for name in $(LIB1FUNCS); do rm -f $${name}.c; done
232350448Sobrien# Delete other built files.
232450448Sobrien	-rm -f t-float.h-cross xsys-protos.hT fp-bit.c dp-bit.c
232550448Sobrien# Delete the stamp and temporary files.
232650448Sobrien	-rm -f s-* tmp-* stamp-* stmp-*
232718334Speter	-rm -f */stamp-* */tmp-*
232818334Speter# Delete debugging dump files.
232918334Speter	-rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
233050448Sobrien	-rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.addressof
233152298Sobrien	-rm -f *.regmove *.mach *.bp *.gcse *.flow2
233218334Speter	-rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl
233318334Speter	-rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2
233452298Sobrien	-rm -f */*.sched2 */*.stack */*.regmove */*.gcse */*.flow2
233518334Speter# Delete some files made during installation.
233652298Sobrien	-rm -f specs float.h-* enquire SYSCALLS.c.X SYSCALLS.c
233718334Speter	-rm -f collect collect2 mips-tfile mips-tdump alloca.s
233818334Speter# Delete files generated for fixproto
233918334Speter	-rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \
234018334Speter	  gen-protos fixproto.list fixtmp.* fixhdr.ready
234118334Speter# Delete unwanted output files from TeX.
234218334Speter	-rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
234318334Speter	-rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg
234418334Speter# Delete sorted indices we don't actually use.
234518334Speter	-rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
234618334Speter# Delete core dumps.
234718334Speter	-rm -f core */core
234850448Sobrien	-rm -f *.bp */*.bp
234918334Speter
235018334Speter# Delete all files made by compilation
235118334Speter# that don't exist in the distribution.
235252298Sobrienclean: mostlyclean intl.clean lang.clean
235318334Speter# It may not be quite desirable to delete unprotoize.c here,
235418334Speter# but the spec for `make clean' requires it.
235518334Speter# Using unprotoize.c is not quite right in the first place, 
235618334Speter# but what better way is there?
235718334Speter	-rm -f libgcc.a libgcc1.a libgcc1-asm.a libgcc2.a libgcc2.ready
235818334Speter	-rm -f libgcc1.null
235918334Speter	-rm -f *.dvi
236018334Speter	-rm -f */*.dvi
236118334Speter	-if [ -f md.pre-cpp ]; then \
236218334Speter	  rm -f md ; \
236318334Speter	fi
236418334Speter# Delete the include directory.
236550448Sobrien	-rm -rf include
236618334Speter# Delete files used by the "multilib" facility (including libgcc subdirs).
236718334Speter	-rm -f multilib.h tmpmultilib*
236818334Speter	-if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \
236918334Speter	  rm -rf $(MULTILIB_DIRNAMES); \
237018334Speter	else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \
237118334Speter	  rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \
237218334Speter	fi ; fi
237350448Sobrien	-rm -fr stage1 stage2 stage3 stage4
237418334Speter
237518334Speter# Delete all files that users would normally create
237618334Speter# while building and installing GCC.
237752298SobrienINTL_DISTCLEAN = intl.distclean
237852298Sobriendistclean: clean $(INTL_DISTCLEAN) lang.distclean
237950448Sobrien	-rm -f tm.h config.h auto-host.h auto-build.h tconfig.h hconfig.h
238050448Sobrien	-rm -f md cstamp-h
238150448Sobrien	-rm -f config.status config.run config.cache config.bak
238250448Sobrien	-rm -f Make-lang Make-hooks Make-host Make-target
238352298Sobrien	-rm -f Makefile specs.h options.h gencheck.h *.oaux
238450448Sobrien	-rm -f gthr-default.h
238518334Speter	-rm -f */stage1 */stage2 */stage3 */stage4 */include
238618334Speter	-rm -f c-parse.output
238718334Speter	-rm -f *.asm
238850448Sobrien	-rm -f float.h
238950448Sobrien	-rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak
239050448Sobrien	-rm -f testsuite/{gcc,g++}.{log,sum}
239152298Sobrien	-rm -f intl/libintl.h libintl.h
239218334Speter
239318334Speter# Delete anything likely to be found in the source directory
239418334Speter# that shouldn't be in the distribution.
239518334Speterextraclean: distclean lang.extraclean
239618334Speter	-rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
239718334Speter	-rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
239818334Speter	-rm -f config/*/=* config/*/"#"* config/*/*~*
239918334Speter	-rm -f config/*/*.orig config/*/*.rej
240018334Speter	-rm -f *.dvi *.ps *.oaux *.d *.[zZ] *.gz
240118334Speter	-rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
240218334Speter	-rm -f *lose config/*lose config/*/*lose
240350448Sobrien	-rm -f *.s *.s[0-9] *.i config/ChangeLog
240452298Sobrien	-rm -f y.tab.c yacc.*
240518334Speter	-rm -f */=* */"#"* */*~*
240618334Speter	-rm -f */patch* */*.orig */*.rej
240718334Speter	-rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz
240818334Speter	-rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs
240918334Speter	-rm -f */*lose */*.s */*.s[0-9] */*.i
241018334Speter
241150448Sobrien# Get rid of every file that's generated from some other file, except for `configure'.
241218334Speter# Most of these files ARE PRESENT in the GCC distribution.
241352298Sobrien# We define INTL_DISTCLEAN to be empty in the submake, so that
241452298Sobrien# we don't descend into intl after its makefile has been removed.
241550448Sobrienmaintainer-clean:
241650448Sobrien	@echo 'This command is intended for maintainers to use; it'
241750448Sobrien	@echo 'deletes files that may need special tools to rebuild.'
241852298Sobrien	$(MAKE) INTL_DISTCLEAN= distclean \
241952298Sobrien		intl.maintainer-clean lang.maintainer-clean
242050448Sobrien	-rm -f c-parse.y c-gperf.h
242118334Speter	-rm -f c-parse.c c-parse.h c-parse.output
242218334Speter	-rm -f cexp.c cexp.output TAGS 
242318334Speter	-rm -f cpp.info* cpp.??s cpp.*aux
242418334Speter	-rm -f gcc.info* gcc.??s gcc.*aux
242550448Sobrien#
242618334Speter# Entry points `install' and `uninstall'.
242718334Speter# Also use `install-collect2' to install collect2 when the config files don't.
242818334Speter
242918334Speter# The semicolon is to prevent the install.sh -> install default rule
243018334Speter# from doing anything.  Having it run true helps avoid problems and
243118334Speter# noise from versions of make which don't like to have null commands.
243218334Speterinstall: $(INSTALL_TARGET) ; @true
243318334Speter
243418334Speter# Copy the compiler files into directories where they will be run.
243518334Speter# Install the driver last so that the window when things are
243618334Speter# broken is small.
243718334Speterinstall-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
243852298Sobrien    $(INSTALL_CPP) install-man install-info intl.install lang.install-normal \
243950448Sobrien    install-driver
244018334Speter
244118334Speter# Do nothing while making gcc with a cross-compiler. The person who
244218334Speter# makes gcc for the target machine has to know how to put a complete
244318334Speter# gcc together by hand.
244418334Speterinstall-build: force
244518334Speter	@echo You have to install gcc on your target machine by hand.
244618334Speter
244718334Speter# Run this on the target machine
244818334Speter# to finish installation of cross compiler.
244952298Sobrien# This is not used anymore now that float.h does not depend on enquire.
245018334Speterinstall-cross-rest: install-float-h-cross
245118334Speter
245250448Sobrien# Handle cpp installation.
245352298Sobrieninstall-cpp: xcpp$(exeext)
245452298Sobrien	-rm -f $(bindir)/$(CPP_INSTALL_NAME)$(exeext)
245552298Sobrien	$(INSTALL_PROGRAM) -m 755 xcpp$(exeext) $(bindir)/$(CPP_INSTALL_NAME)$(exeext)
245650448Sobrien	if [ x$(cpp_install_dir) != x ]; then \
245752298Sobrien	  rm -f $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
245852298Sobrien	  $(INSTALL_PROGRAM) -m 755 xcpp$(exeext) $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
245950448Sobrien	else true; fi
246050448Sobrien
246150448Sobrienuninstall-cpp:
246250448Sobrien	-rm -f $(bindir)/cpp
246350448Sobrien	-if [ x$(cpp_install_dir) != x ]; then \
246452298Sobrien	  rm -f $(prefix)/$(cpp_install_dir)/cpp; \
246550448Sobrien	else true; fi
246650448Sobrien
246718334Speter# Install float.h for cross compiler.
246818334Speter# Run this on the target machine!
246952298Sobrien# This is not used anymore now that float.h does not depend on enquire.
247050448Sobrieninstall-float-h-cross: installdirs
247118334Speter#	if [ -f enquire ] ; then true; else false; fi
247218334Speter# Note: don't use -.  We should fail right away if enquire was not made.
247318334Speter	./enquire -f > $(tmpdir)/float.h
247418334Speter	-rm -f $(libsubdir)/include/float.h
247518334Speter	$(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
247618334Speter	-rm -f $(tmpdir)/float.h
247718334Speter	chmod a-x $(libsubdir)/include/float.h
247818334Speter
247950448Sobrien# Create the installation directories.
248050448Sobrieninstalldirs:
248150448Sobrien	-if [ -d $(prefix) ] ; then true ; else mkdir $(prefix) ; chmod a+rx $(prefix) ; fi
248250448Sobrien	-if [ -d $(exec_prefix) ] ; then true ; else mkdir $(exec_prefix) ; chmod a+rx $(exec_prefix) ; fi
248318334Speter	-if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
248418334Speter	-if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi
248518334Speter# This dir isn't currently searched by cpp.
248618334Speter#	-if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
248750448Sobrien	-fdir= ; for dir in `echo $(libsubdir) | tr '/' ' '`; do \
248850448Sobrien	  fdir=$${fdir}/$${dir}; \
248950448Sobrien	  if [ -d $${fdir} ] ; then true ; else mkdir $${fdir}; chmod a+rx $${fdir}; fi ; \
249050448Sobrien	done
249118334Speter	-if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
249218334Speter	-if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
249352298Sobrien	-if [ -d $(gcc_tooldir) ] ; then true ; else mkdir $(gcc_tooldir) ; chmod a+rx $(gcc_tooldir) ; fi
249418334Speter	-if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
249518334Speter	-if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
249652298Sobrien# We don't use mkdir -p to create the parents of man1dir,
249718334Speter# because some systems don't support it.
249852298Sobrien# Instead, we use this technique to create the immediate parent of man1dir.
249952298Sobrien	-parent=`echo $(man1dir)|sed -e 's@/[^/]*$$@@'`; \
250018334Speter	if [ -d $$parent ] ; then true ; else mkdir $$parent ; chmod a+rx $$parent ; fi
250152298Sobrien	-if [ -d $(man1dir) ] ; then true ; else mkdir $(man1dir) ; chmod a+rx $(man1dir) ; fi
250218334Speter
250318334Speter# Install the compiler executables built during cross compilation.
250450448Sobrieninstall-common: native installdirs $(EXTRA_PARTS) lang.install-common
250518334Speter	for file in $(COMPILERS); do \
250618334Speter	  if [ -f $$file ] ; then \
250718334Speter	    rm -f $(libsubdir)/$$file; \
250818334Speter	    $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
250918334Speter	  else true; \
251018334Speter	  fi; \
251118334Speter	done
251218334Speter	for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
251318334Speter	  if [ x"$$file" != x.. ]; then \
251418334Speter	    rm -f $(libsubdir)/$$file; \
251518334Speter	    $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
251618334Speter	  else true; fi; \
251718334Speter	done
251818334Speter	for file in $(EXTRA_PARTS) ..; do \
251918334Speter	  if [ x"$$file" != x.. ]; then \
252018334Speter	    rm -f $(libsubdir)/$$file; \
252118334Speter	    $(INSTALL_DATA) $$file $(libsubdir)/$$file; \
252250448Sobrien	    chmod a-x $(libsubdir)/$$file; \
252318334Speter	  else true; fi; \
252418334Speter	done
252518334Speter# Don't mess with specs if it doesn't exist yet.
252618334Speter	-if [ -f specs ] ; then \
252718334Speter	  rm -f $(libsubdir)/specs; \
252818334Speter	  $(INSTALL_DATA) specs $(libsubdir)/specs; \
252950448Sobrien	  chmod a-x $(libsubdir)/specs; \
253018334Speter	fi
253118334Speter# Install protoize if it was compiled.
253218334Speter	-if [ -f protoize$(exeext) ]; \
253318334Speter	then \
253450448Sobrien	    if [ -f gcc-cross$(exeext) ] ; then \
253550448Sobrien		rm -f $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \
253650448Sobrien		$(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \
253750448Sobrien		rm -f $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \
253850448Sobrien		$(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \
253950448Sobrien	    else \
254050448Sobrien		rm -f $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \
254150448Sobrien		$(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \
254250448Sobrien		rm -f $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \
254350448Sobrien		$(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \
254450448Sobrien	    fi ; \
254518334Speter	    rm -f $(libsubdir)/SYSCALLS.c.X; \
254618334Speter	    $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
254718334Speter	    chmod a-x $(libsubdir)/SYSCALLS.c.X; \
254818334Speter	fi
254918334Speter	-rm -f $(libsubdir)/cpp$(exeext)
255018334Speter	$(INSTALL_PROGRAM) cpp$(exeext) $(libsubdir)/cpp$(exeext)
255150448Sobrien# Install gcov if it was compiled.
255250448Sobrien	-if [ -f gcov$(exeext) ]; \
255350448Sobrien	then \
255450448Sobrien	    rm -f $(bindir)/gcov$(exeext); \
255552298Sobrien	    $(INSTALL_PROGRAM) gcov$(exeext) $(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \
255650448Sobrien	fi
255718334Speter
255850448Sobrien# Install the driver program as $(target_alias)-gcc
255952298Sobrien# and also as either gcc (if native) or $(gcc_tooldir)/bin/gcc.
256050448Sobrieninstall-driver: xgcc$(exeext)
256118334Speter	-if [ -f gcc-cross$(exeext) ] ; then \
256218334Speter	  rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
256318334Speter	  $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
256452298Sobrien	  if [ -d $(gcc_tooldir)/bin/. ] ; then \
256552298Sobrien	    rm -f $(gcc_tooldir)/bin/gcc$(exeext); \
256652298Sobrien	    $(INSTALL_PROGRAM) gcc-cross$(exeext) $(gcc_tooldir)/bin/gcc$(exeext); \
256718334Speter	  else true; fi; \
256818334Speter	else \
256918334Speter	  rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
257018334Speter	  $(INSTALL_PROGRAM) xgcc$(exeext) $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
257150448Sobrien	  rm -f $(bindir)/$(target_alias)-gcc-1$(exeext); \
257250448Sobrien	  $(LN) $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext); \
257350448Sobrien	  mv $(bindir)/$(target_alias)-gcc-1$(exeext) $(bindir)/$(target_alias)-gcc$(exeext); \
257418334Speter	fi
257518334Speter
257618334Speter# Install the info files.
257750448Sobrien# $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
257850448Sobrien# to do the install.
257950448Sobrieninstall-info: doc installdirs lang.install-info
258018334Speter	-rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
258150448Sobrien	for f in cpp.info* gcc.info*; do \
258250448Sobrien	    $(INSTALL_DATA) $$f $(infodir)/$$f; \
258350448Sobrien	done
258450448Sobrien	-if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
258550448Sobrien	  if [ -f $(infodir)/dir ] ; then \
258650448Sobrien	    for f in cpp.info gcc.info; do \
258750448Sobrien		install-info --dir-file=$(infodir)/dir $(infodir)/$$f; \
258850448Sobrien	    done; \
258950448Sobrien	  else true; fi; \
259050448Sobrien	else true; fi;
259118334Speter	-chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
259218334Speter
259318334Speter# Install the man pages.
259450448Sobrieninstall-man: installdirs $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man
259550448Sobrien	-if [ -f gcc-cross$(exeext) ] ; then \
259652298Sobrien	  rm -f $(man1dir)/$(GCC_CROSS_NAME)$(manext); \
259752298Sobrien	  $(INSTALL_DATA) $(srcdir)/gcc.1 $(man1dir)/$(GCC_CROSS_NAME)$(manext); \
259852298Sobrien	  chmod a-x $(man1dir)/$(GCC_CROSS_NAME)$(manext); \
259918334Speter	else \
260052298Sobrien	  rm -f $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
260152298Sobrien	  $(INSTALL_DATA) $(srcdir)/gcc.1 $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
260252298Sobrien	  chmod a-x $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
260318334Speter	fi
260452298Sobrien	-rm -f $(man1dir)/cccp$(manext)
260552298Sobrien	-$(INSTALL_DATA) $(srcdir)/cccp.1 $(man1dir)/cccp$(manext)
260652298Sobrien	-chmod a-x $(man1dir)/cccp$(manext)
260718334Speter
260818334Speter# Install the library.
260950448Sobrieninstall-libgcc: libgcc.a installdirs
261018334Speter	-if [ -f libgcc.a ] ; then \
261118334Speter	  rm -f $(libsubdir)/libgcc.a; \
261218334Speter	  $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
261352298Sobrien	  if $(RANLIB_TEST_FOR_TARGET) ; then \
261452298Sobrien	    (cd $(libsubdir); $(RANLIB_FOR_TARGET) libgcc.a); else true; fi; \
261518334Speter	  chmod a-x $(libsubdir)/libgcc.a; \
261618334Speter	else true; fi
261718334Speter
261818334Speter# Install multiple versions of libgcc.a.
261950448Sobrieninstall-multilib: stmp-multilib installdirs
262018334Speter	for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
262118334Speter	  dir=`echo $$i | sed -e 's/;.*$$//'`; \
262218334Speter	  if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \
262350448Sobrien	  for f in libgcc.a $(EXTRA_MULTILIB_PARTS); do \
262450448Sobrien	    rm -f $(libsubdir)/$${dir}/$${f}; \
262550448Sobrien	    $(INSTALL_DATA) $${dir}/$${f} $(libsubdir)/$${dir}/$${f}; \
262650448Sobrien	  done; \
262752298Sobrien	  if $(RANLIB_TEST_FOR_TARGET); then \
262852298Sobrien	    (cd $(libsubdir)/$${dir}; $(RANLIB_FOR_TARGET) libgcc.a); \
262952298Sobrien	  else true; fi; \
263018334Speter	  chmod a-x $(libsubdir)/$${dir}/libgcc.a; \
263118334Speter	done
263218334Speter
263318334Speter# Install all the header files built in the include subdirectory.
263418334Speterinstall-headers: install-include-dir $(INSTALL_HEADERS_DIR) $(INSTALL_ASSERT_H)
263518334Speter# Fix symlinks to absolute paths in the installed include directory to
263618334Speter# point to the installed directory, not the build directory.
263750448Sobrien# Don't need to use LN_S here since we really do need ln -s and no substitutes.
263818334Speter	-files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
263918334Speter	if [ $$? -eq 0 ]; then \
264018334Speter	  dir=`cd include; pwd`; \
264118334Speter	  for i in $$files; do \
264218334Speter	    dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
264318334Speter	    if expr "$$dest" : "$$dir.*" > /dev/null; then \
264418334Speter	      rm -f $(libsubdir)/include/$$i; \
264518334Speter	      ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
264618334Speter	    fi; \
264718334Speter	  done; \
264818334Speter	fi
264918334Speter
265018334Speter# Create or recreate the gcc private include file directory.
265150448Sobrieninstall-include-dir: installdirs
265218334Speter	-rm -rf $(libsubdir)/include
265318334Speter	mkdir $(libsubdir)/include
265418334Speter	-chmod a+rx $(libsubdir)/include
265518334Speter
265618334Speter# Install the include directory using tar.
265718334Speterinstall-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
265852298Sobrien# We use `pwd`/include instead of just include to problems with CDPATH
265952298Sobrien# Unless a full pathname is provided, some shells would print the new CWD,
266052298Sobrien# found in CDPATH, corrupting the output.  We could just redirect the
266152298Sobrien# output of `cd', but some shells lose on redirection within `()'s
266252298Sobrien	(cd `pwd`/include ; \
266318334Speter	 tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
266418334Speter# /bin/sh on some systems returns the status of the first tar,
266518334Speter# and that can lose with GNU tar which always writes a full block.
266618334Speter# So use `exit 0' to ignore its exit status.
266718334Speter
266818334Speter# Install the include directory using cpio.
266918334Speterinstall-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
267052298Sobrien# See discussion about the use of `pwd` above
267152298Sobrien	cd `pwd`/include ; \
267252298Sobrien	find . -print | cpio -pdum $(libsubdir)/include
267318334Speter
267418334Speter# Put assert.h where it won't override GNU libc's assert.h.
267518334Speter# It goes in a dir that is searched after GNU libc's headers;
267618334Speter# thus, the following conditionals are no longer needed.
267718334Speter# But it's not worth deleting them now.
267818334Speter## Don't replace the assert.h already there if it is not from GCC.
267918334Speter## This code would be simpler if it tested for -f ... && ! grep ...
268018334Speter## but supposedly the ! operator is missing in sh on some systems.
268150448Sobrieninstall-assert-h: assert.h installdirs
268218334Speter	if [ -f $(assertdir)/assert.h ]; \
268318334Speter	then \
268418334Speter	  if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
268518334Speter	    then \
268618334Speter	    rm -f $(assertdir)/assert.h; \
268718334Speter	    $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
268818334Speter	    chmod a-x $(assertdir)/assert.h; \
268918334Speter	  else true; \
269018334Speter	  fi; \
269118334Speter	else \
269218334Speter	  rm -f $(assertdir)/assert.h; \
269318334Speter	  $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
269418334Speter	  chmod a-x $(assertdir)/assert.h; \
269518334Speter	fi
269618334Speter
269750448Sobrien# Use this target to install the program `collect2' under the name `collect2'.
269850448Sobrieninstall-collect2: collect2 installdirs
269950448Sobrien	$(INSTALL_PROGRAM) collect2$(exeext) $(libsubdir)/collect2$(exeext)
270018334Speter# Install the driver program as $(libsubdir)/gcc for collect2.
270118334Speter	$(INSTALL_PROGRAM) xgcc$(exeext) $(libsubdir)/gcc$(exeext)
270218334Speter
270318334Speter# Cancel installation by deleting the installed files.
270452298Sobrienuninstall: intl.uninstall lang.uninstall $(UNINSTALL_CPP)
270518334Speter	-rm -rf $(libsubdir)
270618334Speter	-rm -rf $(bindir)/$(GCC_INSTALL_NAME)$(exeext)
270718334Speter	-rm -rf $(bindir)/$(GCC_CROSS_NAME)$(exeext)
270852298Sobrien	-rm -rf $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext)
270952298Sobrien	-rm -rf $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext)
271052298Sobrien	-rm -rf $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext)
271152298Sobrien	-rm -rf $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext)
271252298Sobrien	-rm -rf $(bindir)/$(GCOV_INSTALL_NAME)$(exeext)
271352298Sobrien	-rm -rf $(man1dir)/$(GCC_INSTALL_NAME)$(manext)
271452298Sobrien	-rm -rf $(man1dir)/$(GCC_CROSS_NAME)$(manext)
271552298Sobrien	-rm -rf $(man1dir)/cccp$(manext)
271652298Sobrien	-rm -rf $(man1dir)/protoize$(manext)
271752298Sobrien	-rm -rf $(man1dir)/unprotoize$(manext)
271850448Sobrien	-rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
271950448Sobrien#
272050448Sobrien# These targets are for the dejagnu testsuites. The file site.exp 
272150448Sobrien# contains global variables that all the testsuites will use.
272250448Sobrien
272350448Sobrien# Set to $(target_alias)/ for cross.
272450448Sobrientarget_subdir = @target_subdir@
272550448Sobrien
272650448Sobriensite.exp: ./config.status Makefile
272750448Sobrien	@echo "Making a new config file..."
272850448Sobrien	-@rm -f ./tmp?
272950448Sobrien	@touch site.exp
273050448Sobrien	-@mv site.exp site.bak
273150448Sobrien	@echo "## these variables are automatically generated by make ##" > ./tmp0
273250448Sobrien	@echo "# Do not edit here. If you wish to override these values" >> ./tmp0
273350448Sobrien	@echo "# add them to the last section" >> ./tmp0
273450448Sobrien	@echo "set rootme \"`pwd`\"" >> ./tmp0
273550448Sobrien	@echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0
273650448Sobrien	@echo "set host_triplet $(host_canonical)" >> ./tmp0
273750448Sobrien	@echo "set build_triplet $(build_canonical)" >> ./tmp0
273850448Sobrien	@echo "set target_triplet $(target)" >> ./tmp0
273950448Sobrien	@echo "set target_alias $(target_alias)" >> ./tmp0
274050448Sobrien# CFLAGS is set even though it's empty to show we reserve the right to set it.
274150448Sobrien	@echo "set CFLAGS \"\"" >> ./tmp0
274250448Sobrien	@echo "set CXXFLAGS \"-I$(objdir)/../$(target_subdir)libio -I\$$srcdir/../libg++/src -I\$$srcdir/../libio -I\$$srcdir/../libstdc++ -I\$$srcdir/../libstdc++/stl -L$(objdir)/../$(target_subdir)libg++ -L$(objdir)/../$(target_subdir)libstdc++\"" >> ./tmp0
274350448Sobrien# If newlib has been configured, we need to pass -B to gcc so it can find
274450448Sobrien# newlib's crt0.o if it exists.  This will cause a "path prefix not used"
274550448Sobrien# message if it doesn't, but the testsuite is supposed to ignore the message -
274650448Sobrien# it's too difficult to tell when to and when not to pass -B (not all targets
274750448Sobrien# have crt0's).  We could only add the -B if ../newlib/crt0.o exists, but that
274850448Sobrien# seems like too selective a test.
274950448Sobrien# ??? Another way to solve this might be to rely on linker scripts.  Then
275050448Sobrien# theoretically the -B won't be needed.
275150448Sobrien# We also need to pass -L ../ld so that the linker can find ldscripts.
275250448Sobrien	@if [ -d $(objdir)/../$(target_subdir)newlib ] ; then \
275350448Sobrien	  echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \
275450448Sobrien	  echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)newlib/\"" >> ./tmp0; \
275550448Sobrien	  echo "append CFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
275650448Sobrien	  echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
275750448Sobrien	  echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./tmp0; \
275850448Sobrien	else true; \
275950448Sobrien	fi
276050448Sobrien	@if [ -d $(objdir)/../ld ] ; then \
276150448Sobrien	  echo "append LDFLAGS \" -L$(objdir)/../ld\"" >> ./tmp0; \
276250448Sobrien	else true; \
276350448Sobrien	fi
276450448Sobrien	echo "set tmpdir $(objdir)/testsuite" >> ./tmp0
276550448Sobrien	@echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0
276650448Sobrien	@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
276750448Sobrien	@cat ./tmp0 > site.exp
276850448Sobrien	@cat site.bak | sed \
276950448Sobrien		-e '1,/^## All variables above are.*##/ d' >> site.exp
277050448Sobrien	-@rm -f ./tmp?
277150448Sobrien
277252298SobrienCHECK_TARGETS = check-gcc check-g++ check-g77 check-objc
277350448Sobrien
277450448Sobriencheck: $(CHECK_TARGETS)
277550448Sobrien
277650448Sobrientestsuite/site.exp: site.exp
277750448Sobrien	if [ -d testsuite ]; then \
277850448Sobrien	  true; \
277950448Sobrien	else \
278050448Sobrien	  mkdir testsuite; \
278150448Sobrien	fi
278250448Sobrien	rm -rf testsuite/site.exp
278350448Sobrien	cp site.exp testsuite/site.exp
278450448Sobrien
278550448Sobriencheck-g++: testsuite/site.exp
278650448Sobrien	-rootme=`pwd`; export rootme; \
278750448Sobrien	srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
278850448Sobrien	cd testsuite; \
278950448Sobrien	EXPECT=${EXPECT} ; export EXPECT ; \
279050448Sobrien	if [ -f $${rootme}/../expect/expect ] ; then  \
279152298Sobrien	   TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; pwd` ; \
279250448Sobrien	    export TCL_LIBRARY ; fi ; \
279350448Sobrien	$(RUNTEST) --tool g++ $(RUNTESTFLAGS)
279450448Sobrien
279550448Sobriencheck-gcc: testsuite/site.exp
279650448Sobrien	-rootme=`pwd`; export rootme; \
279750448Sobrien	srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
279850448Sobrien	cd testsuite; \
279950448Sobrien	EXPECT=${EXPECT} ; export EXPECT ; \
280050448Sobrien	if [ -f $${rootme}/../expect/expect ] ; then  \
280152298Sobrien	   TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; pwd` ; \
280250448Sobrien	   export TCL_LIBRARY ; fi ; \
280350448Sobrien	$(RUNTEST) --tool gcc $(RUNTESTFLAGS)
280450448Sobrien
280550448Sobriencheck-g77: testsuite/site.exp
280650448Sobrien	-rootme=`pwd`; export rootme; \
280750448Sobrien	srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
280850448Sobrien	cd testsuite; \
280950448Sobrien	EXPECT=${EXPECT} ; export EXPECT ; \
281050448Sobrien	if [ -f $${rootme}/../expect/expect ] ; then  \
281152298Sobrien	   TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; pwd` ; \
281250448Sobrien	   export TCL_LIBRARY ; fi ; \
281350448Sobrien	$(RUNTEST) --tool g77 $(RUNTESTFLAGS)
281450448Sobrien
281552298Sobriencheck-objc: testsuite/site.exp
281652298Sobrien	-rootme=`pwd`; export rootme; \
281752298Sobrien	srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
281852298Sobrien	cd testsuite; \
281952298Sobrien	EXPECT=${EXPECT} ; export EXPECT ; \
282052298Sobrien	if [ -f $${rootme}/../expect/expect ] ; then  \
282152298Sobrien	   TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; pwd` ; \
282252298Sobrien	    export TCL_LIBRARY ; fi ; \
282352298Sobrien	$(RUNTEST) --tool objc $(RUNTESTFLAGS)
282452298Sobrien
282518334Speter# These exist for maintenance purposes.
282618334Speter
282718334Speter# Update the tags table.
282818334SpeterTAGS: force
282918334Speter	cd $(srcdir);							\
283050448Sobrien	mkdir tmp-tags;							\
283150448Sobrien	mv -f c-parse.[ch] cexp.c =*.[chy] tmp-tags;			\
283218334Speter	etags *.y *.h *.c;						\
283350448Sobrien	mv tmp-tags/* .;						\
283450448Sobrien	rmdir tmp-tags
283518334Speter
283650448Sobrien# Create the distribution tar.gz file.
283750448Sobriendist: tmp-gcc.xtar
283850448Sobrien	gzip --best < tmp-gcc.xtar > tmp-gcc.xtar.gz
283950448Sobrien	mv tmp-gcc.xtar.gz gcc-$(version).tar.gz
284018334Speter
284150448Sobrientmp-gcc.xtar: distdir
284250448Sobrien# Make the distribution.
284350448Sobrien	tar -chf tmp-gcc.xtar gcc-$(version)
284418334Speter
284550448Sobriendistdir-cvs: force
284652298Sobrien	if [ -d $(srcdir)/CVS ]; then cd $(srcdir) && cvs -r update; fi
284718334Speter
284818334Speter# This target exists to do the initial work before the language specific
284918334Speter# stuff gets done.
285018334Speterdistdir-start: doc $(srcdir)/INSTALL $(srcdir)/c-parse.y $(srcdir)/c-gperf.h \
285150448Sobrien  $(srcdir)/c-parse.c $(srcdir)/cexp.c $(srcdir)/config.in \
285250448Sobrien  $(srcdir)/version.c TAGS
285352298Sobrien	@case '$(USE_NLS)' in \
285452298Sobrien	yes) ;; \
285552298Sobrien	*) echo "configure with --enable-nls before making a distribution"; \
285652298Sobrien	   exit 1;; \
285752298Sobrien	esac
285818334Speter	@if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \
285918334Speter	then true; \
286018334Speter	else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
286118334Speter	fi
286218334Speter# Update the version number in README
286352298Sobrien	$(AWK) '$$1 " " $$2 " " $$3 == "This directory contains" \
286418334Speter		{ $$6 = version; print $$0 } \
286518334Speter	     $$1 " " $$2 " " $$3 != "This directory contains"' \
286652298Sobrien	  version=$(version) $(srcdir)/README > tmp.README
286718334Speter	mv tmp.README README
286818334Speter	-rm -rf gcc-$(version) tmp	
286918334Speter# Put all the files in a temporary subdirectory
287018334Speter# which has the name that we want to have in the tar file.
287118334Speter	mkdir tmp
287218334Speter	mkdir tmp/config
287318334Speter	mkdir tmp/ginclude
287452298Sobrien	mkdir tmp/objc
287552298Sobrien	mkdir tmp/intl
287652298Sobrien	mkdir tmp/po
287752298Sobrien	for file in `(cd $(srcdir) && echo *[0-9a-zA-Z+])`; do \
287852298Sobrien	  test -f $(srcdir)/$$file && $(LN_S) $(srcdir)/$$file tmp; \
287918334Speter	done
288052298Sobrien	if test "$(srcdir)" != "." ; then \
288152298Sobrien	  for file in c-parse.c cexp.c ; do \
288252298Sobrien	    test -f ./$$file && $(LN_S) ../$$file tmp; \
288352298Sobrien	  done; \
288452298Sobrien	fi
288552298Sobrien	for file in `(cd $(srcdir)/config && echo *[0-9a-zA-Z+])`; do \
288652298Sobrien	  if test -d $(srcdir)/config/$$file \
288752298Sobrien	      && test "$$file" != RCS && test "$$file" != CVS; then \
288852298Sobrien	    mkdir tmp/config/$$file; \
288952298Sobrien	    for subfile in `(cd $(srcdir)/config/$$file && echo *[0-9a-zA-Z+])`; do \
289052298Sobrien	      $(LN_S) $(srcdir)/config/$$file/$$subfile tmp/config/$$file; \
289118334Speter	    done; \
289218334Speter	  else \
289352298Sobrien	    $(LN_S) $(srcdir)/config/$$file tmp/config; \
289418334Speter	  fi; \
289518334Speter	done
289652298Sobrien	for file in `(cd $(srcdir)/ginclude && echo *[0-9a-zA-Z+])`; do \
289752298Sobrien	  $(LN_S) $(srcdir)/ginclude/$$file tmp/ginclude; \
289818334Speter	done
289952298Sobrien	for file in `(cd $(srcdir)/objc && echo *[0-9a-zA-Z+])`; do \
290052298Sobrien	  $(LN_S) $(srcdir)/objc/$$file tmp/objc; \
290118334Speter	done
290252298Sobrien	$(LN_S) .gdbinit tmp
290318334Speter
290418334Speter# Finish making `distdir', after the languages have done their thing.
290518334Speterdistdir-finish:
290618334Speter	mv tmp gcc-$(version)
290718334Speter# Get rid of everything we don't want in the distribution.  We'd want
290818334Speter# this to use Makefile.in, but it doesn't have the `lang.foo' targets
290918334Speter# expanded.
291052298Sobrien	cd gcc-$(version); make extraclean distdir-check VERSION_DEP=
291118334Speter
291252298Sobriendistdir-check:
291352298Sobrien	($(AWK) '/^[^#]/{print} /^#[A-Za-z]/{print substr($$1, 2)}' | sort) \
291452298Sobrien	  < po/POTFILES.in > tmp.POTFILES
291552298Sobrien	ls [A-Za-z]*.[ch] [a-z]*/[A-Za-z]*.[ch] \
291652298Sobrien	  [a-z]*/[a-z]*/[A-Za-z]*.[ch] | sort > tmp.src
291752298Sobrien	diff tmp.POTFILES tmp.src || { \
291852298Sobrien	  echo "po/POTFILES.in and sources do not match -- please fix"; \
291952298Sobrien	  exit 1; \
292052298Sobrien	}
292152298Sobrien	rm -f tmp.*
292218334Speter
292352298Sobriendistdir: distdir-cvs distdir-start intl.distdir intl.distdir-fixup \
292452298Sobrien  lang.distdir distdir-finish
292552298Sobrien
292618334Speter# make diff oldversion=M.N 
292718334Speter# creates a diff file between an older distribution and this one.
292818334Speter# The -P option assumes this is GNU diff.
292918334Speterdiff:
293018334Speter	diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \
293150448Sobrien	  -x cexp.c -x -x TAGS -x INSTALL \
293250448Sobrien	  -x configure -x config.in \
293318334Speter	  -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \
293418334Speter	  -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \
293518334Speter	  $(LANG_DIFF_EXCLUDES) \
293650448Sobrien	  gcc-$(oldversion) gcc-$(version) > gcc-$(oldversion)-$(version).diff
293718334Speter
293850448Sobrienbootstrap bootstrap-lean: force
293918334Speter# Only build the C compiler for stage1, because that is the only one that
294018334Speter# we can guarantee will build with the native compiler, and also it is the
294118334Speter# only thing useful for building stage2.
294250448Sobrien	$(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
294318334Speter	$(MAKE) stage1
294418334Speter# This used to define ALLOCA as empty, but that would lead to bad results
294518334Speter# for a subsequent `make install' since that would not have ALLOCA empty.
294618334Speter# To prevent `make install' from compiling alloca.o and then relinking cc1
294718334Speter# because alloca.o is newer, we permit these recursive makes to compile
294818334Speter# alloca.o.  Then cc1 is newer, so it won't have to be relinked.
294952298Sobrien	$(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
295018334Speter	$(MAKE) stage2
295150448Sobrien	-if test $@ = bootstrap-lean; then rm -rf stage1; else true; fi
295252298Sobrien	$(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
295318334Speter
295450448Sobrienbootstrap2 bootstrap2-lean: force
295552298Sobrien	$(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
295618334Speter	$(MAKE) stage2
295750448Sobrien	-if test $@ = bootstrap2-lean; then rm -rf stage1; else true; fi
295852298Sobrien	$(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
295918334Speter
296050448Sobrienbootstrap3 bootstrap3-lean: force
296152298Sobrien	$(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
296218334Speter
296350448Sobrienbootstrap4 bootstrap4-lean: force
296452298Sobrien	$(MAKE) CC="stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage3/ LANGUAGES="$(LANGUAGES)"
296550448Sobrien
296618334Speter# Compare the object files in the current directory with those in the
296718334Speter# stage2 directory.
296818334Speter
296918334Speter# ./ avoids bug in some versions of tail.
297050448Sobriencompare compare3 compare4 compare-lean compare3-lean compare4-lean: force
297150448Sobrien	-rm -f .bad_compare
297250448Sobrien	case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
297318334Speter	for file in *$(objext); do \
297418334Speter	  tail +16c ./$$file > tmp-foo1; \
297550448Sobrien	  tail +16c stage$$stage/$$file > tmp-foo2 \
297650448Sobrien	    && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
297718334Speter	done
297850448Sobrien	case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
297952298Sobrien	for dir in tmp-foo intl $(SUBDIRS); do \
298018334Speter	  if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
298118334Speter	    for file in $$dir/*$(objext); do \
298252298Sobrien	      tail +16c ./$$file > tmp-foo1; \
298352298Sobrien	      tail +16c stage$$stage/$$file > tmp-foo2 \
298452298Sobrien	        && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
298518334Speter	    done; \
298652298Sobrien	  else true; fi; \
298718334Speter	done
298818334Speter	-rm -f tmp-foo*
298950448Sobrien	case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
299050448Sobrien	if [ -f .bad_compare ]; then \
299150448Sobrien	  echo "Bootstrap comparison failure!"; \
299250448Sobrien	  cat .bad_compare; \
299350448Sobrien	  exit 1; \
299450448Sobrien	else \
299550448Sobrien	  case "$@" in \
299650448Sobrien	    *-lean ) rm -rf stage$$stage ;; \
299750448Sobrien	    *) ;; \
299850448Sobrien	  esac; true; \
299950448Sobrien	fi
300018334Speter
300118334Speter# Compare the object files in the current directory with those in the
300218334Speter# stage2 directory.  Use gnu cmp (diffutils v2.4 or later) to avoid
300318334Speter# running tail and the overhead of twice copying each object file.
300418334Speter
300550448Sobriengnucompare gnucompare3 gnucompare4 gnucompare-lean gnucompare3-lean gnucompare4-lean: force
300650448Sobrien	-rm -f .bad_compare
300750448Sobrien	case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
300818334Speter	for file in *$(objext); do \
300950448Sobrien	  (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
301018334Speter	done
301150448Sobrien	case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
301252298Sobrien	for dir in tmp-foo intl $(SUBDIRS); do \
301318334Speter	  if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
301418334Speter	    for file in $$dir/*$(objext); do \
301552298Sobrien	      (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
301618334Speter	    done; \
301752298Sobrien	  else true; fi; \
301818334Speter	done
301950448Sobrien	case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
302050448Sobrien	if [ -f .bad_compare ]; then \
302150448Sobrien	  echo "Bootstrap comparison failure!"; \
302250448Sobrien	  cat .bad_compare; \
302350448Sobrien	  exit 1; \
302450448Sobrien	else \
302550448Sobrien	  case "$@" in \
302650448Sobrien	    *-lean ) rm -rf stage$$stage ;; \
302750448Sobrien	  esac; true; \
302850448Sobrien	fi
302918334Speter
303018334Speter# Copy the object files from a particular stage into a subdirectory.
303118334Speterstage1-start:
303218334Speter	-if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
303352298Sobrien	-for dir in intl $(SUBDIRS) ; \
303418334Speter	 do \
303518334Speter	   if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \
303618334Speter	 done
303718334Speter	-mv $(STAGESTUFF) stage1
303852298Sobrien	-mv intl/*$(objext) stage1/intl
303918334Speter# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
304018334Speter# dir will work properly.
304150448Sobrien	-if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage1 ; else true ; fi
304250448Sobrien	-if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage1 ; else true ; fi
304350448Sobrien	-if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage1 ; else true ; fi
304418334Speter	-rm -f stage1/libgcc.a
304518334Speter	-cp libgcc.a stage1
304652298Sobrien	-if $(RANLIB_TEST_FOR_TARGET) ; then \
304752298Sobrien	  $(RANLIB_FOR_TARGET) stage1/libgcc.a; \
304852298Sobrien	else true; fi
304950448Sobrien	-for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
305050448Sobrien	  cp stage1/$${f} . ; \
305150448Sobrien	else true; \
305250448Sobrien	fi; done
305318334Speterstage1: force stage1-start lang.stage1
305418334Speter
305518334Speterstage2-start:
305618334Speter	-if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
305752298Sobrien	-for dir in intl $(SUBDIRS) ; \
305818334Speter	 do \
305918334Speter	   if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \
306018334Speter	 done
306118334Speter	-mv $(STAGESTUFF) stage2
306252298Sobrien	-mv intl/*$(objext) stage2/intl
306318334Speter# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
306418334Speter# dir will work properly.
306550448Sobrien	-if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage2 ; else true ; fi
306650448Sobrien	-if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage2 ; else true ; fi
306750448Sobrien	-if [ -f collect-ld ] ; then $(LN_S) ../collect-ld$(exeext) stage2 ; else true ; fi
306818334Speter	-rm -f stage2/libgcc.a
306918334Speter	-cp libgcc.a stage2
307052298Sobrien	-if $(RANLIB_TEST_FOR_TARGET) ; then \
307152298Sobrien	  $(RANLIB_FOR_TARGET) stage2/libgcc.a; \
307252298Sobrien	else true; fi
307350448Sobrien	-for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
307450448Sobrien	  cp stage2/$${f} . ; \
307550448Sobrien	else true; \
307650448Sobrien	fi; done
307718334Speterstage2: force stage2-start lang.stage2
307818334Speter
307918334Speterstage3-start:
308018334Speter	-if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
308152298Sobrien	-for dir in intl $(SUBDIRS) ; \
308218334Speter	 do \
308318334Speter	   if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \
308418334Speter	 done
308518334Speter	-mv $(STAGESTUFF) stage3
308652298Sobrien	-mv intl/*$(objext) stage3/intl
308718334Speter# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
308818334Speter# dir will work properly.
308950448Sobrien	-if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage3 ; else true ; fi
309050448Sobrien	-if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage3 ; else true ; fi
309150448Sobrien	-if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage3 ; else true ; fi
309218334Speter	-rm -f stage3/libgcc.a
309318334Speter	-cp libgcc.a stage3
309452298Sobrien	-if $(RANLIB_TEST_FOR_TARGET) ; then \
309552298Sobrien	  $(RANLIB_FOR_TARGET) stage3/libgcc.a; \
309652298Sobrien	else true; fi
309750448Sobrien	-for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
309850448Sobrien	  cp stage3/$${f} . ; \
309950448Sobrien	else true; \
310050448Sobrien	fi; done
310118334Speterstage3: force stage3-start lang.stage3
310218334Speter
310318334Speterstage4-start:
310418334Speter	-if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
310552298Sobrien	-for dir in intl $(SUBDIRS) ; \
310618334Speter	 do \
310718334Speter	   if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \
310818334Speter	 done
310918334Speter	-mv $(STAGESTUFF) stage4
311052298Sobrien	-mv intl/*$(objext) stage4/intl
311118334Speter# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
311218334Speter# dir will work properly.
311350448Sobrien	-if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage4 ; else true ; fi
311450448Sobrien	-if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage4 ; else true ; fi
311550448Sobrien	-if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage4 ; else true ; fi
311618334Speter	-rm -f stage4/libgcc.a
311718334Speter	-cp libgcc.a stage4
311852298Sobrien	-if $(RANLIB_TEST_FOR_TARGET) ; then \
311952298Sobrien	  $(RANLIB_FOR_TARGET) stage4/libgcc.a; \
312052298Sobrien	else true; fi
312150448Sobrien	-for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
312250448Sobrien	  cp stage4/$${f} . ; \
312350448Sobrien	else true; \
312450448Sobrien	fi; done
312518334Speterstage4: force stage4-start lang.stage4
312618334Speter
312718334Speter# Copy just the executable files from a particular stage into a subdirectory,
312818334Speter# and delete the object files.  Use this if you're just verifying a version
312918334Speter# that is pretty sure to work, and you are short of disk space.
313018334Speterrisky-stage1: stage1
313150448Sobrien	-make clean
313218334Speter
313318334Speterrisky-stage2: stage2
313418334Speter	-make clean
313518334Speter
313618334Speterrisky-stage3: stage3
313718334Speter	-make clean
313818334Speter
313918334Speterrisky-stage4: stage4
314018334Speter	-make clean
314118334Speter
314218334Speter#In GNU Make, ignore whether `stage*' exists.
314318334Speter.PHONY: stage1 stage2 stage3 stage4 clean maintainer-clean TAGS bootstrap
314418334Speter.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
314518334Speter
314618334Speterforce:
314750448Sobrien
314850448Sobrien# ---
314950448Sobrien# The enquire rules are still useful for building new float-anything.h.
315050448Sobrien# Special flags for compiling enquire.
315150448Sobrien# We disable optimization to make floating point more reliable.
315250448SobrienENQUIRE_CFLAGS = -DNO_MEM -DNO_LONG_DOUBLE_IO -O0
315350448SobrienENQUIRE_LDFLAGS = $(LDFLAGS)
315450448Sobrien
315550448Sobrien# Enquire target (This is a variable so that a target can choose not to
315650448Sobrien# build it.)
315750448SobrienENQUIRE = enquire
315850448Sobrien
315950448Sobrien# Test to see whether <float.h> exists in the system header files,
316050448Sobrien# and is not derived from GCC.
316150448SobrienFLOAT_H_TEST = \
316250448Sobrien  [ -f $(SYSTEM_HEADER_DIR)/float.h ] && \
316350448Sobrien  if grep 'ifndef _FLOAT_H___' $(SYSTEM_HEADER_DIR)/float.h >/dev/null; \
316450448Sobrien  then false; \
316550448Sobrien  else :; fi
316650448Sobrien# We pretend to not having a usable <float.h>, hence disable the FLOAT_H_TEST
316750448Sobrien# to ensure, we're emitting a full blown <float.h> ourselves.
316850448SobrienFLOAT_H_TEST = false
316950448Sobrien
317050448Sobrien# Used to compile enquire with standard cc, but have forgotten why.
317150448Sobrien# Let's try with GCC.
317250448Sobrienenquire: enquire.o $(GCC_PARTS)
317350448Sobrien	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o $@
317450448Sobrienenquire.o: $(srcdir)/enquire.c $(GCC_PASSES) stmp-int-hdrs
317550448Sobrien	if $(FLOAT_H_TEST); then \
317650448Sobrien	  rm -f include/float.h; \
317750448Sobrien	  SYS_FLOAT_H_WRAP=1; \
317850448Sobrien	else :; \
317950448Sobrien	  SYS_FLOAT_H_WRAP=0; \
318050448Sobrien	fi; \
318150448Sobrien	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) \
318250448Sobrien	  -DSYS_FLOAT_H_WRAP=$$SYS_FLOAT_H_WRAP \
318350448Sobrien	  -I. -c $(srcdir)/enquire.c
318450448Sobrien
318550448Sobrien# Create float.h source for the native machine.
318650448Sobrien# Make it empty if we can use the system float.h without changes.
318750448Sobrienfloat.h-nat: enquire
318850448Sobrien	-./enquire -f > tmp-float.h
318950448Sobrien	grep '#define [^_]' tmp-float.h >/dev/null || true > tmp-float.h
319050448Sobrien	mv tmp-float.h float.h-nat
319150448Sobrien
319250448Sobrien# Create a dummy float.h source for a cross-compiler.
319350448Sobrien# ??? This isn't used anymore.  Should we create config/float-unkn.h
319450448Sobrien# and make that the default float_format in configure?
319550448Sobrienfloat.h-cross:
319650448Sobrien	echo "#ifndef	__GCC_FLOAT_NOT_NEEDED" > t-float.h-cross
319750448Sobrien	echo "#error float.h values not known for cross-compiler" >> t-float.h-cross
319850448Sobrien	echo "#endif" >> t-float.h-cross
319950448Sobrien	mv t-float.h-cross float.h-cross
320050448Sobrien
3201