Increase test case timeout
[glibc.git] / mach / Makefile
blob08bb3757e1797e2240968294a98d73ff5fcda0fa
1 # Copyright (C) 1991-2013 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, see
16 # <http://www.gnu.org/licenses/>.
18 subdir := mach
20 all:
22 # Some things below (but before including Rules) use configuration variables.
23 include ../Makeconfig
26 headers = mach_init.h mach.h mach_error.h mach-shortcuts.h mach/mach_traps.h \
27 $(interface-headers) mach/mach.h mach/mig_support.h mach/error.h \
28 $(lock-headers) machine-sp.h
29 lock = spin-solid spin-lock mutex-init mutex-solid
30 lock-headers = lock-intern.h machine-lock.h spin-lock.h
31 routines = $(mach-syscalls) $(mach-shortcuts) \
32 mach_init mig_strncpy msg \
33 mig-alloc mig-dealloc mig-reply \
34 msg-destroy msgserver \
35 mach_error errstring error_compat errsystems \
36 devstream setup-thread $(lock)
38 # The RPC interfaces go in a separate library.
39 interface-library := libmachuser
41 # We produce mach_interface.h from mach.defs because there is already a
42 # <mach/mach.h> that is not the interface header (thanks CMU).
43 mach-interface-list := $(patsubst mach,mach_interface,$(mach-interface-list))
44 mach/mach_interface.defs = mach/mach.defs
46 # Similarly for memory_object_user vs. memory_object
47 mach-interface-list := $(patsubst memory_object,memory_object_user,\
48 $(mach-interface-list))
49 mach/memory_object_user.defs = mach/memory_object.defs
51 user-interfaces := $(addprefix mach/,$(mach-interface-list) \
52 mach_port mach_host exc \
54 $(addprefix device/,device device_request)
56 server-interfaces := mach/exc
58 # Clear any environment value.
59 generated =
61 # Translate GNU names for CPUs into the names used in Mach header files.
62 mach-machine = $(patsubst powerpc,ppc,$(base-machine))
64 # Define mach-syscalls and sysno-*.
65 ifndef inhibit_mach_syscalls
66 -include $(objpfx)mach-syscalls.mk
67 endif
68 $(objpfx)mach-syscalls.mk: syscalls.awk Makefile
69 # Go kludges!!!
70 $(make-target-directory)
71 # We must use $(CFLAGS) to get -O flags that affect #if's in header files.
72 echo '#include <mach/syscall_sw.h>' | \
73 $(CC) $(CFLAGS) $(CPPFLAGS) -E -MD -MP -MF $@-dep -MT $@ \
74 -x c-header - \
75 -D_MACH_`echo $(mach-machine) | tr a-z A-Z`_SYSCALL_SW_H_=1 | \
76 sed -n -e 's/^kernel_trap(\(.*\),\([-0-9]*\),\([0-9]*\))$$/\1 \2 \3/p'\
77 | $(AWK) -f $< > $@-new
78 ifneq (,$(objpfx))
79 sed $(sed-remove-objpfx) $@-dep >> $@-new
80 else
81 cat $@-dep >> $@-new
82 endif
83 rm -f $@-dep
84 mv -f $@-new $@
85 generated += mach-syscalls.mk
87 ifndef mach-syscalls
88 # We cannot make the deps properly until we know how to make the system
89 # call functions, and for that we must know what they all are.
90 no_deps=t
91 else
92 $(mach-syscalls:%=$(objpfx)%.S): $(objpfx)%.S: $(objpfx)mach-syscalls.mk
93 (echo '#include <sysdep.h>'; \
94 echo 'kernel_trap (__$*,$(sysno-$*),$(nargs-$*))'; \
95 echo 'weak_alias (__$*, $*)') > $@-new
96 mv -f $@-new $@
97 generated += $(mach-syscalls:=.S)
98 endif # mach-syscalls
100 # These syscalls that look like RPCs actually have no RPC equivalents.
101 mach-shortcuts := $(filter-out device_writev_request \
102 device_read_overwrite_request \
103 device_read_overwrite \
104 vm_read_overwrite \
105 thread_switch \
107 $(patsubst syscall_%,%,$(filter syscall_%,$(mach-syscalls))))
109 ifndef mach-shortcuts
110 # Forget about mach_interface.defs for this run. On the next run,
111 # $(mach-shortcuts) will be set, and that will change how
112 # mach_interface.defs is processed: it will get the -D flags below.
113 user-interfaces := $(filter-out $(mach-interface-list:%=mach/%) \
114 mach/mach_port mach/mach_host mach/mach4 \
115 device/device_request,\
116 $(user-interfaces))
117 endif
119 # For some reason, the calls in this file are `protected' by an ifdef.
120 MIGFLAGS-mach/mach4=-DMACH_PCSAMPLE
122 # Make the MiG stubs for $(mach-shortcuts) be CALL_rpc.
123 migdefines += $(foreach call,$(mach-shortcuts),-D$(call)=$(call)_rpc)
124 $(mach-interface-list:%=mach/%.uh) \
125 mach/mach_host.uh mach/mach_port.uh: $(objpfx)mach-syscalls.mk
127 ifdef mach-shortcuts
128 $(mach-shortcuts:%=$(objpfx)%.c): $(objpfx)%.c: shortcut.awk \
129 $(objpfx)RPC_%_rpc.c
130 $(AWK) -v alias=$* -v call=__$* -v rpc=__$*_rpc \
131 -v syscall=__syscall_$* -f $^ > $@-new
132 mv -f $@-new $@
133 generated += $(mach-shortcuts:%=%.c)
134 endif # mach-shortcuts
136 # Generate mach-shortcuts.h, which will contain the prototypes for the
137 # shortcutted kernel RPC functions.
138 $(objpfx)mach-shortcuts.h: $(mach-interface-list:%=$(objpfx)mach/%.h) \
139 $(objpfx)mach/mach_host.h \
140 $(objpfx)mach/mach_port.h
141 # The first line gets us one paragraph per line, with @s separating real lines.
142 # The second line selects paragraphs for the shortcutted functions.
143 # The third line removes `_rpc' from the names and reconstitutes the lines.
144 cat $^ | tr \\012 @ | sed s/@@/@%/g | tr % \\012 \
145 | grep '^/\* Routine [a-z0-9_]*_rpc \*/' \
146 | sed 's/_rpc//g' | tr @ \\012 > $@-new
147 mv -f $@-new $@
148 generated += mach-shortcuts.h
150 before-compile += $(objpfx)mach-shortcuts.h
152 include Machrules
153 include ../Rules
156 # A gcc bug prevents the generated file from working properly,
157 # so we have one in the distribution for the time being.
158 generated += errsystems.c
159 $(objpfx)errsystems.c: errsystems.awk err_*.sub \
160 $(wildcard $(addsuffix /err_*.sub,$(+sysdep_dirs)))
161 $(AWK) -v subsys='$(filter-out $<,$^)' -f $^ > $@.n
162 mv -f $@.n $@
165 # Convenient target to update all the generated source files.
166 .PHONY: generated
167 generated: $(addprefix $(common-objpfx),$(common-generated)) \
168 $(addprefix $(objpfx),$(generated))
170 .PHONY: mach-before-compile
171 mach-before-compile: $(mach-before-compile)