summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-06-06 04:54:33 +0000
committerRoland McGrath <roland@gnu.org>1996-06-06 04:54:33 +0000
commitf127cd28b5f758a512fcd09e317e720c16bce3b4 (patch)
tree3ca10f40ca7f3cd9e7a1491545c475f609708794 /sysdeps
parentdfe1754a556c167df741843ef0114f5325717a7c (diff)
downloadglibc-f127cd28b5f758a512fcd09e317e720c16bce3b4.tar.gz
Thu Jun 6 00:02:15 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* locale/Makefile: Add vpath for %.gperf to programs. * Make-dist (+tsrcs): Variable removed. (dist): Process $^ here instead of using $(+tsrcs). * sysdeps/unix/sysv/linux/Makefile (install-others): Don't set. ($(includedir)/sys/syscall.h): Target removed. (sysdep_headers): Add syscall-list.h. ($(objpfx)syscall-%.[dh]): New rule to build syscall-list.[dh]. (generated): Add those. * sysdeps/unix/sysv/linux/syscall.h: Include <syscall-list.h>. * misc/sys/syscall.h: New file. * misc/Makefile (headers): Add sys/syscall.h. * sysdeps/unix/sysv/linux/i386/Makefile: Likewise.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/Makefile41
-rw-r--r--sysdeps/unix/sysv/linux/syscall.h8
2 files changed, 26 insertions, 23 deletions
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index ec5119e408..8d351c4046 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -18,29 +18,24 @@ ifeq ($(subdir), misc)
sysdep_routines += mount umount xmknod s_ptrace s_sysctl sysctl llseek \
setfsgid setfsuid sysinfo uselib s_reboot
-sysdep_headers += sys/mount.h sys/sysinfo.h sys/acct.h sys/sysctl.h sys/module.h \
- sys/io.h sys/klog.h sys/kdaemon.h
-
-install-others += $(includedir)/sys/syscall.h
-
-$(includedir)/sys/syscall.h::
- @rm -f $(objpfx)syscall.h $(objpfx)syscall.sed
- @(os=`uname -sr`; \
- echo -e '1i\\\n#ifndef _SYS_SYSCALL_H\\'; \
- echo -e '#define _SYS_SYSCALL_H\t1\\\n\\'; \
- echo -e -n '/* This file is automatically generated as part of '; \
- echo -e 'GNU libc-$(version)\\'; \
- echo -e " on a system running $$os. */\\"; echo; \
- echo -e -n 's/#define __NR_\\([A-Za-z0-9_]*\\)[ \t]*__NR_\\(.*\\)/';\
- echo -e '#define SYS_\\1 SYS_\\2/p'; \
- echo -e -n 's/#define __NR_\\([A-Za-z0-9_]*\\)[ \t]*\\(.*\\)/';\
- echo -e '#define SYS_\\1 \\2/p'; \
- echo -e '$$i\\\n\\\n#endif\t/* sys/syscall.h */\nd') \
- > $(objpfx)syscall.sed
- set -- `echo '#include <asm/unistd.h>'|$(CC) -M -E -`; \
- sed -f $(objpfx)syscall.sed $$2 > $(objpfx)syscall.h
- $(INSTALL_DATA) $(objpfx)syscall.h $@
- rm -f $(objpfx)syscall.h $(objpfx)syscall.sed
+sysdep_headers += sys/mount.h sys/sysinfo.h sys/acct.h sys/sysctl.h \
+ sys/module.h sys/io.h sys/klog.h sys/kdaemon.h \
+ syscall-list.h
+
+# Generate the list of SYS_* macros for the system calls (__NR_* macros).
+$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/syscall.h
+ rm -f $(@:.h=.d)
+ echo > $(@:.d=.h).new \
+ '/* Generated at libc build time from kernel syscall list. */'
+ SUNPRO_DEPENDENCIES='$(@:.h=.d) $(patsubst $(objpfx)%,$$(objpfx)%,\
+ $(@:.h=.d))' \
+ $(CC) -E -x c $< -D_LIBC -dM | \
+ sed -n >> $(@:.d=.h).new \
+ 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p'
+ mv -f $(@:.d=.h).new $(@:.d=.h)
+# Get the generated list of dependencies (probably /usr/include/asm/unistd.h).
+-include $(objpfx)syscall-list.d
+generated += syscall-list.h syscall-list.d
endif
ifeq ($(subdir), time)
diff --git a/sysdeps/unix/sysv/linux/syscall.h b/sysdeps/unix/sysv/linux/syscall.h
index 62fca57d70..1fbda4c56e 100644
--- a/sysdeps/unix/sysv/linux/syscall.h
+++ b/sysdeps/unix/sysv/linux/syscall.h
@@ -24,4 +24,12 @@ Cambridge, MA 02139, USA. */
from the kernel sources. */
#include <asm/unistd.h>
+#ifndef _LIBC
+/* The Linux kernel header file defines macros `__NR_<name>', but some
+ programs expect the traditional form `SYS_<name>'. So in building libc
+ we scan the kernel's list and produce <syscall-list.h> with macros for
+ all the `SYS_' names. */
+#include <syscall-list.h>
+#endif
+
#endif