Russell King | 96a8fae | 2016-10-18 19:57:01 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | in="$1" |
| 4 | out="$2" |
| 5 | my_abis=`echo "($3)" | tr ',' '|'` |
| 6 | prefix="$4" |
| 7 | offset="$5" |
| 8 | |
| 9 | fileguard=_ASM_ARM_`basename "$out" | sed \ |
| 10 | -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ |
| 11 | -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` |
| 12 | if echo $out | grep -q uapi; then |
| 13 | fileguard="_UAPI$fileguard" |
| 14 | fi |
| 15 | grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( |
| 16 | echo "#ifndef ${fileguard}" |
| 17 | echo "#define ${fileguard} 1" |
| 18 | echo "" |
| 19 | |
| 20 | while read nr abi name entry ; do |
| 21 | if [ -z "$offset" ]; then |
| 22 | echo "#define __NR_${prefix}${name} $nr" |
| 23 | else |
| 24 | echo "#define __NR_${prefix}${name} ($offset + $nr)" |
| 25 | fi |
| 26 | done |
| 27 | |
| 28 | echo "" |
| 29 | echo "#endif /* ${fileguard} */" |
| 30 | ) > "$out" |