generate-cmdlist.sh 1.1 KB

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