1*656a46fbSLaurent Vivier#!/bin/sh 2*656a46fbSLaurent Vivier# SPDX-License-Identifier: GPL-2.0 3*656a46fbSLaurent Vivier 4*656a46fbSLaurent Vivierin="$1" 5*656a46fbSLaurent Vivierout="$2" 6*656a46fbSLaurent Viviermy_abis=`echo "($3)" | tr ',' '|'` 7*656a46fbSLaurent Vivierprefix="$4" 8*656a46fbSLaurent Vivieroffset="$5" 9*656a46fbSLaurent Vivier 10*656a46fbSLaurent Vivierfileguard=LINUX_USER_OPENRISC_`basename "$out" | sed \ 11*656a46fbSLaurent Vivier -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ 12*656a46fbSLaurent Vivier -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` 13*656a46fbSLaurent Viviergrep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( 14*656a46fbSLaurent Vivier echo "#ifndef ${fileguard}" 15*656a46fbSLaurent Vivier echo "#define ${fileguard} 1" 16*656a46fbSLaurent Vivier echo "" 17*656a46fbSLaurent Vivier 18*656a46fbSLaurent Vivier while read nr abi name entry ; do 19*656a46fbSLaurent Vivier if [ -z "$offset" ]; then 20*656a46fbSLaurent Vivier echo "#define TARGET_NR_${prefix}${name} $nr" 21*656a46fbSLaurent Vivier else 22*656a46fbSLaurent Vivier echo "#define TARGET_NR_${prefix}${name} ($offset + $nr)" 23*656a46fbSLaurent Vivier fi 24*656a46fbSLaurent Vivier done 25*656a46fbSLaurent Vivier 26*656a46fbSLaurent Vivier echo "" 27*656a46fbSLaurent Vivier echo "#endif /* ${fileguard} */" 28*656a46fbSLaurent Vivier) > "$out" 29