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