OSDN Git Service

Use CROSS_LIBGCC1 for a cross-compiler
[pf3gnuchains/gcc-fork.git] / gcc / Makefile.in
index 2ec478a..46d777b 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for GNU C compiler.
-#   Copyright (C) 1987, 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
+#   Copyright (C) 1987, 88, 90, 91, 92, 1993 Free Software Foundation, Inc.
 
 #This file is part of GNU CC.
 
@@ -52,7 +52,7 @@ T_CPPFLAGS =
 
 CC = cc
 BISON = bison
-BISONFLAGS = -v
+BISONFLAGS =
 AR = ar
 OLDAR_FLAGS = qc
 AR_FLAGS = rc
@@ -64,6 +64,7 @@ INSTALL_PROGRAM = $(INSTALL)
 INSTALL_DATA = $(INSTALL)
 SYMLINK = ln -s
 MAKEINFO = makeinfo
+TEXI2DVI = texi2dvi
 
 # Define this as & to perform parallel make on a Sequent.
 # Note that this has some bugs, and it seems currently necessary 
@@ -120,6 +121,9 @@ RANLIB_TEST_FOR_TARGET = [ -f $(TARGET_TOOLPREFIX)ranlib ]
 # Dir to search for system headers.  Overridden by cross-make.
 SYSTEM_HEADER_DIR = /usr/include
 
+# Uncomment following line for fixproto support.  (May become the default!)
+# STMP_FIXPROTO = stmp-fixproto
+
 # There may be a premade insn-attrtab.c for this machine.
 # (You could rebuild it with genattrtab as usual, but it takes a long time.)
 # PREMADE_ATTRTAB is the file name of the file to use.
@@ -140,7 +144,8 @@ prefix = /usr/local
 # Directory in which to put localized header files. On the systems with
 # gcc as the native cc, `local_prefix' may not be `prefix' which is
 # `/usr'.
-local_prefix = $(prefix)
+# NOTE: local_prefix *should not* default from prefix.
+local_prefix = /usr/local
 # Directory in which to put host dependent programs and libraries
 exec_prefix = $(prefix)
 # Directory in which to put the executable for the command `gcc'
@@ -149,17 +154,20 @@ bindir = $(exec_prefix)/bin
 libdir = $(exec_prefix)/lib
 # Directory in which the compiler finds executables, libraries, etc.
 libsubdir = $(libdir)/gcc-lib/$(target)/$(version)
-# Directory for header file assert.h.
+# Directory to search for site-specific includes.
 includedir = $(local_prefix)/include
 # assertdir is overridden in cross-make.
-assertdir = $(includedir)
+# (But this currently agrees with what is in cross-make.)
+assertdir = $(tooldir)/include
+# where the info files go
+infodir = $(prefix)/info
 # Extension (if any) to put in installed man-page filename.
 manext = .1
 # Directory in which to put man pages.
 mandir = $(prefix)/man/man1
 # Directory in which to find other cross-compilation tools and headers.
 # Used in install-cross.
-tooldir = $(prefix)/$(target)
+tooldir = $(exec_prefix)/$(target)
 # Dir for temp files.
 tmpdir = /tmp
 
@@ -170,11 +178,20 @@ CLIB=
 # system library.
 OBSTACK=obstack.o
 
+# Specify the rule for actually making libgcc.a,
+LIBGCC = libgcc.a
+# and the rule for installing it.
+INSTALL_LIBGCC = install-libgcc
+
 # Specify the rule for actually making libgcc1.a.
 # The value may be empty; that means to do absolutely nothing
 # with or for libgcc1.a.
 LIBGCC1 = libgcc1.a
 
+# Specify the rule for making libgcc1.a for a cross-compiler.
+# The default rule assumes that libgcc1.a is supplied by the user.
+CROSS_LIBGCC1 = libgcc1.cross
+
 # Specify the rule for actually making libgcc2.a.
 LIBGCC2 = libgcc2.a
 
@@ -182,7 +199,15 @@ LIBGCC2 = libgcc2.a
 # -g1 causes output of debug info only for file-scope entities.
 # we use this here because that should be enough, and also
 # so that -g1 will be tested.
-LIBGCC2_CFLAGS = -O2 $(GCC_CFLAGS) -g1
+LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) -g1
+
+# Additional options to use when compiling libgcc2.a.
+# Some targets override this to -Iinclude
+LIBGCC2_INCLUDES =
+
+# Things which must be built before building libgcc2.a.
+# Some targets override this to stmp-int-hdrs
+LIBGCC2_DEPS =
 
 # List of extra executables that should be compiled for this target machine
 # that are used for compiling from source code to object code.
@@ -226,11 +251,18 @@ LIBCONVERT =
 # Control whether header files are installed.
 INSTALL_HEADERS=install-headers
 
