include-fixed followup patch

Joseph S. Myers joseph@codesourcery.com
Sat Mar 3 00:37:00 GMT 2007


This patch follows up my previous include-fixed patch
<http://gcc.gnu.org/ml/gcc-patches/2007-02/msg02038.html>.

* The real-* rules to copy fixed headers from previous stages should
  only copy include-fixed, not include as well.  This should fix bug
  31020.

* The rules for running fixproto need to handle include-fixed just
  like those for running fixincludes.

* If SYSROOT_HEADERS_SUFFIX_SPEC is defined, different multilibs may
  have different headers (for example, one multilib could be using
  glibc and one uClibc), so they need different fixed headers.  Thus
  the fixed header directory is made into a multilib-suffixed
  directory in this case.  (There aren't yet any targets in the FSF
  tree using SYSROOT_HEADERS_SUFFIX_SPEC so this change should not
  affect any FSF tree targets; that macro serves as a means of
  building custom multilib configurations building on the FSF tree,
  but any particular sysroot arrangement is arbitrary and determined
  by external infrastructure that sets up the sysroot, so not very
  suitable for inclusion in the FSF tree.  In future there might be
  configure options to specify the set of multilibs to build, and such
  options would naturally allow specifing the value of this macro.)

Bootstrapped with no regressions on i686-pc-linux-gnu;
SYSROOT_HEADERS_SUFFIX_SPEC case tested separately with custom
multilib configuration.  OK to commit?

fixincludes:
2007-03-02  Joseph Myers  <joseph@codesourcery.com>

	* mkheaders.in: Fix headers for each multilib required.

gcc:
2007-03-02  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/31020
	* configure.ac (CROSS_SYSTEM_HEADER_DIR, build_system_header_dir):
	Define using $${sysroot_headers_suffix}.
	* configure: Regenerate.
	* cppdefault.c (cpp_include_defaults): Make FIXED_INCLUDE_DIR a
	multilib-suffixed directory if SYSROOT_HEADERS_SUFFIX_SPEC
	defined.
	* doc/invoke.texi (-print-sysroot-headers-suffix): Document.
	* gcc.c (print_sysroot_headers_suffix): New.
	(option_map): Include --print-sysroot-headers-suffix.
	(display_help): Mention -print-sysroot-headers-suffix.
	(process_command): Handle -print-sysroot-headers-suffix.
	(do_spec_1): Append multilib directory to include-fixed path if
	sysroot suffixes in use.
	(main): Handle -print-sysroot-headers-suffix.
	* Makefile.in (start.encap): Don't depend on xlimits.h
	(xlimits.h): Remove.
	(stmp-int-hdrs): Don't depend on xlimits.h.  Inline generation of
	limits.h for each multilib in fixinc_list.
	(fixinc_list, s-fixinc_list): New.
	(stmp-fixinc): Depend on fixinc_list.  If not copying headers,
	generate them for each multilib in fixinc_list.
	(stmp-fixproto): Use include-fixed.  Run fixproto for each
	multilib in fixinc_list.
	(mostlyclean): Don't remove xlimits.h.
	(clean): Remove include-fixed.
	(real-install-headers-tar, real-install-headers-cpio,
	real-install-headers-cp): Don't copy include, only include-fixed.
	(install-mkheaders): Depend on fixinc_list.  Don't depend on
	xlimits.h.  Save limits.h files for each multilib in fixinc_list.
	Always save mkinstalldirs.  Preserve ${sysroot_headers_suffix} in
	SYSTEM_HEADER_DIR setting in mkheaders.conf.

Index: fixincludes/mkheaders.in
===================================================================
--- fixincludes/mkheaders.in	(revision 122478)
+++ fixincludes/mkheaders.in	(working copy)
@@ -78,29 +78,33 @@
 itoolsdir=${libexecsubdir}/install-tools
 itoolsdatadir=${libsubdir}/install-tools
 incdir=${libsubdir}/include-fixed
