From 844447b995a6db62d30adad00dfcf6700589c993 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Thu, 17 Apr 2008 20:33:39 -0700 Subject: [PATCH] More reliably handle make install from read-only directory commonly, the make install is run in a compiled directory by a different user (i.e. an administrator) that doesn't necessarily have write access to the build directory. This patch fixes it so that the test that the version.h is up to date doesn't need to write a temporary file in the build directory. It also makes sure that if there is a real need to update the verion.h, and it is not writable, then properly fail the build. --- Makefile.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.in b/Makefile.in index a132527cf..36aa3dd6d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -189,9 +189,9 @@ iverilog-vpi.pdf: iverilog-vpi.ps version.h: @if test -d $(srcdir)/.git; then \ echo "Using git-describe for VERSION_TAG"; \ - git --git-dir $(srcdir)/.git describe \ - | sed -e 's;\(.*\);#define VERSION_TAG "\1";' > $@tmp; \ - diff $@tmp $@ > /dev/null 2>&1 || mv $@tmp $@; \ + tmp=`git --git-dir $(srcdir)/.git describe \ + | sed -e 's;\(.*\);#define VERSION_TAG "\1";'`; \ + echo "$$tmp" | diff - $@ > /dev/null 2>&1 || echo "$$tmp" > $@ || exit 1; \ elif test -r $(srcdir)/$@; then \ echo "Using $(srcdir)/$@ for VERSION_TAG"; \ diff $(srcdir)/$@ $@ > /dev/null 2>&1 || cp $(srcdir)/$@ $@; \