]> git.ipfire.org Git - thirdparty/util-linux.git/blame - tools/all_syscalls
all_errnos/all_syscalls: don't hardcode AWK invocation
[thirdparty/util-linux.git] / tools / all_syscalls
CommitLineData
c40293ed 1#!/bin/bash
69e542bd 2
8e7f8b4d 3set -e
7522d8df 4set -o pipefail
8e7f8b4d 5
543f991f
TW
6AWK="$1"
7shift
69e542bd
TW
8OUTPUT=syscalls.h
9SYSCALL_INCLUDES="
10#include <sys/syscall.h>
11"
12
4d5441ec 13trap 'rm -f $OUTPUT $OUTPUT.deps' ERR
69e542bd 14
c40293ed 15"$@" -MD -MF "$OUTPUT.deps" <<< "$SYSCALL_INCLUDES" -dM -E - \
543f991f 16 | "$AWK" 'match($0, /^#define __NR_([^ ]+)/, res) { print "UL_SYSCALL(\"" res[1] "\", __NR_" res[1] ")" }' \
69e542bd 17 | sort \
8e7f8b4d 18 > "$OUTPUT"