Don't duplicate Makefile shell code

Smaller, and conceptually easier to keep in sync,
way of handling build machines with and without git.
This commit is contained in:
Larry Doolittle 2008-05-29 10:37:35 -07:00 committed by Stephen Williams
parent db642e3850
commit d74f2fe38d
1 changed files with 6 additions and 10 deletions

View File

@ -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)