#!/bin/sh # SPDX-License-Identifier: GPL-2.0 # # Generate C file mapping errno codes to errno names. # # Copyright IBM Corp. 2018 # Author(s): Hendrik Brueckner gcc="$1" toolsdir="$2" include_path="-I$toolsdir/include/uapi" arch_string() { echo "$1" |sed -e 'y/- /__/' |tr '[[:upper:]]' '[[:lower:]]' } asm_errno_file() { local arch="$1" local header header="$toolsdir/arch/$arch/include/uapi/asm/errno.h" if test -r "$header"; then echo "$header" else echo "$toolsdir/include/uapi/asm-generic/errno.h" fi } create_errno_lookup_func() { local arch=$(arch_string "$1") local nr name cat < EoHEADER # Create list of architectures and ignore those that do not appear # in tools/perf/arch archlist="" for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | grep -v x86 | sort); do test -d $toolsdir/perf/arch/$arch && archlist="$archlist $arch" done for arch in x86 $archlist generic; do process_arch "$arch" done create_arch_errno_table_func "x86 $archlist" "generic"