+# Options for tar when copying trees.  So HPUX can override it.
+TAROUTOPTS = xpBf
+
 # Select which version of fixincludes to use (I.E. regular versus SVR4)
 # This value is overridden directly by configure.
 FIXINCLUDES=fixincludes
 
 # Additional directories of header files to run fixincludes on.
+# These should be directories searched automatically by default
+# just as /usr/include is.
+# *Do not* use this for directories that happen to contain 
+# header files, but are not searched automatically by default.
 # On most systems, this is empty.
 OTHER_FIXINCLUDES_DIRS=
 
@@ -240,7 +272,7 @@ GCC_PASSES=xgcc cc1 cpp $(EXTRA_PASSES)
 
 # List of things which should already be built whenever we try to use xgcc
 # to link anything.
-GCC_PARTS=$(GCC_PASSES) libgcc.a $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
+GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
 
 # Directory to link to, when using the target `maketest'.
 DIR = ../gcc
@@ -355,7 +387,7 @@ COMPILERS = cc1 cc1plus cc1obj
 C_OBJS = c-parse.o c-lang.o c-lex.o c-pragma.o \
    c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-iterate.o
 
-# Language-specific object files for Objectionable C.
+# Language-specific object files for Objective C.
 OBJC_OBJS = objc-parse.o objc-act.o c-lex.o c-pragma.o \
    c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-iterate.o
 
@@ -392,7 +424,7 @@ STAGESTUFF = *.o insn-flags.h insn-config.h insn-codes.h \
  stamp-attr stamp-attrtab stamp-opinit stamp-proto \
  genemit genoutput genrecog genextract genflags gencodes genconfig genpeep \
  genattrtab genattr genopinit \
