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