gcc/fixincludes/mkheaders.in
Joseph Myers 14da607343 re PR bootstrap/31020 (cannot write in </test/gnu/gcc/objdir/prev-gcc/../gcc/./include>)
fixincludes:
	* mkheaders.in: Fix headers for each multilib required.

gcc:
	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.

From-SVN: r122620
2007-03-06 15:50:28 +00:00

111 lines
3.3 KiB
Bash

#!/bin/sh
# Copyright (C) 2002, 2007 Free Software Foundation, Inc.
#This file is part of GCC.
#GCC is free software; you can redistribute it and/or modify it under
#the terms of the GNU General Public License as published by the Free
#Software Foundation; either version 2, or (at your option) any later
#version.
#GCC is distributed in the hope that it will be useful, but WITHOUT
#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
#for more details.
#You should have received a copy of the GNU General Public License
#along with GCC; see the file COPYING. If not, write to the Free
#Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#02110-1301, USA.
# Basic information
target=@target@
target_noncanonical=@target_noncanonical@
version=@gcc_version@
VERBOSE=0
while [ x$1 = x-v ] ; do
shift
VERBOSE=`expr $VERBOSE + 1`
done
export VERBOSE
if [ x$1 = x--help ] ; then
echo "Usage: mkheaders [options] [prefix [isysroot]]"
echo "Options:"
echo " -v Print more output (may be repeated for even more output)"
echo " --help This help"
echo " --version Print version information"
exit 0
fi
if [ x$1 = x--version ] ; then
echo "mkheaders (GCC) version $version"
echo "Copyright 2002, 2007 Free Software Foundation, Inc."
echo "This program is free software; you may redistribute it under the"
echo "terms of the GNU General Public License. This program has"
echo "absolutely no warranty."
exit 0
fi
# Common prefix for installation directories.
if [ x$1 != x ] ; then
prefix=$1
shift
else
prefix=@prefix@
fi
# Allow for alternate isysroot in which to find headers
if [ x$1 != x ] ; then
isysroot=$1
shift
else
isysroot=
fi
# Directory in which to put host dependent programs and libraries
exec_prefix=@exec_prefix@
# Directory in which to put the directories used by the compiler.
libdir=@libdir@
libexecdir=@libexecdir@
# Directory in which the compiler finds libraries, etc.
libsubdir=${libdir}/gcc/${target_noncanonical}/${version}
# Directory in which the compiler finds executables
libexecsubdir=${libexecdir}/gcc/${target_noncanonical}/${version}
itoolsdir=${libexecsubdir}/install-tools
itoolsdatadir=${libsubdir}/install-tools
incdir=${libsubdir}/include-fixed
mkinstalldirs="@SHELL@ ${itoolsdir}/mkinstalldirs"
cd ${itoolsdir}
rm -rf ${incdir}/*
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 ${subincdir} \
${isysroot}${SYSTEM_HEADER_DIR} ${OTHER_FIXINCLUDES_DIRS}
rm -f ${subincdir}/syslimits.h
if [ -f ${subincdir}/limits.h ]; then
mv ${subincdir}/limits.h ${subincdir}/syslimits.h
else
cp ${itoolsdatadir}/gsyslimits.h ${subincdir}/syslimits.h
fi
fi
cp ${itoolsdatadir}/include${multi_dir}/limits.h ${subincdir}
if [ x${STMP_FIXPROTO} != x ] ; then
export FIXPROTO_DEFINES mkinstalldirs
@SHELL@ fixproto ${subincdir} ${subincdir} ${isysroot}${SYSTEM_HEADER_DIR} || exit 1
fi
done