2008-06-04 Xinliang David Li <davidxl@google.com>
[official-gcc.git] / fixincludes / mkheaders.in
blobb584b68d6aff1a17fff72f130483f7c840ee0d89
1 #!/bin/sh
3 # Copyright (C) 2002, 2007 Free Software Foundation, Inc.
5 #This file is part of GCC.
7 #GCC is free software; you can redistribute it and/or modify it under
8 #the terms of the GNU General Public License as published by the Free
9 #Software Foundation; either version 2, or (at your option) any later
10 #version.
12 #GCC is distributed in the hope that it will be useful, but WITHOUT
13 #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 #for more details.
17 #You should have received a copy of the GNU General Public License
18 #along with GCC; see the file COPYING. If not, write to the Free
19 #Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20 #02110-1301, USA.
22 # Basic information
23 target=@target@
24 target_noncanonical=@target_noncanonical@
25 version=@gcc_version@
27 VERBOSE=0
28 while [ x$1 = x-v ] ; do
29 shift
30 VERBOSE=`expr $VERBOSE + 1`
31 done
32 export VERBOSE
34 if [ x$1 = x--help ] ; then
35 echo "Usage: mkheaders [options] [prefix [isysroot]]"
36 echo "Options:"
37 echo " -v Print more output (may be repeated for even more output)"
38 echo " --help This help"
39 echo " --version Print version information"
40 exit 0
43 if [ x$1 = x--version ] ; then
44 echo "mkheaders (GCC) version $version"
45 echo "Copyright 2002, 2007 Free Software Foundation, Inc."
46 echo "This program is free software; you may redistribute it under the"
47 echo "terms of the GNU General Public License. This program has"
48 echo "absolutely no warranty."
49 exit 0
52 # Common prefix for installation directories.
53 if [ x$1 != x ] ; then
54 prefix=$1
55 shift
56 else
57 prefix=@prefix@
60 # Allow for alternate isysroot in which to find headers
61 if [ x$1 != x ] ; then
62 isysroot=$1
63 shift
64 else
65 isysroot=
68 # Directory in which to put host dependent programs and libraries
69 exec_prefix=@exec_prefix@
70 # Directory in which to put the directories used by the compiler.
71 libdir=@libdir@
72 libexecdir=@libexecdir@
73 # Directory in which the compiler finds libraries, etc.
74 libsubdir=${libdir}/gcc/${target_noncanonical}/${version}
75 # Directory in which the compiler finds executables
76 libexecsubdir=${libexecdir}/gcc/${target_noncanonical}/${version}
78 itoolsdir=${libexecsubdir}/install-tools
79 itoolsdatadir=${libsubdir}/install-tools
80 incdir=${libsubdir}/include-fixed
81 mkinstalldirs="@SHELL@ ${itoolsdir}/mkinstalldirs"
83 cd ${itoolsdir}
84 rm -rf ${incdir}/*
86 for ml in `cat ${itoolsdatadir}/fixinc_list`; do
87 sysroot_headers_suffix=`echo ${ml} | sed -e 's/;.*$//'`
88 multi_dir=`echo ${ml} | sed -e 's/^[^;]*;//'`
89 subincdir=${incdir}${multi_dir}
90 . ${itoolsdatadir}/mkheaders.conf
91 if [ x${STMP_FIXINC} != x ] ; then
92 TARGET_MACHINE="${target}" target_canonical="${target}" \
93 MACRO_LIST="${itoolsdatadir}/macro_list" \
94 @SHELL@ ./fixinc.sh ${subincdir} \
95 ${isysroot}${SYSTEM_HEADER_DIR} ${OTHER_FIXINCLUDES_DIRS}
96 rm -f ${subincdir}/syslimits.h
97 if [ -f ${subincdir}/limits.h ]; then
98 mv ${subincdir}/limits.h ${subincdir}/syslimits.h
99 else
100 cp ${itoolsdatadir}/gsyslimits.h ${subincdir}/syslimits.h
104 cp ${itoolsdatadir}/include${multi_dir}/limits.h ${subincdir}
106 if [ x${STMP_FIXPROTO} != x ] ; then
107 export FIXPROTO_DEFINES mkinstalldirs
108 @SHELL@ fixproto ${subincdir} ${subincdir} ${isysroot}${SYSTEM_HEADER_DIR} || exit 1
110 done