1 # Rules for MiG interfaces that want to go into the C library.
3 # Copyright (C) 1991 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Library General Public License
8 # as published by the Free Software Foundation; either version 2 of
9 # the License, or (at your option) any later version.
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Library General Public License for more details.
16 # You should have received a copy of the GNU Library General Public
17 # License along with the GNU C Library; see the file COPYING.LIB. If
18 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19 # Cambridge, MA 02139, USA.
23 interface-routines := $(user-interfaces:%=%_user) \
24 $(server-interfaces:%=%_server)
25 interface-headers := $(addsuffix .h,$(interface-headers))
26 interface-routines := $(interface-routines) \
27 $(addsuffix -syms,$(interface-routines))
28 dont_distribute := $(dont_distribute) \
29 $(addsuffix .h,$(interface-routines)) \
30 $(addsuffix .c,$(interface-routines)) # Generated.
34 vpath %.defs $(MIG_DEFS_PATH)
38 migdefines := -DMACH_IPC_COMPAT=0 -DSTANDALONE -DTypeCheck=0 \
39 $(foreach call,$(mach-shortcuts),-D$(call)=mig_$(call))
40 MIGFLAGS = -subrprefix __ -prefix __ $(migdefines)
43 include $(..)mach/mach-shortcuts
45 $(..)mach/mach-shortcuts: $(..)mach/mach_shortcuts.h
46 (echo 'mach-shortcuts := ' \\ ; \
47 sed -n 's/SHORTCUT[^(]*(\([^,]*\),.*$$/ \1 \\/p' < $<) > $@
49 .SUFFIXES: .defs .migh .__h
51 %_user.c %.migh: %.defs
52 $(MIG) $(MIGFLAGS) -server /dev/null -user $@ -header $*.migh $<
54 %_server.c %.migh: %.defs
55 $(MIG) $(MIGFLAGS) -user /dev/null -server $@ -sheader $*.migh $<
58 sed -n 's/^kern_return_t *__\([a-zA-Z0-9_]*\)$$/#define \1 __\1/' \
62 # The last line of foo.migh is "#endif /* foo.h */"
63 (sed '$$d' < $<; cat $(word 2,$^); tail -1 $<) > $@
66 CPP = /usr/local/lib/gcc-cpp
68 $(CPP) -M $(MIGFLAGS) $< | sed 's/$<.o/$@ $(@:.dep=.o)/' > $@
76 (echo '#include <gnu-stabs.h>';
77 sed -n 's/^mig_external kern_return_t __\([a-zA-Z0-9_]*\)$/\
78 symbol_alias (__\1, \1)/p' < $<) > $@