]>
Commit | Line | Data |
---|---|---|
0c5ecdc4 | 1 | # Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. |
28f540f4 RM |
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 Library General Public License as | |
6 | # published by the Free Software Foundation; either version 2 of the | |
7 | # 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 | # Library General Public License for more details. | |
13 | ||
14 | # You should have received a copy of the GNU Library General Public | |
0c5ecdc4 UD |
15 | # License along with the GNU C Library; see the file COPYING.LIB. If not, |
16 | # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
17 | # Boston, MA 02111-1307, USA. | |
28f540f4 RM |
18 | |
19 | # | |
20 | # Sub-makefile for sunrpc portion of the library. | |
21 | # | |
22 | subdir := sunrpc | |
23 | ||
0d204b0a UD |
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. A few files needed trivial | |
27 | # modifications to compile in the GNU environment; these changes are | |
28 | # marked by comments that say `roland@gnu'. All the code from Sun's | |
29 | # rpc, etc, and rpcgen subdirectories is in this directory; the rpc | |
30 | # subdirectory contains only the header files. Other than that, | |
31 | # several files were renamed so as not to exceed 14-character file | |
32 | # name limits: | |
28f540f4 RM |
33 | # |
34 | # authunix_prot.c -> authuxprot.c | |
35 | # bindresvport.c -> bindrsvprt.c | |
36 | # clnt_generic.c -> clnt_gen.c | |
37 | # clnt_perror.c -> clnt_perr.c | |
38 | # clnt_simple.c -> clnt_simp.c | |
39 | # get_myaddress.c -> get_myaddr.c | |
40 | # pmap_getmaps.c -> pm_getmaps.c | |
41 | # pmap_getport.c -> pm_getport.c | |
42 | # rpc_callmsg.c -> rpc_cmsg.c | |
43 | # rpc_commondata.c -> rpc_common.c | |
44 | # rpc_dtablesize.c -> rpc_dtable.c | |
45 | # svc_auth_unix.c -> svc_authux.c | |
46 | # xdr_reference.c -> xdr_ref.c | |
47 | # rpcsvc/bootparam_prot.x -> rpcsvc/bootparam.x | |
48 | ||
28f540f4 RM |
49 | rpcsvc = bootparam.x nlm_prot.x rstat.x \ |
50 | yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \ | |
84384f5b | 51 | rusers.x spray.x nfs_prot.x rquota.x |
56552e42 UD |
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 | $(rpcsvc:%=rpcsvc/%) | |
19361cb7 | 56 | install-others = $(inst_sysconfdir)/rpc |
6952e59e | 57 | generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) \ |
377a515b UD |
58 | $(rpcsvc:%.x=rpcsvc/%.stmp) $(rpcsvc:%.x=x%.stmp) \ |
59 | rpc-proto.c | |
28f540f4 RM |
60 | |
61 | routines := auth_none auth_unix authuxprot bindrsvprt \ | |
62 | clnt_gen clnt_perr clnt_raw clnt_simp clnt_tcp \ | |
5f0e6fc7 | 63 | clnt_udp rpc_dtable get_myaddr getrpcport \ |
28f540f4 RM |
64 | pmap_clnt pm_getmaps pm_getport pmap_prot \ |
65 | pmap_prot2 pmap_rmt rpc_prot rpc_common rpc_cmsg \ | |
66 | svc svc_auth svc_authux svc_raw svc_run svc_simple \ | |
67 | svc_tcp svc_udp xdr xdr_array xdr_float xdr_mem \ | |
d4a089cf | 68 | xdr_rec xdr_ref xdr_stdio publickey |
28f540f4 | 69 | |
46ec036d | 70 | others := rpcinfo |
28f540f4 | 71 | install-bin := rpcgen |
8145a974 | 72 | install-sbin := rpcinfo |
28f540f4 | 73 | rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \ |
0d204b0a UD |
74 | rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \ |
75 | rpc_tblout.o rpc_sample.o | |
28f540f4 | 76 | # These headers are part of rpcgen. |
0d204b0a UD |
77 | distribute := proto.h rpc_util.h rpc_parse.h rpc_scan.h \ |
78 | $(rpcgen-objs:.o=.c) etc.rpc | |
693e7b96 RM |
79 | extra-objs = $(rpcgen-objs) |
80 | ||
e75154a6 RM |
81 | all: # Make this the default target; it will be defined in Rules. |
82 | ||
83 | include ../Makeconfig | |
84 | ||
a5113b14 | 85 | ifeq (no,$(cross-compiling)) |
e75154a6 | 86 | # We can only build this library if we can run the rpcgen we build. |
6952e59e UD |
87 | headers += $(rpcsvc:%.x=rpcsvc/%.h) |
88 | install-others += $(inst_includedir)/rpcsvc/bootparam_prot.h | |
693e7b96 | 89 | extra-libs := librpcsvc |
dbe31b9a | 90 | extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass. |
693e7b96 RM |
91 | librpcsvc-routines = $(rpcsvc:%.x=x%) |
92 | librpcsvc-inhibit-o = .so # Build no shared rpcsvc library. | |
93 | omit-deps = $(librpcsvc-routines) | |
e75154a6 | 94 | endif |
28f540f4 | 95 | |
e7fd8a39 UD |
96 | CFLAGS-xbootparam.c = -Wno-unused |
97 | CFLAGS-xnlm_prot.c = -Wno-unused | |
98 | CFLAGS-xrstat.c = -Wno-unused | |
99 | CFLAGS-xyppasswd.c = -Wno-unused | |
100 | CFLAGS-xklm_prot.c = -Wno-unused | |
101 | CFLAGS-xrex.c = -Wno-unused | |
102 | CFLAGS-xsm_inter.c = -Wno-unused | |
103 | CFLAGS-xmount.c = -Wno-unused | |
104 | CFLAGS-xrusers.c = -Wno-unused | |
105 | CFLAGS-xspray.c = -Wno-unused | |
106 | CFLAGS-xnfs_prot.c = -Wno-unused | |
107 | CFLAGS-xrquote.c = -Wno-unused | |
108 | ||
28f540f4 RM |
109 | include ../Rules |
110 | ||
693e7b96 | 111 | $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) $(common-objpfx)libc.a |
28f540f4 RM |
112 | $(+link) |
113 | ||
03a75825 | 114 | rpcgen-cmd = $(built-program-cmd) |
28f540f4 RM |
115 | |
116 | # The proper file name is longer than 14 chars, so we install it under | |
117 | # a shorter name. But if the filesystem can handle it, we want to | |
118 | # install under the proper name as well. | |
8d57beea UD |
119 | $(inst_includedir)/rpcsvc/bootparam_prot.h: \ |
120 | $(inst_includedir)/rpcsvc/bootparam.h | |
28f540f4 RM |
121 | @echo It is safe to ignore an error here if this file name is too long. |
122 | -$(do-install) | |
123 | ||
124 | # Install the rpc data base file. | |
8d57beea | 125 | $(inst_sysconfdir)/rpc: etc.rpc |
28f540f4 RM |
126 | $(do-install) |
127 | ||
128 | defines := $(defines) -D_PATH_RPC='"$(sysconfdir)/rpc"' | |
129 | \f | |
28f540f4 | 130 | # Generate the rpcsvc headers with rpcgen. |
c0e45674 UD |
131 | # We use a stamp file to avoid unnessary recompilation each time rpcgen is |
132 | # relinked. | |
6952e59e | 133 | $(rpcsvc:%.x=$(objpfx)rpcsvc/%.h): $(objpfx)rpcsvc/%.h: $(objpfx)rpcsvc/%.stmp; |
c0e45674 | 134 | $(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)rpcgen |
28f540f4 | 135 | $(make-target-directory) |
c0e45674 UD |
136 | -@rm -f ${@:stmp=T} $@ |
137 | $(rpcgen-cmd) -h $< -o ${@:stmp=T} | |
138 | if test -r ${@:stmp=h} && cmp -s ${@:stmp=h} ${@:stmp=T}; \ | |
139 | then rm -f ${@:stmp=T}; \ | |
140 | else mv -f ${@:stmp=T} ${@:stmp=h}; fi | |
141 | touch $@ | |
0d204b0a | 142 | |
28f540f4 | 143 | # Generate the rpcsvc XDR functions with rpcgen. |
6952e59e | 144 | $(rpcsvc:%.x=$(objpfx)x%.c): $(objpfx)x%.c: $(objpfx)x%.stmp; |
c0e45674 UD |
145 | $(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)rpcgen |
146 | -@rm -f ${@:stmp=T} $@ | |
147 | $(rpcgen-cmd) -c $< -o ${@:stmp=T} | |
148 | if test -r ${@:stmp=c} && cmp -s ${@:stmp=c} ${@:stmp=T}; \ | |
149 | then rm -f ${@:stmp=T}; \ | |
150 | else mv -f ${@:stmp=T} ${@:stmp=c}; fi | |
151 | touch $@ | |
152 | ||
28f540f4 RM |
153 | # The generated source files depend on the corresponding generated headers. |
154 | # Gratuitous dependency on generated .c file here just gets it mentioned to | |
155 | # avoid being an intermediate file and getting removed. | |
377a515b UD |
156 | $(rpcsvc:%.x=$(objpfx)x%.o): $(objpfx)x%.o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h \ |
157 | $(objpfx)rpc-proto.d | |
158 | ||
159 | ifndef no_deps | |
160 | -include $(objpfx)rpc-proto.d | |
161 | endif | |
162 | ||
163 | $(objpfx)rpc-proto.d: $(objpfx)%.d: $(objpfx)%.c | |
164 | $(+make-deps) | |
165 | # Special file to generate dependencies for the RPC service objects. | |
166 | # Collect all include directives from the source files. | |
167 | $(objpfx)rpc-proto.c: $(rpcsvc:%=rpcsvc/%) | |
4cca6b86 | 168 | $(make-target-directory) |
377a515b UD |
169 | { echo '#include <rpc/types.h>'; \ |
170 | echo '#include <rpc/xdr.h>'; \ | |
171 | echo '#include <rpc/rpc.h>'; \ | |
172 | sed -n '/^%#include/s/%//p' $^; } > $@T | |
173 | mv -f $@T $@ |