6d457a0434935c03eb2a4f8682bc9f2746fd0f17
[platform/upstream/glibc.git] / sunrpc / Makefile
1 # Copyright (C) 1994, 1995, 1996 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 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
15 # License along with the GNU C Library; see the file COPYING.LIB.  If
16 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 # Cambridge, MA 02139, 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.  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:
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
49 headers = $(addprefix rpc/,auth.h auth_unix.h clnt.h netdb.h pmap_clnt.h \
50                            pmap_prot.h pmap_rmt.h rpc.h rpc_msg.h svc.h \
51                            svc_auth.h types.h xdr.h) \
52           $(rpcsvc:%=rpcsvc/%) $(rpcsvc:%.x=rpcsvc/%.h)
53 rpcsvc = bootparam.x nlm_prot.x rstat.x \
54          yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \
55          rnusers.x spray.x nfs_prot.x rquota.x
56 install-others = $(includedir)/rpcsvc/bootparam_prot.h \
57                  $(sysconfdir)/rpc
58 generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c)
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 \
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
68
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)
79
80 all: # Make this the default target; it will be defined in Rules.
81
82 # Sun's code is not too clean.
83 override +gccwarn := -w
84
85 include ../Makeconfig
86
87 ifeq (no,$(cross-compiling))
88 # We can only build this library if we can run the rpcgen we build.
89 extra-libs := librpcsvc
90 extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
91 librpcsvc-routines = $(rpcsvc:%.x=x%)
92 librpcsvc-inhibit-o = .so # Build no shared rpcsvc library.
93 omit-deps = $(librpcsvc-routines)
94 endif
95
96 include ../Rules
97
98 $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) $(common-objpfx)libc.a
99         $(+link)
100
101 rpcgen-cmd = $(built-program-cmd)
102
103 # The proper file name is longer than 14 chars, so we install it under
104 # a shorter name.  But if the filesystem can handle it, we want to
105 # install under the proper name as well.
106 $(includedir)/rpcsvc/bootparam_prot.h: $(includedir)/rpcsvc/bootparam.h
107         @echo It is safe to ignore an error here if this file name is too long.
108         -$(do-install)
109
110 # Install the rpc data base file.
111 $(sysconfdir)/rpc: etc.rpc
112         $(do-install)
113
114 defines := $(defines) -D_PATH_RPC='"$(sysconfdir)/rpc"'
115 \f
116 # Generate the rpcsvc headers with rpcgen.
117 $(objpfx)rpcsvc/%.h: rpcsvc/%.x $(objpfx)rpcgen
118         $(make-target-directory)
119         -@rm -f $@T
120         $(rpcgen-cmd) -h $< -o $@T
121         mv -f $@T $@
122
123 # Generate the rpcsvc XDR functions with rpcgen.
124 $(objpfx)x%.c: rpcsvc/%.x $(objpfx)rpcgen
125         -@rm -f $@T
126         $(rpcgen-cmd) -c $< -o $@T
127         mv -f $@T $@
128
129 # The generated source files depend on the corresponding generated headers.
130 # Gratuitous dependency on generated .c file here just gets it mentioned to
131 # avoid being an intermediate file and getting removed.
132 $(rpcsvc:%.x=$(objpfx)x%.o): $(objpfx)x%.o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h