- $(GCC_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross cccp \
+ $(GCC_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross cccp g++ g++-cross \
  cc1plus cc1obj enquire protoize unprotoize specs collect2 $(USE_COLLECT2)
 
 # Members of libgcc1.a.
@@ -415,7 +447,7 @@ LIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
 
 # Header files that are made available under the same name
 # to programs compiled with GCC.
-USER_H = va-alpha.h va-i860.h va-i960.h va-mips.h va-m88k.h \
+USER_H = va-alpha.h va-h8300.h va-i860.h va-i960.h va-mips.h va-m88k.h \
     va-pa.h va-pyr.h va-sparc.h va-clipper.h va-spur.h proto.h $(EXTRA_HEADERS)
 
 # The files that "belong" in CONFIG_H are deliberately omitted
@@ -441,15 +473,15 @@ all.internal: start.encap rest.encap
 # This is what to compile if making a cross-compiler.
 # Note that we can compile enquire using the cross-compiler just build,
 # although we can't run it on this machine.
-all.cross: native gcc-cross specs libgcc.a stmp-headers cross-test enquire $(EXTRA_PARTS)
+all.cross: native gcc-cross g++-cross specs $(LIBGCC) stmp-headers $(STMP_FIXPROTO) cross-test enquire $(EXTRA_PARTS)
 # This is what to compile if making gcc with a cross-compiler.
-all.build: native xgcc $(EXTRA_PARTS)
+all.build: native xgcc g++ $(EXTRA_PARTS)
 # This is what must be made before installing GCC and converting libraries.
-start.encap: native xgcc specs $(LIBGCC1) xlimits.h
+start.encap: native xgcc g++ specs $(LIBGCC1) xlimits.h
 # Use this to make a GCC that will be used only to recompile GCC.
-for-bootstrap: start.encap libgcc.a
+for-bootstrap: start.encap $(LIBGCC)
 # These can't be made, with COFF encapsulation, until after GCC can run.
-rest.encap: libgcc.a stmp-headers $(EXTRA_PARTS)
+rest.encap: $(LIBGCC) stmp-headers $(STMP_FIXPROTO) $(EXTRA_PARTS)
 # This is what is made with the host's compiler
 # whether making a cross compiler or not.
 native: config.status cpp $(LANGUAGES) $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
@@ -457,8 +489,9 @@ native: config.status cpp $(LANGUAGES) $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_C
 # Define the names for selecting languages in LANGUAGES.
 C c: cc1
 C++ c++: cc1plus
-OBJC objc: cc1obj objc-runtime
-OBJECTIVE-C objective-c: cc1obj objc-runtime
+# The next two ought to depend on objc-runtime, but that doesn't work yet.
+OBJC objc: cc1obj
+OBJECTIVE-C objective-c: cc1obj
 PROTO: proto
 
 # Really, really stupid make features, such as SUN's KEEP_STATE, may force
@@ -474,11 +507,11 @@ config.status:
 
 # On the target machine, finish building a cross compiler.
 # This does the things that can't be done on the host machine.
-rest.cross: libgcc.a gfloat.h specs
+rest.cross: $(LIBGCC) gfloat.h specs
 
 # Verify that it works to compile and link cross-test.
 # If it does, then there are sufficient replacements for libgcc1.a.
-cross-test: cross-test.o native gcc-cross libgcc.a $(GCC_PARTS)
+cross-test: cross-test.o native gcc-cross $(LIBGCC) $(GCC_PARTS)
        $(GCC_FOR_TARGET) $(GCC_CFLAGS) cross-test.o -o $@
 cross-test.o: cross-test.c native gcc-cross
        $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/cross-test.c
@@ -497,12 +530,21 @@ xgcc: gcc.o version.o $(LIBDEPS)
 specs: xgcc
        $(GCC_FOR_TARGET) -dumpspecs > specs
 
+# Create the compiler driver for g++.
+g++: g++.o $(LIBDEPS)
+       $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o g++ g++.o $(LIBS)
+
 # We do want to create an executable named `xgcc', so we can use it to
 # compile libgcc2.a.
 # Also create gcc-cross, so that install-common will install properly.
 gcc-cross: xgcc
        cp xgcc gcc-cross
 
+# Create a version of the g++ driver which calls the cross-compiler.
+g++-cross: $(srcdir)/g++.c
+       $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o g++-cross \
+          -DGCC_NAME=\"$(target)-gcc\" $(srcdir)/g++.c version.o $(LIBS)
+
 cc1:$(P) $(C_OBJS) $(OBJS) $(LIBDEPS)
        $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(LIBS)
 
@@ -518,7 +560,8 @@ gfloat.h: $(FLOAT_H)
 
 # Create float.h source for the native machine.
 float.h-nat: enquire
-       -./enquire -f > float.h-nat
+       -./enquire -f > tmp-float.h
+       mv tmp-float.h float.h-nat
 
 # Create a dummy float.h source for a cross-compiler.
 float.h-cross:
@@ -578,7 +621,10 @@ libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
 # so that libgcc1.a itself remains nonexistent if compilation is aborted.
 # -e causes any failing command to make this rule fail.
 # -e doesn't work in certain shells, so we test $$? as well.
-       set -e; \
+# lynx has a broken ar, it always complains when the initial library is
+# empty, thus this command works only if we don't do -e
+# There is a trailing backslash (\) deleted from the following line.
+#      set -e;
        for name in $(LIB1FUNCS); \
        do \
          echo $${name}; \
@@ -616,7 +662,7 @@ libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
 # Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
 # But recompiling cc1 should not force recompilation of libgcc2.a.
 # If you want to force recompilation, delete libgcc2.a.
-libgcc2.ready: $(GCC_PASSES)
+libgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS)
        -if [ -f libgcc2.ready ] ; then \
                true; \
        else \
@@ -630,7 +676,10 @@ libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \
        -rm -f tmplibgcc2.a
 # -e causes any failing command to make this rule fail.
 # -e doesn't work in certain shells, so we test $$? as well.
-       set -e; \
+# lynx has a broken ar, it always complains when the initial library is
+# empty, thus this command works only if we don't do -e
+# There is a trailing backslash (\) deleted from the following line.
+#      set -e;
        for name in $(LIB2FUNCS); \
        do \
          echo $${name}; \
@@ -676,6 +725,11 @@ libgcc.a: $(LIBGCC1) $(LIBGCC2)
        then (cd tmpcopy; $(AR) x ../$(LIBGCC1));       \
        else true;                                      \
        fi
+# Some versions of ar (specifically the one in RISC/os 5.x), create an
+# unwritable table of contents file, and then print an error message when
+# the second ar command tries to overwrite this file.  To avoid the error
+# message from ar, we make sure all files are writable.
+       (cd tmpcopy; chmod +w * > /dev/null 2>&1)
        (cd tmpcopy; $(AR) x ../$(LIBGCC2))
        (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *.o)
        rm -rf tmpcopy
@@ -687,7 +741,7 @@ libgcc.a: $(LIBGCC1) $(LIBGCC2)
 objc-runtime: libobjc.a
 
 # Build the Objective C runtime library.
-libobjc.a: cc1obj libgcc2.ready
+libobjc.a: cc1obj libgcc2.ready $(USE_COLLECT2) $(EXTRA_PARTS)
        if [ -d objc ]; then true; else mkdir objc; fi
        thisdir1=`pwd`; \
        srcdir1=`cd $(srcdir); pwd`; \
@@ -735,8 +789,10 @@ c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h c-parse.h \
        $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
 $(srcdir)/c-parse.c $(srcdir)/c-parse.h: $(srcdir)/c-parse.y
        cd $(srcdir); $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
-$(srcdir)/c-parse.y: $(srcdir)/c-parse.in $(srcdir)/cond.awk
-       cd $(srcdir); awk -f cond.awk objc=0 c-parse.in > c-parse.y
+$(srcdir)/c-parse.y: $(srcdir)/c-parse.in
+       sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
+         -e "/^ifc$$/d" -e "/^end ifc$$/d" \
+         $(srcdir)/c-parse.in > $(srcdir)/c-parse.y
 
 c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
 c-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
@@ -755,7 +811,7 @@ cp-parse.o : $(srcdir)/cp-parse.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h cp-lex.h
   `echo $(srcdir)/cp-parse.c | sed 's,^\./,,'`
 
 $(srcdir)/cp-parse.c $(srcdir)/cp-parse.h : $(srcdir)/cp-parse.y
-       @echo expect 29 shift/reduce conflicts and 14 reduce/reduce conflicts
+       @echo expect 29 shift/reduce conflicts and 13 reduce/reduce conflicts
        cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o cp-parse.c cp-parse.y
        cd $(srcdir); grep '^#define[   ]*YYEMPTY' cp-parse.c >>cp-parse.h
 
@@ -800,18 +856,20 @@ collect2.o : collect2.c $(CONFIG_H) gstab.h
        -DTARGET_MACHINE=\"$(target)\" \
        -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
 
-# Objectionable C language specific files.
+# Objective C language specific files.
 
 objc-parse.o : $(srcdir)/objc-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
    c-tree.h input.h flags.h objc-act.h
        $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/objc-parse.c
 $(srcdir)/objc-parse.c : $(srcdir)/objc-parse.y
        cd $(srcdir); $(BISON) $(BISONFLAGS) objc-parse.y -o objc-parse.c
-$(srcdir)/objc-parse.y: $(srcdir)/c-parse.in $(srcdir)/cond.awk
-       cd $(srcdir); awk -f cond.awk objc=1 c-parse.in > objc-parse.y
+$(srcdir)/objc-parse.y: $(srcdir)/c-parse.in
+       sed -e "/^ifc$$/,/^end ifc$$/d" \
+         -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
+         $(srcdir)/c-parse.in > $(srcdir)/objc-parse.y
 
-objc-act.o : objc-act.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h \
-   flags.h objc-act.h
+objc-act.o : objc-act.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h c-lex.h \
+   flags.h objc-act.h input.h function.h $(srcdir)/c-parse.h
 
 # A file used by all variants of C.
 
@@ -824,7 +882,7 @@ gcc.o: gcc.c $(CONFIG_H) gvarargs.h config.status
   -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
   -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
   -DDEFAULT_TARGET_MACHINE=\"$(target)\" \
-  -DTOOLDIR_BASE_PREFIX=\"$(prefix)/\" \
+  -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\" \
   -DTOOLDIR=\"$(tooldir)/\" \
   $(MAYBE_TARGET_DEFAULT) \
   -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
@@ -897,7 +955,7 @@ flow.o : flow.c $(CONFIG_H) $(RTL_H) flags.h insn-config.h \
    basic-block.h regs.h hard-reg-set.h output.h
 combine.o : combine.c $(CONFIG_H) $(RTL_H) gvarargs.h flags.h  \
    insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \
-   basic-block.h recog.h real.h
+   basic-block.h recog.h real.h hard-reg-set.h
 regclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
    basic-block.h regs.h insn-config.h recog.h reload.h real.h
 local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h basic-block.h \
@@ -917,7 +975,7 @@ reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
    flags.h output.h
 sched.o : sched.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h \
    flags.h insn-config.h insn-attr.h
-final.o : final.c $(CONFIG_H) $(RTL_H) gvarargs.h flags.h regs.h \
+final.o : final.c $(CONFIG_H) $(RTL_H) $(TREE_H) gvarargs.h flags.h regs.h \
    recog.h conditions.h insn-config.h insn-attr.h real.h output.h \
    hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
 recog.o : recog.c $(CONFIG_H) $(RTL_H)  \
@@ -1234,7 +1292,7 @@ stamp-proto:      $(srcdir)/protoize.c getopt.h $(CONFIG_H)
           -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
           -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
          -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
-         -DLOCAL_INCLUDE_DIR=\"$(prefix)/include\" \
+         -DLOCAL_INCLUDE_DIR=\"$(local_prefix)/include\" \
          -DSTD_PROTO_DIR=\"$(libsubdir)\" \
          -DUNPROTOIZE $(srcdir)/protoize.c
        mv protoize.o unprotoize.o
@@ -1243,7 +1301,7 @@ stamp-proto:      $(srcdir)/protoize.c getopt.h $(CONFIG_H)
           -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
           -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
          -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
-         -DLOCAL_INCLUDE_DIR=\"$(prefix)/include\" \
+         -DLOCAL_INCLUDE_DIR=\"$(local_prefix)/include\" \
          -DSTD_PROTO_DIR=\"$(libsubdir)\" \
          $(srcdir)/protoize.c
        touch stamp-proto
@@ -1261,6 +1319,7 @@ SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES)
          -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
        -rm -f SYSCALLS.c tmp-SYSCALLS.s
 
