From c5426a13ad28fb2c6f0ed62404dbe60ea0dfaad2 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Mon, 19 Sep 2016 09:13:09 -0400 Subject: build: rpc/xdr .c and .h files are regenerated unnecessarily .c and .h files are blindly (re)generated. If you run `make` followed by a second `make` or `make install` the subsequent `make` will unnecessarily recompile everything because of the redundant regeneration of the .c and .h files are now newer than the prior builds .o files Change-Id: I7e477bcdcc20869e144ada7e6d91e7221b8ee71f BUG: 1377341 Signed-off-by: Kaleb S. KEITHLEY Reviewed-on: http://review.gluster.org/15530 Smoke: Gluster Build System Reviewed-by: Niels de Vos Tested-by: Niels de Vos CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Anoop C S --- rpc/xdr/src/Makefile.am | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'rpc/xdr') diff --git a/rpc/xdr/src/Makefile.am b/rpc/xdr/src/Makefile.am index 73640614c55..10487e27664 100644 --- a/rpc/xdr/src/Makefile.am +++ b/rpc/xdr/src/Makefile.am @@ -39,14 +39,18 @@ xdrsrc=$(top_srcdir)/rpc/xdr/src # could use a '-' (i.e. -@rpcgen ...) and suffer with noisy warnings # in the build. Or we do this crufty thing instead. $(XDRSOURCES): $(XDRHEADERS) - @rpcgen -c -o $(@:.c=.tmp) $(@:.c=.x) && mv $(@:.c=.tmp) $@ + @if [ ! -e $@ -o $(@:.c=.x) -nt $@ ]; then \ + rpcgen -c -o $(@:.c=.tmp) $(@:.c=.x) && mv $(@:.c=.tmp) $@ ; \ + fi # d*mn sed in netbsd6 doesn't do -i (inline) # (why are we still running smoke on netbsd6 and not netbsd7?) $(XDRHEADERS): $(XDRGENFILES) - @rpcgen -h -o $(@:.h=.tmp) $(@:.h=.x) - @sed -e '/#ifndef/ s/-/_/g' -e '/#define/ s/-/_/g' -e '/#endif/ s/-/_/' \ - $(@:.h=.tmp) > $@ && rm -f $(@:.h=.tmp) + @if [ ! -e $@ -o $(@:.h=.x) -nt $@ ]; then \ + rpcgen -h -o $(@:.h=.tmp) $(@:.h=.x) ; \ + sed -e '/#ifndef/ s/-/_/g' -e '/#define/ s/-/_/g' -e '/#endif/ s/-/_/' \ + $(@:.h=.tmp) > $@ && 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 -- cgit