OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
1.8 KiB

  1. #!/bin/sh -e
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: package/.../linux-header/generate-asm
  6. # Copyright (C) 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. # Idea borrowed from RedHat's kernel package
  16. # Borrowed from Debian GNU/Linux for sparc64
  17. # Extended for x86-64 and T2 -ReneR
  18. # Usage:
  19. dir="$1"
  20. name1="asm-$2"
  21. name2="asm-$3"
  22. define="$4"
  23. if [ ! -d "$dir" ] ; then
  24. echo E: $dir is not a directory.
  25. exit 1
  26. fi
  27. cd $dir
  28. if [ ! -d "$name1" -o ! -d "$name2" ] ; then
  29. echo E: $name1 and $name2 must exist, or you will have problems.
  30. exit 1
  31. fi
  32. if [ ! "$define" ] ; then
  33. echo E: No define specified - this will not work.
  34. exit 1
  35. fi
  36. rm -rf asm
  37. mkdir asm
  38. for h in `( ls $name1; ls $name2 ) | grep '\.h$' | sort -u`; do
  39. name=`echo $h | tr a-z. A-Z_`
  40. # common header
  41. cat > asm/$h << EOF
  42. /* All asm/ files are generated and point to the corresponding
  43. * file in $name1 or $name2.
  44. */
  45. #ifndef __ASMSTUB__${name}__
  46. #define __ASMSTUB__${name}__
  47. EOF
  48. # common for $name1 and $name2
  49. if [ -f $name1/$h -a -f $name2/$h ]; then
  50. cat >> asm/$h <<EOF
  51. #ifdef $define
  52. #include <$name2/$h>
  53. #else
  54. #include <$name1/$h>
  55. #endif
  56. EOF
  57. # $name1 only
  58. elif [ -f $name1/$h ]; then
  59. cat >> asm/$h <<EOF
  60. #ifndef $define
  61. #include <$name1/$h>
  62. #endif
  63. EOF
  64. # $name2 only
  65. else
  66. cat >> asm/$h <<EOF
  67. #ifdef $define
  68. #include <$name2/$h>
  69. #endif
  70. EOF
  71. fi
  72. # common footer
  73. cat >> asm/$h <<EOF
  74. #endif /* !__ASMSTUB__${name}__ */
  75. EOF
  76. done