+mkinstalldirs="@SHELL@ ${itoolsdir}/mkinstalldirs"
 
-. ${itoolsdatadir}/mkheaders.conf
-
 cd ${itoolsdir}
 rm -rf ${incdir}/*
 
-if [ x${STMP_FIXINC} != x ] ; then
+for ml in `cat ${itoolsdatadir}/fixinc_list`; do
+  sysroot_headers_suffix=`echo ${ml} | sed -e 's/;.*$//'`
+  multi_dir=`echo ${ml} | sed -e 's/^[^;]*;//'`
+  subincdir=${incdir}${multi_dir}
+  . ${itoolsdatadir}/mkheaders.conf
+  if [ x${STMP_FIXINC} != x ] ; then
 	TARGET_MACHINE="${target}" target_canonical="${target}" \
 	    MACRO_LIST="${itoolsdatadir}/macro_list" \
-	    @SHELL@ ./fixinc.sh ${incdir} \
+	    @SHELL@ ./fixinc.sh ${subincdir} \
 	    ${isysroot}${SYSTEM_HEADER_DIR} ${OTHER_FIXINCLUDES_DIRS}
-	rm -f ${incdir}/syslimits.h
-	if [ -f ${incdir}/limits.h ]; then
-	  mv ${incdir}/limits.h ${incdir}/syslimits.h
+	rm -f ${subincdir}/syslimits.h
+	if [ -f ${subincdir}/limits.h ]; then
+	  mv ${subincdir}/limits.h ${subincdir}/syslimits.h
 	else
-	  cp ${itoolsdatadir}/gsyslimits.h ${incdir}/syslimits.h
+	  cp ${itoolsdatadir}/gsyslimits.h ${subincdir}/syslimits.h
 	fi
-fi
+  fi
 
-cp ${itoolsdatadir}/include/* ${incdir}
+  cp ${itoolsdatadir}/include${multi_dir}/limits.h ${subincdir}
 
-if [ x${STMP_FIXPROTO} != x ] ; then
-  mkinstalldirs="@SHELL@ ${itoolsdir}/mkinstalldirs"
-  export FIXPROTO_DEFINES mkinstalldirs
-  @SHELL@ fixproto ${incdir} ${incdir} ${isysroot}${SYSTEM_HEADER_DIR} || exit 1
-fi
+  if [ x${STMP_FIXPROTO} != x ] ; then
+    export FIXPROTO_DEFINES mkinstalldirs
+    @SHELL@ fixproto ${subincdir} ${subincdir} ${isysroot}${SYSTEM_HEADER_DIR} || exit 1
+  fi
+done
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 122478)
+++ gcc/configure.ac	(working copy)
@@ -754,7 +754,7 @@
  esac
    
  TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
- CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)'
+ CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
 	
  if test "x$exec_prefix" = xNONE; then
   if test "x$prefix" = xNONE; then
@@ -1699,7 +1699,7 @@
 SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)'	AC_SUBST(SYSTEM_HEADER_DIR)
 
 if test "x$with_build_sysroot" != x; then
-  build_system_header_dir=$with_build_sysroot'$(NATIVE_SYSTEM_HEADER_DIR)'
+  build_system_header_dir=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
 else
   # This value is used, even on a native system, because 
   # CROSS_SYSTEM_HEADER_DIR is just 
Index: gcc/configure
===================================================================
--- gcc/configure	(revision 122478)
+++ gcc/configure	(working copy)
@@ -7128,7 +7128,7 @@
  esac
 
  TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
- CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$(NATIVE_SYSTEM_HEADER_DIR)'
+ CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
 
  if test "x$exec_prefix" = xNONE; then
   if test "x$prefix" = xNONE; then
@@ -13116,7 +13116,7 @@
 SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)'
 
 if test "x$with_build_sysroot" != x; then
-  build_system_header_dir=$with_build_sysroot'$(NATIVE_SYSTEM_HEADER_DIR)'
+  build_system_header_dir=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
 else
   # This value is used, even on a native system, because
   # CROSS_SYSTEM_HEADER_DIR is just
Index: gcc/cppdefault.c
===================================================================
--- gcc/cppdefault.c	(revision 122478)
+++ gcc/cppdefault.c	(working copy)
@@ -71,8 +71,16 @@
 #endif
 #ifdef FIXED_INCLUDE_DIR
     /* This is the dir for fixincludes.  */