+
 test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
        -rm -f tmp-proto.[cso]
        cp $(srcdir)/protoize.c tmp-proto.c
@@ -1290,7 +1349,10 @@ test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
 # stamp-* so that mostlyclean does not force the include directory to
 # be rebuilt.
 
-stmp-headers: stmp-fixinc $(USER_H) gvarargs.h gstdarg.h gstddef.h gsyslimits.h xlimits.h gfloat.h
+# Build the include directory except for float.h (which depends upon
+# enquire).
+stmp-int-hdrs: stmp-fixinc $(USER_H) gvarargs.h gstdarg.h gstddef.h \
+  xlimits.h objc-headers
 # Copy in the headers provided with gcc.
 # The sed command gets just the last file name component;
 # this is necessary because VPATH could add a dirname.
@@ -1303,13 +1365,6 @@ stmp-headers: stmp-fixinc $(USER_H) gvarargs.h gstdarg.h gstddef.h gsyslimits.h
          cp $$realfile $$objdir/include; \
          chmod a+r $$objdir/include/$$realfile; \
        done
-       rm -f include/syslimits.h
-       if [ -f include/limits.h ]; then \
-         mv include/limits.h include/syslimits.h; \
-       else \
-         cp $(srcdir)/gsyslimits.h include/syslimits.h; \
-       fi
-       chmod a+r include/syslimits.h
        rm -f include/varargs.h
        cp $(srcdir)/gvarargs.h include/varargs.h
        chmod a+r include/varargs.h
