summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2014-04-26 20:19:38 -0700
committerAnand Avati <avati@redhat.com>2014-04-27 10:40:56 -0700
commitf77e5b6ebe5d702065844db141ebd38ff7802168 (patch)
tree1ea7ad07da9b82cbc7aa46f46912c5db3d56f836
parentfbef3a51c501c67ce6814dd16efb87758d855d48 (diff)
rpcgen: After recent changes parallel builds failed
Parallel builds failed due to make file would overrun xdrgen (internally xdrgen uses tempfiles to add License header). Seperate out header and source generation and add explicit dependency to fix it. Change-Id: Id20f548493540b0f17a2300f0775646f9f20789c BUG: 1090807 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-on: http://review.gluster.org/7572 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rwxr-xr-xbuild-aux/xdrgen90
-rw-r--r--rpc/xdr/src/.gitignore2
-rw-r--r--rpc/xdr/src/Makefile.am105
3 files changed, 145 insertions, 52 deletions
diff --git a/build-aux/xdrgen b/build-aux/xdrgen
index b5f33d3..e826111 100755
--- a/build-aux/xdrgen
+++ b/build-aux/xdrgen
@@ -1,23 +1,9 @@
#!/bin/bash
-_init ()
-{
- xfile="$1";
-
- cfile="${1%.x}.c";
- hfile="${1%.x}.h";
-
- tmp_cfile="$1.c";
-
- tmp1_hfile="$1.h.tmp";
- tmp1_cfile="$1.c.tmp";
-
-}
-
append_licence_header ()
{
- src_file=$1;
- dst_file=$2;
+ local src_file=$1;
+ local dst_file=$2;
cat >$dst_file <<EOF
/*
@@ -47,47 +33,65 @@ EOF
}
-main ()
+gen_sources ()
{
- if [ $# -ne 1 ]; then
- echo "wrong number of arguments given"
- echo " $0 <XDR-definition-file>.x"
- exit 1;
- fi
+ local xfile="$1";
+
+ local cfile="${1%.x}.c";
+ local hfile="${1%.x}.h";
+ local tmp_cfile="$1.c.tmp";
+ local tmp_hfile="$1.h.tmp";
- echo -n "writing the XDR routine file ($tmp_cfile) ... ";
+ rm -f $cfile;
+ rpcgen -c -o $cfile $xfile;
+ append_licence_header $cfile $tmp_cfile;
+ mv $tmp_cfile $cfile;
+ # remove unwanted temporary files (if any)
rm -f $tmp_cfile;
- rpcgen -c -o $tmp_cfile $xfile;
+ echo "Generated $cfile"
+ return
+}
+
+gen_headers ()
+{
+ local xfile="$1";
+
+ local cfile="${1%.x}.c";
+ local hfile="${1%.x}.h";
- echo "OK";
+ local tmp_cfile="$1.c.tmp";
+ local tmp_hfile="$1.h.tmp";
# no need for a temporary file here as there are no changes from glusterfs
- echo -n "writing the XDR header file ($hfile) ... ";
rm -f $hfile;
rpcgen -h -o $hfile $xfile;
-
# the '#ifdef' part of file should be fixed
sed -i -e 's/-/_/g' $hfile;
-
- echo "OK";
-
- echo -n "writing licence header to the generated files ... ";
- # Write header to temp file and append generated file
- append_licence_header $hfile $tmp1_hfile;
- append_licence_header $tmp_cfile $tmp1_cfile;
- echo "OK"
-
+ # Gen header to temp file and append generated file
+ append_licence_header $hfile $tmp_hfile;
# now move the destination file to actual original file
- echo -n "updating existing files ... ";
- mv $tmp1_hfile $hfile;
- mv $tmp1_cfile $cfile;
+ mv $tmp_hfile $hfile;
+ rm -f $tmp_hfile;
+ echo "Generated $hfile";
+ return
+}
- # remove unwanted temporary files (if any)
- rm -f $tmp_cfile $tmp1_cfile $tmp1_hfile
+main ()
+{
+ if [ $# -ne 2 ]; then
+ echo "wrong number of arguments given"
+ echo " $0 [header|source] <XDR-definition-file>.x"
+ exit 1;
+ fi
- echo "OK"
+ if [ $1 == "header" ]; then
+ gen_headers $2
+ fi
+ if [ $1 == "source" ]; then
+ gen_sources $2
+ fi
}
-_init "$@" && main "$@";
+main "$@";
diff --git a/rpc/xdr/src/.gitignore b/rpc/xdr/src/.gitignore
index 4fb7f95..f9eab16 100644
--- a/rpc/xdr/src/.gitignore
+++ b/rpc/xdr/src/.gitignore
@@ -16,4 +16,6 @@ portmap-xdr.c
portmap-xdr.h
rpc-common-xdr.c
rpc-common-xdr.h
+mount3udp.c
+mount3udp.h
*-e
diff --git a/rpc/xdr/src/Makefile.am b/rpc/xdr/src/Makefile.am
index e39c677..1c70dc9 100644
--- a/rpc/xdr/src/Makefile.am
+++ b/rpc/xdr/src/Makefile.am
@@ -1,3 +1,8 @@
+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)
+
lib_LTLIBRARIES = libgfxdr.la
libgfxdr_la_CFLAGS = -Wall $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS)
@@ -13,14 +18,96 @@ 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
-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
-XDRHEADERS = glusterfs3-xdr.h cli1-xdr.h nlm4-xdr.h nsm-xdr.h \
- rpc-common-xdr.h glusterd1-xdr.h acl3-xdr.h portmap-xdr.h
+CLEANFILES = $(XDRSOURCES) $(XDRHEADERS)
-%.h:%.x
- $(top_srcdir)/build-aux/xdrgen $(top_srcdir)/rpc/xdr/src/$*.x
-%.c:%.x
- $(top_srcdir)/build-aux/xdrgen $(top_srcdir)/rpc/xdr/src/$*.x
+EXTRA_DIST = $(XDRGENFILES)
-CLEANFILES = $(XDRSOURCES) $(XDRHEADERS)
+glusterfs3-xdr.c: glusterfs3-xdr.x glusterfs3-xdr.h
+ @if test -f $<; then \
+ $(top_srcdir)/build-aux/xdrgen source $< ; \
+ fi
+
+glusterfs3-xdr.h: glusterfs3-xdr.x
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen header $< ; \
+ fi
+
+cli1-xdr.c: cli1-xdr.x cli1-xdr.h
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen source $< ; \
+ fi
+
+cli1-xdr.h: cli1-xdr.x
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen header $< ; \
+ fi
+
+nlm4-xdr.c: nlm4-xdr.x nlm4-xdr.h
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen source $< ; \
+ fi
+
+nlm4-xdr.h: nlm4-xdr.x
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen header $< ; \
+ fi
+
+nsm-xdr.c: nsm-xdr.x nsm-xdr.h
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen source $< ; \
+ fi
+
+nsm-xdr.h: nsm-xdr.x
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen header $< ; \
+ fi
+
+rpc-common-xdr.c: rpc-common-xdr.x rpc-common-xdr.h
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen source $< ; \
+ fi
+
+rpc-common-xdr.h: rpc-common-xdr.x
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen header $< ; \
+ fi
+
+glusterd1-xdr.c: glusterd1-xdr.x glusterd1-xdr.h
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen source $< ; \
+ fi
+
+glusterd1-xdr.h: glusterd1-xdr.x
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen header $< ; \
+ fi
+
+acl3-xdr.c: acl3-xdr.x acl3-xdr.h
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen source $< ; \
+ fi
+
+acl3-xdr.h: acl3-xdr.x
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen header $< ; \
+ fi
+
+portmap-xdr.c: portmap-xdr.x portmap-xdr.h
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen source $< ; \
+ fi
+
+portmap-xdr.h: portmap-xdr.x
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen header $< ; \
+ fi
+
+mount3udp.c: mount3udp.x mount3udp.h
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen source $< ; \
+ fi
+
+mount3udp.h: mount3udp.x
+ @if test -f $< ; then \
+ $(top_srcdir)/build-aux/xdrgen header $< ; \
+ fi