Update.
[glibc.git] / sunrpc / Makefile
blob1ce03d7d987f8fd2ddade173b4d3932c1cb3e6eb
1 # Copyright (C) 1994, 95, 96, 97, 98, 99 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
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) rpc-proto.c rpc-proto.d rpcgen
59 routines := auth_none auth_unix authuxprot bindrsvprt \
60 clnt_gen clnt_perr clnt_raw clnt_simp clnt_tcp \
61 clnt_udp rpc_dtable get_myaddr getrpcport \
62 pmap_clnt pm_getmaps pm_getport pmap_prot \
63 pmap_prot2 pmap_rmt rpc_prot rpc_common rpc_cmsg \
64 svc svc_auth svc_authux svc_raw svc_run svc_simple \
65 svc_tcp svc_udp xdr xdr_array xdr_float xdr_mem \
66 xdr_rec xdr_ref xdr_stdio publickey xdr_sizeof \
67 auth_des authdes_prot des_crypt des_impl des_soft \
68 key_call key_prot netname openchild rtime svcauth_des xcrypt\
69 clnt_unix svc_unix create_xid xdr_intXX_t
71 others := rpcinfo
72 install-bin := rpcgen
73 install-sbin := rpcinfo
74 rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
75 rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \
76 rpc_tblout.o rpc_sample.o
77 # These headers are part of rpcgen.
78 distribute := proto.h rpc_util.h rpc_parse.h rpc_scan.h \
79 $(rpcgen-objs:.o=.c) etc.rpc
80 extra-objs = $(rpcgen-objs)
82 all: # Make this the default target; it will be defined in Rules.
84 include ../Makeconfig
86 ifeq (yes,$(build-static-nss))
87 otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
88 $(resolvobjdir)/libresolv.a
89 endif
91 ifeq (no,$(cross-compiling))
92 # We can only build this library if we can run the rpcgen we build.
93 headers += $(rpcsvc:%.x=rpcsvc/%.h)
94 extra-libs := librpcsvc
95 extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
96 librpcsvc-routines = $(rpcsvc:%.x=x%)
97 librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
98 omit-deps = $(librpcsvc-routines)
99 endif
101 CFLAGS-xbootparam_prot.c = -Wno-unused
102 CFLAGS-xnlm_prot.c = -Wno-unused
103 CFLAGS-xrstat.c = -Wno-unused
104 CFLAGS-xyppasswd.c = -Wno-unused
105 CFLAGS-xklm_prot.c = -Wno-unused
106 CFLAGS-xrex.c = -Wno-unused
107 CFLAGS-xsm_inter.c = -Wno-unused
108 CFLAGS-xmount.c = -Wno-unused
109 CFLAGS-xrusers.c = -Wno-unused
110 CFLAGS-xspray.c = -Wno-unused
111 CFLAGS-xnfs_prot.c = -Wno-unused
112 CFLAGS-xrquota.c = -Wno-unused
113 CFLAGS-xkey_prot.c = -Wno-unused
115 ifeq (yes,$(have_doors))
116 CPPFLAGS-key_call.c += -DHAVE_DOORS=1
117 endif
119 include ../Rules
121 $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) \
122 $(sort $(filter $(common-objpfx)libc%,$(link-libc))) \
123 $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
124 $(+link)
126 # Tell rpcgen where to find the C preprocessor.
127 rpcgen-cmd = $(built-program-cmd) -Y `$(CC) -print-file-name=cpp | \
128 sed "s|/cpp$$||"`
130 # Install the rpc data base file.
131 $(inst_sysconfdir)/rpc: etc.rpc $(+force)
132 $(do-install)
134 # Generate the rpcsvc headers with rpcgen.
135 # We use a stamp file to avoid unnessary recompilation each time rpcgen is
136 # relinked.
137 $(rpcsvc:%.x=$(objpfx)rpcsvc/%.h): $(objpfx)rpcsvc/%.h: $(objpfx)rpcsvc/%.stmp
139 $(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)rpcgen
140 $(make-target-directory)
141 -@rm -f ${@:stmp=T} $@
142 $(rpcgen-cmd) -h $< -o ${@:stmp=T}
143 $(move-if-change) $(@:stmp=T) $(@:stmp=h)
144 touch $@
146 # Generate the rpcsvc XDR functions with rpcgen.
147 $(rpcsvc:%.x=$(objpfx)x%.c): $(objpfx)x%.c: $(objpfx)x%.stmp
149 $(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)rpcgen
150 -@rm -f ${@:stmp=T} $@
151 $(rpcgen-cmd) -c $< -o ${@:stmp=T}
152 $(move-if-change) $(@:stmp=T) $(@:stmp=c)
153 touch $@
155 # The generated source files depend on the corresponding generated headers.
156 # Gratuitous dependency on generated .c file here just gets it mentioned to
157 # avoid being an intermediate file and getting removed.
158 define o-iterator-doit
159 $(rpcsvc:%.x=$(objpfx)x%$o): $(objpfx)x%$o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h \
160 $(objpfx)rpc-proto.d
161 endef
162 object-suffixes-left = $(filter-out $(librpcsvc-inhibit-o),$(object-suffixes))
163 include $(o-iterator)
165 ifndef no_deps
166 -include $(objpfx)rpc-proto.d
167 endif
169 $(objpfx)rpc-proto.d: $(objpfx)%.d: $(objpfx)%.c
170 $(+make-deps)
171 # Special file to generate dependencies for the RPC service objects.
172 # Collect all include directives from the source files.
173 $(objpfx)rpc-proto.c: $(rpcsvc:%=rpcsvc/%)
174 $(make-target-directory)
175 { echo '#include <rpc/types.h>'; \
176 echo '#include <rpc/xdr.h>'; \
177 echo '#include <rpc/rpc.h>'; \
178 sed -n '/^%#include/s/%//p' $^; } > $@T
179 mv -f $@T $@