@@ -1322,17 +1377,21 @@ stmp-headers: stmp-fixinc $(USER_H) gvarargs.h gstdarg.h gstddef.h gsyslimits.h
        rm -f include/limits.h
        cp xlimits.h include/limits.h
        chmod a+r include/limits.h
-       rm -f include/float.h
-       cp gfloat.h include/float.h
-       chmod a+r include/float.h
 # Install the README
        rm -f include/README
        cp $(srcdir)/README-fixinc include/README
        chmod a+r include/README
+       touch stmp-int-hdrs
+
+# Build the complete include directory.
+stmp-headers: stmp-int-hdrs gfloat.h
+       rm -f include/float.h
+       cp gfloat.h include/float.h
+       chmod a+r include/float.h
        touch stmp-headers
 
 # Build fixed copies of system files.
-stmp-fixinc: $(srcdir)/$(FIXINCLUDES)
+stmp-fixinc: $(srcdir)/$(FIXINCLUDES) gsyslimits.h xgcc cpp
        rm -rf include
        mkdir include
        if [ x$(FIXINCLUDES) != xMakefile.in ]; \
@@ -1340,33 +1399,88 @@ stmp-fixinc: $(srcdir)/$(FIXINCLUDES)
          for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
            if [ -d $$dir ]; \
            then \
-             $(srcdir)/$(FIXINCLUDES) include $$dir $(srcdir); \
+             $(srcdir)/$(FIXINCLUDES) include $$dir $(srcdir) "`pwd`/xgcc -B`pwd`/"; \
            else true; fi; \
          done; \
        else true; \
        fi
+       rm -f include/syslimits.h
+       if [ -f include/limits.h ]; then \
+         mv include/limits.h include/syslimits.h; \
+       else \
+         cp $(srcdir)/gsyslimits.h include/syslimits.h; \
+       fi
+       chmod a+r include/syslimits.h
        touch stmp-fixinc
