Update.
[glibc.git] / sunrpc / Makefile
blobd4595482a227dd5658f52646fcbb35e1b81b13e5
1 # Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
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.
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.
14 # You should have received a copy of the GNU Library General Public
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.
20 # Sub-makefile for sunrpc portion of the library.
22 subdir := sunrpc
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:
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 # rpcsvc/bootparam_prot.x -> rpcsvc/bootparam.x
48 rpcsvc = bootparam.x nlm_prot.x rstat.x \
49 yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \
50 rusers.x spray.x nfs_prot.x rquota.x
51 headers = $(addprefix rpc/,auth.h auth_unix.h clnt.h netdb.h pmap_clnt.h \
52 pmap_prot.h pmap_rmt.h rpc.h rpc_msg.h svc.h \
53 svc_auth.h types.h xdr.h auth_des.h) \
54 $(rpcsvc:%=rpcsvc/%)
55 install-others = $(inst_sysconfdir)/rpc
56 generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) \
57 $(rpcsvc:%.x=rpcsvc/%.stmp) $(rpcsvc:%.x=x%.stmp) \
58 rpc-proto.c
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 \
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
69 others := rpcinfo
70 install-bin := rpcgen
71 install-sbin := rpcinfo
72 rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
73 rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \
74 rpc_tblout.o rpc_sample.o
75 # These headers are part of rpcgen.
76 distribute := proto.h rpc_util.h rpc_parse.h rpc_scan.h \
77 $(rpcgen-objs:.o=.c) etc.rpc
78 extra-objs = $(rpcgen-objs)
80 all: # Make this the default target; it will be defined in Rules.
82 include ../Makeconfig
84 ifeq (no,$(cross-compiling))
85 # We can only build this library if we can run the rpcgen we build.
86 headers += $(rpcsvc:%.x=rpcsvc/%.h)
87 install-others += $(inst_includedir)/rpcsvc/bootparam_prot.h
88 extra-libs := librpcsvc
89 extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
90 librpcsvc-routines = $(rpcsvc:%.x=x%)
91 librpcsvc-inhibit-o = .so # Build no shared rpcsvc library.
92 omit-deps = $(librpcsvc-routines)
93 endif
95 CFLAGS-xbootparam.c = -Wno-unused
96 CFLAGS-xnlm_prot.c = -Wno-unused
97 CFLAGS-xrstat.c = -Wno-unused
98 CFLAGS-xyppasswd.c = -Wno-unused
99 CFLAGS-xklm_prot.c = -Wno-unused
100 CFLAGS-xrex.c = -Wno-unused
101 CFLAGS-xsm_inter.c = -Wno-unused
102 CFLAGS-xmount.c = -Wno-unused
103 CFLAGS-xrusers.c = -Wno-unused
104 CFLAGS-xspray.c = -Wno-unused
105 CFLAGS-xnfs_prot.c = -Wno-unused
106 CFLAGS-xrquota.c = -Wno-unused
108 include ../Rules
110 $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) $(common-objpfx)libc.a
111 $(+link)
113 rpcgen-cmd = $(built-program-cmd)
115 # The proper file name is longer than 14 chars, so we install it under
116 # a shorter name. But if the filesystem can handle it, we want to
117 # install under the proper name as well.
118 $(inst_includedir)/rpcsvc/bootparam_prot.h: \
119 $(inst_includedir)/rpcsvc/bootparam.h
120 @echo It is safe to ignore an error here if this file name is too long.
121 -$(do-install)
123 # Install the rpc data base file.
124 $(inst_sysconfdir)/rpc: etc.rpc
125 $(do-install)
127 # Generate the rpcsvc headers with rpcgen.
128 # We use a stamp file to avoid unnessary recompilation each time rpcgen is
129 # relinked.
130 $(rpcsvc:%.x=$(objpfx)rpcsvc/%.h): $(objpfx)rpcsvc/%.h: $(objpfx)rpcsvc/%.stmp
132 $(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)rpcgen
133 $(make-target-directory)
134 -@rm -f ${@:stmp=T} $@
135 $(rpcgen-cmd) -h $< -o ${@:stmp=T}
136 if test -r ${@:stmp=h} && cmp -s ${@:stmp=h} ${@:stmp=T}; \
137 then rm -f ${@:stmp=T}; \
138 else mv -f ${@:stmp=T} ${@:stmp=h}; fi
139 touch $@
141 # Generate the rpcsvc XDR functions with rpcgen.
142 $(rpcsvc:%.x=$(objpfx)x%.c): $(objpfx)x%.c: $(objpfx)x%.stmp
144 $(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)rpcgen
145 -@rm -f ${@:stmp=T} $@
146 $(rpcgen-cmd) -c $< -o ${@:stmp=T}
147 if test -r ${@:stmp=c} && cmp -s ${@:stmp=c} ${@:stmp=T}; \
148 then rm -f ${@:stmp=T}; \
149 else mv -f ${@:stmp=T} ${@:stmp=c}; fi
150 touch $@
152 # The generated source files depend on the corresponding generated headers.
153 # Gratuitous dependency on generated .c file here just gets it mentioned to
154 # avoid being an intermediate file and getting removed.
155 $(rpcsvc:%.x=$(objpfx)x%.o): $(objpfx)x%.o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h \
156 $(objpfx)rpc-proto.d
158 ifndef no_deps
159 -include $(objpfx)rpc-proto.d
160 endif
162 $(objpfx)rpc-proto.d: $(objpfx)%.d: $(objpfx)%.c
163 $(+make-deps)
164 # Special file to generate dependencies for the RPC service objects.
165 # Collect all include directives from the source files.
166 $(objpfx)rpc-proto.c: $(rpcsvc:%=rpcsvc/%)
167 $(make-target-directory)
168 { echo '#include <rpc/types.h>'; \
169 echo '#include <rpc/xdr.h>'; \
170 echo '#include <rpc/rpc.h>'; \
171 sed -n '/^%#include/s/%//p' $^; } > $@T
172 mv -f $@T $@