-    { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
+    { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
+      /* A multilib suffix needs adding if different multilibs use
+	 different headers.  */
+#ifdef SYSROOT_HEADERS_SUFFIX_SPEC
+      1
+#else
+      0
 #endif
+    },
+#endif
 #ifdef CROSS_INCLUDE_DIR
     /* One place the target system's headers might be.  */
     { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 122478)
+++ gcc/doc/invoke.texi	(working copy)
@@ -301,6 +301,7 @@
 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
 -print-multi-directory  -print-multi-lib @gol
 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
+-print-sysroot-headers-suffix @gol
 -save-temps  -time}
 
 @item Optimization Options
@@ -4674,6 +4675,12 @@
 Don't forget the trailing @samp{/}.
 @xref{Environment Variables}.
 
+@item -print-sysroot-headers-suffix
+@opindex print-sysroot-headers-suffix
+Print the suffix added to the target sysroot when searching for
+headers, or give an error if the compiler is not configured with such
+a suffix---and don't do anything else.
+
 @item -dumpmachine
 @opindex dumpmachine
 Print the compiler's target machine (for example,
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 122478)
+++ gcc/gcc.c	(working copy)
@@ -168,6 +168,11 @@
 
 static int print_help_list;
 
+/* Flag saying to print the sysroot suffix used for searching for
+   headers.  */
+
+static int print_sysroot_headers_suffix;
+
 /* Flag indicating whether we should print the command and arguments */
 
 static int verbose_flag;
@@ -1125,6 +1130,7 @@
    {"--print-multi-directory", "-print-multi-directory", 0},
    {"--print-multi-os-directory", "-print-multi-os-directory", 0},
    {"--print-prog-name", "-print-prog-name=", "aj"},
+   {"--print-sysroot-headers-suffix", "-print-sysroot-headers-suffix", 0},
    {"--profile", "-p", 0},
    {"--profile-blocks", "-a", 0},
    {"--quiet", "-q", 0},
@@ -3193,6 +3199,7 @@
   -print-multi-lib         Display the mapping between command line options and\n\
                            multiple library search directories\n"), stdout);
   fputs (_("  -print-multi-os-directory Display the relative path to OS libraries\n"), stdout);
+  fputs (_("  -print-sysroot-headers-suffix Display the sysroot suffix used to find headers\n"), stdout);
   fputs (_("  -Wa,<options>            Pass comma-separated <options> on to the assembler\n"), stdout);
   fputs (_("  -Wp,<options>            Pass comma-separated <options> on to the preprocessor\n"), stdout);
   fputs (_("  -Wl,<options>            Pass comma-separated <options> on to the linker\n"), stdout);
@@ -3637,6 +3644,8 @@
 	print_multi_directory = 1;
       else if (! strcmp (argv[i], "-print-multi-os-directory"))
 	print_multi_os_directory = 1;
