]> git.ipfire.org Git - thirdparty/glibc.git/blame - mach/Makefile
* sysdeps/unix/bsd/bsd4.4/revoke.S: New file.
[thirdparty/glibc.git] / mach / Makefile
CommitLineData
28f540f4
RM
1# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
2# This file is part of the GNU C Library.
3
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.
8
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.
13
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.
18
19subdir := mach
20
21all:
22
23# Some things below (but before including Rules) use configuration variables.
24include ../Makeconfig
25
26
27headers = mach_init.h mach.h mach_error.h mach-shortcuts.h \
28 $(interface-headers) mach/mach.h mach/mig_support.h mach/error.h \
29 $(lock-headers) machine-sp.h
30distribute = thread_state.h
31lock = spin-solid spin-lock mutex-solid
32lock-headers = lock-intern.h machine-lock.h spin-lock.h
33routines = $(mach-syscalls) $(mach-shortcuts) \
34 mach_init mig_strncpy msg \
35 mig-alloc mig-dealloc mig-reply \
36 msg-destroy msgserver \
37 mach_error errstring error_compat errsystems \
38 devstream bootprivport setup-thread $(lock)
39# The RPC interfaces go in a separate library.
f0bf9cb9 40interface-library := libmachuser
28f540f4
RM
41user-interfaces := $(addprefix mach/,mach_interface mach_port mach_host \
42 memory_object_user \
43 memory_object_default \
44 exc mach4 \
45 )\
46 $(addprefix device/,device device_request)
47server-interfaces := device/device_reply mach/exc mach/notify
48tests := hello
49# It is important that we do not use the wildcard function to expand
50# `err_*.sub'. Leaving the wildcard allows Make-dist to find all matching
51# files in all sysdep directories.
52distribute += Machrules syscalls.awk shortcut.awk \
53 errorlib.h err_*.sub
54
55
56# Clear any environment value.
57generated =
58\f
59# Get the proper definition of `mach-srcdir'.
60include ../sysdeps/mach/Makefile
61
62# Use and install the Mach header files directly out of the Mach kernel source.
63
64# Find the MiG defs files in the kernel source.
65vpath %.defs $(mach-srcdir)
66
67# Install all .h and .defs files we find in some of the kernel's source
68# directories and their subdirectories (in MK82, max one level deep).
69mach-src-headers := $(wildcard $(foreach dir,mach device mach_debug \
70 $(config-machine),\
71 $(addprefix $(mach-srcdir)/$(dir)/,\
72 *.defs *.h \
73 */*.defs */*.h)))
74# Exclude mach/machine/*. A symlink will be installed for mach/machine.
75# Exclude $(headers) for Mach files we have our own versions of.
76mach-headers = $(filter-out mach/machine/% $(headers),\
77 $(mach-src-headers:$(mach-srcdir)/%=%))
78# Rename Mach's sys/version.h to mach/version.h.
79mach-headers := $(patsubst sys/version.h,mach/version.h,$(mach-headers))
80
81# Don't distribute the Mach headers; they are in the Mach distribution.
82dont_distribute = $(mach-headers)
83
84# DO NOT try to remake these in any way!!!
85$(addprefix $(mach-srcdir)/,$(mach-headers)) : ;
86install-others += $(addprefix $(includedir)/,$(mach-headers))
87$(includedir)/%: $(mach-srcdir)/%; $(do-install)
88
89# Make symlinks for machine and mach/machine in the include directory.
90install-others += $(includedir)/mach/machine $(includedir)/machine
91$(includedir)/mach/machine $(includedir)/machine: $(common-objpfx)config.make
92 -rm -f $@
93 cd $(@D); ln -s $(config-machine) $(@F)
94
95# Install Mach's <sys/version.h> as <mach/version.h>.
96install-others += $(includedir)/mach/version.h
97$(includedir)/mach/version.h: $(mach-srcdir)/sys/version.h; $(do-install)
98\f
99# Define mach-syscalls and sysno-*.
100ifndef inhibit_mach_syscalls
101include $(objpfx)mach-syscalls.mk
102endif
103$(objpfx)mach-syscalls.mk: mach/syscall_sw.h syscalls.awk
104# Go kludges!!!
105 sed -n -e '/Unix server implement them/,$$d' \
106 -e 's/^kernel_trap(\(.*\),\([-0-9]*\),\([0-9]*\))$$/\1 \2 \3/p'\
107 < $< | awk -f $(word 2,$^) > $@-new
108 mv $@-new $@
109generated += mach-syscalls.mk
110
111ifndef mach-syscalls
112# We cannot make the deps properly until we know how to make the system
113# call functions, and for that we must know what they all are.
114no_deps=t
115else
116$(mach-syscalls:%=$(objpfx)%.S): $(objpfx)%.S: $(objpfx)mach-syscalls.mk
117 (echo '#include <sysdep.h>'; \
118 echo 'kernel_trap(__$*,$(sysno-$*),$(nargs-$*))'; \
119 echo 'weak_alias (__$*, $*)') > $@-new
120 mv $@-new $@
121generated += $(mach-syscalls:=.S)
122endif # mach-syscalls
123
124# syscall_device_writev_request has no RPC equivalent.
125mach-shortcuts := $(filter-out device_writev_request,\
126 $(patsubst syscall_%,%,$(filter syscall_%,$(mach-syscalls))))
127
128ifndef mach-shortcuts
129# Forget about mach_interface.defs for this run. On the next run,
130# $(mach-shortcuts) will be set, and that will change how
131# mach_interface.defs is processed: it will get the -D flags below.
132user-interfaces := $(filter-out mach/mach_interface \
133 mach/mach_port mach/mach_host mach/mach4 \
134 device/device_request,\
135 $(user-interfaces))
136endif
137
138# Make the MiG stubs for $(mach-shortcuts) be CALL_rpc.
139migdefines += $(foreach call,$(mach-shortcuts),-D$(call)=$(call)_rpc)
140mach/mach_interface.uh mach/mach_port.uh: $(objpfx)mach-syscalls.mk
141
142ifdef mach-shortcuts
143$(mach-shortcuts:%=$(objpfx)%.c): $(objpfx)%.c: shortcut.awk \
144 $(objpfx)RPC_%_rpc.c
145 gawk -v alias=$* -v call=__$* -v rpc=__$*_rpc -v syscall=__syscall_$* \
146 -f $^ > $@-new
147 mv $@-new $@
148generated += $(mach-shortcuts:%=%.c)
149endif # mach-shortcuts
150
151# Generate mach-shortcuts.h, which will contain the prototypes for the
152# shortcutted kernel RPC functions.
153$(objpfx)mach-shortcuts.h: $(objpfx)mach/mach_interface.h \
154 $(objpfx)mach/mach_port.h
155# The first line gets us one paragraph per line, with @s separating real lines.
156# The second line selects paragraphs for the shortcutted functions.
157# The third line removes `_rpc' from the names and rerealifies the lines.
158 cat $^ | tr \\012 @ | sed s/@@/@%/g | tr % \\012 \
159 | grep '^/\* Routine [a-z0-9_]*_rpc \*/' \
160 | sed 's/_rpc//g' | tr @ \\012 > $@-new
161 mv $@-new $@
162generated += mach-shortcuts.h
163
164before-compile += $(objpfx)mach-shortcuts.h
165\f
166include Machrules
167include ../Rules
168
169
170# There is already a mach.h, so mach.defs generates mach_interface.h.
171$(objpfx)mach/mach_interface.defs: $(mach-srcdir)/mach/mach.defs
172 ln $< $@ || cp $< $@
173# There is already a memory_object.h,
174# so memory_object.defs generates memory_object_user.h.
175$(objpfx)mach/memory_object_user.defs: $(mach-srcdir)/mach/memory_object.defs
176 ln $< $@ || cp $< $@
177
178ifdef objdir
179vpath mach/mach_interface.defs $(objdir)
180vpath mach/memory_object_user.defs $(objdir)
181endif
182
183# Be sure not to make these with implicit rules from foo.defs.
184mach.h mach/memory_object.h: ;
185
28f540f4
RM
186generated += errsystems.c
187$(objpfx)errsystems.c: errsystems.awk err_*.sub \
188 $(wildcard $(addsuffix /err_*.sub,$(+sysdep_dirs)))
189 gawk -v subsys='$(filter-out $<,$^)' -f $^ > $@.n
190 mv $@.n $@