genopt.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/sh
  2. # Generate m68k-tables.opt from the lists in *.def.
  3. # Copyright (C) 2011-2015 Free Software Foundation, Inc.
  4. #
  5. # This file is part of GCC.
  6. #
  7. # GCC is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 3, or (at your option)
  10. # any later version.
  11. #
  12. # GCC is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with GCC; see the file COPYING3. If not see
  19. # <http://www.gnu.org/licenses/>.
  20. cat <<EOF
  21. ; -*- buffer-read-only: t -*-
  22. ; Generated automatically by genopt.sh from m68k-devices.def,
  23. ; m68k-isas.def and m68k-microarchs.def.
  24. ; Copyright (C) 2011-2015 Free Software Foundation, Inc.
  25. ;
  26. ; This file is part of GCC.
  27. ;
  28. ; GCC is free software; you can redistribute it and/or modify it under
  29. ; the terms of the GNU General Public License as published by the Free
  30. ; Software Foundation; either version 3, or (at your option) any later
  31. ; version.
  32. ;
  33. ; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  34. ; WARRANTY; without even the implied warranty of MERCHANTABILITY or
  35. ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  36. ; for more details.
  37. ;
  38. ; You should have received a copy of the GNU General Public License
  39. ; along with GCC; see the file COPYING3. If not see
  40. ; <http://www.gnu.org/licenses/>.
  41. Enum
  42. Name(target_device) Type(enum target_device)
  43. Known M68K CPUs (for use with the -mcpu= option):
  44. EOF
  45. awk -F'[(, ]+' '/^M68K_DEVICE/ {
  46. name = $2
  47. enum = $3
  48. gsub("\"", "", name)
  49. print "EnumValue"
  50. print "Enum(target_device) String(" name ") Value(" enum ")"
  51. print ""
  52. }' $1/m68k-devices.def
  53. cat <<EOF
  54. Enum
  55. Name(uarch_type) Type(enum uarch_type)
  56. Known M68K microarchitectures (for use with the -mtune= option):
  57. EOF
  58. awk -F'[(, ]+' '/^M68K_MICROARCH/ {
  59. name = $2
  60. enum = $4
  61. gsub("\"", "", name)
  62. print "EnumValue"
  63. print "Enum(uarch_type) String(" name ") Value(u" enum ")"
  64. print ""
  65. }' $1/m68k-microarchs.def
  66. cat <<EOF
  67. Enum
  68. Name(m68k_isa) Type(int)
  69. Known M68K ISAs (for use with the -march= option):
  70. EOF
  71. awk -F'[(, ]+' 'BEGIN {
  72. value = 0
  73. }
  74. /^M68K_ISA/ {
  75. name = $2
  76. gsub("\"", "", name)
  77. print "EnumValue"
  78. print "Enum(m68k_isa) String(" name ") Value(" value ")"
  79. print ""
  80. value++
  81. }' $1/m68k-isas.def