+      else if (! strcmp (argv[i], "-print-sysroot-headers-suffix"))
+	print_sysroot_headers_suffix = 1;
       else if (! strncmp (argv[i], "-Wa,", 4))
 	{
 	  int prev, j;
@@ -4066,6 +4075,8 @@
 	;
       else if (! strcmp (argv[i], "-print-multi-os-directory"))
 	;
+      else if (! strcmp (argv[i], "-print-sysroot-headers-suffix"))
+	;
       else if (! strncmp (argv[i], "--sysroot=", strlen ("--sysroot=")))
 	{
 	  target_system_root = argv[i] + strlen ("--sysroot=");
@@ -4978,6 +4989,9 @@
 			     spec_path, &info);
 
 	      info.append = "include-fixed";
+	      if (*sysroot_hdrs_suffix_spec)
+		info.append = concat (info.append, dir_separator_str,
+				      multilib_dir, NULL);
 	      info.append_len = strlen (info.append);
 	      for_each_path (&include_prefixes, false, info.append_len,
 			     spec_path, &info);
@@ -6394,6 +6408,19 @@
       return (0);
     }
 
+  if (print_sysroot_headers_suffix)
+    {
+      if (*sysroot_hdrs_suffix_spec)
+	{
+	  printf("%s\n", target_sysroot_hdrs_suffix);
+	  return (0);
+	}
+      else
+	/* The error status indicates that only one set of fixed
+	   headers should be built.  */
+	fatal ("not configured with sysroot headers suffix");
+    }
+
   if (print_help_list)
     {
       display_help ();
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 122478)
+++ gcc/Makefile.in	(working copy)
@@ -1418,7 +1418,7 @@
 	libgcc-support lang.all.cross doc @GENINSRC@ srcextra
 # This is what must be made before installing GCC and converting libraries.
 start.encap: native xgcc$(exeext) cpp$(exeext) specs \
-	libgcc-support xlimits.h lang.start.encap @GENINSRC@ srcextra
+	libgcc-support lang.start.encap @GENINSRC@ srcextra
 # These can't be made until after GCC can run.
 rest.encap: $(STMP_FIXPROTO) lang.rest.encap
 # This is what is made with the host's compiler
@@ -1542,14 +1542,6 @@
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) cc1-checksum.o \
 	  $(BACKEND) $(LIBS)
 
-# Build the version of limits.h that we will install.
-xlimits.h: glimits.h limitx.h limity.h
-	if $(LIMITS_H_TEST) ; then \
-	  cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \
-	else \
-	  cat $(srcdir)/glimits.h > tmp-xlimits.h; \
-	fi
-	mv tmp-xlimits.h xlimits.h
 #
 # Build libgcc.a.
 
@@ -3325,7 +3317,7 @@
 # be rebuilt.
 
 # Build the include directories.
-stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) xlimits.h $(UNWIND_H)
+stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) $(UNWIND_H)
 # 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.
@@ -3342,11 +3334,23 @@
 	    chmod a+r include/$$realfile; \
 	  fi; \
 	done
-	rm -f include-fixed/limits.h
-	cp xlimits.h include-fixed/limits.h
-	chmod a+r include-fixed/limits.h
 	rm -f include/unwind.h
 	cp $(UNWIND_H) include/unwind.h
+	set -e; for ml in `cat fixinc_list`; do \
+	  sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \
+	  multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
+	  fix_dir=include-fixed$${multi_dir}; \
+	  if $(LIMITS_H_TEST) ; then \
+	    cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \
+	  else \
+	    cat $(srcdir)/glimits.h > tmp-xlimits.h; \
+	  fi; \
+	  $(mkinstalldirs) $${fix_dir}; \
+	  chmod a+rx $${fix_dir} || true; \
+	  rm -f $${fix_dir}/limits.h; \
+	  mv tmp-xlimits.h $${fix_dir}/limits.h; \
+	  chmod a+r $${fix_dir}/limits.h; \
+	done
 # Install the README
 	rm -f include-fixed/README
 	cp $(srcdir)/../fixincludes/README-fixinc include-fixed/README
@@ -3366,6 +3370,28 @@
 	$(SHELL) $(srcdir)/../move-if-change tmp-macro_list macro_list
 	$(STAMP) s-macro_list
 
