]> git.ipfire.org Git - thirdparty/glibc.git/blob - sunrpc/Makefile
Install rpc/netdb.h again
[thirdparty/glibc.git] / sunrpc / Makefile
1 # Copyright (C) 1994-2004, 2005, 2006, 2011 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, write to the Free
16 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 # 02111-1307 USA.
18
19 #
20 # Sub-makefile for sunrpc portion of the library.
21 #
22 subdir := sunrpc
23
24 # The code in this subdirectory is taken from Sun's RPCSRC-4.0
25 # distribution with some additional changes from the TI-RPC package
26 # which is also available from Sun. The files are heavily changed to
27 # compile cleanly and to fit in the GNU environment. All the code
28 # from Sun's rpc, etc, and rpcgen subdirectories is in this directory;
29 # the rpc subdirectory contains only the header files. Other than
30 # that, several files were renamed so as not to exceed 14-character
31 # file name limits:
32 #
33 # authunix_prot.c -> authuxprot.c
34 # bindresvport.c -> bindrsvprt.c
35 # clnt_generic.c -> clnt_gen.c
36 # clnt_perror.c -> clnt_perr.c
37 # clnt_simple.c -> clnt_simp.c
38 # get_myaddress.c -> get_myaddr.c
39 # pmap_getmaps.c -> pm_getmaps.c
40 # pmap_getport.c -> pm_getport.c
41 # rpc_callmsg.c -> rpc_cmsg.c
42 # rpc_commondata.c -> rpc_common.c
43 # rpc_dtablesize.c -> rpc_dtable.c
44 # svc_auth_unix.c -> svc_authux.c
45 # xdr_reference.c -> xdr_ref.c
46
47 rpcsvc = bootparam_prot.x nlm_prot.x rstat.x \
48 yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \
49 rusers.x spray.x nfs_prot.x rquota.x key_prot.x
50 headers-in-tirpc = $(addprefix rpc/,auth.h auth_unix.h clnt.h pmap_clnt.h \
51 pmap_prot.h pmap_rmt.h rpc.h rpc_msg.h \
52 svc.h svc_auth.h types.h xdr.h auth_des.h \
53 des_crypt.h)
54 headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \
55 $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
56 headers = rpc/netdb.h
57 install-others = $(inst_sysconfdir)/rpc
58 generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
59 $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
60 generated-dirs := rpcsvc
61
62 include ../Makeconfig
63
64 ifeq ($(versioning),yes)
65 need-export-routines := auth_des auth_unix clnt_gen clnt_perr clnt_tcp \
66 clnt_udp get_myaddr key_call netname pm_getport \
67 rpc_thread svc svc_tcp svc_udp xcrypt xdr_array xdr \
68 xdr_intXX_t xdr_mem xdr_ref xdr_sizeof xdr_stdio \
69 svc_run
70
71 routines := auth_none authuxprot bindrsvprt clnt_raw clnt_simp \
72 rpc_dtable getrpcport pmap_clnt pm_getmaps pmap_prot pmap_prot2 \
73 pmap_rmt rpc_prot rpc_common rpc_cmsg svc_auth svc_authux svc_raw \
74 svc_simple xdr_float xdr_rec publickey authdes_prot \
75 des_crypt des_impl des_soft key_prot openchild rtime svcauth_des \
76 clnt_unix svc_unix create_xid $(need-export-routines)
77 # We only add the RPC for compatibility to libc.so.
78 shared-only-routines = $(routines)
79 endif
80
81 # We do not build rpcinfo anymore. It is not needed for a bootstrap
82 # and not wanted on complete systems.
83 # others := rpcinfo
84 # install-sbin := rpcinfo
85 install-bin := rpcgen
86 rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
87 rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \
88 rpc_tblout.o rpc_sample.o
89 # These headers are part of rpcgen.
90 distribute := proto.h rpc_util.h rpc_parse.h rpc_scan.h \
91 $(headers-in-tirpc) $(headers-not-in-tirpc) \
92 $(rpcgen-objs:.o=.c) etc.rpc \
93 errqueue.h
94 extra-objs = $(rpcgen-objs)
95
96 all: # Make this the default target; it will be defined in Rules.
97
98 tests = tst-xdrmem tst-xdrmem2
99 xtests := tst-getmyaddr
100
101 ifeq ($(have-thread-library),yes)
102 xtests += thrsvc
103 endif
104 distribute += thrsvc.c
105
106 ifeq (yes,$(build-static-nss))
107 otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
108 $(resolvobjdir)/libresolv.a
109 endif
110
111 ifeq (no,$(cross-compiling))
112 # We can only build this library if we can run the rpcgen we build.
113 headers += $(rpcsvc:%.x=rpcsvc/%.h)
114 extra-libs := librpcsvc
115 extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
116 librpcsvc-routines = $(rpcsvc:%.x=x%)
117 librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
118 omit-deps = $(librpcsvc-routines)
119 endif
120
121 include ../Rules
122
123 ifeq (yes,$(build-shared))
124 rpc-compat-routines = $(addprefix compat-,$(need-export-routines))
125 rpc-compat-routines.os = $(addprefix $(objpfx), \
126 $(addsuffix .os,$(rpc-compat-routines)))
127 subdir_lib: $(objpfx)librpc_compat_pic.a
128 $(objpfx)librpc_compat_pic.a: $(rpc-compat-routines.os)
129 $(AR) cr$(verbose) $@ $^
130 $(rpc-compat-routines.os): $(objpfx)compat-%.os: %.c $(before-compile)
131 $(compile-command.c) -DEXPORT_RPC_SYMBOLS
132 endif
133
134 CFLAGS-xbootparam_prot.c = -Wno-unused $(PIC-ccflag)
135 CFLAGS-xnlm_prot.c = -Wno-unused $(PIC-ccflag)
136 CFLAGS-xrstat.c = -Wno-unused $(PIC-ccflag)
137 CFLAGS-xyppasswd.c = -Wno-unused $(PIC-ccflag)
138 CFLAGS-xklm_prot.c = -Wno-unused $(PIC-ccflag)
139 CFLAGS-xrex.c = -Wno-unused $(PIC-ccflag)
140 CFLAGS-xsm_inter.c = -Wno-unused $(PIC-ccflag)
141 CFLAGS-xmount.c = -Wno-unused $(PIC-ccflag)
142 CFLAGS-xrusers.c = -Wno-unused $(PIC-ccflag)
143 CFLAGS-xspray.c = -Wno-unused $(PIC-ccflag)
144 CFLAGS-xnfs_prot.c = -Wno-unused $(PIC-ccflag)
145 CFLAGS-xrquota.c = -Wno-unused $(PIC-ccflag)
146 CFLAGS-xkey_prot.c = -Wno-unused $(PIC-ccflag)
147 CFLAGS-auth_unix.c = -fexceptions
148 CFLAGS-key_call.c = -fexceptions
149 CFLAGS-pmap_rmt.c = -fexceptions
150 CFLAGS-clnt_perr.c = -fexceptions
151 CFLAGS-openchild.c = -fexceptions
152
153 CPPFLAGS += -D_RPC_THREAD_SAFE_
154
155 $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
156 $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
157 $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
158
159 $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) \
160 $(sort $(filter $(common-objpfx)libc%,$(link-libc))) \
161 $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
162 $(+link)
163
164 # This makes sure -DNOT_IN_libc is passed for all these modules.
165 cpp-srcs-left := $(rpcgen-objs:.o=.c)
166 lib := nonlib
167 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
168
169 # Tell rpcgen where to find the C preprocessor.
170 rpcgen-cmd = CPP='$(CC) -E -x c-header' $(built-program-cmd) -Y ../scripts
171
172 # Install the rpc data base file.
173 $(inst_sysconfdir)/rpc: etc.rpc $(+force)
174 $(do-install)
175 \f
176 # Generate the rpcsvc headers with rpcgen.
177 # We use a stamp file to avoid unnessary recompilation each time rpcgen is
178 # relinked.
179 $(rpcsvc:%.x=$(objpfx)rpcsvc/%.h): $(objpfx)rpcsvc/%.h: $(objpfx)rpcsvc/%.stmp
180 @:
181 $(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)rpcgen
182 $(make-target-directory)
183 -@rm -f ${@:stmp=T} $@
184 $(rpcgen-cmd) -h $< -o ${@:stmp=T}
185 $(move-if-change) $(@:stmp=T) $(@:stmp=h)
186 touch $@
187
188 # Generate the rpcsvc XDR functions with rpcgen.
189 $(rpcsvc:%.x=$(objpfx)x%.c): $(objpfx)x%.c: $(objpfx)x%.stmp
190 @:
191 $(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)rpcgen
192 -@rm -f ${@:stmp=T} $@
193 $(rpcgen-cmd) -c $< -o ${@:stmp=T}
194 $(move-if-change) $(@:stmp=T) $(@:stmp=c)
195 touch $@
196
197 # The generated source files depend on the corresponding generated headers.
198 # Gratuitous dependency on generated .c file here just gets it mentioned to
199 # avoid being an intermediate file and getting removed.
200 define o-iterator-doit
201 $(rpcsvc:%.x=$(objpfx)x%$o): $(objpfx)x%$o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h
202 endef
203 object-suffixes-left = $(filter-out $(librpcsvc-inhibit-o),$(object-suffixes))
204 include $(o-iterator)
205
206 rpcsvc-dt-files := $(foreach o,$(filter-out $(librpcsvc-inhibit-o),\
207 $(object-suffixes)),\
208 $(rpcsvc:%.x=$(objpfx)x%$o.dt))
209 rpcsvc-depfiles := $(patsubst %.dt,%.d,$(wildcard $(rpcsvc-dt-files))) \
210 $(wildcard $(rpcsvc-dt-files:.dt=.d))
211 ifdef rpcsvc-depfiles
212 ifneq ($(no_deps),t)
213 -include $(rpcsvc-depfiles)
214 endif
215 endif
216
217 $(objpfx)thrsvc: $(common-objpfx)linkobj/libc.so $(shared-thread-library)