1# Copyright (C) 1991-2021 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 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.
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# Lesser General Public License for more details.
13
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# <https://www.gnu.org/licenses/>.
17
18subdir := hurd
19
20include ../Makeconfig
21
22headers = hurd.h $(interface-headers) \
23	  $(addprefix hurd/,fd.h id.h port.h signal.h sigpreempt.h ioctl.h\
24			    userlink.h resource.h lookup.h)
25
26inline-headers = hurd.h $(addprefix hurd/,fd.h signal.h \
27					  userlink.h port.h)
28
29# The RPC interfaces go in a separate library.
30interface-library := libhurduser
31user-interfaces		:= $(addprefix hurd/,\
32				       auth startup \
33				       process process_request \
34				       msg msg_reply msg_request \
35				       exec exec_startup crash interrupt \
36				       fs fsys io io_reply io_request \
37				       term tioctl socket ifsock \
38				       login password pfinet pci \
39				       )
40server-interfaces	:= hurd/msg faultexc
41
42routines = hurdstartup hurdinit \
43	   hurdid hurdpid hurdrlimit hurdprio hurdexec hurdselect \
44	   hurdlookup lookup-retry lookup-at \
45	   get-host set-host \
46	   path-lookup \
47	   setauth \
48	   pid2task task2pid \
49	   geteuids seteuids getumask fchroot \
50	   hurdsock hurdauth \
51	   hurdchdir hurdfchdir \
52	   privports \
53	   msgportdemux \
54	   fopenport \
55	   vpprintf \
56	   ports-get ports-set hurdports hurdmsg \
57	   errno-loc \
58	   hurdlock \
59	   $(sig) $(dtable) $(inlines) \
60	   fd-cleanup port-cleanup report-wait xattr
61sig	= hurdsig hurdfault siginfo hurd-raise preempt-sig \
62	  trampoline longjmp-ts catch-exc exc2signal hurdkill sigunwind \
63	  thread-self thread-cancel intr-msg catch-signal
64dtable	= dtable port2fd new-fd alloc-fd intern-fd \
65	  getdport openport \
66	  fd-close fd-read fd-write hurdioctl ctty-input ctty-output
67inlines = $(inline-headers:%.h=%-inlines)
68
69# XXX this is a temporary hack; see hurdmalloc.h
70routines += hurdmalloc
71
72# Binary compatibility for libc.so.0.2[GLIBC_2.0].
73ifeq ($(build-shared),yes)
74routines += compat-20
75endif
76
77shared-only-routines = compat-20
78
79# For each of the $(inline-headers), generate a trivial source
80# file that will #include it to define its inline functions as real functions.
81$(inlines:%=$(objpfx)%.c): $(objpfx)%-inlines.c: %.h
82	(h="`echo $(subst /,_,$*) | tr '[a-z]' '[A-Z]'`"; \
83	 echo "#define _$${h}_H_EXTERN_INLINE /* Define real function.  */"; \
84	 echo "#define _$${h}_H_HIDDEN_DEF    /* Declare hidden definition.  */"; \
85	 echo '#include "$<"') > $@-new
86	mv -f $@-new $@
87generated += $(inlines:=.c)
88
89# Avoid ssp before TLS is initialized.
90CFLAGS-hurdstartup.o = $(no-stack-protector)
91CFLAGS-RPC_exec_startup_get_info.o = $(no-stack-protector)
92
93# Make generated headers compatible with all support standards
94migheaderpipe := | sed -e 's/\<ino64_t\>/__ino64_t/' -e 's/\<loff_t\>/__loff_t/'
95include ../mach/Machrules
96libhurduser-routines += RPC_gsync_wait_intr
97include ../Rules
98
99# intr-rpc.defs defines the INTR_INTERFACE macro to make the generated RPC
100# stubs import <hurd/signal.h> and #define __mach_msg to
101# _hurd_intr_rpc_mach_msg.
102user-MIGFLAGS += -imacros intr-rpc.defs
103
104# The special exc server for sigthread faults uses a special prefix.
105MIGFLAGS-faultexc = -prefix _hurdsig_fault_
106
107# We need this static dependency to get faultexc.h generated the first time.
108$(objpfx)hurdfault.o $(objpfx)hurdfault.d: \
109	$(objpfx)faultexc_server.h $(objpfx)faultexc_server.c
110