Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revise handling of version.h to avoid build problems.

A patch to insert the version string from git broke compilation when
the source was not a git repository or when building in a read-only
source tree.  This patch avoids breaking compilation by using a
graceful failure mechanism for generating the version string and does
not write to the source tree.
  • Loading branch information...
commit bfb33230aa1b0161fab249fb5eddac3dc2f0ea62 1 parent 44767d8
J Varshney authored committed
Showing with 17 additions and 4 deletions.
  1. +17 −4 Makefile.in
21 Makefile.in
View
@@ -182,10 +182,23 @@ iverilog-vpi.ps: $(srcdir)/iverilog-vpi.man
iverilog-vpi.pdf: iverilog-vpi.ps
ps2pdf iverilog-vpi.ps iverilog-vpi.pdf
-version.h: .git/index
- git --git-dir $(srcdir)/.git describe \
- | sed -e 's;\(.*\);#define VERSION_TAG "\1";' > $@tmp
- diff $@tmp $(srcdir)/$@ > /dev/null 2>&1 || mv $@tmp $(srcdir)/$@
+# For VERSION_TAG in driver/main.c, first try git-describe, then look for a
+# version.h file in the source tree (included in snapshots and releases), and
+# finally use nothing.
+.PHONY: version.h
+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 $@; \
+ elif test -r $(srcdir)/$@; then \
+ echo "Using $(srcdir)/$@ for VERSION_TAG"; \
+ diff $(srcdir)/$@ $@ > /dev/null 2>&1 || cp $(srcdir)/$@ $@; \
+ else \
+ echo "Using empty VERSION_TAG"; \
+ echo '#define VERSION_TAG ""' > $@; \
+ fi
ifeq (@MING32@,yes)
INSTALL_DOC = $(prefix)/iverilog-vpi.pdf $(mandir)/man1/iverilog-vpi.1
Please sign in to comment.
Something went wrong with that request. Please try again.