using sh removes the bash dependencies, for those who don't have
bash on their system, and replaced the GNU awk with a portable
grep and sed.
-#!/bin/bash
+#!/bin/sh
set -e
trap 'rm $OUTPUT $OUTPUT.deps' ERR
-"$@" -MD -MF "$OUTPUT.deps" <<< "$SYSCALL_INCLUDES" -dM -E - \
- | gawk 'match($0, /^#define __NR_([^ ]+)/, res) { print "UL_SYSCALL(\"" res[1] "\", __NR_" res[1] ")" }' \
+echo "$SYSCALL_INCLUDES" \
+ | "$@" -MD -MF "$OUTPUT.deps" -dM -E - \
+ | grep '^#define __NR_' \
+ | sed 's/#define __NR_\([^[:space:]]*\).*/UL_SYSCALL("\1", __NR_\1)/' \
| sort \
> "$OUTPUT"