]> git.ipfire.org Git - thirdparty/glibc.git/blame - mach/Makefile
Few last minute patches from main on 960811
[thirdparty/glibc.git] / mach / Makefile
CommitLineData
a1c46301 1# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
28f540f4
RM
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
c316b486 27headers = mach_init.h mach.h mach_error.h mach-shortcuts.h mach/mach_traps.h \
28f540f4
RM
28 $(interface-headers) mach/mach.h mach/mig_support.h mach/error.h \
29 $(lock-headers) machine-sp.h
30distribute = thread_state.h
2f8033d6 31lock = spin-solid spin-lock mutex-init mutex-solid
28f540f4
RM
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 \
41740721 45 default_pager default_pager_helper \
28f540f4
RM
46 )\
47 $(addprefix device/,device device_request)
aa592a63
RM
48# We produce mach_interface.h from mach.defs because there is already a
49# <mach/mach.h> that is not the interface header (thanks CMU).
c2bf8a5a
MB
50mach/mach_interface.defs = mach/mach.defs
51# Similarly for memory_object_user vs. memory_object
52mach/memory_object_user.defs = mach/memory_object.defs
a1c46301 53server-interfaces := mach/exc
28f540f4
RM
54tests := hello
55# It is important that we do not use the wildcard function to expand
56# `err_*.sub'. Leaving the wildcard allows Make-dist to find all matching
57# files in all sysdep directories.
58distribute += Machrules syscalls.awk shortcut.awk \
59 errorlib.h err_*.sub
60
61
62# Clear any environment value.
63generated =
64\f
28f540f4 65# Define mach-syscalls and sysno-*.
a1c46301 66ifndef no_deps
28f540f4
RM
67ifndef inhibit_mach_syscalls
68include $(objpfx)mach-syscalls.mk
69endif
a1c46301 70endif
aa1075ea 71$(objpfx)mach-syscalls.mk: syscalls.awk Makefile
28f540f4 72# Go kludges!!!
aa1075ea
RM
73 echo '#include <mach/syscall_sw.h>' | \
74 DEPENDENCIES_OUTPUT='$@-dep $@' \
75 $(CC) $(CPPFLAGS) -E -x c-header - \
76 -D_MACH_`echo $(base-machine) | tr a-z A-Z`_SYSCALL_SW_H_=1 | \
77 sed -n -e 's/^kernel_trap(\(.*\),\([-0-9]*\),\([0-9]*\))$$/\1 \2 \3/p'\
78 | awk -f $< > $@-new
79 cat $@-dep >> $@-new; rm -f $@-dep
28f540f4
RM
80 mv $@-new $@
81generated += mach-syscalls.mk
82
83ifndef mach-syscalls
84# We cannot make the deps properly until we know how to make the system
85# call functions, and for that we must know what they all are.
86no_deps=t
87else
88$(mach-syscalls:%=$(objpfx)%.S): $(objpfx)%.S: $(objpfx)mach-syscalls.mk
89 (echo '#include <sysdep.h>'; \
90 echo 'kernel_trap(__$*,$(sysno-$*),$(nargs-$*))'; \
91 echo 'weak_alias (__$*, $*)') > $@-new
92 mv $@-new $@
93generated += $(mach-syscalls:=.S)
94endif # mach-syscalls
95
96# syscall_device_writev_request has no RPC equivalent.
97mach-shortcuts := $(filter-out device_writev_request,\
98 $(patsubst syscall_%,%,$(filter syscall_%,$(mach-syscalls))))
99
100ifndef mach-shortcuts
101# Forget about mach_interface.defs for this run. On the next run,
102# $(mach-shortcuts) will be set, and that will change how
103# mach_interface.defs is processed: it will get the -D flags below.
104user-interfaces := $(filter-out mach/mach_interface \
105 mach/mach_port mach/mach_host mach/mach4 \
106 device/device_request,\
107 $(user-interfaces))
108endif
109
110# Make the MiG stubs for $(mach-shortcuts) be CALL_rpc.
111migdefines += $(foreach call,$(mach-shortcuts),-D$(call)=$(call)_rpc)
112mach/mach_interface.uh mach/mach_port.uh: $(objpfx)mach-syscalls.mk
113
114ifdef mach-shortcuts
115$(mach-shortcuts:%=$(objpfx)%.c): $(objpfx)%.c: shortcut.awk \
116 $(objpfx)RPC_%_rpc.c
117 gawk -v alias=$* -v call=__$* -v rpc=__$*_rpc -v syscall=__syscall_$* \
118 -f $^ > $@-new
119 mv $@-new $@
120generated += $(mach-shortcuts:%=%.c)
121endif # mach-shortcuts
122
123# Generate mach-shortcuts.h, which will contain the prototypes for the
124# shortcutted kernel RPC functions.
125$(objpfx)mach-shortcuts.h: $(objpfx)mach/mach_interface.h \
126 $(objpfx)mach/mach_port.h
127# The first line gets us one paragraph per line, with @s separating real lines.
128# The second line selects paragraphs for the shortcutted functions.
129# The third line removes `_rpc' from the names and rerealifies the lines.
130 cat $^ | tr \\012 @ | sed s/@@/@%/g | tr % \\012 \
131 | grep '^/\* Routine [a-z0-9_]*_rpc \*/' \
132 | sed 's/_rpc//g' | tr @ \\012 > $@-new
133 mv $@-new $@
134generated += mach-shortcuts.h
135
136before-compile += $(objpfx)mach-shortcuts.h
137\f
138include Machrules
139include ../Rules
140
141
421f82e5
RM
142# A gcc bug prevents the generated file from working properly,
143# so we have one in the distribution for the time being.
28f540f4
RM
144generated += errsystems.c
145$(objpfx)errsystems.c: errsystems.awk err_*.sub \
146 $(wildcard $(addsuffix /err_*.sub,$(+sysdep_dirs)))
147 gawk -v subsys='$(filter-out $<,$^)' -f $^ > $@.n
148 mv $@.n $@