+
+# copy objc header files into build directory
+objc-headers:
+       if [ -d objc ]; then true; else mkdir objc; fi
+       thisdir1=`pwd`; \
+       srcdir1=`cd $(srcdir); pwd`; \
+       cd objc; \
+       $(MAKE) -f $${srcdir1}/objc/Makefile copy-headers \
+       srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
+       GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
+       GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=$${thisdir1}/include
+       touch objc-headers
+
+# Files related to the fixproto script.
+
+deduced.h: $(srcdir)/scan-types.sh
+       CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -nostdinc -Iinclude -I${SYSTEM_HEADER_DIR}"; \
+         export CC; \
+         $(srcdir)/scan-types.sh >tmp-deduced.h
+       mv tmp-deduced.h deduced.h
+
+gen-protos: gen-protos.o scan.o
+       ${HOST_CC} -o gen-protos gen-protos.o scan.o
+
+xsys-protos.h: $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
+       cat deduced.h $(srcdir)/sys-protos.h > fixtmp.c
+       $(GCC_FOR_TARGET) fixtmp.c -E \
+         | sed -e 's/  / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
+         | ./gen-protos >xsys-protos.h
+       rm -rf fixtmp.c
+
+scan-decls: scan-decls.o scan.o
+       $(HOST_CC) -o scan-decls scan-decls.o scan.o
+
+patch-header: patch-header.o scan.o xsys-protos.h $(HOST_OBSTACK)
+       $(HOST_CC) -o patch-header patch-header.o scan.o $(HOST_OBSTACK)
+
+patch-header.o: xsys-protos.h
+
+stmp-fixproto: patch-header scan-decls xsys-protos.h
+       CPP="$(GCC_FOR_TARGET) -E"; export CPP; \
+         ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR)
+       touch stmp-fixproto
 \f
 # Remake the info files.
 
-doc: $(srcdir)/cpp.info $(srcdir)/gcc.info
+doc: info
+info: $(srcdir)/cpp.info $(srcdir)/gcc.info
 
 $(srcdir)/cpp.info: cpp.texi
-       $(MAKEINFO) `echo $(srcdir)/cpp.texi | sed 's,^\./,,'`
+       cd $(srcdir); $(MAKEINFO) cpp.texi
 
 #$(srcdir)/gplus.info: gplus.texi
 #      $(MAKEINFO) `echo $(srcdir)/gplus.texi | sed 's,^\./,,'`
 
 $(srcdir)/gcc.info: gcc.texi extend.texi install.texi invoke.texi \
                md.texi rtl.texi tm.texi 
-       $(MAKEINFO) `echo $(srcdir)/gcc.texi | sed 's,^\./,,'`
+       cd $(srcdir); $(MAKEINFO) gcc.texi
+
+dvi: $(srcdir)/gcc.dvi $(srcdir)/cpp.dvi
 
 # This works with GNU Make's default rule.
 $(srcdir)/gcc.dvi: gcc.texi extend.texi install.texi invoke.texi \
                md.texi rtl.texi tm.texi 
+       $(TEXI2DVI) $<
 
 # This works with GNU Make's default rule.
 $(srcdir)/cpp.dvi: cpp.texi
+       $(TEXI2DVI) $<
 
 $(srcdir)/INSTALL: install1.texi install.texi
        $(MAKEINFO) -D INSTALLONLY --no-header `echo $(srcdir)/install1.texi | sed 's,^\./,,'`
@@ -1398,7 +1512,7 @@ mostlyclean:
        -rm -f tmplibgcc* tmpcopy xlimits.h
        for name in $(LIB1FUNCS); do rm -f $${name}.c; done
 # Delete other temporary files.
-       -rm -f tmp-float.h tmp-gcc.xtar.Z
+       -rm -f tmp-float.h tmp-gcc.xtar.gz
        -rm -f tmp-foo1 tmp-foo2 tmp-proto.* tmp-unproto.1 tmp-SYSCALLS.s
 # Delete the stamp files.
        -rm -f stamp-* tmp-*
@@ -1408,6 +1522,9 @@ mostlyclean:
 # Delete some files made during installation.
        -rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
        -rm -f collect collect2 ld mips-tfile mips-tdump alloca.s
+# Delete files generated for fixproto
+       -rm -rf patch-header scan-decls xsys-protos.h deduced.h tmp-deduced.h \
+         gen-protos fixproto.list fixtmp.?
 # Delete unwanted output files from TeX.
        -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
 # Delete sorted indices we don't actually use.
@@ -1425,7 +1542,7 @@ clean: mostlyclean
        -rm -f libgcc.a libgcc1.a libgcc2.a libgcc2.ready libgcc1.null
        -rm -f *.dvi
 # Delete the include directory.
-       -rm -rf stmp-* include
+       -rm -rf stmp-* include objc-headers
 
 # Delete all files that users would normally create
 # while building and installing GCC.
@@ -1433,14 +1550,22 @@ distclean: clean
        -rm -f tm.h aux-output.c config.h md config.status tconfig.h hconfig.h
        -rm -f Makefile *.oaux
        -rm -fr stage1 stage2 stage3 stage4
+       -rm -f cp-parse.output
+       -rm -f objc-parse.output
+       -rm -f c-parse.output
 
 # Delete anything likely to be found in the source directory
 # that shouldn't be in the distribution.
 extraclean: distclean
        -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
        -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