+fixinc_list: s-fixinc_list; @true
+s-fixinc_list : $(GCC_PASSES)
+# Build up a list of multilib directories and corresponding sysroot
+# suffixes, in form sysroot;multilib.
+	if $(GCC_FOR_TARGET) -print-sysroot-headers-suffix > /dev/null 2>&1; then \
+	  set -e; for ml in `$(GCC_FOR_TARGET) -print-multi-lib`; do \
+	    multi_dir=`echo $${ml} | sed -e 's/;.*$$//'`; \
+	    flags=`echo $${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
+	    sfx=`$(GCC_FOR_TARGET) $${flags} -print-sysroot-headers-suffix`; \
+	    if [ "$${multi_dir}" = "." ]; \
+	      then multi_dir=""; \
+	    else \
+	      multi_dir=/$${multi_dir}; \
+	    fi; \
+	    echo "$${sfx};$${multi_dir}"; \
+	  done; \
+	else \
+	  echo ";"; \
+	fi > tmp-fixinc_list
+	$(SHELL) $(srcdir)/../move-if-change tmp-fixinc_list fixinc_list
+	$(STAMP) s-fixinc_list
+
 # The line below is supposed to avoid accidentally matching the
 # built-in suffix rule `.o:' to build fixincl out of fixincl.o.  You'd
 # expect fixincl to be newer than fixincl.o, such that this situation
@@ -3383,16 +3409,9 @@
 # Build fixed copies of system files.
 # Abort if no system headers available, unless building a crosscompiler.
 # FIXME: abort unless building --without-headers would be more accurate and less ugly
-stmp-fixinc: gsyslimits.h macro_list \
+stmp-fixinc: gsyslimits.h macro_list fixinc_list \
   $(build_objdir)/fixincludes/fixincl \
   $(build_objdir)/fixincludes/fixinc.sh
-	@if ! $(inhibit_libc) && test ! -d ${SYSTEM_HEADER_DIR}; then \
-	  echo The directory that should contain system headers does not exist: >&2 ; \
-	  echo "  ${SYSTEM_HEADER_DIR}" >&2 ; \
-	  tooldir_sysinc=`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`; \
-	  if test "x${SYSTEM_HEADER_DIR}" = "x$${tooldir_sysinc}"; \
-	  then sleep 1; else exit 1; fi; \
-	fi
 	rm -rf include-fixed; mkdir include-fixed
 	-chmod a+rx include-fixed
 	if [ -d ../prev-gcc ]; then \
@@ -3400,20 +3419,34 @@
 	  $(MAKE) real-$(INSTALL_HEADERS_DIR) DESTDIR=`pwd`/../gcc/ \
 	    libsubdir=. ; \
 	else \
