summaryrefslogtreecommitdiff
path: root/gcc/mkheaders.in
blob: a97c49edf59441f512af4a4b75070b219ee0d503 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh

# Copyright (C) 2002 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, 59 Temple Place - Suite 330, Boston, MA
#02111-1307, USA.

# Basic information
target=@target@
target_alias=@target_alias@
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]"
    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 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
else
  prefix=@prefix@
fi
# 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'.
# NOTE: local_prefix *should not* default from prefix.
local_prefix=@local_prefix@
# 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@
# Directory in which the compiler finds executables, libraries, etc.
libsubdir=${libdir}/gcc-lib/${target_alias}/${version}
# Since gcc_tooldir does not exist at build-time, use -B${build_tooldir}/bin/
build_tooldir=${exec_prefix}/${target_alias}
# Directory to search for site-specific includes.
local_includedir=${local_prefix}/include
includedir=${prefix}/include

itoolsdir=${libsubdir}/install-tools
incdir=${libsubdir}/include

. ${itoolsdir}/mkheaders.conf

cd ${itoolsdir}
rm -rf ${incdir}/*

if [ x${STMP_FIXINC} != x ] ; then
	TARGET_MACHINE="${target}" target_canonical="${target}" \
	    ${SHELL} ./fixinc.sh ${incdir} \
	    ${SYSTEM_HEADER_DIR} ${OTHER_FIXINCLUDES_DIRS}
	rm -f ${incdir}/syslimits.h
	if [ -f ${incdir}/limits.h ]; then
	  mv ${incdir}/limits.h ${incdir}/syslimits.h
	else
	  cp gsyslimits.h ${incdir}/syslimits.h
	fi
fi

cp include/* ${incdir}

if [ x${STMP_FIXPROTO} != x ] ; then
  mkinstalldirs="${SHELL} ${itoolsdir}/mkinstalldirs"
  export FIXPROTO_DEFINES mkinstalldirs
  ${SHELL} fixproto ${incdir} ${incdir} ${SYSTEM_HEADER_DIR} || exit 1
fi