Mon Mar 27 02:23:15 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[platform/upstream/glibc.git] / hurd / Makefile
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
19 subdir := hurd
20
21 all:
22
23 # Some things below (but before including Rules) use configuration variables.
24 include ../Makeconfig
25
26
27 headers = hurd.h $(interface-headers) \
28           $(addprefix hurd/,fd.h id.h port.h signal.h userlink.h \
29                             resource.h threadvar.h)
30
31 distribute := hurdfault.h intr-rpc.awk intr-rpc.defs STATUS
32
33 # The RPC interfaces go in a separate library.
34 interface-library := libhurduser
35 user-interfaces         := $(addprefix hurd/,\
36                                        auth process startup \
37                                        msg msg_reply msg_request \
38                                        exec core interrupt \
39                                        fs fsys io term socket ifsock)
40 server-interfaces       := hurd/msg
41
42 routines = hurdinit hurdid hurdlookup hurdpid hurdrlimit hurdprio hurdexec \
43            setauth \
44            pid2task task2pid \
45            getuids setuids getumask fchroot \
46            hurdsock hurdauth invoke-trans \
47            privports \
48            msgportdemux \
49            fopenport \
50            vpprintf \
51            ports-get ports-set hurdports hurdmsg \
52            $(sig) $(dtable) hurdinline port-cleanup
53 sig     = hurdsig hurdfault faultexc siginfo hurd-raise preempt-sig \
54           trampoline longjmp-ts catch-exc exc2signal hurdkill
55 dtable  = dtable port2fd new-fd alloc-fd intern-fd \
56           getdport openport \
57           fd-close fd-read fd-write hurdioctl ctty-input ctty-output
58
59 # XXX this is a temporary hack; see hurdmalloc.h
60 routines += hurdmalloc
61 distribute += hurdmalloc.h
62 \f
63 # Get the proper definition of `hurd-srcdir'.
64 include ../sysdeps/mach/hurd/Makefile
65
66 # Use and install the Hurd header files directly out of the Hurd source.
67
68 # Find the MiG defs files in the Hurd source.
69 vpath %.defs $(hurd-srcdir)
70
71 # Install all .h and .defs files we find in the Hurd's hurd/ directory.
72 hurd-headers := $(patsubst $(hurd-srcdir)/%,%,\
73                            $(wildcard $(addprefix $(hurd-srcdir)/hurd/,\
74                                                   *.defs *.h)))
75
76
77 # Don't distribute the Hurd headers; they are in the Hurd distribution.
78 dont_distribute = $(hurd-headers)
79
80 # DO NOT try to remake these in any way!!!
81 $(addprefix $(hurd-srcdir)/,$(hurd-headers)) : ;
82 install-others += $(addprefix $(includedir)/,$(hurd-headers))
83 $(includedir)/hurd/%: $(hurd-srcdir)/hurd/%; $(do-install)
84 \f
85 include ../mach/Machrules
86 include ../Rules
87 \f
88 # intr-rpc.defs defines the INTR_INTERFACE macro to make the generated RPC
89 # stubs send-interruptible, and to prefix them with `hurd_intr_rpc_'.
90 user-MIGFLAGS += -imacros intr-rpc.defs
91
92 # Run each generated user stub through intr-rpc.awk, which will detect
93 # stubs __hurd_intr_rpc_% and generate the user-callable function for the
94 # stub: this is a wrapper which calls __hurd_intr_rpc_% inside
95 # HURD_EINTR_RPC.
96 define transform-user-stub
97 gawk -v call=$${call} -f $(word 2,$^) \
98         $(objpfx)tmp_$${call}.c > $(objpfx)tmpi_$${call}.c; \
99 rm -f $(objpfx)tmp_$${call}.c;
100 endef
101 transform-user-stub-output = tmpi
102
103 $(foreach if,$(user-interfaces),$($(if)-calls:%=$(objpfx)RPC_%.o))): \
104         hurd/signal.h
105
106 $(user-interfaces:%=$(objpfx)%.ustamp): intr-rpc.awk
107
108 $(objpfx)fault%.c $(objpfx)fault%.h: $(mach-srcdir)/mach/%.defs
109         $(MIG) $(MIGFLAGS) -prefix _hurdsig_fault_ \
110                -server $(@:.h=.c) -sheader $(@:.c=.h) \
111                -user /dev/null -header /dev/null \
112                $<
113 generated += faultexc.c faultexc.h
114
115 # We need this static dependency to get faultexc.h generated the first time.
116 $(objpfx)hurdfault.o $(objpfx)hurdfault.d: \
117         $(objpfx)faultexc.h $(objpfx)faultexc.c