Permalink
Browse files

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.
  • Loading branch information...
1 parent 6eb9825 commit 844447b995a6db62d30adad00dfcf6700589c993 @steveicarus committed Apr 18, 2008
Showing with 3 additions and 3 deletions.
  1. +3 −3 Makefile.in
View
@@ -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)/$@ $@; \

0 comments on commit 844447b

Please sign in to comment.