-	  (TARGET_MACHINE='$(target)'; srcdir=`cd $(srcdir); ${PWD_COMMAND}`; \
-	    SHELL='$(SHELL)'; MACRO_LIST=`${PWD_COMMAND}`/macro_list ; \
-	    export TARGET_MACHINE srcdir SHELL MACRO_LIST && \
-	    cd $(build_objdir)/fixincludes && \
-	    $(SHELL) ./fixinc.sh ../../gcc/include-fixed \
-	      $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \
-	  rm -f include-fixed/syslimits.h; \
-	  if [ -f include-fixed/limits.h ]; then \
-	    mv include-fixed/limits.h include-fixed/syslimits.h; \
-	  else \
-	    cp $(srcdir)/gsyslimits.h include-fixed/syslimits.h; \
-	  fi; \
+	  set -e; for ml in `cat fixinc_list`; do \
+	    sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \
+	    multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
+	    fix_dir=include-fixed$${multi_dir}; \
+	    if ! $(inhibit_libc) && test ! -d ${SYSTEM_HEADER_DIR}; then \
+	      echo The directory that should contain system headers does not exist: >&2 ; \
+	      echo "  ${SYSTEM_HEADER_DIR}" >&2 ; \
+	      tooldir_sysinc=`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`; \
+	      if test "x${SYSTEM_HEADER_DIR}" = "x$${tooldir_sysinc}"; \
+	      then sleep 1; else exit 1; fi; \
+	    fi; \
+	    $(mkinstalldirs) $${fix_dir}; \
+	    chmod a+rx $${fix_dir} || true; \
+	    (TARGET_MACHINE='$(target)'; srcdir=`cd $(srcdir); ${PWD_COMMAND}`; \
+	      SHELL='$(SHELL)'; MACRO_LIST=`${PWD_COMMAND}`/macro_list ; \
+	      export TARGET_MACHINE srcdir SHELL MACRO_LIST && \
+	      cd $(build_objdir)/fixincludes && \
+	      $(SHELL) ./fixinc.sh ../../gcc/$${fix_dir} \
+	        $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \
+	    rm -f $${fix_dir}/syslimits.h; \
+	    if [ -f $${fix_dir}/limits.h ]; then \
+	      mv $${fix_dir}/limits.h $${fix_dir}/syslimits.h; \
+	    else \
+	      cp $(srcdir)/gsyslimits.h $${fix_dir}/syslimits.h; \
+	    fi; \
+	    chmod a+r $${fix_dir}/syslimits.h; \
+	  done; \
 	fi
-	chmod a+r include-fixed/syslimits.h
 	$(STAMP) stmp-fixinc
 
 # Files related to the fixproto script.
@@ -3480,21 +3513,26 @@
 
 # stmp-int-hdrs is to make sure fixincludes has already finished.
 # The if statement is so that we don't run fixproto a second time
-# if it has already been run on the files in `include'.
-stmp-fixproto: fixhdr.ready fixproto stmp-int-hdrs
-	if [ -f include/fixed ] ; then true; \
-	else \
-	  : This line works around a 'make' bug in BSDI 1.1.; \
-	  FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
-	  FIX_HEADER="build/fix-header$(build_exeext)"; export FIX_HEADER; \
-	  mkinstalldirs="$(mkinstalldirs)"; \
-	    export mkinstalldirs; \
-	  if [ -d "$(SYSTEM_HEADER_DIR)" ]; then \
-	    $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
-	    if [ $$? -eq 0 ] ; then true ; else exit 1 ; fi ; \
-	  else true; fi; \
-	  $(STAMP) include/fixed; \
-	fi
+# if it has already been run on the files in `include-fixed'.
+stmp-fixproto: fixhdr.ready fixproto fixinc_list stmp-int-hdrs
+	set -e; for ml in `cat fixinc_list`; do \
+	  sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \
+	  multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
+	  fix_dir=include-fixed$${multi_dir}; \
+	  if [ -f $${fix_dir}/fixed ] ; then true; \
+	  else \
+	    : This line works around a 'make' bug in BSDI 1.1.; \
+	    FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
+	    FIX_HEADER="build/fix-header$(build_exeext)"; export FIX_HEADER; \
+	    mkinstalldirs="$(mkinstalldirs)"; \
+	      export mkinstalldirs; \
+	    if [ -d "$(SYSTEM_HEADER_DIR)" ]; then \
+	      $(SHELL) ${srcdir}/fixproto $${fix_dir} $${fix_dir} $(SYSTEM_HEADER_DIR); \
+	      if [ $$? -eq 0 ] ; then true ; else exit 1 ; fi ; \
+	    else true; fi; \
+	    $(STAMP) $${fix_dir}/fixed; \
+	  fi; \
+	done
 	$(STAMP) stmp-fixproto
 
 # We can't run fixproto (it's being built for a different host), but we still
@@ -3696,8 +3734,6 @@
 # Delete build programs
 	-rm -f build/*
 	-rm -f mddeps.mk
-# Delete the temp files made in the course of building libgcc.a.
-	-rm -f xlimits.h
 # Delete other built files.
 	-rm -f xsys-protos.hT
 	-rm -f specs.h gencheck.h options.c options.h
@@ -3738,8 +3774,8 @@
 	-rm -f cs-*
 	-rm -f doc/*.dvi
 	-rm -f doc/*.pdf
-# Delete the include directory.
-	-rm -rf include
+# Delete the include directories.
+	-rm -rf include include-fixed
 # Delete files used by the "multilib" facility (including libgcc subdirs).
 	-rm -f multilib.h tmpmultilib*
 	-if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \
@@ -4017,36 +4053,37 @@
 
 # Targets without dependencies, for use in prev-gcc during bootstrap.
 real-install-headers-tar:
-	(cd `${PWD_COMMAND}`/include ; \
-	 tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include; tar xpf - )
 	(cd `${PWD_COMMAND}`/include-fixed ; \
 	 tar -cf - .; exit 0) | (cd $(DESTDIR)$(libsubdir)/include-fixed; tar xpf - )
 
 real-install-headers-cpio:
-	cd `${PWD_COMMAND}`/include ; \
-	find . -print | cpio -pdum $(DESTDIR)$(libsubdir)/include
 	cd `${PWD_COMMAND}`/include-fixed ; \
 	find . -print | cpio -pdum $(DESTDIR)$(libsubdir)/include-fixed
 
 real-install-headers-cp:
-	cp -p -r include $(DESTDIR)$(libsubdir)
 	cp -p -r include-fixed $(DESTDIR)$(libsubdir)
 
 # Install supporting files for fixincludes to be run later.
 install-mkheaders: stmp-int-hdrs $(STMP_FIXPROTO) install-itoolsdirs \
-  macro_list xlimits.h
-	$(INSTALL_DATA) xlimits.h $(DESTDIR)$(itoolsdatadir)/include/limits.h
+  macro_list fixinc_list
 	$(INSTALL_DATA) $(srcdir)/gsyslimits.h \
 	  $(DESTDIR)$(itoolsdatadir)/gsyslimits.h
 	$(INSTALL_DATA) macro_list $(DESTDIR)$(itoolsdatadir)/macro_list
+	$(INSTALL_DATA) fixinc_list $(DESTDIR)$(itoolsdatadir)/fixinc_list
+	set -e; for ml in `cat fixinc_list`; do \
+	  multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
+	  $(mkinstalldirs) $(DESTDIR)$(itoolsdatadir)/include$${multi_dir}; \
+	  $(INSTALL_DATA) include-fixed$${multidir}/limits.h $(DESTDIR)$(itoolsdatadir)/include$${multi_dir}/limits.h; \
+	done
+	$(INSTALL_SCRIPT) $(srcdir)/../mkinstalldirs \
+		$(DESTDIR)$(itoolsdir)/mkinstalldirs ; \
 	if [ x$(STMP_FIXPROTO) != x ] ; then \
-	  $(INSTALL_SCRIPT) $(mkinstalldirs) \
-		$(DESTDIR)$(itoolsdir)/mkinstalldirs ; \
 	  $(INSTALL_SCRIPT) $(srcdir)/fixproto $(DESTDIR)$(itoolsdir)/fixproto ; \
 	  $(INSTALL_PROGRAM) build/fix-header$(build_exeext) \
 		$(DESTDIR)$(itoolsdir)/fix-header$(build_exeext) ; \
 	else :; fi
-	echo 'SYSTEM_HEADER_DIR="'"$(SYSTEM_HEADER_DIR)"'"' \
+	sysroot_headers_suffix='$${sysroot_headers_suffix}'; \
+		echo 'SYSTEM_HEADER_DIR="'"$(SYSTEM_HEADER_DIR)"'"' \
 		> $(DESTDIR)$(itoolsdatadir)/mkheaders.conf
 	echo 'OTHER_FIXINCLUDES_DIRS="$(OTHER_FIXINCLUDES_DIRS)"' \
 		>> $(DESTDIR)$(itoolsdatadir)/mkheaders.conf

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Gcc-patches mailing list