]>
Commit | Line | Data |
---|---|---|
e34a3d31 GK |
1 | #!/bin/sh |
2 | ||
52c0e446 | 3 | # Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc. |
e34a3d31 GK |
4 | |
5 | #This file is part of GCC. | |
6 | ||
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 | |
748086b7 | 9 | #Software Foundation; either version 3, or (at your option) any later |
e34a3d31 GK |
10 | #version. |
11 | ||
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. | |
16 | ||
17 | #You should have received a copy of the GNU General Public License | |
748086b7 JJ |
18 | #along with GCC; see the file COPYING3. If not see |
19 | #<http://www.gnu.org/licenses/>. | |
e34a3d31 GK |
20 | |
21 | # Basic information | |
22 | target=@target@ | |
caa55b1e | 23 | target_noncanonical=@target_noncanonical@ |
e34a3d31 GK |
24 | version=@gcc_version@ |
25 | ||
26 | VERBOSE=0 | |
27 | while [ x$1 = x-v ] ; do | |
28 | shift | |
29 | VERBOSE=`expr $VERBOSE + 1` | |
30 | done | |
31 | export VERBOSE | |
32 | ||
33 | if [ x$1 = x--help ] ; then | |
3c1c7aae | 34 | echo "Usage: mkheaders [options] [prefix [isysroot]]" |
e34a3d31 GK |
35 | echo "Options:" |
36 | echo " -v Print more output (may be repeated for even more output)" | |
37 | echo " --help This help" | |
38 | echo " --version Print version information" | |
39 | exit 0 | |
40 | fi | |
41 | ||
42 | if [ x$1 = x--version ] ; then | |
43 | echo "mkheaders (GCC) version $version" | |
a3d37119 | 44 | echo "Copyright 2002, 2007, 2009 Free Software Foundation, Inc." |
e34a3d31 GK |
45 | echo "This program is free software; you may redistribute it under the" |
46 | echo "terms of the GNU General Public License. This program has" | |
47 | echo "absolutely no warranty." | |
48 | exit 0 | |
49 | fi | |
50 | ||
51 | # Common prefix for installation directories. | |
52 | if [ x$1 != x ] ; then | |
53 | prefix=$1 | |
3c1c7aae | 54 | shift |
e34a3d31 GK |
55 | else |
56 | prefix=@prefix@ | |
57 | fi | |
3c1c7aae MS |
58 | |
59 | # Allow for alternate isysroot in which to find headers | |
60 | if [ x$1 != x ] ; then | |
61 | isysroot=$1 | |
62 | shift | |
63 | else | |
64 | isysroot= | |
65 | fi | |
66 | ||
e34a3d31 GK |
67 | # Directory in which to put host dependent programs and libraries |
68 | exec_prefix=@exec_prefix@ | |
69 | # Directory in which to put the directories used by the compiler. | |
70 | libdir=@libdir@ | |
a8ee6e2d GK |
71 | libexecdir=@libexecdir@ |
72 | # Directory in which the compiler finds libraries, etc. | |
6b3b5f05 | 73 | libsubdir=${libdir}/gcc/${target_noncanonical}/${version} |
a8ee6e2d | 74 | # Directory in which the compiler finds executables |
caa55b1e | 75 | libexecsubdir=${libexecdir}/gcc/${target_noncanonical}/${version} |
e34a3d31 | 76 | |
a8ee6e2d GK |
77 | itoolsdir=${libexecsubdir}/install-tools |
78 | itoolsdatadir=${libsubdir}/install-tools | |
f686ec05 | 79 | incdir=${libsubdir}/include-fixed |
afbffe08 | 80 | mkinstalldirs="${itoolsdir}/mkinstalldirs" |
e34a3d31 GK |
81 | |
82 | cd ${itoolsdir} | |
83 | rm -rf ${incdir}/* | |
84 | ||
afbffe08 AO |
85 | for shell in $CONFIG_SHELL $SHELL @SHELL@ /bin/sh ""; do |
86 | if { test -x $shell || test -x $shell.exe; } \ | |
87 | && $shell $mkinstalldirs > /dev/null 2>&1; then | |
88 | mkinstalldirs="$shell $mkinstalldirs" | |
89 | break | |
90 | elif test x$shell = x; then | |
91 | if $mkinstalldirs > /dev/null 2>&1; then | |
92 | break | |
93 | elif test ! -f $mkinstalldirs; then | |
94 | echo mkheaders: could not find $mkinstalldirs >&2 | |
95 | exit 1 | |
96 | else | |
97 | echo mkheaders: please rerun with CONFIG_SHELL set to a working Bourne shell >&2 | |
98 | exit 1 | |
99 | fi | |
100 | fi | |
101 | done | |
102 | ||
14da6073 JM |
103 | for ml in `cat ${itoolsdatadir}/fixinc_list`; do |
104 | sysroot_headers_suffix=`echo ${ml} | sed -e 's/;.*$//'` | |
105 | multi_dir=`echo ${ml} | sed -e 's/^[^;]*;//'` | |
106 | subincdir=${incdir}${multi_dir} | |
0a649b83 | 107 | ${mkinstalldirs} ${subincdir} |
14da6073 JM |
108 | . ${itoolsdatadir}/mkheaders.conf |
109 | if [ x${STMP_FIXINC} != x ] ; then | |
e34a3d31 | 110 | TARGET_MACHINE="${target}" target_canonical="${target}" \ |
53c7ffe7 | 111 | MACRO_LIST="${itoolsdatadir}/macro_list" \ |
afbffe08 | 112 | $shell ./fixinc.sh ${subincdir} \ |
3c1c7aae | 113 | ${isysroot}${SYSTEM_HEADER_DIR} ${OTHER_FIXINCLUDES_DIRS} |
14da6073 JM |
114 | rm -f ${subincdir}/syslimits.h |
115 | if [ -f ${subincdir}/limits.h ]; then | |
116 | mv ${subincdir}/limits.h ${subincdir}/syslimits.h | |
e34a3d31 | 117 | else |
14da6073 | 118 | cp ${itoolsdatadir}/gsyslimits.h ${subincdir}/syslimits.h |
e34a3d31 | 119 | fi |
14da6073 | 120 | fi |
e34a3d31 | 121 | |
0a649b83 | 122 | cp ${itoolsdatadir}/include${multi_dir}/limits.h ${subincdir}/limits.h |
14da6073 | 123 | done |