1 # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public License
6 # as published by the Free Software Foundation; either version 2 of
7 # the License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Library General Public License for more details.
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If
16 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 # Cambridge, MA 02139, USA.
21 distribute = Machrules interface.awk syscalls.awk shortcut.awk
23 headers = mach_init.h mach.h \
24 $(addprefix mach/,$(mach-headers)) \
27 mach-headers := host_info.h kern_return.h \
28 mach_param.h mach_types.h \
30 message.h mig_errors.h msg_type.h \
31 policy.h port.h processor_info.h \
32 std_types.h task_info.h task_special_ports.h \
33 thread_info.h thread_special_ports.h \
34 thread_status.h thread_switch.h time_value.h \
35 vm_attributes.h vm_inherit.h vm_prot.h \
38 user-interfaces := $(addprefix mach/,mach_interface mach_port mach_host \
39 default_pager_object \
41 memory_object_default \
44 $(addprefix device/,device device_request)
45 # device_reply is giving me headaches because of userprefix
46 server-interfaces := # mach/__exc mach/exc
48 routines = $(interface-routines) \
49 $(filter-out syscall_%,$(mach-syscalls)) \
50 $(addprefix __,$(mach-syscalls)) \
51 $(mach-shortcuts) $(addprefix __,$(mach-shortcuts)) \
52 mach_init vm_page_size \
53 mig_strncpy __mig_strncpy __bcopy __msg msg \
54 mig_support mig_support_syms \
55 msg_destroy msg_server msg_server_t \
56 __msg_destroy __msg_server \
57 devstream bootprivport privports
65 # Define mach-syscalls and sysno-*.
66 include $(objpfx)mach-syscalls.mk
67 $(objpfx)mach-syscalls.mk: mach/syscall_sw.h syscalls.awk
69 sed -n -e '/Unix server implement them/,$$d' \
70 -e 's/^kernel_trap(\(.*\),\([-0-9]*\),[0-9]*)$$/\1 \2/p' \
71 < $< | awk -f $(word 2,$^) > $@-new
73 clean-extras := $(clean-extras) $(objpfx)mach-syscalls.mk
76 $(mach-syscalls:%=$(objpfx)__%.S): $(objpfx)__%.S: mach-syscalls.mk
77 (echo '#include <sysdep.h>'; \
78 echo 'SYSCALL_TRAP (__$*, $(sysno-$*))') > $@-new
80 $(mach-syscalls:%=$(objpfx)%.c): $(objpfx)%.c:
81 (echo '#include <gnu-stabs.h>'; \
82 echo 'symbol_alias (__$*, $*)') > $@-new
84 clean-extras := $(clean-extras) \
85 $(mach-syscalls:%=$(objpfx)__%.S) \
86 $(mach-syscalls:%=$(objpfx)%.c)
89 mach-shortcuts := $(patsubst syscall_%,%,$(filter syscall_%,$(mach-syscalls)))
92 # Forget about mach_interface.defs for this run. On the next run,
93 # $(mach-shortcuts) will be set, and that will change how
94 # mach_interface.defs is processed: it will get the -D flags below.
95 user-interfaces := $(filter-out mach/mach_interface
96 mach/mach_port mach/mach_host,\
100 # Make the MiG stubs for $(mach-shortcuts) be CALL_rpc.
101 migdefines := $(migdefines) \
102 $(foreach call,$(mach-shortcuts),-D$(call)=$(call)_rpc)
103 mach/mach_interface.uh mach/mach_port.uh: mach-syscalls.mk
106 $(mach-shortcuts:%=__%.c): __%.c: shortcut.awk __%_rpc.c
107 gawk -v call=__$* -v rpc=__$*_rpc -v syscall=__syscall_$* \
111 # The shortcut calls have had their names changed to CALL_rpc, so
112 # CALL_rpc.c is being generated with a symbol alias to __CALL_rpc.
113 # We also want CALL.c with an alias to __CALL.
114 $(mach-shortcuts:%=%.c):
115 (echo '#include <gnu-stabs.h>'; \
116 echo 'symbol_alias (__$*, $*)') > $@-new
124 # There is already a mach.h, so mach.defs generates mach_interface.h.
125 mach/mach_interface.defs: mach/mach.defs
127 # There is already a memory_object.h,
128 # so memory_object.defs generates memory_object_user.h.
129 mach/memory_object_user.defs: mach/memory_object.defs
132 # Be sure not to make these with implicit rules from foo.defs.
133 $(filter-out $(interface-headers),$(headers)) : ;