generate-cmdlist.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0
  3. echo "/* Automatically generated by $0 */
  4. struct cmdname_help
  5. {
  6. char name[16];
  7. char help[80];
  8. };
  9. static struct cmdname_help common_cmds[] = {"
  10. sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt |
  11. sort |
  12. while read cmd
  13. do
  14. sed -n '
  15. /^NAME/,/perf-'"$cmd"'/H
  16. ${
  17. x
  18. s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
  19. p
  20. }' "Documentation/perf-$cmd.txt"
  21. done
  22. echo "#ifdef HAVE_LIBELF_SUPPORT"
  23. sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt |
  24. sort |
  25. while read cmd
  26. do
  27. sed -n '
  28. /^NAME/,/perf-'"$cmd"'/H
  29. ${
  30. x
  31. s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
  32. p
  33. }' "Documentation/perf-$cmd.txt"
  34. done
  35. echo "#endif /* HAVE_LIBELF_SUPPORT */"
  36. echo "#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT)"
  37. sed -n -e 's/^perf-\([^ ]*\)[ ].* audit*/\1/p' command-list.txt |
  38. sort |
  39. while read cmd
  40. do
  41. sed -n '
  42. /^NAME/,/perf-'"$cmd"'/H
  43. ${
  44. x
  45. s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
  46. p
  47. }' "Documentation/perf-$cmd.txt"
  48. done
  49. echo "#endif /* HAVE_LIBELF_SUPPORT */"
  50. echo "};"