mkheaders.in 3.6 KB

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