From d74f2fe38d1111c01a908345afae1af271cbef18 Mon Sep 17 00:00:00 2001 From: Larry Doolittle Date: Thu, 29 May 2008 10:37:35 -0700 Subject: [PATCH] Don't duplicate Makefile shell code Smaller, and conceptually easier to keep in sync, way of handling build machines with and without git. --- Makefile.in | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Makefile.in b/Makefile.in index 6bde10e07..a5be31f9b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -186,17 +186,14 @@ iverilog-vpi.pdf: iverilog-vpi.ps # version.h file in the source tree (included in snapshots and releases), and # finally use nothing. .PHONY: version.h -version.h: +# "true" and "false" in the next few lines are Unix shell command names ifeq ($(GIT),none) - @if 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 +GIT_PRESENT = false else - @if test -d $(srcdir)/.git; then \ +GIT_PRESENT = true +endif +version.h: + @if $(GIT_PRESENT) && test -d $(srcdir)/.git; then \ echo "Using git-describe for VERSION_TAG"; \ tmp=`$(GIT) --git-dir $(srcdir)/.git describe \ | sed -e 's;\(.*\);#define VERSION_TAG "\1";'`; \ @@ -208,7 +205,6 @@ else echo "Using empty VERSION_TAG"; \ echo '#define VERSION_TAG ""' > $@; \ fi -endif ifeq (@MINGW32@,yes) ifeq ($(MAN),none)