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 mach-syscalls.awk # $(interfaces:%=%.defs)
23 interface-header-prefix = mach/
24 headers = mach_init.h \
26 $(addprefix mach/,$(mach-headers)) \
30 mach-headers := host_info.h kern_return.h \
31 mach_param.h mach_types.h \
33 message.h mig_errors.h msg_type.h \
34 policy.h port.h processor_info.h \
35 std_types.h task_info.h task_special_ports.h \
36 thread_info.h thread_special_ports.h \
37 thread_status.h thread_switch.h time_value.h \
38 vm_attributes.h vm_inherit.h vm_prot.h \
41 user-interfaces := mach_interface mach_port mach_host \
42 device device_request device_reply \
43 default_pager_object \
44 memory_object_user memory_object_default
45 server-interfaces := __exc
48 routines = $(interface-routines) \
49 mach_init mach_init_syms \
50 mig_strncpy mig_support msg \
51 mach_msg_destroy mach_msg_server mach_msg_server_timeout \
52 __mach_msg_destroy __mach_msg_server \
61 # Define mach-syscalls and sysno-*.
62 include mach-syscalls.mk
63 dont_distribute := syscall_sw.h
64 mach-syscalls.mk: syscall_sw.h mach-syscalls.awk
65 sed -n -e '/STANDALONE/,$$d' \
66 -e 's/^kernel_trap(\(.*\),\([-0-9]*\),[0-9]*)$$/\1 \2/p' \
67 < $< | awk -f $(word 2,$^) > $@-new
71 $(mach-syscalls:%=__%.S): __%.S: mach-syscalls.mk
72 (echo '#include <sysdep.h>'; \
73 echo 'SYSCALL_TRAP (__$*, $(sysno-$*))') > $@
76 mach-shortcuts := $(patsubst syscall_%,%,$(filter syscall_%,$(mach-syscalls)))
78 # Make the MiG stubs for $(mach-shortcuts) be CALL_rpc.
79 migdefines := $(migdefines) \
80 $(foreach call,$(mach-shortcuts),-D$(call)=$(call)_rpc)
82 # This rule needs to come before the implicit rules in Machrules.
83 __%.c: shortcut.awk __%_rpc.c
84 gawk -v call=__$* -v rpc=__$*_rpc -v syscall=__syscall_$* \
90 interface-routines := $(filter-out %_rpc,$(interface-routines)) \
91 $(foreach call,$(mach-shortcuts),\
92 __$(call) $(call) __syscall_$(call))
93 dont_distribute := $(dont_distribute) \
94 $(interface-routines:%=%.c) $(interface-headers)
99 # There is already a mach.h, so mach.defs generates mach_interface.h.
100 mach_interface.defs: mach.defs
101 ln -s $< $@ || cp $< $@
102 # There is already a memory_object.h,
103 # so memory_object.defs generates memory_object_user.h.
104 memory_object_user.defs: memory_object.defs
105 ln -s $< $@ || cp $< $@
107 # Be sure not to make these with implicit rules from foo.defs.