aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/make-syscalls.sh
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-01-18 10:00:52 +0000
committerRoland McGrath <roland@gnu.org>1996-01-18 10:00:52 +0000
commitaeb72b162283156ff33f5d4d86533fadb758126b (patch)
tree19cf5dd72ebb72beda243e565af9f5117750a1a9 /sysdeps/unix/make-syscalls.sh
parent285a3eee46e60a9dde6275bc1714546150492da4 (diff)
downloadglibc-aeb72b162283156ff33f5d4d86533fadb758126b.tar
glibc-aeb72b162283156ff33f5d4d86533fadb758126b.tar.gz
glibc-aeb72b162283156ff33f5d4d86533fadb758126b.tar.bz2
glibc-aeb72b162283156ff33f5d4d86533fadb758126b.zip
Thu Jan 18 00:32:43 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>cvs/libc-960118
* Makerules (COMPILE.s): New variable. * sysdeps/unix/Makefile (sysd-syscalls): New target; generate with make-syscalls.sh and include it. [$(subdir)=misc] (sysdep_routines): Append extra syscalls from sysd-syscalls. * sysdeps/unix/make-syscalls.sh: New file. * Makerules (COMPILE.S): New variable.
Diffstat (limited to 'sysdeps/unix/make-syscalls.sh')
-rw-r--r--sysdeps/unix/make-syscalls.sh76
1 files changed, 76 insertions, 0 deletions
diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh
new file mode 100644
index 0000000000..ff4b082b11
--- /dev/null
+++ b/sysdeps/unix/make-syscalls.sh
@@ -0,0 +1,76 @@
+#! /bin/sh
+
+# Usage: make-syscalls.sh ../sysdeps unix/common
+# Expects $sysdirs in environment.
+
+sysbase=$1; shift
+thisdir=$1; shift
+
+# Get the list of system calls for this directory.
+calls=`sed 's/#.*$//
+/^[ ]*$/d' $sysbase/$thisdir/syscalls.list`
+
+# Check each sysdep dir with higher priority than this one,
+# and remove from $calls all the functions found in other dirs.
+for dir in $sysdirs; do
+
+ # Punt when we reach the directory defining these syscalls.
+ test $dir = $thisdir && break
+
+ # Remove each syscall that is implemented by a file in $dir.
+ # If a syscall specified a "caller", then only compile that syscall
+ # if the caller function is also implemented in this directory.
+ calls=`echo "$calls" | while read file caller rest; do
+ test -f $sysbase/$dir/$file.c && continue
+ test -f $sysbase/$dir/$file.S && continue
+ test -f $sysbase/$dir/$file.s && continue
+ if test x$caller != x-; then
+ test -f $sysbase/$dir/$caller.c && continue
+ test -f $sysbase/$dir/$caller.S && continue
+ test -f $sysbase/$dir/$caller.s && continue
+ fi
+ echo $file $caller $rest
+ done`
+
+done
+
+# Any calls left?
+test -n "$calls" || exit 0
+
+files=
+
+# Emit rules to compile the syscalls remaining in $calls.
+echo "$calls" | while read file caller syscall nargs strong weak; do
+
+ # Figure out if $syscall is defined with a number in syscall.h.
+ $asm_CPP - << EOF | grep "^@@@ .*$syscall" >/dev/null && continue
+#include <sysdep.h>
+@@@ SYS_ify ($syscall)
+EOF
+
+ # Make sure only the first syscall rule is used, if multiple dirs
+ # define the same syscall.
+ echo "ifeq (,\$(filter $file,\$(unix-syscalls)))"
+
+ # Accumulate the list of syscall files for this directory.
+ echo "unix-syscalls += $file"
+ test x$caller = x- || echo "unix-extra-syscalls += $file"
+
+ # Emit a compilation rule for this syscall.
+ echo "\
+\$(foreach o,\$(object-suffixes),\$(objpfx)$file\$o): \$(objpfx)s-proto.d
+ (echo '#include <sysdep.h>'; \\
+ echo 'PSEUDO ($strong, $syscall, $nargs)'; \\
+ echo ' ret'; \\"
+
+ # Append any weak aliases defined for this syscall function.
+ for name in $weak; do
+ echo " echo 'weak_alias ($strong, $name)'; \\"
+ done
+
+ # And finally, pipe this all into the compiler.
+ echo ' ) | $(COMPILE.S) -x assembler-with-cpp -o $@ -'
+
+ echo endif
+
+done