1 | # Copyright (C) 1994-2004, 2005 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 = $(addprefix rpc/,auth.h auth_unix.h clnt.h netdb.h pmap_clnt.h \
|
---|
51 | pmap_prot.h pmap_rmt.h rpc.h rpc_msg.h svc.h \
|
---|
52 | svc_auth.h types.h xdr.h auth_des.h \
|
---|
53 | des_crypt.h key_prot.h rpc_des.h) \
|
---|
54 | $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
|
---|
55 | install-others = $(inst_sysconfdir)/rpc
|
---|
56 | generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
|
---|
57 | $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
|
---|
58 | generated-dirs := rpcsvc
|
---|
59 |
|
---|
60 | routines := auth_none auth_unix authuxprot bindrsvprt \
|
---|
61 | clnt_gen clnt_perr clnt_raw clnt_simp clnt_tcp \
|
---|
62 | clnt_udp rpc_dtable get_myaddr getrpcport \
|
---|
63 | pmap_clnt pm_getmaps pm_getport pmap_prot \
|
---|
64 | pmap_prot2 pmap_rmt rpc_prot rpc_common rpc_cmsg rpc_thread \
|
---|
65 | svc svc_auth svc_authux svc_raw svc_run svc_simple \
|
---|
66 | svc_tcp svc_udp xdr xdr_array xdr_float xdr_mem \
|
---|
67 | xdr_rec xdr_ref xdr_stdio publickey xdr_sizeof \
|
---|
68 | auth_des authdes_prot des_crypt des_impl des_soft \
|
---|
69 | key_call key_prot netname openchild rtime svcauth_des xcrypt\
|
---|
70 | clnt_unix svc_unix create_xid xdr_intXX_t
|
---|
71 |
|
---|
72 | others := rpcinfo
|
---|
73 | install-bin := rpcgen
|
---|
74 | install-sbin := rpcinfo
|
---|
75 | rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
|
---|
76 | rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \
|
---|
77 | rpc_tblout.o rpc_sample.o
|
---|
78 | # These headers are part of rpcgen.
|
---|
79 | distribute := proto.h rpc_util.h rpc_parse.h rpc_scan.h \
|
---|
80 | $(rpcgen-objs:.o=.c) etc.rpc \
|
---|
81 | errqueue.h
|
---|
82 | extra-objs = $(rpcgen-objs)
|
---|
83 |
|
---|
84 | all: # Make this the default target; it will be defined in Rules.
|
---|
85 |
|
---|
86 | include ../Makeconfig
|
---|
87 |
|
---|
88 | xtests := tst-getmyaddr
|
---|
89 |
|
---|
90 | ifeq ($(have-thread-library),yes)
|
---|
91 | xtests += thrsvc
|
---|
92 | endif
|
---|
93 | distribute += thrsvc.c
|
---|
94 |
|
---|
95 | ifeq (yes,$(build-static-nss))
|
---|
96 | otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
|
---|
97 | $(resolvobjdir)/libresolv.a
|
---|
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 | CFLAGS-xbootparam_prot.c = -Wno-unused $(PIC-ccflag)
|
---|
111 | CFLAGS-xnlm_prot.c = -Wno-unused $(PIC-ccflag)
|
---|
112 | CFLAGS-xrstat.c = -Wno-unused $(PIC-ccflag)
|
---|
113 | CFLAGS-xyppasswd.c = -Wno-unused $(PIC-ccflag)
|
---|
114 | CFLAGS-xklm_prot.c = -Wno-unused $(PIC-ccflag)
|
---|
115 | CFLAGS-xrex.c = -Wno-unused $(PIC-ccflag)
|
---|
116 | CFLAGS-xsm_inter.c = -Wno-unused $(PIC-ccflag)
|
---|
117 | CFLAGS-xmount.c = -Wno-unused $(PIC-ccflag)
|
---|
118 | CFLAGS-xrusers.c = -Wno-unused $(PIC-ccflag)
|
---|
119 | CFLAGS-xspray.c = -Wno-unused $(PIC-ccflag)
|
---|
120 | CFLAGS-xnfs_prot.c = -Wno-unused $(PIC-ccflag)
|
---|
121 | CFLAGS-xrquota.c = -Wno-unused $(PIC-ccflag)
|
---|
122 | CFLAGS-xkey_prot.c = -Wno-unused $(PIC-ccflag)
|
---|
123 | CFLAGS-auth_unix.c = -fexceptions
|
---|
124 | CFLAGS-key_call.c = -fexceptions
|
---|
125 | CFLAGS-pmap_rmt.c = -fexceptions
|
---|
126 | CFLAGS-clnt_perr.c = -fexceptions
|
---|
127 | CFLAGS-openchild.c = -fexceptions
|
---|
128 |
|
---|
129 | CPPFLAGS += -D_RPC_THREAD_SAFE_
|
---|
130 |
|
---|
131 | include ../Rules
|
---|
132 |
|
---|
133 | $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) \
|
---|
134 | $(sort $(filter $(common-objpfx)libc%,$(link-libc))) \
|
---|
135 | $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
|
---|
136 | $(+link)
|
---|
137 |
|
---|
138 | # This makes sure -DNOT_IN_libc is passed for all these modules.
|
---|
139 | cpp-srcs-left := $(rpcgen-objs:.o=.c)
|
---|
140 | lib := nonlib
|
---|
141 | include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
|
---|
142 |
|
---|
143 | # Tell rpcgen where to find the C preprocessor.
|
---|
144 | rpcgen-cmd = CPP='$(CC) -E -x c-header' $(built-program-cmd) -Y ../scripts
|
---|
145 |
|
---|
146 | # Install the rpc data base file.
|
---|
147 | $(inst_sysconfdir)/rpc: etc.rpc $(+force)
|
---|
148 | $(do-install)
|
---|
149 | |
---|
150 |
|
---|
151 | # Generate the rpcsvc headers with rpcgen.
|
---|
152 | # We use a stamp file to avoid unnessary recompilation each time rpcgen is
|
---|
153 | # relinked.
|
---|
154 | $(rpcsvc:%.x=$(objpfx)rpcsvc/%.h): $(objpfx)rpcsvc/%.h: $(objpfx)rpcsvc/%.stmp
|
---|
155 | @:
|
---|
156 | $(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)rpcgen
|
---|
157 | $(make-target-directory)
|
---|
158 | -@rm -f ${@:stmp=T} $@
|
---|
159 | $(rpcgen-cmd) -h $< -o ${@:stmp=T}
|
---|
160 | $(move-if-change) $(@:stmp=T) $(@:stmp=h)
|
---|
161 | touch $@
|
---|
162 |
|
---|
163 | # Generate the rpcsvc XDR functions with rpcgen.
|
---|
164 | $(rpcsvc:%.x=$(objpfx)x%.c): $(objpfx)x%.c: $(objpfx)x%.stmp
|
---|
165 | @:
|
---|
166 | $(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)rpcgen
|
---|
167 | -@rm -f ${@:stmp=T} $@
|
---|
168 | $(rpcgen-cmd) -c $< -o ${@:stmp=T}
|
---|
169 | $(move-if-change) $(@:stmp=T) $(@:stmp=c)
|
---|
170 | touch $@
|
---|
171 |
|
---|
172 | # The generated source files depend on the corresponding generated headers.
|
---|
173 | # Gratuitous dependency on generated .c file here just gets it mentioned to
|
---|
174 | # avoid being an intermediate file and getting removed.
|
---|
175 | define o-iterator-doit
|
---|
176 | $(rpcsvc:%.x=$(objpfx)x%$o): $(objpfx)x%$o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h
|
---|
177 | endef
|
---|
178 | object-suffixes-left = $(filter-out $(librpcsvc-inhibit-o),$(object-suffixes))
|
---|
179 | include $(o-iterator)
|
---|
180 |
|
---|
181 | rpcsvc-dt-files := $(foreach o,$(filter-out $(librpcsvc-inhibit-o),\
|
---|
182 | $(object-suffixes)),\
|
---|
183 | $(rpcsvc:%.x=$(objpfx)x%$o.dt))
|
---|
184 | rpcsvc-depfiles := $(patsubst %.dt,%.d,$(wildcard $(rpcsvc-dt-files))) \
|
---|
185 | $(wildcard $(rpcsvc-dt-files:.dt=.d))
|
---|
186 | ifdef rpcsvc-depfiles
|
---|
187 | ifneq ($(no_deps),t)
|
---|
188 | -include $(rpcsvc-depfiles)
|
---|
189 | endif
|
---|
190 | endif
|
---|
191 |
|
---|
192 | $(objpfx)thrsvc: $(shared-thread-library)
|
---|