-       -rm -f *.dvi *.oaux *.d *.Z *.tar *.xtar *diff
-       -rm -f *lose config/*lose
+       -rm -f config/*/=* config/*/"#"* config/*/*~*
+       -rm -f config/*/*.orig config/*/*.rej
+       -rm -f objc/=* objc/"#"* objc/*~*
+       -rm -f objc/*.orig objc/*.rej
+       -rm -f *.dvi *.oaux *.d *.[zZ] *.gz
+       -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
+       -rm -f *lose config/*lose config/*/*lose
        -rm -f *.s *.s[0-9] *.i install1.texi config/ChangeLog
 
 # Get rid of every file that's generated from some other file.
@@ -1464,7 +1589,8 @@ realclean: distclean
 install: $(INSTALL_TARGET) ; @true
 
 # Copy the compiler files into directories where they will be run.
-install-normal: install-common install-libgcc $(INSTALL_HEADERS) install-man
+install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
+    install-man install-info
 
 # Do nothing while making gcc with a cross-compiler. The person who
 # makes gcc for the target machine has to know how to put a complete
@@ -1498,12 +1624,9 @@ install-dir:
        -if [ -d $(libdir)/gcc-lib/$(target)/$(version)/include ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version)/include ; fi
        -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; fi
        -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; fi
-       -if [ -f gcc-cross ] ; \
-       then \
-         if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; fi ; \
-         if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; fi ; \
-       else true; \
-       fi
+       -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; fi
+       -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; fi
+       -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; fi
 # We don't use mkdir -p to create the parents of mandir,
 # because some systems don't support it.
 # Instead, we use this technique to create the immediate parent of mandir.
@@ -1514,7 +1637,7 @@ install-dir:
 # Install the compiler executables built during cross compilation.
 # Deps on  $(srcdir)/g++ $(srcdir)/c++  would be natural here,
 # but the latter would get confused with the target `c++'.
-install-common: native install-dir xgcc $(EXTRA_PARTS)
+install-common: native install-dir xgcc g++ $(EXTRA_PARTS)
        for file in $(COMPILERS); do \
          if [ -f $$file ] ; then \
            rm -f $(libsubdir)/$$file; \
@@ -1533,20 +1656,28 @@ install-common: native install-dir xgcc $(EXTRA_PARTS)
          rm -f $(libsubdir)/specs; \
          $(INSTALL_DATA) specs $(libsubdir)/specs; \
        fi
-# Install the driver program as gcc-$(target)
+# Install the driver program as $(target)-gcc
 # and also as either gcc (if native) or $(tooldir)/bin/gcc.
        -if [ -f gcc-cross ] ; then \
-         $(INSTALL_PROGRAM) gcc-cross $(bindir)/gcc-$(target); \
+         rm -f $(bindir)/$(target)-gcc; \
+         $(INSTALL_PROGRAM) gcc-cross $(bindir)/$(target)-gcc; \
          if [ -d $(tooldir)/bin/. ] ; then \
            rm -f $(tooldir)/bin/gcc; \
            $(INSTALL_PROGRAM) gcc-cross $(tooldir)/bin/gcc; \
          else true; fi; \
+         if [ -f cc1plus ] ; then \
+           rm -f $(bindir)/$(target)-g++; \
+           $(INSTALL_PROGRAM) g++-cross $(bindir)/$(target)-g++; \
+           chmod a+x $(bindir)/$(target)-g++; \
+           rm -f $(bindir)/$(target)-c++; \
+           ln $(bindir)/$(target)-g++ $(bindir)/$(target)-c++; \
+         fi ; \
        else \
          rm -f $(bindir)/gcc; \
          $(INSTALL_PROGRAM) xgcc $(bindir)/gcc; \
-         rm -f $(bindir)/gcc-$(target)-1; \
-         ln $(bindir)/gcc $(bindir)/gcc-$(target)-1; \
-         mv $(bindir)/gcc-$(target)-1 $(bindir)/gcc-$(target); \
+         rm -f $(bindir)/$(target)-gcc-1; \
+         ln $(bindir)/gcc $(bindir)/$(target)-gcc-1; \
+         mv $(bindir)/$(target)-gcc-1 $(bindir)/$(target)-gcc; \
        fi
 # Install protoize if it was compiled.
        -if [ -f protoize ]; \
@@ -1560,14 +1691,22 @@ install-common: native install-dir xgcc $(EXTRA_PARTS)
            chmod a-x $(libsubdir)/SYSCALLS.c.X; \
        fi
        -if [ -f cc1plus ] ; then \
