diff options
Diffstat (limited to 'rpc/xdr/src/Makefile.am')
| -rw-r--r-- | rpc/xdr/src/Makefile.am | 168 |
1 files changed, 70 insertions, 98 deletions
diff --git a/rpc/xdr/src/Makefile.am b/rpc/xdr/src/Makefile.am index 48aaa7ba775..0e9c377ec93 100644 --- a/rpc/xdr/src/Makefile.am +++ b/rpc/xdr/src/Makefile.am @@ -1,113 +1,85 @@ -XDRSOURCES = glusterfs3-xdr.c cli1-xdr.c nlm4-xdr.c nsm-xdr.c \ - rpc-common-xdr.c glusterd1-xdr.c acl3-xdr.c portmap-xdr.c mount3udp.c -XDRHEADERS = $(XDRSOURCES:.c=.h) -XDRGENFILES = $(XDRSOURCES:.c=.x) +if BUILD_GNFS + NFS_XDRS = nlm4-xdr.x nsm-xdr.x acl3-xdr.x mount3udp.x + NFS_SRCS = xdr-nfs3.c msg-nfs3.c + NFS_HDRS = xdr-nfs3.h msg-nfs3.h +else + NFS_EXTRA_XDRS = nlm4-xdr.x nsm-xdr.x acl3-xdr.x mount3udp.x +endif + +XDRGENFILES = glusterfs3-xdr.x glusterfs4-xdr.x cli1-xdr.x \ + rpc-common-xdr.x glusterd1-xdr.x changelog-xdr.x \ + portmap-xdr.x ${NFS_XDRS} + +XDRHEADERS = $(XDRGENFILES:.x=.h) +XDRSOURCES = $(XDRGENFILES:.x=.c) + +EXTRA_DIST = $(XDRGENFILES) libgfxdr.sym ${NFS_EXTRA_XDRS} lib_LTLIBRARIES = libgfxdr.la libgfxdr_la_CFLAGS = -Wall $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS) libgfxdr_la_CPPFLAGS = $(GF_CPPFLAGS) -D__USE_FILE_OFFSET64 \ - -I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/rpc/rpc-lib/src + -I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/rpc/rpc-lib/src \ + -I$(top_builddir)/rpc/xdr/src libgfxdr_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la -libgfxdr_la_LDFLAGS = -version-info $(LIBGFXDR_LT_VERSION) - -libgfxdr_la_SOURCES = $(XDRSOURCES) xdr-generic.c xdr-nfs3.c msg-nfs3.c - -noinst_HEADERS = $(XDRHEADERS) xdr-generic.h xdr-nfs3.h msg-nfs3.h glusterfs3.h - -CLEANFILES = $(XDRSOURCES) $(XDRHEADERS) - -EXTRA_DIST = $(XDRGENFILES) - -glusterfs3-xdr.c: glusterfs3-xdr.x glusterfs3-xdr.h - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.c=.x}; then \ - $(top_srcdir)/build-aux/xdrgen source $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; \ - fi - -glusterfs3-xdr.h: glusterfs3-xdr.x - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen header $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; \ - fi - -cli1-xdr.c: cli1-xdr.x cli1-xdr.h - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen source $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; \ - fi - -cli1-xdr.h: cli1-xdr.x - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen header $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; \ - fi +libgfxdr_la_LDFLAGS = -version-info $(LIBGFXDR_LT_VERSION) $(GF_LDFLAGS) \ + -export-symbols $(top_srcdir)/rpc/xdr/src/libgfxdr.sym -nlm4-xdr.c: nlm4-xdr.x nlm4-xdr.h - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen source $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; \ - fi +libgfxdr_la_SOURCES = xdr-generic.c ${NFS_SRCS} +nodist_libgfxdr_la_SOURCES = $(XDRSOURCES) -nlm4-xdr.h: nlm4-xdr.x - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen header $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; \ - fi +libgfxdr_la_HEADERS = xdr-generic.h glusterfs3.h rpc-pragmas.h ${NFS_HDRS} +nodist_libgfxdr_la_HEADERS = $(XDRHEADERS) -nsm-xdr.c: nsm-xdr.x nsm-xdr.h - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen source $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; \ - fi +libgfxdr_ladir = $(includedir)/glusterfs/rpc -nsm-xdr.h: nsm-xdr.x - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen header $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; \ - fi - -rpc-common-xdr.c: rpc-common-xdr.x rpc-common-xdr.h - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen source $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; \ - fi - -rpc-common-xdr.h: rpc-common-xdr.x - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen header $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; \ - fi - -glusterd1-xdr.c: glusterd1-xdr.x glusterd1-xdr.h - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen source $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; \ - fi - -glusterd1-xdr.h: glusterd1-xdr.x - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen header $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; \ - fi - -acl3-xdr.c: acl3-xdr.x acl3-xdr.h - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen source $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; \ - fi - -acl3-xdr.h: acl3-xdr.x - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen header $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; \ - fi - -portmap-xdr.c: portmap-xdr.x portmap-xdr.h - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen source $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; \ - fi - -portmap-xdr.h: portmap-xdr.x - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen header $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; \ - fi - -mount3udp.c: mount3udp.x mount3udp.h - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen source $(top_srcdir)/rpc/xdr/src/${@:.c=.x} ; \ - fi +CLEANFILES = $(XDRSOURCES) $(XDRHEADERS) -mount3udp.h: mount3udp.x - @if test -f $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; then \ - $(top_srcdir)/build-aux/xdrgen header $(top_srcdir)/rpc/xdr/src/${@:.h=.x} ; \ +# trick automake into doing BUILT_SOURCES magic +BUILT_SOURCES = $(XDRHEADERS) $(XDRSOURCES) + +xdrsrc=$(top_srcdir)/rpc/xdr/src +xdrdst=$(top_builddir)/rpc/xdr/src + +# make's dependency resolution may mean that it decides to run +# rpcgen again (unnecessarily), but as the .c file already exists, +# rpcgen will exit with an error, resulting in a build error. We +# could use a '-' (i.e. -@rpcgen ...) and suffer with noisy warnings +# in the build. Or we do this crufty thing instead. +$(XDRSOURCES): $(XDRGENFILES) + @if [ ! -e $(xdrdst)/$@ -o $(@:.c=.x) -nt $(xdrdst)/$@ ]; then \ + rpcgen -c -o $(xdrdst)/$@ $(@:.c=.x) ;\ + fi + +# d*mn sed in netbsd6 doesn't do -i (inline) +# (why are we still running smoke on netbsd6 and not netbsd7?) +$(XDRHEADERS): $(XDRGENFILES) + @if [ ! -e $(xdrdst)/$@ -o $(@:.h=.x) -nt $(xdrdst)/$@ ]; then \ + rpcgen -h -o $(@:.h=.tmp) $(@:.h=.x) && \ + sed -e '/#ifndef/ s/-/_/g' -e '/#define/ s/-/_/g' \ + -e '/#endif/ s/-/_/' -e 's/TMP_/H_/g' \ + $(@:.h=.tmp) > $(xdrdst)/$@ && \ + rm -f $(@:.h=.tmp) ; \ + fi + + +# link .x files when doing out-of-tree builds +# have to use .PHONY here to force it; all versions of make +# will think the file already exists "here" by virtue of the +# VPATH. And we have to have the .x file in $cwd in order to +# have rpcgen generate "nice" #include directives +# i.e. (nice): +# #include "acl3-xdr.h" +# versus (not nice): +# #include "../../../../foo/src/rpc/xdr/src/acl3-xdr.h" +.PHONY : $(XDRGENFILES) +$(XDRGENFILES): + @if [ ! -e $@ ]; then ln -s $(xdrsrc)/$@ . ; fi; + +clean-local: + @if [ $(top_builddir) != $(top_srcdir) ]; then \ + rm -f $(xdrdst)/*.x; \ fi |
