summaryrefslogtreecommitdiff
path: root/src/pkg/syscall/mkerrors.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/syscall/mkerrors.sh')
-rwxr-xr-xsrc/pkg/syscall/mkerrors.sh20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/pkg/syscall/mkerrors.sh b/src/pkg/syscall/mkerrors.sh
index 84f1e59a1..467ebe38c 100755
--- a/src/pkg/syscall/mkerrors.sh
+++ b/src/pkg/syscall/mkerrors.sh
@@ -61,6 +61,18 @@ includes='
#include <signal.h>
'
+ccflags=""
+next=false
+for i
+do
+ if $next; then
+ ccflags="$ccflags $i"
+ next=false
+ elif [ "$i" = "-f" ]; then
+ next=true
+ fi
+done
+
# Write godefs input.
(
indirect="includes_$(uname)"
@@ -70,7 +82,7 @@ includes='
# The gcc command line prints all the #defines
# it encounters while processing the input
- echo "${!indirect} $includes" | $GCC -x c - -E -dM |
+ echo "${!indirect} $includes" | $GCC -x c - -E -dM $ccflags |
awk '
$1 != "#define" || $2 ~ /\(/ {next}
@@ -94,7 +106,7 @@ includes='
# Pull out just the error names for later.
errors=$(
- echo '#include <errno.h>' | $GCC -x c - -E -dM |
+ echo '#include <errno.h>' | $GCC -x c - -E -dM $ccflags |
awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print $2 }' |
sort
)
@@ -102,7 +114,7 @@ errors=$(
echo '// mkerrors.sh' "$@"
echo '// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT'
echo
-godefs -gsyscall "$@" _const.c
+godefs "$@" -gsyscall "$@" _const.c
# Run C program to print error strings.
(
@@ -155,4 +167,4 @@ main(void)
'
) >_errors.c
-gcc -o _errors _errors.c && ./_errors && rm -f _errors.c _errors _const.c
+gcc $ccflags -o _errors _errors.c && ./_errors && rm -f _errors.c _errors _const.c