-         rm -f $(bindir)/c++ ; \
-         $(INSTALL_PROGRAM) $(srcdir)/c++ $(bindir)/c++ ; \
-         rm -f $(bindir)/g++ ; \
-         $(INSTALL_PROGRAM) $(srcdir)/g++ $(bindir)/g++ ; \
+           rm -f $(bindir)/g++; \
+           $(INSTALL_PROGRAM) g++ $(bindir)/g++; \
+           chmod a+x $(bindir)/g++; \
+           rm -f $(bindir)/c++; \
+           ln $(bindir)/g++ $(bindir)/c++; \
        fi
        -rm -f $(libsubdir)/cpp
        $(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
 
+# Install the info files.
+install-info: doc
+       -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
+       cd $(srcdir); for f in cpp.info* gcc.info*; \
+       do $(INSTALL_DATA) $$f $(infodir)/$$f; done
+       -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
+
 # Install the man pages.
 install-man: install-dir $(srcdir)/gcc.1 $(srcdir)/cccp.1 $(srcdir)/g++.1
        -rm -f $(mandir)/gcc$(manext)
@@ -1622,17 +1761,24 @@ install-include-dir: install-dir
        -chmod a+rx $(libsubdir)/include
 
 # Install the include directory using tar.
-install-headers-tar: stmp-headers install-include-dir
-       cd include; tar cf - . | (cd $(libsubdir)/include; tar xpBf - )
+install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
+       cd include; \
+        (tar cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
+# /bin/sh on some systems returns the status of the first tar,
+# and that can lose with GNU tar which always writes a full block.
+# So use `exit 0' to ignore its exit status.
 
 # Install the include directory using cpio.
-install-headers-cpio: stmp-headers install-include-dir
+install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
        cd include; find . -print | cpio -pdum $(libsubdir)/include
 
-# Put assert.h in /usr/local/include, so it won't override GNU libc's assert.h.
-# Don't replace the assert.h already there if it is not from GCC.
-# This code would be simpler if it tested for -f ... && ! grep ...
-# but supposedly the ! operator is missing in sh on some systems.
+# Put assert.h where it won't override GNU libc's assert.h.
+# It goes in a dir that is searched after GNU libc's headers;
+# thus, the following conditionals are no longer needed.
+# But it's not worth deleting them now.
+## Don't replace the assert.h already there if it is not from GCC.
+## This code would be simpler if it tested for -f ... && ! grep ...
+## but supposedly the ! operator is missing in sh on some systems.
 install-assert-h: assert.h install-dir
        if [ -f $(assertdir)/assert.h ]; \
        then \
@@ -1679,15 +1825,15 @@ TAGS: force
        rmdir temp
 
 # Create the distribution tar file.
-#dist: gcc-$(version).tar.Z
-dist: gcc.xtar.Z
+#dist: gcc-$(version).tar.gz
+dist: gcc.xtar.gz
 
-gcc.xtar.Z: gcc.xtar
-       compress < gcc.xtar > tmp-gcc.xtar.Z
-       mv tmp-gcc.xtar.Z gcc.xtar.Z
+gcc.xtar.gz: gcc.xtar
+       gzip < gcc.xtar > tmp-gcc.xtar.gz
+       mv tmp-gcc.xtar.gz gcc.xtar.gz
 
-#gcc-$(version).tar.Z: gcc-$(version).tar
-#      compress < gcc-$(version).tar > gcc-$(version).tar.Z
+#gcc-$(version).tar.gz: gcc-$(version).tar
+#      gzip < gcc-$(version).tar > gcc-$(version).tar.gz
 
 #gcc-$(version).tar:
 gcc.xtar: distdir
@@ -1717,7 +1863,18 @@ distdir: doc $(srcdir)/INSTALL c-parse.y objc-parse.y cp-parse.y \
        done
        cd config; \
        for file in *[0-9a-zA-Z+]; do \
-         ln $$file ../tmp/config >/dev/null 2>&1 || cp $$file ../tmp/config; \
+         if test -d $$file && test "$$file" != RCS; then \
+           mkdir ../tmp/config/$$file; \
+           cd $$file; \
+           for subfile in *[0-9a-zA-Z+]; do \
+             ln $$subfile ../../tmp/config/$$file >/dev/null 2>&1 \
+             || cp $$subfile ../../tmp/config/$$file; \
+           done; \
+           cd ..; \
+         else \
+           ln $$file ../tmp/config >/dev/null 2>&1 \
+           || cp $$file ../tmp/config; \
+         fi; \
        done
        cd objc; \
        for file in *[0-9a-zA-Z+]; do \
@@ -1773,9 +1930,10 @@ bootstrap3: force
 # Compare the object files in the current directory with those in the
 # stage2 directory.
 
+# ./ avoids bug in some versions of tail.
 compare: force
        for file in *.o; do \
-         tail +16c $$file > tmp-foo1; \
+         tail +16c ./$$file > tmp-foo1; \
          tail +16c stage2/$$file > tmp-foo2 2>/dev/null \
            && (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
        done