71 lines · bash
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.03 4echo "/* Automatically generated by $0 */5struct cmdname_help6{7 char name[16];8 char help[80];9};10 11static struct cmdname_help common_cmds[] = {"12 13sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt |14sort |15while read cmd16do17 sed -n '18 /^NAME/,/perf-'"$cmd"'/H19 ${20 x21 s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/22 p23 }' "Documentation/perf-$cmd.txt"24done25 26echo "#ifdef HAVE_LIBELF_SUPPORT"27sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt |28sort |29while read cmd30do31 sed -n '32 /^NAME/,/perf-'"$cmd"'/H33 ${34 x35 s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/36 p37 }' "Documentation/perf-$cmd.txt"38done39echo "#endif /* HAVE_LIBELF_SUPPORT */"40 41echo "#if defined(HAVE_LIBTRACEEVENT) && (defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT))"42sed -n -e 's/^perf-\([^ ]*\)[ ].* audit*/\1/p' command-list.txt |43sort |44while read cmd45do46 sed -n '47 /^NAME/,/perf-'"$cmd"'/H48 ${49 x50 s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/51 p52 }' "Documentation/perf-$cmd.txt"53done54echo "#endif /* HAVE_LIBTRACEEVENT && (HAVE_LIBAUDIT_SUPPORT || HAVE_SYSCALL_TABLE_SUPPORT) */"55 56echo "#ifdef HAVE_LIBTRACEEVENT"57sed -n -e 's/^perf-\([^ ]*\)[ ].* traceevent.*/\1/p' command-list.txt |58sort |59while read cmd60do61 sed -n '62 /^NAME/,/perf-'"$cmd"'/H63 ${64 x65 s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/66 p67 }' "Documentation/perf-$cmd.txt"68done69echo "#endif /* HAVE_LIBTRACEEVENT */"70echo "};"71