* sysdeps/m68k/setjmp.c: Also define setjmp and _setjmp if
[glibc.git] / mach / Makefile
blob7e32034bc427ccb78ea234fb6ac9127cf618b08a
1 # Copyright (C) 1991,92,93,94,95,96,97,98,2001 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 Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of 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 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, write to the Free
16 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 # 02111-1307 USA.
19 subdir := mach
21 all:
23 # Some things below (but before including Rules) use configuration variables.
24 include ../Makeconfig
27 headers = mach_init.h mach.h mach_error.h mach-shortcuts.h mach/mach_traps.h \
28 $(interface-headers) mach/mach.h mach/mig_support.h mach/error.h \
29 $(lock-headers) machine-sp.h
30 distribute = thread_state.h
31 lock = spin-solid spin-lock mutex-init mutex-solid
32 lock-headers = lock-intern.h machine-lock.h spin-lock.h
33 routines = $(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.
40 interface-library := libmachuser
41 user-interfaces := $(addprefix mach/,mach_interface mach_port mach_host \
42 memory_object_user \
43 memory_object_default \
44 exc mach4 \
45 default_pager default_pager_helper \
47 $(addprefix device/,device device_request)
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).
50 mach/mach_interface.defs = mach/mach.defs
51 # Similarly for memory_object_user vs. memory_object
52 mach/memory_object_user.defs = mach/memory_object.defs
53 server-interfaces := mach/exc
54 # It is important that we do not use the wildcard function to expand
55 # `err_*.sub'. Leaving the wildcard allows Make-dist to find all matching
56 # files in all sysdep directories.
57 distribute += Machrules syscalls.awk shortcut.awk \
58 errorlib.h err_*.sub errsystems.awk
61 # Clear any environment value.
62 generated =
64 # Define mach-syscalls and sysno-*.
65 ifndef no_deps
66 ifndef inhibit_mach_syscalls
67 -include $(objpfx)mach-syscalls.mk
68 endif
69 endif
70 $(objpfx)mach-syscalls.mk: syscalls.awk Makefile
71 # Go kludges!!!
72 $(make-target-directory)
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
80 mv -f $@-new $@
81 generated += mach-syscalls.mk
83 ifndef 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.
86 no_deps=t
87 else
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 -f $@-new $@
93 generated += $(mach-syscalls:=.S)
94 endif # mach-syscalls
96 # syscall_device_writev_request has no RPC equivalent.
97 mach-shortcuts := $(filter-out device_writev_request,\
98 $(patsubst syscall_%,%,$(filter syscall_%,$(mach-syscalls))))
100 ifndef 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.
104 user-interfaces := $(filter-out mach/mach_interface \
105 mach/mach_port mach/mach_host mach/mach4 \
106 device/device_request,\
107 $(user-interfaces))
108 endif
110 # For some reason, the calls in this file are `protected' by an ifdef.
111 MIGFLAGS-mach/mach4=-DMACH_PCSAMPLE
113 # Make the MiG stubs for $(mach-shortcuts) be CALL_rpc.
114 migdefines += $(foreach call,$(mach-shortcuts),-D$(call)=$(call)_rpc)
115 mach/mach_interface.uh mach/mach_host.uh mach/mach_port.uh: $(objpfx)mach-syscalls.mk
117 ifdef mach-shortcuts
118 $(mach-shortcuts:%=$(objpfx)%.c): $(objpfx)%.c: shortcut.awk \
119 $(objpfx)RPC_%_rpc.c
120 $(AWK) -v alias=$* -v call=__$* -v rpc=__$*_rpc \
121 -v syscall=__syscall_$* -f $^ > $@-new
122 mv -f $@-new $@
123 generated += $(mach-shortcuts:%=%.c)
124 endif # mach-shortcuts
126 # Generate mach-shortcuts.h, which will contain the prototypes for the
127 # shortcutted kernel RPC functions.
128 $(objpfx)mach-shortcuts.h: $(objpfx)mach/mach_interface.h \
129 $(objpfx)mach/mach_host.h \
130 $(objpfx)mach/mach_port.h
131 # The first line gets us one paragraph per line, with @s separating real lines.
132 # The second line selects paragraphs for the shortcutted functions.
133 # The third line removes `_rpc' from the names and reconstitutes the lines.
134 cat $^ | tr \\012 @ | sed s/@@/@%/g | tr % \\012 \
135 | grep '^/\* Routine [a-z0-9_]*_rpc \*/' \
136 | sed 's/_rpc//g' | tr @ \\012 > $@-new
137 mv -f $@-new $@
138 generated += mach-shortcuts.h
140 before-compile += $(objpfx)mach-shortcuts.h
142 include Machrules
143 include ../Rules
146 # A gcc bug prevents the generated file from working properly,
147 # so we have one in the distribution for the time being.
148 generated += errsystems.c
149 $(objpfx)errsystems.c: errsystems.awk err_*.sub \
150 $(wildcard $(addsuffix /err_*.sub,$(+sysdep_dirs)))
151 $(AWK) -v subsys='$(filter-out $<,$^)' -f $^ > $@.n
152 mv -f $@.n $@